MOBILE-3814 ux: Improve storage manager strings

main
Pau Ferrer Ocaña 2022-02-11 12:23:21 +01:00
parent bb28a899bd
commit b5c0275a44
18 changed files with 129 additions and 114 deletions

View File

@ -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",

View File

@ -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"
}

View File

@ -20,7 +20,8 @@
<ion-badge color="light">{{ totalSize | coreBytesToSize }}</ion-badge>
</ion-label>
<ion-button slot="end" (click)="deleteForCourse()" [disabled]="totalSize == 0" color="danger" fill="outline">
<ion-icon name="fas-trash" slot="icon-only" [attr.aria-label]="'addon.storagemanager.deletecourse' | translate">
<ion-icon name="fas-trash" slot="icon-only" [attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate:
{ name: title }">
</ion-icon>
</ion-button>
</ion-item>

View File

@ -282,7 +282,10 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy {
*/
async deleteForCourse(): Promise<void> {
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<void> {
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<void> Once deleting has finished
*/
protected async deleteModules(modules: AddonStorageManagerModule[], section?: AddonStorageManagerCourseSection): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const promises: Promise<void>[] = [];
modules.forEach((module) => {

View File

@ -10,25 +10,30 @@
</ion-header>
<ion-content>
<core-loading [hideUntil]="loaded">
<div class="ion-padding-horizontal ion-text-wrap" *ngIf="downloadedCourses.length">
<h2>{{ 'addon.storagemanager.alldata' | translate }}</h2>
</div>
<ion-card>
<ion-item class="ion-text-wrap" *ngIf="spaceUsage">
<ion-item class="ion-text-wrap total" *ngIf="spaceUsage">
<ion-label>
<p class="item-heading ion-text-wrap">{{ 'addon.storagemanager.totalspaceusage' | translate }}</p>
<ion-badge color="light" *ngIf="spaceUsage.spaceUsage">{{ spaceUsage.spaceUsage | coreBytesToSize }}</ion-badge>
<p>
{{ 'core.settings.spaceusagehelp' | translate }}
</p>
</ion-label>
<ion-button fill="clear" color="danger" slot="end" (click)="deleteSiteStorage($event)"
[hidden]="spaceUsage.spaceUsage! + spaceUsage.cacheEntries! <= 0"
[attr.aria-label]="'core.settings.deletesitefilestitle' | translate" fill="outline">
[attr.aria-label]="'addon.storagemanager.deleteallsitedata' | translate" fill="outline">
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
</ion-item>
<ion-item class="size ion-text-wrap">
</ion-card>
<div class="ion-padding-horizontal ion-text-wrap" *ngIf="downloadedCourses.length">
<h2>{{ 'addon.storagemanager.downloadedcourses' | translate }}</h2>
</div>
<ion-card>
<ion-item class="size courses ion-text-wrap" lines="full">
<ion-label>
<h2 class="ion-text-wrap">{{ 'addon.storagemanager.coursesspaceusage' | translate }}</h2>
<p class="item-heading">{{ 'addon.storagemanager.totalspaceusage' | translate }}</p>
<ion-badge color="light">{{ totalSize | coreBytesToSize }}</ion-badge>
</ion-label>
<ion-button slot="end" (click)="deleteCompletelyDownloadedCourses($event)"
@ -37,33 +42,22 @@
</ion-icon>
</ion-button>
</ion-item>
</ion-card>
<div class="ion-padding-horizontal ion-text-wrap" *ngIf="downloadedCourses.length">
<h2>{{ 'addon.storagemanager.downloadedcourses' | translate }}</h2>
</div>
<ion-card *ngIf="downloadedCourses.length">
<ion-card-content class="ion-no-padding">
<ion-list>
<ion-item *ngFor="let course of downloadedCourses" class="course" (click)="openCourse(course.id, course.title)" button>
<ion-label class="ion-text-wrap">
<p class="item-heading">{{ course.title }}</p>
<p class="item-heading item-heading-secondary" *ngIf="course.isDownloading">
{{ 'core.downloading' | translate }}
</p>
<ion-badge color="light">
{{ course.totalSize | coreBytesToSize }}
</ion-badge>
</ion-label>
<ion-button slot="end" (click)="deleteCourse($event, course)" [disabled]="course.isDownloading" color="danger"
fill="clear">
<ion-icon name="fas-trash" slot="icon-only"
[attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate: { name: course.displayname }">
</ion-icon>
</ion-button>
</ion-item>
</ion-list>
</ion-card-content>
<ion-item *ngFor="let course of downloadedCourses" class="course" (click)="openCourse(course.id, course.title)" button>
<ion-label class="ion-text-wrap">
<p class="item-heading">{{ course.title }}</p>
<p class="item-heading item-heading-secondary" *ngIf="course.isDownloading">
{{ 'core.downloading' | translate }}
</p>
<ion-badge color="light">
{{ course.totalSize | coreBytesToSize }}
</ion-badge>
</ion-label>
<ion-button slot="end" (click)="deleteCourse($event, course)" [disabled]="course.isDownloading" color="danger" fill="clear">
<ion-icon name="fas-trash" slot="icon-only" [attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate:
{ name: course.title }">
</ion-icon>
</ion-button>
</ion-item>
</ion-card>
</core-loading>
</ion-content>

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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?",

View File

@ -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();

View File

@ -259,7 +259,10 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
*/
async deleteCourseStoredData(): Promise<void> {
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;

View File

@ -175,7 +175,10 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy, On
*/
async deleteCourse(): Promise<void> {
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;

View File

@ -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.",

View File

@ -8,9 +8,6 @@
</ion-title>
<ion-buttons slot="end">
<core-navbar-buttons>
<ion-button (click)="showInfo()" [attr.aria-label]="'core.info' | translate">
<ion-icon name="fas-info-circle" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
</core-navbar-buttons>
</ion-buttons>
</ion-toolbar>
@ -28,14 +25,13 @@
</p>
<p class="ion-text-wrap">{{ site.fullName }}</p>
<p>{{ site.siteUrlWithoutProtocol }}</p>
<ion-badge color="light" *ngIf="site.spaceUsage !== undefined">{{ site.spaceUsage | coreBytesToSize }}</ion-badge>
</ion-label>
<p *ngIf="site.spaceUsage !== undefined" slot="end">
{{ site.spaceUsage | coreBytesToSize }}
</p>
<ion-button fill="clear" color="danger" slot="end" (click)="deleteSiteStorage(site)"
[hidden]="site.spaceUsage! + site.cacheEntries! <= 0"
[attr.aria-label]="'core.settings.deletesitefilestitle' | translate">
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
[hidden]="site.spaceUsage! + site.cacheEntries! <= 0">
<ion-icon name="fas-trash" slot="icon-only"
[attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate: { name: site.siteName }">
</ion-icon>
</ion-button>
</ion-item>
<ion-item-divider>

View File

@ -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.
*/

View File

@ -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();
}

View File

@ -1269,15 +1269,34 @@ export class CoreDomUtilsProvider {
showDeleteConfirm(
translateMessage: string = 'core.areyousure',
translateArgs: Record<string, unknown> = {},
options?: AlertOptions,
options: AlertOptions = {},
): Promise<void> {
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);
});
}
/**

View File

@ -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 {

View File

@ -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);