MOBILE-2921 push: Move pushnotifications to core
parent
3c1163b2e6
commit
727fe58a52
|
@ -15,7 +15,7 @@
|
||||||
import { Component, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy } from '@angular/core';
|
||||||
import { IonicPage } from 'ionic-angular';
|
import { IonicPage } from 'ionic-angular';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
import { AddonPushNotificationsProvider } from '@addon/pushnotifications/providers/pushnotifications';
|
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
|
||||||
import { AddonMessageOutputAirnotifierProvider } from '../../providers/airnotifier';
|
import { AddonMessageOutputAirnotifierProvider } from '../../providers/airnotifier';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy {
|
||||||
protected updateTimeout: any;
|
protected updateTimeout: any;
|
||||||
|
|
||||||
constructor(private domUtils: CoreDomUtilsProvider, private airnotifierProivder: AddonMessageOutputAirnotifierProvider,
|
constructor(private domUtils: CoreDomUtilsProvider, private airnotifierProivder: AddonMessageOutputAirnotifierProvider,
|
||||||
private pushNotificationsProvider: AddonPushNotificationsProvider ) {
|
private pushNotificationsProvider: CorePushNotificationsProvider ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { AddonMessagesProvider } from '../../providers/messages';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreAppProvider } from '@providers/app';
|
import { CoreAppProvider } from '@providers/app';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that displays the list of discussions.
|
* Component that displays the list of discussions.
|
||||||
|
@ -54,7 +54,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
|
||||||
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
constructor(private eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
||||||
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
||||||
private appProvider: CoreAppProvider, platform: Platform, private utils: CoreUtilsProvider,
|
private appProvider: CoreAppProvider, platform: Platform, private utils: CoreUtilsProvider,
|
||||||
pushNotificationsDelegate: AddonPushNotificationsDelegate) {
|
pushNotificationsDelegate: CorePushNotificationsDelegate) {
|
||||||
|
|
||||||
this.search.loading = translate.instant('core.searching');
|
this.search.loading = translate.instant('core.searching');
|
||||||
this.loadingMessages = translate.instant('core.loading');
|
this.loadingMessages = translate.instant('core.loading');
|
||||||
|
|
|
@ -35,7 +35,7 @@ import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper';
|
import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper';
|
||||||
import { CoreSettingsDelegate } from '@core/settings/providers/delegate';
|
import { CoreSettingsDelegate } from '@core/settings/providers/delegate';
|
||||||
import { AddonMessagesSettingsHandler } from './providers/settings-handler';
|
import { AddonMessagesSettingsHandler } from './providers/settings-handler';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/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';
|
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ export class AddonMessagesModule {
|
||||||
localNotifications: CoreLocalNotificationsProvider, messagesProvider: AddonMessagesProvider,
|
localNotifications: CoreLocalNotificationsProvider, messagesProvider: AddonMessagesProvider,
|
||||||
sitesProvider: CoreSitesProvider, linkHelper: CoreContentLinksHelperProvider, updateManager: CoreUpdateManagerProvider,
|
sitesProvider: CoreSitesProvider, linkHelper: CoreContentLinksHelperProvider, updateManager: CoreUpdateManagerProvider,
|
||||||
settingsHandler: AddonMessagesSettingsHandler, settingsDelegate: CoreSettingsDelegate,
|
settingsHandler: AddonMessagesSettingsHandler, settingsDelegate: CoreSettingsDelegate,
|
||||||
pushNotificationsDelegate: AddonPushNotificationsDelegate, utils: CoreUtilsProvider,
|
pushNotificationsDelegate: CorePushNotificationsDelegate, utils: CoreUtilsProvider,
|
||||||
addContactHandler: AddonMessagesAddContactUserHandler, blockContactHandler: AddonMessagesBlockContactUserHandler,
|
addContactHandler: AddonMessagesAddContactUserHandler, blockContactHandler: AddonMessagesBlockContactUserHandler,
|
||||||
contactRequestLinkHandler: AddonMessagesContactRequestLinkHandler) {
|
contactRequestLinkHandler: AddonMessagesContactRequestLinkHandler) {
|
||||||
// Register handlers.
|
// Register handlers.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { AddonMessagesProvider } from '../../providers/messages';
|
||||||
import { AddonMessagesOfflineProvider } from '../../providers/messages-offline';
|
import { AddonMessagesOfflineProvider } from '../../providers/messages-offline';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||||
import { CoreUserProvider } from '@core/user/providers/user';
|
import { CoreUserProvider } from '@core/user/providers/user';
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
|
||||||
constructor(eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
constructor(eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, translate: TranslateService,
|
||||||
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
private messagesProvider: AddonMessagesProvider, private domUtils: CoreDomUtilsProvider, navParams: NavParams,
|
||||||
private navCtrl: NavController, platform: Platform, private utils: CoreUtilsProvider,
|
private navCtrl: NavController, platform: Platform, private utils: CoreUtilsProvider,
|
||||||
pushNotificationsDelegate: AddonPushNotificationsDelegate, private messagesOffline: AddonMessagesOfflineProvider,
|
pushNotificationsDelegate: CorePushNotificationsDelegate, private messagesOffline: AddonMessagesOfflineProvider,
|
||||||
private userProvider: CoreUserProvider) {
|
private userProvider: CoreUserProvider) {
|
||||||
|
|
||||||
this.loadingString = translate.instant('core.loading');
|
this.loadingString = translate.instant('core.loading');
|
||||||
|
|
|
@ -22,8 +22,8 @@ import { CoreAppProvider } from '@providers/app';
|
||||||
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { AddonPushNotificationsProvider } from '@addon/pushnotifications/providers/pushnotifications';
|
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
import { CoreEmulatorHelperProvider } from '@core/emulator/providers/helper';
|
import { CoreEmulatorHelperProvider } from '@core/emulator/providers/helper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,8 +50,8 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr
|
||||||
constructor(private messagesProvider: AddonMessagesProvider, private sitesProvider: CoreSitesProvider,
|
constructor(private messagesProvider: AddonMessagesProvider, private sitesProvider: CoreSitesProvider,
|
||||||
eventsProvider: CoreEventsProvider, private appProvider: CoreAppProvider,
|
eventsProvider: CoreEventsProvider, private appProvider: CoreAppProvider,
|
||||||
private localNotificationsProvider: CoreLocalNotificationsProvider, private textUtils: CoreTextUtilsProvider,
|
private localNotificationsProvider: CoreLocalNotificationsProvider, private textUtils: CoreTextUtilsProvider,
|
||||||
private pushNotificationsProvider: AddonPushNotificationsProvider, utils: CoreUtilsProvider,
|
private pushNotificationsProvider: CorePushNotificationsProvider, utils: CoreUtilsProvider,
|
||||||
pushNotificationsDelegate: AddonPushNotificationsDelegate, private emulatorHelper: CoreEmulatorHelperProvider) {
|
pushNotificationsDelegate: CorePushNotificationsDelegate, private emulatorHelper: CoreEmulatorHelperProvider) {
|
||||||
|
|
||||||
eventsProvider.on(AddonMessagesProvider.UNREAD_CONVERSATION_COUNTS_EVENT, (data) => {
|
eventsProvider.on(AddonMessagesProvider.UNREAD_CONVERSATION_COUNTS_EVENT, (data) => {
|
||||||
this.unreadCount = data.favourites + data.individual + data.group;
|
this.unreadCount = data.favourites + data.individual + data.group;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreUrlUtilsProvider } from '@providers/utils/url';
|
import { CoreUrlUtilsProvider } from '@providers/utils/url';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
import { AddonModForumProvider } from '@addon/mod/forum/providers/forum';
|
import { AddonModForumProvider } from '@addon/mod/forum/providers/forum';
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
|
@ -52,7 +52,7 @@ export class AddonNotificationsModule {
|
||||||
cronDelegate: CoreCronDelegate, cronHandler: AddonNotificationsCronHandler, zone: NgZone,
|
cronDelegate: CoreCronDelegate, cronHandler: AddonNotificationsCronHandler, zone: NgZone,
|
||||||
appProvider: CoreAppProvider, utils: CoreUtilsProvider, sitesProvider: CoreSitesProvider,
|
appProvider: CoreAppProvider, utils: CoreUtilsProvider, sitesProvider: CoreSitesProvider,
|
||||||
notificationsProvider: AddonNotificationsProvider, localNotifications: CoreLocalNotificationsProvider,
|
notificationsProvider: AddonNotificationsProvider, localNotifications: CoreLocalNotificationsProvider,
|
||||||
linkHelper: CoreContentLinksHelperProvider, pushNotificationsDelegate: AddonPushNotificationsDelegate,
|
linkHelper: CoreContentLinksHelperProvider, pushNotificationsDelegate: CorePushNotificationsDelegate,
|
||||||
urlUtils: CoreUrlUtilsProvider, forumProvider: AddonModForumProvider) {
|
urlUtils: CoreUrlUtilsProvider, forumProvider: AddonModForumProvider) {
|
||||||
|
|
||||||
mainMenuDelegate.registerHandler(mainMenuHandler);
|
mainMenuDelegate.registerHandler(mainMenuHandler);
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { CoreEventsProvider, CoreEventObserver } from '@providers/events';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { AddonNotificationsProvider } from '../../providers/notifications';
|
import { AddonNotificationsProvider } from '../../providers/notifications';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the list of notifications.
|
* Page that displays the list of notifications.
|
||||||
|
@ -48,7 +48,7 @@ export class AddonNotificationsListPage {
|
||||||
constructor(navParams: NavParams, private domUtils: CoreDomUtilsProvider, private eventsProvider: CoreEventsProvider,
|
constructor(navParams: NavParams, private domUtils: CoreDomUtilsProvider, private eventsProvider: CoreEventsProvider,
|
||||||
private sitesProvider: CoreSitesProvider, private textUtils: CoreTextUtilsProvider,
|
private sitesProvider: CoreSitesProvider, private textUtils: CoreTextUtilsProvider,
|
||||||
private utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
private utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
||||||
private pushNotificationsDelegate: AddonPushNotificationsDelegate) {
|
private pushNotificationsDelegate: CorePushNotificationsDelegate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,8 +18,8 @@ import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@core/mainmenu/providers/delegate';
|
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@core/mainmenu/providers/delegate';
|
||||||
import { AddonNotificationsProvider } from './notifications';
|
import { AddonNotificationsProvider } from './notifications';
|
||||||
import { AddonPushNotificationsProvider } from '@addon/pushnotifications/providers/pushnotifications';
|
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
|
||||||
import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate';
|
import { CorePushNotificationsDelegate } from '@core/pushnotifications/providers/delegate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to inject an option into main menu.
|
* Handler to inject an option into main menu.
|
||||||
|
@ -41,8 +41,8 @@ export class AddonNotificationsMainMenuHandler implements CoreMainMenuHandler {
|
||||||
|
|
||||||
constructor(eventsProvider: CoreEventsProvider, private sitesProvider: CoreSitesProvider,
|
constructor(eventsProvider: CoreEventsProvider, private sitesProvider: CoreSitesProvider,
|
||||||
utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
utils: CoreUtilsProvider, private notificationsProvider: AddonNotificationsProvider,
|
||||||
private pushNotificationsProvider: AddonPushNotificationsProvider,
|
private pushNotificationsProvider: CorePushNotificationsProvider,
|
||||||
pushNotificationsDelegate: AddonPushNotificationsDelegate) {
|
pushNotificationsDelegate: CorePushNotificationsDelegate) {
|
||||||
|
|
||||||
eventsProvider.on(AddonNotificationsProvider.READ_CHANGED_EVENT, (data) => {
|
eventsProvider.on(AddonNotificationsProvider.READ_CHANGED_EVENT, (data) => {
|
||||||
this.updateBadge(data.siteId);
|
this.updateBadge(data.siteId);
|
||||||
|
|
|
@ -121,7 +121,7 @@ import { AddonMessageOutputModule } from '@addon/messageoutput/messageoutput.mod
|
||||||
import { AddonMessageOutputAirnotifierModule } from '@addon/messageoutput/airnotifier/airnotifier.module';
|
import { AddonMessageOutputAirnotifierModule } from '@addon/messageoutput/airnotifier/airnotifier.module';
|
||||||
import { AddonMessagesModule } from '@addon/messages/messages.module';
|
import { AddonMessagesModule } from '@addon/messages/messages.module';
|
||||||
import { AddonNotesModule } from '../addon/notes/notes.module';
|
import { AddonNotesModule } from '../addon/notes/notes.module';
|
||||||
import { AddonPushNotificationsModule } from '@addon/pushnotifications/pushnotifications.module';
|
import { CorePushNotificationsModule } from '@core/pushnotifications/pushnotifications.module';
|
||||||
import { AddonNotificationsModule } from '@addon/notifications/notifications.module';
|
import { AddonNotificationsModule } from '@addon/notifications/notifications.module';
|
||||||
import { AddonRemoteThemesModule } from '@addon/remotethemes/remotethemes.module';
|
import { AddonRemoteThemesModule } from '@addon/remotethemes/remotethemes.module';
|
||||||
import { AddonQbehaviourModule } from '@addon/qbehaviour/qbehaviour.module';
|
import { AddonQbehaviourModule } from '@addon/qbehaviour/qbehaviour.module';
|
||||||
|
@ -201,6 +201,7 @@ export const CORE_PROVIDERS: any[] = [
|
||||||
CoreCommentsModule,
|
CoreCommentsModule,
|
||||||
CoreBlockModule,
|
CoreBlockModule,
|
||||||
CoreRatingModule,
|
CoreRatingModule,
|
||||||
|
CorePushNotificationsModule,
|
||||||
AddonBadgesModule,
|
AddonBadgesModule,
|
||||||
AddonBlogModule,
|
AddonBlogModule,
|
||||||
AddonCalendarModule,
|
AddonCalendarModule,
|
||||||
|
@ -241,7 +242,6 @@ export const CORE_PROVIDERS: any[] = [
|
||||||
AddonMessagesModule,
|
AddonMessagesModule,
|
||||||
AddonNotesModule,
|
AddonNotesModule,
|
||||||
AddonNotificationsModule,
|
AddonNotificationsModule,
|
||||||
AddonPushNotificationsModule,
|
|
||||||
AddonRemoteThemesModule,
|
AddonRemoteThemesModule,
|
||||||
AddonQbehaviourModule,
|
AddonQbehaviourModule,
|
||||||
AddonQtypeModule
|
AddonQtypeModule
|
||||||
|
|
|
@ -35,6 +35,7 @@ import { CORE_QUESTION_PROVIDERS } from '@core/question/question.module';
|
||||||
import { CORE_SHAREDFILES_PROVIDERS } from '@core/sharedfiles/sharedfiles.module';
|
import { CORE_SHAREDFILES_PROVIDERS } from '@core/sharedfiles/sharedfiles.module';
|
||||||
import { CORE_SITEHOME_PROVIDERS } from '@core/sitehome/sitehome.module';
|
import { CORE_SITEHOME_PROVIDERS } from '@core/sitehome/sitehome.module';
|
||||||
import { CORE_USER_PROVIDERS } from '@core/user/user.module';
|
import { CORE_USER_PROVIDERS } from '@core/user/user.module';
|
||||||
|
import { CORE_PUSHNOTIFICATIONS_PROVIDERS } from '@core/pushnotifications/pushnotifications.module';
|
||||||
import { IONIC_NATIVE_PROVIDERS } from '@core/emulator/emulator.module';
|
import { IONIC_NATIVE_PROVIDERS } from '@core/emulator/emulator.module';
|
||||||
|
|
||||||
// Import only this provider to prevent circular dependencies.
|
// Import only this provider to prevent circular dependencies.
|
||||||
|
@ -114,7 +115,6 @@ import { ADDON_MOD_WIKI_PROVIDERS } from '@addon/mod/wiki/wiki.module';
|
||||||
import { ADDON_MOD_WORKSHOP_PROVIDERS } from '@addon/mod/workshop/workshop.module';
|
import { ADDON_MOD_WORKSHOP_PROVIDERS } from '@addon/mod/workshop/workshop.module';
|
||||||
import { ADDON_NOTES_PROVIDERS } from '@addon/notes/notes.module';
|
import { ADDON_NOTES_PROVIDERS } from '@addon/notes/notes.module';
|
||||||
import { ADDON_NOTIFICATIONS_PROVIDERS } from '@addon/notifications/notifications.module';
|
import { ADDON_NOTIFICATIONS_PROVIDERS } from '@addon/notifications/notifications.module';
|
||||||
import { ADDON_PUSHNOTIFICATIONS_PROVIDERS } from '@addon/pushnotifications/pushnotifications.module';
|
|
||||||
import { ADDON_REMOTETHEMES_PROVIDERS } from '@addon/remotethemes/remotethemes.module';
|
import { ADDON_REMOTETHEMES_PROVIDERS } from '@addon/remotethemes/remotethemes.module';
|
||||||
|
|
||||||
// Import some addon modules that define components, directives and pipes. Only import the important ones.
|
// Import some addon modules that define components, directives and pipes. Only import the important ones.
|
||||||
|
@ -233,7 +233,7 @@ export class CoreCompileProvider {
|
||||||
.concat(ADDON_MOD_QUIZ_PROVIDERS).concat(ADDON_MOD_RESOURCE_PROVIDERS).concat(ADDON_MOD_SCORM_PROVIDERS)
|
.concat(ADDON_MOD_QUIZ_PROVIDERS).concat(ADDON_MOD_RESOURCE_PROVIDERS).concat(ADDON_MOD_SCORM_PROVIDERS)
|
||||||
.concat(ADDON_MOD_SURVEY_PROVIDERS).concat(ADDON_MOD_URL_PROVIDERS).concat(ADDON_MOD_WIKI_PROVIDERS)
|
.concat(ADDON_MOD_SURVEY_PROVIDERS).concat(ADDON_MOD_URL_PROVIDERS).concat(ADDON_MOD_WIKI_PROVIDERS)
|
||||||
.concat(ADDON_MOD_WORKSHOP_PROVIDERS).concat(ADDON_NOTES_PROVIDERS).concat(ADDON_NOTIFICATIONS_PROVIDERS)
|
.concat(ADDON_MOD_WORKSHOP_PROVIDERS).concat(ADDON_NOTES_PROVIDERS).concat(ADDON_NOTIFICATIONS_PROVIDERS)
|
||||||
.concat(ADDON_PUSHNOTIFICATIONS_PROVIDERS).concat(ADDON_REMOTETHEMES_PROVIDERS).concat(CORE_BLOCK_PROVIDERS);
|
.concat(CORE_PUSHNOTIFICATIONS_PROVIDERS).concat(ADDON_REMOTETHEMES_PROVIDERS).concat(CORE_BLOCK_PROVIDERS);
|
||||||
|
|
||||||
// We cannot inject anything to this constructor. Use the Injector to inject all the providers into the instance.
|
// We cannot inject anything to this constructor. Use the Injector to inject all the providers into the instance.
|
||||||
for (const i in providers) {
|
for (const i in providers) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreSitesProvider, CoreSiteBasicInfo } from '@providers/sites';
|
import { CoreSitesProvider, CoreSiteBasicInfo } from '@providers/sites';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||||
import { AddonPushNotificationsProvider } from '@addon/pushnotifications/providers/pushnotifications';
|
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
|
||||||
import { CoreLoginHelperProvider } from '../../providers/helper';
|
import { CoreLoginHelperProvider } from '../../providers/helper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ export class CoreLoginSitesPage {
|
||||||
|
|
||||||
constructor(private domUtils: CoreDomUtilsProvider, private textUtils: CoreTextUtilsProvider,
|
constructor(private domUtils: CoreDomUtilsProvider, private textUtils: CoreTextUtilsProvider,
|
||||||
private sitesProvider: CoreSitesProvider, private loginHelper: CoreLoginHelperProvider, logger: CoreLoggerProvider,
|
private sitesProvider: CoreSitesProvider, private loginHelper: CoreLoginHelperProvider, logger: CoreLoggerProvider,
|
||||||
private translate: TranslateService, private pushNotificationsProvider: AddonPushNotificationsProvider) {
|
private translate: TranslateService, private pushNotificationsProvider: CorePushNotificationsProvider) {
|
||||||
this.logger = logger.getInstance('CoreLoginSitesPage');
|
this.logger = logger.getInstance('CoreLoginSitesPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,14 @@ import { Subject } from 'rxjs';
|
||||||
* Service to handle push notifications actions to perform when clicked and received.
|
* Service to handle push notifications actions to perform when clicked and received.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AddonPushNotificationsDelegate {
|
export class CorePushNotificationsDelegate {
|
||||||
|
|
||||||
protected logger;
|
protected logger;
|
||||||
protected observables: { [s: string]: Subject<any> } = {};
|
protected observables: { [s: string]: Subject<any> } = {};
|
||||||
protected counterHandlers: { [s: string]: string } = {};
|
protected counterHandlers: { [s: string]: string } = {};
|
||||||
|
|
||||||
constructor(loggerProvider: CoreLoggerProvider) {
|
constructor(loggerProvider: CoreLoggerProvider) {
|
||||||
this.logger = loggerProvider.getInstance('AddonPushNotificationsDelegate');
|
this.logger = loggerProvider.getInstance('CorePushNotificationsDelegate');
|
||||||
this.observables['click'] = new Subject<any>();
|
this.observables['click'] = new Subject<any>();
|
||||||
this.observables['receive'] = new Subject<any>();
|
this.observables['receive'] = new Subject<any>();
|
||||||
}
|
}
|
|
@ -23,7 +23,7 @@ import { CoreInitDelegate } from '@providers/init';
|
||||||
import { CoreLoggerProvider } from '@providers/logger';
|
import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreSitesProvider, CoreSiteSchema } from '@providers/sites';
|
import { CoreSitesProvider, CoreSiteSchema } from '@providers/sites';
|
||||||
import { CoreSitesFactoryProvider } from '@providers/sites-factory';
|
import { CoreSitesFactoryProvider } from '@providers/sites-factory';
|
||||||
import { AddonPushNotificationsDelegate } from './delegate';
|
import { CorePushNotificationsDelegate } from './delegate';
|
||||||
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||||
|
@ -37,7 +37,7 @@ import { CoreSite } from '@classes/site';
|
||||||
/**
|
/**
|
||||||
* Data needed to register a device in a Moodle site.
|
* Data needed to register a device in a Moodle site.
|
||||||
*/
|
*/
|
||||||
export interface AddonPushNotificationsRegisterData {
|
export interface CorePushNotificationsRegisterData {
|
||||||
/**
|
/**
|
||||||
* App ID.
|
* App ID.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -85,19 +85,19 @@ export interface AddonPushNotificationsRegisterData {
|
||||||
* Service to handle push notifications.
|
* Service to handle push notifications.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AddonPushNotificationsProvider {
|
export class CorePushNotificationsProvider {
|
||||||
protected logger;
|
protected logger;
|
||||||
protected pushID: string;
|
protected pushID: string;
|
||||||
protected appDB: SQLiteDB;
|
protected appDB: SQLiteDB;
|
||||||
static COMPONENT = 'AddonPushNotificationsProvider';
|
static COMPONENT = 'CorePushNotificationsProvider';
|
||||||
|
|
||||||
// Variables for database.
|
// Variables for database. The name still contains the name "addon" for backwards compatibility.
|
||||||
static BADGE_TABLE = 'addon_pushnotifications_badge';
|
static BADGE_TABLE = 'addon_pushnotifications_badge';
|
||||||
static PENDING_UNREGISTER_TABLE = 'addon_pushnotifications_pending_unregister';
|
static PENDING_UNREGISTER_TABLE = 'addon_pushnotifications_pending_unregister';
|
||||||
static REGISTERED_DEVICES_TABLE = 'addon_pushnotifications_registered_devices';
|
static REGISTERED_DEVICES_TABLE = 'addon_pushnotifications_registered_devices';
|
||||||
protected appTablesSchema: SQLiteDBTableSchema[] = [
|
protected appTablesSchema: SQLiteDBTableSchema[] = [
|
||||||
{
|
{
|
||||||
name: AddonPushNotificationsProvider.BADGE_TABLE,
|
name: CorePushNotificationsProvider.BADGE_TABLE,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'siteid',
|
name: 'siteid',
|
||||||
|
@ -115,7 +115,7 @@ export class AddonPushNotificationsProvider {
|
||||||
primaryKeys: ['siteid', 'addon']
|
primaryKeys: ['siteid', 'addon']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: AddonPushNotificationsProvider.PENDING_UNREGISTER_TABLE,
|
name: CorePushNotificationsProvider.PENDING_UNREGISTER_TABLE,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'siteid',
|
name: 'siteid',
|
||||||
|
@ -138,11 +138,11 @@ export class AddonPushNotificationsProvider {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
protected siteSchema: CoreSiteSchema = {
|
protected siteSchema: CoreSiteSchema = {
|
||||||
name: 'AddonPushNotificationsProvider',
|
name: 'AddonPushNotificationsProvider', // The name still contains "Addon" for backwards compatibility.
|
||||||
version: 1,
|
version: 1,
|
||||||
tables: [
|
tables: [
|
||||||
{
|
{
|
||||||
name: AddonPushNotificationsProvider.REGISTERED_DEVICES_TABLE,
|
name: CorePushNotificationsProvider.REGISTERED_DEVICES_TABLE,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'appid',
|
name: 'appid',
|
||||||
|
@ -179,12 +179,12 @@ export class AddonPushNotificationsProvider {
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(logger: CoreLoggerProvider, protected appProvider: CoreAppProvider, private initDelegate: CoreInitDelegate,
|
constructor(logger: CoreLoggerProvider, protected appProvider: CoreAppProvider, private initDelegate: CoreInitDelegate,
|
||||||
protected pushNotificationsDelegate: AddonPushNotificationsDelegate, protected sitesProvider: CoreSitesProvider,
|
protected pushNotificationsDelegate: CorePushNotificationsDelegate, protected sitesProvider: CoreSitesProvider,
|
||||||
private badge: Badge, private localNotificationsProvider: CoreLocalNotificationsProvider,
|
private badge: Badge, private localNotificationsProvider: CoreLocalNotificationsProvider,
|
||||||
private utils: CoreUtilsProvider, private textUtils: CoreTextUtilsProvider, private push: Push,
|
private utils: CoreUtilsProvider, private textUtils: CoreTextUtilsProvider, private push: Push,
|
||||||
private configProvider: CoreConfigProvider, private device: Device, private zone: NgZone,
|
private configProvider: CoreConfigProvider, private device: Device, private zone: NgZone,
|
||||||
private translate: TranslateService, private platform: Platform, private sitesFactory: CoreSitesFactoryProvider) {
|
private translate: TranslateService, private platform: Platform, private sitesFactory: CoreSitesFactoryProvider) {
|
||||||
this.logger = logger.getInstance('AddonPushNotificationsProvider');
|
this.logger = logger.getInstance('CorePushNotificationsProvider');
|
||||||
this.appDB = appProvider.getDB();
|
this.appDB = appProvider.getDB();
|
||||||
this.appDB.createTablesFromSchema(this.appTablesSchema);
|
this.appDB.createTablesFromSchema(this.appTablesSchema);
|
||||||
this.sitesProvider.registerSiteSchema(this.siteSchema);
|
this.sitesProvider.registerSiteSchema(this.siteSchema);
|
||||||
|
@ -207,7 +207,7 @@ export class AddonPushNotificationsProvider {
|
||||||
* @return {Promise<any>} Resolved when done.
|
* @return {Promise<any>} Resolved when done.
|
||||||
*/
|
*/
|
||||||
cleanSiteCounters(siteId: string): Promise<any> {
|
cleanSiteCounters(siteId: string): Promise<any> {
|
||||||
return this.appDB.deleteRecords(AddonPushNotificationsProvider.BADGE_TABLE, {siteid: siteId} ).finally(() => {
|
return this.appDB.deleteRecords(CorePushNotificationsProvider.BADGE_TABLE, {siteid: siteId} ).finally(() => {
|
||||||
this.updateAppCounter();
|
this.updateAppCounter();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -267,9 +267,9 @@ export class AddonPushNotificationsProvider {
|
||||||
/**
|
/**
|
||||||
* Get data to register the device in Moodle.
|
* Get data to register the device in Moodle.
|
||||||
*
|
*
|
||||||
* @return {AddonPushNotificationsRegisterData} Data.
|
* @return {CorePushNotificationsRegisterData} Data.
|
||||||
*/
|
*/
|
||||||
protected getRegisterData(): AddonPushNotificationsRegisterData {
|
protected getRegisterData(): CorePushNotificationsRegisterData {
|
||||||
return {
|
return {
|
||||||
appid: CoreConfigConstants.app_id,
|
appid: CoreConfigConstants.app_id,
|
||||||
name: this.device.manufacturer || '',
|
name: this.device.manufacturer || '',
|
||||||
|
@ -338,7 +338,7 @@ export class AddonPushNotificationsProvider {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
this.localNotificationsProvider.schedule(localNotif, AddonPushNotificationsProvider.COMPONENT, data.site);
|
this.localNotificationsProvider.schedule(localNotif, CorePushNotificationsProvider.COMPONENT, data.site);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,11 +381,11 @@ export class AddonPushNotificationsProvider {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
// Remove the device from the local DB.
|
// Remove the device from the local DB.
|
||||||
promises.push(site.getDb().deleteRecords(AddonPushNotificationsProvider.REGISTERED_DEVICES_TABLE,
|
promises.push(site.getDb().deleteRecords(CorePushNotificationsProvider.REGISTERED_DEVICES_TABLE,
|
||||||
this.getRegisterData()));
|
this.getRegisterData()));
|
||||||
|
|
||||||
// Remove pending unregisters for this site.
|
// Remove pending unregisters for this site.
|
||||||
promises.push(this.appDB.deleteRecords(AddonPushNotificationsProvider.PENDING_UNREGISTER_TABLE, {siteid: site.id}));
|
promises.push(this.appDB.deleteRecords(CorePushNotificationsProvider.PENDING_UNREGISTER_TABLE, {siteid: site.id}));
|
||||||
|
|
||||||
return Promise.all(promises).catch(() => {
|
return Promise.all(promises).catch(() => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
|
@ -397,7 +397,7 @@ export class AddonPushNotificationsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the pending unregister so it's retried again later.
|
// Store the pending unregister so it's retried again later.
|
||||||
return this.appDB.insertRecord(AddonPushNotificationsProvider.PENDING_UNREGISTER_TABLE, {
|
return this.appDB.insertRecord(CorePushNotificationsProvider.PENDING_UNREGISTER_TABLE, {
|
||||||
siteid: site.id,
|
siteid: site.id,
|
||||||
siteurl: site.getURL(),
|
siteurl: site.getURL(),
|
||||||
token: site.getToken(),
|
token: site.getToken(),
|
||||||
|
@ -587,7 +587,7 @@ export class AddonPushNotificationsProvider {
|
||||||
// Now register the device.
|
// Now register the device.
|
||||||
return site.write('core_user_add_user_device', this.utils.clone(data)).then((response) => {
|
return site.write('core_user_add_user_device', this.utils.clone(data)).then((response) => {
|
||||||
// Insert the device in the local DB.
|
// Insert the device in the local DB.
|
||||||
return site.getDb().insertRecord(AddonPushNotificationsProvider.REGISTERED_DEVICES_TABLE, data)
|
return site.getDb().insertRecord(CorePushNotificationsProvider.REGISTERED_DEVICES_TABLE, data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
});
|
});
|
||||||
|
@ -595,7 +595,7 @@ export class AddonPushNotificationsProvider {
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
// Remove pending unregisters for this site.
|
// Remove pending unregisters for this site.
|
||||||
this.appDB.deleteRecords(AddonPushNotificationsProvider.PENDING_UNREGISTER_TABLE, {siteid: site.id}).catch(() => {
|
this.appDB.deleteRecords(CorePushNotificationsProvider.PENDING_UNREGISTER_TABLE, {siteid: site.id}).catch(() => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -609,7 +609,7 @@ export class AddonPushNotificationsProvider {
|
||||||
* @return {Promise<any>} Promise resolved with the stored badge counter for the addon or site or 0 if none.
|
* @return {Promise<any>} Promise resolved with the stored badge counter for the addon or site or 0 if none.
|
||||||
*/
|
*/
|
||||||
protected getAddonBadge(siteId?: string, addon: string = 'site'): Promise<any> {
|
protected getAddonBadge(siteId?: string, addon: string = 'site'): Promise<any> {
|
||||||
return this.appDB.getRecord(AddonPushNotificationsProvider.BADGE_TABLE, {siteid: siteId, addon: addon}).then((entry) => {
|
return this.appDB.getRecord(CorePushNotificationsProvider.BADGE_TABLE, {siteid: siteId, addon: addon}).then((entry) => {
|
||||||
return (entry && entry.number) || 0;
|
return (entry && entry.number) || 0;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -627,10 +627,10 @@ export class AddonPushNotificationsProvider {
|
||||||
|
|
||||||
if (siteId) {
|
if (siteId) {
|
||||||
// Check if the site has a pending unregister.
|
// Check if the site has a pending unregister.
|
||||||
promise = this.appDB.getRecords(AddonPushNotificationsProvider.REGISTERED_DEVICES_TABLE, {siteid: siteId});
|
promise = this.appDB.getRecords(CorePushNotificationsProvider.REGISTERED_DEVICES_TABLE, {siteid: siteId});
|
||||||
} else {
|
} else {
|
||||||
// Get all pending unregisters.
|
// Get all pending unregisters.
|
||||||
promise = this.appDB.getAllRecords(AddonPushNotificationsProvider.PENDING_UNREGISTER_TABLE);
|
promise = this.appDB.getAllRecords(CorePushNotificationsProvider.PENDING_UNREGISTER_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then((results) => {
|
return promise.then((results) => {
|
||||||
|
@ -665,7 +665,7 @@ export class AddonPushNotificationsProvider {
|
||||||
number: value
|
number: value
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.appDB.insertRecord(AddonPushNotificationsProvider.BADGE_TABLE, entry).then(() => {
|
return this.appDB.insertRecord(CorePushNotificationsProvider.BADGE_TABLE, entry).then(() => {
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -673,21 +673,21 @@ export class AddonPushNotificationsProvider {
|
||||||
/**
|
/**
|
||||||
* Check if device should be registered (and unregistered first).
|
* Check if device should be registered (and unregistered first).
|
||||||
*
|
*
|
||||||
* @param {AddonPushNotificationsRegisterData} data Data of the device.
|
* @param {CorePushNotificationsRegisterData} data Data of the device.
|
||||||
* @param {CoreSite} site Site to use.
|
* @param {CoreSite} site Site to use.
|
||||||
* @return {Promise<{register: boolean, unregister: boolean}>} Promise resolved with booleans: whether to register/unregister.
|
* @return {Promise<{register: boolean, unregister: boolean}>} Promise resolved with booleans: whether to register/unregister.
|
||||||
*/
|
*/
|
||||||
protected shouldRegister(data: AddonPushNotificationsRegisterData, site: CoreSite)
|
protected shouldRegister(data: CorePushNotificationsRegisterData, site: CoreSite)
|
||||||
: Promise<{register: boolean, unregister: boolean}> {
|
: Promise<{register: boolean, unregister: boolean}> {
|
||||||
|
|
||||||
// Check if the device is already registered.
|
// Check if the device is already registered.
|
||||||
return site.getDb().getRecords(AddonPushNotificationsProvider.REGISTERED_DEVICES_TABLE, {
|
return site.getDb().getRecords(CorePushNotificationsProvider.REGISTERED_DEVICES_TABLE, {
|
||||||
appid: data.appid,
|
appid: data.appid,
|
||||||
uuid: data.uuid
|
uuid: data.uuid
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
return [];
|
return [];
|
||||||
}).then((records: AddonPushNotificationsRegisterData[]) => {
|
}).then((records: CorePushNotificationsRegisterData[]) => {
|
||||||
let isStored = false,
|
let isStored = false,
|
||||||
versionOrPushChanged = false;
|
versionOrPushChanged = false;
|
||||||
|
|
|
@ -14,16 +14,16 @@
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreCronHandler } from '@providers/cron';
|
import { CoreCronHandler } from '@providers/cron';
|
||||||
import { AddonPushNotificationsProvider } from './pushnotifications';
|
import { CorePushNotificationsProvider } from './pushnotifications';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cron handler to force a register on a Moodle site when a site is manually synchronized.
|
* Cron handler to force a register on a Moodle site when a site is manually synchronized.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AddonPushNotificationsRegisterCronHandler implements CoreCronHandler {
|
export class CorePushNotificationsRegisterCronHandler implements CoreCronHandler {
|
||||||
name = 'AddonPushNotificationsRegisterCronHandler';
|
name = 'CorePushNotificationsRegisterCronHandler';
|
||||||
|
|
||||||
constructor(private pushNotificationsProvider: AddonPushNotificationsProvider) {}
|
constructor(private pushNotificationsProvider: CorePushNotificationsProvider) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the sync can be executed manually. Call isSync if not defined.
|
* Check whether the sync can be executed manually. Call isSync if not defined.
|
|
@ -14,16 +14,16 @@
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreCronHandler } from '@providers/cron';
|
import { CoreCronHandler } from '@providers/cron';
|
||||||
import { AddonPushNotificationsProvider } from './pushnotifications';
|
import { CorePushNotificationsProvider } from './pushnotifications';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cron handler to retry pending unregisters.
|
* Cron handler to retry pending unregisters.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AddonPushNotificationsUnregisterCronHandler implements CoreCronHandler {
|
export class CorePushNotificationsUnregisterCronHandler implements CoreCronHandler {
|
||||||
name = 'AddonPushNotificationsUnregisterCronHandler';
|
name = 'CorePushNotificationsUnregisterCronHandler';
|
||||||
|
|
||||||
constructor(private pushNotificationsProvider: AddonPushNotificationsProvider) {}
|
constructor(private pushNotificationsProvider: CorePushNotificationsProvider) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the process.
|
* Execute the process.
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Platform } from 'ionic-angular';
|
import { Platform } from 'ionic-angular';
|
||||||
import { AddonPushNotificationsProvider } from './providers/pushnotifications';
|
import { CorePushNotificationsProvider } from './providers/pushnotifications';
|
||||||
import { AddonPushNotificationsDelegate } from './providers/delegate';
|
import { CorePushNotificationsDelegate } from './providers/delegate';
|
||||||
import { AddonPushNotificationsRegisterCronHandler } from './providers/register-cron-handler';
|
import { CorePushNotificationsRegisterCronHandler } from './providers/register-cron-handler';
|
||||||
import { AddonPushNotificationsUnregisterCronHandler } from './providers/unregister-cron-handler';
|
import { CorePushNotificationsUnregisterCronHandler } from './providers/unregister-cron-handler';
|
||||||
import { CoreCronDelegate } from '@providers/cron';
|
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';
|
||||||
|
@ -25,9 +25,9 @@ import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
export const CORE_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
||||||
AddonPushNotificationsProvider,
|
CorePushNotificationsProvider,
|
||||||
AddonPushNotificationsDelegate
|
CorePushNotificationsDelegate
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -36,20 +36,20 @@ export const ADDON_PUSHNOTIFICATIONS_PROVIDERS: any[] = [
|
||||||
imports: [
|
imports: [
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
AddonPushNotificationsProvider,
|
CorePushNotificationsProvider,
|
||||||
AddonPushNotificationsDelegate,
|
CorePushNotificationsDelegate,
|
||||||
AddonPushNotificationsRegisterCronHandler,
|
CorePushNotificationsRegisterCronHandler,
|
||||||
AddonPushNotificationsUnregisterCronHandler
|
CorePushNotificationsUnregisterCronHandler
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AddonPushNotificationsModule {
|
export class CorePushNotificationsModule {
|
||||||
constructor(platform: Platform, pushNotificationsProvider: AddonPushNotificationsProvider, eventsProvider: CoreEventsProvider,
|
constructor(platform: Platform, pushNotificationsProvider: CorePushNotificationsProvider, eventsProvider: CoreEventsProvider,
|
||||||
localNotificationsProvider: CoreLocalNotificationsProvider, loggerProvider: CoreLoggerProvider,
|
localNotificationsProvider: CoreLocalNotificationsProvider, loggerProvider: CoreLoggerProvider,
|
||||||
updateManager: CoreUpdateManagerProvider, cronDelegate: CoreCronDelegate,
|
updateManager: CoreUpdateManagerProvider, cronDelegate: CoreCronDelegate,
|
||||||
registerCronHandler: AddonPushNotificationsRegisterCronHandler,
|
registerCronHandler: CorePushNotificationsRegisterCronHandler,
|
||||||
unregisterCronHandler: AddonPushNotificationsUnregisterCronHandler) {
|
unregisterCronHandler: CorePushNotificationsUnregisterCronHandler) {
|
||||||
|
|
||||||
const logger = loggerProvider.getInstance('AddonPushNotificationsModule');
|
const logger = loggerProvider.getInstance('CorePushNotificationsModule');
|
||||||
|
|
||||||
// Register the handlers.
|
// Register the handlers.
|
||||||
cronDelegate.register(registerCronHandler);
|
cronDelegate.register(registerCronHandler);
|
||||||
|
@ -80,13 +80,13 @@ export class AddonPushNotificationsModule {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for local notification clicks (generated by the app).
|
// Listen for local notification clicks (generated by the app).
|
||||||
localNotificationsProvider.registerClick(AddonPushNotificationsProvider.COMPONENT,
|
localNotificationsProvider.registerClick(CorePushNotificationsProvider.COMPONENT,
|
||||||
pushNotificationsProvider.notificationClicked.bind(pushNotificationsProvider));
|
pushNotificationsProvider.notificationClicked.bind(pushNotificationsProvider));
|
||||||
|
|
||||||
// Allow migrating the table from the old app to the new schema.
|
// Allow migrating the table from the old app to the new schema.
|
||||||
updateManager.registerAppTableMigration({
|
updateManager.registerAppTableMigration({
|
||||||
name: 'mma_pushnotifications_badge',
|
name: 'mma_pushnotifications_badge',
|
||||||
newName: AddonPushNotificationsProvider.BADGE_TABLE,
|
newName: CorePushNotificationsProvider.BADGE_TABLE,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'siteid',
|
name: 'siteid',
|
||||||
|
@ -96,6 +96,6 @@ export class AddonPushNotificationsModule {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Migrate the component name.
|
// Migrate the component name.
|
||||||
updateManager.registerLocalNotifComponentMigration('mmaPushNotifications', AddonPushNotificationsProvider.COMPONENT);
|
updateManager.registerLocalNotifComponentMigration('mmaPushNotifications', CorePushNotificationsProvider.COMPONENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@ import { CoreLangProvider } from '@providers/lang';
|
||||||
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreConfigConstants } from '../../../../configconstants';
|
import { CoreConfigConstants } from '../../../../configconstants';
|
||||||
import { AddonPushNotificationsProvider } from '@addon/pushnotifications/providers/pushnotifications';
|
import { CorePushNotificationsProvider } from '@core/pushnotifications/providers/pushnotifications';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the about settings.
|
* Page that displays the about settings.
|
||||||
|
@ -58,7 +58,7 @@ export class CoreSettingsAboutPage {
|
||||||
|
|
||||||
constructor(platform: Platform, device: Device, appProvider: CoreAppProvider, fileProvider: CoreFileProvider,
|
constructor(platform: Platform, device: Device, appProvider: CoreAppProvider, fileProvider: CoreFileProvider,
|
||||||
initDelegate: CoreInitDelegate, langProvider: CoreLangProvider, sitesProvider: CoreSitesProvider,
|
initDelegate: CoreInitDelegate, langProvider: CoreLangProvider, sitesProvider: CoreSitesProvider,
|
||||||
localNotificationsProvider: CoreLocalNotificationsProvider, pushNotificationsProvider: AddonPushNotificationsProvider) {
|
localNotificationsProvider: CoreLocalNotificationsProvider, pushNotificationsProvider: CorePushNotificationsProvider) {
|
||||||
|
|
||||||
const currentSite = sitesProvider.getCurrentSite();
|
const currentSite = sitesProvider.getCurrentSite();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
This files describes API changes in the Moodle Mobile app,
|
This files describes API changes in the Moodle Mobile app,
|
||||||
information provided here is intended especially for developers.
|
information provided here is intended especially for developers.
|
||||||
|
|
||||||
|
=== 3.7.0 ===
|
||||||
|
|
||||||
|
- The pushnotifications addon has been moved to core. All imports of that addon need to be fixed to use the right path and name.
|
||||||
|
|
||||||
=== 3.6.1 ===
|
=== 3.6.1 ===
|
||||||
|
|
||||||
- The local notifications plugin was updated to its latest version. The new API has some breaking changes, so please check its documentation if you're using local notifications. Also, you need to run "npm install" to update the ionic-native library.
|
- The local notifications plugin was updated to its latest version. The new API has some breaking changes, so please check its documentation if you're using local notifications. Also, you need to run "npm install" to update the ionic-native library.
|
||||||
|
|
Loading…
Reference in New Issue