forked from EVOgeek/Vmeda.Online
		
	MOBILE-4724 core: Create CoreAlerts and CorePrompts
This commit is contained in:
		
							parent
							
								
									d8c6288a61
								
							
						
					
					
						commit
						c2a500976d
					
				@ -13,13 +13,13 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { AddonBadges, AddonBadgesBadgeClass } from '../../services/badges';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a badge class.
 | 
			
		||||
@ -71,7 +71,7 @@ export class AddonBadgesBadgeClassPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView(this.badge);
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.');
 | 
			
		||||
            CoreAlerts.showError(message, { default: 'Error getting badge data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,6 @@
 | 
			
		||||
 | 
			
		||||
import { Component, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
 | 
			
		||||
@ -28,6 +27,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays an issued badge.
 | 
			
		||||
@ -141,7 +141,7 @@ export class AddonBadgesIssuedBadgePage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView(badge);
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.');
 | 
			
		||||
            CoreAlerts.showError(message, { default: 'Error getting badge data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,6 @@
 | 
			
		||||
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
@ -26,6 +25,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of calendar events.
 | 
			
		||||
@ -112,7 +112,7 @@ export class AddonBadgesUserBadgesPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'Error loading badges');
 | 
			
		||||
            CoreAlerts.showError(message, { default: 'Error loading badges' });
 | 
			
		||||
 | 
			
		||||
            this.badges.reset();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ import { CoreCourseOptionsDelegate } from '@features/course/services/course-opti
 | 
			
		||||
import { CoreBlockBaseComponent } from '@features/block/classes/base-block-component';
 | 
			
		||||
import { CoreSite } from '@classes/sites/site';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursecompletion';
 | 
			
		||||
import { IonSearchbar } from '@ionic/angular';
 | 
			
		||||
@ -43,6 +42,8 @@ import {
 | 
			
		||||
    CORE_COURSES_STATE_FAVOURITE,
 | 
			
		||||
    CORE_COURSES_STATE_HIDDEN,
 | 
			
		||||
} from '@features/courses/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] =
 | 
			
		||||
    ['all', 'inprogress', 'future', 'past', 'favourite', 'allincludinghidden', 'hidden', 'custom'];
 | 
			
		||||
@ -504,7 +505,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
 | 
			
		||||
            await CoreCourseHelper.prefetchCourses(this.filteredCourses, this.prefetchCoursesData);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (!this.isDestroyed) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.course.errordownloadingcourse', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.course.errordownloadingcourse') });
 | 
			
		||||
                this.prefetchCoursesData.icon = initialIcon;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -566,7 +567,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
 | 
			
		||||
                        throw error; // Pass the error to the caller so it's treated there.
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: this.fetchContentDefaultError });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    if (!alreadyLoading) {
 | 
			
		||||
                        // Only set loaded to true if there was no other data being loaded.
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { CoreSites } from '@services/sites';
 | 
			
		||||
import { ICoreBlockComponent } from '@features/block/classes/base-block-component';
 | 
			
		||||
import { AddonBlockTimeline } from '../../services/timeline';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreCoursesHelper, CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
 | 
			
		||||
import { CoreCourses } from '@features/courses/services/courses';
 | 
			
		||||
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
 | 
			
		||||
@ -30,6 +29,7 @@ import { CoreLogger } from '@singletons/logger';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreSearchComponentsModule } from '@features/search/components/components.module';
 | 
			
		||||
import { AddonBlockTimelineEventsComponent } from '../events/events';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component to render a timeline block.
 | 
			
		||||
@ -211,9 +211,7 @@ export class AddonBlockTimelineComponent implements OnInit, ICoreBlockComponent
 | 
			
		||||
            catchError(error => {
 | 
			
		||||
                // An error ocurred in the function, log the error and just resolve the observable so the workflow continues.
 | 
			
		||||
                this.logger.error(error);
 | 
			
		||||
 | 
			
		||||
                // Error getting data, fail.
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: this.fetchContentDefaultError });
 | 
			
		||||
 | 
			
		||||
                return of([] as AddonBlockTimelineSection[]);
 | 
			
		||||
            }),
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,6 @@ import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -48,6 +47,7 @@ import { CoreForms } from '@singletons/form';
 | 
			
		||||
import { CoreFileEntry } from '@services/file-helper';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
    selector: 'addon-blog-edit-entry',
 | 
			
		||||
@ -164,7 +164,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
 | 
			
		||||
                    this.associatedCourse = course;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error getting associations, they may not be displayed correctly.');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error getting associations, they may not be displayed correctly.' });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -204,7 +204,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
 | 
			
		||||
                this.associatedModule = await CoreCourse.getModule(this.modId);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error retrieving data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error retrieving data.' });
 | 
			
		||||
            this.forceLeave = true;
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -338,7 +338,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                if (CoreWSError.isWebServiceError(error)) {
 | 
			
		||||
                    // It's a WebService error, the user cannot send the message so don't store it.
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error updating entry.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error updating entry.' });
 | 
			
		||||
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
@ -363,7 +363,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (CoreWSError.isWebServiceError(error)) {
 | 
			
		||||
                // It's a WebService error, the user cannot send the message so don't store it.
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error creating entry.');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error creating entry.' });
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -412,7 +412,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
 | 
			
		||||
 | 
			
		||||
        if ((!this.entry && this.hasDataChangedForNewEntry) || (this.entry && this.hasDataChangedForEdit)) {
 | 
			
		||||
            // Modified, confirm user wants to go back.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,6 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreArray } from '@singletons/array';
 | 
			
		||||
@ -43,6 +42,8 @@ import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CorePopovers } from '@services/overlays/popovers';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { Subscription } from 'rxjs';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of blog entries.
 | 
			
		||||
@ -236,7 +237,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
                const result = await AddonBlogSync.syncEntriesForSite(CoreSites.getCurrentSiteId());
 | 
			
		||||
 | 
			
		||||
                if (result.warnings && result.warnings.length) {
 | 
			
		||||
                    CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                    CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (result.updated) {
 | 
			
		||||
@ -244,7 +245,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                if (showSyncErrors) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -281,7 +282,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.pageLoaded++;
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.blog.errorloadentries', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.blog.errorloadentries') });
 | 
			
		||||
            this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded.set(true);
 | 
			
		||||
@ -338,7 +339,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.filter.userid = !enabled ? undefined : this.currentUserId;
 | 
			
		||||
            await this.fetchEntries(true);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.blog.errorloadentries', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.blog.errorloadentries') });
 | 
			
		||||
            this.onlyMyEntries = !enabled;
 | 
			
		||||
            this.filter.userid = !enabled ? this.currentUserId : undefined;
 | 
			
		||||
        } finally {
 | 
			
		||||
@ -418,7 +419,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
     */
 | 
			
		||||
    async deleteEntry(entryToRemove: AddonBlogOfflinePostFormatted | AddonBlogPostFormatted): Promise<void> {
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm('addon.blog.blogdeleteconfirm', { $a: entryToRemove.subject });
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('addon.blog.blogdeleteconfirm', { $a: entryToRemove.subject }));
 | 
			
		||||
        } catch {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -434,7 +435,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            CoreEvents.trigger(ADDON_BLOG_ENTRY_UPDATED);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.blog.errorloadentries', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.blog.errorloadentries') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            loading.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ import {
 | 
			
		||||
} from '@angular/core';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreArray } from '@singletons/array';
 | 
			
		||||
import {
 | 
			
		||||
@ -54,6 +53,7 @@ import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a calendar.
 | 
			
		||||
@ -204,7 +204,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
@ -358,7 +358,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro
 | 
			
		||||
 | 
			
		||||
            this.swipeSlidesComponent.slideToItem(item);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,6 @@
 | 
			
		||||
import { Component, OnDestroy, OnInit, Input, DoCheck, Output, EventEmitter, KeyValueDiffers, KeyValueDiffer } from '@angular/core';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import {
 | 
			
		||||
    AddonCalendarEventToDisplay,
 | 
			
		||||
    AddonCalendar,
 | 
			
		||||
@ -29,6 +28,7 @@ import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays upcoming events.
 | 
			
		||||
@ -174,7 +174,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import {
 | 
			
		||||
    AddonCalendar,
 | 
			
		||||
@ -59,6 +58,7 @@ import {
 | 
			
		||||
    AddonCalendarEventType,
 | 
			
		||||
} from '@addons/calendar/constants';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the calendar events for a certain day.
 | 
			
		||||
@ -277,7 +277,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
@ -343,7 +343,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
 | 
			
		||||
            const result = await AddonCalendarSync.syncEvents();
 | 
			
		||||
 | 
			
		||||
            if (result.warnings && result.warnings.length) {
 | 
			
		||||
                CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (result.updated) {
 | 
			
		||||
@ -357,7 +357,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (showErrors) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -454,7 +454,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.swipeSlidesComponent.slideToItem(currentDay);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,6 @@ import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreGroup, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { CoreCategoryData, CoreCourses, CoreCourseSearchedData, CoreEnrolledCourseData } from '@features/courses/services/courses';
 | 
			
		||||
@ -54,6 +53,7 @@ import { CorePopovers } from '@services/overlays/popovers';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { REMINDERS_DISABLED, CoreRemindersUnits } from '@features/reminders/constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a form to create/edit an event.
 | 
			
		||||
@ -253,7 +253,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.eventTypes = eventTypes;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting data.' });
 | 
			
		||||
            this.error = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -421,7 +421,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.groupControl.setValue(null);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting data.' });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        modal.dismiss();
 | 
			
		||||
@ -475,7 +475,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
        if (error) {
 | 
			
		||||
            // Show error and stop.
 | 
			
		||||
            CoreDomUtils.showErrorModal(Translate.instant(error));
 | 
			
		||||
            CoreAlerts.showError(Translate.instant(error));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -548,7 +548,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.returnToList(event);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error sending data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error sending data.' });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        modal.dismiss();
 | 
			
		||||
@ -593,7 +593,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
    async canLeave(): Promise<boolean> {
 | 
			
		||||
        if (AddonCalendarHelper.hasEventDataChanged(this.form.value, this.originalData)) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CoreForms.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { AlertOptions } from '@ionic/core';
 | 
			
		||||
import {
 | 
			
		||||
    AddonCalendar,
 | 
			
		||||
    AddonCalendarEventToDisplay,
 | 
			
		||||
@ -23,7 +22,6 @@ import { AddonCalendarOffline } from '../../services/calendar-offline';
 | 
			
		||||
import { AddonCalendarSync, AddonCalendarSyncEvents } from '../../services/calendar-sync';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
@ -55,6 +53,7 @@ import {
 | 
			
		||||
    ADDON_CALENDAR_UNDELETED_EVENT_EVENT,
 | 
			
		||||
} from '@addons/calendar/constants';
 | 
			
		||||
import { REMINDERS_DEFAULT_NOTIFICATION_TIME_CHANGED } from '@features/reminders/constants';
 | 
			
		||||
import { CoreAlerts, CoreAlertsConfirmOptions } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a single calendar event.
 | 
			
		||||
@ -191,7 +190,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
        try {
 | 
			
		||||
            this.eventId = CoreNavigator.getRequiredRouteNumberParam('id');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -243,7 +242,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
                if (this.eventId < 0) {
 | 
			
		||||
                    // It's an offline event, but it wasn't found. Shouldn't happen.
 | 
			
		||||
                    CoreDomUtils.showErrorModal('Event not found.');
 | 
			
		||||
                    CoreAlerts.showError('Event not found.');
 | 
			
		||||
                    CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
                    return;
 | 
			
		||||
@ -318,7 +317,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevent') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.eventLoaded = true;
 | 
			
		||||
@ -357,7 +356,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
        try {
 | 
			
		||||
            const result = await AddonCalendarSync.syncEvents();
 | 
			
		||||
            if (result.warnings && result.warnings.length) {
 | 
			
		||||
                CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (result.deleted && result.deleted.indexOf(this.eventId) != -1) {
 | 
			
		||||
@ -380,7 +379,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (showErrors) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -427,7 +426,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
        e.stopPropagation();
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm();
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show('core.deleting', true);
 | 
			
		||||
 | 
			
		||||
@ -435,7 +434,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
                await CoreReminders.removeReminder(id);
 | 
			
		||||
                await this.loadReminders();
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error deleting reminder');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error deleting reminder' });
 | 
			
		||||
            } finally {
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
@ -500,9 +499,10 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const title = Translate.instant('addon.calendar.deleteevent');
 | 
			
		||||
        const options: AlertOptions = {};
 | 
			
		||||
        let message: string;
 | 
			
		||||
        const options: CoreAlertsConfirmOptions = {
 | 
			
		||||
            header: Translate.instant('addon.calendar.deleteevent'),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (this.event.eventcount > 1) {
 | 
			
		||||
            // It's a repeated event.
 | 
			
		||||
@ -534,7 +534,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
        let deleteAll = false;
 | 
			
		||||
        try {
 | 
			
		||||
            deleteAll = await CoreDomUtils.showConfirm(message, title, undefined, undefined, options);
 | 
			
		||||
            deleteAll = await CoreAlerts.confirm(message, options);
 | 
			
		||||
        } catch {
 | 
			
		||||
            // User canceled.
 | 
			
		||||
            return;
 | 
			
		||||
@ -583,7 +583,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
                this.event.deleted = true;
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error deleting event.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error deleting event.' });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        modal.dismiss();
 | 
			
		||||
@ -611,7 +611,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.event.deleted = false;
 | 
			
		||||
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error undeleting event.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error undeleting event.' });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        modal.dismiss();
 | 
			
		||||
 | 
			
		||||
@ -16,13 +16,12 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
 | 
			
		||||
import { AddonCalendar } from '../../services/calendar';
 | 
			
		||||
import { AddonCalendarOffline } from '../../services/calendar-offline';
 | 
			
		||||
import { AddonCalendarSync } from '../../services/calendar-sync';
 | 
			
		||||
import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calendar-helper';
 | 
			
		||||
import { NgZone } from '@singletons';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { Subscription } from 'rxjs';
 | 
			
		||||
import { CoreEnrolledCourseData } from '@features/courses/services/courses';
 | 
			
		||||
import { ActivatedRoute, Params } from '@angular/router';
 | 
			
		||||
@ -41,6 +40,7 @@ import {
 | 
			
		||||
    ADDON_CALENDAR_NEW_EVENT_EVENT,
 | 
			
		||||
    ADDON_CALENDAR_UNDELETED_EVENT_EVENT,
 | 
			
		||||
} from '@addons/calendar/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the calendar events.
 | 
			
		||||
@ -207,7 +207,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
            try {
 | 
			
		||||
                const result = await AddonCalendarSync.syncEvents();
 | 
			
		||||
                if (result.warnings && result.warnings.length) {
 | 
			
		||||
                    CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                    CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (result.updated) {
 | 
			
		||||
@ -222,7 +222,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                if (showErrors) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -255,7 +255,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import {
 | 
			
		||||
    AddonCompetencyDataForPlanPageCompetency,
 | 
			
		||||
@ -30,6 +29,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of competencies of a learning plan.
 | 
			
		||||
@ -111,7 +111,7 @@ export class AddonCompetencyCompetenciesPage implements AfterViewInit, OnDestroy
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting competencies data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting competencies data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreCourseModuleSummary } from '@features/course/services/course';
 | 
			
		||||
import { CoreUserSummary } from '@features/user/services/user';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import {
 | 
			
		||||
    AddonCompetencyDataForUserCompetencySummaryWSResponse,
 | 
			
		||||
@ -41,6 +40,7 @@ import { AddonCompetencyCourseCompetenciesSource } from '@addons/competency/clas
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the competency information.
 | 
			
		||||
@ -86,8 +86,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.competencies = new AddonCompetencyCompetenciesSwipeManager(source);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -163,7 +162,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting competency data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting competency data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,11 +16,11 @@ import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { AddonCompetencySummary, AddonCompetency } from '@addons/competency/services/competency';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the competency summary.
 | 
			
		||||
@ -71,8 +71,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
 | 
			
		||||
            this.contextLevel = CoreNavigator.getRouteParam<ContextLevel>('contextLevel');
 | 
			
		||||
            this.contextInstanceId = CoreNavigator.getRouteNumberParam('contextInstanceId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -103,7 +102,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting competency summary data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting competency summary data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,6 @@ import {
 | 
			
		||||
} from '@addons/competency/services/competency';
 | 
			
		||||
import { CoreUserProfile } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
 | 
			
		||||
import { CoreListItemsManager } from '@classes/items-management/list-items-manager';
 | 
			
		||||
@ -29,6 +28,7 @@ import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of competencies of a course.
 | 
			
		||||
@ -59,7 +59,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit, OnDestroy
 | 
			
		||||
 | 
			
		||||
            this.competencies = new CoreListItemsManager(source, AddonCompetencyCourseCompetenciesPage);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -121,7 +121,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit, OnDestroy
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting course competencies data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting course competencies data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForPlanPageWSResponse } from '../../services/competency';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreUserProfile } from '@features/user/services/user';
 | 
			
		||||
@ -24,6 +23,7 @@ import { CoreListItemsManager } from '@classes/items-management/list-items-manag
 | 
			
		||||
import { AddonCompetencyPlanCompetenciesSource } from '@addons/competency/classes/competency-plan-competencies-source';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a learning plan.
 | 
			
		||||
@ -57,8 +57,7 @@ export class AddonCompetencyPlanPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.competencies = new CoreListItemsManager(competenciesSource, AddonCompetencyPlanPage);
 | 
			
		||||
            this.plans = new CoreSwipeNavigationItemsManager(plansSource);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -101,7 +100,7 @@ export class AddonCompetencyPlanPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting learning plan data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting learning plan data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { AddonCompetencyPlanFormatted, AddonCompetencyPlansSource } from '@addons/competency/classes/competency-plans-source';
 | 
			
		||||
@ -23,6 +22,7 @@ import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of learning plans.
 | 
			
		||||
@ -76,7 +76,7 @@ export class AddonCompetencyPlanListPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting learning plans data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting learning plans data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,9 +22,9 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the course completion report.
 | 
			
		||||
@ -69,8 +69,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -102,7 +101,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
 | 
			
		||||
                // Not enrolled error, probably a teacher.
 | 
			
		||||
                this.tracked = false;
 | 
			
		||||
            } else {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.coursecompletion.couldnotloadreport', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.coursecompletion.couldnotloadreport') });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -131,7 +130,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            await this.refreshCompletion();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ import { CorePasswordModalResponse } from '@components/password-modal/password-m
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CorePrompts } from '@services/overlays/prompts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Enrol handler.
 | 
			
		||||
@ -119,7 +119,7 @@ export class AddonEnrolGuestHandlerService implements CoreEnrolGuestHandler {
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            const response = await CoreModals.promptPassword<CorePasswordModalResponse>({
 | 
			
		||||
            const response = await CorePrompts.promptPassword<CorePasswordModalResponse>({
 | 
			
		||||
                title: method.name,
 | 
			
		||||
                validator: validatePassword,
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
@ -17,11 +17,11 @@ import { CoreEnrolAction, CoreEnrolSelfHandler, CoreEnrolInfoIcon } from '@featu
 | 
			
		||||
import { Translate, makeSingleton } from '@singletons';
 | 
			
		||||
import { AddonEnrolSelf } from './self';
 | 
			
		||||
import { CorePasswordModalResponse } from '@components/password-modal/password-modal';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CORE_COURSES_ENROL_INVALID_KEY } from '@features/courses/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { CorePrompts } from '@services/overlays/prompts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Enrol handler.
 | 
			
		||||
@ -87,11 +87,10 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
 | 
			
		||||
        // Don't allow self access if it requires a password if not supported.
 | 
			
		||||
        if (!info.enrolpassword) {
 | 
			
		||||
            try {
 | 
			
		||||
                await CoreDomUtils.showConfirm(
 | 
			
		||||
                    Translate.instant('addon.enrol_self.confirmselfenrol'),
 | 
			
		||||
                    method.name,
 | 
			
		||||
                    Translate.instant('core.courses.enrolme'),
 | 
			
		||||
                );
 | 
			
		||||
                await CoreAlerts.confirm(Translate.instant('addon.enrol_self.confirmselfenrol'), {
 | 
			
		||||
                    header: method.name,
 | 
			
		||||
                    okText: Translate.instant('core.courses.enrolme'),
 | 
			
		||||
                });
 | 
			
		||||
            } catch {
 | 
			
		||||
                // User cancelled.
 | 
			
		||||
                return false;
 | 
			
		||||
@ -126,7 +125,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
 | 
			
		||||
                    response.validated = false;
 | 
			
		||||
                    response.error = error.message;
 | 
			
		||||
                } else {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'addon.enrol_self.errorselfenrol', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('addon.enrol_self.errorselfenrol') });
 | 
			
		||||
 | 
			
		||||
                    throw error;
 | 
			
		||||
                }
 | 
			
		||||
@ -147,7 +146,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
 | 
			
		||||
 | 
			
		||||
        if (!response.validated) {
 | 
			
		||||
            try {
 | 
			
		||||
                const response = await CoreModals.promptPassword({
 | 
			
		||||
                const response = await CorePrompts.promptPassword({
 | 
			
		||||
                    validator: validatePassword,
 | 
			
		||||
                    title: method.name,
 | 
			
		||||
                    placeholder: 'addon.enrol_self.password',
 | 
			
		||||
 | 
			
		||||
@ -13,11 +13,10 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications';
 | 
			
		||||
import { AddonMessageOutputAirnotifier, AddonMessageOutputAirnotifierDevice } from '../../services/airnotifier';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of devices.
 | 
			
		||||
@ -50,7 +49,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
 | 
			
		||||
            const devices = await AddonMessageOutputAirnotifier.getUserDevices();
 | 
			
		||||
            this.formatDevices(devices);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -148,7 +147,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
 | 
			
		||||
            this.updateDevicesAfterDelay();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            // Show error and revert change.
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            device.enable = !device.enable;
 | 
			
		||||
        } finally {
 | 
			
		||||
            device.updating = false;
 | 
			
		||||
 | 
			
		||||
@ -21,10 +21,10 @@ import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreOpener } from '@singletons/opener';
 | 
			
		||||
import { CorePath } from '@singletons/path';
 | 
			
		||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
			
		||||
import { CorePrompts } from '@services/overlays/prompts';
 | 
			
		||||
 | 
			
		||||
const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:';
 | 
			
		||||
 | 
			
		||||
@ -200,34 +200,35 @@ export class AddonMessageOutputAirnotifierProvider {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Warn the admin.
 | 
			
		||||
            const dontShowAgain = await CoreDomUtils.showPrompt(
 | 
			
		||||
            const dontShowAgain = await CorePrompts.show(
 | 
			
		||||
                Translate.instant('addon.messageoutput_airnotifier.pushdisabledwarning'),
 | 
			
		||||
                undefined,
 | 
			
		||||
                Translate.instant('core.dontshowagain'),
 | 
			
		||||
                'checkbox',
 | 
			
		||||
                [
 | 
			
		||||
                    {
 | 
			
		||||
                        text: Translate.instant('core.ok'),
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        text: Translate.instant('core.goto', { $a: Translate.instant('core.settings.settings') }),
 | 
			
		||||
                        handler: (data, resolve) => {
 | 
			
		||||
                            resolve(data[0]);
 | 
			
		||||
 | 
			
		||||
                            const url = CorePath.concatenatePaths(
 | 
			
		||||
                                site.getURL(),
 | 
			
		||||
                                site.isVersionGreaterEqualThan('3.11') ?
 | 
			
		||||
                                    'message/output/airnotifier/checkconfiguration.php' :
 | 
			
		||||
                                    'admin/message.php',
 | 
			
		||||
                            );
 | 
			
		||||
 | 
			
		||||
                            // Don't try auto-login, admins cannot use it.
 | 
			
		||||
                            CoreOpener.openInBrowser(url, {
 | 
			
		||||
                                showBrowserWarning: false,
 | 
			
		||||
                            });
 | 
			
		||||
                {
 | 
			
		||||
                    placeholderOrLabel: Translate.instant('core.dontshowagain'),
 | 
			
		||||
                    buttons: [
 | 
			
		||||
                        {
 | 
			
		||||
                            text: Translate.instant('core.ok'),
 | 
			
		||||
                        },
 | 
			
		||||
                    },
 | 
			
		||||
                ],
 | 
			
		||||
                        {
 | 
			
		||||
                            text: Translate.instant('core.goto', { $a: Translate.instant('core.settings.settings') }),
 | 
			
		||||
                            handler: (data, resolve) => {
 | 
			
		||||
                                resolve(data[0]);
 | 
			
		||||
 | 
			
		||||
                                const url = CorePath.concatenatePaths(
 | 
			
		||||
                                    site.getURL(),
 | 
			
		||||
                                    site.isVersionGreaterEqualThan('3.11') ?
 | 
			
		||||
                                        'message/output/airnotifier/checkconfiguration.php' :
 | 
			
		||||
                                        'admin/message.php',
 | 
			
		||||
                                );
 | 
			
		||||
 | 
			
		||||
                                // Don't try auto-login, admins cannot use it.
 | 
			
		||||
                                CoreOpener.openInBrowser(url, {
 | 
			
		||||
                                    showBrowserWarning: false,
 | 
			
		||||
                                });
 | 
			
		||||
                            },
 | 
			
		||||
                        },
 | 
			
		||||
                    ],
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            if (dontShowAgain) {
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ import {
 | 
			
		||||
    AddonMessagesConversationMember,
 | 
			
		||||
    AddonMessages,
 | 
			
		||||
} from '../../services/messages';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { ModalController } from '@singletons';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays the list of conversations, including group conversations.
 | 
			
		||||
@ -67,7 +67,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit {
 | 
			
		||||
            // Now get the members.
 | 
			
		||||
            await this.fetchMembers();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting members.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting members.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.fetchMembers(true);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting members.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting members.' });
 | 
			
		||||
            this.loadMoreError = true;
 | 
			
		||||
        } finally {
 | 
			
		||||
            infiniteComplete && infiniteComplete();
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import {
 | 
			
		||||
    AddonMessagesGetContactsContact,
 | 
			
		||||
    AddonMessages,
 | 
			
		||||
} from '../../services/messages';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -29,6 +28,7 @@ import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreKeyboard } from '@singletons/keyboard';
 | 
			
		||||
import { ADDON_MESSAGES_MEMBER_INFO_CHANGED_EVENT } from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of contacts.
 | 
			
		||||
@ -163,7 +163,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.clearSearch();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -233,7 +233,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.contacts.search = this.sortUsers(result);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,9 +21,10 @@ import {
 | 
			
		||||
} from '../../services/messages';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreScreen } from '@services/screen';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { ADDON_MESSAGES_CONTACT_REQUESTS_COUNT_EVENT, ADDON_MESSAGES_MEMBER_INFO_CHANGED_EVENT } from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays contacts and contact requests.
 | 
			
		||||
@ -177,7 +178,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.confirmedCanLoadMore = result.canLoadMore;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.confirmedLoadMoreError = true;
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -203,7 +204,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.requestsCanLoadMore = result.canLoadMore;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.requestsLoadMoreError = true;
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,6 @@
 | 
			
		||||
 | 
			
		||||
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { AlertOptions } from '@ionic/core';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import {
 | 
			
		||||
@ -28,7 +27,6 @@ import {
 | 
			
		||||
import { AddonMessagesOffline, AddonMessagesOfflineMessagesDBRecordFormatted } from '../../services/messages-offline';
 | 
			
		||||
import { AddonMessagesSync } from '../../services/messages-sync';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreLogger } from '@singletons/logger';
 | 
			
		||||
import { CoreInfiniteLoadingComponent } from '@components/infinite-loading/infinite-loading';
 | 
			
		||||
@ -58,6 +56,7 @@ import {
 | 
			
		||||
    AddonMessagesMessageConversationType,
 | 
			
		||||
    AddonMessagesUpdateConversationAction,
 | 
			
		||||
} from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts, CoreAlertsConfirmOptions } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a message discussion page.
 | 
			
		||||
@ -143,7 +142,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
 | 
			
		||||
                // Show first warning if any.
 | 
			
		||||
                if (data.warnings && data.warnings[0]) {
 | 
			
		||||
                    CoreDomUtils.showAlert(undefined, data.warnings[0]);
 | 
			
		||||
                    CoreAlerts.show({ message: data.warnings[0] });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }, this.siteId);
 | 
			
		||||
@ -264,7 +263,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
        try {
 | 
			
		||||
            const syncResult = await AddonMessagesSync.syncDiscussion(this.conversationId, this.userId);
 | 
			
		||||
            if (syncResult.warnings && syncResult.warnings[0]) {
 | 
			
		||||
                CoreDomUtils.showAlert(undefined, syncResult.warnings[0]);
 | 
			
		||||
                CoreAlerts.show({ message: syncResult.warnings[0] });
 | 
			
		||||
            }
 | 
			
		||||
        } catch {
 | 
			
		||||
            // Ignore errors;
 | 
			
		||||
@ -350,7 +349,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.checkCanDelete();
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
@ -953,7 +952,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
        const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers;
 | 
			
		||||
        const langKey = message.pending || canDeleteAll || this.isSelf ? 'core.areyousure' :
 | 
			
		||||
            'addon.messages.deletemessageconfirmation';
 | 
			
		||||
        const options: AlertOptions = {};
 | 
			
		||||
        const options: CoreAlertsConfirmOptions = {};
 | 
			
		||||
 | 
			
		||||
        if (canDeleteAll && !message.pending) {
 | 
			
		||||
            // Show delete for all checkbox.
 | 
			
		||||
@ -967,13 +966,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            const data: boolean[] = await CoreDomUtils.showConfirm(
 | 
			
		||||
                Translate.instant(langKey),
 | 
			
		||||
                undefined,
 | 
			
		||||
                undefined,
 | 
			
		||||
                undefined,
 | 
			
		||||
                options,
 | 
			
		||||
            );
 | 
			
		||||
            const data = await CoreAlerts.confirm<boolean[]>(Translate.instant(langKey), options);
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show('core.deleting', true);
 | 
			
		||||
 | 
			
		||||
@ -989,7 +982,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errordeletemessage', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errordeletemessage') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1037,7 +1030,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
 | 
			
		||||
                this.pagesLoaded--;
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                infiniteComplete && infiniteComplete();
 | 
			
		||||
            }
 | 
			
		||||
@ -1192,7 +1185,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                // We want the user to be able to send multiple messages without the keyboard being closed.
 | 
			
		||||
                CoreKeyboard.close();
 | 
			
		||||
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.messages.messagenotsent', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.messages.messagenotsent') });
 | 
			
		||||
                this.removeMessage(message.hash!);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -1316,7 +1309,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                value: this.conversation.isfavourite,
 | 
			
		||||
            }, this.siteId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error changing favourite state.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error changing favourite state.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.favouriteIcon = 'fas-star';
 | 
			
		||||
            done && done();
 | 
			
		||||
@ -1349,7 +1342,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
            }, this.siteId);
 | 
			
		||||
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error changing muted state.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error changing muted state.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.muteIcon = this.conversation.ismuted ? 'fas-bell' : 'fas-bell-slash';
 | 
			
		||||
            done && done();
 | 
			
		||||
@ -1404,16 +1397,16 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this.otherMember.canmessageevenifblocked) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(Translate.instant('addon.messages.cantblockuser', { $a: this.otherMember.fullname }));
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.messages.cantblockuser', { $a: this.otherMember.fullname }));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const template = Translate.instant('addon.messages.blockuserconfirm', { $a: this.otherMember.fullname });
 | 
			
		||||
        const okText = Translate.instant('addon.messages.blockuser');
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(template, undefined, okText);
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.messages.blockuserconfirm', { $a: this.otherMember.fullname }), {
 | 
			
		||||
                okText: Translate.instant('addon.messages.blockuser'),
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            this.blockIcon = CoreConstants.ICON_LOADING;
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show('core.sending', true);
 | 
			
		||||
@ -1427,7 +1420,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                    this.showLoadingModal = false;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
 | 
			
		||||
            }
 | 
			
		||||
@ -1449,7 +1442,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
        const confirmMessage = 'addon.messages.' + (this.isSelf ? 'deleteallselfconfirm' : 'deleteallconfirm');
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm(confirmMessage);
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant(confirmMessage));
 | 
			
		||||
            this.deleteIcon = CoreConstants.ICON_LOADING;
 | 
			
		||||
 | 
			
		||||
            try {
 | 
			
		||||
@ -1470,7 +1463,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                    done && done();
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error deleting conversation.');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error deleting conversation.' });
 | 
			
		||||
            } finally {
 | 
			
		||||
                this.deleteIcon = 'fas-trash';
 | 
			
		||||
            }
 | 
			
		||||
@ -1490,11 +1483,10 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
            throw new CoreError('No member selected to be unblocked.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const template = Translate.instant('addon.messages.unblockuserconfirm', { $a: this.otherMember.fullname });
 | 
			
		||||
        const okText = Translate.instant('addon.messages.unblockuser');
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(template, undefined, okText);
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.messages.unblockuserconfirm', { $a: this.otherMember.fullname }), {
 | 
			
		||||
                okText: Translate.instant('addon.messages.unblockuser'),
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            this.blockIcon = CoreConstants.ICON_LOADING;
 | 
			
		||||
 | 
			
		||||
@ -1509,7 +1501,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                    this.showLoadingModal = false;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
 | 
			
		||||
            }
 | 
			
		||||
@ -1529,11 +1521,10 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
            throw new CoreError('No member selected to be requested.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const template = Translate.instant('addon.messages.addcontactconfirm', { $a: this.otherMember.fullname });
 | 
			
		||||
        const okText = Translate.instant('core.add');
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(template, undefined, okText);
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.messages.addcontactconfirm', { $a: this.otherMember.fullname }), {
 | 
			
		||||
                okText: Translate.instant('core.add'),
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            this.addRemoveIcon = CoreConstants.ICON_LOADING;
 | 
			
		||||
 | 
			
		||||
@ -1548,7 +1539,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                    this.showLoadingModal = false;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                this.addRemoveIcon = 'fas-user-plus';
 | 
			
		||||
            }
 | 
			
		||||
@ -1579,7 +1570,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                this.showLoadingModal = false;
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1605,7 +1596,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                this.showLoadingModal = false;
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1620,11 +1611,10 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
            throw new CoreError('No member selected to be removed.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const template = Translate.instant('addon.messages.removecontactconfirm', { $a: this.otherMember.fullname });
 | 
			
		||||
        const okText = Translate.instant('core.remove');
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(template, undefined, okText);
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.messages.removecontactconfirm', { $a: this.otherMember.fullname }), {
 | 
			
		||||
                okText: Translate.instant('core.remove'),
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            this.addRemoveIcon = CoreConstants.ICON_LOADING;
 | 
			
		||||
 | 
			
		||||
@ -1639,7 +1629,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
 | 
			
		||||
                    this.showLoadingModal = false;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                this.addRemoveIcon = 'fas-user-plus';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import {
 | 
			
		||||
    AddonMessagesDiscussion,
 | 
			
		||||
    AddonMessagesMessageAreaContact,
 | 
			
		||||
} from '../../services/messages';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { ActivatedRoute, Params } from '@angular/router';
 | 
			
		||||
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
 | 
			
		||||
@ -34,6 +33,7 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreKeyboard } from '@singletons/keyboard';
 | 
			
		||||
import { ADDON_MESSAGES_NEW_MESSAGE_EVENT, ADDON_MESSAGES_READ_CHANGED_EVENT } from '@addons/messages/constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the list of discussions.
 | 
			
		||||
@ -207,7 +207,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
 | 
			
		||||
        try {
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
@ -241,7 +241,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
 | 
			
		||||
            this.search.showResults = true;
 | 
			
		||||
            this.search.results = searchResults.messages;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,6 @@ import {
 | 
			
		||||
    AddonMessagesOffline,
 | 
			
		||||
    AddonMessagesOfflineAnyMessagesFormatted,
 | 
			
		||||
} from '../../services/messages-offline';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -49,6 +48,7 @@ import {
 | 
			
		||||
    AddonMessagesMessageConversationType,
 | 
			
		||||
    AddonMessagesUpdateConversationAction,
 | 
			
		||||
} from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
const enum AddonMessagesGroupConversationOptionNames {
 | 
			
		||||
    FAVOURITES = 'favourites',
 | 
			
		||||
@ -381,7 +381,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
 | 
			
		||||
            // Load the data for the expanded option.
 | 
			
		||||
            await this.fetchDataForExpandedOption();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
 | 
			
		||||
        }
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
    }
 | 
			
		||||
@ -611,7 +611,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.fetchDataForOption(option, true);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
 | 
			
		||||
            option.loadMoreError = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -793,7 +793,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
        // Pass getCounts=true to update the counts everytime the user expands an option.
 | 
			
		||||
        this.expandOption(option, true).catch((error) => {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import {
 | 
			
		||||
    AddonMessagesMessageAreaContact,
 | 
			
		||||
    AddonMessages,
 | 
			
		||||
} from '../../services/messages';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreScreen } from '@services/screen';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
@ -30,6 +29,8 @@ import {
 | 
			
		||||
    ADDON_MESSAGES_LIMIT_SEARCH,
 | 
			
		||||
    ADDON_MESSAGES_LIMIT_INITIAL_USER_SEARCH,
 | 
			
		||||
} from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page for searching users.
 | 
			
		||||
@ -225,7 +226,7 @@ export class AddonMessagesSearchPage implements OnDestroy {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingusers', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingusers') });
 | 
			
		||||
 | 
			
		||||
            if (loadMore == 'messages') {
 | 
			
		||||
                this.messages.loadMoreError = true;
 | 
			
		||||
 | 
			
		||||
@ -23,13 +23,13 @@ import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreConfig } from '@services/config';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreConstants } from '@/core/constants';
 | 
			
		||||
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
 | 
			
		||||
import { CorePlatform } from '@services/platform';
 | 
			
		||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { ADDON_MESSAGES_NOTIFICATION_PREFERENCES_KEY, AddonMessagesMessagePrivacy } from '@addons/messages/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the messages settings page.
 | 
			
		||||
@ -118,7 +118,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.preferencesLoaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -171,7 +171,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.previousContactableValue = this.contactablePrivacy;
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            // Show error and revert change.
 | 
			
		||||
            CoreDomUtils.showErrorModal(message);
 | 
			
		||||
            CoreAlerts.showError(message);
 | 
			
		||||
            this.contactablePrivacy = this.previousContactableValue;
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
@ -214,7 +214,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.updatePreferencesAfterDelay();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            // Show error and revert change.
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            processor.enabled = !processor.enabled;
 | 
			
		||||
        } finally {
 | 
			
		||||
            notification.updating = false;
 | 
			
		||||
@ -249,7 +249,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.updatePreferencesAfterDelay();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            // Show error and revert change.
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            processorState.checked = !processorState.checked;
 | 
			
		||||
        } finally {
 | 
			
		||||
            notification['updating'+state] = false;
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,6 @@
 | 
			
		||||
 | 
			
		||||
import { Component, Input, ViewChild, ElementRef } from '@angular/core';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreFormFields, CoreForms } from '@singletons/form';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { ModalController, Translate } from '@singletons';
 | 
			
		||||
@ -22,6 +21,7 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission }
 | 
			
		||||
import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { AddonModAssignComponentsModule } from '../components.module';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Modal that allows editing a feedback plugin.
 | 
			
		||||
@ -50,7 +50,7 @@ export class AddonModAssignEditFeedbackModalComponent {
 | 
			
		||||
    async closeModal(): Promise<void> {
 | 
			
		||||
        const changed = await this.hasDataChanged();
 | 
			
		||||
        if (changed) {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -53,6 +52,7 @@ import {
 | 
			
		||||
    ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL,
 | 
			
		||||
    ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays an assignment.
 | 
			
		||||
@ -397,8 +397,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (syncEventData.warnings && syncEventData.warnings.length) {
 | 
			
		||||
            // Show warnings.
 | 
			
		||||
            CoreDomUtils.showAlert(undefined, syncEventData.warnings[0]);
 | 
			
		||||
            CoreAlerts.show({ message: syncEventData.warnings[0] });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,6 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
 | 
			
		||||
import { CoreMenuItem, CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../../services/assign-helper';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreCourse, CoreCourseModuleGradeInfo, CoreCourseModuleGradeOutcome } from '@features/course/services/course';
 | 
			
		||||
@ -71,6 +70,7 @@ import {
 | 
			
		||||
import { CoreViewer } from '@features/viewer/services/viewer';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays an assignment submission.
 | 
			
		||||
@ -296,7 +296,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
 | 
			
		||||
        if (modified) {
 | 
			
		||||
            // Modified, confirm user wants to go back.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
 | 
			
		||||
            await this.discardDrafts();
 | 
			
		||||
        }
 | 
			
		||||
@ -315,7 +315,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!CoreNetwork.isOnline()) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('core.networkerrormsg', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('core.networkerrormsg'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -363,7 +363,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
                await this.invalidateAndRefresh(true);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -388,12 +388,11 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
    async goToEdit(afterCopyPrevious = false): Promise<void> {
 | 
			
		||||
        if (!afterCopyPrevious && this.assign?.timelimit && (!this.userSubmission || !this.userSubmission.timestarted)) {
 | 
			
		||||
            try {
 | 
			
		||||
                await CoreDomUtils.showConfirm(
 | 
			
		||||
                await CoreAlerts.confirm(
 | 
			
		||||
                    Translate.instant('addon.mod_assign.confirmstart', {
 | 
			
		||||
                        $a: CoreTime.formatTime(this.assign.timelimit),
 | 
			
		||||
                    }),
 | 
			
		||||
                    undefined,
 | 
			
		||||
                    Translate.instant('addon.mod_assign.beginassignment'),
 | 
			
		||||
                    { okText: Translate.instant('addon.mod_assign.beginassignment') },
 | 
			
		||||
                );
 | 
			
		||||
            } catch {
 | 
			
		||||
                return; // User canceled.
 | 
			
		||||
@ -421,7 +420,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
            'addon.mod_assign.removesubmissionconfirmwithtimelimit' :
 | 
			
		||||
            'addon.mod_assign.removesubmissionconfirm';
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm(message);
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant(message));
 | 
			
		||||
        } catch {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -445,7 +444,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
                CoreSites.getCurrentSiteId(),
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error removing submission.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error removing submission.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -650,7 +649,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -936,14 +935,14 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this.assign.requiresubmissionstatement && !acceptStatement) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_assign.acceptsubmissionstatement', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_assign.acceptsubmissionstatement'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            // Ask for confirmation. @todo plugin precheck_submission
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('addon.mod_assign.confirmsubmission'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.mod_assign.confirmsubmission'));
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show('core.sending', true);
 | 
			
		||||
 | 
			
		||||
@ -963,7 +962,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
 | 
			
		||||
                    userId: this.currentUserId,
 | 
			
		||||
                }, this.siteId);
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            } finally {
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreFormFields, CoreForms } from '@singletons/form';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -48,6 +47,7 @@ import {
 | 
			
		||||
import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows adding or editing an assigment submission.
 | 
			
		||||
@ -101,8 +101,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.isBlind = !!CoreNavigator.getRouteNumberParam('blindId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -126,7 +125,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        // Check if data has changed.
 | 
			
		||||
        const changed = await this.hasDataChanged();
 | 
			
		||||
        if (changed) {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Nothing has changed or user confirmed to leave. Clear temporary data from plugins.
 | 
			
		||||
@ -246,7 +245,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                url: `/mod/assign/view.php?action=editsubmission&id=${this.moduleId}`,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
 | 
			
		||||
 | 
			
		||||
            // Leave the player.
 | 
			
		||||
            this.leaveWithoutCheck();
 | 
			
		||||
@ -376,7 +375,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            await this.saveSubmission();
 | 
			
		||||
            this.leaveWithoutCheck();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error saving submission.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error saving submission.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,6 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreGroupInfo } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import {
 | 
			
		||||
@ -34,6 +33,7 @@ import {
 | 
			
		||||
} from '../../services/assign-sync';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_GRADED_EVENT, ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a list of submissions of an assignment.
 | 
			
		||||
@ -107,8 +107,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
 | 
			
		||||
                AddonModAssignSubmissionListPage,
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -184,7 +183,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
 | 
			
		||||
                url: `/mod/assign/view.php?id=${this.assign.cmid}&action=grading`,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,13 +20,13 @@ import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreScreen } from '@services/screen';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { AddonModAssignListFilterName, AddonModAssignSubmissionsSource } from '../../classes/submissions-source';
 | 
			
		||||
import { AddonModAssignSubmissionComponent } from '../../components/submission/submission';
 | 
			
		||||
import { AddonModAssign, AddonModAssignAssign } from '../../services/assign';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a submission.
 | 
			
		||||
@ -99,8 +99,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
 | 
			
		||||
 | 
			
		||||
                this.submissions.start();
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
                CoreAlerts.showError(error);
 | 
			
		||||
                CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
@ -231,7 +230,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
 | 
			
		||||
                CoreNavigator.back();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreApp } from '@services/app';
 | 
			
		||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreArray } from '@singletons/array';
 | 
			
		||||
@ -36,6 +35,7 @@ import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { convertTextToHTMLElement } from '@/core/utils/create-html-element';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreOpener } from '@singletons/opener';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a Big Blue Button activity.
 | 
			
		||||
@ -287,7 +287,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
 | 
			
		||||
 | 
			
		||||
            await this.fetchRecordings();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.showLoading = false;
 | 
			
		||||
        }
 | 
			
		||||
@ -313,7 +313,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
 | 
			
		||||
 | 
			
		||||
            this.updateMeetingInfo(true);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -330,11 +330,10 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(
 | 
			
		||||
                Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm'),
 | 
			
		||||
                Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm_title'),
 | 
			
		||||
                Translate.instant('core.yes'),
 | 
			
		||||
            );
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm'), {
 | 
			
		||||
                header: Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm_title'),
 | 
			
		||||
                okText: Translate.instant('core.yes'),
 | 
			
		||||
            });
 | 
			
		||||
        } catch {
 | 
			
		||||
            // User canceled.
 | 
			
		||||
            return;
 | 
			
		||||
@ -347,7 +346,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
 | 
			
		||||
 | 
			
		||||
            this.updateMeetingInfo();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,6 @@ import { CoreCourseModulePrefetchDelegate } from '@features/course/services/modu
 | 
			
		||||
import { CoreTag, CoreTagItem } from '@features/tag/services/tag';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -38,6 +37,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { ADDON_MOD_BOOK_COMPONENT, AddonModBookNavStyle } from '../../constants';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a book contents.
 | 
			
		||||
@ -79,8 +79,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.initialChapterId = CoreNavigator.getRouteNumberParam('chapterId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -136,7 +135,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            await source.load();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -14,11 +14,11 @@
 | 
			
		||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { ModalController, NgZone } from '@singletons';
 | 
			
		||||
import { ModalController, NgZone, Translate } from '@singletons';
 | 
			
		||||
import { Subscription } from 'rxjs';
 | 
			
		||||
import { AddonModChat, AddonModChatUser } from '../../services/chat';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * MMdal that displays the chat session users.
 | 
			
		||||
@ -63,7 +63,7 @@ export class AddonModChatUsersModalComponent implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.users = data.users;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhilegettingchatusers', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhilegettingchatusers') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.usersLoaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -33,6 +32,7 @@ import { CoreKeyboard } from '@singletons/keyboard';
 | 
			
		||||
import { CoreWait } from '@singletons/wait';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a chat session.
 | 
			
		||||
@ -108,7 +108,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            this.startPolling();
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhileconnecting', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhileconnecting') });
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
@ -294,7 +294,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                // Fail again. Stop polling if needed.
 | 
			
		||||
                this.stopPolling();
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhileretrievingmessages', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhileretrievingmessages') });
 | 
			
		||||
 | 
			
		||||
                throw error;
 | 
			
		||||
            }
 | 
			
		||||
@ -331,7 +331,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            CoreKeyboard.close();
 | 
			
		||||
 | 
			
		||||
            this.newMessage = text;
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhilesendingmessage', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhilesendingmessage') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.sending = false;
 | 
			
		||||
        }
 | 
			
		||||
@ -380,7 +380,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Modified, confirm user wants to go back.
 | 
			
		||||
        await CoreDomUtils.showConfirm(Translate.instant('addon.mod_chat.confirmloss'));
 | 
			
		||||
        await CoreAlerts.confirm(Translate.instant('addon.mod_chat.confirmloss'));
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -16,13 +16,13 @@ import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { AddonModChat } from '../../services/chat';
 | 
			
		||||
import { AddonModChatFormattedSessionMessage, AddonModChatHelper } from '../../services/chat-helper';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays list of chat session messages.
 | 
			
		||||
@ -75,8 +75,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
 | 
			
		||||
            this.chatId = CoreNavigator.getRequiredRouteNumberParam('chatId');
 | 
			
		||||
            this.groupId = CoreNavigator.getRouteNumberParam('groupId') || 0;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -119,7 +118,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.messages[this.messages.length - 1].showTail = true;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,6 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreGroupInfo } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { AddonModChatSessionFormatted, AddonModChatSessionsSource } from '../../classes/chat-sessions-source';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
@ -26,6 +25,7 @@ import { Translate } from '@singletons';
 | 
			
		||||
import { AddonModChat } from '@addons/mod/chat/services/chat';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays list of chat sessions.
 | 
			
		||||
@ -73,8 +73,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
 | 
			
		||||
 | 
			
		||||
            this.sessions = new CoreListItemsManager(source, AddonModChatSessionsPage);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -119,7 +118,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -132,7 +131,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
 | 
			
		||||
        try {
 | 
			
		||||
            await this.sessions.reload();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,6 @@ import { CoreCourseModuleMainActivityComponent } from '@features/course/classes/
 | 
			
		||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -42,6 +41,7 @@ import {
 | 
			
		||||
    AddonModChoiceShowResults,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a choice.
 | 
			
		||||
@ -370,7 +370,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
 | 
			
		||||
        // Only show confirm if choice doesn't allow update.
 | 
			
		||||
        if (!this.choice.allowupdate) {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.areyousure'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const responses: number[] = [];
 | 
			
		||||
@ -401,7 +401,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
 | 
			
		||||
            await this.dataUpdated(online);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_choice.cannotsubmit', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_choice.cannotsubmit') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -416,7 +416,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm();
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
 | 
			
		||||
        } catch {
 | 
			
		||||
            // User cancelled.
 | 
			
		||||
            return;
 | 
			
		||||
@ -434,7 +434,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
            // Refresh the data. Don't call dataUpdated because deleting an answer doesn't mark the choice as outdated.
 | 
			
		||||
            await this.refreshContent(false);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_choice.cannotsubmit', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_choice.cannotsubmit') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,8 @@ import {
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->';
 | 
			
		||||
 | 
			
		||||
@ -436,7 +438,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
 | 
			
		||||
 | 
			
		||||
            this.logSearch?.();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.showLoading = false;
 | 
			
		||||
        }
 | 
			
		||||
@ -484,7 +486,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
 | 
			
		||||
        try {
 | 
			
		||||
            await this.fetchEntriesData();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,10 +19,10 @@ import { FormBuilder } from '@angular/forms';
 | 
			
		||||
import { SafeUrl } from '@angular/platform-browser';
 | 
			
		||||
import { CoreAnyError } from '@classes/errors/error';
 | 
			
		||||
import { CoreGeolocation, CoreGeolocationError, CoreGeolocationErrorReason } from '@services/geolocation';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CorePlatform } from '@services/platform';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { DomSanitizer } from '@singletons';
 | 
			
		||||
import { DomSanitizer, Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component to render data latlong field.
 | 
			
		||||
@ -140,12 +140,12 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa
 | 
			
		||||
     */
 | 
			
		||||
    protected showLocationErrorModal(error: CoreAnyError | CoreGeolocationError): void {
 | 
			
		||||
        if (error instanceof CoreGeolocationError) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(this.getGeolocationErrorMessage(error), true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant(this.getGeolocationErrorMessage(error)));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CoreDomUtils.showErrorModalDefault(error, 'Error getting location');
 | 
			
		||||
        CoreAlerts.showError(error, { default: 'Error getting location' });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreForms } from '@singletons/form';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -47,6 +46,7 @@ import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED, AddonModDataTem
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { CoreArray } from '@singletons/array';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the view edit page.
 | 
			
		||||
@ -126,7 +126,7 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
            this.entryId = CoreNavigator.getRouteNumberParam('entryId') || undefined;
 | 
			
		||||
            this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -156,7 +156,7 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
        if (changed) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Delete the local files from the tmp folder.
 | 
			
		||||
@ -238,7 +238,7 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
                if (!haveAccess) {
 | 
			
		||||
                    // You shall not pass, go back.
 | 
			
		||||
                    CoreDomUtils.showErrorModal('addon.mod_data.noaccess', true);
 | 
			
		||||
                    CoreAlerts.showError(Translate.instant('addon.mod_data.noaccess'));
 | 
			
		||||
 | 
			
		||||
                    // Go back to entry list.
 | 
			
		||||
                    this.forceLeave = true;
 | 
			
		||||
@ -251,7 +251,7 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
            this.editFormRender = this.displayEditFields();
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.loaded = true;
 | 
			
		||||
@ -395,10 +395,9 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
                    this.scrollToFirstError();
 | 
			
		||||
 | 
			
		||||
                    if (updateEntryResult.generalnotifications?.length) {
 | 
			
		||||
                        CoreDomUtils.showAlertWithOptions({
 | 
			
		||||
                        CoreAlerts.show({
 | 
			
		||||
                            header: Translate.instant('core.notice'),
 | 
			
		||||
                            message: CoreText.buildMessage(updateEntryResult.generalnotifications),
 | 
			
		||||
                            buttons: [Translate.instant('core.ok')],
 | 
			
		||||
                        });
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@ -406,7 +405,7 @@ export class AddonModDataEditPage implements OnInit {
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Cannot edit entry', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Cannot edit entry' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreGroups, CoreGroupInfo } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreArray } from '@singletons/array';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import { AddonModDataComponentsCompileModule } from '../../components/components-compile.module';
 | 
			
		||||
@ -44,6 +43,8 @@ import {
 | 
			
		||||
    AddonModDataTemplateMode,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the view entry page.
 | 
			
		||||
@ -156,8 +157,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
            const sortBy = Number(CoreNavigator.getRouteParam('sortBy'));
 | 
			
		||||
            this.sortBy = isNaN(sortBy) ? this.sortBy : sortBy;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -236,7 +236,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
                return this.refreshAllData(isPtr);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.content?.scrollToTop();
 | 
			
		||||
            this.entryLoaded = true;
 | 
			
		||||
 | 
			
		||||
@ -49,6 +49,7 @@ import {
 | 
			
		||||
} from '../constants';
 | 
			
		||||
import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Service that provides helper functions for datas.
 | 
			
		||||
@ -164,7 +165,7 @@ export class AddonModDataHelperProvider {
 | 
			
		||||
                // Approve/disapprove entry.
 | 
			
		||||
                await AddonModData.approveEntry(dataId, entryId, approve, courseId, siteId);
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.mod_data.errorapproving', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.mod_data.errorapproving') });
 | 
			
		||||
 | 
			
		||||
                throw error;
 | 
			
		||||
            }
 | 
			
		||||
@ -856,7 +857,7 @@ export class AddonModDataHelperProvider {
 | 
			
		||||
        siteId = siteId || CoreSites.getCurrentSiteId();
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm('addon.mod_data.confirmdeleterecord');
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('addon.mod_data.confirmdeleterecord'));
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show();
 | 
			
		||||
 | 
			
		||||
@ -869,7 +870,7 @@ export class AddonModDataHelperProvider {
 | 
			
		||||
                    await AddonModData.deleteEntry(dataId, entryId, courseId, siteId);
 | 
			
		||||
                }
 | 
			
		||||
            } catch (message) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(message, 'addon.mod_data.errordeleting', true);
 | 
			
		||||
                CoreAlerts.showError(message, { default: Translate.instant('addon.mod_data.errordeleting') });
 | 
			
		||||
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
 | 
			
		||||
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
 | 
			
		||||
import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
 | 
			
		||||
import {
 | 
			
		||||
@ -29,6 +28,8 @@ import { AddonModFeedbackAttempt, AddonModFeedbackFormItem, AddonModFeedbackHelp
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a feedback attempt review.
 | 
			
		||||
@ -89,8 +90,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.attempts.start();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -156,7 +156,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            // Some call failed on fetch, go back.
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -20,12 +20,13 @@ import { CorePromisedValue } from '@classes/promised-value';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreGroupInfo } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { AddonModFeedbackAttemptItem, AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
 | 
			
		||||
import { AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAttempt } from '../../services/feedback';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays feedback attempts.
 | 
			
		||||
@ -116,8 +117,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.promisedAttempts.resolve(new AddonModFeedbackAttemptsManager(source, this.route.component));
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -135,7 +135,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.fetchFailed = true;
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        await attempts.start(this.splitView);
 | 
			
		||||
@ -163,7 +163,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.fetchFailed = true;
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            infiniteComplete && infiniteComplete();
 | 
			
		||||
        }
 | 
			
		||||
@ -186,7 +186,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.fetchFailed = true;
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            refresher.complete();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -47,6 +46,7 @@ import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays feedback form.
 | 
			
		||||
@ -109,7 +109,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            this.preview = !!CoreNavigator.getRouteBooleanParam('preview');
 | 
			
		||||
            this.fromIndex = !!CoreNavigator.getRouteBooleanParam('fromIndex');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -119,7 +119,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        await this.fetchData();
 | 
			
		||||
 | 
			
		||||
        if (!this.access || this.access.isempty && (!this.access.canedititems && !this.access.canviewreports)) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(Translate.instant('core.nopermissiontoaccesspage'));
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('core.nopermissiontoaccesspage'));
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -160,7 +160,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            if (this.items && !this.completed && this.originalData) {
 | 
			
		||||
                // Form submitted. Check if there is any change.
 | 
			
		||||
                if (!CoreObject.basicLeftCompare(responses, this.originalData, 3)) {
 | 
			
		||||
                    await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
                    await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -200,7 +200,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            await this.fetchFeedbackPageData(page);
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
            this.forceLeave = true;
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
        } finally {
 | 
			
		||||
@ -405,7 +405,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                await this.fetchFeedbackPageData(response.jumpto);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.feedbackLoaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -15,12 +15,13 @@
 | 
			
		||||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { AddonModFeedback, AddonModFeedbackWSFeedback } from '../../services/feedback';
 | 
			
		||||
import { AddonModFeedbackHelper, AddonModFeedbackNonRespondent } from '../../services/feedback-helper';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays feedback non respondents.
 | 
			
		||||
@ -70,8 +71,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -102,7 +102,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (message) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
 | 
			
		||||
            if (!refresh) {
 | 
			
		||||
                // Some call failed on first fetch, go back.
 | 
			
		||||
@ -162,7 +162,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.loadGroupUsers(groupId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            infiniteComplete && infiniteComplete();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
@ -42,6 +41,7 @@ import {
 | 
			
		||||
} from '../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
const MODE_RESPONSETIME = 1;
 | 
			
		||||
const MODE_COURSE = 2;
 | 
			
		||||
@ -216,7 +216,7 @@ export class AddonModFeedbackHelperProvider {
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -17,10 +17,10 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
 | 
			
		||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_FEEDBACK_PAGE_NAME, AddonModFeedbackIndexTabName } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Content links handler for a feedback analysis.
 | 
			
		||||
@ -65,7 +65,7 @@ export class AddonModFeedbackAnalysisLinkHandlerService extends CoreContentLinks
 | 
			
		||||
                        },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Content links handler for feedback complete questions.
 | 
			
		||||
@ -60,7 +60,7 @@ export class AddonModFeedbackCompleteLinkHandlerService extends CoreContentLinks
 | 
			
		||||
                        },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Content links handler for feedback print questions.
 | 
			
		||||
@ -60,7 +60,7 @@ export class AddonModFeedbackPrintLinkHandlerService extends CoreContentLinksHan
 | 
			
		||||
                        },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
/**
 | 
			
		||||
 * Content links handler for feedback show non respondents.
 | 
			
		||||
 * Match mod/feedback/show_nonrespondents.php with a valid feedback id.
 | 
			
		||||
@ -54,7 +54,7 @@ export class AddonModFeedbackShowNonRespondentsLinkHandlerService extends CoreCo
 | 
			
		||||
                        { siteId },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,6 @@
 | 
			
		||||
 | 
			
		||||
import { Component, Input, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { PopoverController } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { AddonModForum, AddonModForumDiscussion } from '../../services/forum';
 | 
			
		||||
@ -22,6 +21,7 @@ import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants';
 | 
			
		||||
import { CoreToasts } from '@services/overlays/toasts';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This component is meant to display a popover with the discussion options.
 | 
			
		||||
@ -86,7 +86,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            PopoverController.dismiss();
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
@ -118,7 +118,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            PopoverController.dismiss();
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
@ -150,7 +150,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            PopoverController.dismiss();
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,6 @@ import {
 | 
			
		||||
} from '@addons/mod/forum/services/forum-sync';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
 | 
			
		||||
import { CoreScreen } from '@services/screen';
 | 
			
		||||
@ -68,6 +67,7 @@ import { CoreSearchGlobalSearch } from '@features/search/services/global-search'
 | 
			
		||||
import { CoreToasts } from '@services/overlays/toasts';
 | 
			
		||||
import { CorePopovers } from '@services/overlays/popovers';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a forum entry page.
 | 
			
		||||
 */
 | 
			
		||||
@ -475,7 +475,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
 | 
			
		||||
 | 
			
		||||
            await discussions.load();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetforum', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetforum') });
 | 
			
		||||
 | 
			
		||||
            this.fetchFailed = true;
 | 
			
		||||
        } finally {
 | 
			
		||||
@ -618,7 +618,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
 | 
			
		||||
                await CoreUser.setUserPreference(ADDON_MOD_FORUM_PREFERENCE_SORTORDER, sortOrder.value.toFixed(0));
 | 
			
		||||
                await this.showLoadingAndFetch();
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error updating preference.');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error updating preference.' });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -679,7 +679,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
 | 
			
		||||
                this.discussions?.reload(),
 | 
			
		||||
            ]);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -17,9 +17,9 @@ import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { AddonModForum, AddonModForumPost } from '@addons/mod/forum/services/forum';
 | 
			
		||||
import { PopoverController } from '@singletons';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreNetworkError } from '@classes/errors/network-error';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This component is meant to display a popover with the post options.
 | 
			
		||||
@ -65,7 +65,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit {
 | 
			
		||||
                            readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
 | 
			
		||||
                        });
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error getting discussion post.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error getting discussion post.' });
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                this.loaded = true;
 | 
			
		||||
@ -111,7 +111,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit {
 | 
			
		||||
    deletePost(): void {
 | 
			
		||||
        if (!this.offlinePost) {
 | 
			
		||||
            if (!CoreNetwork.isOnline()) {
 | 
			
		||||
                CoreDomUtils.showErrorModal(new CoreNetworkError());
 | 
			
		||||
                CoreAlerts.showError(new CoreNetworkError());
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -127,7 +127,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit {
 | 
			
		||||
     */
 | 
			
		||||
    editPost(): void {
 | 
			
		||||
        if (!this.offlinePost && !CoreNetwork.isOnline()) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(new CoreNetworkError());
 | 
			
		||||
            CoreAlerts.showError(new CoreNetworkError());
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,6 @@ import {
 | 
			
		||||
    ViewChild,
 | 
			
		||||
} from '@angular/core';
 | 
			
		||||
import { FormControl } from '@angular/forms';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import {
 | 
			
		||||
@ -60,6 +59,7 @@ import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreWSFile } from '@services/ws';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Components that shows a discussion post, its attachments and the action buttons allowed (reply, etc.).
 | 
			
		||||
@ -155,7 +155,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
        this.analyticsLogEvent('mod_forum_delete_post', `/mod/forum/post.php?delete=${this.post.id}`);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm('addon.mod_forum.deletesure');
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('addon.mod_forum.deletesure'));
 | 
			
		||||
 | 
			
		||||
            const modal = await CoreLoadings.show('core.deleting', true);
 | 
			
		||||
 | 
			
		||||
@ -181,7 +181,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
                    translateMessage: true,
 | 
			
		||||
                });
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModal(error);
 | 
			
		||||
                CoreAlerts.showError(error);
 | 
			
		||||
            } finally {
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            }
 | 
			
		||||
@ -364,7 +364,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
 | 
			
		||||
            this.analyticsLogEvent('mod_forum_update_discussion_post', `/mod/forum/post.php?edit=${this.post.id}`);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetpost', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetpost') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -384,13 +384,13 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
     */
 | 
			
		||||
    async send(): Promise<void> {
 | 
			
		||||
        if (!this.formData.subject) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_forum.erroremptysubject', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptysubject'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!this.formData.message) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_forum.erroremptymessage', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptymessage'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -481,11 +481,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
 | 
			
		||||
            this.unblockOperation();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(
 | 
			
		||||
                error,
 | 
			
		||||
                isEditOnline ? 'addon.mod_forum.couldnotupdate' : 'addon.mod_forum.couldnotadd',
 | 
			
		||||
                true,
 | 
			
		||||
            );
 | 
			
		||||
            CoreAlerts.showError(error, {
 | 
			
		||||
                default: Translate.instant(isEditOnline ? 'addon.mod_forum.couldnotupdate' : 'addon.mod_forum.couldnotadd'),
 | 
			
		||||
            });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -589,7 +587,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
     */
 | 
			
		||||
    async discardOfflineReply(): Promise<void> {
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showDeleteConfirm();
 | 
			
		||||
            await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
 | 
			
		||||
 | 
			
		||||
            const promises: Promise<void>[] = [];
 | 
			
		||||
 | 
			
		||||
@ -643,7 +641,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
 | 
			
		||||
    protected async confirmDiscard(): Promise<void> {
 | 
			
		||||
        if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmloss'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmloss'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.unblockOperation();
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,6 @@ import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreScreen } from '@services/screen';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreDom } from '@singletons/dom';
 | 
			
		||||
@ -64,6 +63,7 @@ import { CoreToasts } from '@services/overlays/toasts';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
type SortType = 'flat-newest' | 'flat-oldest' | 'nested';
 | 
			
		||||
 | 
			
		||||
@ -171,7 +171,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                await this.discussions.start();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            this.goBack();
 | 
			
		||||
 | 
			
		||||
@ -303,7 +303,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
    async canLeave(): Promise<boolean> {
 | 
			
		||||
        if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Delete the local files from the tmp folder.
 | 
			
		||||
@ -571,7 +571,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
            this.hasOfflineRatings =
 | 
			
		||||
                await CoreRatingOffline.hasRatings('mod_forum', 'post', ContextLevel.MODULE, this.cmId, this.discussionId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.discussionLoaded = true;
 | 
			
		||||
            this.refreshIcon = CoreConstants.ICON_REFRESH;
 | 
			
		||||
@ -616,7 +616,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                .syncDiscussionReplies(this.discussionId)
 | 
			
		||||
                .then((result) => {
 | 
			
		||||
                    if (result.warnings && result.warnings.length) {
 | 
			
		||||
                        CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                        CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (result && result.updated && this.forumId) {
 | 
			
		||||
@ -637,7 +637,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                .syncRatings(this.cmId, this.discussionId)
 | 
			
		||||
                .then((result) => {
 | 
			
		||||
                    if (result.warnings && result.warnings.length) {
 | 
			
		||||
                        CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                        CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    return;
 | 
			
		||||
@ -648,7 +648,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
            await Promise.all(promises);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (showErrors) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new Error('Failed syncing discussion');
 | 
			
		||||
@ -740,7 +740,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -776,7 +776,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -812,7 +812,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
 | 
			
		||||
                translateMessage: true,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ import {
 | 
			
		||||
import { CoreEditorRichTextEditorComponent } from '@features/editor/components/rich-text-editor/rich-text-editor';
 | 
			
		||||
import { AddonModForumSync } from '@addons/mod/forum/services/forum-sync';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { AddonModForumDiscussionOptions, AddonModForumOffline } from '@addons/mod/forum/services/forum-offline';
 | 
			
		||||
@ -54,6 +53,7 @@ import {
 | 
			
		||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
type NewDiscussionData = {
 | 
			
		||||
    subject: string;
 | 
			
		||||
@ -159,7 +159,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
                await this.discussions.start();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            this.goBack();
 | 
			
		||||
 | 
			
		||||
@ -183,7 +183,10 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
        // Refresh data if this discussion is synchronized automatically.
 | 
			
		||||
        this.syncObserver = CoreEvents.on(ADDON_MOD_FORUM_AUTO_SYNCED, data => {
 | 
			
		||||
            if (data.forumId == this.forumId && data.userId == CoreSites.getCurrentSiteUserId()) {
 | 
			
		||||
                CoreDomUtils.showAlertTranslated('core.notice', 'core.contenteditingsynced');
 | 
			
		||||
                CoreAlerts.show({
 | 
			
		||||
                    header: Translate.instant('core.notice'),
 | 
			
		||||
                    message: Translate.instant('core.contenteditingsynced'),
 | 
			
		||||
                });
 | 
			
		||||
                this.returnToDiscussions();
 | 
			
		||||
            }
 | 
			
		||||
        }, CoreSites.getCurrentSiteId());
 | 
			
		||||
@ -336,7 +339,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetgroups', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetgroups') });
 | 
			
		||||
 | 
			
		||||
            this.showForm = false;
 | 
			
		||||
        }
 | 
			
		||||
@ -541,12 +544,12 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (!subject) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_forum.erroremptysubject', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptysubject'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (!message) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_forum.erroremptymessage', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptymessage'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -584,7 +587,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
 | 
			
		||||
            if (discussionIds && discussionIds.length < groupIds.length) {
 | 
			
		||||
                // Some discussions could not be created.
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true);
 | 
			
		||||
                CoreAlerts.showError(Translate.instant('addon.mod_forum.errorposttoallgroups'));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreForms.triggerFormSubmittedEvent(
 | 
			
		||||
@ -595,7 +598,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
 | 
			
		||||
            this.returnToDiscussions(discussionIds, discTimecreated);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.cannotcreatediscussion', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.cannotcreatediscussion') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -606,7 +609,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
     */
 | 
			
		||||
    async discard(): Promise<void> {
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.areyousure'));
 | 
			
		||||
 | 
			
		||||
            const promises: Promise<unknown>[] = [];
 | 
			
		||||
 | 
			
		||||
@ -659,7 +662,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
 | 
			
		||||
 | 
			
		||||
        if (AddonModForumHelper.hasPostDataChanged(this.newDiscussion, this.originalData)) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Delete the local files from the tmp folder.
 | 
			
		||||
 | 
			
		||||
@ -31,6 +31,7 @@ import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
    selector: 'page-addon-mod-forum-search',
 | 
			
		||||
@ -82,7 +83,7 @@ export class AddonModForumSearchPage implements OnInit {
 | 
			
		||||
            this.resultsSource.setFilters(filters);
 | 
			
		||||
            this.ready.resolve();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,6 @@ import { CoreRatingSyncProvider } from '@features/rating/services/rating-sync';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -59,6 +58,7 @@ import {
 | 
			
		||||
    GLOSSARY_AUTO_SYNCED,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CorePopovers } from '@services/overlays/popovers';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a glossary entry page.
 | 
			
		||||
@ -339,7 +339,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
 | 
			
		||||
            await entries.load();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.loadMoreError = true;
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentries', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentries') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            infiniteComplete && infiniteComplete();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,6 @@ import { CoreFileEntry } from '@services/file-helper';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -41,6 +40,7 @@ import { AddonModGlossaryOffline } from '../../services/glossary-offline';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_GLOSSARY_COMPONENT } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the edit form.
 | 
			
		||||
@ -108,7 +108,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
 | 
			
		||||
                this.handler = new AddonModGlossaryNewFormHandler(this);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -142,7 +142,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
 | 
			
		||||
                url: '/mod/glossary/edit.php' + (this.entry ? `?cmid=${this.cmId}&id=${this.entry.id}` : ''),
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingglossary', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingglossary') });
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -187,7 +187,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
 | 
			
		||||
 | 
			
		||||
        if (this.hasDataChanged()) {
 | 
			
		||||
            // Show confirmation if some data has been modified.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Delete the local files from the tmp folder.
 | 
			
		||||
@ -203,7 +203,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
 | 
			
		||||
     */
 | 
			
		||||
    async save(): Promise<void> {
 | 
			
		||||
        if (!this.data.concept || !this.data.definition) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_glossary.fillfields', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_glossary.fillfields'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -223,7 +223,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.cannoteditentry', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.cannoteditentry') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,6 @@ import { CoreTag } from '@features/tag/services/tag';
 | 
			
		||||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -42,6 +41,7 @@ import { ADDON_MOD_GLOSSARY_COMPONENT, ADDON_MOD_GLOSSARY_ENTRY_UPDATED, ADDON_M
 | 
			
		||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
 | 
			
		||||
import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a glossary entry.
 | 
			
		||||
@ -126,7 +126,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
                onlineEntryId = Number(this.entrySlug);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            this.goBack();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -185,7 +185,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
        const glossaryId = this.glossary?.id;
 | 
			
		||||
        const cancelled = await CorePromiseUtils.promiseFails(
 | 
			
		||||
            CoreDomUtils.showConfirm(Translate.instant('addon.mod_glossary.areyousuredelete')),
 | 
			
		||||
            CoreAlerts.confirm(Translate.instant('addon.mod_glossary.areyousuredelete')),
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        if (!glossaryId || cancelled) {
 | 
			
		||||
@ -224,7 +224,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            await this.goBack();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errordeleting', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errordeleting') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -274,7 +274,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentry', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentry') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -298,7 +298,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.canEdit = true;
 | 
			
		||||
            this.canDelete = true;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentry', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentry') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Content links handler for glossary new entry.
 | 
			
		||||
@ -56,7 +56,7 @@ export class AddonModGlossaryEditLinkHandlerService extends CoreContentLinksHand
 | 
			
		||||
                        { siteId },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingglossary', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingglossary') });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    // Just in case. In fact we need to dismiss the modal before showing a toast or error message.
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
 | 
			
		||||
@ -18,11 +18,11 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { AddonModGlossary } from '../glossary';
 | 
			
		||||
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to treat links to glossary entries.
 | 
			
		||||
@ -67,7 +67,7 @@ export class AddonModGlossaryEntryLinkHandlerService extends CoreContentLinksHan
 | 
			
		||||
                        },
 | 
			
		||||
                    );
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentry', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentry') });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,6 @@ import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreFilepool } from '@services/filepool';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreWSFile } from '@services/ws';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
import {
 | 
			
		||||
@ -58,6 +57,8 @@ import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
 | 
			
		||||
import { Subscription } from 'rxjs';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays an H5P activity entry page.
 | 
			
		||||
@ -146,7 +147,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
 | 
			
		||||
        if (this.playing && !this.fileUrl && !this.isOnline && wasOnline && this.trackComponent) {
 | 
			
		||||
            // User lost connection while playing an online package with tracking. Show an error.
 | 
			
		||||
            this.offlineErrorAlert = await CoreDomUtils.showErrorModal(
 | 
			
		||||
            this.offlineErrorAlert = await CoreAlerts.showError(
 | 
			
		||||
                new CoreError(Translate.instant('core.course.changesofflinemaybelost'), {
 | 
			
		||||
                    title: Translate.instant('core.youreoffline'),
 | 
			
		||||
                }),
 | 
			
		||||
@ -398,14 +399,14 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!CoreNetwork.isOnline()) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('core.networkerrormsg', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('core.networkerrormsg'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            // Confirm the download if needed.
 | 
			
		||||
            await CoreDomUtils.confirmDownloadSize({ size: this.deployedFile.filesize || 0, total: true });
 | 
			
		||||
            await CoreAlerts.confirmDownloadSize({ size: this.deployedFile.filesize || 0, total: true });
 | 
			
		||||
 | 
			
		||||
            await this.downloadDeployedFile();
 | 
			
		||||
 | 
			
		||||
@ -414,7 +415,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (CoreDomUtils.isCanceledError(error) || this.isDestroyed) {
 | 
			
		||||
            if (CoreErrorHelper.isCanceledError(error) || this.isDestroyed) {
 | 
			
		||||
                // User cancelled or view destroyed, stop.
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -433,7 +434,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -450,7 +451,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
                this.play();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -522,7 +523,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
        if (!this.fileUrl && !this.isOnline) {
 | 
			
		||||
            this.triedToPlay = true;
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModal(new CoreError(Translate.instant('core.connectandtryagain'), {
 | 
			
		||||
            CoreAlerts.showError(new CoreError(Translate.instant('core.connectandtryagain'), {
 | 
			
		||||
                title: Translate.instant('core.course.activitynotavailableoffline'),
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
@ -697,7 +698,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -757,7 +758,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
 | 
			
		||||
            this.hasOffline = !sent;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -778,7 +779,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ import { Component, OnInit } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import {
 | 
			
		||||
    AddonModH5PActivity,
 | 
			
		||||
@ -26,6 +25,7 @@ import {
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_H5PACTIVITY_COMPONENT } from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays results of an attempt.
 | 
			
		||||
@ -78,8 +78,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
 | 
			
		||||
            this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
 | 
			
		||||
            this.attemptId = CoreNavigator.getRequiredRouteNumberParam('attemptId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -116,7 +115,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading attempt.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading attempt.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -16,9 +16,9 @@ import { Component, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page';
 | 
			
		||||
import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { AddonModH5PActivityIndexComponent } from '../../components/index';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays an H5P activity.
 | 
			
		||||
@ -45,7 +45,7 @@ export class AddonModH5PActivityIndexPage extends CoreCourseModuleMainActivityPa
 | 
			
		||||
 | 
			
		||||
        if (!this.canLeaveSafely) {
 | 
			
		||||
            try {
 | 
			
		||||
                await CoreDomUtils.showConfirm(Translate.instant('core.confirmleaveunknownchanges'));
 | 
			
		||||
                await CoreAlerts.confirm(Translate.instant('core.confirmleaveunknownchanges'));
 | 
			
		||||
 | 
			
		||||
                return true;
 | 
			
		||||
            } catch {
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import {
 | 
			
		||||
    AddonModH5PActivity,
 | 
			
		||||
@ -27,6 +26,7 @@ import {
 | 
			
		||||
} from '../../services/h5pactivity';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays user attempts of a certain user.
 | 
			
		||||
@ -79,8 +79,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
 | 
			
		||||
            this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
 | 
			
		||||
            this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -118,7 +117,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading attempts.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading attempts.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
 | 
			
		||||
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import {
 | 
			
		||||
    AddonModH5PActivity,
 | 
			
		||||
@ -26,6 +25,7 @@ import {
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { AddonModH5PActivityGradeMethod } from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays all users that can attempt an H5P activity.
 | 
			
		||||
@ -74,8 +74,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -111,7 +110,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading attempts.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading attempts.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -192,7 +191,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.fetchUsers(false);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading more users');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading more users' });
 | 
			
		||||
 | 
			
		||||
            this.fetchMoreUsersFailed = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -19,12 +19,12 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { AddonModH5PActivity } from '../h5pactivity';
 | 
			
		||||
import { ADDON_MOD_H5PACTIVITY_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to treat links to H5P activity report.
 | 
			
		||||
@ -65,7 +65,7 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink
 | 
			
		||||
                        await this.openUserAttempts(module.id, module.course, instanceId, siteId, userId);
 | 
			
		||||
                    }
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error processing link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error processing link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -22,12 +22,12 @@ import { CoreCourseModuleData } from '@features/course/services/course-helper';
 | 
			
		||||
import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { AddonModImscp, AddonModImscpImscp, AddonModImscpTocItem } from '../../services/imscp';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a IMSCP content.
 | 
			
		||||
@ -61,8 +61,7 @@ export class AddonModImscpViewPage implements OnInit {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.initialItemHref = CoreNavigator.getRouteParam('initialHref');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -118,7 +117,7 @@ export class AddonModImscpViewPage implements OnInit {
 | 
			
		||||
            try {
 | 
			
		||||
                await this.loadItemHref(this.currentHref);
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.mod_imscp.deploymenterror', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.mod_imscp.deploymenterror') });
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -130,7 +129,7 @@ export class AddonModImscpViewPage implements OnInit {
 | 
			
		||||
                this.warning = '';
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { IonContent, IonInput } from '@ionic/angular';
 | 
			
		||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreForms } from '@singletons/form';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
@ -52,6 +51,7 @@ import {
 | 
			
		||||
    ADDON_MOD_LESSON_DATA_SENT_EVENT,
 | 
			
		||||
    ADDON_MOD_LESSON_PAGE_NAME,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a lesson entry page.
 | 
			
		||||
@ -126,7 +126,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
        try {
 | 
			
		||||
            await this.setGroup(groupId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting report.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting report.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.reportLoaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -464,7 +464,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
 | 
			
		||||
        if (!this.groupInfo) {
 | 
			
		||||
            this.fetchReportData().catch((error) => {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'Error getting report.');
 | 
			
		||||
                CoreAlerts.showError(error, { default: 'Error getting report.' });
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -613,7 +613,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
                // Error downloading but there is something offline, allow continuing it.
 | 
			
		||||
                this.playLesson(continueLast);
 | 
			
		||||
            } else {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
 | 
			
		||||
            }
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.showSpinner = false;
 | 
			
		||||
@ -632,7 +632,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
 | 
			
		||||
        const password = passwordEl?.value;
 | 
			
		||||
        if (!password) {
 | 
			
		||||
            CoreDomUtils.showErrorModal('addon.mod_lesson.emptypassword', true);
 | 
			
		||||
            CoreAlerts.showError(Translate.instant('addon.mod_lesson.emptypassword'));
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -652,7 +652,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
            // Log view now that we have the password.
 | 
			
		||||
            this.logActivity();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.showLoading = false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUrl } from '@singletons/url';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { CoreWSExternalFile } from '@services/ws';
 | 
			
		||||
@ -58,6 +57,7 @@ import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
			
		||||
import { CoreDom } from '@singletons/dom';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows attempting and reviewing a lesson.
 | 
			
		||||
@ -131,7 +131,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            this.currentPage = CoreNavigator.getRouteNumberParam('pageId');
 | 
			
		||||
            this.retakeToReview = CoreNavigator.getRouteNumberParam('retake');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -173,7 +173,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        if (this.question && !this.eolData && !this.processData && this.originalData) {
 | 
			
		||||
            // Question shown. Check if there is any change.
 | 
			
		||||
            if (!CoreObject.basicLeftCompare(this.questionForm.getRawValue(), this.originalData, 3)) {
 | 
			
		||||
                await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
                await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -258,7 +258,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.loadPage(pageId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading page');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading page' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -363,7 +363,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                await AddonModLessonSync.deleteRetakeFinishedInSync(this.lesson!.id);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
            this.forceLeave = true;
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -406,7 +406,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                // Retake hasn't changed, show the warning and finish the retake in offline.
 | 
			
		||||
                CoreDomUtils.showAlert(undefined, result.warnings[0]);
 | 
			
		||||
                CoreAlerts.show({ message: result.warnings[0] });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.offline = false;
 | 
			
		||||
@ -546,7 +546,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.lessonPages = pages.map((entry) => entry.page);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading menu.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading menu.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loadingMenu = false;
 | 
			
		||||
        }
 | 
			
		||||
@ -763,7 +763,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.logContinuePageLoaded();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error processing page');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error processing page' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -782,7 +782,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.loadPage(pageId);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading page');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading page' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -818,7 +818,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        try {
 | 
			
		||||
            await this.finishRetake(true);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error finishing attempt');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error finishing attempt' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,6 @@ import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CoreUser } from '@features/user/services/user';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -36,6 +35,7 @@ import { CoreTime } from '@singletons/time';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_LESSON_COMPONENT } from '../../constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays a retake made by a certain user.
 | 
			
		||||
@ -76,8 +76,7 @@ export class AddonModLessonUserRetakePage implements OnInit {
 | 
			
		||||
            this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
 | 
			
		||||
            this.retakeNumber = CoreNavigator.getRouteNumberParam('retake');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -103,7 +102,7 @@ export class AddonModLessonUserRetakePage implements OnInit {
 | 
			
		||||
            this.performLogView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.selectedRetake = this.previousSelectedRetake ?? this.selectedRetake;
 | 
			
		||||
            CoreDomUtils.showErrorModal(CoreErrorHelper.addDataNotDownloadedError(error, 'Error getting attempt.'));
 | 
			
		||||
            CoreAlerts.showError(CoreErrorHelper.addDataNotDownloadedError(error, 'Error getting attempt.'));
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -171,7 +170,7 @@ export class AddonModLessonUserRetakePage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting data.', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('Error getting data.') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,11 +19,11 @@ import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreCourseHelper } from '@features/course/services/course-helper';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { AddonModLesson } from '../lesson';
 | 
			
		||||
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to treat links to lesson grade.
 | 
			
		||||
@ -84,7 +84,7 @@ export class AddonModLessonGradeLinkHandlerService extends CoreContentLinksModul
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { CoreFilepool } from '@services/filepool';
 | 
			
		||||
import { CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreFileSizeSum, CorePluginFileDelegate } from '@services/plugin-file-delegate';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreWSFile } from '@services/ws';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
@ -33,6 +32,7 @@ import {
 | 
			
		||||
} from '../lesson';
 | 
			
		||||
import { AddonModLessonSync, AddonModLessonSyncResult } from '../lesson-sync';
 | 
			
		||||
import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo, AddonModLessonPageSubtype } from '../../constants';
 | 
			
		||||
import { CorePrompts } from '@services/overlays/prompts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to prefetch lessons.
 | 
			
		||||
@ -136,7 +136,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Create and show the modal.
 | 
			
		||||
        const response = await CoreModals.promptPassword({
 | 
			
		||||
        const response = await CorePrompts.promptPassword({
 | 
			
		||||
            title: 'addon.mod_lesson.enterpassword',
 | 
			
		||||
            placeholder: 'core.login.password',
 | 
			
		||||
            submit: 'addon.mod_lesson.continue',
 | 
			
		||||
 | 
			
		||||
@ -19,10 +19,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to treat links to lesson report.
 | 
			
		||||
@ -111,7 +111,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
 | 
			
		||||
                { params, siteId },
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error processing link.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error processing link.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -150,7 +150,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
 | 
			
		||||
                { params, siteId },
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error processing link.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error processing link.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -18,12 +18,12 @@ import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
 | 
			
		||||
import { CorePlatform } from '@services/platform';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { AddonModLti, AddonModLtiLti } from './lti';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Service that provides some helper functions for LTI.
 | 
			
		||||
@ -93,7 +93,7 @@ export class AddonModLtiHelperProvider {
 | 
			
		||||
            // Launch LTI.
 | 
			
		||||
            return AddonModLti.launch(launchData.endpoint, launchData.parameters);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_lti.errorgetlti', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_lti.errorgetlti') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { CoreCourseContentsPage } from '@features/course/pages/contents/contents
 | 
			
		||||
import { CoreQuestionBehaviourDelegate } from '@features/question/services/behaviour-delegate';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
@ -51,6 +50,7 @@ import {
 | 
			
		||||
    AddonModQuizAttemptStates,
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { QuestionDisplayOptionsMarks } from '@features/question/constants';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a quiz entry page.
 | 
			
		||||
@ -167,7 +167,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
 | 
			
		||||
                // If the site doesn't support check updates, continue too because we cannot tell if there's something new.
 | 
			
		||||
                this.openQuiz();
 | 
			
		||||
            } else {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
 | 
			
		||||
            }
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.showStatusSpinner = false;
 | 
			
		||||
@ -192,7 +192,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
 | 
			
		||||
 | 
			
		||||
        if (warnings?.length) {
 | 
			
		||||
            // Show warnings and delete them so they aren't shown again.
 | 
			
		||||
            CoreDomUtils.showErrorModal(CoreText.buildMessage(warnings));
 | 
			
		||||
            CoreAlerts.showError(CoreText.buildMessage(warnings));
 | 
			
		||||
 | 
			
		||||
            await AddonModQuizSync.setSyncWarnings(quiz.id, []);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -15,8 +15,6 @@
 | 
			
		||||
import { Component, OnInit, ViewChild, ElementRef, Input, Type } from '@angular/core';
 | 
			
		||||
import { FormBuilder, FormGroup } from '@angular/forms';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreForms } from '@singletons/form';
 | 
			
		||||
import { ModalController, Translate } from '@singletons';
 | 
			
		||||
import { AddonModQuizAccessRuleDelegate } from '../../services/access-rules-delegate';
 | 
			
		||||
@ -24,6 +22,7 @@ import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../../service
 | 
			
		||||
import { CoreDom } from '@singletons/dom';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Modal that renders the access rules for a quiz.
 | 
			
		||||
@ -107,7 +106,7 @@ export class AddonModQuizPreflightModalComponent implements OnInit {
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error loading rules');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error loading rules' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
@ -130,7 +129,7 @@ export class AddonModQuizPreflightModalComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
            if (!hasScrolled) {
 | 
			
		||||
                // Input not found, show an error modal.
 | 
			
		||||
                CoreDomUtils.showErrorModal('core.errorinvalidform', true);
 | 
			
		||||
                CoreAlerts.showError(Translate.instant('core.errorinvalidform'));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            CoreForms.triggerFormSubmittedEvent(this.formElement, false, this.siteId);
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ import { CoreQuestionBehaviourButton, CoreQuestionHelper } from '@features/quest
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { ModalController, Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -56,6 +55,7 @@ import { ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT, AddonModQuizAttemptStates, ADDON
 | 
			
		||||
import { CoreWait } from '@singletons/wait';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows attempting a quiz.
 | 
			
		||||
@ -124,7 +124,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
 | 
			
		||||
            this.moduleUrl = CoreNavigator.getRouteParam('moduleUrl');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
@ -178,7 +178,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            // Save attempt failed. Show confirmation.
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('addon.mod_quiz.confirmleavequizonerror'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('addon.mod_quiz.confirmleavequizonerror'));
 | 
			
		||||
 | 
			
		||||
            CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
 | 
			
		||||
        } finally {
 | 
			
		||||
@ -219,7 +219,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            // Confirm that the user really wants to do it.
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.areyousure'));
 | 
			
		||||
 | 
			
		||||
            modal = await CoreLoadings.show('core.sending', true);
 | 
			
		||||
 | 
			
		||||
@ -253,7 +253,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error performing action.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error performing action.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal?.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
@ -303,7 +303,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorsaveattempt', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('addon.mod_quiz.errorsaveattempt') });
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
@ -330,7 +330,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                this.autoSave.startCheckChangesProcess(this.quiz, this.attempt, this.preflightData, this.offline);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquestions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_quiz.errorgetquestions') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -437,11 +437,10 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
                    `;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await CoreDomUtils.showConfirm(
 | 
			
		||||
                    message,
 | 
			
		||||
                    Translate.instant('addon.mod_quiz.submitallandfinish'),
 | 
			
		||||
                    Translate.instant('core.submit'),
 | 
			
		||||
                );
 | 
			
		||||
                await CoreAlerts.confirm(message, {
 | 
			
		||||
                    header: Translate.instant('addon.mod_quiz.submitallandfinish'),
 | 
			
		||||
                    okText: Translate.instant('core.submit'),
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            modal = await CoreLoadings.show('core.sending', true);
 | 
			
		||||
@ -471,8 +470,8 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            // eslint-disable-next-line promise/catch-or-return
 | 
			
		||||
            CoreDomUtils
 | 
			
		||||
                .showErrorModalDefault(error, 'addon.mod_quiz.errorsaveattempt', true)
 | 
			
		||||
            CoreAlerts
 | 
			
		||||
                .showError(error, { default: Translate.instant('addon.mod_quiz.errorsaveattempt') })
 | 
			
		||||
                .then(async alert => {
 | 
			
		||||
                    await alert?.onWillDismiss();
 | 
			
		||||
 | 
			
		||||
@ -882,7 +881,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            // Quiz data has been loaded, try to start or continue.
 | 
			
		||||
            await this.startOrContinueAttempt();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquiz', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_quiz.errorgetquiz') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { CoreQuestionQuestionForView } from '@features/question/services/questio
 | 
			
		||||
import { CoreQuestionHelper } from '@features/question/services/question-helper';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreDom } from '@singletons/dom';
 | 
			
		||||
import { CoreTime } from '@singletons/time';
 | 
			
		||||
@ -36,6 +35,8 @@ import { AddonModQuizHelper } from '../../services/quiz-helper';
 | 
			
		||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_QUIZ_COMPONENT } from '../../constants';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows reviewing a quiz attempt.
 | 
			
		||||
@ -92,8 +93,7 @@ export class AddonModQuizReviewPage implements OnInit {
 | 
			
		||||
            this.currentPage = CoreNavigator.getRouteNumberParam('page') || -1;
 | 
			
		||||
            this.showAll = this.currentPage == -1;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -131,7 +131,7 @@ export class AddonModQuizReviewPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.performLogView(false, { page });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquestions', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_quiz.errorgetquestions') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
 | 
			
		||||
@ -163,7 +163,7 @@ export class AddonModQuizReviewPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
            this.logView();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquiz', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_quiz.errorgetquiz') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,7 @@ import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { convertTextToHTMLElement } from '@/core/utils/create-html-element';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Helper service that provides some features for quiz.
 | 
			
		||||
@ -233,7 +234,7 @@ export class AddonModQuizHelperProvider {
 | 
			
		||||
            // Show error and ask for the preflight again.
 | 
			
		||||
            // Wait to show the error because we want it to be shown over the preflight modal.
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            }, 100);
 | 
			
		||||
 | 
			
		||||
            return this.getAndCheckPreflightData(quiz, accessInfo, preflightData, {
 | 
			
		||||
@ -362,7 +363,7 @@ export class AddonModQuizHelperProvider {
 | 
			
		||||
                },
 | 
			
		||||
            );
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'An error occurred while loading the required data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'An error occurred while loading the required data.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ import { CoreCourseModulePrefetchDelegate } from '@features/course/services/modu
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreMimetypeUtils } from '@services/utils/mimetype';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
@ -36,6 +35,7 @@ import { CorePlatform } from '@services/platform';
 | 
			
		||||
import { ADDON_MOD_RESOURCE_COMPONENT } from '../../constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { OpenFileAction } from '@singletons/opener';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a resource.
 | 
			
		||||
@ -214,10 +214,9 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource
 | 
			
		||||
            if (downloadable) {
 | 
			
		||||
                if (this.currentStatus === DownloadStatus.OUTDATED && !this.isOnline && !this.isExternalFile) {
 | 
			
		||||
                    // Warn the user that the file isn't updated.
 | 
			
		||||
                    const alert = await CoreDomUtils.showAlert(
 | 
			
		||||
                        undefined,
 | 
			
		||||
                        Translate.instant('addon.mod_resource.resourcestatusoutdatedconfirm'),
 | 
			
		||||
                    );
 | 
			
		||||
                    const alert = await CoreAlerts.show({
 | 
			
		||||
                        message: Translate.instant('addon.mod_resource.resourcestatusoutdatedconfirm'),
 | 
			
		||||
                    });
 | 
			
		||||
 | 
			
		||||
                    await alert.onWillDismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,6 @@ import { CoreFile } from '@services/file';
 | 
			
		||||
import { CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { CoreFilepool } from '@services/filepool';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreMimetypeUtils } from '@services/utils/mimetype';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import { CorePath } from '@singletons/path';
 | 
			
		||||
@ -33,6 +32,7 @@ import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { ADDON_MOD_RESOURCE_COMPONENT } from '../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreOpenerOpenFileOptions } from '@singletons/opener';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Service that provides helper functions for resources.
 | 
			
		||||
@ -220,7 +220,7 @@ export class AddonModResourceHelperProvider {
 | 
			
		||||
                url: `/mod/resource/view.php?id=${module.id}`,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_resource.errorwhileloadingthecontent', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_resource.errorwhileloadingthecontent') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreObject } from '@singletons/object';
 | 
			
		||||
import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -53,6 +52,7 @@ import { CoreWait } from '@singletons/wait';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { Subscription } from 'rxjs';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a SCORM entry page.
 | 
			
		||||
@ -463,7 +463,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom
 | 
			
		||||
        try {
 | 
			
		||||
            await this.loadOrganizationToc(this.scorm, this.currentOrganization.identifier);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant(this.fetchContentDefaultError) });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -549,10 +549,9 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            if (!this.isDestroyed) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(
 | 
			
		||||
                    error,
 | 
			
		||||
                    Translate.instant('addon.mod_scorm.errordownloadscorm', { name: scorm.name }),
 | 
			
		||||
                );
 | 
			
		||||
                CoreAlerts.showError(error, {
 | 
			
		||||
                    default: Translate.instant('addon.mod_scorm.errordownloadscorm', { name: scorm.name }),
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,6 @@
 | 
			
		||||
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import {
 | 
			
		||||
    AddonModScorm,
 | 
			
		||||
@ -33,6 +32,7 @@ import { NgZone, Translate } from '@singletons';
 | 
			
		||||
import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CoreWait } from '@singletons/wait';
 | 
			
		||||
import { CoreIframeComponent } from '@components/iframe/iframe';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows playing a SCORM in online, served from the server.
 | 
			
		||||
@ -78,7 +78,7 @@ export default class AddonModScormOnlinePlayerPage implements OnInit, OnDestroy
 | 
			
		||||
 | 
			
		||||
                if (!isOnline && wasOnline) {
 | 
			
		||||
                    // User lost connection while playing an online package. Show an error.
 | 
			
		||||
                    CoreDomUtils.showErrorModal(new CoreError(Translate.instant('core.course.changesofflinemaybelost'), {
 | 
			
		||||
                    CoreAlerts.showError(new CoreError(Translate.instant('core.course.changesofflinemaybelost'), {
 | 
			
		||||
                        title: Translate.instant('core.youreoffline'),
 | 
			
		||||
                    }));
 | 
			
		||||
 | 
			
		||||
@ -101,7 +101,7 @@ export default class AddonModScormOnlinePlayerPage implements OnInit, OnDestroy
 | 
			
		||||
            this.organizationId = CoreNavigator.getRouteParam('organizationId');
 | 
			
		||||
            this.initialScoId = CoreNavigator.getRouteNumberParam('scoId');
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -221,7 +221,7 @@ export default class AddonModScormOnlinePlayerPage implements OnInit, OnDestroy
 | 
			
		||||
                newAttempt: this.newAttempt,
 | 
			
		||||
            });
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_scorm.errorgetscorm', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_scorm.errorgetscorm') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,6 @@ import { CoreNavigationBarItem } from '@components/navigation-bar/navigation-bar
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreTimeUtils } from '@services/utils/time';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -43,6 +42,8 @@ import {
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CoreWait } from '@singletons/wait';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows playing a SCORM.
 | 
			
		||||
@ -102,8 +103,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
            this.initialScoId = CoreNavigator.getRouteNumberParam('scoId');
 | 
			
		||||
            this.siteId = CoreSites.getRequiredCurrentSite().getId();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModal(error);
 | 
			
		||||
 | 
			
		||||
            CoreAlerts.showError(error);
 | 
			
		||||
            CoreNavigator.back();
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
@ -124,7 +124,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
                try {
 | 
			
		||||
                    await this.setStartTime(this.currentSco.id);
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'addon.mod_scorm.errorgetscorm', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('addon.mod_scorm.errorgetscorm') });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -214,7 +214,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
                try {
 | 
			
		||||
                    AddonModScormHelper.convertAttemptToOffline(this.scorm, this.attempt);
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                    CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                this.refreshToc();
 | 
			
		||||
@ -338,7 +338,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            this.userData = data;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_scorm.errorgetscorm', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_scorm.errorgetscorm') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -494,7 +494,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
                await AddonModScorm.saveTracks(sco.id, this.attempt, tracks, this.scorm, true);
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
 | 
			
		||||
                CoreAlerts.showError(error, { default: Translate.instant('core.error') });
 | 
			
		||||
            }
 | 
			
		||||
        } finally {
 | 
			
		||||
            // Refresh TOC, some prerequisites might have changed.
 | 
			
		||||
@ -537,7 +537,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
            await this.fetchToc();
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_scorm.errorgetscorm', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_scorm.errorgetscorm') });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ import { Injectable } from '@angular/core';
 | 
			
		||||
import { CoreError } from '@classes/errors/error';
 | 
			
		||||
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreUtils } from '@singletons/utils';
 | 
			
		||||
import { makeSingleton, Translate } from '@singletons';
 | 
			
		||||
import {
 | 
			
		||||
@ -34,6 +33,7 @@ import {
 | 
			
		||||
import { AddonModScormOffline } from './scorm-offline';
 | 
			
		||||
import { AddonModScormMode } from '../constants';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
// List of elements we want to ignore when copying attempts (they're calculated).
 | 
			
		||||
const elementsToIgnore = [
 | 
			
		||||
@ -72,7 +72,7 @@ export class AddonModScormHelperProvider {
 | 
			
		||||
            scorm.packagesize = size;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return CoreDomUtils.confirmDownloadSize({ size: size, total: true });
 | 
			
		||||
        return CoreAlerts.confirmDownloadSize({ size: size, total: true });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -17,10 +17,10 @@ import { CoreContentLinksModuleIndexHandler } from '@features/contentlinks/class
 | 
			
		||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
 | 
			
		||||
import { CoreCourse } from '@features/course/services/course';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreCourseHelper } from '@features/course/services/course-helper';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handler to treat links to subsection.
 | 
			
		||||
@ -77,7 +77,7 @@ export class AddonModSubsectionIndexLinkHandlerService extends CoreContentLinksM
 | 
			
		||||
 | 
			
		||||
                    await this.openSubsection(module.section, module.course, siteId);
 | 
			
		||||
                } catch (error) {
 | 
			
		||||
                    CoreDomUtils.showErrorModalDefault(error, 'Error opening link.');
 | 
			
		||||
                    CoreAlerts.showError(error, { default: 'Error opening link.' });
 | 
			
		||||
                } finally {
 | 
			
		||||
                    modal.dismiss();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,6 @@ import { CoreCourseModuleMainActivityComponent } from '@features/course/classes/
 | 
			
		||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
 | 
			
		||||
import { IonContent } from '@ionic/angular';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { Translate } from '@singletons';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -39,6 +38,7 @@ import {
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { ADDON_MOD_SURVEY_AUTO_SYNCED, ADDON_MOD_SURVEY_COMPONENT } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a survey.
 | 
			
		||||
@ -195,7 +195,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
        let modal: CoreIonLoadingElement | undefined;
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.areyousure'));
 | 
			
		||||
 | 
			
		||||
            const answers: AddonModSurveySubmitAnswerData[] = [];
 | 
			
		||||
            modal = await CoreLoadings.show('core.sending', true);
 | 
			
		||||
@ -233,7 +233,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
 | 
			
		||||
                this.showLoadingAndRefresh(false);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'addon.mod_survey.cannotsubmitsurvey', true);
 | 
			
		||||
            CoreAlerts.showError(error, { default: Translate.instant('addon.mod_survey.cannotsubmitsurvey') });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal?.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,6 @@ import { CoreNetwork } from '@services/network';
 | 
			
		||||
import { CoreGroup, CoreGroups } from '@services/groups';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { Translate, NgZone } from '@singletons';
 | 
			
		||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
			
		||||
@ -60,6 +59,7 @@ import {
 | 
			
		||||
} from '../../constants';
 | 
			
		||||
import { CoreModals } from '@services/overlays/modals';
 | 
			
		||||
import { CorePopovers } from '@services/overlays/popovers';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a wiki entry page.
 | 
			
		||||
@ -870,7 +870,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
 | 
			
		||||
 | 
			
		||||
            if (this.isCurrentView && syncEventData.warnings && syncEventData.warnings.length) {
 | 
			
		||||
                // Show warnings.
 | 
			
		||||
                CoreDomUtils.showAlert(undefined, syncEventData.warnings[0]);
 | 
			
		||||
                CoreAlerts.show({ message: syncEventData.warnings[0] });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Check if current page was created or discarded.
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreText } from '@singletons/text';
 | 
			
		||||
import { CorePromiseUtils } from '@singletons/promise-utils';
 | 
			
		||||
import { CoreWSFile } from '@services/ws';
 | 
			
		||||
@ -34,6 +33,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
 | 
			
		||||
import { ADDON_MOD_WIKI_COMPONENT, ADDON_MOD_WIKI_PAGE_CREATED_EVENT, ADDON_MOD_WIKI_RENEW_LOCK_TIME } from '../../constants';
 | 
			
		||||
import { CoreLoadings } from '@services/overlays/loadings';
 | 
			
		||||
import { CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { CoreAlerts } from '@services/overlays/alerts';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that allows adding or editing a wiki page.
 | 
			
		||||
@ -244,7 +244,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            return true;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error getting wiki data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error getting wiki data.' });
 | 
			
		||||
            fetchFailed = true;
 | 
			
		||||
 | 
			
		||||
            // Go back.
 | 
			
		||||
@ -254,7 +254,10 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
        } finally {
 | 
			
		||||
            if (!canEdit && !fetchFailed) {
 | 
			
		||||
                // Cannot edit, show alert and go back.
 | 
			
		||||
                CoreDomUtils.showAlert(Translate.instant('core.notice'), Translate.instant('addon.mod_wiki.cannoteditpage'));
 | 
			
		||||
                CoreAlerts.show({
 | 
			
		||||
                    header: Translate.instant('core.notice'),
 | 
			
		||||
                    message: Translate.instant('addon.mod_wiki.cannoteditpage'),
 | 
			
		||||
                });
 | 
			
		||||
                this.forceLeavePage();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -334,7 +337,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
        // Check if data has changed.
 | 
			
		||||
        if (this.hasDataChanged()) {
 | 
			
		||||
            await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
            await CoreAlerts.confirm(Translate.instant('core.confirmcanceledit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
 | 
			
		||||
@ -386,10 +389,10 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
            if (!title) {
 | 
			
		||||
                // Title is mandatory, stop.
 | 
			
		||||
                modal.dismiss();
 | 
			
		||||
                CoreDomUtils.showAlert(
 | 
			
		||||
                    Translate.instant('core.notice'),
 | 
			
		||||
                    Translate.instant('addon.mod_wiki.titleshouldnotbeempty'),
 | 
			
		||||
                );
 | 
			
		||||
                CoreAlerts.show({
 | 
			
		||||
                    header: Translate.instant('core.notice'),
 | 
			
		||||
                    message: Translate.instant('addon.mod_wiki.titleshouldnotbeempty'),
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@ -453,7 +456,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
 | 
			
		||||
 | 
			
		||||
            this.goToPage(title);
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            CoreDomUtils.showErrorModalDefault(error, 'Error saving wiki data.');
 | 
			
		||||
            CoreAlerts.showError(error, { default: 'Error saving wiki data.' });
 | 
			
		||||
        } finally {
 | 
			
		||||
            modal.dismiss();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user