11import { Injectable } from "@angular/core" ;
22import { LocationStrategy } from "@angular/common" ;
33import { DefaultUrlSerializer , UrlSegmentGroup , UrlTree } from "@angular/router" ;
4- import { routerLog } from "../trace" ;
4+ import { routerLog , routerError } from "../trace" ;
55import { NavigationTransition , Frame } from "tns-core-modules/ui/frame" ;
66import { isPresent } from "../lang-facade" ;
77import { FrameService } from "../platform-providers" ;
@@ -286,10 +286,11 @@ export class NSLocationStrategy extends LocationStrategy {
286286
287287 // Methods for syncing with page navigation in PageRouterOutlet
288288 public _beginBackPageNavigation ( name : string , frame : Frame ) {
289- routerLog ( "NSLocationStrategy.startGoBack()" ) ;
290289 if ( this . _isPageNavigationBack ) {
291- throw new Error ( "Calling startGoBack while going back." ) ;
290+ routerError ( "Attempted to call startGoBack while going back." ) ;
291+ return ;
292292 }
293+ routerLog ( "NSLocationStrategy.startGoBack()" ) ;
293294 this . _isPageNavigationBack = true ;
294295
295296 let { cachedFrame } = this . frameService . findFrame ( frame ) ;
@@ -302,10 +303,11 @@ export class NSLocationStrategy extends LocationStrategy {
302303 }
303304
304305 public _finishBackPageNavigation ( ) {
305- routerLog ( "NSLocationStrategy.finishBackPageNavigation()" ) ;
306306 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 ;
308309 }
310+ routerLog ( "NSLocationStrategy.finishBackPageNavigation()" ) ;
309311 this . _isPageNavigationBack = false ;
310312 }
311313
@@ -314,33 +316,35 @@ export class NSLocationStrategy extends LocationStrategy {
314316 }
315317
316318 public _beginModalNavigation ( frame : Frame ) : void {
317- routerLog ( "NSLocationStrategy._beginModalNavigation()" ) ;
319+ routerLog ( "NSLocationStrategy._beginModalNavigation()" ) ;
318320
319- let { cachedFrameRootOutlet } = this . frameService . findFrame ( frame ) ;
321+ let { cachedFrameRootOutlet } = this . frameService . findFrame ( frame ) ;
320322
321- const lastState = this . peekState ( cachedFrameRootOutlet || this . currentOutlet ) ;
323+ const lastState = this . peekState ( cachedFrameRootOutlet || this . currentOutlet ) ;
322324
323- if ( lastState ) {
324- lastState . isModalNavigation = true ;
325- }
325+ if ( lastState ) {
326+ lastState . isModalNavigation = true ;
327+ }
326328
327- this . _isModalNavigation = true ;
328- }
329+ this . _isModalNavigation = true ;
330+ }
329331
330332 public _beginCloseModalNavigation ( ) : void {
331- routerLog ( "NSLocationStrategy.startCloseModal()" ) ;
332333 if ( this . _isModalClosing ) {
333- throw new Error ( "Calling startCloseModal while closing modal." ) ;
334+ routerError ( "Attempted to call startCloseModal while closing modal." ) ;
335+ return ;
334336 }
337+ routerLog ( "NSLocationStrategy.startCloseModal()" ) ;
335338 this . _isModalClosing = true ;
336339 }
337340
338341 public _finishCloseModalNavigation ( ) {
339- routerLog ( "NSLocationStrategy.finishCloseModalNavigation()" ) ;
340342 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 ;
342345 }
343346
347+ routerLog ( "NSLocationStrategy.finishCloseModalNavigation()" ) ;
344348 this . _isModalNavigation = false ;
345349 this . _isModalClosing = false ;
346350 }
0 commit comments