1
1
import { Injectable } from "@angular/core" ;
2
2
import { LocationStrategy } from "@angular/common" ;
3
3
import { DefaultUrlSerializer , UrlSegmentGroup , UrlTree } from "@angular/router" ;
4
- import { routerLog } from "../trace" ;
4
+ import { routerLog , routerError } from "../trace" ;
5
5
import { NavigationTransition , Frame } from "tns-core-modules/ui/frame" ;
6
6
import { isPresent } from "../lang-facade" ;
7
7
import { FrameService } from "../platform-providers" ;
@@ -286,10 +286,11 @@ export class NSLocationStrategy extends LocationStrategy {
286
286
287
287
// Methods for syncing with page navigation in PageRouterOutlet
288
288
public _beginBackPageNavigation ( name : string , frame : Frame ) {
289
- routerLog ( "NSLocationStrategy.startGoBack()" ) ;
290
289
if ( this . _isPageNavigationBack ) {
291
- throw new Error ( "Calling startGoBack while going back." ) ;
290
+ routerError ( "Attempted to call startGoBack while going back." ) ;
291
+ return ;
292
292
}
293
+ routerLog ( "NSLocationStrategy.startGoBack()" ) ;
293
294
this . _isPageNavigationBack = true ;
294
295
295
296
let { cachedFrame } = this . frameService . findFrame ( frame ) ;
@@ -302,10 +303,11 @@ export class NSLocationStrategy extends LocationStrategy {
302
303
}
303
304
304
305
public _finishBackPageNavigation ( ) {
305
- routerLog ( "NSLocationStrategy.finishBackPageNavigation()" ) ;
306
306
if ( ! this . _isPageNavigationBack ) {
307
- throw new Error ( "Calling endGoBack while not going back." ) ;
307
+ routerError ( "Attempted to call endGoBack while not going back." ) ;
308
+ return ;
308
309
}
310
+ routerLog ( "NSLocationStrategy.finishBackPageNavigation()" ) ;
309
311
this . _isPageNavigationBack = false ;
310
312
}
311
313
@@ -314,33 +316,35 @@ export class NSLocationStrategy extends LocationStrategy {
314
316
}
315
317
316
318
public _beginModalNavigation ( frame : Frame ) : void {
317
- routerLog ( "NSLocationStrategy._beginModalNavigation()" ) ;
319
+ routerLog ( "NSLocationStrategy._beginModalNavigation()" ) ;
318
320
319
- let { cachedFrameRootOutlet } = this . frameService . findFrame ( frame ) ;
321
+ let { cachedFrameRootOutlet } = this . frameService . findFrame ( frame ) ;
320
322
321
- const lastState = this . peekState ( cachedFrameRootOutlet || this . currentOutlet ) ;
323
+ const lastState = this . peekState ( cachedFrameRootOutlet || this . currentOutlet ) ;
322
324
323
- if ( lastState ) {
324
- lastState . isModalNavigation = true ;
325
- }
325
+ if ( lastState ) {
326
+ lastState . isModalNavigation = true ;
327
+ }
326
328
327
- this . _isModalNavigation = true ;
328
- }
329
+ this . _isModalNavigation = true ;
330
+ }
329
331
330
332
public _beginCloseModalNavigation ( ) : void {
331
- routerLog ( "NSLocationStrategy.startCloseModal()" ) ;
332
333
if ( this . _isModalClosing ) {
333
- throw new Error ( "Calling startCloseModal while closing modal." ) ;
334
+ routerError ( "Attempted to call startCloseModal while closing modal." ) ;
335
+ return ;
334
336
}
337
+ routerLog ( "NSLocationStrategy.startCloseModal()" ) ;
335
338
this . _isModalClosing = true ;
336
339
}
337
340
338
341
public _finishCloseModalNavigation ( ) {
339
- routerLog ( "NSLocationStrategy.finishCloseModalNavigation()" ) ;
340
342
if ( ! this . _isModalClosing ) {
341
- throw new Error ( "Calling startCloseModal while not closing modal." ) ;
343
+ routerError ( "Attempted to call startCloseModal while not closing modal." ) ;
344
+ return ;
342
345
}
343
346
347
+ routerLog ( "NSLocationStrategy.finishCloseModalNavigation()" ) ;
344
348
this . _isModalNavigation = false ;
345
349
this . _isModalClosing = false ;
346
350
}
0 commit comments