MOBILE-2915 split: Fix call split push too soon

main
Dani Palou 2019-03-25 14:33:51 +01:00
parent c0697e4436
commit 08d7d6e1f9
1 changed files with 18 additions and 10 deletions

View File

@ -49,7 +49,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
@ViewChild('menu') menu: Menu;
@Input() when?: string | boolean = 'md';
protected isEnabled = false;
protected isEnabled;
protected masterPageName = '';
protected masterPageIndex = 0;
protected loadDetailPage: any = false;
@ -174,7 +174,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
* @return {boolean} If split view is enabled.
*/
isOn(): boolean {
return this.isEnabled;
return !!this.isEnabled;
}
/**
@ -182,8 +182,15 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
*
* @param {any} page The component class or deeplink name you want to push onto the navigation stack.
* @param {any} params Any NavParams you want to pass along to the next view.
* @param {boolean} [retrying] Whether it's retrying.
*/
push(page: any, params?: any): void {
push(page: any, params?: any, retrying?: boolean): void {
if (typeof this.isEnabled == 'undefined' && !retrying) {
// Hasn't calculated if it's enabled yet. Wait a bit and try again.
setTimeout(() => {
this.push(page, params, true);
}, 200);
} else {
if (this.isEnabled) {
this.detailNav.setRoot(page, params);
} else {
@ -194,6 +201,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
this.masterNav.push(page, params);
}
}
}
/**
* Set the details panel to default info.