File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
src/core/features/pushnotifications/services Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ export class CorePushNotificationsDelegateService {
108108 handlers = handlers . sort ( ( a , b ) => ( a . priority || 0 ) <= ( b . priority || 0 ) ? 1 : - 1 ) ;
109109
110110 // Execute the first one.
111- handlers [ 0 ] ?. handleClick ( notification ) ;
111+ await handlers [ 0 ] ?. handleClick ( notification ) ;
112112 }
113113
114114 /**
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ import { CorePlatform } from '@services/platform';
5454import { CoreAnalytics , CoreAnalyticsEventType } from '@services/analytics' ;
5555import { CoreSiteInfo } from '@classes/sites/unauthenticated-site' ;
5656import { Push } from '@features/native/plugins' ;
57+ import { CoreNavigator } from '@services/navigator' ;
58+ import { CoreWait } from '@singletons/wait' ;
5759
5860/**
5961 * Service to handle push notifications.
@@ -442,7 +444,26 @@ export class CorePushNotificationsProvider {
442444 async notificationClicked ( data : CorePushNotificationsNotificationBasicData ) : Promise < void > {
443445 await ApplicationInit . donePromise ;
444446
445- CorePushNotificationsDelegate . clicked ( data ) ;
447+ if ( CoreSites . isLoggedIn ( ) ) {
448+ CoreSites . runAfterLoginNavigation ( {
449+ priority : 600 ,
450+ callback : async ( ) => {
451+ await CorePushNotificationsDelegate . clicked ( data ) ;
452+ } ,
453+ } ) ;
454+
455+ return ;
456+ }
457+
458+ // User not logged in, wait for the path to be a "valid" path (not a parent path used when starting the app).
459+ await CoreWait . waitFor ( ( ) => {
460+ const currentPath = CoreNavigator . getCurrentPath ( ) ;
461+
462+ return currentPath !== '/' && currentPath !== '/login' ;
463+ } , { timeout : 400 } ) ;
464+
465+ await CorePushNotificationsDelegate . clicked ( data ) ;
466+
446467 }
447468
448469 /**
You can’t perform that action at this time.
0 commit comments