MOBILE-4470 quiz: Fix auto save popover not dismissed
parent
efb8fdd630
commit
b9f07d7f65
|
@ -200,7 +200,7 @@ export class AddonModDataActionComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await CoreDomUtils.openPopover({
|
await CoreDomUtils.openPopoverWithoutResult({
|
||||||
component: AddonModDataActionsMenuComponent,
|
component: AddonModDataActionsMenuComponent,
|
||||||
componentProps: { items },
|
componentProps: { items },
|
||||||
id: 'actionsmenu-popover',
|
id: 'actionsmenu-popover',
|
||||||
|
|
|
@ -197,7 +197,7 @@ export class AddonModQuizAutoSave {
|
||||||
};
|
};
|
||||||
this.popoverShown = true;
|
this.popoverShown = true;
|
||||||
|
|
||||||
this.popover = await CoreDomUtils.openPopover({
|
this.popover = await CoreDomUtils.openPopoverWithoutResult({
|
||||||
component: AddonModQuizConnectionErrorComponent,
|
component: AddonModQuizConnectionErrorComponent,
|
||||||
event: <Event> event,
|
event: <Event> event,
|
||||||
});
|
});
|
||||||
|
|
|
@ -131,7 +131,7 @@ export class CoreCourseModuleCompletionComponent
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreDomUtils.openPopover({
|
CoreDomUtils.openPopoverWithoutResult({
|
||||||
component: CoreCourseModuleCompletionDetailsComponent,
|
component: CoreCourseModuleCompletionDetailsComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
completion: this.completion,
|
completion: this.completion,
|
||||||
|
|
|
@ -548,7 +548,7 @@ export class CoreDomUtilsProvider {
|
||||||
el.addEventListener('click', async (ev: Event) => {
|
el.addEventListener('click', async (ev: Event) => {
|
||||||
const html = el.getAttribute('data-html');
|
const html = el.getAttribute('data-html');
|
||||||
|
|
||||||
await CoreDomUtils.openPopover({
|
await CoreDomUtils.openPopoverWithoutResult({
|
||||||
component: CoreBSTooltipComponent,
|
component: CoreBSTooltipComponent,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
content,
|
content,
|
||||||
|
@ -1534,7 +1534,7 @@ export class CoreDomUtilsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a popover.
|
* Opens a popover and waits for it to be dismissed to return the result.
|
||||||
*
|
*
|
||||||
* @param options Options.
|
* @param options Options.
|
||||||
* @returns Promise resolved when the popover is dismissed or will be dismissed.
|
* @returns Promise resolved when the popover is dismissed or will be dismissed.
|
||||||
|
@ -1542,7 +1542,22 @@ export class CoreDomUtilsProvider {
|
||||||
async openPopover<T = void>(options: OpenPopoverOptions): Promise<T | undefined> {
|
async openPopover<T = void>(options: OpenPopoverOptions): Promise<T | undefined> {
|
||||||
|
|
||||||
const { waitForDismissCompleted, ...popoverOptions } = options;
|
const { waitForDismissCompleted, ...popoverOptions } = options;
|
||||||
const popover = await PopoverController.create(popoverOptions);
|
const popover = await this.openPopoverWithoutResult(popoverOptions);
|
||||||
|
|
||||||
|
const result = waitForDismissCompleted ? await popover.onDidDismiss<T>() : await popover.onWillDismiss<T>();
|
||||||
|
if (result?.data) {
|
||||||
|
return result?.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens a popover.
|
||||||
|
*
|
||||||
|
* @param options Options.
|
||||||
|
* @returns Promise resolved when the popover is displayed.
|
||||||
|
*/
|
||||||
|
async openPopoverWithoutResult(options: Omit<PopoverOptions, 'showBackdrop'>): Promise<HTMLIonPopoverElement> {
|
||||||
|
const popover = await PopoverController.create(options);
|
||||||
const zoomLevel = await CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreConstants.CONFIG.defaultZoomLevel);
|
const zoomLevel = await CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreConstants.CONFIG.defaultZoomLevel);
|
||||||
|
|
||||||
await popover.present();
|
await popover.present();
|
||||||
|
@ -1559,10 +1574,7 @@ export class CoreDomUtilsProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = waitForDismissCompleted ? await popover.onDidDismiss<T>() : await popover.onWillDismiss<T>();
|
return popover;
|
||||||
if (result?.data) {
|
|
||||||
return result?.data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue