Merge pull request #4282 from dpalou/MOBILE-4724

Mobile 4724
main
Pau Ferrer Ocaña 2025-01-14 11:01:15 +01:00 committed by GitHub
commit 070fbc5cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
264 changed files with 2068 additions and 1842 deletions

View File

@ -69,7 +69,7 @@ jobs:
cat circular-dependencies cat circular-dependencies
lines=$(cat circular-dependencies | wc -l) lines=$(cat circular-dependencies | wc -l)
echo "Total circular dependencies: $lines" echo "Total circular dependencies: $lines"
test $lines -eq 90 test $lines -eq 93
- name: JavaScript code compatibility - name: JavaScript code compatibility
run: | run: |
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Object.hasOwn" npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Object.hasOwn"

View File

@ -1561,9 +1561,9 @@
"core.completion-alt-manual-n-override": "completion", "core.completion-alt-manual-n-override": "completion",
"core.completion-alt-manual-y": "completion", "core.completion-alt-manual-y": "completion",
"core.completion-alt-manual-y-override": "completion", "core.completion-alt-manual-y-override": "completion",
"core.confirmcanceledit": "local_moodlemobileapp",
"core.confirmdeletefile": "repository", "core.confirmdeletefile": "repository",
"core.confirmleaveunknownchanges": "local_moodlemobileapp", "core.confirmleavepagedescription": "local_moodlemobileapp",
"core.confirmleavepagetitle": "local_moodlemobileapp",
"core.confirmloss": "local_moodlemobileapp", "core.confirmloss": "local_moodlemobileapp",
"core.confirmopeninbrowser": "local_moodlemobileapp", "core.confirmopeninbrowser": "local_moodlemobileapp",
"core.confirmremoveselectedfile": "local_moodlemobileapp", "core.confirmremoveselectedfile": "local_moodlemobileapp",
@ -2091,6 +2091,7 @@
"core.lastmodified": "moodle", "core.lastmodified": "moodle",
"core.lastsync": "local_moodlemobileapp", "core.lastsync": "local_moodlemobileapp",
"core.layoutgrid": "workshopform_rubric", "core.layoutgrid": "workshopform_rubric",
"core.leave": "local_moodlemobileapp",
"core.list": "moodle", "core.list": "moodle",
"core.listsep": "langconfig", "core.listsep": "langconfig",
"core.loading": "moodle", "core.loading": "moodle",

View File

@ -13,13 +13,13 @@
// limitations under the License. // limitations under the License.
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { AddonBadges, AddonBadgesBadgeClass } from '../../services/badges'; import { AddonBadges, AddonBadgesBadgeClass } from '../../services/badges';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a badge class. * Page that displays a badge class.
@ -71,7 +71,7 @@ export class AddonBadgesBadgeClassPage implements OnInit {
this.logView(this.badge); this.logView(this.badge);
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.'); CoreAlerts.showError(message, { default: 'Error getting badge data.' });
} }
} }

View File

@ -14,7 +14,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges'; import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
@ -28,6 +27,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays an issued badge. * Page that displays an issued badge.
@ -141,7 +141,7 @@ export class AddonBadgesIssuedBadgePage implements OnInit, OnDestroy {
this.logView(badge); this.logView(badge);
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.'); CoreAlerts.showError(message, { default: 'Error getting badge data.' });
} }
} }

View File

@ -15,7 +15,6 @@
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core'; import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges'; import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; 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 { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of calendar events. * Page that displays the list of calendar events.
@ -112,7 +112,7 @@ export class AddonBadgesUserBadgesPage implements AfterViewInit, OnDestroy {
this.logView(); this.logView();
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'Error loading badges'); CoreAlerts.showError(message, { default: 'Error loading badges' });
this.badges.reset(); this.badges.reset();
} }

View File

@ -27,7 +27,6 @@ import { CoreCourseOptionsDelegate } from '@features/course/services/course-opti
import { CoreBlockBaseComponent } from '@features/block/classes/base-block-component'; import { CoreBlockBaseComponent } from '@features/block/classes/base-block-component';
import { CoreSite } from '@classes/sites/site'; import { CoreSite } from '@classes/sites/site';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursecompletion'; import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursecompletion';
import { IonSearchbar } from '@ionic/angular'; import { IonSearchbar } from '@ionic/angular';
@ -43,6 +42,8 @@ import {
CORE_COURSES_STATE_FAVOURITE, CORE_COURSES_STATE_FAVOURITE,
CORE_COURSES_STATE_HIDDEN, CORE_COURSES_STATE_HIDDEN,
} from '@features/courses/constants'; } from '@features/courses/constants';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] = const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] =
['all', 'inprogress', 'future', 'past', 'favourite', 'allincludinghidden', 'hidden', 'custom']; ['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); await CoreCourseHelper.prefetchCourses(this.filteredCourses, this.prefetchCoursesData);
} catch (error) { } catch (error) {
if (!this.isDestroyed) { if (!this.isDestroyed) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errordownloadingcourse', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errordownloadingcourse') });
this.prefetchCoursesData.icon = initialIcon; 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. 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 { } finally {
if (!alreadyLoading) { if (!alreadyLoading) {
// Only set loaded to true if there was no other data being loaded. // Only set loaded to true if there was no other data being loaded.

View File

@ -20,7 +20,7 @@ import {
AddonBlockRecentlyAccessedItemsItemCalculatedData, AddonBlockRecentlyAccessedItemsItemCalculatedData,
} from '../../services/recentlyaccesseditems'; } from '../../services/recentlyaccesseditems';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';

View File

@ -14,7 +14,7 @@
import { Component, Input, Output, EventEmitter, OnInit, HostBinding } from '@angular/core'; import { Component, Input, Output, EventEmitter, OnInit, HostBinding } from '@angular/core';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper'; import { CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
import { AddonBlockTimelineDayEvents } from '@addons/block/timeline/classes/section'; import { AddonBlockTimelineDayEvents } from '@addons/block/timeline/classes/section';

View File

@ -17,7 +17,6 @@ import { CoreSites } from '@services/sites';
import { ICoreBlockComponent } from '@features/block/classes/base-block-component'; import { ICoreBlockComponent } from '@features/block/classes/base-block-component';
import { AddonBlockTimeline } from '../../services/timeline'; import { AddonBlockTimeline } from '../../services/timeline';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCoursesHelper, CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper'; import { CoreCoursesHelper, CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
import { CoreCourses } from '@features/courses/services/courses'; import { CoreCourses } from '@features/courses/services/courses';
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; 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 { CoreSharedModule } from '@/core/shared.module';
import { CoreSearchComponentsModule } from '@features/search/components/components.module'; import { CoreSearchComponentsModule } from '@features/search/components/components.module';
import { AddonBlockTimelineEventsComponent } from '../events/events'; import { AddonBlockTimelineEventsComponent } from '../events/events';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component to render a timeline block. * Component to render a timeline block.
@ -211,9 +211,7 @@ export class AddonBlockTimelineComponent implements OnInit, ICoreBlockComponent
catchError(error => { catchError(error => {
// An error ocurred in the function, log the error and just resolve the observable so the workflow continues. // An error ocurred in the function, log the error and just resolve the observable so the workflow continues.
this.logger.error(error); this.logger.error(error);
CoreAlerts.showError(error, { default: this.fetchContentDefaultError });
// Error getting data, fail.
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
return of([] as AddonBlockTimelineSection[]); return of([] as AddonBlockTimelineSection[]);
}), }),

View File

@ -35,19 +35,18 @@ import { CoreEditorComponentsModule } from '@features/editor/components/componen
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader'; import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
import { CoreTagComponentsModule } from '@features/tag/components/components.module'; import { CoreTagComponentsModule } from '@features/tag/components/components.module';
import { CanLeave } from '@guards/can-leave'; import { CanLeave } from '@guards/can-leave';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSync } from '@services/sync'; import { CoreSync } from '@services/sync';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { CoreFileEntry } from '@services/file-helper'; import { CoreFileEntry } from '@services/file-helper';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
@Component({ @Component({
selector: 'addon-blog-edit-entry', selector: 'addon-blog-edit-entry',
@ -164,7 +163,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
this.associatedCourse = course; this.associatedCourse = course;
} }
} catch (error) { } 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; return;
@ -204,7 +203,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
this.associatedModule = await CoreCourse.getModule(this.modId); this.associatedModule = await CoreCourse.getModule(this.modId);
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error retrieving data.'); CoreAlerts.showError(error, { default: 'Error retrieving data.' });
this.forceLeave = true; this.forceLeave = true;
CoreNavigator.back(); CoreNavigator.back();
@ -338,7 +337,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
} catch (error) { } catch (error) {
if (CoreWSError.isWebServiceError(error)) { if (CoreWSError.isWebServiceError(error)) {
// It's a WebService error, the user cannot send the message so don't store it. // 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; return;
} }
@ -363,7 +362,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
} catch (error) { } catch (error) {
if (CoreWSError.isWebServiceError(error)) { if (CoreWSError.isWebServiceError(error)) {
// It's a WebService error, the user cannot send the message so don't store it. // 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; return;
} }
@ -412,7 +411,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
if ((!this.entry && this.hasDataChangedForNewEntry) || (this.entry && this.hasDataChangedForEdit)) { if ((!this.entry && this.hasDataChangedForNewEntry) || (this.entry && this.hasDataChangedForEdit)) {
// Modified, confirm user wants to go back. // Modified, confirm user wants to go back.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId()); CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());

View File

@ -34,15 +34,16 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreArray } from '@singletons/array'; import { CoreArray } from '@singletons/array';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page that displays the list of blog entries. * 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()); const result = await AddonBlogSync.syncEntriesForSite(CoreSites.getCurrentSiteId());
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
CoreDomUtils.showAlert(undefined, result.warnings[0]); CoreAlerts.show({ message: result.warnings[0] });
} }
if (result.updated) { if (result.updated) {
@ -244,7 +245,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
} }
} catch (error) { } catch (error) {
if (showSyncErrors) { 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.pageLoaded++;
this.logView(); this.logView();
} catch (error) { } 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. this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
} finally { } finally {
this.loaded.set(true); this.loaded.set(true);
@ -338,7 +339,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
this.filter.userid = !enabled ? undefined : this.currentUserId; this.filter.userid = !enabled ? undefined : this.currentUserId;
await this.fetchEntries(true); await this.fetchEntries(true);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.blog.errorloadentries', true); CoreAlerts.showError(error, { default: Translate.instant('addon.blog.errorloadentries') });
this.onlyMyEntries = !enabled; this.onlyMyEntries = !enabled;
this.filter.userid = !enabled ? this.currentUserId : undefined; this.filter.userid = !enabled ? this.currentUserId : undefined;
} finally { } finally {
@ -418,7 +419,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
*/ */
async deleteEntry(entryToRemove: AddonBlogOfflinePostFormatted | AddonBlogPostFormatted): Promise<void> { async deleteEntry(entryToRemove: AddonBlogOfflinePostFormatted | AddonBlogPostFormatted): Promise<void> {
try { try {
await CoreDomUtils.showDeleteConfirm('addon.blog.blogdeleteconfirm', { $a: entryToRemove.subject }); await CoreAlerts.confirmDelete(Translate.instant('addon.blog.blogdeleteconfirm', { $a: entryToRemove.subject }));
} catch { } catch {
return; return;
} }
@ -434,7 +435,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
CoreEvents.trigger(ADDON_BLOG_ENTRY_UPDATED); CoreEvents.trigger(ADDON_BLOG_ENTRY_UPDATED);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.blog.errorloadentries', true); CoreAlerts.showError(error, { default: Translate.instant('addon.blog.errorloadentries') });
} finally { } finally {
loading.dismiss(); loading.dismiss();
} }

View File

@ -26,6 +26,7 @@ import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/comp
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
import { ADDON_CALENDAR_PAGE_NAME } from './constants'; import { ADDON_CALENDAR_PAGE_NAME } from './constants';
import { canLeaveGuard } from '@guards/can-leave';
/** /**
* Build module routes. * Build module routes.
@ -55,6 +56,7 @@ function buildRoutes(injector: Injector): Routes {
{ {
path: 'edit/:eventId', path: 'edit/:eventId',
component: AddonCalendarEditEventPage, component: AddonCalendarEditEventPage,
canDeactivate: [canLeaveGuard],
}, },
...buildTabMainRoutes(injector, { ...buildTabMainRoutes(injector, {
redirectTo: 'index', redirectTo: 'index',

View File

@ -27,7 +27,6 @@ import {
} from '@angular/core'; } from '@angular/core';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreArray } from '@singletons/array'; import { CoreArray } from '@singletons/array';
import { import {
@ -54,6 +53,7 @@ import { CoreTime } from '@singletons/time';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { toBoolean } from '@/core/transforms/boolean'; import { toBoolean } from '@/core/transforms/boolean';
import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants'; import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a calendar. * Component that displays a calendar.
@ -204,7 +204,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} }
this.loaded = true; this.loaded = true;
@ -358,7 +358,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro
this.swipeSlidesComponent.slideToItem(item); this.swipeSlidesComponent.slideToItem(item);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -15,7 +15,6 @@
import { Component, OnDestroy, OnInit, Input, DoCheck, Output, EventEmitter, KeyValueDiffers, KeyValueDiffer } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, DoCheck, Output, EventEmitter, KeyValueDiffers, KeyValueDiffer } from '@angular/core';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { import {
AddonCalendarEventToDisplay, AddonCalendarEventToDisplay,
AddonCalendar, AddonCalendar,
@ -29,6 +28,7 @@ import { CoreUrl } from '@singletons/url';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants'; import { ADDON_CALENDAR_UNDELETED_EVENT_EVENT } from '@addons/calendar/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays upcoming events. * Component that displays upcoming events.
@ -174,7 +174,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} }
this.loaded = true; this.loaded = true;

View File

@ -16,7 +16,6 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { import {
AddonCalendar, AddonCalendar,
@ -46,7 +45,7 @@ import { AddonCalendarEventsSource } from '@addons/calendar/classes/events-sourc
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { import {
ADDON_CALENDAR_AUTO_SYNCED, ADDON_CALENDAR_AUTO_SYNCED,
ADDON_CALENDAR_DELETED_EVENT_EVENT, ADDON_CALENDAR_DELETED_EVENT_EVENT,
@ -59,6 +58,7 @@ import {
AddonCalendarEventType, AddonCalendarEventType,
} from '@addons/calendar/constants'; } from '@addons/calendar/constants';
import { CoreObject } from '@singletons/object'; import { CoreObject } from '@singletons/object';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the calendar events for a certain day. * Page that displays the calendar events for a certain day.
@ -277,7 +277,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} }
this.loaded = true; this.loaded = true;
@ -343,7 +343,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
const result = await AddonCalendarSync.syncEvents(); const result = await AddonCalendarSync.syncEvents();
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
CoreDomUtils.showAlert(undefined, result.warnings[0]); CoreAlerts.show({ message: result.warnings[0] });
} }
if (result.updated) { if (result.updated) {
@ -357,7 +357,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
} }
} catch (error) { } catch (error) {
if (showErrors) { 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); this.swipeSlidesComponent.slideToItem(currentDay);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -18,7 +18,6 @@ import { CoreEvents } from '@singletons/events';
import { CoreGroup, CoreGroups } from '@services/groups'; import { CoreGroup, CoreGroups } from '@services/groups';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreSync } from '@services/sync'; import { CoreSync } from '@services/sync';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { CoreCategoryData, CoreCourses, CoreCourseSearchedData, CoreEnrolledCourseData } from '@features/courses/services/courses'; import { CoreCategoryData, CoreCourses, CoreCourseSearchedData, CoreEnrolledCourseData } from '@features/courses/services/courses';
@ -50,10 +49,11 @@ import {
AddonCalendarEventType, AddonCalendarEventType,
} from '@addons/calendar/constants'; } from '@addons/calendar/constants';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { REMINDERS_DISABLED, CoreRemindersUnits } from '@features/reminders/constants'; import { REMINDERS_DISABLED, CoreRemindersUnits } from '@features/reminders/constants';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a form to create/edit an event. * Page that displays a form to create/edit an event.
@ -253,7 +253,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
this.eventTypes = eventTypes; this.eventTypes = eventTypes;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting data.'); CoreAlerts.showError(error, { default: 'Error getting data.' });
this.error = true; this.error = true;
} }
} }
@ -421,7 +421,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
this.groupControl.setValue(null); this.groupControl.setValue(null);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting data.'); CoreAlerts.showError(error, { default: 'Error getting data.' });
} }
modal.dismiss(); modal.dismiss();
@ -475,7 +475,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
if (error) { if (error) {
// Show error and stop. // Show error and stop.
CoreDomUtils.showErrorModal(Translate.instant(error)); CoreAlerts.showError(Translate.instant(error));
return; return;
} }
@ -548,7 +548,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
this.returnToList(event); this.returnToList(event);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error sending data.'); CoreAlerts.showError(error, { default: 'Error sending data.' });
} }
modal.dismiss(); modal.dismiss();
@ -593,7 +593,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
async canLeave(): Promise<boolean> { async canLeave(): Promise<boolean> {
if (AddonCalendarHelper.hasEventDataChanged(this.form.value, this.originalData)) { if (AddonCalendarHelper.hasEventDataChanged(this.form.value, this.originalData)) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
CoreForms.triggerFormCancelledEvent(this.formElement, this.currentSite.getId()); CoreForms.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());

View File

@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { AlertOptions } from '@ionic/core';
import { import {
AddonCalendar, AddonCalendar,
AddonCalendarEventToDisplay, AddonCalendarEventToDisplay,
@ -23,7 +22,6 @@ import { AddonCalendarOffline } from '../../services/calendar-offline';
import { AddonCalendarSync, AddonCalendarSyncEvents } from '../../services/calendar-sync'; import { AddonCalendarSync, AddonCalendarSyncEvents } from '../../services/calendar-sync';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
@ -41,9 +39,9 @@ import { CoreReminders } from '@features/reminders/services/reminders';
import { CoreLocalNotifications } from '@services/local-notifications'; import { CoreLocalNotifications } from '@services/local-notifications';
import { CorePlatform } from '@services/platform'; import { CorePlatform } from '@services/platform';
import { CoreConfig } from '@services/config'; import { CoreConfig } from '@services/config';
import { CoreToasts, ToastDuration } from '@services/toasts'; import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { import {
ADDON_CALENDAR_AUTO_SYNCED, ADDON_CALENDAR_AUTO_SYNCED,
@ -55,6 +53,7 @@ import {
ADDON_CALENDAR_UNDELETED_EVENT_EVENT, ADDON_CALENDAR_UNDELETED_EVENT_EVENT,
} from '@addons/calendar/constants'; } from '@addons/calendar/constants';
import { REMINDERS_DEFAULT_NOTIFICATION_TIME_CHANGED } from '@features/reminders/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. * Page that displays a single calendar event.
@ -191,7 +190,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
try { try {
this.eventId = CoreNavigator.getRequiredRouteNumberParam('id'); this.eventId = CoreNavigator.getRequiredRouteNumberParam('id');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
@ -243,7 +242,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
if (this.eventId < 0) { if (this.eventId < 0) {
// It's an offline event, but it wasn't found. Shouldn't happen. // 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(); CoreNavigator.back();
return; return;
@ -318,7 +317,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevent', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevent') });
} }
this.eventLoaded = true; this.eventLoaded = true;
@ -357,7 +356,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
try { try {
const result = await AddonCalendarSync.syncEvents(); const result = await AddonCalendarSync.syncEvents();
if (result.warnings && result.warnings.length) { 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) { if (result.deleted && result.deleted.indexOf(this.eventId) != -1) {
@ -380,7 +379,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
} }
} catch (error) { } catch (error) {
if (showErrors) { 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(); e.stopPropagation();
try { try {
await CoreDomUtils.showDeleteConfirm(); await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
const modal = await CoreLoadings.show('core.deleting', true); const modal = await CoreLoadings.show('core.deleting', true);
@ -435,7 +434,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
await CoreReminders.removeReminder(id); await CoreReminders.removeReminder(id);
await this.loadReminders(); await this.loadReminders();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error deleting reminder'); CoreAlerts.showError(error, { default: 'Error deleting reminder' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -500,9 +499,10 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
return; return;
} }
const title = Translate.instant('addon.calendar.deleteevent');
const options: AlertOptions = {};
let message: string; let message: string;
const options: CoreAlertsConfirmOptions = {
header: Translate.instant('addon.calendar.deleteevent'),
};
if (this.event.eventcount > 1) { if (this.event.eventcount > 1) {
// It's a repeated event. // It's a repeated event.
@ -534,7 +534,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
let deleteAll = false; let deleteAll = false;
try { try {
deleteAll = await CoreDomUtils.showConfirm(message, title, undefined, undefined, options); deleteAll = await CoreAlerts.confirm(message, options);
} catch { } catch {
// User canceled. // User canceled.
return; return;
@ -583,7 +583,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
this.event.deleted = true; this.event.deleted = true;
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error deleting event.'); CoreAlerts.showError(error, { default: 'Error deleting event.' });
} }
modal.dismiss(); modal.dismiss();
@ -611,7 +611,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
this.event.deleted = false; this.event.deleted = false;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error undeleting event.'); CoreAlerts.showError(error, { default: 'Error undeleting event.' });
} }
modal.dismiss(); modal.dismiss();

View File

@ -16,13 +16,12 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCoursesHelper } from '@features/courses/services/courses-helper'; import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
import { AddonCalendar } from '../../services/calendar'; import { AddonCalendar } from '../../services/calendar';
import { AddonCalendarOffline } from '../../services/calendar-offline'; import { AddonCalendarOffline } from '../../services/calendar-offline';
import { AddonCalendarSync } from '../../services/calendar-sync'; import { AddonCalendarSync } from '../../services/calendar-sync';
import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calendar-helper'; import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calendar-helper';
import { NgZone } from '@singletons'; import { NgZone, Translate } from '@singletons';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { CoreEnrolledCourseData } from '@features/courses/services/courses'; import { CoreEnrolledCourseData } from '@features/courses/services/courses';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
@ -30,7 +29,7 @@ import { AddonCalendarCalendarComponent } from '../../components/calendar/calend
import { AddonCalendarUpcomingEventsComponent } from '../../components/upcoming-events/upcoming-events'; import { AddonCalendarUpcomingEventsComponent } from '../../components/upcoming-events/upcoming-events';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreConstants } from '@/core/constants'; import { CoreConstants } from '@/core/constants';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { import {
ADDON_CALENDAR_AUTO_SYNCED, ADDON_CALENDAR_AUTO_SYNCED,
ADDON_CALENDAR_DELETED_EVENT_EVENT, ADDON_CALENDAR_DELETED_EVENT_EVENT,
@ -41,6 +40,7 @@ import {
ADDON_CALENDAR_NEW_EVENT_EVENT, ADDON_CALENDAR_NEW_EVENT_EVENT,
ADDON_CALENDAR_UNDELETED_EVENT_EVENT, ADDON_CALENDAR_UNDELETED_EVENT_EVENT,
} from '@addons/calendar/constants'; } from '@addons/calendar/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the calendar events. * Page that displays the calendar events.
@ -207,7 +207,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
try { try {
const result = await AddonCalendarSync.syncEvents(); const result = await AddonCalendarSync.syncEvents();
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
CoreDomUtils.showAlert(undefined, result.warnings[0]); CoreAlerts.show({ message: result.warnings[0] });
} }
if (result.updated) { if (result.updated) {
@ -222,7 +222,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
} }
} catch (error) { } catch (error) {
if (showErrors) { 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); await Promise.all(promises);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.calendar.errorloadevents', true); CoreAlerts.showError(error, { default: Translate.instant('addon.calendar.errorloadevents') });
} }
this.loaded = true; this.loaded = true;

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { import {
CoreReminders, CoreReminders,
CoreRemindersService, CoreRemindersService,

View File

@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core'; import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { import {
AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForPlanPageCompetency,
@ -30,6 +29,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of competencies of a learning plan. * Page that displays the list of competencies of a learning plan.
@ -111,7 +111,7 @@ export class AddonCompetencyCompetenciesPage implements AfterViewInit, OnDestroy
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting competencies data.'); CoreAlerts.showError(error, { default: 'Error getting competencies data.' });
} }
} }

View File

@ -17,7 +17,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { CoreCourseModuleSummary } from '@features/course/services/course'; import { CoreCourseModuleSummary } from '@features/course/services/course';
import { CoreUserSummary } from '@features/user/services/user'; import { CoreUserSummary } from '@features/user/services/user';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { import {
AddonCompetencyDataForUserCompetencySummaryWSResponse, AddonCompetencyDataForUserCompetencySummaryWSResponse,
@ -41,6 +40,7 @@ import { AddonCompetencyCourseCompetenciesSource } from '@addons/competency/clas
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the competency information. * Page that displays the competency information.
@ -86,8 +86,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
this.competencies = new AddonCompetencyCompetenciesSwipeManager(source); this.competencies = new AddonCompetencyCompetenciesSwipeManager(source);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -163,7 +162,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting competency data.'); CoreAlerts.showError(error, { default: 'Error getting competency data.' });
} }
} }

View File

@ -16,11 +16,11 @@ import { Component, OnInit } from '@angular/core';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { AddonCompetencySummary, AddonCompetency } from '@addons/competency/services/competency'; import { AddonCompetencySummary, AddonCompetency } from '@addons/competency/services/competency';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants'; import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the competency summary. * Page that displays the competency summary.
@ -71,8 +71,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
this.contextLevel = CoreNavigator.getRouteParam<ContextLevel>('contextLevel'); this.contextLevel = CoreNavigator.getRouteParam<ContextLevel>('contextLevel');
this.contextInstanceId = CoreNavigator.getRouteNumberParam('contextInstanceId'); this.contextInstanceId = CoreNavigator.getRouteNumberParam('contextInstanceId');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -103,7 +102,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting competency summary data.'); CoreAlerts.showError(error, { default: 'Error getting competency summary data.' });
} }
} }

View File

@ -19,7 +19,6 @@ import {
} from '@addons/competency/services/competency'; } from '@addons/competency/services/competency';
import { CoreUserProfile } from '@features/user/services/user'; import { CoreUserProfile } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants'; import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { CoreListItemsManager } from '@classes/items-management/list-items-manager'; 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 { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of competencies of a course. * 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); this.competencies = new CoreListItemsManager(source, AddonCompetencyCourseCompetenciesPage);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -121,7 +121,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit, OnDestroy
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting course competencies data.'); CoreAlerts.showError(error, { default: 'Error getting course competencies data.' });
} }
} }

View File

@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { CoreDomUtils } from '@services/utils/dom';
import { AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForPlanPageWSResponse } from '../../services/competency'; import { AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForPlanPageWSResponse } from '../../services/competency';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreUserProfile } from '@features/user/services/user'; 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 { AddonCompetencyPlanCompetenciesSource } from '@addons/competency/classes/competency-plan-competencies-source';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a learning plan. * Page that displays a learning plan.
@ -57,8 +57,7 @@ export class AddonCompetencyPlanPage implements OnInit, OnDestroy {
this.competencies = new CoreListItemsManager(competenciesSource, AddonCompetencyPlanPage); this.competencies = new CoreListItemsManager(competenciesSource, AddonCompetencyPlanPage);
this.plans = new CoreSwipeNavigationItemsManager(plansSource); this.plans = new CoreSwipeNavigationItemsManager(plansSource);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -101,7 +100,7 @@ export class AddonCompetencyPlanPage implements OnInit, OnDestroy {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting learning plan data.'); CoreAlerts.showError(error, { default: 'Error getting learning plan data.' });
} }
} }

View File

@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core'; import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { AddonCompetencyPlanFormatted, AddonCompetencyPlansSource } from '@addons/competency/classes/competency-plans-source'; 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 { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of learning plans. * Page that displays the list of learning plans.
@ -76,7 +76,7 @@ export class AddonCompetencyPlanListPage implements AfterViewInit, OnDestroy {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting learning plans data.'); CoreAlerts.showError(error, { default: 'Error getting learning plans data.' });
} }
} }

View File

@ -19,12 +19,12 @@ import {
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CoreUser, CoreUserProfile } from '@features/user/services/user'; import { CoreUser, CoreUserProfile } from '@features/user/services/user';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the course completion report. * Page that displays the course completion report.
@ -69,8 +69,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId'); this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId(); this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -102,7 +101,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
// Not enrolled error, probably a teacher. // Not enrolled error, probably a teacher.
this.tracked = false; this.tracked = false;
} else { } 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(); await this.refreshCompletion();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -22,10 +22,10 @@ import {
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonEnrolGuest } from './guest'; import { AddonEnrolGuest } from './guest';
import { CorePasswordModalResponse } from '@components/password-modal/password-modal'; import { CorePasswordModalResponse } from '@components/password-modal/password-modal';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol'; import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals'; import { CorePrompts } from '@services/overlays/prompts';
/** /**
* Enrol handler. * Enrol handler.
@ -119,7 +119,7 @@ export class AddonEnrolGuestHandlerService implements CoreEnrolGuestHandler {
}; };
try { try {
const response = await CoreModals.promptPassword<CorePasswordModalResponse>({ const response = await CorePrompts.promptPassword<CorePasswordModalResponse>({
title: method.name, title: method.name,
validator: validatePassword, validator: validatePassword,
}); });

View File

@ -17,11 +17,11 @@ import { CoreEnrolAction, CoreEnrolSelfHandler, CoreEnrolInfoIcon } from '@featu
import { Translate, makeSingleton } from '@singletons'; import { Translate, makeSingleton } from '@singletons';
import { AddonEnrolSelf } from './self'; import { AddonEnrolSelf } from './self';
import { CorePasswordModalResponse } from '@components/password-modal/password-modal'; import { CorePasswordModalResponse } from '@components/password-modal/password-modal';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol'; import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreLoadings } from '@services/loadings';
import { CORE_COURSES_ENROL_INVALID_KEY } from '@features/courses/constants'; import { CORE_COURSES_ENROL_INVALID_KEY } from '@features/courses/constants';
import { CoreAlerts } from '@services/overlays/alerts';
import { CorePrompts } from '@services/overlays/prompts';
/** /**
* Enrol handler. * Enrol handler.
@ -87,11 +87,10 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
// Don't allow self access if it requires a password if not supported. // Don't allow self access if it requires a password if not supported.
if (!info.enrolpassword) { if (!info.enrolpassword) {
try { try {
await CoreDomUtils.showConfirm( await CoreAlerts.confirm(Translate.instant('addon.enrol_self.confirmselfenrol'), {
Translate.instant('addon.enrol_self.confirmselfenrol'), header: method.name,
method.name, okText: Translate.instant('core.courses.enrolme'),
Translate.instant('core.courses.enrolme'), });
);
} catch { } catch {
// User cancelled. // User cancelled.
return false; return false;
@ -126,7 +125,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
response.validated = false; response.validated = false;
response.error = error.message; response.error = error.message;
} else { } else {
CoreDomUtils.showErrorModalDefault(error, 'addon.enrol_self.errorselfenrol', true); CoreAlerts.showError(error, { default: Translate.instant('addon.enrol_self.errorselfenrol') });
throw error; throw error;
} }
@ -147,7 +146,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
if (!response.validated) { if (!response.validated) {
try { try {
const response = await CoreModals.promptPassword({ const response = await CorePrompts.promptPassword({
validator: validatePassword, validator: validatePassword,
title: method.name, title: method.name,
placeholder: 'addon.enrol_self.password', placeholder: 'addon.enrol_self.password',

View File

@ -13,11 +13,10 @@
// limitations under the License. // limitations under the License.
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications'; import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications';
import { AddonMessageOutputAirnotifier, AddonMessageOutputAirnotifierDevice } from '../../services/airnotifier'; import { AddonMessageOutputAirnotifier, AddonMessageOutputAirnotifierDevice } from '../../services/airnotifier';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of devices. * Page that displays the list of devices.
@ -50,7 +49,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
const devices = await AddonMessageOutputAirnotifier.getUserDevices(); const devices = await AddonMessageOutputAirnotifier.getUserDevices();
this.formatDevices(devices); this.formatDevices(devices);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -148,7 +147,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
this.updateDevicesAfterDelay(); this.updateDevicesAfterDelay();
} catch (error) { } catch (error) {
// Show error and revert change. // Show error and revert change.
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
device.enable = !device.enable; device.enable = !device.enable;
} finally { } finally {
device.updating = false; device.updating = false;

View File

@ -21,10 +21,10 @@ import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { makeSingleton, Translate } from '@singletons'; import { makeSingleton, Translate } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events'; import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreOpener } from '@singletons/opener'; import { CoreOpener } from '@singletons/opener';
import { CorePath } from '@singletons/path'; import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site'; import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CorePrompts } from '@services/overlays/prompts';
const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:'; const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:';
@ -200,12 +200,12 @@ export class AddonMessageOutputAirnotifierProvider {
} }
// Warn the admin. // Warn the admin.
const dontShowAgain = await CoreDomUtils.showPrompt( const dontShowAgain = await CorePrompts.show(
Translate.instant('addon.messageoutput_airnotifier.pushdisabledwarning'), Translate.instant('addon.messageoutput_airnotifier.pushdisabledwarning'),
undefined,
Translate.instant('core.dontshowagain'),
'checkbox', 'checkbox',
[ {
placeholderOrLabel: Translate.instant('core.dontshowagain'),
buttons: [
{ {
text: Translate.instant('core.ok'), text: Translate.instant('core.ok'),
}, },
@ -228,6 +228,7 @@ export class AddonMessageOutputAirnotifierProvider {
}, },
}, },
], ],
},
); );
if (dontShowAgain) { if (dontShowAgain) {

View File

@ -18,9 +18,9 @@ import {
AddonMessagesConversationMember, AddonMessagesConversationMember,
AddonMessages, AddonMessages,
} from '../../services/messages'; } from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ModalController } from '@singletons'; import { ModalController } from '@singletons';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays the list of conversations, including group conversations. * Component that displays the list of conversations, including group conversations.
@ -67,7 +67,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit {
// Now get the members. // Now get the members.
await this.fetchMembers(); await this.fetchMembers();
} catch (error) { } 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 { try {
await this.fetchMembers(true); await this.fetchMembers(true);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting members.'); CoreAlerts.showError(error, { default: 'Error getting members.' });
this.loadMoreError = true; this.loadMoreError = true;
} finally { } finally {
infiniteComplete && infiniteComplete(); infiniteComplete && infiniteComplete();

View File

@ -20,7 +20,6 @@ import {
AddonMessagesGetContactsContact, AddonMessagesGetContactsContact,
AddonMessages, AddonMessages,
} from '../../services/messages'; } from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -29,6 +28,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreKeyboard } from '@singletons/keyboard'; import { CoreKeyboard } from '@singletons/keyboard';
import { ADDON_MESSAGES_MEMBER_INFO_CHANGED_EVENT } from '@addons/messages/constants'; import { ADDON_MESSAGES_MEMBER_INFO_CHANGED_EVENT } from '@addons/messages/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of contacts. * Page that displays the list of contacts.
@ -163,7 +163,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy {
this.clearSearch(); this.clearSearch();
} catch (error) { } 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); this.contacts.search = this.sortUsers(result);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
} }
} }

View File

@ -21,9 +21,10 @@ import {
} from '../../services/messages'; } from '../../services/messages';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen'; import { CoreScreen } from '@services/screen';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; 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 { 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. * Page that displays contacts and contact requests.
@ -177,7 +178,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
this.confirmedCanLoadMore = result.canLoadMore; this.confirmedCanLoadMore = result.canLoadMore;
} catch (error) { } catch (error) {
this.confirmedLoadMoreError = true; 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; this.requestsCanLoadMore = result.canLoadMore;
} catch (error) { } catch (error) {
this.requestsLoadMoreError = true; this.requestsLoadMoreError = true;
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingcontacts', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingcontacts') });
} }
} }

View File

@ -14,7 +14,6 @@
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { IonContent } from '@ionic/angular'; import { IonContent } from '@ionic/angular';
import { AlertOptions } from '@ionic/core';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { import {
@ -28,7 +27,6 @@ import {
import { AddonMessagesOffline, AddonMessagesOfflineMessagesDBRecordFormatted } from '../../services/messages-offline'; import { AddonMessagesOffline, AddonMessagesOfflineMessagesDBRecordFormatted } from '../../services/messages-offline';
import { AddonMessagesSync } from '../../services/messages-sync'; import { AddonMessagesSync } from '../../services/messages-sync';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreLogger } from '@singletons/logger'; import { CoreLogger } from '@singletons/logger';
import { CoreInfiniteLoadingComponent } from '@components/infinite-loading/infinite-loading'; import { CoreInfiniteLoadingComponent } from '@components/infinite-loading/infinite-loading';
@ -44,8 +42,8 @@ import { CoreDom } from '@singletons/dom';
import { CoreKeyboard } from '@singletons/keyboard'; import { CoreKeyboard } from '@singletons/keyboard';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreWait } from '@singletons/wait'; import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { import {
ADDON_MESSAGES_AUTO_SYNCED, ADDON_MESSAGES_AUTO_SYNCED,
ADDON_MESSAGES_LIMIT_MESSAGES, ADDON_MESSAGES_LIMIT_MESSAGES,
@ -58,6 +56,7 @@ import {
AddonMessagesMessageConversationType, AddonMessagesMessageConversationType,
AddonMessagesUpdateConversationAction, AddonMessagesUpdateConversationAction,
} from '@addons/messages/constants'; } from '@addons/messages/constants';
import { CoreAlerts, CoreAlertsConfirmOptions } from '@services/overlays/alerts';
/** /**
* Page that displays a message discussion page. * Page that displays a message discussion page.
@ -143,7 +142,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
// Show first warning if any. // Show first warning if any.
if (data.warnings && data.warnings[0]) { if (data.warnings && data.warnings[0]) {
CoreDomUtils.showAlert(undefined, data.warnings[0]); CoreAlerts.show({ message: data.warnings[0] });
} }
} }
}, this.siteId); }, this.siteId);
@ -264,7 +263,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
try { try {
const syncResult = await AddonMessagesSync.syncDiscussion(this.conversationId, this.userId); const syncResult = await AddonMessagesSync.syncDiscussion(this.conversationId, this.userId);
if (syncResult.warnings && syncResult.warnings[0]) { if (syncResult.warnings && syncResult.warnings[0]) {
CoreDomUtils.showAlert(undefined, syncResult.warnings[0]); CoreAlerts.show({ message: syncResult.warnings[0] });
} }
} catch { } catch {
// Ignore errors; // Ignore errors;
@ -350,7 +349,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
} finally { } finally {
this.checkCanDelete(); this.checkCanDelete();
this.loaded = true; this.loaded = true;
@ -953,7 +952,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers; const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers;
const langKey = message.pending || canDeleteAll || this.isSelf ? 'core.areyousure' : const langKey = message.pending || canDeleteAll || this.isSelf ? 'core.areyousure' :
'addon.messages.deletemessageconfirmation'; 'addon.messages.deletemessageconfirmation';
const options: AlertOptions = {}; const options: CoreAlertsConfirmOptions = {};
if (canDeleteAll && !message.pending) { if (canDeleteAll && !message.pending) {
// Show delete for all checkbox. // Show delete for all checkbox.
@ -967,13 +966,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
} }
try { try {
const data: boolean[] = await CoreDomUtils.showConfirm( const data = await CoreAlerts.confirm<boolean[]>(Translate.instant(langKey), options);
Translate.instant(langKey),
undefined,
undefined,
undefined,
options,
);
const modal = await CoreLoadings.show('core.deleting', true); const modal = await CoreLoadings.show('core.deleting', true);
@ -989,7 +982,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
modal.dismiss(); modal.dismiss();
} }
} catch (error) { } 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) { } catch (error) {
this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading. this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
this.pagesLoaded--; this.pagesLoaded--;
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
} finally { } finally {
infiniteComplete && infiniteComplete(); 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. // We want the user to be able to send multiple messages without the keyboard being closed.
CoreKeyboard.close(); CoreKeyboard.close();
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.messagenotsent', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.messagenotsent') });
this.removeMessage(message.hash!); this.removeMessage(message.hash!);
} }
} }
@ -1316,7 +1309,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
value: this.conversation.isfavourite, value: this.conversation.isfavourite,
}, this.siteId); }, this.siteId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error changing favourite state.'); CoreAlerts.showError(error, { default: 'Error changing favourite state.' });
} finally { } finally {
this.favouriteIcon = 'fas-star'; this.favouriteIcon = 'fas-star';
done && done(); done && done();
@ -1349,7 +1342,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
}, this.siteId); }, this.siteId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error changing muted state.'); CoreAlerts.showError(error, { default: 'Error changing muted state.' });
} finally { } finally {
this.muteIcon = this.conversation.ismuted ? 'fas-bell' : 'fas-bell-slash'; this.muteIcon = this.conversation.ismuted ? 'fas-bell' : 'fas-bell-slash';
done && done(); done && done();
@ -1404,16 +1397,16 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
} }
if (this.otherMember.canmessageevenifblocked) { 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; return;
} }
const template = Translate.instant('addon.messages.blockuserconfirm', { $a: this.otherMember.fullname });
const okText = Translate.instant('addon.messages.blockuser');
try { 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; this.blockIcon = CoreConstants.ICON_LOADING;
const modal = await CoreLoadings.show('core.sending', true); const modal = await CoreLoadings.show('core.sending', true);
@ -1427,7 +1420,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.showLoadingModal = false; this.showLoadingModal = false;
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock'; 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'); const confirmMessage = 'addon.messages.' + (this.isSelf ? 'deleteallselfconfirm' : 'deleteallconfirm');
try { try {
await CoreDomUtils.showDeleteConfirm(confirmMessage); await CoreAlerts.confirmDelete(Translate.instant(confirmMessage));
this.deleteIcon = CoreConstants.ICON_LOADING; this.deleteIcon = CoreConstants.ICON_LOADING;
try { try {
@ -1470,7 +1463,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
done && done(); done && done();
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error deleting conversation.'); CoreAlerts.showError(error, { default: 'Error deleting conversation.' });
} finally { } finally {
this.deleteIcon = 'fas-trash'; this.deleteIcon = 'fas-trash';
} }
@ -1490,11 +1483,10 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
throw new CoreError('No member selected to be unblocked.'); 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 { 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; this.blockIcon = CoreConstants.ICON_LOADING;
@ -1509,7 +1501,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.showLoadingModal = false; this.showLoadingModal = false;
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock'; 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.'); 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 { 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; this.addRemoveIcon = CoreConstants.ICON_LOADING;
@ -1548,7 +1539,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.showLoadingModal = false; this.showLoadingModal = false;
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
this.addRemoveIcon = 'fas-user-plus'; this.addRemoveIcon = 'fas-user-plus';
} }
@ -1579,7 +1570,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.showLoadingModal = false; this.showLoadingModal = false;
} }
} catch (error) { } 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; this.showLoadingModal = false;
} }
} catch (error) { } 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.'); 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 { 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; this.addRemoveIcon = CoreConstants.ICON_LOADING;
@ -1639,7 +1629,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.showLoadingModal = false; this.showLoadingModal = false;
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
this.addRemoveIcon = 'fas-user-plus'; this.addRemoveIcon = 'fas-user-plus';
} }

View File

@ -20,7 +20,6 @@ import {
AddonMessagesDiscussion, AddonMessagesDiscussion,
AddonMessagesMessageAreaContact, AddonMessagesMessageAreaContact,
} from '../../services/messages'; } from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications'; 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 { CoreKeyboard } from '@singletons/keyboard';
import { ADDON_MESSAGES_NEW_MESSAGE_EVENT, ADDON_MESSAGES_READ_CHANGED_EVENT } from '@addons/messages/constants'; import { ADDON_MESSAGES_NEW_MESSAGE_EVENT, ADDON_MESSAGES_READ_CHANGED_EVENT } from '@addons/messages/constants';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the list of discussions. * Page that displays the list of discussions.
@ -207,7 +207,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
try { try {
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
} }
this.loaded = true; this.loaded = true;
@ -241,7 +241,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
this.search.showResults = true; this.search.showResults = true;
this.search.results = searchResults.messages; this.search.results = searchResults.messages;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingmessages', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingmessages') });
} }
this.loaded = true; this.loaded = true;

View File

@ -26,7 +26,6 @@ import {
AddonMessagesOffline, AddonMessagesOffline,
AddonMessagesOfflineAnyMessagesFormatted, AddonMessagesOfflineAnyMessagesFormatted,
} from '../../services/messages-offline'; } from '../../services/messages-offline';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -49,6 +48,7 @@ import {
AddonMessagesMessageConversationType, AddonMessagesMessageConversationType,
AddonMessagesUpdateConversationAction, AddonMessagesUpdateConversationAction,
} from '@addons/messages/constants'; } from '@addons/messages/constants';
import { CoreAlerts } from '@services/overlays/alerts';
const enum AddonMessagesGroupConversationOptionNames { const enum AddonMessagesGroupConversationOptionNames {
FAVOURITES = 'favourites', FAVOURITES = 'favourites',
@ -381,7 +381,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
// Load the data for the expanded option. // Load the data for the expanded option.
await this.fetchDataForExpandedOption(); await this.fetchDataForExpandedOption();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
} }
this.loaded = true; this.loaded = true;
} }
@ -611,7 +611,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
try { try {
await this.fetchDataForOption(option, true); await this.fetchDataForOption(option, true);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
option.loadMoreError = true; 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. // Pass getCounts=true to update the counts everytime the user expands an option.
this.expandOption(option, true).catch((error) => { this.expandOption(option, true).catch((error) => {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingdiscussions') });
}); });
} }

View File

@ -20,7 +20,6 @@ import {
AddonMessagesMessageAreaContact, AddonMessagesMessageAreaContact,
AddonMessages, AddonMessages,
} from '../../services/messages'; } from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen'; import { CoreScreen } from '@services/screen';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
@ -30,6 +29,8 @@ import {
ADDON_MESSAGES_LIMIT_SEARCH, ADDON_MESSAGES_LIMIT_SEARCH,
ADDON_MESSAGES_LIMIT_INITIAL_USER_SEARCH, ADDON_MESSAGES_LIMIT_INITIAL_USER_SEARCH,
} from '@addons/messages/constants'; } from '@addons/messages/constants';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page for searching users. * Page for searching users.
@ -225,7 +226,7 @@ export class AddonMessagesSearchPage implements OnDestroy {
} }
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingusers', true); CoreAlerts.showError(error, { default: Translate.instant('addon.messages.errorwhileretrievingusers') });
if (loadMore == 'messages') { if (loadMore == 'messages') {
this.messages.loadMoreError = true; this.messages.loadMoreError = true;

View File

@ -23,13 +23,13 @@ import { CoreUser } from '@features/user/services/user';
import { CoreConfig } from '@services/config'; import { CoreConfig } from '@services/config';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreConstants } from '@/core/constants'; import { CoreConstants } from '@/core/constants';
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications'; import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
import { CorePlatform } from '@services/platform'; import { CorePlatform } from '@services/platform';
import { CoreErrorHelper } from '@services/error-helper'; import { CoreErrorHelper } from '@services/error-helper';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { ADDON_MESSAGES_NOTIFICATION_PREFERENCES_KEY, AddonMessagesMessagePrivacy } from '@addons/messages/constants'; import { ADDON_MESSAGES_NOTIFICATION_PREFERENCES_KEY, AddonMessagesMessagePrivacy } from '@addons/messages/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the messages settings page. * Page that displays the messages settings page.
@ -118,7 +118,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
return; return;
} }
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
this.preferencesLoaded = true; this.preferencesLoaded = true;
} }
@ -171,7 +171,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
this.previousContactableValue = this.contactablePrivacy; this.previousContactableValue = this.contactablePrivacy;
} catch (message) { } catch (message) {
// Show error and revert change. // Show error and revert change.
CoreDomUtils.showErrorModal(message); CoreAlerts.showError(message);
this.contactablePrivacy = this.previousContactableValue; this.contactablePrivacy = this.previousContactableValue;
} finally { } finally {
modal.dismiss(); modal.dismiss();
@ -214,7 +214,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
this.updatePreferencesAfterDelay(); this.updatePreferencesAfterDelay();
} catch (error) { } catch (error) {
// Show error and revert change. // Show error and revert change.
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
processor.enabled = !processor.enabled; processor.enabled = !processor.enabled;
} finally { } finally {
notification.updating = false; notification.updating = false;
@ -249,7 +249,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
this.updatePreferencesAfterDelay(); this.updatePreferencesAfterDelay();
} catch (error) { } catch (error) {
// Show error and revert change. // Show error and revert change.
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
processorState.checked = !processorState.checked; processorState.checked = !processorState.checked;
} finally { } finally {
notification['updating'+state] = false; notification['updating'+state] = false;

View File

@ -15,7 +15,7 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { CoreCanceledError } from '@classes/errors/cancelederror'; import { CoreCanceledError } from '@classes/errors/cancelederror';
import { CoreError } from '@classes/errors/error'; import { CoreError } from '@classes/errors/error';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { AddonModAssignFeedbackCommentsTextData } from '../feedback/comments/services/handler'; import { AddonModAssignFeedbackCommentsTextData } from '../feedback/comments/services/handler';
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../services/assign'; import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../services/assign';
import { toBoolean } from '@/core/transforms/boolean'; import { toBoolean } from '@/core/transforms/boolean';

View File

@ -14,14 +14,14 @@
import { Component, Input, ViewChild, ElementRef } from '@angular/core'; import { Component, Input, ViewChild, ElementRef } from '@angular/core';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFormFields, CoreForms } from '@singletons/form'; import { CoreFormFields, CoreForms } from '@singletons/form';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { ModalController, Translate } from '@singletons'; import { ModalController } from '@singletons';
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../../services/assign'; import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../../services/assign';
import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate'; import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { AddonModAssignComponentsModule } from '../components.module'; import { AddonModAssignComponentsModule } from '../components.module';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Modal that allows editing a feedback plugin. * Modal that allows editing a feedback plugin.
@ -50,7 +50,7 @@ export class AddonModAssignEditFeedbackModalComponent {
async closeModal(): Promise<void> { async closeModal(): Promise<void> {
const changed = await this.hasDataChanged(); const changed = await this.hasDataChanged();
if (changed) { if (changed) {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId()); CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());

View File

@ -22,7 +22,6 @@ import { IonContent } from '@ionic/angular';
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -53,6 +52,7 @@ import {
ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL, ADDON_MOD_ASSIGN_WARN_GROUPS_OPTIONAL,
ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED, ADDON_MOD_ASSIGN_WARN_GROUPS_REQUIRED,
} from '../../constants'; } from '../../constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays an assignment. * Component that displays an assignment.
@ -397,8 +397,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
} }
if (syncEventData.warnings && syncEventData.warnings.length) { if (syncEventData.warnings && syncEventData.warnings.length) {
// Show warnings. CoreAlerts.show({ message: syncEventData.warnings[0] });
CoreDomUtils.showAlert(undefined, syncEventData.warnings[0]);
} }
return true; return true;

View File

@ -39,7 +39,6 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper'; import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
import { CoreMenuItem, CoreUtils } from '@singletons/utils'; import { CoreMenuItem, CoreUtils } from '@singletons/utils';
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../../services/assign-helper'; import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../../services/assign-helper';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreCourse, CoreCourseModuleGradeInfo, CoreCourseModuleGradeOutcome } from '@features/course/services/course'; import { CoreCourse, CoreCourseModuleGradeInfo, CoreCourseModuleGradeOutcome } from '@features/course/services/course';
@ -69,8 +68,9 @@ import {
ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS, ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS,
} from '../../constants'; } from '../../constants';
import { CoreViewer } from '@features/viewer/services/viewer'; import { CoreViewer } from '@features/viewer/services/viewer';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays an assignment submission. * Component that displays an assignment submission.
@ -296,7 +296,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
if (modified) { if (modified) {
// Modified, confirm user wants to go back. // Modified, confirm user wants to go back.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
await this.discardDrafts(); await this.discardDrafts();
} }
@ -315,7 +315,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
} }
if (!CoreNetwork.isOnline()) { if (!CoreNetwork.isOnline()) {
CoreDomUtils.showErrorModal('core.networkerrormsg', true); CoreAlerts.showError(Translate.instant('core.networkerrormsg'));
return; return;
} }
@ -363,7 +363,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
await this.invalidateAndRefresh(true); await this.invalidateAndRefresh(true);
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -388,12 +388,11 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
async goToEdit(afterCopyPrevious = false): Promise<void> { async goToEdit(afterCopyPrevious = false): Promise<void> {
if (!afterCopyPrevious && this.assign?.timelimit && (!this.userSubmission || !this.userSubmission.timestarted)) { if (!afterCopyPrevious && this.assign?.timelimit && (!this.userSubmission || !this.userSubmission.timestarted)) {
try { try {
await CoreDomUtils.showConfirm( await CoreAlerts.confirm(
Translate.instant('addon.mod_assign.confirmstart', { Translate.instant('addon.mod_assign.confirmstart', {
$a: CoreTime.formatTime(this.assign.timelimit), $a: CoreTime.formatTime(this.assign.timelimit),
}), }),
undefined, { okText: Translate.instant('addon.mod_assign.beginassignment') },
Translate.instant('addon.mod_assign.beginassignment'),
); );
} catch { } catch {
return; // User canceled. return; // User canceled.
@ -421,7 +420,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
'addon.mod_assign.removesubmissionconfirmwithtimelimit' : 'addon.mod_assign.removesubmissionconfirmwithtimelimit' :
'addon.mod_assign.removesubmissionconfirm'; 'addon.mod_assign.removesubmissionconfirm';
try { try {
await CoreDomUtils.showDeleteConfirm(message); await CoreAlerts.confirmDelete(Translate.instant(message));
} catch { } catch {
return; return;
} }
@ -445,7 +444,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
CoreSites.getCurrentSiteId(), CoreSites.getCurrentSiteId(),
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error removing submission.'); CoreAlerts.showError(error, { default: 'Error removing submission.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -650,7 +649,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.'); CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -936,14 +935,14 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
} }
if (this.assign.requiresubmissionstatement && !acceptStatement) { if (this.assign.requiresubmissionstatement && !acceptStatement) {
CoreDomUtils.showErrorModal('addon.mod_assign.acceptsubmissionstatement', true); CoreAlerts.showError(Translate.instant('addon.mod_assign.acceptsubmissionstatement'));
return; return;
} }
try { try {
// Ask for confirmation. @todo plugin precheck_submission // 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); const modal = await CoreLoadings.show('core.sending', true);
@ -963,7 +962,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
userId: this.currentUserId, userId: this.currentUserId,
}, this.siteId); }, this.siteId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -20,7 +20,6 @@ import { CanLeave } from '@guards/can-leave';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSync } from '@services/sync'; import { CoreSync } from '@services/sync';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFormFields, CoreForms } from '@singletons/form'; import { CoreFormFields, CoreForms } from '@singletons/form';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
@ -45,9 +44,10 @@ import {
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT, ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT, ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
} from '../../constants'; } from '../../constants';
import { CoreToasts, ToastDuration } from '@services/toasts'; import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that allows adding or editing an assigment submission. * 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.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.isBlind = !!CoreNavigator.getRouteNumberParam('blindId'); this.isBlind = !!CoreNavigator.getRouteNumberParam('blindId');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -126,7 +125,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
// Check if data has changed. // Check if data has changed.
const changed = await this.hasDataChanged(); const changed = await this.hasDataChanged();
if (changed) { if (changed) {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
// Nothing has changed or user confirmed to leave. Clear temporary data from plugins. // 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}`, url: `/mod/assign/view.php?action=editsubmission&id=${this.moduleId}`,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.'); CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
// Leave the player. // Leave the player.
this.leaveWithoutCheck(); this.leaveWithoutCheck();
@ -376,7 +375,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
await this.saveSubmission(); await this.saveSubmission();
this.leaveWithoutCheck(); this.leaveWithoutCheck();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error saving submission.'); CoreAlerts.showError(error, { default: 'Error saving submission.' });
} }
} }

View File

@ -19,7 +19,6 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreGroupInfo } from '@services/groups'; import { CoreGroupInfo } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { import {
@ -34,6 +33,7 @@ import {
} from '../../services/assign-sync'; } from '../../services/assign-sync';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; 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 { 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. * Page that displays a list of submissions of an assignment.
@ -107,8 +107,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
AddonModAssignSubmissionListPage, AddonModAssignSubmissionListPage,
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -184,7 +183,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro
url: `/mod/assign/view.php?id=${this.assign.cmid}&action=grading`, url: `/mod/assign/view.php?id=${this.assign.cmid}&action=grading`,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting assigment data.'); CoreAlerts.showError(error, { default: 'Error getting assigment data.' });
} }
} }

View File

@ -20,13 +20,13 @@ import { CoreCourse } from '@features/course/services/course';
import { CanLeave } from '@guards/can-leave'; import { CanLeave } from '@guards/can-leave';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen'; import { CoreScreen } from '@services/screen';
import { CoreDomUtils } from '@services/utils/dom';
import { AddonModAssignListFilterName, AddonModAssignSubmissionsSource } from '../../classes/submissions-source'; import { AddonModAssignListFilterName, AddonModAssignSubmissionsSource } from '../../classes/submissions-source';
import { AddonModAssignSubmissionComponent } from '../../components/submission/submission'; import { AddonModAssignSubmissionComponent } from '../../components/submission/submission';
import { AddonModAssign, AddonModAssignAssign } from '../../services/assign'; import { AddonModAssign, AddonModAssignAssign } from '../../services/assign';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a submission. * Page that displays a submission.
@ -99,8 +99,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
this.submissions.start(); this.submissions.start();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -231,7 +230,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca
CoreNavigator.back(); CoreNavigator.back();
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.error', true); CoreAlerts.showError(error, { default: Translate.instant('core.error') });
} }
} }

View File

@ -20,7 +20,6 @@ import { IonContent } from '@ionic/angular';
import { CoreApp } from '@services/app'; import { CoreApp } from '@services/app';
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreArray } from '@singletons/array'; import { CoreArray } from '@singletons/array';
@ -32,10 +31,11 @@ import {
AddonModBBBRecordingPlaybackTypes, AddonModBBBRecordingPlaybackTypes,
} from '../../services/bigbluebuttonbn'; } from '../../services/bigbluebuttonbn';
import { ADDON_MOD_BBB_COMPONENT } from '../../constants'; import { ADDON_MOD_BBB_COMPONENT } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { convertTextToHTMLElement } from '@/core/utils/create-html-element'; import { convertTextToHTMLElement } from '@/core/utils/create-html-element';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreOpener } from '@singletons/opener'; import { CoreOpener } from '@singletons/opener';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a Big Blue Button activity. * Component that displays a Big Blue Button activity.
@ -287,7 +287,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
await this.fetchRecordings(); await this.fetchRecordings();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
this.showLoading = false; this.showLoading = false;
} }
@ -313,7 +313,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
this.updateMeetingInfo(true); this.updateMeetingInfo(true);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -330,11 +330,10 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
} }
try { try {
await CoreDomUtils.showConfirm( await CoreAlerts.confirm(Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm'), {
Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm'), header: Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm_title'),
Translate.instant('addon.mod_bigbluebuttonbn.end_session_confirm_title'), okText: Translate.instant('core.yes'),
Translate.instant('core.yes'), });
);
} catch { } catch {
// User canceled. // User canceled.
return; return;
@ -347,7 +346,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
this.updateMeetingInfo(); this.updateMeetingInfo();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -24,7 +24,6 @@ import { CoreCourseModulePrefetchDelegate } from '@features/course/services/modu
import { CoreTag, CoreTagItem } from '@features/tag/services/tag'; import { CoreTag, CoreTagItem } from '@features/tag/services/tag';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreErrorHelper } from '@services/error-helper'; import { CoreErrorHelper } from '@services/error-helper';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -37,7 +36,8 @@ import {
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { ADDON_MOD_BOOK_COMPONENT, AddonModBookNavStyle } from '../../constants'; import { ADDON_MOD_BOOK_COMPONENT, AddonModBookNavStyle } from '../../constants';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a book contents. * Page that displays a book contents.
@ -79,8 +79,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId'); this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.initialChapterId = CoreNavigator.getRouteNumberParam('chapterId'); this.initialChapterId = CoreNavigator.getRouteNumberParam('chapterId');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -136,7 +135,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
await source.load(); await source.load();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -14,11 +14,11 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { ModalController, NgZone, Translate } from '@singletons';
import { ModalController, NgZone } from '@singletons';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { AddonModChat, AddonModChatUser } from '../../services/chat'; import { AddonModChat, AddonModChatUser } from '../../services/chat';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* MMdal that displays the chat session users. * MMdal that displays the chat session users.
@ -63,7 +63,7 @@ export class AddonModChatUsersModalComponent implements OnInit, OnDestroy {
this.users = data.users; this.users = data.users;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhilegettingchatusers', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhilegettingchatusers') });
} finally { } finally {
this.usersLoaded = true; this.usersLoaded = true;
} }

View File

@ -19,7 +19,6 @@ import { IonContent } from '@ionic/angular';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { NgZone, Translate } from '@singletons'; import { NgZone, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
@ -31,8 +30,9 @@ import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreKeyboard } from '@singletons/keyboard'; import { CoreKeyboard } from '@singletons/keyboard';
import { CoreWait } from '@singletons/wait'; import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a chat session. * Page that displays a chat session.
@ -108,7 +108,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
this.startPolling(); this.startPolling();
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhileconnecting', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhileconnecting') });
CoreNavigator.back(); CoreNavigator.back();
} finally { } finally {
this.loaded = true; this.loaded = true;
@ -294,7 +294,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
} catch (error) { } catch (error) {
// Fail again. Stop polling if needed. // Fail again. Stop polling if needed.
this.stopPolling(); this.stopPolling();
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhileretrievingmessages', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhileretrievingmessages') });
throw error; throw error;
} }
@ -331,7 +331,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
CoreKeyboard.close(); CoreKeyboard.close();
this.newMessage = text; this.newMessage = text;
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_chat.errorwhilesendingmessage', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_chat.errorwhilesendingmessage') });
} finally { } finally {
this.sending = false; this.sending = false;
} }
@ -380,7 +380,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
} }
// Modified, confirm user wants to go back. // 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; return true;
} }

View File

@ -16,13 +16,13 @@ import { Component, OnInit } from '@angular/core';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { AddonModChat } from '../../services/chat'; import { AddonModChat } from '../../services/chat';
import { AddonModChatFormattedSessionMessage, AddonModChatHelper } from '../../services/chat-helper'; import { AddonModChatFormattedSessionMessage, AddonModChatHelper } from '../../services/chat-helper';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays list of chat session messages. * Page that displays list of chat session messages.
@ -75,8 +75,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
this.chatId = CoreNavigator.getRequiredRouteNumberParam('chatId'); this.chatId = CoreNavigator.getRequiredRouteNumberParam('chatId');
this.groupId = CoreNavigator.getRouteNumberParam('groupId') || 0; this.groupId = CoreNavigator.getRouteNumberParam('groupId') || 0;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -119,7 +118,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
this.messages[this.messages.length - 1].showTail = true; this.messages[this.messages.length - 1].showTail = true;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true); CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -18,14 +18,14 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreGroupInfo } from '@services/groups'; import { CoreGroupInfo } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { AddonModChatSessionFormatted, AddonModChatSessionsSource } from '../../classes/chat-sessions-source'; import { AddonModChatSessionFormatted, AddonModChatSessionsSource } from '../../classes/chat-sessions-source';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { AddonModChat } from '@addons/mod/chat/services/chat'; import { AddonModChat } from '@addons/mod/chat/services/chat';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays list of chat sessions. * Page that displays list of chat sessions.
@ -73,8 +73,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
this.sessions = new CoreListItemsManager(source, AddonModChatSessionsPage); this.sessions = new CoreListItemsManager(source, AddonModChatSessionsPage);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -119,7 +118,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
this.logView(); this.logView();
} catch (error) { } 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 { try {
await this.sessions.reload(); await this.sessions.reload();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true); CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,7 +18,6 @@ import { CoreCourseModuleMainActivityComponent } from '@features/course/classes/
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { IonContent } from '@ionic/angular'; import { IonContent } from '@ionic/angular';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
@ -41,7 +40,8 @@ import {
ADDON_MOD_CHOICE_PUBLISH_ANONYMOUS, ADDON_MOD_CHOICE_PUBLISH_ANONYMOUS,
AddonModChoiceShowResults, AddonModChoiceShowResults,
} from '../../constants'; } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a choice. * Component that displays a choice.
@ -370,7 +370,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
// Only show confirm if choice doesn't allow update. // Only show confirm if choice doesn't allow update.
if (!this.choice.allowupdate) { if (!this.choice.allowupdate) {
await CoreDomUtils.showConfirm(Translate.instant('core.areyousure')); await CoreAlerts.confirm(Translate.instant('core.areyousure'));
} }
const responses: number[] = []; const responses: number[] = [];
@ -401,7 +401,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
await this.dataUpdated(online); await this.dataUpdated(online);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_choice.cannotsubmit', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_choice.cannotsubmit') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -416,7 +416,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
} }
try { try {
await CoreDomUtils.showDeleteConfirm(); await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
} catch { } catch {
// User cancelled. // User cancelled.
return; 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. // Refresh the data. Don't call dataUpdated because deleting an answer doesn't mark the choice as outdated.
await this.refreshContent(false); await this.refreshContent(false);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_choice.cannotsubmit', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_choice.cannotsubmit') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -26,7 +26,7 @@ import {
} from '../../services/data'; } from '../../services/data';
import { AddonModDataHelper } from '../../services/data-helper'; import { AddonModDataHelper } from '../../services/data-helper';
import { AddonModDataOffline } from '../../services/data-offline'; import { AddonModDataOffline } from '../../services/data-offline';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { AddonModDataActionsMenuItem } from '../actionsmenu/actionsmenu'; import { AddonModDataActionsMenuItem } from '../actionsmenu/actionsmenu';
import { import {
ADDON_MOD_DATA_ENTRY_CHANGED, ADDON_MOD_DATA_ENTRY_CHANGED,

View File

@ -51,9 +51,11 @@ import {
AddonModDataTemplateType, AddonModDataTemplateType,
AddonModDataTemplateMode, AddonModDataTemplateMode,
} from '../../constants'; } from '../../constants';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreObject } from '@singletons/object'; import { CoreObject } from '@singletons/object';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->'; const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->';
@ -436,7 +438,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
this.logSearch?.(); this.logSearch?.();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
this.showLoading = false; this.showLoading = false;
} }
@ -484,7 +486,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
try { try {
await this.fetchEntriesData(); await this.fetchEntriesData();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} }
} }

View File

@ -19,10 +19,10 @@ import { FormBuilder } from '@angular/forms';
import { SafeUrl } from '@angular/platform-browser'; import { SafeUrl } from '@angular/platform-browser';
import { CoreAnyError } from '@classes/errors/error'; import { CoreAnyError } from '@classes/errors/error';
import { CoreGeolocation, CoreGeolocationError, CoreGeolocationErrorReason } from '@services/geolocation'; import { CoreGeolocation, CoreGeolocationError, CoreGeolocationErrorReason } from '@services/geolocation';
import { CoreLoadings } from '@services/loadings'; import { CoreAlerts } from '@services/overlays/alerts';
import { CoreLoadings } from '@services/overlays/loadings';
import { CorePlatform } from '@services/platform'; import { CorePlatform } from '@services/platform';
import { CoreDomUtils } from '@services/utils/dom'; import { DomSanitizer, Translate } from '@singletons';
import { DomSanitizer } from '@singletons';
/** /**
* Component to render data latlong field. * Component to render data latlong field.
@ -140,12 +140,12 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa
*/ */
protected showLocationErrorModal(error: CoreAnyError | CoreGeolocationError): void { protected showLocationErrorModal(error: CoreAnyError | CoreGeolocationError): void {
if (error instanceof CoreGeolocationError) { if (error instanceof CoreGeolocationError) {
CoreDomUtils.showErrorModal(this.getGeolocationErrorMessage(error), true); CoreAlerts.showError(Translate.instant(this.getGeolocationErrorMessage(error)));
return; return;
} }
CoreDomUtils.showErrorModalDefault(error, 'Error getting location'); CoreAlerts.showError(error, { default: 'Error getting location' });
} }
/** /**

View File

@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -44,9 +43,10 @@ import { CoreText } from '@singletons/text';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED, AddonModDataTemplateType } from '../../constants'; import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED, AddonModDataTemplateType } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { CoreArray } from '@singletons/array'; import { CoreArray } from '@singletons/array';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the view edit page. * Page that displays the view edit page.
@ -126,7 +126,7 @@ export class AddonModDataEditPage implements OnInit {
this.entryId = CoreNavigator.getRouteNumberParam('entryId') || undefined; this.entryId = CoreNavigator.getRouteNumberParam('entryId') || undefined;
this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0; this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
@ -156,7 +156,7 @@ export class AddonModDataEditPage implements OnInit {
if (changed) { if (changed) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
// Delete the local files from the tmp folder. // Delete the local files from the tmp folder.
@ -238,7 +238,7 @@ export class AddonModDataEditPage implements OnInit {
if (!haveAccess) { if (!haveAccess) {
// You shall not pass, go back. // 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. // Go back to entry list.
this.forceLeave = true; this.forceLeave = true;
@ -251,7 +251,7 @@ export class AddonModDataEditPage implements OnInit {
this.editFormRender = this.displayEditFields(); this.editFormRender = this.displayEditFields();
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} }
this.loaded = true; this.loaded = true;
@ -395,10 +395,9 @@ export class AddonModDataEditPage implements OnInit {
this.scrollToFirstError(); this.scrollToFirstError();
if (updateEntryResult.generalnotifications?.length) { if (updateEntryResult.generalnotifications?.length) {
CoreDomUtils.showAlertWithOptions({ CoreAlerts.show({
header: Translate.instant('core.notice'), header: Translate.instant('core.notice'),
message: CoreText.buildMessage(updateEntryResult.generalnotifications), message: CoreText.buildMessage(updateEntryResult.generalnotifications),
buttons: [Translate.instant('core.ok')],
}); });
} }
} }
@ -406,7 +405,7 @@ export class AddonModDataEditPage implements OnInit {
modal.dismiss(); modal.dismiss();
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Cannot edit entry', true); CoreAlerts.showError(error, { default: 'Cannot edit entry' });
} }
} }

View File

@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
import { CoreGroups, CoreGroupInfo } from '@services/groups'; import { CoreGroups, CoreGroupInfo } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreArray } from '@singletons/array'; import { CoreArray } from '@singletons/array';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { AddonModDataComponentsCompileModule } from '../../components/components-compile.module'; import { AddonModDataComponentsCompileModule } from '../../components/components-compile.module';
@ -44,6 +43,8 @@ import {
AddonModDataTemplateMode, AddonModDataTemplateMode,
} from '../../constants'; } from '../../constants';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page that displays the view entry page. * Page that displays the view entry page.
@ -156,8 +157,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
const sortBy = Number(CoreNavigator.getRouteParam('sortBy')); const sortBy = Number(CoreNavigator.getRouteParam('sortBy'));
this.sortBy = isNaN(sortBy) ? this.sortBy : sortBy; this.sortBy = isNaN(sortBy) ? this.sortBy : sortBy;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -236,7 +236,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
return this.refreshAllData(isPtr); return this.refreshAllData(isPtr);
} }
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
this.content?.scrollToTop(); this.content?.scrollToTop();
this.entryLoaded = true; this.entryLoaded = true;

View File

@ -47,8 +47,9 @@ import {
AddonModDataTemplateType, AddonModDataTemplateType,
AddonModDataTemplateMode, AddonModDataTemplateMode,
} from '../constants'; } from '../constants';
import { CoreToasts, ToastDuration } from '@services/toasts'; import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Service that provides helper functions for datas. * Service that provides helper functions for datas.
@ -164,7 +165,7 @@ export class AddonModDataHelperProvider {
// Approve/disapprove entry. // Approve/disapprove entry.
await AddonModData.approveEntry(dataId, entryId, approve, courseId, siteId); await AddonModData.approveEntry(dataId, entryId, approve, courseId, siteId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_data.errorapproving', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_data.errorapproving') });
throw error; throw error;
} }
@ -856,7 +857,7 @@ export class AddonModDataHelperProvider {
siteId = siteId || CoreSites.getCurrentSiteId(); siteId = siteId || CoreSites.getCurrentSiteId();
try { try {
await CoreDomUtils.showDeleteConfirm('addon.mod_data.confirmdeleterecord'); await CoreAlerts.confirmDelete(Translate.instant('addon.mod_data.confirmdeleterecord'));
const modal = await CoreLoadings.show(); const modal = await CoreLoadings.show();
@ -869,7 +870,7 @@ export class AddonModDataHelperProvider {
await AddonModData.deleteEntry(dataId, entryId, courseId, siteId); await AddonModData.deleteEntry(dataId, entryId, courseId, siteId);
} }
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'addon.mod_data.errordeleting', true); CoreAlerts.showError(message, { default: Translate.instant('addon.mod_data.errordeleting') });
modal.dismiss(); modal.dismiss();

View File

@ -17,7 +17,7 @@ import { Params } from '@angular/router';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_DATA_FEATURE_NAME, ADDON_MOD_DATA_PAGE_NAME } from '../../constants'; import { ADDON_MOD_DATA_FEATURE_NAME, ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import { AddonModDataEditLinkHandlerService } from '@addons/mod/data/services/handlers/edit-link'; import { AddonModDataEditLinkHandlerService } from '@addons/mod/data/services/handlers/edit-link';

View File

@ -17,7 +17,7 @@ import { Params } from '@angular/router';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_DATA_PAGE_NAME } from '../../constants'; import { ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import { AddonModDataShowLinkHandlerService } from '@addons/mod/data/services/handlers/show-link'; import { AddonModDataShowLinkHandlerService } from '@addons/mod/data/services/handlers/show-link';

View File

@ -17,7 +17,6 @@ import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker'; import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager'; import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFileHelper } from '@services/file-helper'; import { CoreFileHelper } from '@services/file-helper';
import { AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source'; import { AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
import { import {
@ -29,6 +28,8 @@ import { AddonModFeedbackAttempt, AddonModFeedbackFormItem, AddonModFeedbackHelp
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../../constants'; import { ADDON_MOD_FEEDBACK_COMPONENT } from '../../constants';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page that displays a feedback attempt review. * Page that displays a feedback attempt review.
@ -89,8 +90,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
try { try {
await this.attempts.start(); await this.attempts.start();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -156,7 +156,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
this.logView(); this.logView();
} catch (message) { } catch (message) {
// Some call failed on fetch, go back. // 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(); CoreNavigator.back();
} finally { } finally {
this.loaded = true; this.loaded = true;

View File

@ -20,12 +20,13 @@ import { CorePromisedValue } from '@classes/promised-value';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreGroupInfo } from '@services/groups'; import { CoreGroupInfo } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { AddonModFeedbackAttemptItem, AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source'; import { AddonModFeedbackAttemptItem, AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
import { AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAttempt } from '../../services/feedback'; import { AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAttempt } from '../../services/feedback';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page that displays feedback attempts. * Page that displays feedback attempts.
@ -116,8 +117,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
this.promisedAttempts.resolve(new AddonModFeedbackAttemptsManager(source, this.route.component)); this.promisedAttempts.resolve(new AddonModFeedbackAttemptsManager(source, this.route.component));
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -135,7 +135,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
} catch (error) { } catch (error) {
this.fetchFailed = true; this.fetchFailed = true;
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} }
await attempts.start(this.splitView); await attempts.start(this.splitView);
@ -163,7 +163,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
} catch (error) { } catch (error) {
this.fetchFailed = true; this.fetchFailed = true;
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
infiniteComplete && infiniteComplete(); infiniteComplete && infiniteComplete();
} }
@ -186,7 +186,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
} catch (error) { } catch (error) {
this.fetchFailed = true; this.fetchFailed = true;
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
refresher.complete(); refresher.complete();
} }

View File

@ -21,7 +21,6 @@ import { IonContent } from '@ionic/angular';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { NgZone, Translate } from '@singletons'; import { NgZone, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
@ -42,11 +41,12 @@ import {
ADDON_MOD_FEEDBACK_PAGE_NAME, ADDON_MOD_FEEDBACK_PAGE_NAME,
AddonModFeedbackIndexTabName, AddonModFeedbackIndexTabName,
} from '../../constants'; } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreError } from '@classes/errors/error'; import { CoreError } from '@classes/errors/error';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { CoreObject } from '@singletons/object'; import { CoreObject } from '@singletons/object';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays feedback form. * Page that displays feedback form.
@ -109,7 +109,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
this.preview = !!CoreNavigator.getRouteBooleanParam('preview'); this.preview = !!CoreNavigator.getRouteBooleanParam('preview');
this.fromIndex = !!CoreNavigator.getRouteBooleanParam('fromIndex'); this.fromIndex = !!CoreNavigator.getRouteBooleanParam('fromIndex');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
@ -119,7 +119,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
await this.fetchData(); await this.fetchData();
if (!this.access || this.access.isempty && (!this.access.canedititems && !this.access.canviewreports)) { 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(); CoreNavigator.back();
@ -160,7 +160,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
if (this.items && !this.completed && this.originalData) { if (this.items && !this.completed && this.originalData) {
// Form submitted. Check if there is any change. // Form submitted. Check if there is any change.
if (!CoreObject.basicLeftCompare(responses, this.originalData, 3)) { if (!CoreObject.basicLeftCompare(responses, this.originalData, 3)) {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
} }
} }
@ -200,7 +200,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
await this.fetchFeedbackPageData(page); await this.fetchFeedbackPageData(page);
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true); CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
this.forceLeave = true; this.forceLeave = true;
CoreNavigator.back(); CoreNavigator.back();
} finally { } finally {
@ -405,7 +405,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
await this.fetchFeedbackPageData(response.jumpto); await this.fetchFeedbackPageData(response.jumpto);
} }
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true); CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
this.feedbackLoaded = true; this.feedbackLoaded = true;
} }

View File

@ -15,12 +15,13 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { AddonModFeedback, AddonModFeedbackWSFeedback } from '../../services/feedback'; import { AddonModFeedback, AddonModFeedbackWSFeedback } from '../../services/feedback';
import { AddonModFeedbackHelper, AddonModFeedbackNonRespondent } from '../../services/feedback-helper'; import { AddonModFeedbackHelper, AddonModFeedbackNonRespondent } from '../../services/feedback-helper';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
/** /**
* Page that displays feedback non respondents. * Page that displays feedback non respondents.
@ -70,8 +71,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId'); this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0; this.selectedGroup = CoreNavigator.getRouteNumberParam('group') || 0;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -102,7 +102,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
this.logView(); this.logView();
} catch (message) { } catch (message) {
CoreDomUtils.showErrorModalDefault(message, 'core.course.errorgetmodule', true); CoreAlerts.showError(message, { default: Translate.instant('core.course.errorgetmodule') });
if (!refresh) { if (!refresh) {
// Some call failed on first fetch, go back. // Some call failed on first fetch, go back.
@ -162,7 +162,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
try { try {
await this.loadGroupUsers(groupId); await this.loadGroupUsers(groupId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
infiniteComplete && infiniteComplete(); infiniteComplete && infiniteComplete();
} }

View File

@ -17,7 +17,6 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFileHelper } from '@services/file-helper'; import { CoreFileHelper } from '@services/file-helper';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
@ -40,8 +39,9 @@ import {
ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT, ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT,
ADDON_MOD_FEEDBACK_PAGE_NAME, ADDON_MOD_FEEDBACK_PAGE_NAME,
} from '../constants'; } from '../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreAlerts } from '@services/overlays/alerts';
const MODE_RESPONSETIME = 1; const MODE_RESPONSETIME = 1;
const MODE_COURSE = 2; const MODE_COURSE = 2;
@ -216,7 +216,7 @@ export class AddonModFeedbackHelperProvider {
}, },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error opening link.'); CoreAlerts.showError(error, { default: 'Error opening link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -17,10 +17,10 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME, AddonModFeedbackIndexTabName } from '../../constants'; import { ADDON_MOD_FEEDBACK_PAGE_NAME, AddonModFeedbackIndexTabName } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Content links handler for a feedback analysis. * Content links handler for a feedback analysis.
@ -65,7 +65,7 @@ export class AddonModFeedbackAnalysisLinkHandlerService extends CoreContentLinks
}, },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error opening link.'); CoreAlerts.showError(error, { default: 'Error opening link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Content links handler for feedback complete questions. * Content links handler for feedback complete questions.
@ -60,7 +60,7 @@ export class AddonModFeedbackCompleteLinkHandlerService extends CoreContentLinks
}, },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error opening link.'); CoreAlerts.showError(error, { default: 'Error opening link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Content links handler for feedback print questions. * Content links handler for feedback print questions.
@ -60,7 +60,7 @@ export class AddonModFeedbackPrintLinkHandlerService extends CoreContentLinksHan
}, },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error opening link.'); CoreAlerts.showError(error, { default: 'Error opening link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Content links handler for feedback show non respondents. * Content links handler for feedback show non respondents.
* Match mod/feedback/show_nonrespondents.php with a valid feedback id. * Match mod/feedback/show_nonrespondents.php with a valid feedback id.
@ -54,7 +54,7 @@ export class AddonModFeedbackShowNonRespondentsLinkHandlerService extends CoreCo
{ siteId }, { siteId },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error opening link.'); CoreAlerts.showError(error, { default: 'Error opening link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -14,14 +14,14 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { PopoverController } from '@singletons'; import { PopoverController } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { AddonModForum, AddonModForumDiscussion } from '../../services/forum'; import { AddonModForum, AddonModForumDiscussion } from '../../services/forum';
import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants'; import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants';
import { CoreToasts } from '@services/toasts'; import { CoreToasts } from '@services/overlays/toasts';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* This component is meant to display a popover with the discussion options. * This component is meant to display a popover with the discussion options.
@ -86,7 +86,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
PopoverController.dismiss(); PopoverController.dismiss();
} finally { } finally {
modal.dismiss(); modal.dismiss();
@ -118,7 +118,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
PopoverController.dismiss(); PopoverController.dismiss();
} finally { } finally {
modal.dismiss(); modal.dismiss();
@ -150,7 +150,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
PopoverController.dismiss(); PopoverController.dismiss();
} finally { } finally {
modal.dismiss(); modal.dismiss();

View File

@ -38,7 +38,6 @@ import {
} from '@addons/mod/forum/services/forum-sync'; } from '@addons/mod/forum/services/forum-sync';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreScreen } from '@services/screen'; import { CoreScreen } from '@services/screen';
@ -65,9 +64,10 @@ import {
AddonModForumType, AddonModForumType,
} from '@addons/mod/forum/constants'; } from '@addons/mod/forum/constants';
import { CoreSearchGlobalSearch } from '@features/search/services/global-search'; import { CoreSearchGlobalSearch } from '@features/search/services/global-search';
import { CoreToasts } from '@services/toasts'; import { CoreToasts } from '@services/overlays/toasts';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a forum entry page. * Component that displays a forum entry page.
*/ */
@ -475,7 +475,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
await discussions.load(); await discussions.load();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetforum', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetforum') });
this.fetchFailed = true; this.fetchFailed = true;
} finally { } finally {
@ -618,7 +618,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
await CoreUser.setUserPreference(ADDON_MOD_FORUM_PREFERENCE_SORTORDER, sortOrder.value.toFixed(0)); await CoreUser.setUserPreference(ADDON_MOD_FORUM_PREFERENCE_SORTORDER, sortOrder.value.toFixed(0));
await this.showLoadingAndFetch(); await this.showLoadingAndFetch();
} catch (error) { } 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(), this.discussions?.reload(),
]); ]);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true); CoreAlerts.showError(error, { default: Translate.instant('core.errorloadingcontent') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -17,9 +17,9 @@ import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { AddonModForum, AddonModForumPost } from '@addons/mod/forum/services/forum'; import { AddonModForum, AddonModForumPost } from '@addons/mod/forum/services/forum';
import { PopoverController } from '@singletons'; import { PopoverController } from '@singletons';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreNetworkError } from '@classes/errors/network-error'; import { CoreNetworkError } from '@classes/errors/network-error';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* This component is meant to display a popover with the post options. * 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, readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting discussion post.'); CoreAlerts.showError(error, { default: 'Error getting discussion post.' });
} }
} else { } else {
this.loaded = true; this.loaded = true;
@ -111,7 +111,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit {
deletePost(): void { deletePost(): void {
if (!this.offlinePost) { if (!this.offlinePost) {
if (!CoreNetwork.isOnline()) { if (!CoreNetwork.isOnline()) {
CoreDomUtils.showErrorModal(new CoreNetworkError()); CoreAlerts.showError(new CoreNetworkError());
return; return;
} }
@ -127,7 +127,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit {
*/ */
editPost(): void { editPost(): void {
if (!this.offlinePost && !CoreNetwork.isOnline()) { if (!this.offlinePost && !CoreNetwork.isOnline()) {
CoreDomUtils.showErrorModal(new CoreNetworkError()); CoreAlerts.showError(new CoreNetworkError());
return; return;
} }

View File

@ -25,7 +25,6 @@ import {
ViewChild, ViewChild,
} from '@angular/core'; } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { import {
@ -53,13 +52,14 @@ import { AddonModForumSharedPostFormData } from '../../pages/discussion/discussi
import { CoreDom } from '@singletons/dom'; import { CoreDom } from '@singletons/dom';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, ADDON_MOD_FORUM_COMPONENT } from '../../constants'; import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, ADDON_MOD_FORUM_COMPONENT } from '../../constants';
import { CoreToasts } from '@services/toasts'; import { CoreToasts } from '@services/overlays/toasts';
import { toBoolean } from '@/core/transforms/boolean'; import { toBoolean } from '@/core/transforms/boolean';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreWSFile } from '@services/ws'; import { CoreWSFile } from '@services/ws';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreWSError } from '@classes/errors/wserror'; 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.). * 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}`); this.analyticsLogEvent('mod_forum_delete_post', `/mod/forum/post.php?delete=${this.post.id}`);
try { 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); const modal = await CoreLoadings.show('core.deleting', true);
@ -181,7 +181,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); 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}`); this.analyticsLogEvent('mod_forum_update_discussion_post', `/mod/forum/post.php?edit=${this.post.id}`);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetpost', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetpost') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -384,13 +384,13 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
*/ */
async send(): Promise<void> { async send(): Promise<void> {
if (!this.formData.subject) { if (!this.formData.subject) {
CoreDomUtils.showErrorModal('addon.mod_forum.erroremptysubject', true); CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptysubject'));
return; return;
} }
if (!this.formData.message) { if (!this.formData.message) {
CoreDomUtils.showErrorModal('addon.mod_forum.erroremptymessage', true); CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptymessage'));
return; return;
} }
@ -481,11 +481,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
this.unblockOperation(); this.unblockOperation();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault( CoreAlerts.showError(error, {
error, default: Translate.instant(isEditOnline ? 'addon.mod_forum.couldnotupdate' : 'addon.mod_forum.couldnotadd'),
isEditOnline ? 'addon.mod_forum.couldnotupdate' : 'addon.mod_forum.couldnotadd', });
true,
);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -589,7 +587,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
*/ */
async discardOfflineReply(): Promise<void> { async discardOfflineReply(): Promise<void> {
try { try {
await CoreDomUtils.showDeleteConfirm(); await CoreAlerts.confirmDelete(Translate.instant('core.areyousure'));
const promises: Promise<void>[] = []; const promises: Promise<void>[] = [];
@ -643,7 +641,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
protected async confirmDiscard(): Promise<void> { protected async confirmDiscard(): Promise<void> {
if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) { if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmloss')); await CoreAlerts.confirm(Translate.instant('core.confirmloss'));
} }
this.unblockOperation(); this.unblockOperation();

View File

@ -28,7 +28,6 @@ import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen'; import { CoreScreen } from '@services/screen';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { NgZone, Translate } from '@singletons'; import { NgZone, Translate } from '@singletons';
import { CoreDom } from '@singletons/dom'; import { CoreDom } from '@singletons/dom';
@ -60,10 +59,11 @@ import {
AddonModForumType, AddonModForumType,
} from '../../constants'; } from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts } from '@services/toasts'; import { CoreToasts } from '@services/overlays/toasts';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreObject } from '@singletons/object'; import { CoreObject } from '@singletons/object';
import { CoreAlerts } from '@services/overlays/alerts';
type SortType = 'flat-newest' | 'flat-oldest' | 'nested'; type SortType = 'flat-newest' | 'flat-oldest' | 'nested';
@ -171,7 +171,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
await this.discussions.start(); await this.discussions.start();
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
this.goBack(); this.goBack();
@ -303,7 +303,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
async canLeave(): Promise<boolean> { async canLeave(): Promise<boolean> {
if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) { if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
// Delete the local files from the tmp folder. // Delete the local files from the tmp folder.
@ -571,7 +571,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
this.hasOfflineRatings = this.hasOfflineRatings =
await CoreRatingOffline.hasRatings('mod_forum', 'post', ContextLevel.MODULE, this.cmId, this.discussionId); await CoreRatingOffline.hasRatings('mod_forum', 'post', ContextLevel.MODULE, this.cmId, this.discussionId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
this.discussionLoaded = true; this.discussionLoaded = true;
this.refreshIcon = CoreConstants.ICON_REFRESH; this.refreshIcon = CoreConstants.ICON_REFRESH;
@ -616,7 +616,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
.syncDiscussionReplies(this.discussionId) .syncDiscussionReplies(this.discussionId)
.then((result) => { .then((result) => {
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
CoreDomUtils.showAlert(undefined, result.warnings[0]); CoreAlerts.show({ message: result.warnings[0] });
} }
if (result && result.updated && this.forumId) { if (result && result.updated && this.forumId) {
@ -637,7 +637,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
.syncRatings(this.cmId, this.discussionId) .syncRatings(this.cmId, this.discussionId)
.then((result) => { .then((result) => {
if (result.warnings && result.warnings.length) { if (result.warnings && result.warnings.length) {
CoreDomUtils.showAlert(undefined, result.warnings[0]); CoreAlerts.show({ message: result.warnings[0] });
} }
return; return;
@ -648,7 +648,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
if (showErrors) { if (showErrors) {
CoreDomUtils.showErrorModalDefault(error, 'core.errorsync', true); CoreAlerts.showError(error, { default: Translate.instant('core.errorsync') });
} }
throw new Error('Failed syncing discussion'); throw new Error('Failed syncing discussion');
@ -740,7 +740,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -776,7 +776,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -812,7 +812,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
translateMessage: true, translateMessage: true,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -27,7 +27,6 @@ import {
import { CoreEditorRichTextEditorComponent } from '@features/editor/components/rich-text-editor/rich-text-editor'; import { CoreEditorRichTextEditorComponent } from '@features/editor/components/rich-text-editor/rich-text-editor';
import { AddonModForumSync } from '@addons/mod/forum/services/forum-sync'; import { AddonModForumSync } from '@addons/mod/forum/services/forum-sync';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreSync } from '@services/sync'; import { CoreSync } from '@services/sync';
import { AddonModForumDiscussionOptions, AddonModForumOffline } from '@addons/mod/forum/services/forum-offline'; import { AddonModForumDiscussionOptions, AddonModForumOffline } from '@addons/mod/forum/services/forum-offline';
@ -52,8 +51,9 @@ import {
ADDON_MOD_FORUM_NEW_DISCUSSION_EVENT, ADDON_MOD_FORUM_NEW_DISCUSSION_EVENT,
} from '../../constants'; } from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
type NewDiscussionData = { type NewDiscussionData = {
subject: string; subject: string;
@ -159,7 +159,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
await this.discussions.start(); await this.discussions.start();
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
this.goBack(); this.goBack();
@ -183,7 +183,10 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
// Refresh data if this discussion is synchronized automatically. // Refresh data if this discussion is synchronized automatically.
this.syncObserver = CoreEvents.on(ADDON_MOD_FORUM_AUTO_SYNCED, data => { this.syncObserver = CoreEvents.on(ADDON_MOD_FORUM_AUTO_SYNCED, data => {
if (data.forumId == this.forumId && data.userId == CoreSites.getCurrentSiteUserId()) { 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(); this.returnToDiscussions();
} }
}, CoreSites.getCurrentSiteId()); }, CoreSites.getCurrentSiteId());
@ -336,7 +339,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetgroups', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.errorgetgroups') });
this.showForm = false; this.showForm = false;
} }
@ -541,12 +544,12 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
}; };
if (!subject) { if (!subject) {
CoreDomUtils.showErrorModal('addon.mod_forum.erroremptysubject', true); CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptysubject'));
return; return;
} }
if (!message) { if (!message) {
CoreDomUtils.showErrorModal('addon.mod_forum.erroremptymessage', true); CoreAlerts.showError(Translate.instant('addon.mod_forum.erroremptymessage'));
return; return;
} }
@ -584,7 +587,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
if (discussionIds && discussionIds.length < groupIds.length) { if (discussionIds && discussionIds.length < groupIds.length) {
// Some discussions could not be created. // Some discussions could not be created.
CoreDomUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true); CoreAlerts.showError(Translate.instant('addon.mod_forum.errorposttoallgroups'));
} }
CoreForms.triggerFormSubmittedEvent( CoreForms.triggerFormSubmittedEvent(
@ -595,7 +598,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
this.returnToDiscussions(discussionIds, discTimecreated); this.returnToDiscussions(discussionIds, discTimecreated);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.cannotcreatediscussion', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_forum.cannotcreatediscussion') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -606,7 +609,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
*/ */
async discard(): Promise<void> { async discard(): Promise<void> {
try { try {
await CoreDomUtils.showConfirm(Translate.instant('core.areyousure')); await CoreAlerts.confirm(Translate.instant('core.areyousure'));
const promises: Promise<unknown>[] = []; const promises: Promise<unknown>[] = [];
@ -659,7 +662,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
if (AddonModForumHelper.hasPostDataChanged(this.newDiscussion, this.originalData)) { if (AddonModForumHelper.hasPostDataChanged(this.newDiscussion, this.originalData)) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
// Delete the local files from the tmp folder. // Delete the local files from the tmp folder.

View File

@ -26,11 +26,12 @@ import {
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { CoreUtils } from '@singletons/utils'; import { CoreUtils } from '@singletons/utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
import { CoreLoadings } from '@services/overlays/loadings';
@Component({ @Component({
selector: 'page-addon-mod-forum-search', selector: 'page-addon-mod-forum-search',
@ -82,7 +83,7 @@ export class AddonModForumSearchPage implements OnInit {
this.resultsSource.setFilters(filters); this.resultsSource.setFilters(filters);
this.ready.resolve(); this.ready.resolve();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -103,7 +104,7 @@ export class AddonModForumSearchPage implements OnInit {
return; return;
} }
await CoreDomUtils.showOperationModals('core.searching', true, async () => { await CoreLoadings.showOperationModals('core.searching', true, async () => {
await this.resultsSource.reload(); await this.resultsSource.reload();
await CorePromiseUtils.ignoreErrors( await CorePromiseUtils.ignoreErrors(
CoreSearchGlobalSearch.logViewResults(this.resultsSource.getQuery(), this.resultsSource.getFilters()), CoreSearchGlobalSearch.logViewResults(this.resultsSource.getQuery(), this.resultsSource.getFilters()),

View File

@ -18,7 +18,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_FORUM_PAGE_NAME } from '../../constants'; import { ADDON_MOD_FORUM_PAGE_NAME } from '../../constants';

View File

@ -28,7 +28,6 @@ import { CoreRatingSyncProvider } from '@features/rating/services/rating-sync';
import { IonContent } from '@ionic/angular'; import { IonContent } from '@ionic/angular';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
@ -58,7 +57,8 @@ import {
ADDON_MOD_GLOSSARY_PAGE_NAME, ADDON_MOD_GLOSSARY_PAGE_NAME,
GLOSSARY_AUTO_SYNCED, GLOSSARY_AUTO_SYNCED,
} from '../../constants'; } from '../../constants';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a glossary entry page. * Component that displays a glossary entry page.
@ -339,7 +339,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
await entries.load(); await entries.load();
} catch (error) { } catch (error) {
this.loadMoreError = true; this.loadMoreError = true;
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentries', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentries') });
} finally { } finally {
infiniteComplete && infiniteComplete(); infiniteComplete && infiniteComplete();
} }

View File

@ -23,7 +23,6 @@ import { CoreFileEntry } from '@services/file-helper';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -40,7 +39,8 @@ import { AddonModGlossaryHelper } from '../../services/glossary-helper';
import { AddonModGlossaryOffline } from '../../services/glossary-offline'; import { AddonModGlossaryOffline } from '../../services/glossary-offline';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_GLOSSARY_COMPONENT } from '../../constants'; import { ADDON_MOD_GLOSSARY_COMPONENT } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays the edit form. * Page that displays the edit form.
@ -108,7 +108,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
this.handler = new AddonModGlossaryNewFormHandler(this); this.handler = new AddonModGlossaryNewFormHandler(this);
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; 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}` : ''), url: '/mod/glossary/edit.php' + (this.entry ? `?cmid=${this.cmId}&id=${this.entry.id}` : ''),
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingglossary', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingglossary') });
CoreNavigator.back(); CoreNavigator.back();
} }
} }
@ -187,7 +187,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
if (this.hasDataChanged()) { if (this.hasDataChanged()) {
// Show confirmation if some data has been modified. // Show confirmation if some data has been modified.
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
// Delete the local files from the tmp folder. // Delete the local files from the tmp folder.
@ -203,7 +203,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
*/ */
async save(): Promise<void> { async save(): Promise<void> {
if (!this.data.concept || !this.data.definition) { if (!this.data.concept || !this.data.definition) {
CoreDomUtils.showErrorModal('addon.mod_glossary.fillfields', true); CoreAlerts.showError(Translate.instant('addon.mod_glossary.fillfields'));
return; return;
} }
@ -223,7 +223,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
CoreNavigator.back(); CoreNavigator.back();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.cannoteditentry', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.cannoteditentry') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -26,7 +26,6 @@ import { CoreTag } from '@features/tag/services/tag';
import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
@ -40,8 +39,9 @@ import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_GLOSSARY_COMPONENT, ADDON_MOD_GLOSSARY_ENTRY_UPDATED, ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants'; import { ADDON_MOD_GLOSSARY_COMPONENT, ADDON_MOD_GLOSSARY_ENTRY_UPDATED, ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts, ToastDuration } from '@services/toasts'; import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a glossary entry. * Page that displays a glossary entry.
@ -126,7 +126,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
onlineEntryId = Number(this.entrySlug); onlineEntryId = Number(this.entrySlug);
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
this.goBack(); this.goBack();
return; return;
@ -185,7 +185,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
const glossaryId = this.glossary?.id; const glossaryId = this.glossary?.id;
const cancelled = await CorePromiseUtils.promiseFails( const cancelled = await CorePromiseUtils.promiseFails(
CoreDomUtils.showConfirm(Translate.instant('addon.mod_glossary.areyousuredelete')), CoreAlerts.confirm(Translate.instant('addon.mod_glossary.areyousuredelete')),
); );
if (!glossaryId || cancelled) { if (!glossaryId || cancelled) {
@ -224,7 +224,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
await this.goBack(); await this.goBack();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errordeleting', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errordeleting') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -274,7 +274,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
this.logView(); this.logView();
} catch (error) { } 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.canEdit = true;
this.canDelete = true; this.canDelete = true;
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentry', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentry') });
} }
} }

View File

@ -18,10 +18,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { makeSingleton, Translate } from '@singletons';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants'; import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Content links handler for glossary new entry. * Content links handler for glossary new entry.
@ -56,7 +56,7 @@ export class AddonModGlossaryEditLinkHandlerService extends CoreContentLinksHand
{ siteId }, { siteId },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingglossary', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingglossary') });
} finally { } finally {
// Just in case. In fact we need to dismiss the modal before showing a toast or error message. // Just in case. In fact we need to dismiss the modal before showing a toast or error message.
modal.dismiss(); modal.dismiss();

View File

@ -18,11 +18,11 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { makeSingleton, Translate } from '@singletons';
import { makeSingleton } from '@singletons';
import { AddonModGlossary } from '../glossary'; import { AddonModGlossary } from '../glossary';
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants'; import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Handler to treat links to glossary entries. * Handler to treat links to glossary entries.
@ -67,7 +67,7 @@ export class AddonModGlossaryEntryLinkHandlerService extends CoreContentLinksHan
}, },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentry', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentry') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -28,7 +28,6 @@ import { CoreNetwork } from '@services/network';
import { CoreFilepool } from '@services/filepool'; import { CoreFilepool } from '@services/filepool';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreWSFile } from '@services/ws'; import { CoreWSFile } from '@services/ws';
import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { import {
@ -54,10 +53,12 @@ import {
ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT, ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT,
} from '../../constants'; } from '../../constants';
import { CoreH5PMissingDependenciesError } from '@features/h5p/classes/errors/missing-dependencies-error'; import { CoreH5PMissingDependenciesError } from '@features/h5p/classes/errors/missing-dependencies-error';
import { CoreToasts, ToastDuration } from '@services/toasts'; import { CoreToasts, ToastDuration } from '@services/overlays/toasts';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { NgZone, Translate } from '@singletons'; import { NgZone, Translate } from '@singletons';
import { CoreError } from '@classes/errors/error'; 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. * 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) { if (this.playing && !this.fileUrl && !this.isOnline && wasOnline && this.trackComponent) {
// User lost connection while playing an online package with tracking. Show an error. // 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'), { new CoreError(Translate.instant('core.course.changesofflinemaybelost'), {
title: Translate.instant('core.youreoffline'), title: Translate.instant('core.youreoffline'),
}), }),
@ -398,14 +399,14 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
} }
if (!CoreNetwork.isOnline()) { if (!CoreNetwork.isOnline()) {
CoreDomUtils.showErrorModal('core.networkerrormsg', true); CoreAlerts.showError(Translate.instant('core.networkerrormsg'));
return; return;
} }
try { try {
// Confirm the download if needed. // 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(); await this.downloadDeployedFile();
@ -414,7 +415,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
} }
} catch (error) { } catch (error) {
if (CoreDomUtils.isCanceledError(error) || this.isDestroyed) { if (CoreErrorHelper.isCanceledError(error) || this.isDestroyed) {
// User cancelled or view destroyed, stop. // User cancelled or view destroyed, stop.
return; return;
} }
@ -433,7 +434,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
return; 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(); this.play();
} }
} catch (error) { } 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) { if (!this.fileUrl && !this.isOnline) {
this.triedToPlay = true; 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'), title: Translate.instant('core.course.activitynotavailableoffline'),
})); }));
@ -697,7 +698,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
} }
} }
} catch (error) { } 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; this.hasOffline = !sent;
} catch (error) { } 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) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.'); CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
} }
} }

View File

@ -16,7 +16,6 @@ import { Component, OnInit } from '@angular/core';
import { CoreUser, CoreUserProfile } from '@features/user/services/user'; import { CoreUser, CoreUserProfile } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { import {
AddonModH5PActivity, AddonModH5PActivity,
@ -26,6 +25,7 @@ import {
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_H5PACTIVITY_COMPONENT } from '../../constants'; import { ADDON_MOD_H5PACTIVITY_COMPONENT } from '../../constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays results of an attempt. * Page that displays results of an attempt.
@ -78,8 +78,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId'); this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
this.attemptId = CoreNavigator.getRequiredRouteNumberParam('attemptId'); this.attemptId = CoreNavigator.getRequiredRouteNumberParam('attemptId');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -116,7 +115,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading attempt.'); CoreAlerts.showError(error, { default: 'Error loading attempt.' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -16,9 +16,8 @@ import { Component, OnDestroy, ViewChild } from '@angular/core';
import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page';
import { CanLeave } from '@guards/can-leave'; import { CanLeave } from '@guards/can-leave';
import { CoreDomUtils } from '@services/utils/dom';
import { Translate } from '@singletons';
import { AddonModH5PActivityIndexComponent } from '../../components/index'; import { AddonModH5PActivityIndexComponent } from '../../components/index';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays an H5P activity. * Page that displays an H5P activity.
@ -45,7 +44,7 @@ export class AddonModH5PActivityIndexPage extends CoreCourseModuleMainActivityPa
if (!this.canLeaveSafely) { if (!this.canLeaveSafely) {
try { try {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmleaveunknownchanges')); await CoreAlerts.confirmLeaveWithChanges();
return true; return true;
} catch { } catch {

View File

@ -17,7 +17,6 @@ import { Component, OnInit } from '@angular/core';
import { CoreUser, CoreUserProfile } from '@features/user/services/user'; import { CoreUser, CoreUserProfile } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { import {
AddonModH5PActivity, AddonModH5PActivity,
@ -27,6 +26,7 @@ import {
} from '../../services/h5pactivity'; } from '../../services/h5pactivity';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays user attempts of a certain user. * Page that displays user attempts of a certain user.
@ -79,8 +79,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId'); this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId(); this.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -118,7 +117,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading attempts.'); CoreAlerts.showError(error, { default: 'Error loading attempts.' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -16,7 +16,6 @@ import { Component, OnInit } from '@angular/core';
import { CoreUser, CoreUserProfile } from '@features/user/services/user'; import { CoreUser, CoreUserProfile } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { import {
AddonModH5PActivity, AddonModH5PActivity,
@ -26,6 +25,7 @@ import {
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { AddonModH5PActivityGradeMethod } from '../../constants'; import { AddonModH5PActivityGradeMethod } from '../../constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays all users that can attempt an H5P activity. * 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.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId'); this.cmId = CoreNavigator.getRequiredRouteNumberParam('cmId');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -111,7 +110,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading attempts.'); CoreAlerts.showError(error, { default: 'Error loading attempts.' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -192,7 +191,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
try { try {
await this.fetchUsers(false); await this.fetchUsers(false);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading more users'); CoreAlerts.showError(error, { default: 'Error loading more users' });
this.fetchMoreUsersFailed = true; this.fetchMoreUsersFailed = true;
} }

View File

@ -19,12 +19,12 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModH5PActivity } from '../h5pactivity'; import { AddonModH5PActivity } from '../h5pactivity';
import { ADDON_MOD_H5PACTIVITY_PAGE_NAME } from '../../constants'; import { ADDON_MOD_H5PACTIVITY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Handler to treat links to H5P activity report. * 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); await this.openUserAttempts(module.id, module.course, instanceId, siteId, userId);
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error processing link.'); CoreAlerts.showError(error, { default: 'Error processing link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -22,12 +22,12 @@ import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate'; import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate';
import { CoreNetwork } from '@services/network'; import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreErrorHelper } from '@services/error-helper'; import { CoreErrorHelper } from '@services/error-helper';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
import { AddonModImscp, AddonModImscpImscp, AddonModImscpTocItem } from '../../services/imscp'; import { AddonModImscp, AddonModImscpImscp, AddonModImscpTocItem } from '../../services/imscp';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a IMSCP content. * Page that displays a IMSCP content.
@ -61,8 +61,7 @@ export class AddonModImscpViewPage implements OnInit {
this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId'); this.courseId = CoreNavigator.getRequiredRouteNumberParam('courseId');
this.initialItemHref = CoreNavigator.getRouteParam('initialHref'); this.initialItemHref = CoreNavigator.getRouteParam('initialHref');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -118,7 +117,7 @@ export class AddonModImscpViewPage implements OnInit {
try { try {
await this.loadItemHref(this.currentHref); await this.loadItemHref(this.currentHref);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_imscp.deploymenterror', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_imscp.deploymenterror') });
return; return;
} }
@ -130,7 +129,7 @@ export class AddonModImscpViewPage implements OnInit {
this.warning = ''; this.warning = '';
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -22,7 +22,6 @@ import { CoreUser } from '@features/user/services/user';
import { IonContent, IonInput } from '@ionic/angular'; import { IonContent, IonInput } from '@ionic/angular';
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
@ -52,6 +51,7 @@ import {
ADDON_MOD_LESSON_DATA_SENT_EVENT, ADDON_MOD_LESSON_DATA_SENT_EVENT,
ADDON_MOD_LESSON_PAGE_NAME, ADDON_MOD_LESSON_PAGE_NAME,
} from '../../constants'; } from '../../constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a lesson entry page. * Component that displays a lesson entry page.
@ -126,7 +126,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
try { try {
await this.setGroup(groupId); await this.setGroup(groupId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting report.'); CoreAlerts.showError(error, { default: 'Error getting report.' });
} finally { } finally {
this.reportLoaded = true; this.reportLoaded = true;
} }
@ -464,7 +464,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
if (!this.groupInfo) { if (!this.groupInfo) {
this.fetchReportData().catch((error) => { 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. // Error downloading but there is something offline, allow continuing it.
this.playLesson(continueLast); this.playLesson(continueLast);
} else { } else {
CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true); CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
} }
} finally { } finally {
this.showSpinner = false; this.showSpinner = false;
@ -632,7 +632,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
const password = passwordEl?.value; const password = passwordEl?.value;
if (!password) { if (!password) {
CoreDomUtils.showErrorModal('addon.mod_lesson.emptypassword', true); CoreAlerts.showError(Translate.instant('addon.mod_lesson.emptypassword'));
return; return;
} }
@ -652,7 +652,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
// Log view now that we have the password. // Log view now that we have the password.
this.logActivity(); this.logActivity();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
} finally { } finally {
this.showLoading = false; this.showLoading = false;

View File

@ -22,7 +22,6 @@ import { CoreNetwork } from '@services/network';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSync } from '@services/sync'; import { CoreSync } from '@services/sync';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { CoreObject } from '@singletons/object'; import { CoreObject } from '@singletons/object';
import { CoreWSExternalFile } from '@services/ws'; import { CoreWSExternalFile } from '@services/ws';
@ -54,10 +53,11 @@ import { AddonModLessonSync } from '../../services/lesson-sync';
import { CoreFormFields, CoreForms } from '@singletons/form'; import { CoreFormFields, CoreForms } from '@singletons/form';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo } from '../../constants'; import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo } from '../../constants';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/overlays/modals';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreWSError } from '@classes/errors/wserror'; import { CoreWSError } from '@classes/errors/wserror';
import { CoreDom } from '@singletons/dom'; import { CoreDom } from '@singletons/dom';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that allows attempting and reviewing a lesson. * 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.currentPage = CoreNavigator.getRouteNumberParam('pageId');
this.retakeToReview = CoreNavigator.getRouteNumberParam('retake'); this.retakeToReview = CoreNavigator.getRouteNumberParam('retake');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
@ -173,7 +173,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
if (this.question && !this.eolData && !this.processData && this.originalData) { if (this.question && !this.eolData && !this.processData && this.originalData) {
// Question shown. Check if there is any change. // Question shown. Check if there is any change.
if (!CoreObject.basicLeftCompare(this.questionForm.getRawValue(), this.originalData, 3)) { if (!CoreObject.basicLeftCompare(this.questionForm.getRawValue(), this.originalData, 3)) {
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); await CoreAlerts.confirmLeaveWithChanges();
} }
} }
@ -258,7 +258,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
try { try {
await this.loadPage(pageId); await this.loadPage(pageId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading page'); CoreAlerts.showError(error, { default: 'Error loading page' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -363,7 +363,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
await AddonModLessonSync.deleteRetakeFinishedInSync(this.lesson!.id); 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; this.forceLeave = true;
CoreNavigator.back(); 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. // 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; this.offline = false;
@ -546,7 +546,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
this.lessonPages = pages.map((entry) => entry.page); this.lessonPages = pages.map((entry) => entry.page);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading menu.'); CoreAlerts.showError(error, { default: 'Error loading menu.' });
} finally { } finally {
this.loadingMenu = false; this.loadingMenu = false;
} }
@ -763,7 +763,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
this.logContinuePageLoaded(); this.logContinuePageLoaded();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error processing page'); CoreAlerts.showError(error, { default: 'Error processing page' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -782,7 +782,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
try { try {
await this.loadPage(pageId); await this.loadPage(pageId);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading page'); CoreAlerts.showError(error, { default: 'Error loading page' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -818,7 +818,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
try { try {
await this.finishRetake(true); await this.finishRetake(true);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error finishing attempt'); CoreAlerts.showError(error, { default: 'Error finishing attempt' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }

View File

@ -18,7 +18,6 @@ import { CoreError } from '@classes/errors/error';
import { CoreUser } from '@features/user/services/user'; import { CoreUser } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CoreErrorHelper } from '@services/error-helper'; import { CoreErrorHelper } from '@services/error-helper';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -36,6 +35,7 @@ import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_LESSON_COMPONENT } from '../../constants'; import { ADDON_MOD_LESSON_COMPONENT } from '../../constants';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Page that displays a retake made by a certain user. * 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.userId = CoreNavigator.getRouteNumberParam('userId') || CoreSites.getCurrentSiteUserId();
this.retakeNumber = CoreNavigator.getRouteNumberParam('retake'); this.retakeNumber = CoreNavigator.getRouteNumberParam('retake');
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreAlerts.showError(error);
CoreNavigator.back(); CoreNavigator.back();
return; return;
@ -103,7 +102,7 @@ export class AddonModLessonUserRetakePage implements OnInit {
this.performLogView(); this.performLogView();
} catch (error) { } catch (error) {
this.selectedRetake = this.previousSelectedRetake ?? this.selectedRetake; this.selectedRetake = this.previousSelectedRetake ?? this.selectedRetake;
CoreDomUtils.showErrorModal(CoreErrorHelper.addDataNotDownloadedError(error, 'Error getting attempt.')); CoreAlerts.showError(CoreErrorHelper.addDataNotDownloadedError(error, 'Error getting attempt.'));
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -171,7 +170,7 @@ export class AddonModLessonUserRetakePage implements OnInit {
this.logView(); this.logView();
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error getting data.', true); CoreAlerts.showError(error, { default: Translate.instant('Error getting data.') });
} }
} }

View File

@ -19,11 +19,11 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { makeSingleton, Translate } from '@singletons';
import { makeSingleton } from '@singletons';
import { AddonModLesson } from '../lesson'; import { AddonModLesson } from '../lesson';
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants'; import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Handler to treat links to lesson grade. * Handler to treat links to lesson grade.
@ -84,7 +84,7 @@ export class AddonModLessonGradeLinkHandlerService extends CoreContentLinksModul
}); });
} }
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.course.errorgetmodule', true); CoreAlerts.showError(error, { default: Translate.instant('core.course.errorgetmodule') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -19,7 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModLesson } from '../lesson'; import { AddonModLesson } from '../lesson';

View File

@ -21,7 +21,6 @@ import { CoreFilepool } from '@services/filepool';
import { CoreGroups } from '@services/groups'; import { CoreGroups } from '@services/groups';
import { CoreFileSizeSum, CorePluginFileDelegate } from '@services/plugin-file-delegate'; import { CoreFileSizeSum, CorePluginFileDelegate } from '@services/plugin-file-delegate';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites'; import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreModals } from '@services/modals';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreWSFile } from '@services/ws'; import { CoreWSFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons'; import { makeSingleton, Translate } from '@singletons';
@ -33,6 +32,7 @@ import {
} from '../lesson'; } from '../lesson';
import { AddonModLessonSync, AddonModLessonSyncResult } from '../lesson-sync'; import { AddonModLessonSync, AddonModLessonSyncResult } from '../lesson-sync';
import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo, AddonModLessonPageSubtype } from '../../constants'; import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo, AddonModLessonPageSubtype } from '../../constants';
import { CorePrompts } from '@services/overlays/prompts';
/** /**
* Handler to prefetch lessons. * Handler to prefetch lessons.
@ -136,7 +136,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
} }
// Create and show the modal. // Create and show the modal.
const response = await CoreModals.promptPassword({ const response = await CorePrompts.promptPassword({
title: 'addon.mod_lesson.enterpassword', title: 'addon.mod_lesson.enterpassword',
placeholder: 'core.login.password', placeholder: 'core.login.password',
submit: 'addon.mod_lesson.continue', submit: 'addon.mod_lesson.continue',

View File

@ -19,10 +19,10 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course'; import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants'; import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Handler to treat links to lesson report. * Handler to treat links to lesson report.
@ -111,7 +111,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
{ params, siteId }, { params, siteId },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error processing link.'); CoreAlerts.showError(error, { default: 'Error processing link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }
@ -150,7 +150,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
{ params, siteId }, { params, siteId },
); );
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error processing link.'); CoreAlerts.showError(error, { default: 'Error processing link.' });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,12 +18,12 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CorePlatform } from '@services/platform'; import { CorePlatform } from '@services/platform';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { makeSingleton, Translate } from '@singletons';
import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { AddonModLti, AddonModLtiLti } from './lti'; import { AddonModLti, AddonModLtiLti } from './lti';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreLoadings } from '@services/loadings'; import { CoreLoadings } from '@services/overlays/loadings';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Service that provides some helper functions for LTI. * Service that provides some helper functions for LTI.
@ -93,7 +93,7 @@ export class AddonModLtiHelperProvider {
// Launch LTI. // Launch LTI.
return AddonModLti.launch(launchData.endpoint, launchData.parameters); return AddonModLti.launch(launchData.endpoint, launchData.parameters);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_lti.errorgetlti', true); CoreAlerts.showError(error, { default: Translate.instant('addon.mod_lti.errorgetlti') });
} finally { } finally {
modal.dismiss(); modal.dismiss();
} }

View File

@ -18,7 +18,7 @@ import { CoreQuestionHelper } from '@features/question/services/question-helper'
import { CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionsAnswers } from '@features/question/services/question';
import { CoreLogger } from '@singletons/logger'; import { CoreLogger } from '@singletons/logger';
import { AddonModQuiz, AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../services/quiz'; import { AddonModQuiz, AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../services/quiz';
import { CorePopovers } from '@services/popovers'; import { CorePopovers } from '@services/overlays/popovers';
/** /**
* Class to support auto-save in quiz. Every certain seconds, it will check if there are changes in the current page answers * Class to support auto-save in quiz. Every certain seconds, it will check if there are changes in the current page answers

View File

@ -21,7 +21,6 @@ import { CoreCourseContentsPage } from '@features/course/pages/contents/contents
import { CoreQuestionBehaviourDelegate } from '@features/question/services/behaviour-delegate'; import { CoreQuestionBehaviourDelegate } from '@features/question/services/behaviour-delegate';
import { IonContent } from '@ionic/angular'; import { IonContent } from '@ionic/angular';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text'; import { CoreText } from '@singletons/text';
import { CorePromiseUtils } from '@singletons/promise-utils'; import { CorePromiseUtils } from '@singletons/promise-utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -51,6 +50,7 @@ import {
AddonModQuizAttemptStates, AddonModQuizAttemptStates,
} from '../../constants'; } from '../../constants';
import { QuestionDisplayOptionsMarks } from '@features/question/constants'; import { QuestionDisplayOptionsMarks } from '@features/question/constants';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Component that displays a quiz entry page. * 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. // If the site doesn't support check updates, continue too because we cannot tell if there's something new.
this.openQuiz(); this.openQuiz();
} else { } else {
CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true); CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
} }
} finally { } finally {
this.showStatusSpinner = false; this.showStatusSpinner = false;
@ -192,7 +192,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
if (warnings?.length) { if (warnings?.length) {
// Show warnings and delete them so they aren't shown again. // 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, []); await AddonModQuizSync.setSyncWarnings(quiz.id, []);
} }

View File

@ -15,8 +15,6 @@
import { Component, OnInit, ViewChild, ElementRef, Input, Type } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef, Input, Type } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms'; import { FormBuilder, FormGroup } from '@angular/forms';
import { CoreSites } from '@services/sites'; import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { ModalController, Translate } from '@singletons'; import { ModalController, Translate } from '@singletons';
import { AddonModQuizAccessRuleDelegate } from '../../services/access-rules-delegate'; import { AddonModQuizAccessRuleDelegate } from '../../services/access-rules-delegate';
@ -24,6 +22,7 @@ import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../../service
import { CoreDom } from '@singletons/dom'; import { CoreDom } from '@singletons/dom';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { toBoolean } from '@/core/transforms/boolean'; import { toBoolean } from '@/core/transforms/boolean';
import { CoreAlerts } from '@services/overlays/alerts';
/** /**
* Modal that renders the access rules for a quiz. * Modal that renders the access rules for a quiz.
@ -107,7 +106,7 @@ export class AddonModQuizPreflightModalComponent implements OnInit {
})); }));
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading rules'); CoreAlerts.showError(error, { default: 'Error loading rules' });
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -130,7 +129,7 @@ export class AddonModQuizPreflightModalComponent implements OnInit {
if (!hasScrolled) { if (!hasScrolled) {
// Input not found, show an error modal. // Input not found, show an error modal.
CoreDomUtils.showErrorModal('core.errorinvalidform', true); CoreAlerts.showError(Translate.instant('core.errorinvalidform'));
} }
} else { } else {
CoreForms.triggerFormSubmittedEvent(this.formElement, false, this.siteId); CoreForms.triggerFormSubmittedEvent(this.formElement, false, this.siteId);

Some files were not shown because too many files have changed in this diff Show More