@@ -150,15 +150,17 @@ export const contentScriptSetupIfVacant = async (webmailSpecific: WebmailSpecifi
150150 relayManager : RelayManager ,
151151 ppEvent : { entered ?: boolean }
152152 ) => {
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 ;
154155 if ( $ ( `.secure_compose_window.active[data-frame-id="${ frameId } "]` ) . length ) {
155156 return ; // already active
156157 }
157158 $ ( `.secure_compose_window` ) . removeClass ( 'previous_active' ) ;
158159 $ ( `.secure_compose_window.active` ) . addClass ( 'previous_active' ) . removeClass ( 'active' ) ;
159160 $ ( `.secure_compose_window[data-frame-id="${ frameId } "]` ) . addClass ( 'active' ) ;
160161 } ) ;
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 ;
162164 $ ( `.secure_compose_window[data-frame-id="${ frameId } "]` ) . remove ( ) ;
163165 if ( $ ( '.secure_compose_window.previous_active:not(.minimized)' ) . length ) {
164166 BrowserMsg . send . focusPreviousActiveWindow ( tabId , {
@@ -184,59 +186,74 @@ export const contentScriptSetupIfVacant = async (webmailSpecific: WebmailSpecifi
184186 }
185187 $ ( 'body' ) . trigger ( 'focus' ) ;
186188 } ) ;
187- BrowserMsg . addListener ( 'focus_frame' , async ( { frameId } : Bm . ComposeWindow ) => {
189+ BrowserMsg . addListener ( 'focus_frame' , async req => {
190+ const { frameId } = req as Bm . ComposeWindow ;
188191 $ ( `iframe#${ frameId } ` ) . trigger ( 'focus' ) ;
189192 } ) ;
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 ;
191195 $ ( `iframe#${ frameId } ` ) . remove ( ) ;
192196 } ) ;
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 ;
194199 webmailSpecific . getReplacer ( ) . reinsertReplyBox ( replyMsgId ) ;
195200 } ) ;
196201 BrowserMsg . addListener ( 'close_dialog' , async ( ) => {
197202 Swal . close ( ) ;
198203 } ) ;
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 ;
200206 webmailSpecific . getReplacer ( ) . scrollToReplyBox ( replyMsgId ) ;
201207 } ) ;
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 ;
203210 webmailSpecific . getReplacer ( ) . scrollToCursorInReplyBox ( replyMsgId , cursorOffsetTop ) ;
204211 } ) ;
205- BrowserMsg . addListener ( 'passphrase_dialog' , async ( args : Bm . PassphraseDialog ) => {
212+ BrowserMsg . addListener ( 'passphrase_dialog' , async req => {
213+ const args = req as Bm . PassphraseDialog ;
206214 await showPassphraseDialog ( factory , args ) ;
207215 } ) ;
208- BrowserMsg . addListener ( 'passphrase_entry' , async ( { entered } : Bm . PassphraseEntry ) => {
216+ BrowserMsg . addListener ( 'passphrase_entry' , async req => {
217+ const { entered } = req as Bm . PassphraseEntry ;
209218 ppEvent . entered = entered ;
210219 } ) ;
211220 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 ;
213223 await factory . showAddPubkeyDialog ( emails ) ;
214224 } ) ;
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 ;
216227 relayManager . associate ( frameId , messageSender ) ;
217228 } ) ;
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 ;
219231 relayManager . retry ( frameId , messageSender ) ;
220232 } ) ;
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 ;
222235 notifications . show ( notification , callbacks , group ) ;
223236 $ ( 'body' ) . one (
224237 'click' ,
225238 Catch . try ( ( ) => notifications . clear ( group ) )
226239 ) ;
227240 } ) ;
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 ;
229243 notifications . showAuthPopupNeeded ( acctEmail ) ;
230244 } ) ;
231245 BrowserMsg . addListener ( 'reply_pubkey_mismatch' , BrowserMsgCommonHandlers . replyPubkeyMismatch ) ;
232246 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 ;
234249 await Ui . modal . attachmentPreview ( iframeUrl ) ;
235250 } ) ;
236- BrowserMsg . addListener ( 'ajax_progress' , async ( progress : Bm . AjaxProgress ) => {
251+ BrowserMsg . addListener ( 'ajax_progress' , async req => {
252+ const progress = req as Bm . AjaxProgress ;
237253 relayManager . renderProgress ( progress ) ;
238254 } ) ;
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 ;
240257 const traverseUpLevels = traverseUp || 0 ;
241258 let appendAfter = $ ( `iframe#${ afterFrameId } ` ) ;
242259 for ( let i = 0 ; i < traverseUpLevels ; i ++ ) {
0 commit comments