Skip to content

Commit 4dc8122

Browse files
committed
feat: v2
fixes: #88 fixes: #77 breaking(android): min sdk is now API 19 (kitkat) for Analytics, Firestore, Messaging & Dynamic Links
1 parent 8a53b8b commit 4dc8122

File tree

69 files changed

+1035
-902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1035
-902
lines changed

apps/demo/src/app.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ dynamicLinks.onLink((link) => {
3737
});
3838

3939
const messaging = firebase().messaging();
40-
messaging.onMessage((message) => {
41-
console.log('Firebase onMessage', message);
42-
});
4340

44-
messaging.onNotificationTap((message) => {
45-
console.log('Firebase onNotificationTap', message);
46-
});
41+
Application.on('launch', (args) => {
42+
messaging.onMessage((message) => {
43+
console.log('Firebase onMessage', message);
44+
});
4745

48-
messaging.onToken((token) => {
49-
console.log('Firebase onToken', token);
46+
messaging.onNotificationTap((message) => {
47+
console.log('Firebase onNotificationTap', message);
48+
});
49+
50+
messaging.onToken((token) => {
51+
console.log('Firebase onToken', token);
52+
});
5053
});
5154

5255
messaging

apps/demo/src/main-view-model.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export class MainViewModel extends Observable {
2626
{
2727
name: 'firebase-app-check',
2828
},
29+
{
30+
name: 'firebase-app-check-debug',
31+
},
2932
{
3033
name: 'firebase-in-app-messaging',
3134
},
@@ -38,9 +41,9 @@ export class MainViewModel extends Observable {
3841
{
3942
name: 'firebase-messaging',
4043
},
41-
{
42-
name: 'firebase-firestore',
43-
},
44+
{
45+
name: 'firebase-firestore',
46+
},
4447
];
4548

4649
viewDemo(args) {

apps/demo/src/plugin-demos/firebase-admob.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ xmlns:ui="@nativescript/firebase-admob"
66
</ActionBar>
77
</Page.actionBar>
88
<StackLayout class="p-20">
9-
<!-- <ui:BannerAd height="100" width="100" unitId="{{bannerAdUnit}}" layoutChanged="{{bannerLoaded}}"/> -->
10-
<ui:NativeAdView height="400" loaded="{{nativeAdLoaded}}" layoutChanged="{{nativeAdLayoutChanged}}">
9+
<ui:BannerAd height="100" width="100" unitId="{{bannerAdUnit}}" layoutChanged="{{bannerLoaded}}"/>
10+
<!-- <ui:NativeAdView height="400" loaded="{{nativeAdLoaded}}" layoutChanged="{{nativeAdLayoutChanged}}">
1111
<GridLayout rows="auto,auto,auto,auto" height="300" width="300">
1212
<Label id="headLineView" text="First"/>
1313
<ui:MediaView row="1" id="mediaView" height="100%"/>
1414
<Label row="2" id="bodyView"/>
1515
<Image id="iconView" row="3"/>
1616
</GridLayout>
17-
</ui:NativeAdView>
17+
</ui:NativeAdView> -->
1818
</StackLayout>
1919
</Page>
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
import { Observable, EventData, Page } from '@nativescript/core';
22
import { DemoSharedFirebaseAppCheckDebug } from '@demo/shared';
3-
import { } from '@nativescript/firebase-app-check-debug';
3+
import { firebase } from '@nativescript/firebase-core';
4+
import '@nativescript/firebase-app-check-debug';
45

56
export function navigatingTo(args: EventData) {
67
const page = <Page>args.object;
78
page.bindingContext = new DemoModel();
89
}
910

1011
export class DemoModel extends DemoSharedFirebaseAppCheckDebug {
11-
12+
constructor() {
13+
super();
14+
}
15+
16+
testIt(): void {
17+
firebase()
18+
.appCheck()
19+
.getToken(true)
20+
.then((token) => {
21+
console.log(token.token);
22+
})
23+
.catch((error) => {
24+
console.log(error);
25+
});
26+
}
1227
}

apps/demo/src/plugin-demos/firebase-database.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,25 @@ export class DemoModel extends DemoSharedFirebaseDatabase {
1515
super();
1616
this.auth = firebase().auth();
1717
this.database = firebase().database();
18+
}
19+
20+
testIt(): void {
1821
this.transaction();
1922
this.randomData();
2023
this.children();
2124
this.setData();
2225
}
2326

24-
setData(){
27+
setData() {
2528
this.database
26-
.ref('/person/me')
27-
.set({ name: 'set', boolean: true , updated: new Date() })
28-
.then((value) => {
29-
console.log('set some data', value);
30-
}).catch(e =>{
31-
console.log('failed to set data', e);
32-
});
29+
.ref('/person/me')
30+
.set({ name: 'set', boolean: true, updated: new Date() })
31+
.then((value) => {
32+
console.log('set some data', value);
33+
})
34+
.catch((e) => {
35+
console.log('failed to set data', e);
36+
});
3337
}
3438

3539
randomData() {

apps/demo/src/plugin-demos/firebase-firestore.ts

+17-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export function navigatingTo(args: EventData) {
1111
export class DemoModel extends DemoSharedFirebaseFirestore {
1212
constructor() {
1313
super();
14-
Promise.all([this.init(),this.invalid_field_path()]);
14+
}
15+
16+
testIt(): void {
17+
Promise.all([this.init(), this.invalid_field_path()]);
1518
}
1619

1720
async init() {
@@ -57,21 +60,20 @@ export class DemoModel extends DemoSharedFirebaseFirestore {
5760
const exampleDoc2 = firebase().firestore().collection('things').doc('exampleDoc2');
5861

5962
firebase()
60-
.firestore()
61-
.batch()
62-
.set(exampleDoc, {
63-
message: 'Hello doc',
64-
})
65-
.set(exampleDoc2, {
66-
date: new Date(),
67-
})
68-
.commit()
69-
.then(() => {})
70-
.catch((error) => {
71-
console.error(error);
72-
});
63+
.firestore()
64+
.batch()
65+
.set(exampleDoc, {
66+
message: 'Hello doc',
67+
})
68+
.set(exampleDoc2, {
69+
date: new Date(),
70+
})
71+
.commit()
72+
.then(() => {})
73+
.catch((error) => {
74+
console.error(error);
75+
});
7376
}
74-
7577

7678
async invalid_field_path() {
7779
try {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plugins",
3-
"version": "1.2.2",
3+
"version": "2.0.0",
44
"license": "MIT",
55
"scripts": {
66
"postinstall": "husky install && npx ts-patch install",

packages/firebase-admob/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-admob",
3-
"version": "1.2.2",
3+
"version": "2.0.0",
44
"description": "NativeScript Firebase - Admob",
55
"main": "index",
66
"typings": "index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dependencies {
2-
implementation 'com.google.android.gms:play-services-ads:20.4.0'
2+
implementation 'com.google.android.gms:play-services-ads:20.6.0'
33
implementation 'com.google.android.ump:user-messaging-platform:2.0.0'
44
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
use_frameworks!
2-
pod 'Google-Mobile-Ads-SDK', '~> 8.10'
2+
pod 'Google-Mobile-Ads-SDK', '~> 9.5.0'

packages/firebase-analytics/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-analytics",
3-
"version": "1.2.2",
3+
"version": "2.0.0",
44
"description": "NativeScript Firebase - Analytics",
55
"main": "index",
66
"typings": "index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
platform :ios, '10.0'
12
# Firebase dependencies
23
if defined?($NSFirebaseAnalyticsWithoutAdIdSupport)
34
Pod::UI.puts "Using Firebase/AnalyticsWithoutAdIdSupport pod in place of default Firebase/Analytics"
45

5-
pod 'Firebase/AnalyticsWithoutAdIdSupport','~>8.6'
6+
pod 'Firebase/AnalyticsWithoutAdIdSupport','~>9.0'
67
else
78
Pod::UI.puts "Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps."
89
Pod::UI.puts "You may set variable `$NSFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids."
9-
pod 'Firebase/Analytics','~>8.6'
10+
pod 'Firebase/Analytics','~>9.0'
1011
end

packages/firebase-app-check-debug/index.android.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Object.defineProperty(fb, 'appCheck', {
1717
writable: false,
1818
});
1919

20-
const NSAppCheck = lazy(() => org.nativescript.firebase.app_check_debug.FirebaseAppCheck);
20+
const NSAppCheck = lazy(() => org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug);
2121

2222
export class AppCheckToken implements IAppCheckToken {
2323
#native: com.google.firebase.appcheck.AppCheckToken;
@@ -66,16 +66,15 @@ export class AppCheck implements IAppCheck {
6666
static setProviderFactory() {}
6767

6868
activate(isTokenAutoRefreshEnabled: boolean) {
69-
this.native.setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled);
70-
this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory.getInstance());
69+
this.native.installAppCheckProviderFactory(com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory.getInstance(), isTokenAutoRefreshEnabled);
7170
}
7271

7372
getToken(forceRefresh: boolean): Promise<AppCheckToken> {
7473
return new Promise((resolve, reject) => {
7574
NSAppCheck().getToken(
7675
this.native,
7776
forceRefresh,
78-
new org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback({
77+
new org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback({
7978
onSuccess(param0) {
8079
resolve(AppCheckToken.fromNative(param0));
8180
},

packages/firebase-app-check-debug/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-app-check-debug",
3-
"version": "1.2.2",
3+
"version": "2.0.0",
44
"description": "NativeScript Firebase - App Check",
55
"main": "index",
66
"typings": "index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dependencies {
2-
implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta04'
2+
implementation 'com.google.firebase:firebase-appcheck-debug'
33
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
platform :ios, '11.0'
2-
pod 'Firebase/AppCheck', '~>8.6'
2+
pod 'Firebase/AppCheck', '~>9.0'

packages/firebase-app-check-debug/src-native/android/.idea/gradle.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/firebase-app-check-debug/src-native/android/app_check_debug/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ dependencies {
3333

3434
implementation 'androidx.core:core-ktx:1.7.0'
3535
implementation 'androidx.appcompat:appcompat:1.3.0'
36-
implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta04'
36+
def computeFirebaseBomVersion = { ->
37+
project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" }
38+
implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}")
39+
implementation 'com.google.firebase:firebase-appcheck-debug'
3740
testImplementation 'junit:junit:4.13.2'
3841
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
3942
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

packages/firebase-app-check-debug/typings/org.nativescript.firebase.app_check.d.ts

+12-16
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,29 @@ declare module org {
1818
export module nativescript {
1919
export module firebase {
2020
export module app_check_debug {
21-
export class FirebaseAppCheck {
22-
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheck>;
23-
public static Companion: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Companion;
21+
export class FirebaseAppCheckDebug {
22+
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug>;
23+
public static Companion: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Companion;
2424
public constructor();
2525
public static getExecutorsCount(): number;
26-
public static getToken(param0: com.google.firebase.appcheck.FirebaseAppCheck, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback<com.google.firebase.appcheck.AppCheckToken>): void;
26+
public static getToken(param0: com.google.firebase.appcheck.FirebaseAppCheckDebug, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback<com.google.firebase.appcheck.AppCheckToken>): void;
2727
public static setExecutorsCount(param0: number): void;
2828
}
29-
export module FirebaseAppCheck {
30-
export class Callback<T> extends java.lang.Object {
31-
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback<any>>;
29+
export module FirebaseAppCheckDebug {
30+
export class Callback<T> extends java.lang.Object {
31+
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback<any>>;
3232
/**
33-
* 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.
33+
* 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.
3434
*/
35-
public constructor(implementation: {
36-
onSuccess(param0: T): void;
37-
onError(param0: any): void;
38-
});
35+
public constructor(implementation: { onSuccess(param0: T): void; onError(param0: any): void });
3936
public constructor();
4037
public onError(param0: any): void;
4138
public onSuccess(param0: T): void;
4239
}
4340
export class Companion {
44-
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Companion>;
41+
public static class: java.lang.Class<org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Companion>;
4542
public setExecutorsCount(param0: number): void;
46-
public getToken(param0: com.google.firebase.appcheck.FirebaseAppCheck, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback<com.google.firebase.appcheck.AppCheckToken>): void;
43+
public getToken(param0: com.google.firebase.appcheck.FirebaseAppCheckDebug, param1: boolean, param2: org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback<com.google.firebase.appcheck.AppCheckToken>): void;
4744
public getExecutorsCount(): number;
4845
}
4946
}
@@ -53,5 +50,4 @@ declare module org {
5350
}
5451

5552
//Generics information:
56-
//org.nativescript.firebase.app_check_debug.FirebaseAppCheck.Callback:1
57-
53+
//org.nativescript.firebase.app_check_debug.FirebaseAppCheckDebug.Callback:1

packages/firebase-app-check/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-app-check",
3-
"version": "1.2.2",
3+
"version": "2.0.0",
44
"description": "NativeScript Firebase - App Check",
55
"main": "index",
66
"typings": "index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dependencies {
2-
implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0-beta02'
2+
implementation 'com.google.firebase:firebase-appcheck-safetynet'
33
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
platform :ios, '11.0'
2-
pod 'Firebase/AppCheck', '~>8.6'
2+
pod 'Firebase/AppCheck', '~>9.0'

packages/firebase-app-check/src-native/android/app_check/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@ dependencies {
3939
testImplementation 'junit:junit:4.+'
4040
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
4141
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
42-
implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0-beta02'
42+
def computeFirebaseBomVersion = { ->
43+
project.hasProperty("firebaseBomVersion") ? firebaseBomVersion : "30.0.1" }
44+
implementation platform("com.google.firebase:firebase-bom:${computeFirebaseBomVersion}")
45+
implementation 'com.google.firebase:firebase-appcheck-safetynet'
4346
}

packages/firebase-auth/index.ios.ts

-2
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,6 @@ export class PhoneAuthProvider {
697697
reject();
698698
} else {
699699
this.native.verifyPhoneNumberUIDelegateCompletion(phoneNumber, null, (verificationId, error) => {
700-
console.log('verifyPhoneNumberUIDelegateCompletion', verificationId, error);
701-
console.log(UIApplication.sharedApplication.delegate.respondsToSelector('application:didReceiveRemoteNotification:fetchCompletionHandler'));
702700
if (error) {
703701
reject(FirebaseError.fromNative(error));
704702
} else {

0 commit comments

Comments
 (0)