Skip to content

Commit

Permalink
fix(notifications): remove XMPP support
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgxvii committed Feb 6, 2023
1 parent 2a19610 commit d36be7f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 156 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Certain values can be overriden using Firebase Remote Config. Specifically, the
| `platform_instance` | Title of RADAR Base / platform instance | `RADAR-CNS` |
| `participant_attribute_order` | Map that specifies the order in which the attributes are matched with the protocol path | `{Human-readable-identifier: -1}` |
| `schedule_year_coverage` | Schedule coverage in years (length of schedule to generate tasks until) | `3` |
| `notification_messaging_type` | Notifications type (either 'FCM_XMPP', 'FCM_REST' or 'LOCAL' notifications) | `FCM_XMPP` |
| `notification_messaging_type` | Notifications type (either 'FCM_REST' or 'LOCAL' notifications) | `FCM_REST` |
| `app_server_url` | Default app server url. | `{DefaultEndPoint + '/appserver'}` |
| `github_fetch_strategy` | Default Github fetch strategy for Github requests (default or appserver). | `default` |
| `app_credits_title` | Title of the popup box that appears when you tap on the app logo on the left hand side of the homepage. | `Credits` |
Expand Down Expand Up @@ -199,8 +199,8 @@ export const DefaultEndPoint = 'https://your-hosted-radar-platform-base-url/'
The default appserver configs.

```ts
// The notification type (either 'FCM_XMPP', 'FCM_REST' or 'LOCAL' notifications)
export const DefaultNotificationType: string = 'FCM_XMPP'
// The notification type (either 'FCM_REST' or 'LOCAL' notifications)
export const DefaultNotificationType: string = 'FCM_REST'

// App server URL
export const DefaultAppServerURL = DefaultEndPoint + '/appserver'
Expand Down
21 changes: 2 additions & 19 deletions src/app/core/services/notifications/fcm-notification.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core'
import { FirebaseX } from '@ionic-native/firebase-x/ngx'
import { Platform } from 'ionic-angular'
import { Subscription } from "rxjs";

import {
DefaultNotificationTtlMinutes,
Expand All @@ -16,9 +17,6 @@ import { SubjectConfigService } from '../config/subject-config.service'
import { LogService } from '../misc/log.service'
import { StorageService } from '../storage/storage.service'
import { NotificationService } from './notification.service'
import { Subscription } from "rxjs";

declare var FirebasePlugin

@Injectable()
export abstract class FcmNotificationService extends NotificationService {
Expand Down Expand Up @@ -53,12 +51,7 @@ export abstract class FcmNotificationService extends NotificationService {
}

init() {
if (!this.platform.is('ios'))
FirebasePlugin.setDeliveryMetricsExportToBigQuery(true)
return Promise.all([
this.firebase.setAutoInitEnabled(true),
this.setSenderIdPromise(),
])
return this.firebase.setAutoInitEnabled(true)
.then(() => this.firebase.getToken())
.then(token => {
if (this.tokenSubscription === null) {
Expand All @@ -72,16 +65,6 @@ export abstract class FcmNotificationService extends NotificationService {
})
}

setSenderIdPromise(): Promise<void> {
return new Promise((resolve, reject) =>
FirebasePlugin.setSenderId(FCMPluginProjectSenderId, resolve, reject))
.then(() => this.logger.log('[NOTIFICATION SERVICE] Set sender id success'))
.catch(error => {
this.logger.error('Failed to set sender ID', error)
alert(error)
throw error
})
}

publish(
type,
Expand Down
128 changes: 0 additions & 128 deletions src/app/core/services/notifications/fcm-xmpp-notification.service.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { NotificationMessagingType } from '../../../shared/models/notification-h
import { RemoteConfigService } from '../config/remote-config.service'
import { StorageService } from '../storage/storage.service'
import { FcmRestNotificationService } from './fcm-rest-notification.service'
import { FcmXmppNotificationService } from './fcm-xmpp-notification.service'
import { LocalNotificationService } from './local-notification.service'
import { NotificationService } from './notification.service'

Expand All @@ -17,7 +16,6 @@ export class NotificationFactoryService extends NotificationService {

constructor(
public fcmRestNotificationService: FcmRestNotificationService,
public fcmXmppNotificationService: FcmXmppNotificationService,
public localNotificationService: LocalNotificationService,
private remoteConfig: RemoteConfigService,
private platform: Platform,
Expand All @@ -41,8 +39,6 @@ export class NotificationFactoryService extends NotificationService {
return (this.notificationService = this.localNotificationService)
case NotificationMessagingType.FCM_REST:
return (this.notificationService = this.fcmRestNotificationService)
case NotificationMessagingType.FCM_XMPP:
return (this.notificationService = this.fcmXmppNotificationService)
default:
throw new Error('No such notification service available')
}
Expand Down
4 changes: 2 additions & 2 deletions src/assets/data/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export const DefaultScheduleServiceType: string = 'LOCAL'

// DEFAULT NOTIFICATION SETUP

// *Default notification type (either 'FCM_XMPP', 'FCM_REST' or 'LOCAL' notifications)
export const DefaultNotificationType: string = 'FCM_XMPP'
// *Default notification type (either 'FCM_REST' or 'LOCAL' notifications)
export const DefaultNotificationType: string = 'FCM_REST'

// *Default app server URL
export const DefaultAppServerURL = DefaultEndPoint + '/appserver'
Expand Down

0 comments on commit d36be7f

Please sign in to comment.