Compare commits

...

15 Commits

Author SHA1 Message Date
EVOgeek 44a6d1747f Первая загрузка 2025-01-17 16:22:23 +03:00
Pau Ferrer Ocaña 7ed6583ebd
Merge pull request #4286 from dpalou/MOBILE-4705
MOBILE-4705 mod_resource: Use VideoJS if needed in embedded media
2025-01-15 12:18:22 +01:00
Dani Palou a95e65ead0 MOBILE-4705 mod_resource: Use VideoJS if needed in embedded media 2025-01-15 10:22:53 +01:00
Dani Palou 917e6fcf5c
Merge pull request #4280 from crazyserver/MOBILE-4653
MOBILE-4653 package: Update ionic and node and audit fixes
2025-01-14 15:51:14 +01:00
Pau Ferrer Ocaña 8fc5db0584 MOBILE-4653 package: Update ionic and node and audit fixes 2025-01-14 15:29:55 +01:00
Dani Palou 9ad916588b
Merge pull request #4285 from crazyserver/MOBILE-3063
MOBILE-3063 reading: Avoid collapsible heading glitch
2025-01-14 15:24:37 +01:00
Pau Ferrer Ocaña 1069e2f45c
Merge pull request #4284 from dpalou/MOBILE-4732
MOBILE-4732 cordova: Use fork of media-capture plugin
2025-01-14 15:22:50 +01:00
Pau Ferrer Ocaña 553664ce68 MOBILE-3063 reading: Avoid collapsible heading glitch 2025-01-14 14:53:43 +01:00
Dani Palou 740b1c0cbc MOBILE-4732 cordova: Use fork of media-capture plugin 2025-01-14 14:31:12 +01:00
Pau Ferrer Ocaña 070fbc5cd1
Merge pull request #4282 from dpalou/MOBILE-4724
Mobile 4724
2025-01-14 11:01:15 +01:00
Dani Palou 239ed82697 MOBILE-4724 calendar: Fix confirm not shown when leaving 2025-01-14 10:39:32 +01:00
Dani Palou c51cca9fd3 MOBILE-4724 ux: Change confirm message when leaving page 2025-01-14 10:39:32 +01:00
Dani Palou 9e006424f6 MOBILE-4724 core: Move showOperationModals to CoreLoadings 2025-01-14 09:44:13 +01:00
Dani Palou c2a500976d MOBILE-4724 core: Create CoreAlerts and CorePrompts 2025-01-14 09:44:13 +01:00
Dani Palou d8c6288a61 MOBILE-4724 core: Move some services to overlay subfolder 2025-01-14 09:11:10 +01:00
290 changed files with 96485 additions and 6026 deletions

View File

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

2
.nvmrc
View File

@ -1 +1 @@
v18.18.2
v20.18.1

View File

@ -1,8 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="50000" id="com.moodle.moodlemobile" ios-CFBundleVersion="5.0.0.0" version="5.0.0" versionCode="50000" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Moodle</name>
<description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
<widget android-packageName="com.vmeda.online" android-versionCode="50000" id="com.vmeda.online" ios-CFBundleVersion="5.0.0.0" version="5.0.0" versionCode="50000" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ВМедА Онлайн</name>
<description>ВМедА Онлайн</description>
<icon src="resources/android/icon/logo.png" />
<author email="mobile@vmeda.org" href="https://online.vmeda.org">Военная Медицинская Академия им. Кирова</author>
<content src="index.html" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
@ -62,10 +63,6 @@
<preference name="AndroidWindowSplashScreenBackground" value="#FFFFFF" />
<preference name="AndroidWindowSplashScreenIconBackgroundColor" value="#FFFFFF" />
<resource-file src="google-services.json" target="app/google-services.json" />
<resource-file src="resources/android/icon/drawable-ldpi-smallicon.png" target="app/src/main/res/mipmap-ldpi/smallicon.png" />
<resource-file src="resources/android/icon/drawable-mdpi-smallicon.png" target="app/src/main/res/mipmap-mdpi/smallicon.png" />
<resource-file src="resources/android/icon/drawable-hdpi-smallicon.png" target="app/src/main/res/mipmap-hdpi/smallicon.png" />
<resource-file src="resources/android/icon/drawable-xhdpi-smallicon.png" target="app/src/main/res/mipmap-xhdpi/smallicon.png" />
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<resource-file src="resources/android/xml/backup_rules.xml" target="app/src/main/res/xml/backup_rules.xml" />
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">

View File

@ -10,7 +10,7 @@
"client_info": {
"mobilesdk_app_id": "1:111111111111:android:1111111111111111",
"android_client_info": {
"package_name": "com.moodle.moodlemobile"
"package_name": "com.vmeda.online"
}
},
"oauth_client": [

View File

@ -1,5 +1,5 @@
{
"name": "moodlemobile",
"name": "vmedaonline",
"integrations": {
"cordova": {}
},

View File

@ -1,71 +1,16 @@
{
"app_id": "com.moodle.moodlemobile",
"appname": "Moodle Mobile",
"app_id": "com.vmeda.online",
"appname": "ВМедА Онлайн",
"versioncode": 50000,
"versionname": "5.0.0",
"cache_update_frequency_usually": 420000,
"cache_update_frequency_often": 1200000,
"cache_update_frequency_sometimes": 3600000,
"cache_update_frequency_rarely": 43200000,
"default_lang": "en",
"default_lang": "ru",
"languages": {
"af": "Afrikaans",
"ar": "العربية",
"az": "Azərbaycanca",
"bg": "Български",
"ca": "Català",
"cs": "Čeština",
"da": "Dansk",
"de": "Deutsch",
"de-du": "Deutsch (du)",
"el": "Ελληνικά",
"en": "English",
"en-us": "English (United States)",
"es": "Español - Internacional",
"es-mx": "Español - México",
"eu": "Euskara",
"fa": "فارسی",
"fi": "Suomi",
"fr": "Français",
"gl": "Galego",
"he": "עברית",
"hi": "हिंदी",
"hr": "Hrvatski",
"hsb": "Hornjoserbsce",
"hu": "magyar",
"hy": "Հայերեն",
"id": "Bahasa Indonesia",
"it": "Italiano",
"ja": "日本語",
"km": "ខ្មែរ",
"kn": "ಕನ್ನಡ",
"ko": "한국어",
"lo": "ລາວ",
"lt": "Lietuvių",
"lv": "Latviešu",
"mn": "Монгол",
"mr": "मराठी",
"nl": "Nederlands",
"no": "Norsk",
"pl": "Polski",
"ps": "لیسي",
"pt": "Português - Portugal",
"pt-br": "Português - Brasil",
"ro": "Română",
"ru": "Русский",
"sl": "Slovenščina",
"sq": "Shqip",
"sr-cr": "Српски",
"sr-lt": "Srpski",
"sv": "Svenska",
"szl": "Ślōnski",
"tg": "Тоҷикӣ",
"tr": "Türkçe",
"uk": "Українська",
"uz": "O'zbekcha",
"vi": "Vietnamese",
"zh-cn": "简体中文",
"zh-tw": "正體中文"
"ru": "Русский"
},
"wsservice": "moodle_mobile_app",
"demo_sites": {
@ -87,13 +32,15 @@
"high": 120
},
"customurlscheme": "moodlemobile",
"sites": [],
"sites": [{
"url": "https://online.vmeda.org"
}],
"multisitesdisplay": "",
"sitefindersettings": {},
"onlyallowlistedsites": false,
"forcedefaultlanguage": false,
"privacypolicy": "https://moodle.net/moodle-app-privacy/",
"notificoncolor": "#f98012",
"notificoncolor": "#007aff",
"enableanalytics": false,
"enableonboarding": true,
"forceColorScheme": "",
@ -101,7 +48,7 @@
"showTopLogo": "hidden",
"ioswebviewscheme": "moodleappfs",
"appstores": {
"android": "com.moodle.moodlemobile",
"android": "com.vmeda.online",
"ios": "id633359593"
},
"wsrequestqueuelimit": 10,

8438
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,7 @@
"@awesome-cordova-plugins/sqlite": "^6.9.0",
"@awesome-cordova-plugins/status-bar": "^6.9.0",
"@awesome-cordova-plugins/web-intent": "^6.9.0",
"@ionic/angular": "^8.3.1",
"@ionic/angular": "^8.4.1",
"@ionic/cordova-builders": "^11.0.0",
"@moodlehq/cordova-plugin-advanced-http": "3.3.1-moodle.1",
"@moodlehq/cordova-plugin-camera": "7.0.0-moodle.1",
@ -81,6 +81,7 @@
"@moodlehq/cordova-plugin-inappbrowser": "6.0.0-moodle.1",
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.5",
"@moodlehq/cordova-plugin-media-capture": "5.0.0-moodle.1",
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
"@moodlehq/cordova-plugin-statusbar": "4.0.0-moodle.3",
"@moodlehq/cordova-plugin-zip": "3.1.0-moodle.1",
@ -93,7 +94,7 @@
"@types/dom-mediacapture-record": "1.0.7",
"chart.js": "^2.9.4",
"cordova": "^12.0.0",
"cordova-android": "^13.0.0",
"cordova-android": "13.0.0",
"cordova-clipboard": "^1.3.0",
"cordova-ios": "^7.1.1",
"cordova-plugin-add-swift-support": "^2.0.2",
@ -106,7 +107,6 @@
"cordova-plugin-geolocation": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-local-notification": "1.0.0",
"cordova-plugin-media-capture": "^5.0.0",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-prevent-override": "^1.0.1",
"cordova-plugin-screen-orientation": "^3.0.4",
@ -182,12 +182,12 @@
"vinyl": "^3.0.0"
},
"engines": {
"node": ">=18.18.2 <19"
"node": ">=v20.18 <21"
},
"cordova": {
"platforms": [
"android",
"ios"
"ios",
"android"
],
"plugins": {
"@moodlehq/cordova-plugin-advanced-http": {
@ -201,6 +201,7 @@
"@moodlehq/cordova-plugin-inappbrowser": {},
"@moodlehq/cordova-plugin-intent": {},
"@moodlehq/cordova-plugin-ionic-webview": {},
"@moodlehq/cordova-plugin-media-capture": {},
"@moodlehq/cordova-plugin-qrscanner": {},
"@moodlehq/cordova-plugin-statusbar": {},
"@moodlehq/cordova-plugin-zip": {},
@ -227,7 +228,6 @@
"cordova-plugin-local-notification": {
"ANDROID_SUPPORT_V4_VERSION": "26.+"
},
"cordova-plugin-media-capture": {},
"cordova-plugin-moodleapp": {},
"cordova-plugin-network-information": {},
"cordova-plugin-prevent-override": {},

View File

@ -1,5 +1,5 @@
diff --git a/node_modules/@ionic/core/components/popover.js b/node_modules/@ionic/core/components/popover.js
index ec31d43..6be0b28 100644
index 394d7e6..1f36f24 100644
--- a/node_modules/@ionic/core/components/popover.js
+++ b/node_modules/@ionic/core/components/popover.js
@@ -763,8 +763,10 @@ const iosEnterAnimation = (baseEl, opts) => {
@ -29,7 +29,7 @@ index ec31d43..6be0b28 100644
const contentEl = root.querySelector('.popover-content');
const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
diff --git a/node_modules/@ionic/core/dist/cjs/ion-popover.cjs.entry.js b/node_modules/@ionic/core/dist/cjs/ion-popover.cjs.entry.js
index 2e169dc..ddd9daa 100644
index 004effa..84389bf 100644
--- a/node_modules/@ionic/core/dist/cjs/ion-popover.cjs.entry.js
+++ b/node_modules/@ionic/core/dist/cjs/ion-popover.cjs.entry.js
@@ -769,8 +769,10 @@ const iosEnterAnimation = (baseEl, opts) => {
@ -93,7 +93,7 @@ index 603923a..ff10a25 100644
const contentEl = root.querySelector('.popover-content');
const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
diff --git a/node_modules/@ionic/core/dist/esm/ion-popover.entry.js b/node_modules/@ionic/core/dist/esm/ion-popover.entry.js
index a88d216..bc09959 100644
index 9b06217..70b4015 100644
--- a/node_modules/@ionic/core/dist/esm/ion-popover.entry.js
+++ b/node_modules/@ionic/core/dist/esm/ion-popover.entry.js
@@ -765,8 +765,10 @@ const iosEnterAnimation = (baseEl, opts) => {
@ -123,10 +123,10 @@ index a88d216..bc09959 100644
const contentEl = root.querySelector('.popover-content');
const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
diff --git a/node_modules/@ionic/core/hydrate/index.js b/node_modules/@ionic/core/hydrate/index.js
index 06501b6..a6ee24e 100644
index c3d2d8e..bc40d4f 100644
--- a/node_modules/@ionic/core/hydrate/index.js
+++ b/node_modules/@ionic/core/hydrate/index.js
@@ -23747,8 +23747,10 @@ const iosEnterAnimation$1 = (baseEl, opts) => {
@@ -23882,8 +23882,10 @@ const iosEnterAnimation$1 = (baseEl, opts) => {
const { event: ev, size, trigger, reference, side, align } = opts;
const doc = baseEl.ownerDocument;
const isRTL = doc.dir === 'rtl';
@ -139,7 +139,7 @@ index 06501b6..a6ee24e 100644
const root = getElementRoot(baseEl);
const contentEl = root.querySelector('.popover-content');
const arrowEl = root.querySelector('.popover-arrow');
@@ -23868,8 +23870,10 @@ const mdEnterAnimation$1 = (baseEl, opts) => {
@@ -24003,8 +24005,10 @@ const mdEnterAnimation$1 = (baseEl, opts) => {
const { event: ev, size, trigger, reference, side, align } = opts;
const doc = baseEl.ownerDocument;
const isRTL = doc.dir === 'rtl';

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,10 +21,10 @@ import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { makeSingleton, Translate } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreOpener } from '@singletons/opener';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CorePrompts } from '@services/overlays/prompts';
const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:';
@ -200,34 +200,35 @@ export class AddonMessageOutputAirnotifierProvider {
}
// Warn the admin.
const dontShowAgain = await CoreDomUtils.showPrompt(
const dontShowAgain = await CorePrompts.show(
Translate.instant('addon.messageoutput_airnotifier.pushdisabledwarning'),
undefined,
Translate.instant('core.dontshowagain'),
'checkbox',
[
{
text: Translate.instant('core.ok'),
},
{
text: Translate.instant('core.goto', { $a: Translate.instant('core.settings.settings') }),
handler: (data, resolve) => {
resolve(data[0]);
const url = CorePath.concatenatePaths(
site.getURL(),
site.isVersionGreaterEqualThan('3.11') ?
'message/output/airnotifier/checkconfiguration.php' :
'admin/message.php',
);
// Don't try auto-login, admins cannot use it.
CoreOpener.openInBrowser(url, {
showBrowserWarning: false,
});
{
placeholderOrLabel: Translate.instant('core.dontshowagain'),
buttons: [
{
text: Translate.instant('core.ok'),
},
},
],
{
text: Translate.instant('core.goto', { $a: Translate.instant('core.settings.settings') }),
handler: (data, resolve) => {
resolve(data[0]);
const url = CorePath.concatenatePaths(
site.getURL(),
site.isVersionGreaterEqualThan('3.11') ?
'message/output/airnotifier/checkconfiguration.php' :
'admin/message.php',
);
// Don't try auto-login, admins cannot use it.
CoreOpener.openInBrowser(url, {
showBrowserWarning: false,
});
},
},
],
},
);
if (dontShowAgain) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@
import { Component, Input } from '@angular/core';
import { CoreCanceledError } from '@classes/errors/cancelederror';
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 { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../services/assign';
import { toBoolean } from '@/core/transforms/boolean';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,14 +14,14 @@
import { Component, Input, OnInit } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { PopoverController } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModForum, AddonModForumDiscussion } from '../../services/forum';
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 { 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.
@ -86,7 +86,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
CoreAlerts.showError(error);
PopoverController.dismiss();
} finally {
modal.dismiss();
@ -118,7 +118,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
CoreAlerts.showError(error);
PopoverController.dismiss();
} finally {
modal.dismiss();
@ -150,7 +150,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
CoreAlerts.showError(error);
PopoverController.dismiss();
} finally {
modal.dismiss();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,11 +26,12 @@ import {
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUrl } from '@singletons/url';
import { CoreUtils } from '@singletons/utils';
import { Translate } from '@singletons';
import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreAlerts } from '@services/overlays/alerts';
import { CoreLoadings } from '@services/overlays/loadings';
@Component({
selector: 'page-addon-mod-forum-search',
@ -82,7 +83,7 @@ export class AddonModForumSearchPage implements OnInit {
this.resultsSource.setFilters(filters);
this.ready.resolve();
} catch (error) {
CoreDomUtils.showErrorModal(error);
CoreAlerts.showError(error);
CoreNavigator.back();
return;
@ -103,7 +104,7 @@ export class AddonModForumSearchPage implements OnInit {
return;
}
await CoreDomUtils.showOperationModals('core.searching', true, async () => {
await CoreLoadings.showOperationModals('core.searching', true, async () => {
await this.resultsSource.reload();
await CorePromiseUtils.ignoreErrors(
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 { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreLoadings } from '@services/loadings';
import { CoreLoadings } from '@services/overlays/loadings';
import { makeSingleton } from '@singletons';
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 { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreText } from '@singletons/text';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
@ -58,7 +57,8 @@ import {
ADDON_MOD_GLOSSARY_PAGE_NAME,
GLOSSARY_AUTO_SYNCED,
} 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.
@ -339,7 +339,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
await entries.load();
} catch (error) {
this.loadMoreError = true;
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_glossary.errorloadingentries', true);
CoreAlerts.showError(error, { default: Translate.instant('addon.mod_glossary.errorloadingentries') });
} finally {
infiniteComplete && infiniteComplete();
}

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,6 @@ import { CoreNetwork } from '@services/network';
import { CoreFilepool } from '@services/filepool';
import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreWSFile } from '@services/ws';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import {
@ -54,10 +53,12 @@ import {
ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT,
} from '../../constants';
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 { NgZone, Translate } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CoreErrorHelper } from '@services/error-helper';
import { CoreAlerts } from '@services/overlays/alerts';
/**
* Component that displays an H5P activity entry page.
@ -146,7 +147,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
if (this.playing && !this.fileUrl && !this.isOnline && wasOnline && this.trackComponent) {
// User lost connection while playing an online package with tracking. Show an error.
this.offlineErrorAlert = await CoreDomUtils.showErrorModal(
this.offlineErrorAlert = await CoreAlerts.showError(
new CoreError(Translate.instant('core.course.changesofflinemaybelost'), {
title: Translate.instant('core.youreoffline'),
}),
@ -398,14 +399,14 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
}
if (!CoreNetwork.isOnline()) {
CoreDomUtils.showErrorModal('core.networkerrormsg', true);
CoreAlerts.showError(Translate.instant('core.networkerrormsg'));
return;
}
try {
// Confirm the download if needed.
await CoreDomUtils.confirmDownloadSize({ size: this.deployedFile.filesize || 0, total: true });
await CoreAlerts.confirmDownloadSize({ size: this.deployedFile.filesize || 0, total: true });
await this.downloadDeployedFile();
@ -414,7 +415,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
}
} catch (error) {
if (CoreDomUtils.isCanceledError(error) || this.isDestroyed) {
if (CoreErrorHelper.isCanceledError(error) || this.isDestroyed) {
// User cancelled or view destroyed, stop.
return;
}
@ -433,7 +434,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
return;
}
CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
}
}
@ -450,7 +451,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
this.play();
}
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
CoreAlerts.showError(error, { default: Translate.instant('core.errordownloading') });
}
}
@ -522,7 +523,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
if (!this.fileUrl && !this.isOnline) {
this.triedToPlay = true;
CoreDomUtils.showErrorModal(new CoreError(Translate.instant('core.connectandtryagain'), {
CoreAlerts.showError(new CoreError(Translate.instant('core.connectandtryagain'), {
title: Translate.instant('core.course.activitynotavailableoffline'),
}));
@ -697,7 +698,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
}
}
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
}
}
@ -757,7 +758,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
this.hasOffline = !sent;
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
}
}
@ -778,7 +779,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
},
);
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error sending tracking data.');
CoreAlerts.showError(error, { default: 'Error sending tracking data.' });
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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