MOBILE-3654 sync: Add component translatable string
parent
3dbe1d12d7
commit
28bf4243bc
|
@ -28,7 +28,6 @@ import { AddonCalendarOffline } from './calendar-offline';
|
|||
import { AddonCalendarHelper } from './calendar-helper';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreSync } from '@services/sync';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreNetworkError } from '@classes/errors/network-error';
|
||||
|
||||
/**
|
||||
|
@ -41,6 +40,8 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
static readonly MANUAL_SYNCED = 'addon_calendar_manual_synced';
|
||||
static readonly SYNC_ID = 'calendar';
|
||||
|
||||
protected componentTranslatableString = 'addon.calendar.calendarevent';
|
||||
|
||||
constructor() {
|
||||
super('AddonCalendarSync');
|
||||
}
|
||||
|
@ -229,12 +230,9 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
}));
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
// Event deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: Translate.instant('addon.calendar.calendarevent'),
|
||||
name: data.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, data.name, error);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -286,12 +284,9 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
result.updated = true;
|
||||
|
||||
await AddonCalendarOffline.deleteEvent(event.id!, siteId);
|
||||
|
||||
// Event deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: Translate.instant('addon.calendar.calendarevent'),
|
||||
name: event.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, event.name, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import { CoreSync } from '@services/sync';
|
|||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreNetworkError } from '@classes/errors/network-error';
|
||||
import { CoreGradesFormattedItem, CoreGradesFormattedRow, CoreGradesHelper } from '@features/grades/services/grades-helper';
|
||||
import { AddonModAssignSubmissionDelegate } from './submission-delegate';
|
||||
|
@ -51,11 +50,10 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
static readonly AUTO_SYNCED = 'addon_mod_assign_autom_synced';
|
||||
static readonly MANUAL_SYNCED = 'addon_mod_assign_manual_synced';
|
||||
|
||||
protected componentTranslate: string;
|
||||
protected componentTranslatableString = 'assign';
|
||||
|
||||
constructor() {
|
||||
super('AddonModLessonSyncProvider');
|
||||
this.componentTranslate = CoreCourse.translateModuleName('assign');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,7 +162,6 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
*/
|
||||
async syncAssign(assignId: number, siteId?: string): Promise<AddonModAssignSyncResult> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
this.componentTranslate = this.componentTranslate || CoreCourse.translateModuleName('assign');
|
||||
|
||||
if (this.isSyncing(assignId, siteId)) {
|
||||
// There's already a sync ongoing for this assign, return the promise.
|
||||
|
@ -328,7 +325,6 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
// The submission was modified in Moodle, discard the submission.
|
||||
this.addOfflineDataDeletedWarning(
|
||||
warnings,
|
||||
this.componentTranslate,
|
||||
assign.name,
|
||||
Translate.instant('addon.mod_assign.warningsubmissionmodified'),
|
||||
);
|
||||
|
@ -369,12 +365,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
}
|
||||
|
||||
// A WebService has thrown an error, this means it cannot be submitted. Discard the submission.
|
||||
this.addOfflineDataDeletedWarning(
|
||||
warnings,
|
||||
this.componentTranslate,
|
||||
assign.name,
|
||||
CoreTextUtils.getErrorMessageFromError(error) || '',
|
||||
);
|
||||
this.addOfflineDataDeletedWarning(warnings, assign.name, error);
|
||||
}
|
||||
|
||||
// Delete the offline data.
|
||||
|
@ -458,7 +449,6 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
// The submission grade was modified in Moodle, discard it.
|
||||
this.addOfflineDataDeletedWarning(
|
||||
warnings,
|
||||
this.componentTranslate,
|
||||
assign.name,
|
||||
Translate.instant('addon.mod_assign.warningsubmissiongrademodified'),
|
||||
);
|
||||
|
@ -527,12 +517,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
}
|
||||
|
||||
// A WebService has thrown an error, this means it cannot be submitted. Discard the submission.
|
||||
this.addOfflineDataDeletedWarning(
|
||||
warnings,
|
||||
this.componentTranslate,
|
||||
assign.name,
|
||||
CoreTextUtils.getErrorMessageFromError(error) || '',
|
||||
);
|
||||
this.addOfflineDataDeletedWarning(warnings, assign.name, error);
|
||||
}
|
||||
|
||||
// Delete the offline data.
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CoreSyncBaseProvider } from '@classes/base-sync';
|
||||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreCourseActivitySyncBaseProvider } from '@features/course/classes/activity-sync';
|
||||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
||||
import { CoreRatingSync } from '@features/rating/services/rating-sync';
|
||||
|
@ -23,7 +22,6 @@ import { CoreApp } from '@services/app';
|
|||
import { CoreGroups } from '@services/groups';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreSync } from '@services/sync';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreArray } from '@singletons/array';
|
||||
|
@ -55,25 +53,17 @@ declare module '@singletons/events' {
|
|||
* Service to sync forums.
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModForumSyncProvider extends CoreSyncBaseProvider<AddonModForumSyncResult> {
|
||||
export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvider<AddonModForumSyncResult> {
|
||||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_forum_autom_synced';
|
||||
static readonly MANUAL_SYNCED = 'addon_mod_forum_manual_synced';
|
||||
|
||||
private _componentTranslate?: string;
|
||||
protected componentTranslatableString = 'forum';
|
||||
|
||||
constructor() {
|
||||
super('AddonModForumSyncProvider');
|
||||
}
|
||||
|
||||
protected get componentTranslate(): string {
|
||||
if (!this._componentTranslate) {
|
||||
this._componentTranslate = CoreCourse.translateModuleName('forum');
|
||||
}
|
||||
|
||||
return this._componentTranslate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to synchronize all the forums in a certain site or in all sites.
|
||||
*
|
||||
|
@ -291,11 +281,7 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider<AddonModForu
|
|||
|
||||
if (errors.length === groupIds.length) {
|
||||
// All requests failed with WS error.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: discussion.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(errors[0]),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, discussion.name, errors[0]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -352,11 +338,7 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider<AddonModForu
|
|||
promises.push(AddonModForum.getForum(result.itemSet!.courseId!, result.itemSet!.instanceId, { siteId })
|
||||
.then((forum) => {
|
||||
result.warnings.forEach((warning) => {
|
||||
warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: forum.name,
|
||||
error: warning,
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(warnings, forum.name, warning);
|
||||
});
|
||||
|
||||
return;
|
||||
|
@ -512,11 +494,8 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider<AddonModForu
|
|||
await this.deleteReply(forumId, reply.postid, siteId, userId);
|
||||
|
||||
// Responses deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: reply.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, reply.name, error);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -16,15 +16,13 @@ import { Injectable } from '@angular/core';
|
|||
|
||||
import { CoreNetworkError } from '@classes/errors/network-error';
|
||||
import { CoreCourseActivitySyncBaseProvider } from '@features/course/classes/activity-sync';
|
||||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreXAPIOffline } from '@features/xapi/services/offline';
|
||||
import { CoreXAPI } from '@features/xapi/services/xapi';
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { AddonModH5PActivity, AddonModH5PActivityProvider } from './h5pactivity';
|
||||
|
||||
|
@ -36,25 +34,12 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP
|
|||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_h5pactivity_autom_synced';
|
||||
|
||||
protected componentTranslate?: string;
|
||||
protected componentTranslatableString = 'h5pactivity';
|
||||
|
||||
constructor() {
|
||||
super('AddonModH5PActivitySyncProvider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get component name translated.
|
||||
*
|
||||
* @return Component name translated.
|
||||
*/
|
||||
protected getComponentTranslate(): string {
|
||||
if (!this.componentTranslate) {
|
||||
this.componentTranslate = CoreCourse.translateModuleName('h5pactivity');
|
||||
}
|
||||
|
||||
return this.componentTranslate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to synchronize all the H5P activities in a certain site or in all sites.
|
||||
*
|
||||
|
@ -188,11 +173,8 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP
|
|||
await CoreXAPIOffline.deleteStatements(entry.id, siteId);
|
||||
|
||||
// Responses deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: entry.extra,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, entry.extra || '', error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
|||
import { CoreApp } from '@services/app';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreSync } from '@services/sync';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUrlUtils } from '@services/utils/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
|
@ -41,7 +40,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_lesson_autom_synced';
|
||||
|
||||
protected componentTranslate?: string;
|
||||
protected componentTranslatableString = 'lesson';
|
||||
|
||||
constructor() {
|
||||
super('AddonModLessonSyncProvider');
|
||||
|
@ -189,7 +188,6 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
siteId?: string,
|
||||
): Promise<AddonModLessonSyncResult> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
this.componentTranslate = this.componentTranslate || CoreCourse.translateModuleName('lesson');
|
||||
|
||||
let syncPromise = this.getOngoingSync(lessonId, siteId);
|
||||
if (syncPromise) {
|
||||
|
@ -317,11 +315,12 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
|
||||
if (attempts.length != attemptsLength) {
|
||||
// Some attempts won't be sent, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: lesson.name,
|
||||
error: Translate.instant('addon.mod_lesson.warningretakefinished'),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(
|
||||
result.warnings,
|
||||
lesson.name,
|
||||
Translate.instant('addon.mod_lesson.warningretakefinished'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
|
@ -386,11 +385,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
await AddonModLessonOffline.deleteAttempt(lesson.id, retake, pageId, timemodified, siteId);
|
||||
|
||||
// Attempt deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: lesson.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, lesson.name, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,11 +442,11 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
if (retake.retake != passwordData.accessInfo.attemptscount) {
|
||||
// The retake changed, add a warning if it isn't there already.
|
||||
if (!result.warnings.length) {
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: passwordData.lesson.name,
|
||||
error: Translate.instant('addon.mod_lesson.warningretakefinished'),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(
|
||||
result.warnings,
|
||||
passwordData.lesson.name,
|
||||
Translate.instant('addon.mod_lesson.warningretakefinished'),
|
||||
);
|
||||
}
|
||||
|
||||
await AddonModLessonOffline.deleteRetake(lessonId, siteId);
|
||||
|
@ -488,11 +483,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
await AddonModLessonOffline.deleteRetake(lessonId, siteId);
|
||||
|
||||
// Retake deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: passwordData.lesson.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, passwordData.lesson.name, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_quiz_autom_synced';
|
||||
|
||||
protected componentTranslate?: string;
|
||||
protected componentTranslatableString = 'quiz';
|
||||
|
||||
constructor() {
|
||||
super('AddonModQuizSyncProvider');
|
||||
|
@ -271,7 +271,6 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
// Verify that quiz isn't blocked.
|
||||
if (CoreSync.isBlocked(AddonModQuizProvider.COMPONENT, quiz.id, siteId)) {
|
||||
this.logger.debug('Cannot sync quiz ' + quiz.id + ' because it is blocked.');
|
||||
this.componentTranslate = this.componentTranslate || CoreCourse.translateModuleName('quiz');
|
||||
|
||||
throw new CoreError(Translate.instant('core.errorsyncblocked', { $a: this.componentTranslate }));
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@ import { CoreCourse } from '@features/course/services/course';
|
|||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { AddonModSurveyPrefetchHandler } from './handlers/prefetch';
|
||||
import { AddonModSurvey, AddonModSurveyProvider } from './survey';
|
||||
|
@ -35,11 +34,10 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_survey_autom_synced';
|
||||
|
||||
protected componentTranslate: string;
|
||||
protected componentTranslatableString = 'survey';
|
||||
|
||||
constructor() {
|
||||
super('AddonModSurveySyncProvider');
|
||||
this.componentTranslate = CoreCourse.translateModuleName('survey');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,11 +194,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
await AddonModSurveyOffline.deleteSurveyAnswers(surveyId, siteId, userId);
|
||||
|
||||
// Answers deleted, add a warning.
|
||||
result.warnings.push(Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: this.componentTranslate,
|
||||
name: data.name,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
}));
|
||||
this.addOfflineDataDeletedWarning(result.warnings, data.name, error);
|
||||
}
|
||||
|
||||
if (result.courseId) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import { CoreTextUtils } from '@services/utils/text';
|
|||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreLogger } from '@singletons/logger';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreAnyError, CoreError } from '@classes/errors/error';
|
||||
|
||||
/**
|
||||
* Blocked sync error.
|
||||
|
@ -41,6 +41,16 @@ export class CoreSyncBaseProvider<T = void> {
|
|||
*/
|
||||
component = 'core';
|
||||
|
||||
/**
|
||||
* Translatable component name string.
|
||||
*/
|
||||
protected componentTranslatableString = 'generic component';
|
||||
|
||||
/**
|
||||
* Translated name of the component.
|
||||
*/
|
||||
protected componentTranslateInternal?: string;
|
||||
|
||||
/**
|
||||
* Sync provider's interval.
|
||||
*/
|
||||
|
@ -58,15 +68,14 @@ export class CoreSyncBaseProvider<T = void> {
|
|||
* Add an offline data deleted warning to a list of warnings.
|
||||
*
|
||||
* @param warnings List of warnings.
|
||||
* @param component Component.
|
||||
* @param name Instance name.
|
||||
* @param error Specific error message.
|
||||
*/
|
||||
protected addOfflineDataDeletedWarning(warnings: string[], component: string, name: string, error: string): void {
|
||||
protected addOfflineDataDeletedWarning(warnings: string[], name: string, error: CoreAnyError): void {
|
||||
const warning = Translate.instant('core.warningofflinedatadeleted', {
|
||||
component: component,
|
||||
component: this.componentTranslate,
|
||||
name: name,
|
||||
error: error,
|
||||
error: CoreTextUtils.getErrorMessageFromError(error),
|
||||
});
|
||||
|
||||
if (warnings.indexOf(warning) == -1) {
|
||||
|
@ -304,4 +313,17 @@ export class CoreSyncBaseProvider<T = void> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get component name translated.
|
||||
*
|
||||
* @return Component name translated.
|
||||
*/
|
||||
protected get componentTranslate(): string {
|
||||
if (!this.componentTranslateInternal) {
|
||||
this.componentTranslateInternal = Translate.instant(this.componentTranslatableString);
|
||||
}
|
||||
|
||||
return this.componentTranslateInternal!;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { CoreTextErrorObject } from '@services/utils/text';
|
||||
|
||||
/**
|
||||
* Base Error class.
|
||||
*
|
||||
|
@ -31,3 +33,5 @@ export class CoreError extends Error {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
export type CoreAnyError = string | CoreError | CoreTextErrorObject | null | undefined;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { CoreSyncBaseProvider } from '@classes/base-sync';
|
||||
import { CoreCourseAnyModuleData } from '../services/course';
|
||||
import { CoreCourse, CoreCourseAnyModuleData } from '../services/course';
|
||||
import { CoreCourseModulePrefetchDelegate } from '../services/module-prefetch-delegate';
|
||||
import { CoreCourseModulePrefetchHandlerBase } from './module-prefetch-handler';
|
||||
|
||||
|
@ -22,6 +22,8 @@ import { CoreCourseModulePrefetchHandlerBase } from './module-prefetch-handler';
|
|||
*/
|
||||
export class CoreCourseActivitySyncBaseProvider<T = void> extends CoreSyncBaseProvider<T> {
|
||||
|
||||
protected componentTranslatableString = 'activity';
|
||||
|
||||
/**
|
||||
* Conveniece function to prefetch data after an update.
|
||||
*
|
||||
|
@ -54,4 +56,15 @@ export class CoreCourseActivitySyncBaseProvider<T = void> extends CoreSyncBasePr
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected get componentTranslate(): string {
|
||||
if (!this.componentTranslateInternal) {
|
||||
this.componentTranslateInternal = CoreCourse.translateModuleName(this.componentTranslatableString);
|
||||
}
|
||||
|
||||
return this.componentTranslateInternal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import { ModalOptions } from '@ionic/core';
|
|||
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreLang } from '@services/lang';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreAnyError, CoreError } from '@classes/errors/error';
|
||||
import { makeSingleton, ModalController, Translate } from '@singletons';
|
||||
import { CoreWSExternalFile } from '@services/ws';
|
||||
import { Locutus } from '@singletons/locutus';
|
||||
|
@ -533,7 +533,7 @@ export class CoreTextUtilsProvider {
|
|||
* @param error Error.
|
||||
* @return Error message, undefined if not found.
|
||||
*/
|
||||
getErrorMessageFromError(error?: string | CoreError | CoreTextErrorObject | null): string | undefined {
|
||||
getErrorMessageFromError(error?: CoreAnyError): string | undefined {
|
||||
if (typeof error == 'string') {
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue