MOBILE-4653 sync: Decouple Sync services from related main service
This commit is contained in:
		
							parent
							
								
									40b200d6da
								
							
						
					
					
						commit
						1eb548e47b
					
				@ -39,7 +39,7 @@ import { CoreNetworkError } from '@classes/errors/network-error';
 | 
				
			|||||||
import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
 | 
					import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
 | 
				
			||||||
import { AddonModAssignSubmissionDelegate } from './submission-delegate';
 | 
					import { AddonModAssignSubmissionDelegate } from './submission-delegate';
 | 
				
			||||||
import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
 | 
					import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
 | 
				
			||||||
import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_COMPONENT } from '../constants';
 | 
					import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_COMPONENT, ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync assigns.
 | 
					 * Service to sync assigns.
 | 
				
			||||||
@ -535,7 +535,7 @@ export type AddonModAssignSyncResult = CoreSyncResult & {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_ASSIGN_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModAssignAutoSyncData = {
 | 
					export type AddonModAssignAutoSyncData = {
 | 
				
			||||||
    assignId: number;
 | 
					    assignId: number;
 | 
				
			||||||
@ -544,9 +544,23 @@ export type AddonModAssignAutoSyncData = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to MANUAL_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_ASSIGN_MANUAL_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModAssignManualSyncData = AddonModAssignAutoSyncData & {
 | 
					export type AddonModAssignManualSyncData = AddonModAssignAutoSyncData & {
 | 
				
			||||||
    context: string;
 | 
					    context: string;
 | 
				
			||||||
    submitId?: number;
 | 
					    submitId?: number;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_ASSIGN_MANUAL_SYNCED]: AddonModAssignManualSyncData;
 | 
				
			||||||
 | 
					        [ADDON_MOD_ASSIGN_AUTO_SYNCED]: AddonModAssignAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -30,17 +30,14 @@ import { AddonModAssignSubmissionDelegate } from './submission-delegate';
 | 
				
			|||||||
import { CoreComments } from '@features/comments/services/comments';
 | 
					import { CoreComments } from '@features/comments/services/comments';
 | 
				
			||||||
import { AddonModAssignSubmissionFormatted } from './assign-helper';
 | 
					import { AddonModAssignSubmissionFormatted } from './assign-helper';
 | 
				
			||||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
					import { CoreWSError } from '@classes/errors/wserror';
 | 
				
			||||||
import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData } from './assign-sync';
 | 
					 | 
				
			||||||
import { CoreFormFields } from '@singletons/form';
 | 
					import { CoreFormFields } from '@singletons/form';
 | 
				
			||||||
import { CoreFileHelper } from '@services/file-helper';
 | 
					import { CoreFileHelper } from '@services/file-helper';
 | 
				
			||||||
import { CoreIonicColorNames } from '@singletons/colors';
 | 
					import { CoreIonicColorNames } from '@singletons/colors';
 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
 | 
					import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_ASSIGN_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_ASSIGN_COMPONENT,
 | 
					    ADDON_MOD_ASSIGN_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_ASSIGN_GRADED_EVENT,
 | 
					    ADDON_MOD_ASSIGN_GRADED_EVENT,
 | 
				
			||||||
    ADDON_MOD_ASSIGN_MANUAL_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_ASSIGN_STARTED_EVENT,
 | 
					    ADDON_MOD_ASSIGN_STARTED_EVENT,
 | 
				
			||||||
    ADDON_MOD_ASSIGN_SUBMISSION_REMOVED_EVENT,
 | 
					    ADDON_MOD_ASSIGN_SUBMISSION_REMOVED_EVENT,
 | 
				
			||||||
    ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
 | 
					    ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
 | 
				
			||||||
@ -60,8 +57,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
        [ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT]: AddonModAssignSubmittedForGradingEventData;
 | 
					        [ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT]: AddonModAssignSubmittedForGradingEventData;
 | 
				
			||||||
        [ADDON_MOD_ASSIGN_GRADED_EVENT]: AddonModAssignGradedEventData;
 | 
					        [ADDON_MOD_ASSIGN_GRADED_EVENT]: AddonModAssignGradedEventData;
 | 
				
			||||||
        [ADDON_MOD_ASSIGN_STARTED_EVENT]: AddonModAssignStartedEventData;
 | 
					        [ADDON_MOD_ASSIGN_STARTED_EVENT]: AddonModAssignStartedEventData;
 | 
				
			||||||
        [ADDON_MOD_ASSIGN_MANUAL_SYNCED]: AddonModAssignManualSyncData;
 | 
					 | 
				
			||||||
        [ADDON_MOD_ASSIGN_AUTO_SYNCED]: AddonModAssignAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -28,6 +28,19 @@ import { AddonModChoiceOffline } from './choice-offline';
 | 
				
			|||||||
import { AddonModChoicePrefetchHandler } from './handlers/prefetch';
 | 
					import { AddonModChoicePrefetchHandler } from './handlers/prefetch';
 | 
				
			||||||
import { ADDON_MOD_CHOICE_AUTO_SYNCED, ADDON_MOD_CHOICE_COMPONENT } from '../constants';
 | 
					import { ADDON_MOD_CHOICE_AUTO_SYNCED, ADDON_MOD_CHOICE_COMPONENT } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_CHOICE_AUTO_SYNCED]: AddonModChoiceAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync choices.
 | 
					 * Service to sync choices.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -220,7 +233,7 @@ export const AddonModChoiceSync = makeSingleton(AddonModChoiceSyncProvider);
 | 
				
			|||||||
export type AddonModChoiceSyncResult = CoreSyncResult;
 | 
					export type AddonModChoiceSyncResult = CoreSyncResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_CHOICE_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModChoiceAutoSyncData = {
 | 
					export type AddonModChoiceAutoSyncData = {
 | 
				
			||||||
    choiceId: number;
 | 
					    choiceId: number;
 | 
				
			||||||
 | 
				
			|||||||
@ -24,9 +24,8 @@ import { CoreUtils } from '@services/utils/utils';
 | 
				
			|||||||
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
 | 
					import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
 | 
				
			||||||
import { makeSingleton, Translate } from '@singletons';
 | 
					import { makeSingleton, Translate } from '@singletons';
 | 
				
			||||||
import { AddonModChoiceOffline } from './choice-offline';
 | 
					import { AddonModChoiceOffline } from './choice-offline';
 | 
				
			||||||
import { AddonModChoiceAutoSyncData } from './choice-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import { ADDON_MOD_CHOICE_AUTO_SYNCED, ADDON_MOD_CHOICE_COMPONENT, AddonModChoiceShowResults } from '../constants';
 | 
					import { ADDON_MOD_CHOICE_COMPONENT, AddonModChoiceShowResults } from '../constants';
 | 
				
			||||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
					import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -602,16 +601,3 @@ export type AddonModChoiceSubmitChoiceResponseWSParams = {
 | 
				
			|||||||
    choiceid: number; // Choice instance id.
 | 
					    choiceid: number; // Choice instance id.
 | 
				
			||||||
    responses: number[]; // Array of response ids.
 | 
					    responses: number[]; // Array of response ids.
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					 | 
				
			||||||
declare module '@singletons/events' {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Augment CoreEventsData interface with events specific to this service.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    export interface CoreEventsData {
 | 
					 | 
				
			||||||
        [ADDON_MOD_CHOICE_AUTO_SYNCED]: AddonModChoiceAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -486,3 +486,15 @@ export type AddonModDataAutoSyncData = {
 | 
				
			|||||||
    offlineEntryId?: number;
 | 
					    offlineEntryId?: number;
 | 
				
			||||||
    deleted?: boolean;
 | 
					    deleted?: boolean;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_DATA_AUTO_SYNCED]: AddonModDataAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -27,10 +27,8 @@ import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
 | 
				
			|||||||
import { makeSingleton, Translate } from '@singletons';
 | 
					import { makeSingleton, Translate } from '@singletons';
 | 
				
			||||||
import { AddonModDataFieldsDelegate } from './data-fields-delegate';
 | 
					import { AddonModDataFieldsDelegate } from './data-fields-delegate';
 | 
				
			||||||
import { AddonModDataOffline } from './data-offline';
 | 
					import { AddonModDataOffline } from './data-offline';
 | 
				
			||||||
import { AddonModDataAutoSyncData } from './data-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_DATA_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_DATA_COMPONENT,
 | 
					    ADDON_MOD_DATA_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_DATA_ENTRIES_PER_PAGE,
 | 
					    ADDON_MOD_DATA_ENTRIES_PER_PAGE,
 | 
				
			||||||
    ADDON_MOD_DATA_ENTRY_CHANGED,
 | 
					    ADDON_MOD_DATA_ENTRY_CHANGED,
 | 
				
			||||||
@ -46,7 +44,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_DATA_AUTO_SYNCED]: AddonModDataAutoSyncData;
 | 
					 | 
				
			||||||
        [ADDON_MOD_DATA_ENTRY_CHANGED]: AddonModDataEntryChangedEventData;
 | 
					        [ADDON_MOD_DATA_ENTRY_CHANGED]: AddonModDataEntryChangedEventData;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -35,11 +35,11 @@ import { AddonModFeedbackOffline } from '../../services/feedback-offline';
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
    AddonModFeedbackAutoSyncData,
 | 
					    AddonModFeedbackAutoSyncData,
 | 
				
			||||||
    AddonModFeedbackSync,
 | 
					    AddonModFeedbackSync,
 | 
				
			||||||
    AddonModFeedbackSyncProvider,
 | 
					 | 
				
			||||||
    AddonModFeedbackSyncResult,
 | 
					    AddonModFeedbackSyncResult,
 | 
				
			||||||
} from '../../services/feedback-sync';
 | 
					} from '../../services/feedback-sync';
 | 
				
			||||||
import { AddonModFeedbackPrefetchHandler } from '../../services/handlers/prefetch';
 | 
					import { AddonModFeedbackPrefetchHandler } from '../../services/handlers/prefetch';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
 | 
					    ADDON_MOD_FEEDBACK_AUTO_SYNCED,
 | 
				
			||||||
    ADDON_MOD_FEEDBACK_COMPONENT,
 | 
					    ADDON_MOD_FEEDBACK_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_FEEDBACK_FORM_SUBMITTED,
 | 
					    ADDON_MOD_FEEDBACK_FORM_SUBMITTED,
 | 
				
			||||||
    ADDON_MOD_FEEDBACK_PAGE_NAME,
 | 
					    ADDON_MOD_FEEDBACK_PAGE_NAME,
 | 
				
			||||||
@ -87,7 +87,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected submitObserver: CoreEventObserver;
 | 
					    protected submitObserver: CoreEventObserver;
 | 
				
			||||||
    protected syncEventName = AddonModFeedbackSyncProvider.AUTO_SYNCED;
 | 
					    protected syncEventName = ADDON_MOD_FEEDBACK_AUTO_SYNCED;
 | 
				
			||||||
    protected checkCompletionAfterLog = false;
 | 
					    protected checkCompletionAfterLog = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructor(
 | 
					    constructor(
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ export const ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP = '<<<<<';
 | 
				
			|||||||
export const ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT = 'h';
 | 
					export const ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT = 'h';
 | 
				
			||||||
export const ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP = '####';
 | 
					export const ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP = '####';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const ADDON_MOD_FEEDBACK_AUTO_SYNCED = 'addon_mod_feedback_autom_synced';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ADDON_MOD_FEEDBACK_PER_PAGE = 20;
 | 
					export const ADDON_MOD_FEEDBACK_PER_PAGE = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,7 @@ import { CoreEvents } from '@singletons/events';
 | 
				
			|||||||
import { AddonModFeedback, AddonModFeedbackWSFeedback } from './feedback';
 | 
					import { AddonModFeedback, AddonModFeedbackWSFeedback } from './feedback';
 | 
				
			||||||
import { AddonModFeedbackOffline, AddonModFeedbackOfflineResponse } from './feedback-offline';
 | 
					import { AddonModFeedbackOffline, AddonModFeedbackOfflineResponse } from './feedback-offline';
 | 
				
			||||||
import { AddonModFeedbackPrefetchHandler, AddonModFeedbackPrefetchHandlerService } from './handlers/prefetch';
 | 
					import { AddonModFeedbackPrefetchHandler, AddonModFeedbackPrefetchHandlerService } from './handlers/prefetch';
 | 
				
			||||||
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../constants';
 | 
					import { ADDON_MOD_FEEDBACK_AUTO_SYNCED, ADDON_MOD_FEEDBACK_COMPONENT } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync feedbacks.
 | 
					 * Service to sync feedbacks.
 | 
				
			||||||
@ -35,8 +35,6 @@ import { ADDON_MOD_FEEDBACK_COMPONENT } from '../constants';
 | 
				
			|||||||
@Injectable({ providedIn: 'root' })
 | 
					@Injectable({ providedIn: 'root' })
 | 
				
			||||||
export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProvider<AddonModFeedbackSyncResult> {
 | 
					export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProvider<AddonModFeedbackSyncResult> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static readonly AUTO_SYNCED = 'addon_mod_feedback_autom_synced';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    protected componentTranslatableString = 'feedback';
 | 
					    protected componentTranslatableString = 'feedback';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
@ -96,7 +94,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (result?.updated) {
 | 
					            if (result?.updated) {
 | 
				
			||||||
                // Sync successful, send event.
 | 
					                // Sync successful, send event.
 | 
				
			||||||
                CoreEvents.trigger(AddonModFeedbackSyncProvider.AUTO_SYNCED, {
 | 
					                CoreEvents.trigger(ADDON_MOD_FEEDBACK_AUTO_SYNCED, {
 | 
				
			||||||
                    feedbackId: response.feedbackid,
 | 
					                    feedbackId: response.feedbackid,
 | 
				
			||||||
                    warnings: result.warnings,
 | 
					                    warnings: result.warnings,
 | 
				
			||||||
                }, siteId);
 | 
					                }, siteId);
 | 
				
			||||||
@ -296,9 +294,22 @@ export const AddonModFeedbackSync = makeSingleton(AddonModFeedbackSyncProvider);
 | 
				
			|||||||
export type AddonModFeedbackSyncResult = CoreSyncResult;
 | 
					export type AddonModFeedbackSyncResult = CoreSyncResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_FEEDBACK_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModFeedbackAutoSyncData = {
 | 
					export type AddonModFeedbackAutoSyncData = {
 | 
				
			||||||
    feedbackId: number;
 | 
					    feedbackId: number;
 | 
				
			||||||
    warnings: string[];
 | 
					    warnings: string[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_FEEDBACK_AUTO_SYNCED]: AddonModFeedbackAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,6 @@ import { CoreUtils } from '@services/utils/utils';
 | 
				
			|||||||
import { CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@services/ws';
 | 
					import { CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@services/ws';
 | 
				
			||||||
import { makeSingleton, Translate } from '@singletons';
 | 
					import { makeSingleton, Translate } from '@singletons';
 | 
				
			||||||
import { AddonModFeedbackOffline } from './feedback-offline';
 | 
					import { AddonModFeedbackOffline } from './feedback-offline';
 | 
				
			||||||
import { AddonModFeedbackAutoSyncData, AddonModFeedbackSyncProvider } from './feedback-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_FEEDBACK_COMPONENT,
 | 
					    ADDON_MOD_FEEDBACK_COMPONENT,
 | 
				
			||||||
@ -1254,7 +1253,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_FEEDBACK_FORM_SUBMITTED]: AddonModFeedbackFormSubmittedData;
 | 
					        [ADDON_MOD_FEEDBACK_FORM_SUBMITTED]: AddonModFeedbackFormSubmittedData;
 | 
				
			||||||
        [AddonModFeedbackSyncProvider.AUTO_SYNCED]: AddonModFeedbackAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -648,7 +648,7 @@ export const AddonModForumSync = makeSingleton(AddonModForumSyncProvider);
 | 
				
			|||||||
export type AddonModForumSyncResult = CoreSyncResult;
 | 
					export type AddonModForumSyncResult = CoreSyncResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_FORUM_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModForumAutoSyncData = {
 | 
					export type AddonModForumAutoSyncData = {
 | 
				
			||||||
    forumId: number;
 | 
					    forumId: number;
 | 
				
			||||||
@ -658,7 +658,7 @@ export type AddonModForumAutoSyncData = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to MANUAL_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_FORUM_MANUAL_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModForumManualSyncData = {
 | 
					export type AddonModForumManualSyncData = {
 | 
				
			||||||
    forumId: number;
 | 
					    forumId: number;
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,6 @@ import { AddonModGlossaryOfflineEntry } from '../../services/glossary-offline';
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
    AddonModGlossaryAutoSyncedData,
 | 
					    AddonModGlossaryAutoSyncedData,
 | 
				
			||||||
    AddonModGlossarySyncResult,
 | 
					    AddonModGlossarySyncResult,
 | 
				
			||||||
    GLOSSARY_AUTO_SYNCED,
 | 
					 | 
				
			||||||
} from '../../services/glossary-sync';
 | 
					} from '../../services/glossary-sync';
 | 
				
			||||||
import { AddonModGlossaryPrefetchHandler } from '../../services/handlers/prefetch';
 | 
					import { AddonModGlossaryPrefetchHandler } from '../../services/handlers/prefetch';
 | 
				
			||||||
import { CoreTime } from '@singletons/time';
 | 
					import { CoreTime } from '@singletons/time';
 | 
				
			||||||
@ -57,6 +56,7 @@ import {
 | 
				
			|||||||
    ADDON_MOD_GLOSSARY_ENTRY_DELETED,
 | 
					    ADDON_MOD_GLOSSARY_ENTRY_DELETED,
 | 
				
			||||||
    ADDON_MOD_GLOSSARY_ENTRY_UPDATED,
 | 
					    ADDON_MOD_GLOSSARY_ENTRY_UPDATED,
 | 
				
			||||||
    ADDON_MOD_GLOSSARY_PAGE_NAME,
 | 
					    ADDON_MOD_GLOSSARY_PAGE_NAME,
 | 
				
			||||||
 | 
					    GLOSSARY_AUTO_SYNCED,
 | 
				
			||||||
} from '../../constants';
 | 
					} from '../../constants';
 | 
				
			||||||
import { CorePopovers } from '@services/popovers';
 | 
					import { CorePopovers } from '@services/popovers';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,5 +19,7 @@ export const ADDON_MOD_GLOSSARY_ENTRY_ADDED = 'addon_mod_glossary_entry_added';
 | 
				
			|||||||
export const ADDON_MOD_GLOSSARY_ENTRY_UPDATED = 'addon_mod_glossary_entry_updated';
 | 
					export const ADDON_MOD_GLOSSARY_ENTRY_UPDATED = 'addon_mod_glossary_entry_updated';
 | 
				
			||||||
export const ADDON_MOD_GLOSSARY_ENTRY_DELETED = 'addon_mod_glossary_entry_deleted';
 | 
					export const ADDON_MOD_GLOSSARY_ENTRY_DELETED = 'addon_mod_glossary_entry_deleted';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const GLOSSARY_AUTO_SYNCED = 'addon_mod_glossary_auto_synced';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ADDON_MOD_GLOSSARY_LIMIT_ENTRIES = 25;
 | 
					export const ADDON_MOD_GLOSSARY_LIMIT_ENTRIES = 25;
 | 
				
			||||||
export const ADDON_MOD_GLOSSARY_LIMIT_CATEGORIES = 10;
 | 
					export const ADDON_MOD_GLOSSARY_LIMIT_CATEGORIES = 10;
 | 
				
			||||||
 | 
				
			|||||||
@ -30,9 +30,7 @@ import { AddonModGlossaryHelper } from './glossary-helper';
 | 
				
			|||||||
import { AddonModGlossaryOffline, AddonModGlossaryOfflineEntry } from './glossary-offline';
 | 
					import { AddonModGlossaryOffline, AddonModGlossaryOfflineEntry } from './glossary-offline';
 | 
				
			||||||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
 | 
					import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
 | 
				
			||||||
import { CoreFileEntry } from '@services/file-helper';
 | 
					import { CoreFileEntry } from '@services/file-helper';
 | 
				
			||||||
import { ADDON_MOD_GLOSSARY_COMPONENT } from '../constants';
 | 
					import { ADDON_MOD_GLOSSARY_COMPONENT, GLOSSARY_AUTO_SYNCED } from '../constants';
 | 
				
			||||||
 | 
					 | 
				
			||||||
export const GLOSSARY_AUTO_SYNCED = 'addon_mod_glossary_auto_synced';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync glossaries.
 | 
					 * Service to sync glossaries.
 | 
				
			||||||
 | 
				
			|||||||
@ -401,3 +401,16 @@ export type AddonModH5PActivityAutoSyncData = {
 | 
				
			|||||||
    contextId: number;
 | 
					    contextId: number;
 | 
				
			||||||
    warnings: string[];
 | 
					    warnings: string[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_H5PACTIVITY_AUTO_SYNCED]: AddonModH5PActivityAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -25,11 +25,9 @@ import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
 | 
				
			|||||||
import { makeSingleton, Translate } from '@singletons/index';
 | 
					import { makeSingleton, Translate } from '@singletons/index';
 | 
				
			||||||
import { CoreWSError } from '@classes/errors/wserror';
 | 
					import { CoreWSError } from '@classes/errors/wserror';
 | 
				
			||||||
import { CoreError } from '@classes/errors/error';
 | 
					import { CoreError } from '@classes/errors/error';
 | 
				
			||||||
import { AddonModH5PActivityAutoSyncData } from './h5pactivity-sync';
 | 
					 | 
				
			||||||
import { CoreTime } from '@singletons/time';
 | 
					import { CoreTime } from '@singletons/time';
 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_H5PACTIVITY_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_H5PACTIVITY_COMPONENT,
 | 
					    ADDON_MOD_H5PACTIVITY_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_H5PACTIVITY_USERS_PER_PAGE,
 | 
					    ADDON_MOD_H5PACTIVITY_USERS_PER_PAGE,
 | 
				
			||||||
    AddonModH5PActivityGradeMethod,
 | 
					    AddonModH5PActivityGradeMethod,
 | 
				
			||||||
@ -1137,19 +1135,6 @@ export type AddonModH5PActivityGetAllUsersAttemptsOptions = AddonModH5PActivityG
 | 
				
			|||||||
    dontFailOnError?: boolean; // If true the function will return the users it's able to retrieve, until a call fails.
 | 
					    dontFailOnError?: boolean; // If true the function will return the users it's able to retrieve, until a call fails.
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare module '@singletons/events' {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Augment CoreEventsData interface with events specific to this service.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    export interface CoreEventsData {
 | 
					 | 
				
			||||||
        [ADDON_MOD_H5PACTIVITY_AUTO_SYNCED]: AddonModH5PActivityAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data to be sent using xAPI.
 | 
					 * Data to be sent using xAPI.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
				
			|||||||
@ -499,9 +499,22 @@ export type AddonModLessonSyncResult = CoreSyncResult & {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_LESSON_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModLessonAutoSyncData = {
 | 
					export type AddonModLessonAutoSyncData = {
 | 
				
			||||||
    lessonId: number;
 | 
					    lessonId: number;
 | 
				
			||||||
    warnings: string[];
 | 
					    warnings: string[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_LESSON_AUTO_SYNCED]: AddonModLessonAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -25,10 +25,8 @@ import { makeSingleton, Translate } from '@singletons';
 | 
				
			|||||||
import { CoreEvents } from '@singletons/events';
 | 
					import { CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { AddonModLessonPasswordDBRecord, PASSWORD_TABLE_NAME } from './database/lesson';
 | 
					import { AddonModLessonPasswordDBRecord, PASSWORD_TABLE_NAME } from './database/lesson';
 | 
				
			||||||
import { AddonModLessonOffline, AddonModLessonPageAttemptRecord } from './lesson-offline';
 | 
					import { AddonModLessonOffline, AddonModLessonPageAttemptRecord } from './lesson-offline';
 | 
				
			||||||
import { AddonModLessonAutoSyncData } from './lesson-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_LESSON_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_LESSON_COMPONENT,
 | 
					    ADDON_MOD_LESSON_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_LESSON_DATA_SENT_EVENT,
 | 
					    ADDON_MOD_LESSON_DATA_SENT_EVENT,
 | 
				
			||||||
    ADDON_MOD_LESSON_OTHER_ANSWERS,
 | 
					    ADDON_MOD_LESSON_OTHER_ANSWERS,
 | 
				
			||||||
@ -48,7 +46,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_LESSON_DATA_SENT_EVENT]: AddonModLessonDataSentData;
 | 
					        [ADDON_MOD_LESSON_DATA_SENT_EVENT]: AddonModLessonDataSentData;
 | 
				
			||||||
        [ADDON_MOD_LESSON_AUTO_SYNCED]: AddonModLessonAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -496,10 +496,23 @@ type FinishSyncOptions = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_QUIZ_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModQuizAutoSyncData = {
 | 
					export type AddonModQuizAutoSyncData = {
 | 
				
			||||||
    quizId: number;
 | 
					    quizId: number;
 | 
				
			||||||
    attemptFinished: boolean;
 | 
					    attemptFinished: boolean;
 | 
				
			||||||
    warnings: string[];
 | 
					    warnings: string[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_QUIZ_AUTO_SYNCED]: AddonModQuizAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,6 @@ import { makeSingleton, Translate } from '@singletons';
 | 
				
			|||||||
import { CoreLogger } from '@singletons/logger';
 | 
					import { CoreLogger } from '@singletons/logger';
 | 
				
			||||||
import { AddonModQuizAccessRuleDelegate } from './access-rules-delegate';
 | 
					import { AddonModQuizAccessRuleDelegate } from './access-rules-delegate';
 | 
				
			||||||
import { AddonModQuizOffline, AddonModQuizQuestionsWithAnswers } from './quiz-offline';
 | 
					import { AddonModQuizOffline, AddonModQuizQuestionsWithAnswers } from './quiz-offline';
 | 
				
			||||||
import { AddonModQuizAutoSyncData } from './quiz-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    QUESTION_INVALID_STATE_CLASSES,
 | 
					    QUESTION_INVALID_STATE_CLASSES,
 | 
				
			||||||
@ -51,7 +50,6 @@ import {
 | 
				
			|||||||
    AddonModQuizGradeMethods,
 | 
					    AddonModQuizGradeMethods,
 | 
				
			||||||
    AddonModQuizDisplayOptionsAttemptStates,
 | 
					    AddonModQuizDisplayOptionsAttemptStates,
 | 
				
			||||||
    ADDON_MOD_QUIZ_IMMEDIATELY_AFTER_PERIOD,
 | 
					    ADDON_MOD_QUIZ_IMMEDIATELY_AFTER_PERIOD,
 | 
				
			||||||
    ADDON_MOD_QUIZ_AUTO_SYNCED,
 | 
					 | 
				
			||||||
} from '../constants';
 | 
					} from '../constants';
 | 
				
			||||||
import { CoreIonicColorNames } from '@singletons/colors';
 | 
					import { CoreIonicColorNames } from '@singletons/colors';
 | 
				
			||||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
					import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
				
			||||||
@ -65,7 +63,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT]: AddonModQuizAttemptFinishedData;
 | 
					        [ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT]: AddonModQuizAttemptFinishedData;
 | 
				
			||||||
        [ADDON_MOD_QUIZ_AUTO_SYNCED]: AddonModQuizAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -850,3 +850,16 @@ export type AddonModScormAutoSyncEventData = CoreSyncResult & {
 | 
				
			|||||||
    scormId: number;
 | 
					    scormId: number;
 | 
				
			||||||
    attemptFinished: boolean;
 | 
					    attemptFinished: boolean;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_SCORM_DATA_AUTO_SYNCED]: AddonModScormAutoSyncEventData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,6 @@ import { makeSingleton, Translate } from '@singletons';
 | 
				
			|||||||
import { CoreEvents } from '@singletons/events';
 | 
					import { CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { CorePath } from '@singletons/path';
 | 
					import { CorePath } from '@singletons/path';
 | 
				
			||||||
import { AddonModScormOffline } from './scorm-offline';
 | 
					import { AddonModScormOffline } from './scorm-offline';
 | 
				
			||||||
import { AddonModScormAutoSyncEventData } from './scorm-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_SCORM_COMPONENT,
 | 
					    ADDON_MOD_SCORM_COMPONENT,
 | 
				
			||||||
@ -42,7 +41,6 @@ import {
 | 
				
			|||||||
    ADDON_MOD_SCORM_LAUNCH_NEXT_SCO_EVENT,
 | 
					    ADDON_MOD_SCORM_LAUNCH_NEXT_SCO_EVENT,
 | 
				
			||||||
    ADDON_MOD_SCORM_LAUNCH_PREV_SCO_EVENT,
 | 
					    ADDON_MOD_SCORM_LAUNCH_PREV_SCO_EVENT,
 | 
				
			||||||
    ADDON_MOD_SCORM_UPDATE_TOC_EVENT,
 | 
					    ADDON_MOD_SCORM_UPDATE_TOC_EVENT,
 | 
				
			||||||
    ADDON_MOD_SCORM_DATA_AUTO_SYNCED,
 | 
					 | 
				
			||||||
} from '../constants';
 | 
					} from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Private constants.
 | 
					// Private constants.
 | 
				
			||||||
@ -2080,7 +2078,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
        [ADDON_MOD_SCORM_UPDATE_TOC_EVENT]: AddonModScormCommonEventData;
 | 
					        [ADDON_MOD_SCORM_UPDATE_TOC_EVENT]: AddonModScormCommonEventData;
 | 
				
			||||||
        [ADDON_MOD_SCORM_GO_OFFLINE_EVENT]: AddonModScormCommonEventData;
 | 
					        [ADDON_MOD_SCORM_GO_OFFLINE_EVENT]: AddonModScormCommonEventData;
 | 
				
			||||||
        [ADDON_MOD_SCORM_DATA_SENT_EVENT]: AddonModScormCommonEventData;
 | 
					        [ADDON_MOD_SCORM_DATA_SENT_EVENT]: AddonModScormCommonEventData;
 | 
				
			||||||
        [ADDON_MOD_SCORM_DATA_AUTO_SYNCED]: AddonModScormAutoSyncEventData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -241,7 +241,7 @@ export type AddonModSurveySyncResult = CoreSyncResult & {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_SURVEY_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModSurveyAutoSyncData = {
 | 
					export type AddonModSurveyAutoSyncData = {
 | 
				
			||||||
    surveyId: number;
 | 
					    surveyId: number;
 | 
				
			||||||
 | 
				
			|||||||
@ -26,7 +26,7 @@ import { CoreEvents } from '@singletons/events';
 | 
				
			|||||||
import { AddonModWikiPageDBRecord } from './database/wiki';
 | 
					import { AddonModWikiPageDBRecord } from './database/wiki';
 | 
				
			||||||
import { AddonModWiki } from './wiki';
 | 
					import { AddonModWiki } from './wiki';
 | 
				
			||||||
import { AddonModWikiOffline } from './wiki-offline';
 | 
					import { AddonModWikiOffline } from './wiki-offline';
 | 
				
			||||||
import { ADDON_MOD_WIKI_AUTO_SYNCED, ADDON_MOD_WIKI_COMPONENT } from '../constants';
 | 
					import { ADDON_MOD_WIKI_AUTO_SYNCED, ADDON_MOD_WIKI_COMPONENT, ADDON_MOD_WIKI_MANUAL_SYNCED } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync wikis.
 | 
					 * Service to sync wikis.
 | 
				
			||||||
@ -386,7 +386,7 @@ export type AddonModWikiDiscardedPage = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_WIKI_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModWikiAutoSyncData = {
 | 
					export type AddonModWikiAutoSyncData = {
 | 
				
			||||||
    siteId: string;
 | 
					    siteId: string;
 | 
				
			||||||
@ -400,8 +400,22 @@ export type AddonModWikiAutoSyncData = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to MANUAL_SYNCED event.
 | 
					 * Data passed to ADDON_MOD_WIKI_MANUAL_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonModWikiManualSyncData = AddonModWikiSyncWikiResult & {
 | 
					export type AddonModWikiManualSyncData = AddonModWikiSyncWikiResult & {
 | 
				
			||||||
    wikiId: number;
 | 
					    wikiId: number;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_WIKI_AUTO_SYNCED]: AddonModWikiAutoSyncData;
 | 
				
			||||||
 | 
					        [ADDON_MOD_WIKI_MANUAL_SYNCED]: AddonModWikiManualSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -26,12 +26,9 @@ import { makeSingleton, Translate } from '@singletons';
 | 
				
			|||||||
import { CoreEvents } from '@singletons/events';
 | 
					import { CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { AddonModWikiPageDBRecord } from './database/wiki';
 | 
					import { AddonModWikiPageDBRecord } from './database/wiki';
 | 
				
			||||||
import { AddonModWikiOffline } from './wiki-offline';
 | 
					import { AddonModWikiOffline } from './wiki-offline';
 | 
				
			||||||
import { AddonModWikiAutoSyncData, AddonModWikiManualSyncData } from './wiki-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_WIKI_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_WIKI_COMPONENT,
 | 
					    ADDON_MOD_WIKI_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_WIKI_MANUAL_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
 | 
					    ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
 | 
				
			||||||
} from '../constants';
 | 
					} from '../constants';
 | 
				
			||||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
					import { CoreCacheUpdateFrequency } from '@/core/constants';
 | 
				
			||||||
@ -898,8 +895,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_WIKI_PAGE_CREATED_EVENT]: AddonModWikiPageCreatedData;
 | 
					        [ADDON_MOD_WIKI_PAGE_CREATED_EVENT]: AddonModWikiPageCreatedData;
 | 
				
			||||||
        [ADDON_MOD_WIKI_AUTO_SYNCED]: AddonModWikiAutoSyncData;
 | 
					 | 
				
			||||||
        [ADDON_MOD_WIKI_MANUAL_SYNCED]: AddonModWikiManualSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -640,3 +640,15 @@ export type AddonModWorkshopAutoSyncData = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type AddonModWorkshopSyncResult = CoreSyncResult;
 | 
					export type AddonModWorkshopSyncResult = CoreSyncResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [ADDON_MOD_WORKSHOP_AUTO_SYNCED]: AddonModWorkshopAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -25,11 +25,9 @@ import { CoreStatusWithWarningsWSResponse, CoreWS, CoreWSExternalFile, CoreWSExt
 | 
				
			|||||||
import { makeSingleton, Translate } from '@singletons';
 | 
					import { makeSingleton, Translate } from '@singletons';
 | 
				
			||||||
import { CoreFormFields } from '@singletons/form';
 | 
					import { CoreFormFields } from '@singletons/form';
 | 
				
			||||||
import { AddonModWorkshopOffline } from './workshop-offline';
 | 
					import { AddonModWorkshopOffline } from './workshop-offline';
 | 
				
			||||||
import { AddonModWorkshopAutoSyncData } from './workshop-sync';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED,
 | 
					    ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED,
 | 
				
			||||||
    ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED,
 | 
					    ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED,
 | 
				
			||||||
    ADDON_MOD_WORKSHOP_AUTO_SYNCED,
 | 
					 | 
				
			||||||
    ADDON_MOD_WORKSHOP_COMPONENT,
 | 
					    ADDON_MOD_WORKSHOP_COMPONENT,
 | 
				
			||||||
    ADDON_MOD_WORKSHOP_PER_PAGE,
 | 
					    ADDON_MOD_WORKSHOP_PER_PAGE,
 | 
				
			||||||
    ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED,
 | 
					    ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED,
 | 
				
			||||||
@ -51,7 +49,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [ADDON_MOD_WORKSHOP_AUTO_SYNCED]: AddonModWorkshopAutoSyncData;
 | 
					 | 
				
			||||||
        [ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED]: AddonModWorkshopSubmissionChangedEventData;
 | 
					        [ADDON_MOD_WORKSHOP_SUBMISSION_CHANGED]: AddonModWorkshopSubmissionChangedEventData;
 | 
				
			||||||
        [ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED]: AddonModWorkshopAssessmentSavedChangedEventData;
 | 
					        [ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED]: AddonModWorkshopAssessmentSavedChangedEventData;
 | 
				
			||||||
        [ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED]: AddonModWorkshopAssessmentInvalidatedChangedEventData;
 | 
					        [ADDON_MOD_WORKSHOP_ASSESSMENT_INVALIDATED]: AddonModWorkshopAssessmentInvalidatedChangedEventData;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ import { CoreConstants } from '@/core/constants';
 | 
				
			|||||||
import { AddonNotesAddModalReturn } from '@addons/notes/components/add/add-modal';
 | 
					import { AddonNotesAddModalReturn } from '@addons/notes/components/add/add-modal';
 | 
				
			||||||
import { AddonNotes, AddonNotesNoteFormatted, AddonNotesPublishState } from '@addons/notes/services/notes';
 | 
					import { AddonNotes, AddonNotesNoteFormatted, AddonNotesPublishState } from '@addons/notes/services/notes';
 | 
				
			||||||
import { AddonNotesOffline } from '@addons/notes/services/notes-offline';
 | 
					import { AddonNotesOffline } from '@addons/notes/services/notes-offline';
 | 
				
			||||||
import { AddonNotesSync, AddonNotesSyncProvider } from '@addons/notes/services/notes-sync';
 | 
					import { AddonNotesSync } from '@addons/notes/services/notes-sync';
 | 
				
			||||||
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
 | 
					import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
 | 
				
			||||||
import { CoreAnimations } from '@components/animations';
 | 
					import { CoreAnimations } from '@components/animations';
 | 
				
			||||||
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
 | 
					import { CoreUser, CoreUserProfile } from '@features/user/services/user';
 | 
				
			||||||
@ -33,6 +33,7 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
 | 
				
			|||||||
import { CoreTime } from '@singletons/time';
 | 
					import { CoreTime } from '@singletons/time';
 | 
				
			||||||
import { CoreToasts, ToastDuration } from '@services/toasts';
 | 
					import { CoreToasts, ToastDuration } from '@services/toasts';
 | 
				
			||||||
import { CoreModals } from '@services/modals';
 | 
					import { CoreModals } from '@services/modals';
 | 
				
			||||||
 | 
					import { ADDON_NOTES_AUTO_SYNCED } from '@addons/notes/services/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Page that displays a list of notes.
 | 
					 * Page that displays a list of notes.
 | 
				
			||||||
@ -77,7 +78,7 @@ export class AddonNotesListPage implements OnInit, OnDestroy {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Refresh data if notes are synchronized automatically.
 | 
					        // Refresh data if notes are synchronized automatically.
 | 
				
			||||||
        this.syncObserver = CoreEvents.on(AddonNotesSyncProvider.AUTO_SYNCED, (data) => {
 | 
					        this.syncObserver = CoreEvents.on(ADDON_NOTES_AUTO_SYNCED, (data) => {
 | 
				
			||||||
            if (data.courseId == this.courseId) {
 | 
					            if (data.courseId == this.courseId) {
 | 
				
			||||||
                // Show the sync warnings.
 | 
					                // Show the sync warnings.
 | 
				
			||||||
                this.showSyncWarnings(data.warnings);
 | 
					                this.showSyncWarnings(data.warnings);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								src/addons/notes/services/constants.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/addons/notes/services/constants.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					// (C) Copyright 2015 Moodle Pty Ltd.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//     http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const ADDON_NOTES_AUTO_SYNCED = 'addon_notes_autom_synced';
 | 
				
			||||||
@ -27,6 +27,7 @@ import { AddonNotesOffline } from './notes-offline';
 | 
				
			|||||||
import { CoreArray } from '@singletons/array';
 | 
					import { CoreArray } from '@singletons/array';
 | 
				
			||||||
import { CoreAnyError } from '@classes/errors/error';
 | 
					import { CoreAnyError } from '@classes/errors/error';
 | 
				
			||||||
import { CoreErrorHelper } from '@services/error-helper';
 | 
					import { CoreErrorHelper } from '@services/error-helper';
 | 
				
			||||||
 | 
					import { ADDON_NOTES_AUTO_SYNCED } from './constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync notes.
 | 
					 * Service to sync notes.
 | 
				
			||||||
@ -34,8 +35,6 @@ import { CoreErrorHelper } from '@services/error-helper';
 | 
				
			|||||||
@Injectable( { providedIn: 'root' } )
 | 
					@Injectable( { providedIn: 'root' } )
 | 
				
			||||||
export class AddonNotesSyncProvider extends CoreSyncBaseProvider<AddonNotesSyncResult> {
 | 
					export class AddonNotesSyncProvider extends CoreSyncBaseProvider<AddonNotesSyncResult> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static readonly AUTO_SYNCED = 'addon_notes_autom_synced';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super('AddonNotesSync');
 | 
					        super('AddonNotesSync');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -80,7 +79,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider<AddonNotesSyncR
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (result !== undefined) {
 | 
					            if (result !== undefined) {
 | 
				
			||||||
                // Sync successful, send event.
 | 
					                // Sync successful, send event.
 | 
				
			||||||
                CoreEvents.trigger(AddonNotesSyncProvider.AUTO_SYNCED, {
 | 
					                CoreEvents.trigger(ADDON_NOTES_AUTO_SYNCED, {
 | 
				
			||||||
                    courseId,
 | 
					                    courseId,
 | 
				
			||||||
                    warnings: result.warnings,
 | 
					                    warnings: result.warnings,
 | 
				
			||||||
                }, siteId);
 | 
					                }, siteId);
 | 
				
			||||||
@ -251,7 +250,7 @@ export type AddonNotesSyncResult = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to ADDON_NOTES_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type AddonNotesSyncAutoSyncData = {
 | 
					export type AddonNotesSyncAutoSyncData = {
 | 
				
			||||||
    courseId: number;
 | 
					    courseId: number;
 | 
				
			||||||
@ -266,7 +265,7 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [AddonNotesSyncProvider.AUTO_SYNCED]: AddonNotesSyncAutoSyncData;
 | 
					        [ADDON_NOTES_AUTO_SYNCED]: AddonNotesSyncAutoSyncData;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								src/core/features/comments/constants.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/core/features/comments/constants.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					// (C) Copyright 2015 Moodle Pty Ltd.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
 | 
					// you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
					// You may obtain a copy of the License at
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//     http://www.apache.org/licenses/LICENSE-2.0
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Unless required by applicable law or agreed to in writing, software
 | 
				
			||||||
 | 
					// distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
 | 
					// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
 | 
					// See the License for the specific language governing permissions and
 | 
				
			||||||
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const CORE_COMMENTS_AUTO_SYNCED = 'core_comments_autom_synced';
 | 
				
			||||||
@ -24,7 +24,6 @@ import {
 | 
				
			|||||||
} from '@features/comments/services/comments';
 | 
					} from '@features/comments/services/comments';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    CoreCommentsSync,
 | 
					    CoreCommentsSync,
 | 
				
			||||||
    CoreCommentsSyncProvider,
 | 
					 | 
				
			||||||
} from '@features/comments/services/comments-sync';
 | 
					} from '@features/comments/services/comments-sync';
 | 
				
			||||||
import { IonContent } from '@ionic/angular';
 | 
					import { IonContent } from '@ionic/angular';
 | 
				
			||||||
import { ContextLevel, CoreConstants } from '@/core/constants';
 | 
					import { ContextLevel, CoreConstants } from '@/core/constants';
 | 
				
			||||||
@ -45,6 +44,7 @@ import { CoreAnimations } from '@components/animations';
 | 
				
			|||||||
import { CoreKeyboard } from '@singletons/keyboard';
 | 
					import { CoreKeyboard } from '@singletons/keyboard';
 | 
				
			||||||
import { CoreToasts, ToastDuration } from '@services/toasts';
 | 
					import { CoreToasts, ToastDuration } from '@services/toasts';
 | 
				
			||||||
import { CoreLoadings } from '@services/loadings';
 | 
					import { CoreLoadings } from '@services/loadings';
 | 
				
			||||||
 | 
					import { CORE_COMMENTS_AUTO_SYNCED } from '@features/comments/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Page that displays comments.
 | 
					 * Page that displays comments.
 | 
				
			||||||
@ -94,7 +94,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy {
 | 
				
			|||||||
        this.currentUserId = CoreSites.getCurrentSiteUserId();
 | 
					        this.currentUserId = CoreSites.getCurrentSiteUserId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Refresh data if comments are synchronized automatically.
 | 
					        // Refresh data if comments are synchronized automatically.
 | 
				
			||||||
        this.syncObserver = CoreEvents.on(CoreCommentsSyncProvider.AUTO_SYNCED, (data) => {
 | 
					        this.syncObserver = CoreEvents.on(CORE_COMMENTS_AUTO_SYNCED, (data) => {
 | 
				
			||||||
            if (data.contextLevel == this.contextLevel && data.instanceId == this.instanceId &&
 | 
					            if (data.contextLevel == this.contextLevel && data.instanceId == this.instanceId &&
 | 
				
			||||||
                    data.componentName == this.componentName && data.itemId == this.itemId && data.area == this.area) {
 | 
					                    data.componentName == this.componentName && data.itemId == this.itemId && data.area == this.area) {
 | 
				
			||||||
                // Show the sync warnings.
 | 
					                // Show the sync warnings.
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,7 @@ import { CoreNetworkError } from '@classes/errors/network-error';
 | 
				
			|||||||
import { CoreCommentsDBRecord, CoreCommentsDeletedDBRecord } from './database/comments';
 | 
					import { CoreCommentsDBRecord, CoreCommentsDeletedDBRecord } from './database/comments';
 | 
				
			||||||
import { CoreSyncResult } from '@services/sync';
 | 
					import { CoreSyncResult } from '@services/sync';
 | 
				
			||||||
import { ContextLevel } from '@/core/constants';
 | 
					import { ContextLevel } from '@/core/constants';
 | 
				
			||||||
 | 
					import { CORE_COMMENTS_AUTO_SYNCED } from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Service to sync omments.
 | 
					 * Service to sync omments.
 | 
				
			||||||
@ -32,8 +33,6 @@ import { ContextLevel } from '@/core/constants';
 | 
				
			|||||||
@Injectable( { providedIn: 'root' })
 | 
					@Injectable( { providedIn: 'root' })
 | 
				
			||||||
export class CoreCommentsSyncProvider extends CoreSyncBaseProvider<CoreCommentsSyncResult> {
 | 
					export class CoreCommentsSyncProvider extends CoreSyncBaseProvider<CoreCommentsSyncResult> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static readonly AUTO_SYNCED = 'core_comments_autom_synced';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super('CoreCommentsSync');
 | 
					        super('CoreCommentsSync');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -96,7 +95,7 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider<CoreCommentsS
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (result !== undefined) {
 | 
					            if (result !== undefined) {
 | 
				
			||||||
                // Sync successful, send event.
 | 
					                // Sync successful, send event.
 | 
				
			||||||
                CoreEvents.trigger(CoreCommentsSyncProvider.AUTO_SYNCED, {
 | 
					                CoreEvents.trigger(CORE_COMMENTS_AUTO_SYNCED, {
 | 
				
			||||||
                    contextLevel: comment.contextlevel,
 | 
					                    contextLevel: comment.contextlevel,
 | 
				
			||||||
                    instanceId: comment.instanceid,
 | 
					                    instanceId: comment.instanceid,
 | 
				
			||||||
                    componentName: comment.component,
 | 
					                    componentName: comment.component,
 | 
				
			||||||
@ -329,7 +328,7 @@ export const CoreCommentsSync = makeSingleton(CoreCommentsSyncProvider);
 | 
				
			|||||||
export type CoreCommentsSyncResult = CoreSyncResult;
 | 
					export type CoreCommentsSyncResult = CoreSyncResult;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Data passed to AUTO_SYNCED event.
 | 
					 * Data passed to CORE_COMMENTS_AUTO_SYNCED event.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export type CoreCommentsSyncAutoSyncData = {
 | 
					export type CoreCommentsSyncAutoSyncData = {
 | 
				
			||||||
    contextLevel: ContextLevel;
 | 
					    contextLevel: ContextLevel;
 | 
				
			||||||
@ -339,3 +338,16 @@ export type CoreCommentsSyncAutoSyncData = {
 | 
				
			|||||||
    area: string;
 | 
					    area: string;
 | 
				
			||||||
    warnings: string[];
 | 
					    warnings: string[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [CORE_COMMENTS_AUTO_SYNCED]: CoreCommentsSyncAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -22,7 +22,6 @@ import { CoreWSExternalWarning } from '@services/ws';
 | 
				
			|||||||
import { makeSingleton } from '@singletons';
 | 
					import { makeSingleton } from '@singletons';
 | 
				
			||||||
import { CoreEvents } from '@singletons/events';
 | 
					import { CoreEvents } from '@singletons/events';
 | 
				
			||||||
import { CoreCommentsOffline } from './comments-offline';
 | 
					import { CoreCommentsOffline } from './comments-offline';
 | 
				
			||||||
import { CoreCommentsSyncAutoSyncData, CoreCommentsSyncProvider } from './comments-sync';
 | 
					 | 
				
			||||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
					import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
				
			||||||
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
 | 
					import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -38,7 +37,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [CoreCommentsProvider.REFRESH_COMMENTS_EVENT]: CoreCommentsRefreshCommentsEventData;
 | 
					        [CoreCommentsProvider.REFRESH_COMMENTS_EVENT]: CoreCommentsRefreshCommentsEventData;
 | 
				
			||||||
        [CoreCommentsProvider.COMMENTS_COUNT_CHANGED_EVENT]: CoreCommentsCountChangedEventData;
 | 
					        [CoreCommentsProvider.COMMENTS_COUNT_CHANGED_EVENT]: CoreCommentsCountChangedEventData;
 | 
				
			||||||
        [CoreCommentsSyncProvider.AUTO_SYNCED]: CoreCommentsSyncAutoSyncData;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,6 @@ import { CoreCourseHelper, CoreCourseModuleData, CoreCourseModuleCompletionData
 | 
				
			|||||||
import { CoreCourseFormatDelegate } from './format-delegate';
 | 
					import { CoreCourseFormatDelegate } from './format-delegate';
 | 
				
			||||||
import { CoreCronDelegate } from '@services/cron';
 | 
					import { CoreCronDelegate } from '@services/cron';
 | 
				
			||||||
import { CoreCourseLogCronHandler } from './handlers/log-cron';
 | 
					import { CoreCourseLogCronHandler } from './handlers/log-cron';
 | 
				
			||||||
import { CoreCourseAutoSyncData } from './sync';
 | 
					 | 
				
			||||||
import { CoreTagItem } from '@features/tag/services/tag';
 | 
					import { CoreTagItem } from '@features/tag/services/tag';
 | 
				
			||||||
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
 | 
					import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
 | 
				
			||||||
import { CoreCourseModuleDelegate } from './module-delegate';
 | 
					import { CoreCourseModuleDelegate } from './module-delegate';
 | 
				
			||||||
@ -74,7 +73,6 @@ import {
 | 
				
			|||||||
    CORE_COURSE_CORE_MODULES,
 | 
					    CORE_COURSE_CORE_MODULES,
 | 
				
			||||||
    CORE_COURSE_PROGRESS_UPDATED_EVENT,
 | 
					    CORE_COURSE_PROGRESS_UPDATED_EVENT,
 | 
				
			||||||
    CORE_COURSE_STEALTH_MODULES_SECTION_ID,
 | 
					    CORE_COURSE_STEALTH_MODULES_SECTION_ID,
 | 
				
			||||||
    CORE_COURSE_AUTO_SYNCED,
 | 
					 | 
				
			||||||
} from '../constants';
 | 
					} from '../constants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type CoreCourseProgressUpdated = { progress: number; courseId: number };
 | 
					export type CoreCourseProgressUpdated = { progress: number; courseId: number };
 | 
				
			||||||
@ -87,7 +85,6 @@ declare module '@singletons/events' {
 | 
				
			|||||||
     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    export interface CoreEventsData {
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
        [CORE_COURSE_AUTO_SYNCED]: CoreCourseAutoSyncData;
 | 
					 | 
				
			||||||
        [CORE_COURSE_PROGRESS_UPDATED_EVENT]: CoreCourseProgressUpdated;
 | 
					        [CORE_COURSE_PROGRESS_UPDATED_EVENT]: CoreCourseProgressUpdated;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -275,3 +275,16 @@ export type CoreCourseAutoSyncData = {
 | 
				
			|||||||
    courseId: number;
 | 
					    courseId: number;
 | 
				
			||||||
    warnings: CoreWSExternalWarning[];
 | 
					    warnings: CoreWSExternalWarning[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					declare module '@singletons/events' {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Augment CoreEventsData interface with events specific to this service.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    export interface CoreEventsData {
 | 
				
			||||||
 | 
					        [CORE_COURSE_AUTO_SYNCED]: CoreCourseAutoSyncData;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -13,3 +13,5 @@
 | 
				
			|||||||
// limitations under the License.
 | 
					// limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const PARTICIPANTS_PAGE_NAME = 'participants';
 | 
					export const PARTICIPANTS_PAGE_NAME = 'participants';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const CORE_USER_AUTO_SYNCED = 'core_user_autom_synced';
 | 
				
			||||||
 | 
				
			|||||||
@ -28,8 +28,6 @@ import { CoreUser } from './user';
 | 
				
			|||||||
@Injectable({ providedIn: 'root' })
 | 
					@Injectable({ providedIn: 'root' })
 | 
				
			||||||
export class CoreUserSyncProvider extends CoreSyncBaseProvider<string[]> {
 | 
					export class CoreUserSyncProvider extends CoreSyncBaseProvider<string[]> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static readonly AUTO_SYNCED = 'core_user_autom_synced';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        super('CoreUserSync');
 | 
					        super('CoreUserSync');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user