MOBILE-3068 splitview: Force only one push at a time
parent
886880a2f0
commit
a604b1d6a0
|
@ -60,6 +60,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
|
||||||
protected ignoreSplitChanged = false;
|
protected ignoreSplitChanged = false;
|
||||||
protected audioCaptureSubscription: Subscription;
|
protected audioCaptureSubscription: Subscription;
|
||||||
protected languageChangedSubscription: Subscription;
|
protected languageChangedSubscription: Subscription;
|
||||||
|
protected pushOngoing: boolean;
|
||||||
|
|
||||||
// Empty placeholder for the 'detail' page.
|
// Empty placeholder for the 'detail' page.
|
||||||
detailPage: any = null;
|
detailPage: any = null;
|
||||||
|
@ -185,20 +186,29 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy {
|
||||||
* @param {boolean} [retrying] Whether it's retrying.
|
* @param {boolean} [retrying] Whether it's retrying.
|
||||||
*/
|
*/
|
||||||
push(page: any, params?: any, retrying?: boolean): void {
|
push(page: any, params?: any, retrying?: boolean): void {
|
||||||
|
// Check there's no ongoing push.
|
||||||
|
if (!this.pushOngoing) {
|
||||||
if (typeof this.isEnabled == 'undefined' && !retrying) {
|
if (typeof this.isEnabled == 'undefined' && !retrying) {
|
||||||
// Hasn't calculated if it's enabled yet. Wait a bit and try again.
|
// Hasn't calculated if it's enabled yet. Wait a bit and try again.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.push(page, params, true);
|
this.push(page, params, true);
|
||||||
}, 200);
|
}, 200);
|
||||||
} else {
|
} else {
|
||||||
|
this.pushOngoing = true;
|
||||||
|
let promise;
|
||||||
|
|
||||||
if (this.isEnabled) {
|
if (this.isEnabled) {
|
||||||
this.detailNav.setRoot(page, params);
|
promise = this.detailNav.setRoot(page, params);
|
||||||
} else {
|
} else {
|
||||||
this.loadDetailPage = {
|
this.loadDetailPage = {
|
||||||
component: page,
|
component: page,
|
||||||
data: params
|
data: params
|
||||||
};
|
};
|
||||||
this.masterNav.push(page, params);
|
promise = this.masterNav.push(page, params);
|
||||||
|
}
|
||||||
|
promise.finally(() => {
|
||||||
|
this.pushOngoing = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue