From 5a21837fb9406ca053be7c0f7502a7585224842f Mon Sep 17 00:00:00 2001 From: ifsnow Date: Thu, 5 Jul 2018 14:55:39 +0900 Subject: [PATCH 01/33] Fix for setting past time in the scheduling. --- .../RNFirebaseNotificationManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java b/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java index 948ba9bd..185dc4d5 100644 --- a/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java +++ b/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotificationManager.java @@ -36,6 +36,7 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.Map; @@ -357,6 +358,21 @@ public class RNFirebaseNotificationManager { notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); if (schedule.containsKey("repeatInterval")) { + // If fireDate you specify is in the past, the alarm triggers immediately. + // So we need to adjust the time for correct operation. + if (fireDate < System.currentTimeMillis()) { + Calendar newFireDate = Calendar.getInstance(); + Calendar currentFireDate = Calendar.getInstance(); + currentFireDate.setTimeInMillis(fireDate); + + newFireDate.add(Calendar.DATE, 1); + newFireDate.set(Calendar.HOUR_OF_DAY, currentFireDate.get(Calendar.HOUR_OF_DAY)); + newFireDate.set(Calendar.MINUTE, currentFireDate.get(Calendar.MINUTE)); + newFireDate.set(Calendar.SECOND, currentFireDate.get(Calendar.SECOND)); + + fireDate = newFireDate.getTimeInMillis(); + } + Long interval = null; switch (schedule.getString("repeatInterval")) { case "minute": From b773717d1a290a2f2920cc2f8f94976ba0b60329 Mon Sep 17 00:00:00 2001 From: Bilal Syed Date: Mon, 9 Jul 2018 22:48:55 +0300 Subject: [PATCH 02/33] [iOS] Fix crash at unknown firebase url --- ios/RNFirebase/links/RNFirebaseLinks.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/RNFirebase/links/RNFirebaseLinks.m b/ios/RNFirebase/links/RNFirebaseLinks.m index db3a94ea..8ed42677 100644 --- a/ios/RNFirebase/links/RNFirebaseLinks.m +++ b/ios/RNFirebase/links/RNFirebaseLinks.m @@ -60,11 +60,11 @@ continueUserActivity:(NSUserActivity *)userActivity return [[FIRDynamicLinks dynamicLinks] handleUniversalLink:userActivity.webpageURL completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) { - if (error != nil){ - NSLog(@"Failed to handle universal link: %@", [error localizedDescription]); - } else { - NSURL* url = dynamicLink ? dynamicLink.url : userActivity.webpageURL; + if (dynamicLink && dynamicLink.url) { + NSURL* url = dynamicLink.url; [self sendJSEvent:self name:LINKS_LINK_RECEIVED body:url.absoluteString]; + } else { + NSLog(@"Failed to handle universal link: %@", userActivity.webpageURL); } }]; } From ce9fdef7a115f5d165a59d85db77445ffc1bfe49 Mon Sep 17 00:00:00 2001 From: Bilal Syed Date: Tue, 10 Jul 2018 00:16:57 +0300 Subject: [PATCH 03/33] handle error --- ios/RNFirebase/links/RNFirebaseLinks.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RNFirebase/links/RNFirebaseLinks.m b/ios/RNFirebase/links/RNFirebaseLinks.m index 8ed42677..61ef8aab 100644 --- a/ios/RNFirebase/links/RNFirebaseLinks.m +++ b/ios/RNFirebase/links/RNFirebaseLinks.m @@ -60,7 +60,7 @@ continueUserActivity:(NSUserActivity *)userActivity return [[FIRDynamicLinks dynamicLinks] handleUniversalLink:userActivity.webpageURL completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) { - if (dynamicLink && dynamicLink.url) { + if (dynamicLink && dynamicLink.url && error == nil) { NSURL* url = dynamicLink.url; [self sendJSEvent:self name:LINKS_LINK_RECEIVED body:url.absoluteString]; } else { From 5e9909954a8bea6b2954f1bf2f51c592b0a2d954 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 21:37:17 +0100 Subject: [PATCH 04/33] [internals] check for string type else return early --- lib/utils/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils/index.js b/lib/utils/index.js index 5680419e..ab7361ab 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -196,6 +196,7 @@ export function noop(): void {} * @returns {*} */ export function stripTrailingSlash(str: string): string { + if (!isString(str)) return str; return str.endsWith('/') ? str.slice(0, -1) : str; } From 1d2757dc308c6dc51ecd81a6f91df5298bfb5342 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 21:37:56 +0100 Subject: [PATCH 05/33] [crashlytics][ios] fix header imports --- ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.h | 2 +- ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.h b/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.h index c529237a..b7ddcda1 100644 --- a/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.h +++ b/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.h @@ -2,7 +2,7 @@ #define RNFirebaseCrashlytics_h #import -#if __has_include() +#if __has_include() #import @interface RNFirebaseCrashlytics : NSObject { diff --git a/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m b/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m index 393f77a1..526c9c0f 100644 --- a/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m +++ b/ios/RNFirebase/fabric/crashlytics/RNFirebaseCrashlytics.m @@ -1,7 +1,7 @@ #import "RNFirebaseCrashlytics.h" -#if __has_include() -#import +#if __has_include() +#import @implementation RNFirebaseCrashlytics RCT_EXPORT_MODULE(); From 7e68d5eb11e9675ff213c3e0748368b443c70070 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:15:50 +0100 Subject: [PATCH 06/33] [iid][ios] temporarily remove Messaging dependency for v4.3.0 release until an outcome is agreed on original PR #1215 --- ios/RNFirebase/instanceid/RNFirebaseInstanceId.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/RNFirebase/instanceid/RNFirebaseInstanceId.m b/ios/RNFirebase/instanceid/RNFirebaseInstanceId.m index 2720036b..80d79a6e 100644 --- a/ios/RNFirebase/instanceid/RNFirebaseInstanceId.m +++ b/ios/RNFirebase/instanceid/RNFirebaseInstanceId.m @@ -1,7 +1,7 @@ #import "RNFirebaseInstanceId.h" #if __has_include() -#import +//#import #import @implementation RNFirebaseInstanceId @@ -32,9 +32,9 @@ RCT_EXPORT_METHOD(getToken:(NSString *)authorizedEntity resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSDictionary * options = nil; - if ([FIRMessaging messaging].APNSToken) { - options = @{@"apns_token": [FIRMessaging messaging].APNSToken}; - } +// if ([FIRMessaging messaging].APNSToken) { +// options = @{@"apns_token": [FIRMessaging messaging].APNSToken}; +// } [[FIRInstanceID instanceID] tokenWithAuthorizedEntity:authorizedEntity scope:scope options:options handler:^(NSString * _Nullable identity, NSError * _Nullable error) { if (error) { reject(@"instance_id_error", @"Failed to getToken", error); From b4f97c8f8c0e04b0bfeb5dc337543a2112a811e8 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:17:11 +0100 Subject: [PATCH 07/33] [tests][storage] content tests - need expanding - verified on console --- bridge/e2e/storage/storage.e2e.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bridge/e2e/storage/storage.e2e.js b/bridge/e2e/storage/storage.e2e.js index f5211185..50f28f5b 100644 --- a/bridge/e2e/storage/storage.e2e.js +++ b/bridge/e2e/storage/storage.e2e.js @@ -49,6 +49,18 @@ describe('storage()', () => { .downloadFile( `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg` ); + await firebase + .storage() + .ref('/cat.gif') + .downloadFile( + `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif` + ); + await firebase + .storage() + .ref('/hei.heic') + .downloadFile( + `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic` + ); }); it('errors if permission denied', async () => { @@ -75,6 +87,20 @@ describe('storage()', () => { `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/ok.jpeg` ); + await firebase + .storage() + .ref('/uploadCat.gif') + .putFile( + `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/cat.gif` + ); + + await firebase + .storage() + .ref('/uploadHei.heic') + .putFile( + `${firebase.storage.Native.DOCUMENT_DIRECTORY_PATH}/hei.heic` + ); + uploadTaskSnapshot.state.should.eql(firebase.storage.TaskState.SUCCESS); uploadTaskSnapshot.bytesTransferred.should.eql( uploadTaskSnapshot.totalBytes From 55a650e909d7361d746082efe287b5961286dc06 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:17:50 +0100 Subject: [PATCH 08/33] [tests][ios] lock Firebase SDK versions in Podfile --- bridge/ios/Podfile | 28 +++++++------- bridge/ios/Podfile.lock | 82 +++++++++++++++++++++-------------------- 2 files changed, 56 insertions(+), 54 deletions(-) diff --git a/bridge/ios/Podfile b/bridge/ios/Podfile index e54784fd..5bd2f566 100644 --- a/bridge/ios/Podfile +++ b/bridge/ios/Podfile @@ -18,21 +18,21 @@ target 'testing' do 'RCTWebSocket', ] - pod 'Firebase/AdMob' - pod 'Firebase/Auth' - pod 'Firebase/Core' - pod 'Firebase/Crash' - pod 'Firebase/Database' - pod 'Firebase/Functions' - pod 'Firebase/DynamicLinks' - pod 'Firebase/Firestore' - pod 'Firebase/Invites' - pod 'Firebase/Messaging' - pod 'Firebase/RemoteConfig' - pod 'Firebase/Storage' - pod 'Firebase/Performance' + pod 'Firebase/AdMob', '~> 5.3.0' + pod 'Firebase/Auth', '~> 5.3.0' + pod 'Firebase/Core', '~> 5.3.0' + pod 'Firebase/Crash', '~> 5.3.0' + pod 'Firebase/Database', '~> 5.3.0' + pod 'Firebase/Functions', '~> 5.3.0' + pod 'Firebase/DynamicLinks', '~> 5.3.0' + pod 'Firebase/Firestore', '~> 5.3.0' + pod 'Firebase/Invites', '~> 5.3.0' + pod 'Firebase/Messaging', '~> 5.3.0' + pod 'Firebase/RemoteConfig', '~> 5.3.0' + pod 'Firebase/Storage', '~> 5.3.0' + pod 'Firebase/Performance', '~> 5.3.0' pod 'Fabric', '~> 1.7.5' - pod 'Crashlytics', '~> 3.10.1' + pod 'Crashlytics', '~> 3.10.4' pod 'RNFirebase', :path => '../../ios/RNFirebase.podspec' diff --git a/bridge/ios/Podfile.lock b/bridge/ios/Podfile.lock index da0abb4e..4e947e5f 100644 --- a/bridge/ios/Podfile.lock +++ b/bridge/ios/Podfile.lock @@ -5,9 +5,9 @@ PODS: - BoringSSL/Implementation (10.0.5): - BoringSSL/Interface (= 10.0.5) - BoringSSL/Interface (10.0.5) - - Crashlytics (3.10.2): - - Fabric (~> 1.7.7) - - Fabric (1.7.7) + - Crashlytics (3.10.4): + - Fabric (~> 1.7.9) + - Fabric (1.7.9) - Firebase/AdMob (5.3.0): - Firebase/Core - Google-Mobile-Ads-SDK (= 7.31.0) @@ -162,25 +162,27 @@ PODS: - GoogleToolboxForMac/Defines (= 2.1.4) - "GoogleToolboxForMac/NSDictionary+URLArguments (= 2.1.4)" - "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)" - - gRPC (1.12.0): - - gRPC-RxLibrary (= 1.12.0) - - gRPC/Main (= 1.12.0) - - gRPC-Core (1.12.0): - - gRPC-Core/Implementation (= 1.12.0) - - gRPC-Core/Interface (= 1.12.0) - - gRPC-Core/Implementation (1.12.0): + - gRPC (1.13.0): + - gRPC-RxLibrary (= 1.13.0) + - gRPC/Main (= 1.13.0) + - gRPC-Core (1.13.0): + - gRPC-Core/Implementation (= 1.13.0) + - gRPC-Core/Interface (= 1.13.0) + - gRPC-Core/Implementation (1.13.0): - BoringSSL (~> 10.0) - - gRPC-Core/Interface (= 1.12.0) + - gRPC-Core/Interface (= 1.13.0) - nanopb (~> 0.3) - - gRPC-Core/Interface (1.12.0) - - gRPC-ProtoRPC (1.12.0): - - gRPC (= 1.12.0) - - gRPC-RxLibrary (= 1.12.0) + - gRPC-Core/Interface (1.13.0) + - gRPC-ProtoRPC (1.13.0): + - gRPC-ProtoRPC/Main (= 1.13.0) + - gRPC-ProtoRPC/Main (1.13.0): + - gRPC (= 1.13.0) + - gRPC-RxLibrary (= 1.13.0) - Protobuf (~> 3.0) - - gRPC-RxLibrary (1.12.0) - - gRPC/Main (1.12.0): - - gRPC-Core (= 1.12.0) - - gRPC-RxLibrary (= 1.12.0) + - gRPC-RxLibrary (1.13.0) + - gRPC/Main (1.13.0): + - gRPC-Core (= 1.13.0) + - gRPC-RxLibrary (= 1.13.0) - GTMOAuth2 (1.1.6): - GTMSessionFetcher (~> 1.1) - GTMSessionFetcher (1.1.15): @@ -216,21 +218,21 @@ PODS: - yoga (0.55.3.React) DEPENDENCIES: - - Crashlytics (~> 3.10.1) + - Crashlytics (~> 3.10.4) - Fabric (~> 1.7.5) - - Firebase/AdMob - - Firebase/Auth - - Firebase/Core - - Firebase/Crash - - Firebase/Database - - Firebase/DynamicLinks - - Firebase/Firestore - - Firebase/Functions - - Firebase/Invites - - Firebase/Messaging - - Firebase/Performance - - Firebase/RemoteConfig - - Firebase/Storage + - Firebase/AdMob (~> 5.3.0) + - Firebase/Auth (~> 5.3.0) + - Firebase/Core (~> 5.3.0) + - Firebase/Crash (~> 5.3.0) + - Firebase/Database (~> 5.3.0) + - Firebase/DynamicLinks (~> 5.3.0) + - Firebase/Firestore (~> 5.3.0) + - Firebase/Functions (~> 5.3.0) + - Firebase/Invites (~> 5.3.0) + - Firebase/Messaging (~> 5.3.0) + - Firebase/Performance (~> 5.3.0) + - Firebase/RemoteConfig (~> 5.3.0) + - Firebase/Storage (~> 5.3.0) - React/Core (from `../node_modules/react-native`) - React/RCTNetwork (from `../node_modules/react-native`) - React/RCTText (from `../node_modules/react-native`) @@ -284,8 +286,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: BoringSSL: cf3f1793eb6e3c445c4d150456341f149c268a35 - Crashlytics: 0360624eea1c978a743feddb2fb1ef8b37fb7a0d - Fabric: bda89e242bce1b7b8ab264248cf3407774ce0095 + Crashlytics: 915a7787b84f635fb2a81f92a90e265c2c413f76 + Fabric: a2917d3895e4c1569b9c3170de7320ea1b1e6661 Firebase: 68afeeb05461db02d7c9e3215cda28068670f4aa FirebaseABTesting: 1f50b8d50f5e3469eea54e7463a7b7fe221d1f5e FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2 @@ -307,10 +309,10 @@ SPEC CHECKSUMS: GoogleAPIClientForREST: f7951c455df271bc6259b3ddb4073d0026475ccf GoogleSignIn: d9ef55b10f0aa401a5de2747f59b725e4b9732ac GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f - gRPC: 9362451032695e2dfb7bafcd3740e3a27939e4ff - gRPC-Core: 9696b220565b283e021cf2722d473a4a74b7622a - gRPC-ProtoRPC: a1bd56fb1991a8dae4581250d7259eddabb66779 - gRPC-RxLibrary: 1ed5314e8b38cd6e55c9bfa048387136ae925ce9 + gRPC: 81b990caa01d7c32605d300c2ffd1b5ba0ef9e49 + gRPC-Core: a56b086a8ef5ced6f6ba5be5bc0a63fca185015a + gRPC-ProtoRPC: 842797fbe05dfcf891afb4a5048e5ccf5f06ef86 + gRPC-RxLibrary: fa6852f98d6ec0b73c0ec2f6406c26943099d501 GTMOAuth2: c77fe325e4acd453837e72d91e3b5f13116857b2 GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2 leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5 @@ -320,6 +322,6 @@ SPEC CHECKSUMS: RNFirebase: 2b25fd2e60269f26bb0a76c71dcc942b35a77df0 yoga: a23273df0088bf7f2bb7e5d7b00044ea57a2a54a -PODFILE CHECKSUM: 582ceaad051470812ad9203e13b5ea8ad20c78ac +PODFILE CHECKSUM: af3286375d5c28aa5d912b64dee23c8f7c4f9282 COCOAPODS: 1.5.3 From c023a001a4db52964210b2a59e17b7668b8aea13 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:43:34 +0100 Subject: [PATCH 09/33] [types][flow] fix _forceResending type --- lib/modules/auth/phone/PhoneAuthListener.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/modules/auth/phone/PhoneAuthListener.js b/lib/modules/auth/phone/PhoneAuthListener.js index 36a8a2ac..982a2e10 100644 --- a/lib/modules/auth/phone/PhoneAuthListener.js +++ b/lib/modules/auth/phone/PhoneAuthListener.js @@ -32,6 +32,7 @@ export default class PhoneAuthListener { _timeout: number; _publicEvents: Object; _internalEvents: Object; + _forceResending: boolean; _reject: Function | null; _resolve: Function | null; _credential: Object | null; From c35011145b230e03406a1a81adca5fa0ddcf5855 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:44:27 +0100 Subject: [PATCH 10/33] [types][flow] add missing GetOptions type import --- lib/modules/firestore/Query.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/modules/firestore/Query.js b/lib/modules/firestore/Query.js index 45827019..56164fa0 100644 --- a/lib/modules/firestore/Query.js +++ b/lib/modules/firestore/Query.js @@ -13,7 +13,12 @@ import { getNativeModule } from '../../utils/native'; import type Firestore from './'; import type Path from './Path'; -import type { MetadataChanges, QueryDirection, QueryOperator } from './types'; +import type { + MetadataChanges, + QueryDirection, + QueryOperator, + GetOptions, +} from './types'; const DIRECTIONS: { [QueryDirection]: string } = { ASC: 'ASCENDING', From 16a7e192f7f88e197b0c0ddea7f6d79bf94f0314 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:45:26 +0100 Subject: [PATCH 11/33] [types][flow] fix NativeDocumentChange.type -> should be enum to match other usage --- lib/modules/firestore/types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/firestore/types.js b/lib/modules/firestore/types.js index 6ca120d0..fa97342b 100644 --- a/lib/modules/firestore/types.js +++ b/lib/modules/firestore/types.js @@ -27,7 +27,7 @@ export type NativeDocumentChange = { document: NativeDocumentSnapshot, newIndex: number, oldIndex: number, - type: string, + type: 'added' | 'modified' | 'removed', }; export type NativeDocumentSnapshot = { From b3a675d96441bff0587bcd56c492cd0a891cf315 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:51:45 +0100 Subject: [PATCH 12/33] [tests] misc project files --- .../android/app/src/main/AndroidManifest.xml | 37 ++++++++++++++++--- .../main/java/com/testing/MainActivity.java | 4 ++ bridge/android/build.gradle | 2 +- bridge/package.json | 2 +- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/bridge/android/app/src/main/AndroidManifest.xml b/bridge/android/app/src/main/AndroidManifest.xml index b016f89e..61b4e13e 100755 --- a/bridge/android/app/src/main/AndroidManifest.xml +++ b/bridge/android/app/src/main/AndroidManifest.xml @@ -65,18 +65,45 @@ - + + android:scheme="http" + android:host="je786.app.goo.gl" /> + + + + + + + + android:scheme="http" + android:host="je786.app.goo.gl" /> + + + + + + + + + + + + + + + + diff --git a/bridge/android/app/src/main/java/com/testing/MainActivity.java b/bridge/android/app/src/main/java/com/testing/MainActivity.java index 286ab301..b0329405 100755 --- a/bridge/android/app/src/main/java/com/testing/MainActivity.java +++ b/bridge/android/app/src/main/java/com/testing/MainActivity.java @@ -32,6 +32,10 @@ public class MainActivity extends ReactActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkWindowPerms(); + // ATTENTION: This was auto-generated to handle app links. + Intent appLinkIntent = getIntent(); + String appLinkAction = appLinkIntent.getAction(); + Uri appLinkData = appLinkIntent.getData(); } public void checkWindowPerms() { diff --git a/bridge/android/build.gradle b/bridge/android/build.gradle index 8e7ee8c7..1fdb7242 100755 --- a/bridge/android/build.gradle +++ b/bridge/android/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.1.3' classpath 'com.google.gms:google-services:4.0.1' classpath 'com.google.firebase:firebase-plugins:1.1.1' classpath 'io.fabric.tools:gradle:1.25.4' diff --git a/bridge/package.json b/bridge/package.json index 1b75558f..f81df1e8 100755 --- a/bridge/package.json +++ b/bridge/package.json @@ -13,7 +13,7 @@ "test-android-reuse": "detox test --configuration android.emu.debug --reuse", "test-android-cover": "nyc detox test --configuration android.emu.debug", "test-android-cover-reuse": "nyc detox test --configuration android.emu.debug --reuse", - "test-ios": "detox test --configuration ios.sim.debug", + "test-ios": "detox test --configuration ios.sim.debug --loglevel warn", "test-ios-reuse": "detox test --configuration ios.sim.debug --reuse --loglevel warn", "test-ios-cover": "nyc detox test --configuration ios.sim.debug", "test-ios-cover-reuse": "nyc detox test --configuration ios.sim.debug --reuse --loglevel warn", From 82bb3ca3f71ec6fc8152133358ec1966faf2cd2a Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 22:52:08 +0100 Subject: [PATCH 13/33] 4.3.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4282e0ca..5ed9f03b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.2.0", + "version": "4.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6d099010..41522403 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.2.0", + "version": "4.3.0", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From e4d42f15b80d5edc8630643ab3de979bdeca31ff Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:02:34 +0100 Subject: [PATCH 14/33] update npm ignore --- .npmignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.npmignore b/.npmignore index 0890a2e7..a2bc77d3 100644 --- a/.npmignore +++ b/.npmignore @@ -81,3 +81,9 @@ bin/test.js .github example codorials +.vscode +.nyc_output +React-Native-Firebase.svg +CONTRIBUTING.md +CODE_OF_CONDUCT.md +android/.settings From e6b8c7f9f229e4ad5b1ffac8931ee170d8327972 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:02:48 +0100 Subject: [PATCH 15/33] 4.3.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ed9f03b..a70119ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.0", + "version": "4.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 41522403..900ef1a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.0", + "version": "4.3.1", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From 8886584bc0f1f1c5021e8b8c2ca6a11b8d8a9238 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:05:12 +0100 Subject: [PATCH 16/33] update npm ignore --- .npmignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index a2bc77d3..5d4654d6 100644 --- a/.npmignore +++ b/.npmignore @@ -75,7 +75,6 @@ coverage yarn.lock tests bridge/ -lib/.watchmanconfig buddybuild_postclone.sh bin/test.js .github @@ -87,3 +86,4 @@ React-Native-Firebase.svg CONTRIBUTING.md CODE_OF_CONDUCT.md android/.settings +lib From 7c50c160e3477b4afacd5b893035e9c756b4e578 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:05:19 +0100 Subject: [PATCH 17/33] 4.3.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a70119ec..f77d2f83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.1", + "version": "4.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 900ef1a1..01275d79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.1", + "version": "4.3.2", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From 8e492faf8925608c7808bdf78abe69558e27db9f Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:07:43 +0100 Subject: [PATCH 18/33] update npm ignore --- .npmignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.npmignore b/.npmignore index 5d4654d6..9b624fb2 100644 --- a/.npmignore +++ b/.npmignore @@ -86,4 +86,3 @@ React-Native-Firebase.svg CONTRIBUTING.md CODE_OF_CONDUCT.md android/.settings -lib From 093d15aa677f8e100a7ea3a6611189efad629093 Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:07:46 +0100 Subject: [PATCH 19/33] 4.3.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f77d2f83..9758e822 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.2", + "version": "4.3.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 01275d79..eceb9550 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.2", + "version": "4.3.3", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From 5be43f10a6dcb8741ea51f39b05e80b7a0de941c Mon Sep 17 00:00:00 2001 From: Salakar Date: Tue, 10 Jul 2018 23:09:55 +0100 Subject: [PATCH 20/33] update npm ignore --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index 9b624fb2..d2e4626d 100644 --- a/.npmignore +++ b/.npmignore @@ -86,3 +86,4 @@ React-Native-Firebase.svg CONTRIBUTING.md CODE_OF_CONDUCT.md android/.settings +README.md From 2e2913114ab5e2f48848f85217fe21bd8d66ea83 Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 11 Jul 2018 08:21:02 +0100 Subject: [PATCH 21/33] revert #869 to fix #1292 temporarily --- lib/modules/database/Reference.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/modules/database/Reference.js b/lib/modules/database/Reference.js index 72171865..1811a23f 100644 --- a/lib/modules/database/Reference.js +++ b/lib/modules/database/Reference.js @@ -299,15 +299,15 @@ export default class Reference extends ReferenceBase { * @param onComplete * @returns {*} */ - push(value: any, onComplete?: Function): ThenableReference { + push(value: any, onComplete?: Function): Reference | Promise { if (value === null || value === undefined) { - return new ThenableReference( + return new Reference( this._database, `${this.path}/${generatePushID(this._database._serverTimeOffset)}` ); } - const newRef = new ThenableReference( + const newRef = new Reference( this._database, `${this.path}/${generatePushID(this._database._serverTimeOffset)}` ); @@ -894,10 +894,10 @@ export default class Reference extends ReferenceBase { } // eslint-disable-next-line no-unused-vars -declare class ThenableReference<+R> extends Reference { - then( - onFulfill?: (value: R) => Promise | U, - onReject?: (error: any) => Promise | U - ): Promise; - catch(onReject?: (error: any) => Promise | U): Promise; -} +// class ThenableReference<+R> extends Reference { +// then( +// onFulfill?: (value: R) => Promise | U, +// onReject?: (error: any) => Promise | U +// ): Promise; +// catch(onReject?: (error: any) => Promise | U): Promise; +// } From 3ca718c6086cdd7c5e58d2e7e650ac08c5260f0a Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 11 Jul 2018 08:21:29 +0100 Subject: [PATCH 22/33] 4.3.4 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9758e822..dd49450f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.3", + "version": "4.3.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index eceb9550..882d74cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.3", + "version": "4.3.4", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From c70af86e2ee43ea337784b4a5e044d68ca04d30c Mon Sep 17 00:00:00 2001 From: Bilal Syed Date: Wed, 11 Jul 2018 15:30:35 +0300 Subject: [PATCH 23/33] [Android] Fix getInitialLink() is NULL --- .../java/io/invertase/firebase/links/RNFirebaseLinks.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/io/invertase/firebase/links/RNFirebaseLinks.java b/android/src/main/java/io/invertase/firebase/links/RNFirebaseLinks.java index 9c308168..099bd3d3 100644 --- a/android/src/main/java/io/invertase/firebase/links/RNFirebaseLinks.java +++ b/android/src/main/java/io/invertase/firebase/links/RNFirebaseLinks.java @@ -174,7 +174,11 @@ public class RNFirebaseLinks extends ReactContextBaseJavaModule implements Activ // Looks at the internals of the link data to detect whether it's an invitation or not private boolean isInvitation(PendingDynamicLinkData pendingDynamicLinkData) { - return FirebaseAppInvite.getInvitation(pendingDynamicLinkData) != null; + FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(pendingDynamicLinkData); + if (invite != null && invite.getInvitationId() != null && !invite.getInvitationId().isEmpty()) { + return true; + } + return false; } private DynamicLink.Builder getDynamicLinkBuilder(final ReadableMap linkData) { From 94aed54a0a58557d86d19c094cb2b3a1b16eda12 Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 11 Jul 2018 14:41:52 +0100 Subject: [PATCH 24/33] fix license format --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 882d74cb..f239cf0d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "setupFiles": [], "unmockedModulePathPatterns": ["./node_modules/react", "./node_modules/react-native", "./node_modules/react-native-mock", "./node_modules/react-addons-test-utils"] }, - "license": "APACHE-2.0", + "license": "Apache-2.0", "keywords": ["react", "admob", "auth", "config", "digits", "fabric", "functions", "phone-auth", "sms", "firestore", "cloud-firestore", "datastore", "remote-config", "transactions", "react-native", "react-native-firebase", "firebase", "fcm", "apn", "gcm", "analytics", "messaging", "database", "android", "ios", "crash", "firestack", "performance", "firestore", "dynamic-links", "crashlytics"], "peerDependencies": { "react": "*", From 01c274a2f14f93905eacf77c3c3dffe1749afb01 Mon Sep 17 00:00:00 2001 From: Salakar Date: Wed, 11 Jul 2018 14:43:50 +0100 Subject: [PATCH 25/33] 4.3.5 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd49450f..d137c2cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.4", + "version": "4.3.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f239cf0d..23989c2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.4", + "version": "4.3.5", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From 96b837287361d1660a69441f9b61920f40796f94 Mon Sep 17 00:00:00 2001 From: Salakar Date: Fri, 13 Jul 2018 14:03:20 +0100 Subject: [PATCH 26/33] [android] fixes 1012 --- android/build.gradle | 6 +++++- android/src/main/AndroidManifest.xml | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 4c267196..acb6ecc1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -36,6 +36,9 @@ android { } productFlavors { } + lintOptions { + disable 'GradleCompatible' + } } rootProject.gradle.buildFinished { buildResult -> @@ -68,7 +71,8 @@ rootProject.gradle.buildFinished { buildResult -> logger.log(LogLevel.ERROR, "| |") logger.log(LogLevel.ERROR, " ----------------------------------------------------------- ") } - } catch (Exception exception) {} + } catch (Exception exception) { + } } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 6ed6b311..152971db 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -2,4 +2,6 @@ package="io.invertase.firebase"> + + From b29fbafc98bb43f3a5b4b395274d906679403a9f Mon Sep 17 00:00:00 2001 From: Salakar Date: Fri, 13 Jul 2018 14:05:50 +0100 Subject: [PATCH 27/33] 4.3.6 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d137c2cf..9a025b04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.5", + "version": "4.3.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 23989c2f..ff8a3a2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.5", + "version": "4.3.6", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From d1783152dc983f33d027b6707ee3225ef09e9eb1 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sat, 14 Jul 2018 23:34:57 +0100 Subject: [PATCH 28/33] [ios][storage] fix #739 --- ios/RNFirebase/storage/RNFirebaseStorage.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/RNFirebase/storage/RNFirebaseStorage.m b/ios/RNFirebase/storage/RNFirebaseStorage.m index fac5986b..7d879724 100644 --- a/ios/RNFirebase/storage/RNFirebaseStorage.m +++ b/ios/RNFirebase/storage/RNFirebaseStorage.m @@ -231,11 +231,15 @@ RCT_EXPORT_METHOD(putFile:(NSString *) appDisplayName options.networkAccessAllowed = true; [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { if (info[PHImageErrorKey] == nil) { - if (UTTypeConformsTo((__bridge CFStringRef)dataUTI, kUTTypeJPEG)) { + if ( + UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypeJPEG) || + UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypePNG) || + UTTypeConformsTo((__bridge CFStringRef) dataUTI, kUTTypeGIF) + ) { firmetadata.contentType = [self utiToMimeType:dataUTI]; [self uploadData:appDisplayName data:imageData firmetadata:firmetadata path:path resolver:resolve rejecter:reject]; } else { - // if the image UTI is not JPEG then convert to JPEG, e.g. HEI + // all other image types are converted to JPEG, e.g. HEI CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL); NSDictionary *imageInfo = (__bridge NSDictionary*)CGImageSourceCopyPropertiesAtIndex(source, 0, NULL); NSDictionary *imageMetadata = [imageInfo copy]; From 947825c8ee094f264da6f87d49299a171fe1a4b6 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sat, 14 Jul 2018 23:35:04 +0100 Subject: [PATCH 29/33] 4.3.7 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a025b04..ec1b6a13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.6", + "version": "4.3.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ff8a3a2d..dd0aa9bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-firebase", - "version": "4.3.6", + "version": "4.3.7", "author": "Invertase (http://invertase.io)", "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.", "main": "dist/index.js", From aa12de324881fa778aad3416605a44e68b02a11c Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 15 Jul 2018 00:43:12 +0100 Subject: [PATCH 30/33] [js][iid] getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope --- lib/modules/iid/index.js | 49 ++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/lib/modules/iid/index.js b/lib/modules/iid/index.js index 4ede6748..773fb033 100644 --- a/lib/modules/iid/index.js +++ b/lib/modules/iid/index.js @@ -7,8 +7,8 @@ import { getNativeModule } from '../../utils/native'; import type App from '../core/app'; -export const MODULE_NAME = 'RNFirebaseInstanceId'; export const NAMESPACE = 'iid'; +export const MODULE_NAME = 'RNFirebaseInstanceId'; export default class InstanceId extends ModuleBase { constructor(app: App) { @@ -20,20 +20,51 @@ export default class InstanceId extends ModuleBase { }); } - delete(): Promise { - return getNativeModule(this).delete(); - } - + /** + * Get the current Instance ID. + * + * @returns {*} + */ get(): Promise { return getNativeModule(this).get(); } - getToken(authorizedEntity: string, scope: string): Promise { - return getNativeModule(this).getToken(authorizedEntity, scope); + /** + * Delete the current Instance ID. + * + * @returns {*} + */ + delete(): Promise { + return getNativeModule(this).delete(); } - deleteToken(authorizedEntity: string, scope: string): Promise { - return getNativeModule(this).deleteToken(authorizedEntity, scope); + /** + * Get a token that authorizes an Entity to perform an action on behalf + * of the application identified by Instance ID. + * + * @param authorizedEntity + * @param scope + * @returns {Promise} + */ + getToken(authorizedEntity?: string, scope?: string): Promise { + return getNativeModule(this).getToken( + authorizedEntity || this.app.options.messagingSenderId, + scope || '*' + ); + } + + /** + * Revokes access to a scope (action) for an entity previously authorized by getToken(). + * + * @param authorizedEntity + * @param scope + * @returns {Promise} + */ + deleteToken(authorizedEntity?: string, scope?: string): Promise { + return getNativeModule(this).deleteToken( + authorizedEntity || this.app.options.messagingSenderId, + scope || '*' + ); } } From 6a7d3ddc7a3c768368704a0fd7c67bb2f43680ef Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 15 Jul 2018 00:44:20 +0100 Subject: [PATCH 31/33] [types][iid] getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope --- lib/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 45c5d54b..65bf3579 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -1089,8 +1089,8 @@ declare module 'react-native-firebase' { interface InstanceId { delete(): Promise; get(): Promise; - getToken(authorizedEntity: string, scope: string): Promise; - deleteToken(authorizedEntity: string, scope: string): Promise; + getToken(authorizedEntity?: string, scope?: string): Promise; + deleteToken(authorizedEntity?: string, scope?: string): Promise; } } From 8aac77b3ace533676b70f315a902f3dde7608fa0 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 15 Jul 2018 00:45:04 +0100 Subject: [PATCH 32/33] [tests][iid] more coverage including change: getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope --- bridge/e2e/iid/iid.e2e.js | 49 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/bridge/e2e/iid/iid.e2e.js b/bridge/e2e/iid/iid.e2e.js index 1c249e5a..99bbd9af 100644 --- a/bridge/e2e/iid/iid.e2e.js +++ b/bridge/e2e/iid/iid.e2e.js @@ -1,4 +1,4 @@ -describe('iid()', () => { +describe.only('iid()', () => { describe('get()', () => { it('returns instance id string', async () => { const iid = await firebase.iid().get(); @@ -10,13 +10,56 @@ describe('iid()', () => { it('deletes the current instance id', async () => { const iidBefore = await firebase.iid().get(); iidBefore.should.be.a.String(); - await firebase.iid().delete(); const iidAfter = await firebase.iid().get(); iidAfter.should.be.a.String(); - iidBefore.should.not.equal(iidAfter); }); }); + + describe('getToken()', () => { + it('should return an FCM token from getToken with arguments', async () => { + const authorizedEntity = firebase.iid().app.options.messagingSenderId; + + await firebase.iid().delete(); + const token = await firebase.iid().getToken(authorizedEntity, '*'); + token.should.be.a.String(); + }); + + it('should return an FCM token from getToken without arguments', async () => { + await firebase.iid().delete(); + const token = await firebase.iid().getToken(); + token.should.be.a.String(); + }); + + it('should return an FCM token from getToken with 1 argument', async () => { + const authorizedEntity = firebase.iid().app.options.messagingSenderId; + + await firebase.iid().delete(); + const token = await firebase.iid().getToken(authorizedEntity); + token.should.be.a.String(); + }); + }); + + describe('deleteToken()', () => { + it('should return nil from deleteToken with arguments', async () => { + const authorizedEntity = firebase.iid().app.options.messagingSenderId; + + const token = await firebase.iid().deleteToken(authorizedEntity, '*'); + should.not.exist(token); + }); + + it('should return nil from deleteToken without arguments', async () => { + const token = await firebase.iid().deleteToken(); + should.not.exist(token); + }); + + it('should return nil from deleteToken with 1 argument', async () => { + const authorizedEntity = firebase.iid().app.options.messagingSenderId; + + const token = await firebase.iid().deleteToken(authorizedEntity); + should.not.exist(token); + }); + }); }); From 7a66c165ed1bbf12329029453d59a4a18d32cca5 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 15 Jul 2018 00:47:00 +0100 Subject: [PATCH 33/33] [tests][iid] remove test focus --- bridge/e2e/iid/iid.e2e.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/e2e/iid/iid.e2e.js b/bridge/e2e/iid/iid.e2e.js index 99bbd9af..18f3a07f 100644 --- a/bridge/e2e/iid/iid.e2e.js +++ b/bridge/e2e/iid/iid.e2e.js @@ -1,4 +1,4 @@ -describe.only('iid()', () => { +describe('iid()', () => { describe('get()', () => { it('returns instance id string', async () => { const iid = await firebase.iid().get();