diff --git a/apps/demo/src/app.ts b/apps/demo/src/app.ts index 42e44922..4394a423 100644 --- a/apps/demo/src/app.ts +++ b/apps/demo/src/app.ts @@ -37,16 +37,19 @@ dynamicLinks.onLink((link) => { }); const messaging = firebase().messaging(); -messaging.onMessage((message) => { - console.log('Firebase onMessage', message); -}); -messaging.onNotificationTap((message) => { - console.log('Firebase onNotificationTap', message); -}); +Application.on('launch', (args) => { + messaging.onMessage((message) => { + console.log('Firebase onMessage', message); + }); -messaging.onToken((token) => { - console.log('Firebase onToken', token); + messaging.onNotificationTap((message) => { + console.log('Firebase onNotificationTap', message); + }); + + messaging.onToken((token) => { + console.log('Firebase onToken', token); + }); }); messaging diff --git a/apps/demo/src/main-view-model.ts b/apps/demo/src/main-view-model.ts index 27d990dd..ffba07e6 100644 --- a/apps/demo/src/main-view-model.ts +++ b/apps/demo/src/main-view-model.ts @@ -26,6 +26,9 @@ export class MainViewModel extends Observable { { name: 'firebase-app-check', }, + { + name: 'firebase-app-check-debug', + }, { name: 'firebase-in-app-messaging', }, @@ -38,9 +41,9 @@ export class MainViewModel extends Observable { { name: 'firebase-messaging', }, - { - name: 'firebase-firestore', - }, + { + name: 'firebase-firestore', + }, ]; viewDemo(args) { diff --git a/apps/demo/src/plugin-demos/firebase-admob.xml b/apps/demo/src/plugin-demos/firebase-admob.xml index eff58fe0..495f5fac 100644 --- a/apps/demo/src/plugin-demos/firebase-admob.xml +++ b/apps/demo/src/plugin-demos/firebase-admob.xml @@ -6,14 +6,14 @@ xmlns:ui="@nativescript/firebase-admob" - - + + \ No newline at end of file diff --git a/apps/demo/src/plugin-demos/firebase-app-check-debug.ts b/apps/demo/src/plugin-demos/firebase-app-check-debug.ts index a96642cd..247b738f 100644 --- a/apps/demo/src/plugin-demos/firebase-app-check-debug.ts +++ b/apps/demo/src/plugin-demos/firebase-app-check-debug.ts @@ -1,6 +1,7 @@ import { Observable, EventData, Page } from '@nativescript/core'; import { DemoSharedFirebaseAppCheckDebug } from '@demo/shared'; -import { } from '@nativescript/firebase-app-check-debug'; +import { firebase } from '@nativescript/firebase-core'; +import '@nativescript/firebase-app-check-debug'; export function navigatingTo(args: EventData) { const page = args.object; @@ -8,5 +9,19 @@ export function navigatingTo(args: EventData) { } export class DemoModel extends DemoSharedFirebaseAppCheckDebug { - + constructor() { + super(); + } + + testIt(): void { + firebase() + .appCheck() + .getToken(true) + .then((token) => { + console.log(token.token); + }) + .catch((error) => { + console.log(error); + }); + } } diff --git a/apps/demo/src/plugin-demos/firebase-database.ts b/apps/demo/src/plugin-demos/firebase-database.ts index 6a58269c..4e6922df 100644 --- a/apps/demo/src/plugin-demos/firebase-database.ts +++ b/apps/demo/src/plugin-demos/firebase-database.ts @@ -15,21 +15,25 @@ export class DemoModel extends DemoSharedFirebaseDatabase { super(); this.auth = firebase().auth(); this.database = firebase().database(); + } + + testIt(): void { this.transaction(); this.randomData(); this.children(); this.setData(); } - setData(){ + setData() { this.database - .ref('/person/me') - .set({ name: 'set', boolean: true , updated: new Date() }) - .then((value) => { - console.log('set some data', value); - }).catch(e =>{ - console.log('failed to set data', e); - }); + .ref('/person/me') + .set({ name: 'set', boolean: true, updated: new Date() }) + .then((value) => { + console.log('set some data', value); + }) + .catch((e) => { + console.log('failed to set data', e); + }); } randomData() { diff --git a/apps/demo/src/plugin-demos/firebase-firestore.ts b/apps/demo/src/plugin-demos/firebase-firestore.ts index 77d1d574..349dff89 100644 --- a/apps/demo/src/plugin-demos/firebase-firestore.ts +++ b/apps/demo/src/plugin-demos/firebase-firestore.ts @@ -11,7 +11,10 @@ export function navigatingTo(args: EventData) { export class DemoModel extends DemoSharedFirebaseFirestore { constructor() { super(); - Promise.all([this.init(),this.invalid_field_path()]); + } + + testIt(): void { + Promise.all([this.init(), this.invalid_field_path()]); } async init() { @@ -57,21 +60,20 @@ export class DemoModel extends DemoSharedFirebaseFirestore { const exampleDoc2 = firebase().firestore().collection('things').doc('exampleDoc2'); firebase() - .firestore() - .batch() - .set(exampleDoc, { - message: 'Hello doc', - }) - .set(exampleDoc2, { - date: new Date(), - }) - .commit() - .then(() => {}) - .catch((error) => { - console.error(error); - }); + .firestore() + .batch() + .set(exampleDoc, { + message: 'Hello doc', + }) + .set(exampleDoc2, { + date: new Date(), + }) + .commit() + .then(() => {}) + .catch((error) => { + console.error(error); + }); } - async invalid_field_path() { try { diff --git a/package.json b/package.json index 8e784ba9..6798af30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plugins", - "version": "1.2.2", + "version": "2.0.0", "license": "MIT", "scripts": { "postinstall": "husky install && npx ts-patch install", diff --git a/packages/firebase-admob/package.json b/packages/firebase-admob/package.json index d2f28172..d1ff73e8 100644 --- a/packages/firebase-admob/package.json +++ b/packages/firebase-admob/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-admob", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Admob", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-admob/platforms/android/include.gradle b/packages/firebase-admob/platforms/android/include.gradle index e9e417fa..e2065f96 100644 --- a/packages/firebase-admob/platforms/android/include.gradle +++ b/packages/firebase-admob/platforms/android/include.gradle @@ -1,4 +1,4 @@ dependencies { - implementation 'com.google.android.gms:play-services-ads:20.4.0' + implementation 'com.google.android.gms:play-services-ads:20.6.0' implementation 'com.google.android.ump:user-messaging-platform:2.0.0' } diff --git a/packages/firebase-admob/platforms/ios/Podfile b/packages/firebase-admob/platforms/ios/Podfile index 54485233..2949b551 100644 --- a/packages/firebase-admob/platforms/ios/Podfile +++ b/packages/firebase-admob/platforms/ios/Podfile @@ -1,2 +1,2 @@ use_frameworks! -pod 'Google-Mobile-Ads-SDK', '~> 8.10' \ No newline at end of file +pod 'Google-Mobile-Ads-SDK', '~> 9.5.0' \ No newline at end of file diff --git a/packages/firebase-analytics/package.json b/packages/firebase-analytics/package.json index dcb4cbfa..a9857eb8 100644 --- a/packages/firebase-analytics/package.json +++ b/packages/firebase-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-analytics", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Analytics", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-analytics/platforms/ios/Podfile b/packages/firebase-analytics/platforms/ios/Podfile index d9a87423..6bfab2d0 100644 --- a/packages/firebase-analytics/platforms/ios/Podfile +++ b/packages/firebase-analytics/platforms/ios/Podfile @@ -1,10 +1,11 @@ +platform :ios, '10.0' # Firebase dependencies if defined?($NSFirebaseAnalyticsWithoutAdIdSupport) Pod::UI.puts "Using Firebase/AnalyticsWithoutAdIdSupport pod in place of default Firebase/Analytics" - pod 'Firebase/AnalyticsWithoutAdIdSupport','~>8.6' + pod 'Firebase/AnalyticsWithoutAdIdSupport','~>9.0' else Pod::UI.puts "Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps." Pod::UI.puts "You may set variable `$NSFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids." - pod 'Firebase/Analytics','~>8.6' + pod 'Firebase/Analytics','~>9.0' end diff --git a/packages/firebase-app-check-debug/index.android.ts b/packages/firebase-app-check-debug/index.android.ts index 762505cb..23ccdd61 100644 --- a/packages/firebase-app-check-debug/index.android.ts +++ b/packages/firebase-app-check-debug/index.android.ts @@ -17,7 +17,7 @@ Object.defineProperty(fb, 'appCheck', { writable: false, }); -const NSAppCheck = lazy(() => org.nativescript.firebase.app_check_debug.FirebaseAppCheck); +const NSAppCheck = lazy(() => org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug); export class AppCheckToken implements IAppCheckToken { #native: com.google.firebase.appcheck.AppCheckToken; @@ -66,8 +66,7 @@ export class AppCheck implements IAppCheck { static setProviderFactory() {} activate(isTokenAutoRefreshEnabled: boolean) { - this.native.setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled); - this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory.getInstance()); + this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory.getInstance(), isTokenAutoRefreshEnabled); } getToken(forceRefresh: boolean): Promise { @@ -75,7 +74,7 @@ export class AppCheck implements IAppCheck { NSAppCheck().getToken( this.native, forceRefresh, - new org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback({ + new org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback({ onSuccess(param0) { resolve(AppCheckToken.fromNative(param0)); }, diff --git a/packages/firebase-app-check-debug/package.json b/packages/firebase-app-check-debug/package.json index 4e7c85a9..7ed06593 100644 --- a/packages/firebase-app-check-debug/package.json +++ b/packages/firebase-app-check-debug/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-app-check-debug", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - App Check", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-app-check-debug/platforms/android/include.gradle b/packages/firebase-app-check-debug/platforms/android/include.gradle index 1a93c0d2..778c6675 100644 --- a/packages/firebase-app-check-debug/platforms/android/include.gradle +++ b/packages/firebase-app-check-debug/platforms/android/include.gradle @@ -1,3 +1,3 @@ dependencies { - implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta04' + implementation 'com.google.firebase:firebase-appcheck-debug' } \ No newline at end of file diff --git a/packages/firebase-app-check-debug/platforms/ios/Podfile b/packages/firebase-app-check-debug/platforms/ios/Podfile index 2c8b8da0..45a1948f 100644 --- a/packages/firebase-app-check-debug/platforms/ios/Podfile +++ b/packages/firebase-app-check-debug/platforms/ios/Podfile @@ -1,2 +1,2 @@ platform :ios, '11.0' -pod 'Firebase/AppCheck', '~>8.6' \ No newline at end of file +pod 'Firebase/AppCheck', '~>9.0' \ No newline at end of file diff --git a/packages/firebase-app-check-debug/src-native/android/.idea/gradle.xml b/packages/firebase-app-check-debug/src-native/android/.idea/gradle.xml index 3f70b95d..ee5f3a90 100644 --- a/packages/firebase-app-check-debug/src-native/android/.idea/gradle.xml +++ b/packages/firebase-app-check-debug/src-native/android/.idea/gradle.xml @@ -1,5 +1,6 @@ + diff --git a/packages/firebase-app-check-debug/src-native/android/app_check_debug/build.gradle b/packages/firebase-app-check-debug/src-native/android/app_check_debug/build.gradle index 61b955cd..048792f8 100644 --- a/packages/firebase-app-check-debug/src-native/android/app_check_debug/build.gradle +++ b/packages/firebase-app-check-debug/src-native/android/app_check_debug/build.gradle @@ -33,7 +33,10 @@ dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.3.0' - implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta04' + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + implementation 'com.google.firebase:firebase-appcheck-debug' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/packages/firebase-app-check-debug/typings/org.nativescript.firebase.app_check.d.ts b/packages/firebase-app-check-debug/typings/org.nativescript.firebase.app_check.d.ts index c7fcfee6..c1ccf0f0 100644 --- a/packages/firebase-app-check-debug/typings/org.nativescript.firebase.app_check.d.ts +++ b/packages/firebase-app-check-debug/typings/org.nativescript.firebase.app_check.d.ts @@ -18,32 +18,29 @@ declare module org { export module nativescript { export module firebase { export module app_check_debug { - export class FirebaseAppCheck { - public static class: java.lang.Class; - public static Companion: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Companion; + export class FirebaseAppCheckDebug { + public static class: java.lang.Class; + public static Companion: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Companion; public constructor(); public static getExecutorsCount(): number; - public static getToken(param0: com.google.firebase.appcheck.FirebaseAppCheck, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback): void; + public static getToken(param0: com.google.firebase.appcheck.FirebaseAppCheckDebug, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback): void; public static setExecutorsCount(param0: number): void; } - export module FirebaseAppCheck { - export class Callback extends java.lang.Object { - public static class: java.lang.Class>; + export module FirebaseAppCheckDebug { + export class Callback extends java.lang.Object { + public static class: java.lang.Class>; /** - * Constructs a new instance of the org.nativescript.firebase.app_check_debug.FirebaseAppCheck$Callback interface with the provided implementation. An empty constructor exists calling super() when extending the interface class. + * Constructs a new instance of the org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug$Callback interface with the provided implementation. An empty constructor exists calling super() when extending the interface class. */ - public constructor(implementation: { - onSuccess(param0: T): void; - onError(param0: any): void; - }); + public constructor(implementation: { onSuccess(param0: T): void; onError(param0: any): void }); public constructor(); public onError(param0: any): void; public onSuccess(param0: T): void; } export class Companion { - public static class: java.lang.Class; + public static class: java.lang.Class; public setExecutorsCount(param0: number): void; - public getToken(param0: com.google.firebase.appcheck.FirebaseAppCheck, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback): void; + public getToken(param0: com.google.firebase.appcheck.FirebaseAppCheckDebug, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback): void; public getExecutorsCount(): number; } } @@ -53,5 +50,4 @@ declare module org { } //Generics information: -//org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback:1 - +//org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback:1 diff --git a/packages/firebase-app-check/package.json b/packages/firebase-app-check/package.json index 3cc00ca2..08978525 100644 --- a/packages/firebase-app-check/package.json +++ b/packages/firebase-app-check/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-app-check", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - App Check", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-app-check/platforms/android/include.gradle b/packages/firebase-app-check/platforms/android/include.gradle index 8d50468b..e1478106 100644 --- a/packages/firebase-app-check/platforms/android/include.gradle +++ b/packages/firebase-app-check/platforms/android/include.gradle @@ -1,3 +1,3 @@ dependencies { - implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0-beta02' + implementation 'com.google.firebase:firebase-appcheck-safetynet' } \ No newline at end of file diff --git a/packages/firebase-app-check/platforms/ios/Podfile b/packages/firebase-app-check/platforms/ios/Podfile index 2c8b8da0..45a1948f 100644 --- a/packages/firebase-app-check/platforms/ios/Podfile +++ b/packages/firebase-app-check/platforms/ios/Podfile @@ -1,2 +1,2 @@ platform :ios, '11.0' -pod 'Firebase/AppCheck', '~>8.6' \ No newline at end of file +pod 'Firebase/AppCheck', '~>9.0' \ No newline at end of file diff --git a/packages/firebase-app-check/src-native/android/app_check/build.gradle b/packages/firebase-app-check/src-native/android/app_check/build.gradle index a206438d..3d80507e 100644 --- a/packages/firebase-app-check/src-native/android/app_check/build.gradle +++ b/packages/firebase-app-check/src-native/android/app_check/build.gradle @@ -39,5 +39,8 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0-beta02' + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + implementation 'com.google.firebase:firebase-appcheck-safetynet' } diff --git a/packages/firebase-auth/index.ios.ts b/packages/firebase-auth/index.ios.ts index 4e79a42c..09874f52 100644 --- a/packages/firebase-auth/index.ios.ts +++ b/packages/firebase-auth/index.ios.ts @@ -697,8 +697,6 @@ export class PhoneAuthProvider { reject(); } else { this.native.verifyPhoneNumberUIDelegateCompletion(phoneNumber, null, (verificationId, error) => { - console.log('verifyPhoneNumberUIDelegateCompletion', verificationId, error); - console.log(UIApplication.sharedApplication.delegate.respondsToSelector('application:didReceiveRemoteNotification:fetchCompletionHandler')); if (error) { reject(FirebaseError.fromNative(error)); } else { diff --git a/packages/firebase-auth/package.json b/packages/firebase-auth/package.json index 361dca32..e1c23845 100644 --- a/packages/firebase-auth/package.json +++ b/packages/firebase-auth/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-auth", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Auth", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-auth/platforms/ios/Podfile b/packages/firebase-auth/platforms/ios/Podfile index b541f395..225af896 100644 --- a/packages/firebase-auth/platforms/ios/Podfile +++ b/packages/firebase-auth/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Auth','~>8.6' \ No newline at end of file +pod 'Firebase/Auth','~>9.0' \ No newline at end of file diff --git a/packages/firebase-auth/src-native/android/firebaseauth/build.gradle b/packages/firebase-auth/src-native/android/firebaseauth/build.gradle index 28c114c2..283a24b1 100644 --- a/packages/firebase-auth/src-native/android/firebaseauth/build.gradle +++ b/packages/firebase-auth/src-native/android/firebaseauth/build.gradle @@ -39,8 +39,8 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } - implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'com.google.firebase:firebase-auth' } diff --git a/packages/firebase-core/index.android.ts b/packages/firebase-core/index.android.ts index d11439fe..fd66eb8d 100644 --- a/packages/firebase-core/index.android.ts +++ b/packages/firebase-core/index.android.ts @@ -1,5 +1,5 @@ import { IFirebaseOptions, FirebaseConfig } from './common'; -import { knownFolders, Utils } from '@nativescript/core'; +import { Application, knownFolders, Utils } from '@nativescript/core'; export * from './utils'; declare const __non_webpack_require__; export class FirebaseError extends Error { @@ -174,11 +174,33 @@ export class FirebaseApp { } export class Firebase { + static #onResumeQueue = []; + static addToResumeQueue(callback: () => void) { + if (typeof callback !== 'function') { + return; + } + Firebase.#onResumeQueue.push(callback); + } + static #inForeground = false; + static get inForeground() { + return Firebase.#inForeground; + } constructor() { if (firebaseInstance) { return firebaseInstance; } firebaseInstance = this; + Application.android.on('activityResumed', (args) => { + Firebase.#inForeground = true; + Firebase.#onResumeQueue.forEach((callback) => { + callback(); + }); + Firebase.#onResumeQueue.splice(0); + }); + + Application.android.on('activityPaused', (args) => { + Firebase.#inForeground = false; + }); return firebaseInstance; } diff --git a/packages/firebase-core/index.ios.ts b/packages/firebase-core/index.ios.ts index 022a370a..fbc1f273 100644 --- a/packages/firebase-core/index.ios.ts +++ b/packages/firebase-core/index.ios.ts @@ -261,11 +261,37 @@ const launchCallback = () => { TNSFirebaseCore.setOnAppFinishLaunchingCallback(launchCallback); export class Firebase { + static #onResumeQueue = []; + static addToResumeQueue(callback: () => void) { + if (typeof callback !== 'function') { + return; + } + Firebase.#onResumeQueue.push(callback); + } + static #inForeground = false; + static get inForeground() { + return Firebase.#inForeground; + } constructor() { if (firebaseInstance) { return firebaseInstance; } firebaseInstance = this; + + Application.on('launch', (args) => { + Firebase.#onResumeQueue.forEach((callback) => { + callback(); + }); + Firebase.#onResumeQueue.splice(0); + }); + + Application.on('resume', (args) => { + Firebase.#inForeground = true; + }); + + Application.on('suspend', (args) => { + Firebase.#inForeground = false; + }); return firebaseInstance; } app(name?: string) { diff --git a/packages/firebase-core/package.json b/packages/firebase-core/package.json index 262e7a71..349db956 100644 --- a/packages/firebase-core/package.json +++ b/packages/firebase-core/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-core", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Core", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-core/platforms/android/include.gradle b/packages/firebase-core/platforms/android/include.gradle index 030c53ae..f1af9556 100644 --- a/packages/firebase-core/platforms/android/include.gradle +++ b/packages/firebase-core/platforms/android/include.gradle @@ -3,6 +3,6 @@ dependencies { def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "1.4.32" } implementation "org.jetbrains.kotlin:kotlin-stdlib:$computeKotlinVersion" - def computeFirebaseBomVersion = { -> project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } + def computeFirebaseBomVersion = { -> project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") } \ No newline at end of file diff --git a/packages/firebase-core/platforms/ios/Podfile b/packages/firebase-core/platforms/ios/Podfile index c8ec556e..cd0885cb 100644 --- a/packages/firebase-core/platforms/ios/Podfile +++ b/packages/firebase-core/platforms/ios/Podfile @@ -1,3 +1,4 @@ +use_frameworks! platform :ios, '10.0' #pod 'Firebase/CoreOnly' diff --git a/packages/firebase-crashlytics/package.json b/packages/firebase-crashlytics/package.json index 6841f988..8fdaede2 100644 --- a/packages/firebase-crashlytics/package.json +++ b/packages/firebase-crashlytics/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-crashlytics", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Crashlytics", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-crashlytics/platforms/ios/Podfile b/packages/firebase-crashlytics/platforms/ios/Podfile index 74ddeb04..5d22e102 100644 --- a/packages/firebase-crashlytics/platforms/ios/Podfile +++ b/packages/firebase-crashlytics/platforms/ios/Podfile @@ -1,2 +1,2 @@ -pod 'Firebase/Crashlytics','~>8.6' -pod 'Firebase/Analytics','~>8.6' \ No newline at end of file +pod 'Firebase/Crashlytics','~>9.0' +pod 'Firebase/Analytics','~>9.0' \ No newline at end of file diff --git a/packages/firebase-crashlytics/src-native/android/crashlytics/build.gradle b/packages/firebase-crashlytics/src-native/android/crashlytics/build.gradle index f8a22217..995457cd 100644 --- a/packages/firebase-crashlytics/src-native/android/crashlytics/build.gradle +++ b/packages/firebase-crashlytics/src-native/android/crashlytics/build.gradle @@ -33,7 +33,7 @@ android { dependencies { def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/packages/firebase-database/index.ios.ts b/packages/firebase-database/index.ios.ts index 6a3f105b..854510e3 100644 --- a/packages/firebase-database/index.ios.ts +++ b/packages/firebase-database/index.ios.ts @@ -1,5 +1,5 @@ -import {deserialize, firebase, FirebaseApp, FirebaseError, serialize} from '@nativescript/firebase-core'; -import {IDatabase, IReference, IDataSnapshot, EventType, IQuery, IOnDisconnect, IThenableReference} from './common'; +import { deserialize, firebase, FirebaseApp, FirebaseError, serialize } from '@nativescript/firebase-core'; +import { IDatabase, IReference, IDataSnapshot, EventType, IQuery, IOnDisconnect, IThenableReference } from './common'; let defaultDatabase: Database; const fb = firebase(); @@ -16,7 +16,6 @@ Object.defineProperty(fb, 'database', { writable: false, }); - function serializeItems(data, wrapPrimitives = false) { if (data instanceof ServerValue) { return data.native; @@ -24,623 +23,619 @@ function serializeItems(data, wrapPrimitives = false) { return serialize(data, wrapPrimitives); } - export class OnDisconnect implements IOnDisconnect { - #native: FIRDatabaseReference; - - static fromNative(disconnect: FIRDatabaseReference) { - if (disconnect instanceof FIRDatabaseReference) { - const d = new OnDisconnect(); - d.#native = disconnect; - return d; - } - return null; - } - - get native() { - return this.#native; - } - - get ios() { - return this.native; - } - - cancel(onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - if (!this.native) { - reject(); - } else { - this.native.cancelDisconnectOperationsWithCompletionBlock((error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - } - }); - } - - remove(onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.onDisconnectRemoveValueWithCompletionBlock((error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - set(value: any, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.onDisconnectSetValueWithCompletionBlock(value, (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - setWithPriority(value: any, priority: string | number, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.onDisconnectSetValueAndPriorityWithCompletionBlock(value, priority, (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.onDisconnectUpdateChildValuesWithCompletionBlock(serializeItems(values), (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } + #native: FIRDatabaseReference; + + static fromNative(disconnect: FIRDatabaseReference) { + if (disconnect instanceof FIRDatabaseReference) { + const d = new OnDisconnect(); + d.#native = disconnect; + return d; + } + return null; + } + + get native() { + return this.#native; + } + + get ios() { + return this.native; + } + + cancel(onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + if (!this.native) { + reject(); + } else { + this.native.cancelDisconnectOperationsWithCompletionBlock((error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + } + }); + } + + remove(onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.onDisconnectRemoveValueWithCompletionBlock((error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + set(value: any, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.onDisconnectSetValueWithCompletionBlock(value, (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + setWithPriority(value: any, priority: string | number, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.onDisconnectSetValueAndPriorityWithCompletionBlock(value, priority, (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.onDisconnectUpdateChildValuesWithCompletionBlock(serializeItems(values), (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } } function toFIRDataEventType(event: EventType): FIRDataEventType { - switch (event) { - case 'child_added': - return FIRDataEventType.ChildAdded; - case 'child_changed': - return FIRDataEventType.ChildChanged; - case 'child_moved': - return FIRDataEventType.ChildMoved; - case 'child_removed': - return FIRDataEventType.ChildRemoved; - case 'value': - return FIRDataEventType.Value; - } + switch (event) { + case 'child_added': + return FIRDataEventType.ChildAdded; + case 'child_changed': + return FIRDataEventType.ChildChanged; + case 'child_moved': + return FIRDataEventType.ChildMoved; + case 'child_removed': + return FIRDataEventType.ChildRemoved; + case 'value': + return FIRDataEventType.Value; + } } export class Query implements IQuery { - #native: FIRDatabaseQuery; - - static fromNative(query: FIRDatabaseQuery) { - if (query instanceof FIRDatabaseQuery) { - const q = new Query(); - q.#native = query; - return q; - } - return null; - } - - get native() { - return this.#native; - } - - get ios() { - return this.native; - } - - get ref(): Reference { - return Reference.fromNative(this.native.ref); - } - - endAt(value: string | number | boolean, key?: string): Query { - if (key) { - return Query.fromNative(this.native.queryEndingAtValueChildKey(value, key)); - } else { - return Query.fromNative(this.native.queryEndingAtValue(value)); - } - } - - equalTo(value: string | number | boolean, key?: string): Query { - if (key) { - return Query.fromNative(this.native.queryEqualToValueChildKey(value, key)); - } else { - return Query.fromNative(this.native.queryEqualToValue(value)); - } - } - - keepSynced(bool: boolean) { - this.native?.keepSynced?.(bool); - } - - limitToFirst(limit: number): Query { - return Query.fromNative(this.native.queryLimitedToFirst(limit)); - } - - limitToLast(limit: number): Query { - return Query.fromNative(this.native.queryLimitedToLast(limit)); - } - - #handles: Map<{ eventType: EventType; callback?: (a: DataSnapshot, b: string) => void; context?: any }, number> = new Map(); - - off(eventType?: EventType, callback?: (a: DataSnapshot, b: string) => void, context?: Record): void { - const handle = this.#handles.get({ - eventType, - callback, - context, - }); - if (handle) { - this.native.removeObserverWithHandle(handle); - } - } - - on(eventType: EventType, callback: (data: DataSnapshot, previousChildKey: string) => void, cancelCallbackOrContext?: (a: any) => void | Record, context?: Record): (a: DataSnapshot, b: string) => void { - const handle = this.native?.observeEventTypeAndPreviousSiblingKeyWithBlockWithCancelBlock?.( - toFIRDataEventType(eventType), - (snapshot, key) => { - callback(DataSnapshot.fromNative(snapshot), key); - }, - (error) => { - cancelCallbackOrContext({ - message: error.localizedDescription, - native: error, - }); - } - ); - - this.#handles.set( - { - eventType, - callback, - context, - }, - handle - ); - - return callback; - } - - once(eventType: EventType, successCallback?: (a: DataSnapshot, b: string) => any, failureCallbackContext?: (a: any) => void | Record): Promise { - return new Promise((resolve, reject) => { - this.native.observeSingleEventOfTypeAndPreviousSiblingKeyWithBlockWithCancelBlock?.( - toFIRDataEventType(eventType), - (snapshot, key) => { - const ss = DataSnapshot.fromNative(snapshot); - successCallback?.(ss, key); - resolve(ss); - }, - (error) => { - failureCallbackContext?.({ - message: error.localizedDescription, - native: error, - }); - - reject({ - message: error.localizedDescription, - native: error, - }); - } - ); - }); - } - - orderByChild(path: string): Query { - return Query.fromNative(this.native.queryOrderedByChild(path)); - } - - orderByKey(): Query { - return Query.fromNative(this.native.queryOrderedByKey()); - } - - orderByPriority(): Query { - return Query.fromNative(this.native.queryOrderedByPriority()); - } - - orderByValue(): Query { - return Query.fromNative(this.native.queryOrderedByValue()); - } - - startAt(value: string | number | boolean, key?: string): Query { - if (key) { - return Query.fromNative(this.native.queryStartingAtValueChildKey(value, key)); - } else { - return Query.fromNative(this.native.queryStartingAtValue(value)); - } - } + #native: FIRDatabaseQuery; + + static fromNative(query: FIRDatabaseQuery) { + if (query instanceof FIRDatabaseQuery) { + const q = new Query(); + q.#native = query; + return q; + } + return null; + } + + get native() { + return this.#native; + } + + get ios() { + return this.native; + } + + get ref(): Reference { + return Reference.fromNative(this.native.ref); + } + + endAt(value: string | number | boolean, key?: string): Query { + if (key) { + return Query.fromNative(this.native.queryEndingAtValueChildKey(value, key)); + } else { + return Query.fromNative(this.native.queryEndingAtValue(value)); + } + } + + equalTo(value: string | number | boolean, key?: string): Query { + if (key) { + return Query.fromNative(this.native.queryEqualToValueChildKey(value, key)); + } else { + return Query.fromNative(this.native.queryEqualToValue(value)); + } + } + + keepSynced(bool: boolean) { + this.native?.keepSynced?.(bool); + } + + limitToFirst(limit: number): Query { + return Query.fromNative(this.native.queryLimitedToFirst(limit)); + } + + limitToLast(limit: number): Query { + return Query.fromNative(this.native.queryLimitedToLast(limit)); + } + + #handles: Map<{ eventType: EventType; callback?: (a: DataSnapshot, b: string) => void; context?: any }, number> = new Map(); + + off(eventType?: EventType, callback?: (a: DataSnapshot, b: string) => void, context?: Record): void { + const handle = this.#handles.get({ + eventType, + callback, + context, + }); + if (handle) { + this.native.removeObserverWithHandle(handle); + } + } + + on(eventType: EventType, callback: (data: DataSnapshot, previousChildKey: string) => void, cancelCallbackOrContext?: (a: any) => void | Record, context?: Record): (a: DataSnapshot, b: string) => void { + const handle = this.native?.observeEventTypeAndPreviousSiblingKeyWithBlockWithCancelBlock?.( + toFIRDataEventType(eventType), + (snapshot, key) => { + callback(DataSnapshot.fromNative(snapshot), key); + }, + (error) => { + cancelCallbackOrContext({ + message: error.localizedDescription, + native: error, + }); + } + ); + + this.#handles.set( + { + eventType, + callback, + context, + }, + handle + ); + + return callback; + } + + once(eventType: EventType, successCallback?: (a: DataSnapshot, b: string) => any, failureCallbackContext?: (a: any) => void | Record): Promise { + return new Promise((resolve, reject) => { + this.native.observeSingleEventOfTypeAndPreviousSiblingKeyWithBlockWithCancelBlock?.( + toFIRDataEventType(eventType), + (snapshot, key) => { + const ss = DataSnapshot.fromNative(snapshot); + successCallback?.(ss, key); + resolve(ss); + }, + (error) => { + failureCallbackContext?.({ + message: error.localizedDescription, + native: error, + }); + + reject({ + message: error.localizedDescription, + native: error, + }); + } + ); + }); + } + + orderByChild(path: string): Query { + return Query.fromNative(this.native.queryOrderedByChild(path)); + } + + orderByKey(): Query { + return Query.fromNative(this.native.queryOrderedByKey()); + } + + orderByPriority(): Query { + return Query.fromNative(this.native.queryOrderedByPriority()); + } + + orderByValue(): Query { + return Query.fromNative(this.native.queryOrderedByValue()); + } + + startAt(value: string | number | boolean, key?: string): Query { + if (key) { + return Query.fromNative(this.native.queryStartingAtValueChildKey(value, key)); + } else { + return Query.fromNative(this.native.queryStartingAtValue(value)); + } + } } export class ServerValue { - #native: any; - static timeStamp() { - const value = new ServerValue(); - value.#native = FIRServerValue.timestamp(); - return value; - } - static increment(count: number) { - const value = new ServerValue(); - value.#native = FIRServerValue.increment(count); - return value; - } - - get native() { - return this.#native; - } - - get ios() { - return this.native; - } + #native: any; + static timeStamp() { + const value = new ServerValue(); + value.#native = FIRServerValue.timestamp(); + return value; + } + static increment(count: number) { + const value = new ServerValue(); + value.#native = FIRServerValue.increment(count); + return value; + } + + get native() { + return this.#native; + } + + get ios() { + return this.native; + } } export class Reference extends Query implements IReference { - #native: FIRDatabaseReference; - - static fromNative(ref: any) { - if (ref instanceof FIRDatabaseReference) { - const reference = new Reference(); - reference.#native = ref; - return reference; - } - return null; - } - - get key(): string { - return this.native.key; - } - - get parent(): Reference { - return Reference.fromNative(this.native.parent); - } - - get ref(): Reference { - return Reference.fromNative(this.native.ref); - } - - get root(): Reference { - return Reference.fromNative(this.native.root); - } - - get native() { - return this.#native as any; - } - - get ios() { - return this.native; - } - - child(path: string): Reference { - return Reference.fromNative(this.native.child?.(path)); - } - - onDisconnect(): OnDisconnect { - return OnDisconnect.fromNative(this.native); - } - - push(value?: any, onComplete?: () => void): ThenableReference { - const id = this.native.childByAutoId(); - const thennablePushRef = Reference.fromNative(id); - const pushRef = Reference.fromNative(id); - let promise; - if (value) { - promise = thennablePushRef.set(value, onComplete).then(() => pushRef); - } else { - promise = Promise.resolve(pushRef); - } - - // @ts-ignore - thennablePushRef.then = promise.then.bind(promise); - // @ts-ignore - thennablePushRef.catch = promise.then.bind(promise, undefined); - - if (typeof onComplete === 'function') { - promise.catch(() => { - }); - } - - return thennablePushRef as ThenableReference; - } - - remove(onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.removeValueWithCompletionBlock((error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - set(value: any, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.setValueWithCompletionBlock(serializeItems(value), (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - setPriority(priority: string | number, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - if (!this.native) { - reject(); - } else { - this.native.setPriorityWithCompletionBlock(priority, (error) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - } - }); - } - - setWithPriority(newVal: any, newPriority: string | number, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.setValueAndPriorityWithCompletionBlock(serializeItems(newVal), newPriority, (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } - - transaction(transactionUpdate: (currentData: object) => object, onComplete?: (error: FirebaseError, committed: boolean, finalResult: any) => void, applyLocally?: boolean): Promise { - return new Promise((resolve, reject) => { - this.native.runTransactionBlockAndCompletionBlockWithLocalEvents( - (data) => { - const newData = transactionUpdate(deserialize(data.value)); - data.value = serializeItems(newData); - return FIRTransactionResult.successWithValue(data); - }, - (error, commited, snapshot) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err, commited, null); - reject(err); - } else { - const ss = DataSnapshot.fromNative(snapshot); - onComplete?.(null, commited, ss); - resolve({ - commited, - snapshot: ss, - }); - } - }, - applyLocally || true - ); - }); - } - - update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise { - return new Promise((resolve, reject) => { - this.native.updateChildValuesWithCompletionBlock(serializeItems(values), (error, ref) => { - if (error) { - const err = FirebaseError.fromNative(error); - onComplete?.(err); - reject(err); - } else { - onComplete?.(null); - resolve(); - } - }); - }); - } + #native: FIRDatabaseReference; + + static fromNative(ref: any) { + if (ref instanceof FIRDatabaseReference) { + const reference = new Reference(); + reference.#native = ref; + return reference; + } + return null; + } + + get key(): string { + return this.native.key; + } + + get parent(): Reference { + return Reference.fromNative(this.native.parent); + } + + get ref(): Reference { + return Reference.fromNative(this.native.ref); + } + + get root(): Reference { + return Reference.fromNative(this.native.root); + } + + get native() { + return this.#native as any; + } + + get ios() { + return this.native; + } + + child(path: string): Reference { + return Reference.fromNative(this.native.child?.(path)); + } + + onDisconnect(): OnDisconnect { + return OnDisconnect.fromNative(this.native); + } + + push(value?: any, onComplete?: () => void): ThenableReference { + const id = this.native.childByAutoId(); + const thennablePushRef = Reference.fromNative(id); + const pushRef = Reference.fromNative(id); + let promise; + if (value) { + promise = thennablePushRef.set(value, onComplete).then(() => pushRef); + } else { + promise = Promise.resolve(pushRef); + } + + // @ts-ignore + thennablePushRef.then = promise.then.bind(promise); + // @ts-ignore + thennablePushRef.catch = promise.then.bind(promise, undefined); + + if (typeof onComplete === 'function') { + promise.catch(() => {}); + } + + return thennablePushRef as ThenableReference; + } + + remove(onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.removeValueWithCompletionBlock((error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + set(value: any, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.setValueWithCompletionBlock(serializeItems(value), (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + setPriority(priority: string | number, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + if (!this.native) { + reject(); + } else { + this.native.setPriorityWithCompletionBlock(priority, (error) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + } + }); + } + + setWithPriority(newVal: any, newPriority: string | number, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.setValueAndPriorityWithCompletionBlock(serializeItems(newVal), newPriority, (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } + + transaction(transactionUpdate: (currentData: object) => object, onComplete?: (error: FirebaseError, committed: boolean, finalResult: any) => void, applyLocally?: boolean): Promise { + return new Promise((resolve, reject) => { + this.native.runTransactionBlockAndCompletionBlockWithLocalEvents( + (data) => { + const newData = transactionUpdate(deserialize(data.value)); + data.value = serializeItems(newData); + return FIRTransactionResult.successWithValue(data); + }, + (error, commited, snapshot) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err, commited, null); + reject(err); + } else { + const ss = DataSnapshot.fromNative(snapshot); + onComplete?.(null, commited, ss); + resolve({ + commited, + snapshot: ss, + }); + } + }, + applyLocally || true + ); + }); + } + + update(values: { [key: string]: any }, onComplete?: (error: FirebaseError) => void): Promise { + return new Promise((resolve, reject) => { + this.native.updateChildValuesWithCompletionBlock(serializeItems(values), (error, ref) => { + if (error) { + const err = FirebaseError.fromNative(error); + onComplete?.(err); + reject(err); + } else { + onComplete?.(null); + resolve(); + } + }); + }); + } } export class ThenableReference extends Reference implements IThenableReference { - toString(): string { - throw new Error('Method not implemented.'); - } + toString(): string { + throw new Error('Method not implemented.'); + } - then(onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): PromiseLike { - throw new Error('Method not implemented.'); - } + then(onfulfilled?: (value: any) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): PromiseLike { + throw new Error('Method not implemented.'); + } } export class DataSnapshot implements IDataSnapshot { - #native: FIRDataSnapshot; - - static fromNative(snapshot: FIRDataSnapshot) { - if (snapshot instanceof FIRDataSnapshot) { - const ss = new DataSnapshot(); - ss.#native = snapshot; - return ss; - } - return null; - } - - get native() { - return this.#native; - } - - get ios() { - return this.native; - } - - get key(): string { - return this.native?.key; - } - - get ref(): Reference { - return Reference.fromNative(this.native.ref); - } - - child(path: string): DataSnapshot { - return DataSnapshot.fromNative(this.native.childSnapshotForPath(path)); - } - - exists(): boolean { - return this.native?.exists(); - } - - exportVal() { - return { - '.priority': this.native.priority, - '.value': deserialize(this.native.value), - }; - } - - forEach(action: (child: DataSnapshot) => true | undefined): boolean { - let didStop = false; - const children = this.native.children; - let object = children.nextObject(); - while (object) { - didStop = action(DataSnapshot.fromNative(object)); - if (didStop || !object) { - break; - } - object = children.nextObject(); - } - if (didStop) { - return true; - } - if (!object) { - return false; - } - } - - getPriority(): string | number { - return this.native.priority; - } - - hasChild(path: string): boolean { - return this.native?.hasChild?.(path); - } - - hasChildren(): boolean { - return this.native?.hasChildren?.(); - } - - numChildren(): number { - return this.native?.childrenCount; - } - - val() { - return deserialize(this.native.value); - } + #native: FIRDataSnapshot; + + static fromNative(snapshot: FIRDataSnapshot) { + if (snapshot instanceof FIRDataSnapshot) { + const ss = new DataSnapshot(); + ss.#native = snapshot; + return ss; + } + return null; + } + + get native() { + return this.#native; + } + + get ios() { + return this.native; + } + + get key(): string { + return this.native?.key; + } + + get ref(): Reference { + return Reference.fromNative(this.native.ref); + } + + child(path: string): DataSnapshot { + return DataSnapshot.fromNative(this.native.childSnapshotForPath(path)); + } + + exists(): boolean { + return this.native?.exists(); + } + + exportVal() { + return { + '.priority': this.native.priority, + '.value': deserialize(this.native.value), + }; + } + + forEach(action: (child: DataSnapshot) => true | undefined): boolean { + let didStop = false; + const children = this.native.children; + let object = children.nextObject(); + while (object) { + didStop = action(DataSnapshot.fromNative(object)); + if (didStop || !object) { + break; + } + object = children.nextObject(); + } + if (didStop) { + return true; + } + if (!object) { + return false; + } + } + + getPriority(): string | number { + return this.native.priority; + } + + hasChild(path: string): boolean { + return this.native?.hasChild?.(path); + } + + hasChildren(): boolean { + return this.native?.hasChildren?.(); + } + + numChildren(): number { + return this.native?.childrenCount; + } + + val() { + return deserialize(this.native.value); + } } export class Database implements IDatabase { - #native: FIRDatabase; - #app: FirebaseApp; - - constructor(app?: FirebaseApp) { - if (app?.native) { - this.#native = FIRDatabase.databaseForApp(app.native); - } else { - if (defaultDatabase) { + #native: FIRDatabase; + #app: FirebaseApp; + + constructor(app?: FirebaseApp) { + if (app?.native) { + this.#native = FIRDatabase.databaseForApp(app.native); + } else { + if (defaultDatabase) { return defaultDatabase; } defaultDatabase = this; - this.#native = FIRDatabase.database(); - console.log(this.#native); - } - } - - useEmulator(host: string, port: number) { - this.native.useEmulatorWithHostPort(host, port); - } - - - get persistenceCacheSizeBytes(): number { - return this.native.persistenceCacheSizeBytes; - } - - set persistenceCacheSizeBytes(bytes) { - this.native.persistenceCacheSizeBytes = bytes; - } - - get persistenceEnabled(): boolean { - return this.native.persistenceEnabled; - } - - set persistenceEnabled(value) { - this.native.persistenceEnabled = value; - } - - refFromURL(url: string): Reference { - return Reference.fromNative(this.native?.referenceFromURL?.(url)); - } - - setLoggingEnabled(enabled: boolean) { - FIRDatabase.setLoggingEnabled(enabled); - } - - ref(path?: string): Reference { - return Reference.fromNative(this.native?.referenceWithPath?.(path || '/')); - } - - goOffline() { - this.native.goOffline(); - } - - goOnline() { - this.native.goOnline(); - } - - get native() { - return this.#native; - } - - get ios() { - return this.native; - } - - get app(): FirebaseApp { - if (!this.#app) { - // @ts-ignore - this.#app = FirebaseApp.fromNative(this.native.app); - } - return this.#app; - } + this.#native = FIRDatabase.database(); + } + } + + useEmulator(host: string, port: number) { + this.native.useEmulatorWithHostPort(host, port); + } + + get persistenceCacheSizeBytes(): number { + return this.native.persistenceCacheSizeBytes; + } + + set persistenceCacheSizeBytes(bytes) { + this.native.persistenceCacheSizeBytes = bytes; + } + + get persistenceEnabled(): boolean { + return this.native.persistenceEnabled; + } + + set persistenceEnabled(value) { + this.native.persistenceEnabled = value; + } + + refFromURL(url: string): Reference { + return Reference.fromNative(this.native?.referenceFromURL?.(url)); + } + + setLoggingEnabled(enabled: boolean) { + FIRDatabase.setLoggingEnabled(enabled); + } + + ref(path?: string): Reference { + return Reference.fromNative(this.native?.referenceWithPath?.(path || '/')); + } + + goOffline() { + this.native.goOffline(); + } + + goOnline() { + this.native.goOnline(); + } + + get native() { + return this.#native; + } + + get ios() { + return this.native; + } + + get app(): FirebaseApp { + if (!this.#app) { + // @ts-ignore + this.#app = FirebaseApp.fromNative(this.native.app); + } + return this.#app; + } } diff --git a/packages/firebase-database/package.json b/packages/firebase-database/package.json index 895e4b63..75c9800d 100644 --- a/packages/firebase-database/package.json +++ b/packages/firebase-database/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-database", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Database", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-database/platforms/ios/Podfile b/packages/firebase-database/platforms/ios/Podfile index aee26cf7..ee5a66ee 100644 --- a/packages/firebase-database/platforms/ios/Podfile +++ b/packages/firebase-database/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Database','~>8.6' \ No newline at end of file +pod 'Firebase/Database','~>9.0' \ No newline at end of file diff --git a/packages/firebase-database/src-native/android/database/build.gradle b/packages/firebase-database/src-native/android/database/build.gradle index 160699c5..a7ccfb57 100644 --- a/packages/firebase-database/src-native/android/database/build.gradle +++ b/packages/firebase-database/src-native/android/database/build.gradle @@ -39,6 +39,8 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation platform('com.google.firebase:firebase-bom:28.4.2') + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'com.google.firebase:firebase-database' } diff --git a/packages/firebase-dynamic-links/package.json b/packages/firebase-dynamic-links/package.json index 4e3f570d..faadf50b 100644 --- a/packages/firebase-dynamic-links/package.json +++ b/packages/firebase-dynamic-links/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-dynamic-links", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Dynamic Links", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-dynamic-links/platforms/ios/Podfile b/packages/firebase-dynamic-links/platforms/ios/Podfile index 4af4e724..8ff46e71 100644 --- a/packages/firebase-dynamic-links/platforms/ios/Podfile +++ b/packages/firebase-dynamic-links/platforms/ios/Podfile @@ -1,2 +1,2 @@ -pod 'Firebase/Analytics', '~> 8.6' -pod 'Firebase/DynamicLinks', '~> 8.6' \ No newline at end of file +pod 'Firebase/Analytics', '~> 9.0' +pod 'Firebase/DynamicLinks', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-dynamic-links/src-native/android/dynamic_links/build.gradle b/packages/firebase-dynamic-links/src-native/android/dynamic_links/build.gradle index 9eb6a24e..f7de2cf9 100644 --- a/packages/firebase-dynamic-links/src-native/android/dynamic_links/build.gradle +++ b/packages/firebase-dynamic-links/src-native/android/dynamic_links/build.gradle @@ -32,9 +32,9 @@ android { } dependencies { - def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } - implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'com.google.android.material:material:1.4.0' diff --git a/packages/firebase-firestore/package.json b/packages/firebase-firestore/package.json index 731b4799..755ddd82 100644 --- a/packages/firebase-firestore/package.json +++ b/packages/firebase-firestore/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-firestore", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Firestore", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-firestore/platforms/ios/Podfile b/packages/firebase-firestore/platforms/ios/Podfile index 3eaa50d9..8c3e7e4f 100644 --- a/packages/firebase-firestore/platforms/ios/Podfile +++ b/packages/firebase-firestore/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Firestore','~>8.6' \ No newline at end of file +pod 'Firebase/Firestore','~>9.0' \ No newline at end of file diff --git a/packages/firebase-firestore/src-native/android/.idea/gradle.xml b/packages/firebase-firestore/src-native/android/.idea/gradle.xml index 2e71cc5b..8f5fd14f 100644 --- a/packages/firebase-firestore/src-native/android/.idea/gradle.xml +++ b/packages/firebase-firestore/src-native/android/.idea/gradle.xml @@ -14,7 +14,6 @@ - diff --git a/packages/firebase-firestore/src-native/android/firestore/build.gradle b/packages/firebase-firestore/src-native/android/firestore/build.gradle index 5bda95cc..244f0229 100644 --- a/packages/firebase-firestore/src-native/android/firestore/build.gradle +++ b/packages/firebase-firestore/src-native/android/firestore/build.gradle @@ -40,8 +40,8 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } - implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'com.google.firebase:firebase-firestore' } diff --git a/packages/firebase-functions/package.json b/packages/firebase-functions/package.json index bf59295d..5e1832f2 100644 --- a/packages/firebase-functions/package.json +++ b/packages/firebase-functions/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-functions", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Functions", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-functions/platforms/ios/Podfile b/packages/firebase-functions/platforms/ios/Podfile index 33fd0149..90440072 100644 --- a/packages/firebase-functions/platforms/ios/Podfile +++ b/packages/firebase-functions/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Functions','~>8.6' +pod 'Firebase/Functions','~>9.0' diff --git a/packages/firebase-functions/src-native/android/functions/build.gradle b/packages/firebase-functions/src-native/android/functions/build.gradle index 1ceafb11..210d5acc 100644 --- a/packages/firebase-functions/src-native/android/functions/build.gradle +++ b/packages/firebase-functions/src-native/android/functions/build.gradle @@ -39,8 +39,8 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } - implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'com.google.firebase:firebase-functions' } diff --git a/packages/firebase-in-app-messaging/package.json b/packages/firebase-in-app-messaging/package.json index ad0e23a6..015765f2 100644 --- a/packages/firebase-in-app-messaging/package.json +++ b/packages/firebase-in-app-messaging/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-in-app-messaging", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - In App Messaging", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-in-app-messaging/platforms/ios/Podfile b/packages/firebase-in-app-messaging/platforms/ios/Podfile index 25c4557b..83ee816b 100644 --- a/packages/firebase-in-app-messaging/platforms/ios/Podfile +++ b/packages/firebase-in-app-messaging/platforms/ios/Podfile @@ -1,2 +1,2 @@ -pod 'Firebase/InAppMessaging', '~> 8.6' -pod 'Firebase/Analytics', '~> 8.6' \ No newline at end of file +pod 'Firebase/InAppMessaging', '~> 9.0' +pod 'Firebase/Analytics', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-installations/package.json b/packages/firebase-installations/package.json index 957efe45..9405fff3 100644 --- a/packages/firebase-installations/package.json +++ b/packages/firebase-installations/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-installations", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Installations", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-installations/platforms/ios/Podfile b/packages/firebase-installations/platforms/ios/Podfile index bbad47ca..22a2f998 100644 --- a/packages/firebase-installations/platforms/ios/Podfile +++ b/packages/firebase-installations/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Installations', '~> 8.6' \ No newline at end of file +pod 'Firebase/Installations', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-installations/src-native/android/installations/build.gradle b/packages/firebase-installations/src-native/android/installations/build.gradle index 170f9740..67d10453 100644 --- a/packages/firebase-installations/src-native/android/installations/build.gradle +++ b/packages/firebase-installations/src-native/android/installations/build.gradle @@ -32,8 +32,8 @@ android { } dependencies { - def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/packages/firebase-messaging/index.android.ts b/packages/firebase-messaging/index.android.ts index 7dc785ad..22edd90d 100644 --- a/packages/firebase-messaging/index.android.ts +++ b/packages/firebase-messaging/index.android.ts @@ -1,5 +1,5 @@ import { AndroidActivityNewIntentEventData, AndroidApplication, Application, Utils } from '@nativescript/core'; -import { FirebaseApp, FirebaseError, firebase, deserialize } from '@nativescript/firebase-core'; +import { FirebaseApp, FirebaseError, firebase, deserialize, Firebase } from '@nativescript/firebase-core'; import { AuthorizationStatus, IMessaging, RemoteMessage } from './common'; let defaultMessaging: Messaging; @@ -28,24 +28,32 @@ function ensureCallback() { return global.__native(this); } - public onError(error: any): void { } + public onError(error: any): void {} public onSuccess(message: string): void { - const callback = this._owner?.get?.()?.[this._propName]; - if (typeof callback === 'function') { - if (this._propName === '_onToken') { - callback(message); - } else if (this._propName === '_onNotificationTap' || this._propName === '_onMessage') { - try { - setTimeout(() => { + const exec = () => { + const callback = this._owner?.get?.()?.[this._propName]; + if (typeof callback === 'function') { + if (this._propName === '_onToken') { + callback(message); + } else if (this._propName === '_onNotificationTap' || this._propName === '_onMessage') { + try { + setTimeout(() => { + callback(JSON.parse(message)); + }); + } catch (e) {} + } else { + try { callback(JSON.parse(message)); - }); - } catch (e) { } - } else { - try { - callback(JSON.parse(message)); - } catch (e) { } + } catch (e) {} + } } + }; + const fb = require('@nativescript/firebase-core'); + if (!fb.Firebase.inForeground) { + fb.Firebase.addToResumeQueue(exec); + } else { + exec(); } } } @@ -74,6 +82,37 @@ export class Messaging implements IMessaging { defaultMessaging = this; org.nativescript.firebase.messaging.FirebaseMessaging.init(Utils.android.getApplicationContext()); ensureCallback(); + + // Setup onmessage handling + + if (!this.#onMessageCallback) { + this.#onMessageCallback = new Callback(); + this.#onMessageCallback._propName = '_onMessage'; + + this.#onMessageCallback._owner = new WeakRef(this); + + org.nativescript.firebase.messaging.FirebaseMessaging.setOnMessageListener(this.#onMessageCallback); + } + + // Setup tap notification handling + + if (!this.#onNotificationTapCallback) { + this.#onNotificationTapCallback = new Callback(); + this.#onNotificationTapCallback._propName = '_onNotificationTap'; + + this.#onNotificationTapCallback._owner = new WeakRef(this); + + org.nativescript.firebase.messaging.FirebaseMessaging.setOnMessageTapListener(this.#onNotificationTapCallback); + } + + if (!this.#onTokenCallback) { + this.#onTokenCallback = new Callback(); + this.#onTokenCallback._propName = '_onToken'; + this.#onTokenCallback._owner = new WeakRef(this); + + org.nativescript.firebase.messaging.FirebaseMessaging.setOnTokenListener(this.#onTokenCallback); + } + Application.android.on(AndroidApplication.activityNewIntentEvent, this._newIntentCallback.bind(this)); } @@ -131,43 +170,15 @@ export class Messaging implements IMessaging { onMessage(listener: (message: RemoteMessage) => any) { this.#onMessage = listener; - if (listener) { - if (!this.#onMessageCallback) { - this.#onMessageCallback = new Callback(); - this.#onMessageCallback._propName = '_onMessage'; - } - - this.#onMessageCallback._owner = new WeakRef(this); - - org.nativescript.firebase.messaging.FirebaseMessaging.setOnMessageListener(this.#onMessageCallback); - } } onNotificationTap(listener: (message: RemoteMessage) => any) { this.#onNotificationTap = listener; - if (listener) { - if (!this.#onNotificationTapCallback) { - this.#onNotificationTapCallback = new Callback(); - this.#onNotificationTapCallback._propName = '_onNotificationTap'; - } - - this.#onNotificationTapCallback._owner = new WeakRef(this); - - org.nativescript.firebase.messaging.FirebaseMessaging.setOnMessageTapListener(this.#onNotificationTapCallback); - } } onToken(listener: (token: string) => any) { this.#onToken = listener; - if (listener) { - if (!this.#onTokenCallback) { - this.#onTokenCallback = new Callback(); - this.#onTokenCallback._propName = '_onToken'; - } - - this.#onTokenCallback._owner = new WeakRef(this); - org.nativescript.firebase.messaging.FirebaseMessaging.setOnTokenListener(this.#onTokenCallback); } else { org.nativescript.firebase.messaging.FirebaseMessaging.setOnTokenListener(null); diff --git a/packages/firebase-messaging/index.ios.ts b/packages/firebase-messaging/index.ios.ts index f1edb50c..ecb58687 100644 --- a/packages/firebase-messaging/index.ios.ts +++ b/packages/firebase-messaging/index.ios.ts @@ -36,6 +36,24 @@ export class Messaging implements IMessaging { return defaultMessaging; } defaultMessaging = this; + + TNSFirebaseMessaging.onMessageCallback = (dict) => { + if (this.#onMessage) { + this.#onMessage(deserialize(dict)); + } + }; + + TNSFirebaseMessaging.onTokenCallback = (value) => { + if (this.#onToken) { + this.#onToken(value); + } + }; + + TNSFirebaseMessaging.onNotificationTapCallback = (dict) => { + if (this.#onNotificationTap) { + this.#onNotificationTap(deserialize(dict)); + } + }; } get showNotificationsWhenInForeground(): boolean { @@ -114,35 +132,14 @@ export class Messaging implements IMessaging { onMessage(listener: (message: RemoteMessage) => any) { this.#onMessage = listener; - if (listener) { - TNSFirebaseMessaging.onMessageCallback = (dict) => { - listener(deserialize(dict)); - }; - } else { - TNSFirebaseMessaging.onMessageCallback = null; - } } onToken(listener: (token: string) => any) { this.#onToken = listener; - if (listener) { - TNSFirebaseMessaging.onTokenCallback = (value) => { - listener(value); - }; - } else { - TNSFirebaseMessaging.onTokenCallback = null; - } } onNotificationTap(listener: (message: RemoteMessage) => any) { this.#onNotificationTap = listener; - if (listener) { - TNSFirebaseMessaging.onNotificationTapCallback = (dict) => { - listener(deserialize(dict)); - }; - } else { - TNSFirebaseMessaging.onNotificationTapCallback = null; - } } registerDeviceForRemoteMessages(): Promise { diff --git a/packages/firebase-messaging/package.json b/packages/firebase-messaging/package.json index 7215410f..b762a9ef 100644 --- a/packages/firebase-messaging/package.json +++ b/packages/firebase-messaging/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-messaging", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Messaging", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-messaging/platforms/ios/Podfile b/packages/firebase-messaging/platforms/ios/Podfile index 2415265f..622c3c36 100644 --- a/packages/firebase-messaging/platforms/ios/Podfile +++ b/packages/firebase-messaging/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Messaging', '~> 8.6' \ No newline at end of file +pod 'Firebase/Messaging', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-messaging/src-native/android/.idea/gradle.xml b/packages/firebase-messaging/src-native/android/.idea/gradle.xml index 532c333d..927b7fcd 100644 --- a/packages/firebase-messaging/src-native/android/.idea/gradle.xml +++ b/packages/firebase-messaging/src-native/android/.idea/gradle.xml @@ -14,7 +14,6 @@ - diff --git a/packages/firebase-messaging/src-native/android/messaging/build.gradle b/packages/firebase-messaging/src-native/android/messaging/build.gradle index 8cc91976..73ad06bc 100644 --- a/packages/firebase-messaging/src-native/android/messaging/build.gradle +++ b/packages/firebase-messaging/src-native/android/messaging/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - def computeFirebaseBomVersion = { -> project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } + def computeFirebaseBomVersion = { -> project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/packages/firebase-performance/package.json b/packages/firebase-performance/package.json index 985a7933..a711dedd 100644 --- a/packages/firebase-performance/package.json +++ b/packages/firebase-performance/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-performance", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Performancee", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-performance/platforms/ios/Podfile b/packages/firebase-performance/platforms/ios/Podfile index 153d8c8a..fdf21b8c 100644 --- a/packages/firebase-performance/platforms/ios/Podfile +++ b/packages/firebase-performance/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Performance', '~> 8.6' \ No newline at end of file +pod 'Firebase/Performance', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-remote-config/package.json b/packages/firebase-remote-config/package.json index 9b1e91f1..b0dc7349 100644 --- a/packages/firebase-remote-config/package.json +++ b/packages/firebase-remote-config/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-remote-config", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Remote Config", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-remote-config/platforms/ios/Podfile b/packages/firebase-remote-config/platforms/ios/Podfile index c04a5080..46a3fd63 100644 --- a/packages/firebase-remote-config/platforms/ios/Podfile +++ b/packages/firebase-remote-config/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/RemoteConfig', '~> 8.6' \ No newline at end of file +pod 'Firebase/RemoteConfig', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-remote-config/src-native/android/remote_config/build.gradle b/packages/firebase-remote-config/src-native/android/remote_config/build.gradle index aa799392..f6ce4203 100644 --- a/packages/firebase-remote-config/src-native/android/remote_config/build.gradle +++ b/packages/firebase-remote-config/src-native/android/remote_config/build.gradle @@ -33,7 +33,7 @@ android { dependencies { def computeFirebaseBomVersion = { -> - project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "28.4.2" } + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'androidx.core:core-ktx:1.6.0' implementation 'androidx.appcompat:appcompat:1.3.1' diff --git a/packages/firebase-storage/package.json b/packages/firebase-storage/package.json index f6560609..1ce6aa9e 100644 --- a/packages/firebase-storage/package.json +++ b/packages/firebase-storage/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/firebase-storage", - "version": "1.2.2", + "version": "2.0.0", "description": "NativeScript Firebase - Storage", "main": "index", "typings": "index.d.ts", diff --git a/packages/firebase-storage/platforms/ios/Podfile b/packages/firebase-storage/platforms/ios/Podfile index 166c7d6f..5fdf2696 100644 --- a/packages/firebase-storage/platforms/ios/Podfile +++ b/packages/firebase-storage/platforms/ios/Podfile @@ -1 +1 @@ -pod 'Firebase/Storage', '~> 8.6' \ No newline at end of file +pod 'Firebase/Storage', '~> 9.0' \ No newline at end of file diff --git a/packages/firebase-storage/src-native/android/storage/build.gradle b/packages/firebase-storage/src-native/android/storage/build.gradle index 707dd27b..ea86bf78 100644 --- a/packages/firebase-storage/src-native/android/storage/build.gradle +++ b/packages/firebase-storage/src-native/android/storage/build.gradle @@ -36,6 +36,8 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation platform('com.google.firebase:firebase-bom:28.4.2') + def computeFirebaseBomVersion = { -> + project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" } + implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}") implementation 'com.google.firebase:firebase-storage' } diff --git a/tools/assets/App_Resources/Android/src/google-services.json b/tools/assets/App_Resources/Android/src/google-services.json index 89a3153a..6d4c262d 100644 --- a/tools/assets/App_Resources/Android/src/google-services.json +++ b/tools/assets/App_Resources/Android/src/google-services.json @@ -1,115 +1,167 @@ { - "project_info": { - "project_number": "292142294722", - "firebase_url": "https://nativescript-firebase-a55a0.firebaseio.com", - "project_id": "nativescript-firebase-a55a0", - "storage_bucket": "nativescript-firebase-a55a0.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:292142294722:android:834a7a9094ffdb32287d5b", - "android_client_info": { - "package_name": "io.github.triniwiz.nativescript.firebasedemo" - } - }, - "oauth_client": [ - { - "client_id": "292142294722-ckf8oa3neiemb5ju5naesnkqqidbn92o.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "io.github.triniwiz.nativescript.firebasedemo", - "certificate_hash": "17816f5cf2666cabd896c79e4957884c23f016da" - } - }, - { - "client_id": "292142294722-u1eosqh9eco1l5isgau2805df2lvk0ek.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "io.github.triniwiz.nativescript.firebasedemo", - "certificate_hash": "dad4ffbd27b6435c3fe5250c4d7d2195fa72fafb" - } - }, - { - "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyAL69oiwiL5z7ngogAvc7cguxBh81eG25I" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", - "client_type": 3 - }, - { - "client_id": "292142294722-23nmrq9mn8rhpqipjc1bt4qecga3qgsf.apps.googleusercontent.com", - "client_type": 2, - "ios_info": { - "bundle_id": "io.github.triniwiz.nativescript.firebasedemo" - } - } - ] - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:292142294722:android:502a8a2497c98cb1287d5b", - "android_client_info": { - "package_name": "org.nativescript.firebasedemo" - } - }, - "oauth_client": [ - { - "client_id": "292142294722-9s58kof5a3ng34vqhj51gs04qlr6jjgf.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "org.nativescript.firebasedemo", - "certificate_hash": "dad4ffbd27b6435c3fe5250c4d7d2195fa72fafb" - } - }, - { - "client_id": "292142294722-p4kc740vu3rtfgvmmcmnntsk2qb6niah.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "org.nativescript.firebasedemo", - "certificate_hash": "17816f5cf2666cabd896c79e4957884c23f016da" - } - }, - { - "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyAL69oiwiL5z7ngogAvc7cguxBh81eG25I" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", - "client_type": 3 - }, - { - "client_id": "292142294722-23nmrq9mn8rhpqipjc1bt4qecga3qgsf.apps.googleusercontent.com", - "client_type": 2, - "ios_info": { - "bundle_id": "io.github.triniwiz.nativescript.firebasedemo" - } - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file + "project_info": { + "project_number": "292142294722", + "firebase_url": "https://nativescript-firebase-a55a0.firebaseio.com", + "project_id": "nativescript-firebase-a55a0", + "storage_bucket": "nativescript-firebase-a55a0.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:292142294722:android:834a7a9094ffdb32287d5b", + "android_client_info": { + "package_name": "io.github.triniwiz.nativescript.firebasedemo" + } + }, + "oauth_client": [ + { + "client_id": "292142294722-ckf8oa3neiemb5ju5naesnkqqidbn92o.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.github.triniwiz.nativescript.firebasedemo", + "certificate_hash": "17816f5cf2666cabd896c79e4957884c23f016da" + } + }, + { + "client_id": "292142294722-u1eosqh9eco1l5isgau2805df2lvk0ek.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.github.triniwiz.nativescript.firebasedemo", + "certificate_hash": "dad4ffbd27b6435c3fe5250c4d7d2195fa72fafb" + } + }, + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAL69oiwiL5z7ngogAvc7cguxBh81eG25I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "292142294722-23nmrq9mn8rhpqipjc1bt4qecga3qgsf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.github.triniwiz.nativescript.firebasedemo" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:292142294722:android:aeab85b4cab64d0b287d5b", + "android_client_info": { + "package_name": "io.github.triniwiz.nativescript.plugindemo" + } + }, + "oauth_client": [ + { + "client_id": "292142294722-b9jtkhq62nblpacl7tajv896t8a6k9lc.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.github.triniwiz.nativescript.plugindemo", + "certificate_hash": "dad4ffbd27b6435c3fe5250c4d7d2195fa72fafb" + } + }, + { + "client_id": "292142294722-p0kkquj76f5qehroteosr5s070tq1idn.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.github.triniwiz.nativescript.plugindemo", + "certificate_hash": "17816f5cf2666cabd896c79e4957884c23f016da" + } + }, + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAL69oiwiL5z7ngogAvc7cguxBh81eG25I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "292142294722-23nmrq9mn8rhpqipjc1bt4qecga3qgsf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.github.triniwiz.nativescript.firebasedemo" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:292142294722:android:502a8a2497c98cb1287d5b", + "android_client_info": { + "package_name": "org.nativescript.firebasedemo" + } + }, + "oauth_client": [ + { + "client_id": "292142294722-9s58kof5a3ng34vqhj51gs04qlr6jjgf.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "org.nativescript.firebasedemo", + "certificate_hash": "dad4ffbd27b6435c3fe5250c4d7d2195fa72fafb" + } + }, + { + "client_id": "292142294722-p4kc740vu3rtfgvmmcmnntsk2qb6niah.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "org.nativescript.firebasedemo", + "certificate_hash": "17816f5cf2666cabd896c79e4957884c23f016da" + } + }, + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAL69oiwiL5z7ngogAvc7cguxBh81eG25I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "292142294722-uenpeed8drufjhsgfj9vhk3o73l9vp6b.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "292142294722-23nmrq9mn8rhpqipjc1bt4qecga3qgsf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.github.triniwiz.nativescript.firebasedemo" + } + } + ] + } + } + } + ], + "configuration_version": "1" +}