diff --git a/scripts/langindex.json b/scripts/langindex.json index c999b7a30..f70a5b11c 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1104,14 +1104,19 @@ "addon.report_insights.notapplicable": "analytics", "addon.report_insights.notuseful": "analytics", "addon.report_insights.useful": "analytics", + "addon.storagemanager.alldata": "tool_wp", + "addon.storagemanager.confirmdeleteallsitedata": "local_moodlemobileapp", + "addon.storagemanager.confirmdeletecourses": "local_moodlemobileapp", + "addon.storagemanager.confirmdeletedatafrom": "local_moodlemobileapp", "addon.storagemanager.coursedownloads": "local_moodlemobileapp", "addon.storagemanager.courseinfo": "local_moodlemobileapp", - "addon.storagemanager.coursesspaceusage": "local_moodlemobileapp", - "addon.storagemanager.deletecourse": "local_moodlemobileapp", + "addon.storagemanager.deleteallsitedata": "local_moodlemobileapp", + "addon.storagemanager.deleteallsitedatainfo": "local_moodlemobileapp", "addon.storagemanager.deletecourses": "local_moodlemobileapp", "addon.storagemanager.deletedata": "local_moodlemobileapp", "addon.storagemanager.deletedatafrom": "local_moodlemobileapp", "addon.storagemanager.downloadedcourses": "local_moodlemobileapp", + "addon.storagemanager.errordeletedownloadeddata": "local_moodlemobileapp", "addon.storagemanager.managedownloads": "local_moodlemobileapp", "addon.storagemanager.totaldownloads": "local_moodlemobileapp", "addon.storagemanager.totalspaceusage": "local_moodlemobileapp", @@ -1531,8 +1536,6 @@ "core.course.completion_setby:manual:done": "course", "core.course.completion_setby:manual:markdone": "course", "core.course.completionrequirements": "course", - "core.course.confirmdeletemodulefiles": "local_moodlemobileapp", - "core.course.confirmdeletestoreddata": "local_moodlemobileapp", "core.course.confirmdownload": "local_moodlemobileapp", "core.course.confirmdownloadunknownsize": "local_moodlemobileapp", "core.course.confirmdownloadzerosize": "local_moodlemobileapp", @@ -2161,8 +2164,6 @@ "core.settings.currentlanguage": "moodle", "core.settings.debugdisplay": "admin", "core.settings.debugdisplaydescription": "local_moodlemobileapp", - "core.settings.deletesitefiles": "local_moodlemobileapp", - "core.settings.deletesitefilestitle": "local_moodlemobileapp", "core.settings.developeroptions": "local_moodlemobileapp", "core.settings.deviceinfo": "local_moodlemobileapp", "core.settings.deviceos": "local_moodlemobileapp", @@ -2178,7 +2179,6 @@ "core.settings.enablerichtexteditordescription": "local_moodlemobileapp", "core.settings.enablesyncwifi": "local_moodlemobileapp", "core.settings.entriesincache": "local_moodlemobileapp", - "core.settings.errordeletesitefiles": "local_moodlemobileapp", "core.settings.errorsyncsite": "local_moodlemobileapp", "core.settings.estimatedfreespace": "local_moodlemobileapp", "core.settings.filesystemroot": "local_moodlemobileapp", @@ -2215,7 +2215,6 @@ "core.settings.siteplugins": "local_moodlemobileapp", "core.settings.sites": "moodle", "core.settings.spaceusage": "local_moodlemobileapp", - "core.settings.spaceusagehelp": "local_moodlemobileapp", "core.settings.synchronization": "local_moodlemobileapp", "core.settings.synchronizenow": "local_moodlemobileapp", "core.settings.synchronizenowhelp": "local_moodlemobileapp", @@ -2339,8 +2338,8 @@ "core.user.webpage": "moodle", "core.userdeleted": "moodle", "core.userdetails": "moodle", - "core.usernotfullysetup": "error", "core.usernologin": "local_moodlemobileapp", + "core.usernotfullysetup": "error", "core.users": "moodle", "core.usersuspended": "tool_reportbuilder", "core.view": "moodle", diff --git a/src/addons/storagemanager/lang.json b/src/addons/storagemanager/lang.json index 1641c3b96..84988fe0d 100644 --- a/src/addons/storagemanager/lang.json +++ b/src/addons/storagemanager/lang.json @@ -1,13 +1,18 @@ { - "deletedata": "Delete offline data", - "deletecourse": "Delete offline data from this course", - "deletecourses": "Delete offline data from all courses", - "deletedatafrom": "Delete offline data from {{name}}", - "courseinfo": "Download course content to work offline. Your activity will sync automatically when your device is back online.", - "managedownloads": "Manage downloads", + "alldata": "All data", + "confirmdeleteallsitedata": "Delete all site downloaded data?", + "confirmdeletecourses": "Delete downloaded data from all courses?", + "confirmdeletedatafrom": "Delete all downloaded data from '{{name}}'?", "coursedownloads": "Course downloads", + "courseinfo": "Download course content to work offline. Your activity will sync automatically when your device is back online.", + "deleteallsitedata": "Delete all site downloaded data", + "deleteallsitedatainfo": "This will delete all downloaded data from '{{name}}', including all downloaded courses and data that allows you to work offline.", + "deletecourses": "Delete downloaded data from all courses", + "deletedata": "Delete downloaded data", + "deletedatafrom": "Delete all downloaded data from '{{name}}'", + "downloadedcourses": "Downloaded courses", + "errordeletedownloadeddata": "Error deleting downloaded data.", + "managedownloads": "Manage downloads", "totaldownloads": "Total downloads", - "totalspaceusage": "Total space usage", - "coursesspaceusage": "Courses space usage", - "downloadedcourses": "Downloaded courses" + "totalspaceusage": "Total space used" } diff --git a/src/addons/storagemanager/pages/course-storage/course-storage.html b/src/addons/storagemanager/pages/course-storage/course-storage.html index 07054abe7..bd058183d 100644 --- a/src/addons/storagemanager/pages/course-storage/course-storage.html +++ b/src/addons/storagemanager/pages/course-storage/course-storage.html @@ -20,7 +20,8 @@ {{ totalSize | coreBytesToSize }} - + diff --git a/src/addons/storagemanager/pages/course-storage/course-storage.ts b/src/addons/storagemanager/pages/course-storage/course-storage.ts index fdfef8253..3dc5ae558 100644 --- a/src/addons/storagemanager/pages/course-storage/course-storage.ts +++ b/src/addons/storagemanager/pages/course-storage/course-storage.ts @@ -282,7 +282,10 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { */ async deleteForCourse(): Promise { try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: this.title }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; @@ -312,7 +315,10 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { */ async deleteForSection(section: AddonStorageManagerCourseSection): Promise { try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: section.name }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; @@ -343,7 +349,10 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { } try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: module.name }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; @@ -363,7 +372,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { * @return Promise Once deleting has finished */ protected async deleteModules(modules: AddonStorageManagerModule[], section?: AddonStorageManagerCourseSection): Promise { - const modal = await CoreDomUtils.showModalLoading(); + const modal = await CoreDomUtils.showModalLoading('core.deleting', true); const promises: Promise[] = []; modules.forEach((module) => { diff --git a/src/addons/storagemanager/pages/courses-storage/courses-storage.html b/src/addons/storagemanager/pages/courses-storage/courses-storage.html index 00d3893a6..cbd478a0d 100644 --- a/src/addons/storagemanager/pages/courses-storage/courses-storage.html +++ b/src/addons/storagemanager/pages/courses-storage/courses-storage.html @@ -10,25 +10,30 @@ - +
+

{{ 'addon.storagemanager.alldata' | translate }}

+
- +

{{ 'addon.storagemanager.totalspaceusage' | translate }}

{{ spaceUsage.spaceUsage | coreBytesToSize }} -

- {{ 'core.settings.spaceusagehelp' | translate }} -

+ [attr.aria-label]="'addon.storagemanager.deleteallsitedata' | translate" fill="outline">
- +
+ +
+

{{ 'addon.storagemanager.downloadedcourses' | translate }}

+
+ + -

{{ 'addon.storagemanager.coursesspaceusage' | translate }}

+

{{ 'addon.storagemanager.totalspaceusage' | translate }}

{{ totalSize | coreBytesToSize }}
-
- -
-

{{ 'addon.storagemanager.downloadedcourses' | translate }}

-
- - - - - -

{{ course.title }}

-

- {{ 'core.downloading' | translate }} -

- - {{ course.totalSize | coreBytesToSize }} - -
- - - - -
-
-
+ + +

{{ course.title }}

+

+ {{ 'core.downloading' | translate }} +

+ + {{ course.totalSize | coreBytesToSize }} + +
+ + + + +
diff --git a/src/addons/storagemanager/pages/courses-storage/courses-storage.scss b/src/addons/storagemanager/pages/courses-storage/courses-storage.scss index 18d5a6e54..854bb2af6 100644 --- a/src/addons/storagemanager/pages/courses-storage/courses-storage.scss +++ b/src/addons/storagemanager/pages/courses-storage/courses-storage.scss @@ -1,10 +1,6 @@ -@import "~theme/globals"; - -:host { - ion-item.course { - .item-heading { - font-weight: bold; - } +ion-item.courses, +ion-item.total { + .item-heading { + font-weight: bold; } - } diff --git a/src/addons/storagemanager/pages/courses-storage/courses-storage.ts b/src/addons/storagemanager/pages/courses-storage/courses-storage.ts index 0697c31aa..0f2e8a215 100644 --- a/src/addons/storagemanager/pages/courses-storage/courses-storage.ts +++ b/src/addons/storagemanager/pages/courses-storage/courses-storage.ts @@ -111,7 +111,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy event.stopPropagation(); try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm('addon.storagemanager.confirmdeletecourses'); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; @@ -120,7 +120,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy return; } - const modal = await CoreDomUtils.showModalLoading(); + const modal = await CoreDomUtils.showModalLoading('core.deleting', true); const deletedCourseIds = this.completelyDownloadedCourses.map((course) => course.id); try { @@ -145,7 +145,10 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy event.stopPropagation(); try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: course.title }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; @@ -154,7 +157,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy return; } - const modal = await CoreDomUtils.showModalLoading(); + const modal = await CoreDomUtils.showModalLoading('core.deleting', true); try { await CoreCourseHelper.deleteCourseFiles(course.id); diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index b3b0f24be..4fddbfd81 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -19,8 +19,6 @@ "completion_setby:manual:done": "{{$a.activityname}} is marked by {{$a.setby}} as done. Press to undo.", "completion_setby:manual:markdone": "{{$a.activityname}} is marked by {{$a.setby}} as not done. Press to mark as done.", "completionrequirements": "Completion requirements for {{$a}}", - "confirmdeletemodulefiles": "Are you sure you want to delete these files?", - "confirmdeletestoreddata": "Are you sure you want to delete the stored data?", "confirmdownload": "You are about to download {{size}}.{{availableSpace}} Are you sure you want to continue?", "confirmdownloadunknownsize": "It was not possible to calculate the size of the download.{{availableSpace}} Are you sure you want to continue?", "confirmdownloadzerosize": "You are about to start downloading.{{availableSpace}} Are you sure you want to continue?", diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index 56dee5790..d0e16d0c2 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -499,7 +499,7 @@ export class CoreCourseHelperProvider { try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm('addon.storagemanager.confirmdeletedatafrom', { name: module.name }); modal = await CoreDomUtils.showModalLoading(); diff --git a/src/core/features/courses/components/course-list-item/course-list-item.ts b/src/core/features/courses/components/course-list-item/course-list-item.ts index 5f8043b2c..3568f83d4 100644 --- a/src/core/features/courses/components/course-list-item/course-list-item.ts +++ b/src/core/features/courses/components/course-list-item/course-list-item.ts @@ -259,7 +259,10 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On */ async deleteCourseStoredData(): Promise { try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: this.course.displayname || this.course.fullname }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; diff --git a/src/core/features/courses/components/course-progress/course-progress.ts b/src/core/features/courses/components/course-progress/course-progress.ts index 9d295b906..d719ab2dc 100644 --- a/src/core/features/courses/components/course-progress/course-progress.ts +++ b/src/core/features/courses/components/course-progress/course-progress.ts @@ -175,7 +175,10 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy, On */ async deleteCourse(): Promise { try { - await CoreDomUtils.showDeleteConfirm('core.course.confirmdeletestoreddata'); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.confirmdeletedatafrom', + { name: this.course.displayname || this.course.fullname }, + ); } catch (error) { if (!CoreDomUtils.isCanceledError(error)) { throw error; diff --git a/src/core/features/settings/lang.json b/src/core/features/settings/lang.json index a7fe5e31f..92dd83bda 100644 --- a/src/core/features/settings/lang.json +++ b/src/core/features/settings/lang.json @@ -21,8 +21,6 @@ "currentlanguage": "Current language", "debugdisplay": "Display debug messages", "debugdisplaydescription": "If enabled, error modals will display more data about the error if possible.", - "deletesitefiles": "Are you sure that you want to delete the downloaded files and cached data from the site '{{sitename}}'? You won't be able to use the app in offline mode.", - "deletesitefilestitle": "Delete site files", "developeroptions": "Developer options", "deviceinfo": "Device info", "deviceos": "Device OS", @@ -38,7 +36,6 @@ "enablerichtexteditordescription": "If enabled, a text editor will be available when entering content.", "enablesyncwifi": "Allow sync only when on Wi-Fi", "entriesincache": "{{$a}} entries in cache", - "errordeletesitefiles": "Error deleting site files.", "errorsyncsite": "Error synchronising site data. Please check your Internet connection and try again.", "estimatedfreespace": "Estimated free space", "filesystemroot": "File system root", @@ -75,7 +72,6 @@ "siteplugins": "Site plugins", "sites": "Sites", "spaceusage": "Space usage", - "spaceusagehelp": "Deleting the stored information of the site will remove all the site offline data. This information allows you to use the app when offline. ", "synchronization": "Synchronisation", "synchronizenow": "Synchronise now", "synchronizenowhelp": "Synchronising a site will send pending changes and all offline activity stored in the device and will synchronise some data like messages and notifications.", diff --git a/src/core/features/settings/pages/space-usage/space-usage.html b/src/core/features/settings/pages/space-usage/space-usage.html index 51bd07d89..57586ef86 100644 --- a/src/core/features/settings/pages/space-usage/space-usage.html +++ b/src/core/features/settings/pages/space-usage/space-usage.html @@ -8,9 +8,6 @@ - - - @@ -28,14 +25,13 @@

{{ site.fullName }}

{{ site.siteUrlWithoutProtocol }}

+ {{ site.spaceUsage | coreBytesToSize }} -

- {{ site.spaceUsage | coreBytesToSize }} -

- + [hidden]="site.spaceUsage! + site.cacheEntries! <= 0"> + + diff --git a/src/core/features/settings/pages/space-usage/space-usage.ts b/src/core/features/settings/pages/space-usage/space-usage.ts index 5f0657705..e048d0a24 100644 --- a/src/core/features/settings/pages/space-usage/space-usage.ts +++ b/src/core/features/settings/pages/space-usage/space-usage.ts @@ -16,8 +16,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { IonRefresher } from '@ionic/angular'; import { CoreSiteBasicInfo, CoreSites } from '@services/sites'; -import { CoreDomUtils } from '@services/utils/dom'; -import { Translate } from '@singletons'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreSettingsHelper, CoreSiteSpaceUsage } from '../../services/settings-helper'; @@ -129,16 +127,6 @@ export class CoreSettingsSpaceUsagePage implements OnInit, OnDestroy { } } - /** - * Show information about space usage actions. - */ - showInfo(): void { - CoreDomUtils.showAlert( - Translate.instant('core.help'), - Translate.instant('core.settings.spaceusagehelp'), - ); - } - /** * Page destroyed. */ diff --git a/src/core/features/settings/services/settings-helper.ts b/src/core/features/settings/services/settings-helper.ts index 4dfc9eb3e..d8b845583 100644 --- a/src/core/features/settings/services/settings-helper.ts +++ b/src/core/features/settings/services/settings-helper.ts @@ -116,10 +116,13 @@ export class CoreSettingsHelperProvider { siteName = await CoreFilter.formatText(siteName, { clean: true, singleLine: true, filter: false }, [], siteId); - const title = Translate.instant('core.settings.deletesitefilestitle'); - const message = Translate.instant('core.settings.deletesitefiles', { sitename: siteName }); + const title = Translate.instant('addon.storagemanager.confirmdeleteallsitedata'); - await CoreDomUtils.showConfirm(message, title, Translate.instant('core.delete')); + await CoreDomUtils.showDeleteConfirm( + 'addon.storagemanager.deleteallsitedatainfo', + { name: siteName }, + { header: title }, + ); const site = await CoreSites.getSite(siteId); @@ -143,7 +146,7 @@ export class CoreSettingsHelperProvider { siteInfo.spaceUsage = 0; } else { // Error, recalculate the site usage. - CoreDomUtils.showErrorModal('core.settings.errordeletesitefiles', true); + CoreDomUtils.showErrorModal('addon.storagemanager.errordeletedownloadeddata', true); siteInfo.spaceUsage = await site.getSpaceUsage(); } diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts index 0dbd3e638..9d2076256 100644 --- a/src/core/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -1269,15 +1269,34 @@ export class CoreDomUtilsProvider { showDeleteConfirm( translateMessage: string = 'core.areyousure', translateArgs: Record = {}, - options?: AlertOptions, + options: AlertOptions = {}, ): Promise { - return this.showConfirm( - Translate.instant(translateMessage, translateArgs), - undefined, - Translate.instant('core.delete'), - undefined, - options, - ); + return new Promise((resolve, reject): void => { + options.message = Translate.instant(translateMessage, translateArgs); + + options.buttons = [ + { + text: Translate.instant('core.cancel'), + role: 'cancel', + handler: () => { + reject(new CoreCanceledError('')); + }, + }, + { + text: Translate.instant('core.delete'), + role: 'destructive', + handler: () => { + resolve(); + }, + }, + ]; + + if (!options.header) { + options.cssClass = (options.cssClass || '') + ' core-nohead'; + } + + this.showAlertWithOptions(options, 0); + }); } /** diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index eedc3f535..9b279abeb 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -414,9 +414,10 @@ ion-alert { overflow: auto; border-radius: var(--border-radius) !important; - button.alert-button { - color: var(--primary); + button.alert-button.alert-button-role-destructive { + color: var(--danger); } + } .alert-message { diff --git a/src/theme/theme.dark.scss b/src/theme/theme.dark.scss index 9f06651c1..206f6e2d4 100644 --- a/src/theme/theme.dark.scss +++ b/src/theme/theme.dark.scss @@ -69,6 +69,7 @@ --core-header-toolbar-background: var(--gray-900); --core-header-toolbar-color: var(--white); + --core-header-toolbar-border-color: var(--stroke); --core-tabs-background: var(--gray-800); --core-tab-background: var(--core-tabs-background);