Skip to content

Commit 070fbc5

Browse files
authored
Merge pull request #4282 from dpalou/MOBILE-4724
Mobile 4724
2 parents 11753a4 + 239ed82 commit 070fbc5

File tree

264 files changed

+2068
-1842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+2068
-1842
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
cat circular-dependencies
7070
lines=$(cat circular-dependencies | wc -l)
7171
echo "Total circular dependencies: $lines"
72-
test $lines -eq 90
72+
test $lines -eq 93
7373
- name: JavaScript code compatibility
7474
run: |
7575
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Object.hasOwn"

scripts/langindex.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,9 +1561,9 @@
15611561
"core.completion-alt-manual-n-override": "completion",
15621562
"core.completion-alt-manual-y": "completion",
15631563
"core.completion-alt-manual-y-override": "completion",
1564-
"core.confirmcanceledit": "local_moodlemobileapp",
15651564
"core.confirmdeletefile": "repository",
1566-
"core.confirmleaveunknownchanges": "local_moodlemobileapp",
1565+
"core.confirmleavepagedescription": "local_moodlemobileapp",
1566+
"core.confirmleavepagetitle": "local_moodlemobileapp",
15671567
"core.confirmloss": "local_moodlemobileapp",
15681568
"core.confirmopeninbrowser": "local_moodlemobileapp",
15691569
"core.confirmremoveselectedfile": "local_moodlemobileapp",
@@ -2091,6 +2091,7 @@
20912091
"core.lastmodified": "moodle",
20922092
"core.lastsync": "local_moodlemobileapp",
20932093
"core.layoutgrid": "workshopform_rubric",
2094+
"core.leave": "local_moodlemobileapp",
20942095
"core.list": "moodle",
20952096
"core.listsep": "langconfig",
20962097
"core.loading": "moodle",

src/addons/badges/pages/badge-class/badge-class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
// limitations under the License.
1414

1515
import { Component, OnInit } from '@angular/core';
16-
import { CoreDomUtils } from '@services/utils/dom';
1716
import { CorePromiseUtils } from '@singletons/promise-utils';
1817
import { CoreNavigator } from '@services/navigator';
1918
import { ActivatedRoute } from '@angular/router';
2019
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
2120
import { CoreTime } from '@singletons/time';
2221
import { AddonBadges, AddonBadgesBadgeClass } from '../../services/badges';
22+
import { CoreAlerts } from '@services/overlays/alerts';
2323

2424
/**
2525
* Page that displays a badge class.
@@ -71,7 +71,7 @@ export class AddonBadgesBadgeClassPage implements OnInit {
7171

7272
this.logView(this.badge);
7373
} catch (message) {
74-
CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.');
74+
CoreAlerts.showError(message, { default: 'Error getting badge data.' });
7575
}
7676
}
7777

src/addons/badges/pages/issued-badge/issued-badge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import { Component, OnDestroy, OnInit } from '@angular/core';
1616
import { CoreTimeUtils } from '@services/utils/time';
17-
import { CoreDomUtils } from '@services/utils/dom';
1817
import { CoreSites } from '@services/sites';
1918
import { CoreUser } from '@features/user/services/user';
2019
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
@@ -28,6 +27,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
2827
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
2928
import { CoreTime } from '@singletons/time';
3029
import { CoreSharedModule } from '@/core/shared.module';
30+
import { CoreAlerts } from '@services/overlays/alerts';
3131

3232
/**
3333
* Page that displays an issued badge.
@@ -141,7 +141,7 @@ export class AddonBadgesIssuedBadgePage implements OnInit, OnDestroy {
141141

142142
this.logView(badge);
143143
} catch (message) {
144-
CoreDomUtils.showErrorModalDefault(message, 'Error getting badge data.');
144+
CoreAlerts.showError(message, { default: 'Error getting badge data.' });
145145
}
146146
}
147147

src/addons/badges/pages/user-badges/user-badges.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
1616
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
1717
import { CoreTimeUtils } from '@services/utils/time';
18-
import { CoreDomUtils } from '@services/utils/dom';
1918
import { CoreSites } from '@services/sites';
2019
import { CorePromiseUtils } from '@singletons/promise-utils';
2120
import { CoreSplitViewComponent } from '@components/split-view/split-view';
@@ -26,6 +25,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/
2625
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
2726
import { CoreTime } from '@singletons/time';
2827
import { Translate } from '@singletons';
28+
import { CoreAlerts } from '@services/overlays/alerts';
2929

3030
/**
3131
* Page that displays the list of calendar events.
@@ -112,7 +112,7 @@ export class AddonBadgesUserBadgesPage implements AfterViewInit, OnDestroy {
112112

113113
this.logView();
114114
} catch (message) {
115-
CoreDomUtils.showErrorModalDefault(message, 'Error loading badges');
115+
CoreAlerts.showError(message, { default: 'Error loading badges' });
116116

117117
this.badges.reset();
118118
}

src/addons/block/myoverview/components/myoverview/myoverview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { CoreCourseOptionsDelegate } from '@features/course/services/course-opti
2727
import { CoreBlockBaseComponent } from '@features/block/classes/base-block-component';
2828
import { CoreSite } from '@classes/sites/site';
2929
import { CorePromiseUtils } from '@singletons/promise-utils';
30-
import { CoreDomUtils } from '@services/utils/dom';
3130
import { CoreText } from '@singletons/text';
3231
import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursecompletion';
3332
import { IonSearchbar } from '@ionic/angular';
@@ -43,6 +42,8 @@ import {
4342
CORE_COURSES_STATE_FAVOURITE,
4443
CORE_COURSES_STATE_HIDDEN,
4544
} from '@features/courses/constants';
45+
import { CoreAlerts } from '@services/overlays/alerts';
46+
import { Translate } from '@singletons';
4647

4748
const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] =
4849
['all', 'inprogress', 'future', 'past', 'favourite', 'allincludinghidden', 'hidden', 'custom'];
@@ -504,7 +505,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
504505
await CoreCourseHelper.prefetchCourses(this.filteredCourses, this.prefetchCoursesData);
505506
} catch (error) {
506507
if (!this.isDestroyed) {
507-
CoreDomUtils.showErrorModalDefault(error, 'core.course.errordownloadingcourse', true);
508+
CoreAlerts.showError(error, { default: Translate.instant('core.course.errordownloadingcourse') });
508509
this.prefetchCoursesData.icon = initialIcon;
509510
}
510511
}
@@ -566,7 +567,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
566567
throw error; // Pass the error to the caller so it's treated there.
567568
}
568569

569-
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError);
570+
CoreAlerts.showError(error, { default: this.fetchContentDefaultError });
570571
} finally {
571572
if (!alreadyLoading) {
572573
// Only set loaded to true if there was no other data being loaded.

src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
AddonBlockRecentlyAccessedItemsItemCalculatedData,
2121
} from '../../services/recentlyaccesseditems';
2222
import { CoreText } from '@singletons/text';
23-
import { CoreLoadings } from '@services/loadings';
23+
import { CoreLoadings } from '@services/overlays/loadings';
2424
import { CoreUtils } from '@singletons/utils';
2525
import { CoreSharedModule } from '@/core/shared.module';
2626

src/addons/block/timeline/components/events/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

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

src/addons/block/timeline/components/timeline/timeline.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { CoreSites } from '@services/sites';
1717
import { ICoreBlockComponent } from '@features/block/classes/base-block-component';
1818
import { AddonBlockTimeline } from '../../services/timeline';
1919
import { CorePromiseUtils } from '@singletons/promise-utils';
20-
import { CoreDomUtils } from '@services/utils/dom';
2120
import { CoreCoursesHelper, CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
2221
import { CoreCourses } from '@features/courses/services/courses';
2322
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
@@ -30,6 +29,7 @@ import { CoreLogger } from '@singletons/logger';
3029
import { CoreSharedModule } from '@/core/shared.module';
3130
import { CoreSearchComponentsModule } from '@features/search/components/components.module';
3231
import { AddonBlockTimelineEventsComponent } from '../events/events';
32+
import { CoreAlerts } from '@services/overlays/alerts';
3333

3434
/**
3535
* Component to render a timeline block.
@@ -211,9 +211,7 @@ export class AddonBlockTimelineComponent implements OnInit, ICoreBlockComponent
211211
catchError(error => {
212212
// An error ocurred in the function, log the error and just resolve the observable so the workflow continues.
213213
this.logger.error(error);
214-
215-
// Error getting data, fail.
216-
CoreDomUtils.showErrorModalDefault(error, this.fetchContentDefaultError, true);
214+
CoreAlerts.showError(error, { default: this.fetchContentDefaultError });
217215

218216
return of([] as AddonBlockTimelineSection[]);
219217
}),

src/addons/blog/pages/edit-entry/edit-entry.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ import { CoreEditorComponentsModule } from '@features/editor/components/componen
3535
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
3636
import { CoreTagComponentsModule } from '@features/tag/components/components.module';
3737
import { CanLeave } from '@guards/can-leave';
38-
import { CoreLoadings } from '@services/loadings';
38+
import { CoreLoadings } from '@services/overlays/loadings';
3939
import { CoreNavigator } from '@services/navigator';
4040
import { CoreNetwork } from '@services/network';
4141
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
4242
import { CoreSync } from '@services/sync';
43-
import { CoreDomUtils } from '@services/utils/dom';
4443
import { CoreWSError } from '@classes/errors/wserror';
45-
import { Translate } from '@singletons';
4644
import { CoreEvents } from '@singletons/events';
4745
import { CoreForms } from '@singletons/form';
4846
import { CoreFileEntry } from '@services/file-helper';
4947
import { CoreTimeUtils } from '@services/utils/time';
5048
import { CorePromiseUtils } from '@singletons/promise-utils';
49+
import { CoreAlerts } from '@services/overlays/alerts';
5150

5251
@Component({
5352
selector: 'addon-blog-edit-entry',
@@ -164,7 +163,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
164163
this.associatedCourse = course;
165164
}
166165
} catch (error) {
167-
CoreDomUtils.showErrorModalDefault(error, 'Error getting associations, they may not be displayed correctly.');
166+
CoreAlerts.showError(error, { default: 'Error getting associations, they may not be displayed correctly.' });
168167
}
169168

170169
return;
@@ -204,7 +203,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
204203
this.associatedModule = await CoreCourse.getModule(this.modId);
205204
}
206205
} catch (error) {
207-
CoreDomUtils.showErrorModalDefault(error, 'Error retrieving data.');
206+
CoreAlerts.showError(error, { default: 'Error retrieving data.' });
208207
this.forceLeave = true;
209208
CoreNavigator.back();
210209

@@ -338,7 +337,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
338337
} catch (error) {
339338
if (CoreWSError.isWebServiceError(error)) {
340339
// It's a WebService error, the user cannot send the message so don't store it.
341-
CoreDomUtils.showErrorModalDefault(error, 'Error updating entry.');
340+
CoreAlerts.showError(error, { default: 'Error updating entry.' });
342341

343342
return;
344343
}
@@ -363,7 +362,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
363362
} catch (error) {
364363
if (CoreWSError.isWebServiceError(error)) {
365364
// It's a WebService error, the user cannot send the message so don't store it.
366-
CoreDomUtils.showErrorModalDefault(error, 'Error creating entry.');
365+
CoreAlerts.showError(error, { default: 'Error creating entry.' });
367366

368367
return;
369368
}
@@ -412,7 +411,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
412411

413412
if ((!this.entry && this.hasDataChangedForNewEntry) || (this.entry && this.hasDataChangedForEdit)) {
414413
// Modified, confirm user wants to go back.
415-
await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
414+
await CoreAlerts.confirmLeaveWithChanges();
416415
}
417416

418417
CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());

0 commit comments

Comments
 (0)