@@ -50,18 +50,18 @@ export class CoreMainMenuDeepLinkManager {
5050 /**
5151 * Treat a deep link if there's any to treat.
5252 */
53- treatLink ( ) : void {
54- if ( ! this . pendingRedirect ) {
53+ async treatLink ( ) : Promise < void > {
54+ const pendingRedirect = this . pendingRedirect ;
55+ if ( ! pendingRedirect ) {
5556 return ;
5657 }
5758
58- if ( this . pendingRedirect . redirectPath ) {
59- this . treatPath ( this . pendingRedirect . redirectPath , this . pendingRedirect . redirectOptions ) ;
60- } else if ( this . pendingRedirect . urlToOpen ) {
61- this . treatUrlToOpen ( this . pendingRedirect . urlToOpen ) ;
62- }
63-
6459 delete this . pendingRedirect ;
60+ if ( pendingRedirect . redirectPath ) {
61+ await this . treatPath ( pendingRedirect . redirectPath , pendingRedirect . redirectOptions ) ;
62+ } else if ( pendingRedirect . urlToOpen ) {
63+ await this . treatUrlToOpen ( pendingRedirect . urlToOpen ) ;
64+ }
6565 }
6666
6767 /**
@@ -70,18 +70,18 @@ export class CoreMainMenuDeepLinkManager {
7070 * @param path Path.
7171 * @param navOptions Navigation options.
7272 */
73- protected treatPath ( path : string , navOptions : CoreNavigationOptions = { } ) : void {
73+ protected async treatPath ( path : string , navOptions : CoreNavigationOptions = { } ) : Promise < void > {
7474 const params = navOptions . params ;
7575 const coursePathMatches = path . match ( / ^ c o u r s e \/ ( \d + ) \/ ? $ / ) ;
7676
7777 if ( coursePathMatches ) {
7878 if ( ! params ?. course ) {
79- CoreCourseHelper . getAndOpenCourse ( Number ( coursePathMatches [ 1 ] ) , params ) ;
79+ await CoreCourseHelper . getAndOpenCourse ( Number ( coursePathMatches [ 1 ] ) , params ) ;
8080 } else {
81- CoreCourse . openCourse ( params . course , navOptions ) ;
81+ await CoreCourse . openCourse ( params . course , navOptions ) ;
8282 }
8383 } else {
84- CoreNavigator . navigateToSitePath ( path , {
84+ await CoreNavigator . navigateToSitePath ( path , {
8585 ...navOptions ,
8686 preferCurrentTab : false ,
8787 } ) ;
@@ -96,7 +96,7 @@ export class CoreMainMenuDeepLinkManager {
9696 protected async treatUrlToOpen ( url : string ) : Promise < void > {
9797 const action = await CoreContentLinksHelper . getFirstValidActionFor ( url ) ;
9898 if ( action ?. sites ?. [ 0 ] ) {
99- action . action ( action . sites [ 0 ] ) ;
99+ await action . action ( action . sites [ 0 ] ) ;
100100 }
101101 }
102102
0 commit comments