MOBILE-3318 core: Remove old actions from update manager
parent
6556e54d0c
commit
7a6b4802c9
|
@ -25,7 +25,6 @@ import { CoreCronDelegate } from '@providers/cron';
|
||||||
import { CoreInitDelegate } from '@providers/init';
|
import { CoreInitDelegate } from '@providers/init';
|
||||||
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreLoginHelperProvider } from '@core/login/providers/helper';
|
import { CoreLoginHelperProvider } from '@core/login/providers/helper';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate';
|
import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate';
|
||||||
import { AddonCalendarComponentsModule } from './components/components.module';
|
import { AddonCalendarComponentsModule } from './components/components.module';
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ export const ADDON_CALENDAR_PROVIDERS: any[] = [
|
||||||
export class AddonCalendarModule {
|
export class AddonCalendarModule {
|
||||||
constructor(mainMenuDelegate: CoreMainMenuDelegate, calendarHandler: AddonCalendarMainMenuHandler,
|
constructor(mainMenuDelegate: CoreMainMenuDelegate, calendarHandler: AddonCalendarMainMenuHandler,
|
||||||
initDelegate: CoreInitDelegate, calendarProvider: AddonCalendarProvider, loginHelper: CoreLoginHelperProvider,
|
initDelegate: CoreInitDelegate, calendarProvider: AddonCalendarProvider, loginHelper: CoreLoginHelperProvider,
|
||||||
localNotificationsProvider: CoreLocalNotificationsProvider, updateManager: CoreUpdateManagerProvider,
|
localNotificationsProvider: CoreLocalNotificationsProvider,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonCalendarSyncCronHandler,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonCalendarSyncCronHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, viewLinkHandler: AddonCalendarViewLinkHandler) {
|
contentLinksDelegate: CoreContentLinksDelegate, viewLinkHandler: AddonCalendarViewLinkHandler) {
|
||||||
|
|
||||||
|
@ -88,18 +87,5 @@ export class AddonCalendarModule {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Allow migrating the table from the old app to the new schema.
|
|
||||||
// In the old app some calculated properties were stored when it shouldn't. Filter only the fields we want.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'calendar_events',
|
|
||||||
newName: AddonCalendarProvider.EVENTS_TABLE,
|
|
||||||
filterFields: ['id', 'name', 'description', 'format', 'eventtype', 'courseid', 'timestart', 'timeduration',
|
|
||||||
'categoryid', 'groupid', 'userid', 'instance', 'modulename', 'timemodified', 'repeatid', 'visible', 'uuid',
|
|
||||||
'sequence', 'subscriptionid']
|
|
||||||
});
|
|
||||||
|
|
||||||
// Migrate the component name.
|
|
||||||
updateManager.registerLocalNotifComponentMigration('mmaCalendarComponent', AddonCalendarProvider.COMPONENT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import { CoreSettingsDelegate } from '@core/settings/providers/delegate';
|
||||||
import { AddonMessagesSettingsHandler } from './providers/settings-handler';
|
import { AddonMessagesSettingsHandler } from './providers/settings-handler';
|
||||||
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MESSAGES_PROVIDERS: any[] = [
|
export const ADDON_MESSAGES_PROVIDERS: any[] = [
|
||||||
|
@ -75,7 +74,7 @@ export class AddonMessagesModule {
|
||||||
userDelegate: CoreUserDelegate, cronDelegate: CoreCronDelegate, syncHandler: AddonMessagesSyncCronHandler,
|
userDelegate: CoreUserDelegate, cronDelegate: CoreCronDelegate, syncHandler: AddonMessagesSyncCronHandler,
|
||||||
network: Network, zone: NgZone, messagesSync: AddonMessagesSyncProvider, appProvider: CoreAppProvider,
|
network: Network, zone: NgZone, messagesSync: AddonMessagesSyncProvider, appProvider: CoreAppProvider,
|
||||||
localNotifications: CoreLocalNotificationsProvider, messagesProvider: AddonMessagesProvider,
|
localNotifications: CoreLocalNotificationsProvider, messagesProvider: AddonMessagesProvider,
|
||||||
sitesProvider: CoreSitesProvider, linkHelper: CoreContentLinksHelperProvider, updateManager: CoreUpdateManagerProvider,
|
sitesProvider: CoreSitesProvider, linkHelper: CoreContentLinksHelperProvider,
|
||||||
settingsHandler: AddonMessagesSettingsHandler, settingsDelegate: CoreSettingsDelegate,
|
settingsHandler: AddonMessagesSettingsHandler, settingsDelegate: CoreSettingsDelegate,
|
||||||
pushNotificationsDelegate: CorePushNotificationsDelegate, utils: CoreUtilsProvider,
|
pushNotificationsDelegate: CorePushNotificationsDelegate, utils: CoreUtilsProvider,
|
||||||
addContactHandler: AddonMessagesAddContactUserHandler, blockContactHandler: AddonMessagesBlockContactUserHandler,
|
addContactHandler: AddonMessagesAddContactUserHandler, blockContactHandler: AddonMessagesBlockContactUserHandler,
|
||||||
|
@ -136,21 +135,5 @@ export class AddonMessagesModule {
|
||||||
// Listen for clicks in simulated push notifications.
|
// Listen for clicks in simulated push notifications.
|
||||||
localNotifications.registerClick(AddonMessagesProvider.PUSH_SIMULATION_COMPONENT, notificationClicked);
|
localNotifications.registerClick(AddonMessagesProvider.PUSH_SIMULATION_COMPONENT, notificationClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow migrating the table from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_messages_offline_messages',
|
|
||||||
newName: AddonMessagesOfflineProvider.MESSAGES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'textformat',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Migrate the component name.
|
|
||||||
updateManager.registerLocalNotifComponentMigration('mmaMessagesPushSimulation',
|
|
||||||
AddonMessagesProvider.PUSH_SIMULATION_COMPONENT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import { AddonModAssignListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModAssignPushClickHandler } from './providers/push-click-handler';
|
import { AddonModAssignPushClickHandler } from './providers/push-click-handler';
|
||||||
import { AddonModAssignSubmissionModule } from './submission/submission.module';
|
import { AddonModAssignSubmissionModule } from './submission/submission.module';
|
||||||
import { AddonModAssignFeedbackModule } from './feedback/feedback.module';
|
import { AddonModAssignFeedbackModule } from './feedback/feedback.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_ASSIGN_PROVIDERS: any[] = [
|
export const ADDON_MOD_ASSIGN_PROVIDERS: any[] = [
|
||||||
|
@ -73,7 +72,7 @@ export const ADDON_MOD_ASSIGN_PROVIDERS: any[] = [
|
||||||
export class AddonModAssignModule {
|
export class AddonModAssignModule {
|
||||||
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModAssignModuleHandler,
|
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModAssignModuleHandler,
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModAssignPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModAssignPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModAssignSyncCronHandler, updateManager: CoreUpdateManagerProvider,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModAssignSyncCronHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModAssignIndexLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModAssignIndexLinkHandler,
|
||||||
listLinkHandler: AddonModAssignListLinkHandler, pushNotificationsDelegate: CorePushNotificationsDelegate,
|
listLinkHandler: AddonModAssignListLinkHandler, pushNotificationsDelegate: CorePushNotificationsDelegate,
|
||||||
pushClickHandler: AddonModAssignPushClickHandler) {
|
pushClickHandler: AddonModAssignPushClickHandler) {
|
||||||
|
@ -84,57 +83,5 @@ export class AddonModAssignModule {
|
||||||
contentLinksDelegate.registerHandler(linkHandler);
|
contentLinksDelegate.registerHandler(linkHandler);
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTablesMigration([
|
|
||||||
{
|
|
||||||
name: 'mma_mod_assign_submissions',
|
|
||||||
newName: AddonModAssignOfflineProvider.SUBMISSIONS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'assignmentid',
|
|
||||||
newName: 'assignid'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'submitted',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'submissionstatement',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'plugindata',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_assign_submissions_grading',
|
|
||||||
newName: AddonModAssignOfflineProvider.SUBMISSIONS_GRADES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'assignmentid',
|
|
||||||
newName: 'assignid'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'addattempt',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'applytoall',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'outcomes',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'plugindata',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import { AddonModChoicePrefetchHandler } from './providers/prefetch-handler';
|
||||||
import { AddonModChoiceSyncProvider } from './providers/sync';
|
import { AddonModChoiceSyncProvider } from './providers/sync';
|
||||||
import { AddonModChoiceSyncCronHandler } from './providers/sync-cron-handler';
|
import { AddonModChoiceSyncCronHandler } from './providers/sync-cron-handler';
|
||||||
import { AddonModChoiceOfflineProvider } from './providers/offline';
|
import { AddonModChoiceOfflineProvider } from './providers/offline';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_CHOICE_PROVIDERS: any[] = [
|
export const ADDON_MOD_CHOICE_PROVIDERS: any[] = [
|
||||||
|
@ -56,7 +55,7 @@ export class AddonModChoiceModule {
|
||||||
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChoiceModuleHandler,
|
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChoiceModuleHandler,
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModChoicePrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModChoicePrefetchHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChoiceLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChoiceLinkHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModChoiceSyncCronHandler, updateManager: CoreUpdateManagerProvider,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModChoiceSyncCronHandler,
|
||||||
listLinkHandler: AddonModChoiceListLinkHandler) {
|
listLinkHandler: AddonModChoiceListLinkHandler) {
|
||||||
|
|
||||||
moduleDelegate.registerHandler(moduleHandler);
|
moduleDelegate.registerHandler(moduleHandler);
|
||||||
|
@ -64,21 +63,5 @@ export class AddonModChoiceModule {
|
||||||
contentLinksDelegate.registerHandler(linkHandler);
|
contentLinksDelegate.registerHandler(linkHandler);
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_choice_offline_responses',
|
|
||||||
newName: AddonModChoiceOfflineProvider.CHOICE_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'responses',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'deleting',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import { AddonModDataDefaultFieldHandler } from './providers/default-field-handl
|
||||||
import { CoreTagAreaDelegate } from '@core/tag/providers/area-delegate';
|
import { CoreTagAreaDelegate } from '@core/tag/providers/area-delegate';
|
||||||
import { AddonModDataTagAreaHandler } from './providers/tag-area-handler';
|
import { AddonModDataTagAreaHandler } from './providers/tag-area-handler';
|
||||||
import { AddonModDataFieldModule } from './fields/field.module';
|
import { AddonModDataFieldModule } from './fields/field.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_DATA_PROVIDERS: any[] = [
|
export const ADDON_MOD_DATA_PROVIDERS: any[] = [
|
||||||
|
@ -77,7 +76,7 @@ export class AddonModDataModule {
|
||||||
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModDataModuleHandler,
|
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModDataModuleHandler,
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModDataPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModDataPrefetchHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModDataLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModDataLinkHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModDataSyncCronHandler, updateManager: CoreUpdateManagerProvider,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModDataSyncCronHandler,
|
||||||
approveLinkHandler: AddonModDataApproveLinkHandler, deleteLinkHandler: AddonModDataDeleteLinkHandler,
|
approveLinkHandler: AddonModDataApproveLinkHandler, deleteLinkHandler: AddonModDataDeleteLinkHandler,
|
||||||
showLinkHandler: AddonModDataShowLinkHandler, editLinkHandler: AddonModDataEditLinkHandler,
|
showLinkHandler: AddonModDataShowLinkHandler, editLinkHandler: AddonModDataEditLinkHandler,
|
||||||
listLinkHandler: AddonModDataListLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
listLinkHandler: AddonModDataListLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
||||||
|
@ -93,21 +92,5 @@ export class AddonModDataModule {
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_data_entry',
|
|
||||||
newName: AddonModDataOfflineProvider.DATA_ENTRY_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'fields',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'dataAndEntry',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import { AddonModFeedbackPushClickHandler } from './providers/push-click-handler
|
||||||
import { AddonModFeedbackSyncProvider } from './providers/sync';
|
import { AddonModFeedbackSyncProvider } from './providers/sync';
|
||||||
import { AddonModFeedbackSyncCronHandler } from './providers/sync-cron-handler';
|
import { AddonModFeedbackSyncCronHandler } from './providers/sync-cron-handler';
|
||||||
import { AddonModFeedbackOfflineProvider } from './providers/offline';
|
import { AddonModFeedbackOfflineProvider } from './providers/offline';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_FEEDBACK_PROVIDERS: any[] = [
|
export const ADDON_MOD_FEEDBACK_PROVIDERS: any[] = [
|
||||||
|
@ -73,7 +72,7 @@ export class AddonModFeedbackModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModFeedbackPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModFeedbackPrefetchHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModFeedbackLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModFeedbackLinkHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModFeedbackSyncCronHandler,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModFeedbackSyncCronHandler,
|
||||||
analysisLinkHandler: AddonModFeedbackAnalysisLinkHandler, updateManager: CoreUpdateManagerProvider,
|
analysisLinkHandler: AddonModFeedbackAnalysisLinkHandler,
|
||||||
showEntriesLinkHandler: AddonModFeedbackShowEntriesLinkHandler,
|
showEntriesLinkHandler: AddonModFeedbackShowEntriesLinkHandler,
|
||||||
showNonRespondentsLinkHandler: AddonModFeedbackShowNonRespondentsLinkHandler,
|
showNonRespondentsLinkHandler: AddonModFeedbackShowNonRespondentsLinkHandler,
|
||||||
completeLinkHandler: AddonModFeedbackCompleteLinkHandler,
|
completeLinkHandler: AddonModFeedbackCompleteLinkHandler,
|
||||||
|
@ -91,17 +90,5 @@ export class AddonModFeedbackModule {
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_feedback_responses',
|
|
||||||
newName: AddonModFeedbackOfflineProvider.FEEDBACK_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'responses',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import { AddonModForumPostLinkHandler } from './providers/post-link-handler';
|
||||||
import { AddonModForumPushClickHandler } from './providers/push-click-handler';
|
import { AddonModForumPushClickHandler } from './providers/push-click-handler';
|
||||||
import { AddonModForumTagAreaHandler } from './providers/tag-area-handler';
|
import { AddonModForumTagAreaHandler } from './providers/tag-area-handler';
|
||||||
import { AddonModForumComponentsModule } from './components/components.module';
|
import { AddonModForumComponentsModule } from './components/components.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_FORUM_PROVIDERS: any[] = [
|
export const ADDON_MOD_FORUM_PROVIDERS: any[] = [
|
||||||
|
@ -70,7 +69,7 @@ export class AddonModForumModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModForumPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModForumPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModForumSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModForumSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModForumIndexLinkHandler, discussionHandler: AddonModForumDiscussionLinkHandler,
|
indexHandler: AddonModForumIndexLinkHandler, discussionHandler: AddonModForumDiscussionLinkHandler,
|
||||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModForumListLinkHandler,
|
listLinkHandler: AddonModForumListLinkHandler,
|
||||||
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModForumPushClickHandler,
|
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModForumPushClickHandler,
|
||||||
postLinkHandler: AddonModForumPostLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
postLinkHandler: AddonModForumPostLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
||||||
tagAreaHandler: AddonModForumTagAreaHandler) {
|
tagAreaHandler: AddonModForumTagAreaHandler) {
|
||||||
|
@ -84,41 +83,5 @@ export class AddonModForumModule {
|
||||||
linksDelegate.registerHandler(postLinkHandler);
|
linksDelegate.registerHandler(postLinkHandler);
|
||||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTablesMigration([
|
|
||||||
{
|
|
||||||
name: 'mma_mod_forum_offline_discussions',
|
|
||||||
newName: AddonModForumOfflineProvider.DISCUSSIONS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'forumAndUser',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'options',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_forum_offline_replies',
|
|
||||||
newName: AddonModForumOfflineProvider.REPLIES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'forumAndUser',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'discussionAndUser',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'options',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import { AddonModGlossaryListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModGlossaryEditLinkHandler } from './providers/edit-link-handler';
|
import { AddonModGlossaryEditLinkHandler } from './providers/edit-link-handler';
|
||||||
import { AddonModGlossaryTagAreaHandler } from './providers/tag-area-handler';
|
import { AddonModGlossaryTagAreaHandler } from './providers/tag-area-handler';
|
||||||
import { AddonModGlossaryComponentsModule } from './components/components.module';
|
import { AddonModGlossaryComponentsModule } from './components/components.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_GLOSSARY_PROVIDERS: any[] = [
|
export const ADDON_MOD_GLOSSARY_PROVIDERS: any[] = [
|
||||||
|
@ -67,7 +66,7 @@ export class AddonModGlossaryModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModGlossaryPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModGlossaryPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModGlossarySyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModGlossarySyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModGlossaryIndexLinkHandler, discussionHandler: AddonModGlossaryEntryLinkHandler,
|
indexHandler: AddonModGlossaryIndexLinkHandler, discussionHandler: AddonModGlossaryEntryLinkHandler,
|
||||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModGlossaryListLinkHandler,
|
listLinkHandler: AddonModGlossaryListLinkHandler,
|
||||||
editLinkHandler: AddonModGlossaryEditLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
editLinkHandler: AddonModGlossaryEditLinkHandler, tagAreaDelegate: CoreTagAreaDelegate,
|
||||||
tagAreaHandler: AddonModGlossaryTagAreaHandler) {
|
tagAreaHandler: AddonModGlossaryTagAreaHandler) {
|
||||||
|
|
||||||
|
@ -79,29 +78,5 @@ export class AddonModGlossaryModule {
|
||||||
linksDelegate.registerHandler(listLinkHandler);
|
linksDelegate.registerHandler(listLinkHandler);
|
||||||
linksDelegate.registerHandler(editLinkHandler);
|
linksDelegate.registerHandler(editLinkHandler);
|
||||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_glossary_add_entry',
|
|
||||||
newName: AddonModGlossaryOfflineProvider.ENTRIES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'glossaryAndConcept',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'glossaryAndUser',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'options',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'attachments',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import { AddonModLessonGradeLinkHandler } from './providers/grade-link-handler';
|
||||||
import { AddonModLessonReportLinkHandler } from './providers/report-link-handler';
|
import { AddonModLessonReportLinkHandler } from './providers/report-link-handler';
|
||||||
import { AddonModLessonListLinkHandler } from './providers/list-link-handler';
|
import { AddonModLessonListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModLessonPushClickHandler } from './providers/push-click-handler';
|
import { AddonModLessonPushClickHandler } from './providers/push-click-handler';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_LESSON_PROVIDERS: any[] = [
|
export const ADDON_MOD_LESSON_PROVIDERS: any[] = [
|
||||||
|
@ -67,7 +66,7 @@ export class AddonModLessonModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModLessonPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModLessonPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModLessonSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModLessonSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModLessonIndexLinkHandler, gradeHandler: AddonModLessonGradeLinkHandler,
|
indexHandler: AddonModLessonIndexLinkHandler, gradeHandler: AddonModLessonGradeLinkHandler,
|
||||||
reportHandler: AddonModLessonReportLinkHandler, updateManager: CoreUpdateManagerProvider,
|
reportHandler: AddonModLessonReportLinkHandler,
|
||||||
listLinkHandler: AddonModLessonListLinkHandler, pushNotificationsDelegate: CorePushNotificationsDelegate,
|
listLinkHandler: AddonModLessonListLinkHandler, pushNotificationsDelegate: CorePushNotificationsDelegate,
|
||||||
pushClickHandler: AddonModLessonPushClickHandler) {
|
pushClickHandler: AddonModLessonPushClickHandler) {
|
||||||
|
|
||||||
|
@ -79,71 +78,5 @@ export class AddonModLessonModule {
|
||||||
linksDelegate.registerHandler(reportHandler);
|
linksDelegate.registerHandler(reportHandler);
|
||||||
linksDelegate.registerHandler(listLinkHandler);
|
linksDelegate.registerHandler(listLinkHandler);
|
||||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTablesMigration([
|
|
||||||
{
|
|
||||||
name: 'mma_mod_lesson_password',
|
|
||||||
newName: AddonModLessonProvider.PASSWORD_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'id',
|
|
||||||
newName: 'lessonid'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_lesson_retakes',
|
|
||||||
newName: AddonModLessonOfflineProvider.RETAKES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'finished',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'outoftime',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_lesson_page_attempts',
|
|
||||||
newName: AddonModLessonOfflineProvider.PAGE_ATTEMPTS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'lessonAndPage',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'lessonAndRetake',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'lessonAndRetakeAndType',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'lessonAndRetakeAndPage',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'data',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'correct',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'userAnswer',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_lesson_retakes_finished_sync',
|
|
||||||
newName: AddonModLessonSyncProvider.RETAKES_FINISHED_TABLE
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { CoreComponentsModule } from '@components/components.module';
|
||||||
import { AddonModQuizAccessPasswordHandler } from './providers/handler';
|
import { AddonModQuizAccessPasswordHandler } from './providers/handler';
|
||||||
import { AddonModQuizAccessPasswordComponent } from './component/password';
|
import { AddonModQuizAccessPasswordComponent } from './component/password';
|
||||||
import { AddonModQuizAccessRuleDelegate } from '../../providers/access-rules-delegate';
|
import { AddonModQuizAccessRuleDelegate } from '../../providers/access-rules-delegate';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -43,14 +42,7 @@ import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AddonModQuizAccessPasswordModule {
|
export class AddonModQuizAccessPasswordModule {
|
||||||
constructor(accessRuleDelegate: AddonModQuizAccessRuleDelegate, handler: AddonModQuizAccessPasswordHandler,
|
constructor(accessRuleDelegate: AddonModQuizAccessRuleDelegate, handler: AddonModQuizAccessPasswordHandler) {
|
||||||
updateManager: CoreUpdateManagerProvider) {
|
|
||||||
accessRuleDelegate.registerHandler(handler);
|
accessRuleDelegate.registerHandler(handler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mod_quiz_access_password',
|
|
||||||
newName: AddonModQuizAccessPasswordHandler.PASSWORD_TABLE
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import { AddonModQuizReviewLinkHandler } from './providers/review-link-handler';
|
||||||
import { AddonModQuizListLinkHandler } from './providers/list-link-handler';
|
import { AddonModQuizListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModQuizPushClickHandler } from './providers/push-click-handler';
|
import { AddonModQuizPushClickHandler } from './providers/push-click-handler';
|
||||||
import { AddonModQuizComponentsModule } from './components/components.module';
|
import { AddonModQuizComponentsModule } from './components/components.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// Access rules.
|
// Access rules.
|
||||||
import { AddonModQuizAccessDelayBetweenAttemptsModule } from './accessrules/delaybetweenattempts/delaybetweenattempts.module';
|
import { AddonModQuizAccessDelayBetweenAttemptsModule } from './accessrules/delaybetweenattempts/delaybetweenattempts.module';
|
||||||
|
@ -90,7 +89,7 @@ export class AddonModQuizModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModQuizPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModQuizPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModQuizSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModQuizSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModQuizIndexLinkHandler, gradeHandler: AddonModQuizGradeLinkHandler,
|
indexHandler: AddonModQuizIndexLinkHandler, gradeHandler: AddonModQuizGradeLinkHandler,
|
||||||
reviewHandler: AddonModQuizReviewLinkHandler, updateManager: CoreUpdateManagerProvider,
|
reviewHandler: AddonModQuizReviewLinkHandler,
|
||||||
listLinkHandler: AddonModQuizListLinkHandler,
|
listLinkHandler: AddonModQuizListLinkHandler,
|
||||||
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModQuizPushClickHandler) {
|
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModQuizPushClickHandler) {
|
||||||
|
|
||||||
|
@ -102,21 +101,5 @@ export class AddonModQuizModule {
|
||||||
linksDelegate.registerHandler(reviewHandler);
|
linksDelegate.registerHandler(reviewHandler);
|
||||||
linksDelegate.registerHandler(listLinkHandler);
|
linksDelegate.registerHandler(listLinkHandler);
|
||||||
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mod_quiz_attempts',
|
|
||||||
newName: AddonModQuizOfflineProvider.ATTEMPTS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'quizAndUser',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'finished',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import { AddonModScormGradeLinkHandler } from './providers/grade-link-handler';
|
||||||
import { AddonModScormListLinkHandler } from './providers/list-link-handler';
|
import { AddonModScormListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModScormSyncProvider } from './providers/scorm-sync';
|
import { AddonModScormSyncProvider } from './providers/scorm-sync';
|
||||||
import { AddonModScormComponentsModule } from './components/components.module';
|
import { AddonModScormComponentsModule } from './components/components.module';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_SCORM_PROVIDERS: any[] = [
|
export const ADDON_MOD_SCORM_PROVIDERS: any[] = [
|
||||||
|
@ -62,7 +61,7 @@ export class AddonModScormModule {
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModScormPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModScormPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModScormSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModScormSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModScormIndexLinkHandler, gradeHandler: AddonModScormGradeLinkHandler,
|
indexHandler: AddonModScormIndexLinkHandler, gradeHandler: AddonModScormGradeLinkHandler,
|
||||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModScormListLinkHandler) {
|
listLinkHandler: AddonModScormListLinkHandler) {
|
||||||
|
|
||||||
moduleDelegate.registerHandler(moduleHandler);
|
moduleDelegate.registerHandler(moduleHandler);
|
||||||
prefetchDelegate.registerHandler(prefetchHandler);
|
prefetchDelegate.registerHandler(prefetchHandler);
|
||||||
|
@ -70,41 +69,5 @@ export class AddonModScormModule {
|
||||||
linksDelegate.registerHandler(indexHandler);
|
linksDelegate.registerHandler(indexHandler);
|
||||||
linksDelegate.registerHandler(gradeHandler);
|
linksDelegate.registerHandler(gradeHandler);
|
||||||
linksDelegate.registerHandler(listLinkHandler);
|
linksDelegate.registerHandler(listLinkHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTablesMigration([
|
|
||||||
{
|
|
||||||
name: 'mod_scorm_offline_attempts',
|
|
||||||
newName: AddonModScormOfflineProvider.ATTEMPTS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'snapshot',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'scormAndUser',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mod_scorm_offline_scos_tracks',
|
|
||||||
newName: AddonModScormOfflineProvider.TRACKS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'value',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'scormUserAttempt',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'scormUserAttemptSynced',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import { AddonModSurveyPrefetchHandler } from './providers/prefetch-handler';
|
||||||
import { AddonModSurveySyncProvider } from './providers/sync';
|
import { AddonModSurveySyncProvider } from './providers/sync';
|
||||||
import { AddonModSurveySyncCronHandler } from './providers/sync-cron-handler';
|
import { AddonModSurveySyncCronHandler } from './providers/sync-cron-handler';
|
||||||
import { AddonModSurveyOfflineProvider } from './providers/offline';
|
import { AddonModSurveyOfflineProvider } from './providers/offline';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_SURVEY_PROVIDERS: any[] = [
|
export const ADDON_MOD_SURVEY_PROVIDERS: any[] = [
|
||||||
|
@ -59,7 +58,7 @@ export class AddonModSurveyModule {
|
||||||
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModSurveyModuleHandler,
|
constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModSurveyModuleHandler,
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModSurveyPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModSurveyPrefetchHandler,
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModSurveyLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModSurveyLinkHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModSurveySyncCronHandler, updateManager: CoreUpdateManagerProvider,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModSurveySyncCronHandler,
|
||||||
listLinkHandler: AddonModSurveyListLinkHandler) {
|
listLinkHandler: AddonModSurveyListLinkHandler) {
|
||||||
|
|
||||||
moduleDelegate.registerHandler(moduleHandler);
|
moduleDelegate.registerHandler(moduleHandler);
|
||||||
|
@ -67,17 +66,5 @@ export class AddonModSurveyModule {
|
||||||
contentLinksDelegate.registerHandler(linkHandler);
|
contentLinksDelegate.registerHandler(linkHandler);
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_survey_answers',
|
|
||||||
newName: AddonModSurveyOfflineProvider.SURVEY_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'answers',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import { AddonModWikiCreateLinkHandler } from './providers/create-link-handler';
|
||||||
import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler';
|
import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler';
|
||||||
import { AddonModWikiListLinkHandler } from './providers/list-link-handler';
|
import { AddonModWikiListLinkHandler } from './providers/list-link-handler';
|
||||||
import { AddonModWikiTagAreaHandler } from './providers/tag-area-handler';
|
import { AddonModWikiTagAreaHandler } from './providers/tag-area-handler';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_WIKI_PROVIDERS: any[] = [
|
export const ADDON_MOD_WIKI_PROVIDERS: any[] = [
|
||||||
|
@ -67,7 +66,7 @@ export class AddonModWikiModule {
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModWikiSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModWikiSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
|
||||||
indexHandler: AddonModWikiIndexLinkHandler, pageOrMapHandler: AddonModWikiPageOrMapLinkHandler,
|
indexHandler: AddonModWikiIndexLinkHandler, pageOrMapHandler: AddonModWikiPageOrMapLinkHandler,
|
||||||
createHandler: AddonModWikiCreateLinkHandler, editHandler: AddonModWikiEditLinkHandler,
|
createHandler: AddonModWikiCreateLinkHandler, editHandler: AddonModWikiEditLinkHandler,
|
||||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWikiListLinkHandler,
|
listLinkHandler: AddonModWikiListLinkHandler,
|
||||||
tagAreaDelegate: CoreTagAreaDelegate, tagAreaHandler: AddonModWikiTagAreaHandler) {
|
tagAreaDelegate: CoreTagAreaDelegate, tagAreaHandler: AddonModWikiTagAreaHandler) {
|
||||||
|
|
||||||
moduleDelegate.registerHandler(moduleHandler);
|
moduleDelegate.registerHandler(moduleHandler);
|
||||||
|
@ -79,21 +78,5 @@ export class AddonModWikiModule {
|
||||||
linksDelegate.registerHandler(editHandler);
|
linksDelegate.registerHandler(editHandler);
|
||||||
linksDelegate.registerHandler(listLinkHandler);
|
linksDelegate.registerHandler(listLinkHandler);
|
||||||
tagAreaDelegate.registerHandler(tagAreaHandler);
|
tagAreaDelegate.registerHandler(tagAreaHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_mod_wiki_new_pages_store',
|
|
||||||
newName: AddonModWikiOfflineProvider.NEW_PAGES_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'subwikiWikiUserGroup',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'caneditpage',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import { AddonModWorkshopHelperProvider } from './providers/helper';
|
||||||
import { AddonWorkshopAssessmentStrategyDelegate } from './providers/assessment-strategy-delegate';
|
import { AddonWorkshopAssessmentStrategyDelegate } from './providers/assessment-strategy-delegate';
|
||||||
import { AddonModWorkshopPrefetchHandler } from './providers/prefetch-handler';
|
import { AddonModWorkshopPrefetchHandler } from './providers/prefetch-handler';
|
||||||
import { AddonModWorkshopSyncCronHandler } from './providers/sync-cron-handler';
|
import { AddonModWorkshopSyncCronHandler } from './providers/sync-cron-handler';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_MOD_WORKSHOP_PROVIDERS: any[] = [
|
export const ADDON_MOD_WORKSHOP_PROVIDERS: any[] = [
|
||||||
|
@ -65,60 +64,12 @@ export class AddonModWorkshopModule {
|
||||||
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModWorkshopLinkHandler,
|
contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModWorkshopLinkHandler,
|
||||||
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModWorkshopPrefetchHandler,
|
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModWorkshopPrefetchHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonModWorkshopSyncCronHandler,
|
cronDelegate: CoreCronDelegate, syncHandler: AddonModWorkshopSyncCronHandler,
|
||||||
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWorkshopListLinkHandler) {
|
listLinkHandler: AddonModWorkshopListLinkHandler) {
|
||||||
|
|
||||||
moduleDelegate.registerHandler(moduleHandler);
|
moduleDelegate.registerHandler(moduleHandler);
|
||||||
contentLinksDelegate.registerHandler(linkHandler);
|
contentLinksDelegate.registerHandler(linkHandler);
|
||||||
contentLinksDelegate.registerHandler(listLinkHandler);
|
contentLinksDelegate.registerHandler(listLinkHandler);
|
||||||
prefetchDelegate.registerHandler(prefetchHandler);
|
prefetchDelegate.registerHandler(prefetchHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTablesMigration([
|
|
||||||
{
|
|
||||||
name: 'mma_mod_workshop_offline_submissions',
|
|
||||||
newName: AddonModWorkshopOfflineProvider.SUBMISSIONS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'attachmentsid',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_workshop_offline_assessments',
|
|
||||||
newName: AddonModWorkshopOfflineProvider.ASSESSMENTS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'inputdata',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_workshop_offline_evaluate_submissions',
|
|
||||||
newName: AddonModWorkshopOfflineProvider.EVALUATE_SUBMISSIONS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'gradeover',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'published',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mma_mod_workshop_offline_evaluate_assessments',
|
|
||||||
newName: AddonModWorkshopOfflineProvider.EVALUATE_ASSESSMENTS_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'gradinggradeover',
|
|
||||||
type: 'object'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { AddonNotesComponentsModule } from './components/components.module';
|
||||||
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
|
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
|
||||||
import { CoreCronDelegate } from '@providers/cron';
|
import { CoreCronDelegate } from '@providers/cron';
|
||||||
import { CoreUserDelegate } from '@core/user/providers/user-delegate';
|
import { CoreUserDelegate } from '@core/user/providers/user-delegate';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_NOTES_PROVIDERS: any[] = [
|
export const ADDON_NOTES_PROVIDERS: any[] = [
|
||||||
|
@ -49,17 +48,11 @@ export const ADDON_NOTES_PROVIDERS: any[] = [
|
||||||
export class AddonNotesModule {
|
export class AddonNotesModule {
|
||||||
constructor(courseOptionsDelegate: CoreCourseOptionsDelegate, courseOptionHandler: AddonNotesCourseOptionHandler,
|
constructor(courseOptionsDelegate: CoreCourseOptionsDelegate, courseOptionHandler: AddonNotesCourseOptionHandler,
|
||||||
userDelegate: CoreUserDelegate, userHandler: AddonNotesUserHandler,
|
userDelegate: CoreUserDelegate, userHandler: AddonNotesUserHandler,
|
||||||
cronDelegate: CoreCronDelegate, syncHandler: AddonNotesSyncCronHandler, updateManager: CoreUpdateManagerProvider) {
|
cronDelegate: CoreCronDelegate, syncHandler: AddonNotesSyncCronHandler) {
|
||||||
|
|
||||||
// Register handlers.
|
// Register handlers.
|
||||||
courseOptionsDelegate.registerHandler(courseOptionHandler);
|
courseOptionsDelegate.registerHandler(courseOptionHandler);
|
||||||
userDelegate.registerHandler(userHandler);
|
userDelegate.registerHandler(userHandler);
|
||||||
cronDelegate.register(syncHandler);
|
cronDelegate.register(syncHandler);
|
||||||
|
|
||||||
// Allow migrating the tables from the old app to the new schema.
|
|
||||||
updateManager.registerSiteTableMigration({
|
|
||||||
name: 'mma_notes_offline_notes',
|
|
||||||
newName: AddonNotesOfflineProvider.NOTES_TABLE
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import { CoreCronDelegate } from '@providers/cron';
|
||||||
import { CoreEventsProvider } from '@providers/events';
|
import { CoreEventsProvider } from '@providers/events';
|
||||||
import { CoreLoggerProvider } from '@providers/logger';
|
import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const CORE_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
export const CORE_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
||||||
|
@ -45,7 +44,7 @@ export const CORE_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
||||||
export class CorePushNotificationsModule {
|
export class CorePushNotificationsModule {
|
||||||
constructor(platform: Platform, pushNotificationsProvider: CorePushNotificationsProvider, eventsProvider: CoreEventsProvider,
|
constructor(platform: Platform, pushNotificationsProvider: CorePushNotificationsProvider, eventsProvider: CoreEventsProvider,
|
||||||
localNotificationsProvider: CoreLocalNotificationsProvider, loggerProvider: CoreLoggerProvider,
|
localNotificationsProvider: CoreLocalNotificationsProvider, loggerProvider: CoreLoggerProvider,
|
||||||
updateManager: CoreUpdateManagerProvider, cronDelegate: CoreCronDelegate,
|
cronDelegate: CoreCronDelegate,
|
||||||
registerCronHandler: CorePushNotificationsRegisterCronHandler,
|
registerCronHandler: CorePushNotificationsRegisterCronHandler,
|
||||||
unregisterCronHandler: CorePushNotificationsUnregisterCronHandler) {
|
unregisterCronHandler: CorePushNotificationsUnregisterCronHandler) {
|
||||||
|
|
||||||
|
@ -92,20 +91,5 @@ export class CorePushNotificationsModule {
|
||||||
// Log notification dismissed event.
|
// Log notification dismissed event.
|
||||||
pushNotificationsProvider.logEvent('moodle_notification_dismiss', notification, true);
|
pushNotificationsProvider.logEvent('moodle_notification_dismiss', notification, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Allow migrating the table from the old app to the new schema.
|
|
||||||
updateManager.registerAppTableMigration({
|
|
||||||
name: 'mma_pushnotifications_badge',
|
|
||||||
newName: CorePushNotificationsProvider.BADGE_TABLE,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'siteid',
|
|
||||||
newName: 'siteId'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// Migrate the component name.
|
|
||||||
updateManager.registerLocalNotifComponentMigration('mmaPushNotifications', CorePushNotificationsProvider.COMPONENT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1346,28 +1346,6 @@ export class CoreFilepoolProvider {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill Missing Extension In Files, used to migrate from previous file handling.
|
|
||||||
* Reserved for core use, please do not call.
|
|
||||||
*
|
|
||||||
* @param siteId SiteID to get migrated
|
|
||||||
* @return Promise resolved when done.
|
|
||||||
*/
|
|
||||||
fillMissingExtensionInFiles(siteId: string): Promise<any> {
|
|
||||||
this.logger.debug('Fill missing extensions in files of ' + siteId);
|
|
||||||
|
|
||||||
return this.sitesProvider.getSiteDb(siteId).then((db) => {
|
|
||||||
return db.getAllRecords(this.FILES_TABLE).then((entries) => {
|
|
||||||
const promises = [];
|
|
||||||
entries.forEach((entry) => {
|
|
||||||
promises.push(this.fillExtensionInFile(entry, siteId));
|
|
||||||
});
|
|
||||||
|
|
||||||
return Promise.all(promises);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix a component ID to always be a Number if possible.
|
* Fix a component ID to always be a Number if possible.
|
||||||
*
|
*
|
||||||
|
@ -3018,33 +2996,6 @@ export class CoreFilepoolProvider {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove extension from fileId in queue, used to migrate from previous file handling.
|
|
||||||
*
|
|
||||||
* @return Promise resolved when done.
|
|
||||||
*/
|
|
||||||
async treatExtensionInQueue(): Promise<any> {
|
|
||||||
await this.dbReady;
|
|
||||||
|
|
||||||
this.logger.debug('Treat extensions in queue');
|
|
||||||
|
|
||||||
const entries = await this.appDB.getAllRecords(this.QUEUE_TABLE);
|
|
||||||
|
|
||||||
return Promise.all(entries.map((entry) => {
|
|
||||||
|
|
||||||
// For files in the queue, we only need to remove the extension from the fileId.
|
|
||||||
// After downloading, additional info will be added.
|
|
||||||
const fileId = entry.fileId;
|
|
||||||
entry.fileId = this.mimeUtils.removeExtension(fileId);
|
|
||||||
|
|
||||||
if (fileId == entry.fileId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.appDB.updateRecords(this.QUEUE_TABLE, { fileId: entry.fileId }, { fileId: fileId });
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves or rejects a queue deferred and removes it from the list.
|
* Resolves or rejects a queue deferred and removes it from the list.
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,45 +14,9 @@
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreConfigProvider } from './config';
|
import { CoreConfigProvider } from './config';
|
||||||
import { CoreFilepoolProvider } from './filepool';
|
|
||||||
import { CoreInitHandler, CoreInitDelegate } from './init';
|
import { CoreInitHandler, CoreInitDelegate } from './init';
|
||||||
import { CoreLocalNotificationsProvider } from './local-notifications';
|
|
||||||
import { CoreLoggerProvider } from './logger';
|
import { CoreLoggerProvider } from './logger';
|
||||||
import { CoreSitesProvider } from './sites';
|
|
||||||
import { CoreUtilsProvider } from './utils/utils';
|
|
||||||
import { CoreTimeUtilsProvider } from './utils/time';
|
|
||||||
import { CoreConfigConstants } from '../configconstants';
|
import { CoreConfigConstants } from '../configconstants';
|
||||||
import { AddonCalendarProvider } from '@addon/calendar/providers/calendar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Data to migrate a store of Ionic 1 app to the SQLite DB.
|
|
||||||
*/
|
|
||||||
export interface CoreUpdateManagerMigrateTable {
|
|
||||||
/**
|
|
||||||
* Current name of the store/table.
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New name of the table. If not defined, "name" will be used.
|
|
||||||
*/
|
|
||||||
newName?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An object to rename and convert some fields of the table/store.
|
|
||||||
*/
|
|
||||||
fields?: {
|
|
||||||
name: string, // Field name in the old app.
|
|
||||||
newName?: string, // New field name. If not provided, keep the same name.
|
|
||||||
type?: string, // Type of the field if it needs to be treated: 'any', 'object', 'date', 'boolean'.
|
|
||||||
delete?: boolean // Whether the field must be deleted because it isn't needed in the new schema.
|
|
||||||
}[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If set, all the fields that aren't in this array will be deleted. The names in this list should be the new names.
|
|
||||||
*/
|
|
||||||
filterFields?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory to handle app updates. This factory shouldn't be used outside of core.
|
* Factory to handle app updates. This factory shouldn't be used outside of core.
|
||||||
|
@ -68,253 +32,8 @@ export class CoreUpdateManagerProvider implements CoreInitHandler {
|
||||||
|
|
||||||
protected VERSION_APPLIED = 'version_applied';
|
protected VERSION_APPLIED = 'version_applied';
|
||||||
protected logger;
|
protected logger;
|
||||||
protected localNotificationsComponentsMigrate: {[old: string]: string} = {};
|
|
||||||
|
|
||||||
/**
|
constructor(logger: CoreLoggerProvider, private configProvider: CoreConfigProvider) {
|
||||||
* Tables to migrate from app DB ('MoodleMobile'). Include all the core ones to decrease the dependencies.
|
|
||||||
*/
|
|
||||||
protected appDBTables: CoreUpdateManagerMigrateTable[] = [
|
|
||||||
{
|
|
||||||
name: 'config',
|
|
||||||
newName: 'core_config',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'value',
|
|
||||||
type: 'any'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'cron'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'current_site',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'siteid',
|
|
||||||
newName: 'siteId'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'desktop_local_notifications',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'data',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'triggered',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
filterFields: ['id', 'title', 'text', 'at', 'data', 'triggered']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'files_queue',
|
|
||||||
newName: 'filepool_files_queue',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'isexternalfile',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'links',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'sortorder',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'notification_components'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'notification_sites'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'notifications_triggered'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'shared_files'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'sites',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'siteurl',
|
|
||||||
newName: 'siteUrl'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'infos',
|
|
||||||
newName: 'info',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'privatetoken',
|
|
||||||
newName: 'privateToken'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'config',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'loggedout',
|
|
||||||
newName: 'loggedOut'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tables to migrate from each site DB. Include all the core ones to decrease the dependencies.
|
|
||||||
*/
|
|
||||||
protected siteDBTables: CoreUpdateManagerMigrateTable[] = [
|
|
||||||
{
|
|
||||||
name: 'check_updates_times',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'courseid',
|
|
||||||
newName: 'courseId'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'course_status',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'previous',
|
|
||||||
newName: 'previousStatus'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'downloadtime',
|
|
||||||
newName: 'downloadTime'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'previousdownloadtime',
|
|
||||||
newName: 'previousDownloadTime'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'filepool',
|
|
||||||
newName: 'filepool_files',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'stale',
|
|
||||||
type: 'boolean'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'downloaded',
|
|
||||||
newName: 'downloadTime'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'isexternalfile',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'files_links',
|
|
||||||
newName: 'filepool_files_links',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'componentAndId',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'filepool_packages',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'downloadtime',
|
|
||||||
newName: 'downloadTime'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'previousdownloadtime',
|
|
||||||
newName: 'previousDownloadTime'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'revision', // Move the value of 'revision' to 'extra' so SCORMs keep working.
|
|
||||||
newName: 'extra'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'timemodified',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mm_emulator_last_received_notification',
|
|
||||||
newName: 'core_emulator_last_received_notification',
|
|
||||||
filterFields: ['component', 'id', 'timecreated']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'questions',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'componentId',
|
|
||||||
newName: 'componentid'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'componentAndAttempt',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'componentAndComponentId',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'question_answers',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'componentId',
|
|
||||||
newName: 'componentid'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'componentAndAttempt',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'componentAndComponentId',
|
|
||||||
delete: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'componentAndAttemptAndQuestion',
|
|
||||||
delete: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'sync'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'users'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'wscache',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'data',
|
|
||||||
type: 'object'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'expirationtime',
|
|
||||||
newName: 'expirationTime'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor(logger: CoreLoggerProvider, private configProvider: CoreConfigProvider, private sitesProvider: CoreSitesProvider,
|
|
||||||
private filepoolProvider: CoreFilepoolProvider, private notifProvider: CoreLocalNotificationsProvider,
|
|
||||||
private utils: CoreUtilsProvider, private timeUtils: CoreTimeUtilsProvider,
|
|
||||||
private calendarProvider: AddonCalendarProvider) {
|
|
||||||
this.logger = logger.getInstance('CoreUpdateManagerProvider');
|
this.logger = logger.getInstance('CoreUpdateManagerProvider');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,21 +49,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler {
|
||||||
|
|
||||||
return this.configProvider.get(this.VERSION_APPLIED, 0).then((versionApplied: number) => {
|
return this.configProvider.get(this.VERSION_APPLIED, 0).then((versionApplied: number) => {
|
||||||
|
|
||||||
if (versionCode >= 2013 && versionApplied < 2013 && versionApplied > 0) {
|
// Put here the code to treat app updates.
|
||||||
promises.push(this.migrateFileExtensions());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (versionCode >= 2017 && versionApplied < 2017 && versionApplied > 0) {
|
|
||||||
promises.push(this.setCalendarDefaultNotifTime());
|
|
||||||
promises.push(this.setSitesConfig());
|
|
||||||
}
|
|
||||||
|
|
||||||
// In version 2018 we adapted the forum offline stores to match a new schema.
|
|
||||||
// However, due to the migration of data to SQLite we can no longer do that.
|
|
||||||
|
|
||||||
if (versionCode >= 3500 && versionApplied < 3500 && versionApplied > 0) {
|
|
||||||
promises.push(this.logoutLegacySites());
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all(promises).then(() => {
|
return Promise.all(promises).then(() => {
|
||||||
return this.configProvider.set(this.VERSION_APPLIED, versionCode);
|
return this.configProvider.set(this.VERSION_APPLIED, versionCode);
|
||||||
|
@ -353,193 +58,4 @@ export class CoreUpdateManagerProvider implements CoreInitHandler {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Register several app tables to be migrated to the new schema.
|
|
||||||
*
|
|
||||||
* @param tables The tables to migrate.
|
|
||||||
*/
|
|
||||||
registerAppTablesMigration(tables: CoreUpdateManagerMigrateTable[]): void {
|
|
||||||
tables.forEach((table) => {
|
|
||||||
this.registerAppTableMigration(table);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register an app table to be migrated to the new schema.
|
|
||||||
*
|
|
||||||
* @param table The table to migrate.
|
|
||||||
*/
|
|
||||||
registerAppTableMigration(table: CoreUpdateManagerMigrateTable): void {
|
|
||||||
this.appDBTables.push(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register several site tables to be migrated to the new schema.
|
|
||||||
*
|
|
||||||
* @param tables The tables to migrate.
|
|
||||||
*/
|
|
||||||
registerSiteTablesMigration(tables: CoreUpdateManagerMigrateTable[]): void {
|
|
||||||
tables.forEach((table) => {
|
|
||||||
this.registerSiteTableMigration(table);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a site table to be migrated to the new schema.
|
|
||||||
*
|
|
||||||
* @param table The table to migrate.
|
|
||||||
*/
|
|
||||||
registerSiteTableMigration(table: CoreUpdateManagerMigrateTable): void {
|
|
||||||
this.siteDBTables.push(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a migration of component name for local notifications.
|
|
||||||
*
|
|
||||||
* @param oldName The old name.
|
|
||||||
* @param newName The new name.
|
|
||||||
*/
|
|
||||||
registerLocalNotifComponentMigration(oldName: string, newName: string): void {
|
|
||||||
this.localNotificationsComponentsMigrate[oldName] = newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrates files filling extensions.
|
|
||||||
*
|
|
||||||
* @return Promise resolved when the site migration is finished.
|
|
||||||
*/
|
|
||||||
protected migrateFileExtensions(): Promise<any> {
|
|
||||||
return this.sitesProvider.getSitesIds().then((sites) => {
|
|
||||||
const promises = [];
|
|
||||||
sites.forEach((siteId) => {
|
|
||||||
promises.push(this.filepoolProvider.fillMissingExtensionInFiles(siteId));
|
|
||||||
});
|
|
||||||
promises.push(this.filepoolProvider.treatExtensionInQueue());
|
|
||||||
|
|
||||||
return Promise.all(promises);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar default notification time is configurable from version 3.2.1, and a new option "Default" is added.
|
|
||||||
* All events that were configured to use the fixed default time should now be configured to use "Default" option.
|
|
||||||
*
|
|
||||||
* @return Promise resolved when the events are configured.
|
|
||||||
*/
|
|
||||||
protected setCalendarDefaultNotifTime(): Promise<any> {
|
|
||||||
if (!this.notifProvider.isAvailable()) {
|
|
||||||
// Local notifications not available, nothing to do.
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
const now = this.timeUtils.timestamp();
|
|
||||||
|
|
||||||
return this.sitesProvider.getSitesIds().then((siteIds) => {
|
|
||||||
|
|
||||||
const promises = [];
|
|
||||||
siteIds.forEach((siteId) => {
|
|
||||||
// Get stored events.
|
|
||||||
promises.push(this.calendarProvider.getAllEventsFromLocalDb(siteId).then((events) => {
|
|
||||||
const eventPromises = [];
|
|
||||||
|
|
||||||
events.forEach((event) => {
|
|
||||||
if (event.notificationtime && event.notificationtime == AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME) {
|
|
||||||
eventPromises.push(this.calendarProvider.addEventReminder(event, -1, siteId));
|
|
||||||
} else if (event.notificationtime && event.notificationtime > 0) {
|
|
||||||
const time = event.timestart - event.notificationtime * 60;
|
|
||||||
|
|
||||||
if (time < now) {
|
|
||||||
// Old reminder, just not add this.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
eventPromises.push(this.calendarProvider.addEventReminder(event, time, siteId));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return Promise.all(eventPromises);
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
return Promise.all(promises);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In version 3.2.1 we want the site config to be stored in each site if available.
|
|
||||||
* Since it can be slow, we'll only block retrieving the config of current site, the rest will be in background.
|
|
||||||
*
|
|
||||||
* @return Promise resolved when the config is loaded for the current site (if any).
|
|
||||||
*/
|
|
||||||
protected setSitesConfig(): Promise<any> {
|
|
||||||
return this.sitesProvider.getSitesIds().then((siteIds) => {
|
|
||||||
|
|
||||||
return this.sitesProvider.getStoredCurrentSiteId().catch(() => {
|
|
||||||
// Error getting current site.
|
|
||||||
}).then((currentSiteId) => {
|
|
||||||
let promise;
|
|
||||||
|
|
||||||
// Load the config of current site first.
|
|
||||||
if (currentSiteId) {
|
|
||||||
promise = this.setSiteConfig(currentSiteId);
|
|
||||||
} else {
|
|
||||||
promise = Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the config of rest of sites in background.
|
|
||||||
siteIds.forEach((siteId) => {
|
|
||||||
if (siteId != currentSiteId) {
|
|
||||||
this.setSiteConfig(siteId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the config of a site.
|
|
||||||
*
|
|
||||||
* @param siteId Site ID.
|
|
||||||
* @return Promise resolved when the config is loaded for the site.
|
|
||||||
*/
|
|
||||||
protected setSiteConfig(siteId: string): Promise<any> {
|
|
||||||
return this.sitesProvider.getSite(siteId).then((site) => {
|
|
||||||
if (site.getStoredConfig() || !site.wsAvailable('tool_mobile_get_config')) {
|
|
||||||
// Site already has the config or it cannot be retrieved. Stop.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the site config.
|
|
||||||
return site.getConfig().then((config) => {
|
|
||||||
return this.sitesProvider.addSite(
|
|
||||||
site.getId(), site.getURL(), site.getToken(), site.getInfo(), site.getPrivateToken(), config);
|
|
||||||
}).catch(() => {
|
|
||||||
// Ignore errors.
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logout from legacy sites.
|
|
||||||
*
|
|
||||||
* @return Promise resolved when done.
|
|
||||||
*/
|
|
||||||
protected logoutLegacySites(): Promise<any> {
|
|
||||||
return this.sitesProvider.getSitesIds().then((siteIds) => {
|
|
||||||
const promises = [];
|
|
||||||
|
|
||||||
siteIds.forEach((siteId) => {
|
|
||||||
promises.push(this.sitesProvider.getSite(siteId).then((site) => {
|
|
||||||
// If the site is a legacy site, mark it as logged out so the user has to authenticate again.
|
|
||||||
if (this.sitesProvider.isLegacyMoodleByInfo(site.getInfo())) {
|
|
||||||
return this.sitesProvider.setSiteLoggedOut(site.getId(), true);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
return this.utils.allPromises(promises);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue