@@ -64,9 +64,10 @@ class _PresentAlertOperation extends _Task {
6464 this . _isAlertPresented = false ;
6565 this . _alertSoftButtonClearListener = alertSoftButtonClearListener ;
6666
67- this . _alertView . canceledListener = function ( ) {
67+ this . _alertView . canceledListener = ( ) => {
6868 this . cancelAlert ( ) ;
6969 } ;
70+ alertView . canceledListener = this . _alertView . canceledListener ;
7071 }
7172
7273 /**
@@ -257,7 +258,7 @@ class _PresentAlertOperation extends _Task {
257258 */
258259 async cancelAlert ( ) {
259260 if ( this . getState ( ) === _Task . FINISHED ) {
260- console . logInfo ( 'This operation has already finished so it can not be canceled' ) ;
261+ console . log ( 'This operation has already finished so it can not be canceled' ) ;
261262 return ;
262263 } else if ( this . getState ( ) === _Task . CANCELED ) {
263264 console . log ( 'This operation has already been canceled. It will be finished at some point during the operation.' ) ;
@@ -266,12 +267,17 @@ class _PresentAlertOperation extends _Task {
266267 if ( this . _lifecycleManager !== null && this . _lifecycleManager . getSdlMsgVersion ( ) !== null && this . _lifecycleManager . getSdlMsgVersion ( ) . getMajorVersion ( ) < 6 ) {
267268 console . log ( 'Attempting to cancel this operation in-progress; if the alert is already presented on the module, it cannot be dismissed.' ) ;
268269 this . switchStates ( _Task . CANCELED ) ;
270+ return ;
269271 } else if ( ! this . _isAlertPresented ) {
270272 console . log ( 'Alert has not yet been sent to the module. Alert will not be shown.' ) ;
273+ this . switchStates ( _Task . CANCELED ) ;
274+ return ;
271275 }
272276 console . log ( 'Canceling the presented alert' ) ;
273277
274- const cancelInteraction = new CancelInteraction ( FunctionID . Alert , this . _cancelId ) ;
278+ const cancelInteraction = new CancelInteraction ( )
279+ . setFunctionIDParam ( FunctionID . Alert )
280+ . setCancelID ( this . _cancelId ) ;
275281 const response = await this . _lifecycleManager . sendRpcResolve ( cancelInteraction ) ;
276282 if ( ! response . getSuccess ( ) ) {
277283 console . log ( `Error canceling the presented alert: ${ response . getInfo ( ) } ` ) ;
0 commit comments