@@ -150,15 +150,17 @@ export const contentScriptSetupIfVacant = async (webmailSpecific: WebmailSpecifi
150
150
relayManager : RelayManager ,
151
151
ppEvent : { entered ?: boolean }
152
152
) => {
153
- BrowserMsg . addListener ( 'set_active_window' , async ( { frameId } : Bm . ComposeWindow ) => {
153
+ BrowserMsg . addListener ( 'set_active_window' , async req => {
154
+ const { frameId } = req as Bm . ComposeWindow ;
154
155
if ( $ ( `.secure_compose_window.active[data-frame-id="${ frameId } "]` ) . length ) {
155
156
return ; // already active
156
157
}
157
158
$ ( `.secure_compose_window` ) . removeClass ( 'previous_active' ) ;
158
159
$ ( `.secure_compose_window.active` ) . addClass ( 'previous_active' ) . removeClass ( 'active' ) ;
159
160
$ ( `.secure_compose_window[data-frame-id="${ frameId } "]` ) . addClass ( 'active' ) ;
160
161
} ) ;
161
- BrowserMsg . addListener ( 'close_compose_window' , async ( { frameId } : Bm . ComposeWindow ) => {
162
+ BrowserMsg . addListener ( 'close_compose_window' , async req => {
163
+ const { frameId } = req as Bm . ComposeWindow ;
162
164
$ ( `.secure_compose_window[data-frame-id="${ frameId } "]` ) . remove ( ) ;
163
165
if ( $ ( '.secure_compose_window.previous_active:not(.minimized)' ) . length ) {
164
166
BrowserMsg . send . focusPreviousActiveWindow ( tabId , {
@@ -184,59 +186,74 @@ export const contentScriptSetupIfVacant = async (webmailSpecific: WebmailSpecifi
184
186
}
185
187
$ ( 'body' ) . trigger ( 'focus' ) ;
186
188
} ) ;
187
- BrowserMsg . addListener ( 'focus_frame' , async ( { frameId } : Bm . ComposeWindow ) => {
189
+ BrowserMsg . addListener ( 'focus_frame' , async req => {
190
+ const { frameId } = req as Bm . ComposeWindow ;
188
191
$ ( `iframe#${ frameId } ` ) . trigger ( 'focus' ) ;
189
192
} ) ;
190
- BrowserMsg . addListener ( 'close_reply_message' , async ( { frameId } : Bm . ComposeWindow ) => {
193
+ BrowserMsg . addListener ( 'close_reply_message' , async req => {
194
+ const { frameId } = req as Bm . ComposeWindow ;
191
195
$ ( `iframe#${ frameId } ` ) . remove ( ) ;
192
196
} ) ;
193
- BrowserMsg . addListener ( 'reinsert_reply_box' , async ( { replyMsgId } : Bm . ReinsertReplyBox ) => {
197
+ BrowserMsg . addListener ( 'reinsert_reply_box' , async req => {
198
+ const { replyMsgId } = req as Bm . ReinsertReplyBox ;
194
199
webmailSpecific . getReplacer ( ) . reinsertReplyBox ( replyMsgId ) ;
195
200
} ) ;
196
201
BrowserMsg . addListener ( 'close_dialog' , async ( ) => {
197
202
Swal . close ( ) ;
198
203
} ) ;
199
- BrowserMsg . addListener ( 'scroll_to_reply_box' , async ( { replyMsgId } : Bm . ScrollToReplyBox ) => {
204
+ BrowserMsg . addListener ( 'scroll_to_reply_box' , async req => {
205
+ const { replyMsgId } = req as Bm . ScrollToReplyBox ;
200
206
webmailSpecific . getReplacer ( ) . scrollToReplyBox ( replyMsgId ) ;
201
207
} ) ;
202
- BrowserMsg . addListener ( 'scroll_to_cursor_in_reply_box' , async ( { replyMsgId, cursorOffsetTop } : Bm . ScrollToCursorInReplyBox ) => {
208
+ BrowserMsg . addListener ( 'scroll_to_cursor_in_reply_box' , async req => {
209
+ const { replyMsgId, cursorOffsetTop } = req as Bm . ScrollToCursorInReplyBox ;
203
210
webmailSpecific . getReplacer ( ) . scrollToCursorInReplyBox ( replyMsgId , cursorOffsetTop ) ;
204
211
} ) ;
205
- BrowserMsg . addListener ( 'passphrase_dialog' , async ( args : Bm . PassphraseDialog ) => {
212
+ BrowserMsg . addListener ( 'passphrase_dialog' , async req => {
213
+ const args = req as Bm . PassphraseDialog ;
206
214
await showPassphraseDialog ( factory , args ) ;
207
215
} ) ;
208
- BrowserMsg . addListener ( 'passphrase_entry' , async ( { entered } : Bm . PassphraseEntry ) => {
216
+ BrowserMsg . addListener ( 'passphrase_entry' , async req => {
217
+ const { entered } = req as Bm . PassphraseEntry ;
209
218
ppEvent . entered = entered ;
210
219
} ) ;
211
220
BrowserMsg . addListener ( 'confirmation_show' , CommonHandlers . showConfirmationHandler ) ;
212
- BrowserMsg . addListener ( 'add_pubkey_dialog' , async ( { emails } : Bm . AddPubkeyDialog ) => {
221
+ BrowserMsg . addListener ( 'add_pubkey_dialog' , async req => {
222
+ const { emails } = req as Bm . AddPubkeyDialog ;
213
223
await factory . showAddPubkeyDialog ( emails ) ;
214
224
} ) ;
215
- BrowserMsg . addListener ( 'pgp_block_ready' , async ( { frameId, messageSender } : Bm . PgpBlockReady ) => {
225
+ BrowserMsg . addListener ( 'pgp_block_ready' , async req => {
226
+ const { frameId, messageSender } = req as Bm . PgpBlockReady ;
216
227
relayManager . associate ( frameId , messageSender ) ;
217
228
} ) ;
218
- BrowserMsg . addListener ( 'pgp_block_retry' , async ( { frameId, messageSender } : Bm . PgpBlockRetry ) => {
229
+ BrowserMsg . addListener ( 'pgp_block_retry' , async req => {
230
+ const { frameId, messageSender } = req as Bm . PgpBlockRetry ;
219
231
relayManager . retry ( frameId , messageSender ) ;
220
232
} ) ;
221
- BrowserMsg . addListener ( 'notification_show' , async ( { notification, callbacks, group } : Bm . NotificationShow ) => {
233
+ BrowserMsg . addListener ( 'notification_show' , async req => {
234
+ const { notification, callbacks, group } = req as Bm . NotificationShow ;
222
235
notifications . show ( notification , callbacks , group ) ;
223
236
$ ( 'body' ) . one (
224
237
'click' ,
225
238
Catch . try ( ( ) => notifications . clear ( group ) )
226
239
) ;
227
240
} ) ;
228
- BrowserMsg . addListener ( 'notification_show_auth_popup_needed' , async ( { acctEmail } : Bm . NotificationShowAuthPopupNeeded ) => {
241
+ BrowserMsg . addListener ( 'notification_show_auth_popup_needed' , async req => {
242
+ const { acctEmail } = req as Bm . NotificationShowAuthPopupNeeded ;
229
243
notifications . showAuthPopupNeeded ( acctEmail ) ;
230
244
} ) ;
231
245
BrowserMsg . addListener ( 'reply_pubkey_mismatch' , BrowserMsgCommonHandlers . replyPubkeyMismatch ) ;
232
246
BrowserMsg . addListener ( 'add_end_session_btn' , ( ) => inject . insertEndSessionBtn ( acctEmail ) ) ;
233
- BrowserMsg . addListener ( 'show_attachment_preview' , async ( { iframeUrl } : Bm . ShowAttachmentPreview ) => {
247
+ BrowserMsg . addListener ( 'show_attachment_preview' , async req => {
248
+ const { iframeUrl } = req as Bm . ShowAttachmentPreview ;
234
249
await Ui . modal . attachmentPreview ( iframeUrl ) ;
235
250
} ) ;
236
- BrowserMsg . addListener ( 'ajax_progress' , async ( progress : Bm . AjaxProgress ) => {
251
+ BrowserMsg . addListener ( 'ajax_progress' , async req => {
252
+ const progress = req as Bm . AjaxProgress ;
237
253
relayManager . renderProgress ( progress ) ;
238
254
} ) ;
239
- BrowserMsg . addListener ( 'render_public_keys' , async ( { traverseUp, afterFrameId, publicKeys } : Bm . RenderPublicKeys ) => {
255
+ BrowserMsg . addListener ( 'render_public_keys' , async req => {
256
+ const { traverseUp, afterFrameId, publicKeys } = req as Bm . RenderPublicKeys ;
240
257
const traverseUpLevels = traverseUp || 0 ;
241
258
let appendAfter = $ ( `iframe#${ afterFrameId } ` ) ;
242
259
for ( let i = 0 ; i < traverseUpLevels ; i ++ ) {
0 commit comments