@nitra/cap 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cap",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Nitra capacitor components",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -20,6 +20,7 @@
20
20
  "@capacitor-firebase/messaging": "^6.1.0",
21
21
  "@capacitor/core": "^6.1.2",
22
22
  "@capawesome/capacitor-app-update": "^6.0.0",
23
- "firebase": "^10.13.1"
23
+ "@firebase/app": "^0.10.11",
24
+ "firebase": "^10.13.2"
24
25
  }
25
26
  }
@@ -1,3 +1,13 @@
1
1
  import { getMessaging } from 'firebase/messaging/sw'
2
- // eslint-disable-next-line no-unused-vars
3
- const messaging = getMessaging()
2
+ import { initializeApp } from "firebase/app"
3
+
4
+ const firebaseApp = initializeApp({
5
+ apiKey: import.meta.env.VITE_API_KEY,
6
+ authDomain: import.meta.env.VITE_AUTH_DOMAIN,
7
+ projectId: import.meta.env.VITE_PROJECT_ID,
8
+ storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
9
+ messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
10
+ appId: import.meta.env.VITE_APP_ID
11
+ })
12
+
13
+ export const messaging = getMessaging(firebaseApp)
@@ -1,6 +1,7 @@
1
1
  import { Capacitor } from '@capacitor/core'
2
2
  import { FirebaseMessaging } from '@capacitor-firebase/messaging'
3
3
  import { getToken } from '@nitra/vite-boot/token'
4
+ import { initializeApp } from "firebase/app"
4
5
 
5
6
  /**
6
7
  * Save the Firebase push token for a given app and platform.
@@ -14,6 +15,15 @@ export async function saveToken() {
14
15
  return
15
16
  }
16
17
 
18
+ initializeApp({
19
+ apiKey: import.meta.env.VITE_API_KEY,
20
+ authDomain: import.meta.env.VITE_AUTH_DOMAIN,
21
+ projectId: import.meta.env.VITE_PROJECT_ID,
22
+ storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
23
+ messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
24
+ appId: import.meta.env.VITE_APP_ID
25
+ })
26
+
17
27
  if (!Capacitor.isPluginAvailable('FirebaseMessaging')) {
18
28
  console.error('FirebaseMessaging plugin is not available')
19
29