MOBILE-3814 loading: Fix bug showing content
parent
b475bd840a
commit
d6051f0e70
|
@ -103,23 +103,19 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit {
|
||||||
* @return Promise resolved when done.
|
* @return Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
async changeState(loaded: boolean): Promise<void> {
|
async changeState(loaded: boolean): Promise<void> {
|
||||||
await CoreUtils.nextTick();
|
|
||||||
|
|
||||||
this.element.classList.toggle('core-loading-loaded', loaded);
|
this.element.classList.toggle('core-loading-loaded', loaded);
|
||||||
this.content?.nativeElement.classList.add('core-loading-content', loaded);
|
this.content?.nativeElement.classList.toggle('core-loading-content', loaded);
|
||||||
|
|
||||||
await CoreUtils.nextTick();
|
|
||||||
|
|
||||||
// Wait for next tick before triggering the event to make sure ngIf elements have been added to the DOM.
|
|
||||||
CoreEvents.trigger(CoreEvents.CORE_LOADING_CHANGED, <CoreEventLoadingChangedData> {
|
|
||||||
loaded: loaded,
|
|
||||||
uniqueId: this.uniqueId,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!this.loaded && loaded) {
|
if (!this.loaded && loaded) {
|
||||||
this.loaded = true; // Only comes true once.
|
this.loaded = true; // Only comes true once.
|
||||||
this.firstLoadedPromise.resolve(this.uniqueId);
|
this.firstLoadedPromise.resolve(this.uniqueId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event has been deprecated since app 4.0.
|
||||||
|
CoreEvents.trigger(CoreEvents.CORE_LOADING_CHANGED, <CoreEventLoadingChangedData> {
|
||||||
|
loaded: true,
|
||||||
|
uniqueId: this.uniqueId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -117,6 +117,9 @@ export class CoreEvents {
|
||||||
static readonly APP_LAUNCHED_URL = 'app_launched_url'; // App opened with a certain URL (custom URL scheme).
|
static readonly APP_LAUNCHED_URL = 'app_launched_url'; // App opened with a certain URL (custom URL scheme).
|
||||||
static readonly FILE_SHARED = 'file_shared';
|
static readonly FILE_SHARED = 'file_shared';
|
||||||
static readonly KEYBOARD_CHANGE = 'keyboard_change';
|
static readonly KEYBOARD_CHANGE = 'keyboard_change';
|
||||||
|
/**
|
||||||
|
* @deprecated since app 4.0. Use CoreComponentsRegistry promises instead.
|
||||||
|
*/
|
||||||
static readonly CORE_LOADING_CHANGED = 'core_loading_changed';
|
static readonly CORE_LOADING_CHANGED = 'core_loading_changed';
|
||||||
static readonly ORIENTATION_CHANGE = 'orientation_change';
|
static readonly ORIENTATION_CHANGE = 'orientation_change';
|
||||||
static readonly SEND_ON_ENTER_CHANGED = 'send_on_enter_changed';
|
static readonly SEND_ON_ENTER_CHANGED = 'send_on_enter_changed';
|
||||||
|
|
Loading…
Reference in New Issue