|
| 1 | +import {getAnalytics, type Analytics} from "firebase/analytics"; |
1 | 2 | import {FirebaseApp, initializeApp} from "firebase/app"; |
2 | 3 | import {getMessaging, getToken, Messaging, onMessage} from "firebase/messaging"; |
3 | 4 | import Api from "./Api"; |
4 | 5 |
|
5 | 6 | const FIREBASE_CONFIG = { |
6 | | - apiKey: "AIzaSyAUwv7mr1FK5BEpzJzqH1Bkb9tSj3e0KXY", |
7 | | - authDomain: "adapt-chat.firebaseapp.com", |
8 | | - projectId: "adapt-chat", |
9 | | - storageBucket: "adapt-chat.appspot.com", |
10 | | - messagingSenderId: "464541692865", |
11 | | - appId: "1:464541692865:web:651cc571d8c787c0823540", |
12 | | - measurementId: "G-W32V7KR3TQ" |
| 7 | + apiKey: "AIzaSyCLxCU60cABrOneUgs2rQXIzNWl9MehBlQ", |
| 8 | + authDomain: "adapt-chat-2.firebaseapp.com", |
| 9 | + projectId: "adapt-chat-2", |
| 10 | + storageBucket: "adapt-chat-2.firebasestorage.app", |
| 11 | + messagingSenderId: "516583022231", |
| 12 | + appId: "1:516583022231:web:84baa083f9e35b5b4ad3d2", |
| 13 | + measurementId: "G-PRVX9CFT8Q" |
13 | 14 | } as const |
14 | 15 |
|
15 | | -const VAPID = 'BJ4XIJ_C9AHBXox8b5Ivm7F37ynaKEz0EAui1U9TwUWTs_qgnpz6PD3bVOaFNo9lToqe5dmhLZKT5SYyahpKRow' |
| 16 | +const VAPID = 'BAsaxzVjW2JLuRBkJpAByKG994vxkMrYBX8DLyTYqXT3beoPx2tY9hgEYWME_SsVQweXyAi1nYTUj81CMK0f6dQ' |
16 | 17 |
|
17 | 18 | /** |
18 | 19 | * Handles and subscribes to push notifications via Firebase |
19 | 20 | */ |
20 | 21 | export default class PushNotifications { |
21 | 22 | app: FirebaseApp |
22 | 23 | messaging: Messaging |
| 24 | + analytics: Analytics |
23 | 25 |
|
24 | 26 | constructor(public api: Api) { |
25 | 27 | this.app = initializeApp(FIREBASE_CONFIG) |
26 | 28 | this.messaging = getMessaging(this.app) |
| 29 | + this.analytics = getAnalytics(this.app) |
27 | 30 |
|
28 | 31 | onMessage(this.messaging, (payload) => { |
29 | 32 | console.log('[FIREBASE] Message received. ', payload) |
|
0 commit comments