Skip to content

Commit

Permalink
fix(pushNotifications): Prevent firebase app from initializing more t…
Browse files Browse the repository at this point in the history
…han one time
  • Loading branch information
sdimitris committed Jan 3, 2022
1 parent 6eb77a1 commit a971a0a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ export class FirebaseProvider implements IPushNotificationsProvider {
const firebaseOptions: firebase.AppOptions = {
credential: firebase.credential.cert(serviceAccount),
};
try {
this.fcm = firebase.app(serviceAccount.projectId).messaging();
} catch (e) {
this.fcm = firebase.initializeApp(firebaseOptions, serviceAccount.projectId).messaging();
}

this.fcm = firebase.initializeApp(firebaseOptions).messaging();
}

// TODO check for disabled notifications for users
Expand Down

0 comments on commit a971a0a

Please sign in to comment.