From 0577518578e688221149b82ec2a12062d19fd625 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 16 Nov 2017 15:45:29 +0800 Subject: [PATCH 01/21] fix for 'show_in_foreground' flag of local notification for iOS 10+ --- ios/RNFirebase/messaging/RNFirebaseMessaging.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/RNFirebase/messaging/RNFirebaseMessaging.m b/ios/RNFirebase/messaging/RNFirebaseMessaging.m index 36294b79..dfca2348 100644 --- a/ios/RNFirebase/messaging/RNFirebaseMessaging.m +++ b/ios/RNFirebase/messaging/RNFirebaseMessaging.m @@ -45,6 +45,10 @@ RCT_ENUM_CONVERTER(NSCalendarUnit, content.userInfo = details; content.badge = [RCTConvert NSNumber:details[@"badge"]]; + if(details[@"show_in_foreground"]) { + [content setValue:@YES forKeyPath:@"shouldAlwaysAlertWhileAppIsForeground"]; + } + NSDate *fireDate = [RCTConvert NSDate:details[@"fire_date"]]; if(fireDate == nil){ From 02ac39678ea198280f155125be3d4015700b8107 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 16 Nov 2017 16:58:10 +0800 Subject: [PATCH 02/21] flag checking fix --- ios/RNFirebase/messaging/RNFirebaseMessaging.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/RNFirebase/messaging/RNFirebaseMessaging.m b/ios/RNFirebase/messaging/RNFirebaseMessaging.m index dfca2348..226b30a9 100644 --- a/ios/RNFirebase/messaging/RNFirebaseMessaging.m +++ b/ios/RNFirebase/messaging/RNFirebaseMessaging.m @@ -45,8 +45,10 @@ RCT_ENUM_CONVERTER(NSCalendarUnit, content.userInfo = details; content.badge = [RCTConvert NSNumber:details[@"badge"]]; - if(details[@"show_in_foreground"]) { - [content setValue:@YES forKeyPath:@"shouldAlwaysAlertWhileAppIsForeground"]; + if([details objectForKey:@"show_in_foreground"] != nil) { + if([(NSNumber *)details[@"show_in_foreground"] boolValue] == YES) { + [content setValue:@YES forKeyPath:@"shouldAlwaysAlertWhileAppIsForeground"]; + } } NSDate *fireDate = [RCTConvert NSDate:details[@"fire_date"]]; From 8511705d8ee4b3795acb9c03720998d3afc80418 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 10:02:01 +0000 Subject: [PATCH 03/21] [auth][android] Add methods to set the auth language via code or device language --- .../firebase/auth/RNFirebaseAuth.java | 26 +++++++++++++++++++ lib/modules/auth/index.js | 17 ++++++++++++ 2 files changed, 43 insertions(+) diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index 601f5cb5..36649088 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -1129,6 +1129,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { /** * fetchProvidersForEmail * + * @param appName * @param promise */ @ReactMethod @@ -1163,6 +1164,31 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { }); } + /** + * Set the language code for the auth module + * @param appName + * @param code + */ + @ReactMethod + public void setLanguageCode(String appName, String code) { + FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); + FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); + + firebaseAuth.setLanguageCode(code); + } + + /** + * Use the device language + * @param appName + */ + @ReactMethod + public void useDeviceLanguage(String appName) { + FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); + FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); + + firebaseAuth.useAppLanguage(); + } + /* ------------------ * INTERNAL HELPERS * ---------------- */ diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index 67abfe8a..accc5f8e 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -322,6 +322,23 @@ export default class Auth extends ModuleBase { return this._native.fetchProvidersForEmail(email); } + /** + * Sets the language for the auth module using the device language + * @returns {*} + */ + useDeviceLanguage() { + return this._native.useDeviceLanguage(); + } + + /** + * Sets the language for the auth module + * @param code + * @returns {*} + */ + set languageCode(code) { + return this._native.setLanguageCode(code); + } + /** * Get the currently signed in user * @return {Promise} From b266a0451042bf63a638a4b25df385ebc9fffec6 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 10:17:04 +0000 Subject: [PATCH 04/21] [auth][ios] Add auth language methods --- ios/RNFirebase/auth/RNFirebaseAuth.m | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index 37662dcb..7668fd0f 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -912,6 +912,34 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail: return credential; } +/** + setLanguageCode + + @param NSString code + @return + */ +RCT_EXPORT_METHOD(setLanguageCode: + (NSString *) appName + code: + (NSString *) code) { + FIRApp *firApp = [FIRApp appNamed:appName]; + + [FIRAuth authWithApp:firApp].languageCode = code; +} + +/** + useDeviceLanguage + + @param NSString code + @return + */ +RCT_EXPORT_METHOD(useDeviceLanguage: + (NSString *) appName) { + FIRApp *firApp = [FIRApp appNamed:appName]; + + [[FIRAuth authWithApp:firApp] useAppLanguage]; +} + // This is here to protect against bugs in the iOS SDK which don't // correctly refresh the user object when performing certain operations - (void)reloadAndReturnUser:(FIRUser *)user From fb8c08c7f6034ad8569a3c4eceb53d4cf519a281 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 10:56:01 +0000 Subject: [PATCH 05/21] [auth] Remove unnecessary return --- lib/modules/auth/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index accc5f8e..bf32aa26 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -327,7 +327,7 @@ export default class Auth extends ModuleBase { * @returns {*} */ useDeviceLanguage() { - return this._native.useDeviceLanguage(); + this._native.useDeviceLanguage(); } /** @@ -335,8 +335,8 @@ export default class Auth extends ModuleBase { * @param code * @returns {*} */ - set languageCode(code) { - return this._native.setLanguageCode(code); + set languageCode(code: string) { + this._native.setLanguageCode(code); } /** From e452f514a324c63522fffdf08c818a29b5c409b9 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 11:27:59 +0000 Subject: [PATCH 06/21] [utils] Allow _native to return statics --- lib/utils/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index 6f619e4e..4c1697d8 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -351,9 +351,13 @@ export function nativeWithApp(appName: string, NativeModule: Object) { for (let i = 0, len = methods.length; i < len; i++) { const method = methods[i]; - native[method] = (...args) => { - return NativeModule[method](...[appName, ...args]); - }; + if (isFunction(NativeModule[method])) { + native[method] = (...args) => { + return NativeModule[method](...[appName, ...args]); + }; + } else { + native[method] = NativeModule[method]; + } } return native; From 0083ef7a66be8b141ee1f0866376d200d3a2659a Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 11:41:40 +0000 Subject: [PATCH 07/21] [auth][android] Add languageCode getter --- .../firebase/auth/RNFirebaseAuth.java | 26 +++++++++++++++++++ lib/modules/auth/index.js | 6 +++++ 2 files changed, 32 insertions(+) diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index 36649088..2a8f88ed 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -6,6 +6,7 @@ import android.util.Log; import android.net.Uri; import android.support.annotation.NonNull; +import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.HashMap; import java.util.List; @@ -1439,4 +1440,29 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { eventMap.putMap("state", state); Utils.sendEvent(mReactContext, "phone_auth_state_changed", eventMap); } + + /** + * Constants bootstrapped on react native app boot + * + * @return + */ + @Override + public Map getConstants() { + Map constants = new HashMap<>(); + + List firebaseAppList = FirebaseApp.getApps(getReactApplicationContext()); + final Map appLanguage = new HashMap<>(); + + for (FirebaseApp app : firebaseAppList) { + String appName = app.getName(); + + FirebaseApp instance = FirebaseApp.getInstance(appName); + FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(instance); + + appLanguage.put(appName, firebaseAuth.getLanguageCode()); + } + + constants.put("APP_LANGUAGE", appLanguage); + return constants; + } } diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index bf32aa26..e154fc28 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -36,6 +36,7 @@ export default class Auth extends ModuleBase { super(firebaseApp, options, true); this._user = null; this._authResult = null; + this._languageCode = this._native.APP_LANGUAGE[firebaseApp._name] || null; this.addListener( // sub to internal native event - this fans out to @@ -336,6 +337,7 @@ export default class Auth extends ModuleBase { * @returns {*} */ set languageCode(code: string) { + this._languageCode = code; this._native.setLanguageCode(code); } @@ -351,6 +353,10 @@ export default class Auth extends ModuleBase { return 'firebase:auth'; } + get languageCode(): string { + return this._languageCode; + } + /** * KNOWN UNSUPPORTED METHODS */ From c736a6bb5144626eee4a20151900d9da9525ae97 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 12:08:12 +0000 Subject: [PATCH 08/21] [auth][ios] Add app language constants --- ios/RNFirebase/auth/RNFirebaseAuth.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index 7668fd0f..de68bed2 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -1166,6 +1166,25 @@ RCT_EXPORT_METHOD(useDeviceLanguage: return output; } +/** + * React native constant exports - exports native firebase apps mainly + * @return NSDictionary + */ +- (NSDictionary *)constantsToExport { + NSMutableDictionary *constants = [NSMutableDictionary new]; + NSDictionary *firApps = [FIRApp allApps]; + NSMutableDictionary *appLanguage = [NSMutableDictionary new]; + + for (id key in firApps) { + FIRApp *firApp = firApps[key]; + + appLanguage[firApp.name] = [FIRAuth authWithApp:firApp].languageCode; + } + + constants[@"APP_LANGUAGE"] = appLanguage; + return constants; +} + /** Converts a FIRUser instance into a dictionary to send via RNBridge From 7cfcb4efa0b2aa7b14b46ab6f4a3942c4db7e808 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 12:56:28 +0000 Subject: [PATCH 09/21] [auth] Update typescript --- lib/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/index.d.ts b/lib/index.d.ts index 688dd9bc..c960dd88 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -637,6 +637,11 @@ declare module "react-native-firebase" { */ currentUser: User | null + /** + * Gets/Sets the language for the app instance + */ + languageCode: string | null; + /** * Listen for changes in the users auth state (logging in and out). * This method returns a unsubscribe function to stop listening to events. @@ -705,6 +710,11 @@ declare module "react-native-firebase" { */ signOut(): Promise + /** + * Sets the language for the auth instance to the device language + */ + useDeviceLanguage(): void + [key: string]: any; } } From fd3f316e09534348070143fa8f6f34e9944a91c1 Mon Sep 17 00:00:00 2001 From: fr1n63 Date: Fri, 1 Dec 2017 17:10:05 +0000 Subject: [PATCH 10/21] Add || exit 0 to opencollective https://github.com/opencollective/opencollective-postinstall Why || exit 0 in scripts.postinstall? Since we are adding the dependency in devDependencies, the script ./node_modules/.bin/opencollective-postinstall won't be installed in production. Therefore, the postinstall script will return an error and will interrupt the npm install process. Adding || exit 0 makes sure that this postinstall script always returns true. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8fdc90c4..05f0aa68 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "flow": "flow", "lint": "eslint ./src", "prepublish": "npm run clean && npm run build", - "postinstall": "postinstall-build dist && opencollective postinstall", + "postinstall": "postinstall-build dist && opencollective postinstall || exit 0", "test-cli": "node ./bin/test.js", "tests-packager": "cd tests && npm run start", "tests-npm-install": "cd tests && npm install", From 74d614ad43b32feee0d9213bb0438277796f9ac2 Mon Sep 17 00:00:00 2001 From: Ardavan Kalhori Date: Fri, 5 Jan 2018 16:43:02 -0800 Subject: [PATCH 11/21] Fixed: attempt to insert nil object from objects[0] Fixed the issue that was causing a crash in my application: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' *** First throw call stack: ( 0 CoreFoundation 0x000000011310e12b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00000001127a6f41 objc_exception_throw + 48 2 CoreFoundation 0x000000011314e0cc _CFThrowFormattedException + 194 3 CoreFoundation 0x0000000113022951 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321 4 CoreFoundation 0x00000001130227db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59 5 Mesghal 0x000000010ace08c2 sendDynamicLink + 226 6 Mesghal 0x000000010ace0d0f __71+[RNFirebaseLinks application:continueUserActivity:restorationHandler:]_block_invoke + 447 7 libdispatch.dylib 0x0000000113fcd2f7 _dispatch_call_block_and_release + 12 8 libdispatch.dylib 0x0000000113fce33d _dispatch_client_callout + 8 9 libdispatch.dylib 0x0000000113fd95f9 _dispatch_main_queue_callback_4CF + 628 10 CoreFoundation 0x00000001130d0e39 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 11 CoreFoundation 0x0000000113095462 __CFRunLoopRun + 2402 12 CoreFoundation 0x0000000113094889 CFRunLoopRunSpecific + 409 13 GraphicsServices 0x00000001154d29c6 GSEventRunModal + 62 14 UIKit 0x000000010f60b5d6 UIApplicationMain + 159 15 Mesghal 0x000000010a6b688f main + 111 16 libdyld.dylib 0x000000011404ad81 start + 1 ) --- ios/RNFirebase/links/RNFirebaseLinks.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ios/RNFirebase/links/RNFirebaseLinks.m b/ios/RNFirebase/links/RNFirebaseLinks.m index 46478d46..f9209350 100644 --- a/ios/RNFirebase/links/RNFirebaseLinks.m +++ b/ios/RNFirebase/links/RNFirebaseLinks.m @@ -6,10 +6,12 @@ static void sendDynamicLink(NSURL *url, id sender) { - [[NSNotificationCenter defaultCenter] postNotificationName:LINKS_DYNAMIC_LINK_RECEIVED - object:sender - userInfo:@{@"url": url.absoluteString}]; - NSLog(@"sendDynamicLink Success: %@", url.absoluteString); + if (url) { + [[NSNotificationCenter defaultCenter] postNotificationName:LINKS_DYNAMIC_LINK_RECEIVED + object:sender + userInfo:@{@"url": url.absoluteString}]; + NSLog(@"sendDynamicLink Success: %@", url.absoluteString); + } } @implementation RNFirebaseLinks From f970d882ba5afec847056e8aebdd6f97b8f1f19f Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Sat, 6 Jan 2018 14:48:07 +0000 Subject: [PATCH 12/21] Ignore atlassian-ide-plugin --- .gitignore | 1 + atlassian-ide-plugin.xml | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 atlassian-ide-plugin.xml diff --git a/.gitignore b/.gitignore index 7a868226..3590e23d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ npm-debug.log *.perspectivev3 *.xcuserstate project.xcworkspace/ +atlassian-ide-plugin xcuserdata/ # Example diff --git a/atlassian-ide-plugin.xml b/atlassian-ide-plugin.xml deleted file mode 100644 index b68e35d1..00000000 --- a/atlassian-ide-plugin.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file From 9ea0a5cc7fbcbf4bd6d672b1bc0c80fdb69b7ab6 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Sat, 6 Jan 2018 15:14:11 +0000 Subject: [PATCH 13/21] [auth] Move useDeviceLanguage to unsupported method --- lib/index.d.ts | 5 ----- lib/modules/auth/index.js | 16 ++++++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 2b4b17bc..f5e42abf 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -714,11 +714,6 @@ declare module "react-native-firebase" { */ signOut(): Promise - /** - * Sets the language for the auth instance to the device language - */ - useDeviceLanguage(): void - [key: string]: any; } } diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index 1ea2c312..23524d75 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -48,7 +48,7 @@ export default class Auth extends ModuleBase { }); this._user = null; this._authResult = null; - this._languageCode = this._native.APP_LANGUAGE[firebaseApp._name] || null; + this._languageCode = getNativeModule(this).APP_LANGUAGE[app._name] || null; SharedEventEmitter.addListener( // sub to internal native event - this fans out to @@ -335,14 +335,6 @@ export default class Auth extends ModuleBase { return getNativeModule(this).fetchProvidersForEmail(email); } - /** - * Sets the language for the auth module using the device language - * @returns {*} - */ - useDeviceLanguage() { - this._native.useDeviceLanguage(); - } - /** * Sets the language for the auth module * @param code @@ -350,7 +342,7 @@ export default class Auth extends ModuleBase { */ set languageCode(code: string) { this._languageCode = code; - this._native.setLanguageCode(code); + getNativeModule(this).setLanguageCode(code); } /** @@ -392,6 +384,10 @@ export default class Auth extends ModuleBase { signInWithRedirect() { throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'signInWithRedirect')); } + + useDeviceLanguage() { + throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'useDeviceLanguage')); + } } export const statics = { From a8896bc9b883f77b96e18edcf1f7a117f7dd45ac Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Sat, 6 Jan 2018 15:14:49 +0000 Subject: [PATCH 14/21] [auth] Add language code tests --- tests/src/tests/auth/authTests.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/src/tests/auth/authTests.js b/tests/src/tests/auth/authTests.js index ad838968..31d70d72 100644 --- a/tests/src/tests/auth/authTests.js +++ b/tests/src/tests/auth/authTests.js @@ -356,6 +356,18 @@ function authTests({ tryCatch, describe, it, firebase }) { return firebase.native.auth().signOut().then(successCb).catch(failureCb); }); }); + + it('it should change the language code', () => { + firebase.native.auth().languageCode = 'en'; + if (firebase.native.auth().languageCode !== 'en') { + throw new Error('Expected language code to be "en".'); + } + firebase.native.auth().languageCode = 'fr'; + if (firebase.native.auth().languageCode !== 'en') { + throw new Error('Expected language code to be "fr".'); + } + firebase.native.auth().languageCode = 'en'; + }); }); } From f4d29b9136882ce26eb49333abd04f88d06940f2 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Sat, 6 Jan 2018 15:17:59 +0000 Subject: [PATCH 15/21] [auth] Fix incorrect languageCode test --- tests/src/tests/auth/authTests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/tests/auth/authTests.js b/tests/src/tests/auth/authTests.js index 31d70d72..5848db26 100644 --- a/tests/src/tests/auth/authTests.js +++ b/tests/src/tests/auth/authTests.js @@ -363,7 +363,7 @@ function authTests({ tryCatch, describe, it, firebase }) { throw new Error('Expected language code to be "en".'); } firebase.native.auth().languageCode = 'fr'; - if (firebase.native.auth().languageCode !== 'en') { + if (firebase.native.auth().languageCode !== 'fr') { throw new Error('Expected language code to be "fr".'); } firebase.native.auth().languageCode = 'en'; From 409cd70ab1d418ac9f91c12ba6620f399a31ce06 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Mon, 8 Jan 2018 10:07:15 +0000 Subject: [PATCH 16/21] [auth] Update iOS methods to internals change --- ios/RNFirebase/auth/RNFirebaseAuth.m | 8 ++++---- lib/modules/auth/index.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index 4ad5b526..607c9070 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -928,10 +928,10 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail: @return */ RCT_EXPORT_METHOD(setLanguageCode: - (NSString *) appName + (NSString *) appDisplayName code: (NSString *) code) { - FIRApp *firApp = [FIRApp appNamed:appName]; + FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName]; [FIRAuth authWithApp:firApp].languageCode = code; } @@ -943,8 +943,8 @@ RCT_EXPORT_METHOD(setLanguageCode: @return */ RCT_EXPORT_METHOD(useDeviceLanguage: - (NSString *) appName) { - FIRApp *firApp = [FIRApp appNamed:appName]; + (NSString *) appDisplayName) { + FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName]; [[FIRAuth authWithApp:firApp] useAppLanguage]; } diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index 23524d75..de5ffbda 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -385,6 +385,7 @@ export default class Auth extends ModuleBase { throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'signInWithRedirect')); } + // firebase issue - https://github.com/invertase/react-native-firebase/pull/655#issuecomment-349904680 useDeviceLanguage() { throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'useDeviceLanguage')); } From 06424aff14634e4c59d719a4a23b84500408af2a Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Mon, 8 Jan 2018 11:30:59 +0000 Subject: [PATCH 17/21] [auth] use [DEFAULT] languageCode for dynamic apps --- lib/modules/auth/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index de5ffbda..eb20e237 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -48,7 +48,7 @@ export default class Auth extends ModuleBase { }); this._user = null; this._authResult = null; - this._languageCode = getNativeModule(this).APP_LANGUAGE[app._name] || null; + this._languageCode = getNativeModule(this).APP_LANGUAGE[app._name] || getNativeModule(this).APP_LANGUAGE['[DEFAULT]']; SharedEventEmitter.addListener( // sub to internal native event - this fans out to From edc12487f5452b5d6dd0baddd37e7ffc5b4a509c Mon Sep 17 00:00:00 2001 From: Paul Huynh Date: Tue, 16 Jan 2018 22:34:26 +1100 Subject: [PATCH 18/21] Add Typescript definitions for Dynamic Links --- lib/index.d.ts | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/lib/index.d.ts b/lib/index.d.ts index 1eff94bf..204900da 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -64,6 +64,14 @@ declare module "react-native-firebase" { */ crash(): RNFirebase.crash.Crash; + /** + * Firebase Dynamic Links are links that work the way you want, on multiple + * platforms, and whether or not your app is already installed. + * See the official Firebase docs: + * https://firebase.google.com/docs/dynamic-links/ + */ + links(): RNFirebase.links.Links; + static fabric: { crashlytics(): RNFirebase.crashlytics.Crashlytics; }; @@ -895,5 +903,60 @@ declare module "react-native-firebase" { setUserIdentifier(userId: string): void; } } + + namespace links { + interface Links { + /** Creates a standard dynamic link. */ + createDynamicLink(parameters: LinkConfiguration): Promise; + /** Creates a short dynamic link. */ + createShortDynamicLink(parameters: LinkConfiguration): Promise; + /** + * Returns the URL that the app has been launched from. If the app was + * not launched from a URL the return value will be null. + */ + getInitialLink(): Promise; + /** + * Subscribe to URL open events while the app is still running. + * The listener is called from URL open events whilst the app is still + * running, use getInitialLink for URLs which cause the app to open + * from a previously closed / not running state. + * Returns an unsubscribe function, call the returned function to + * unsubscribe from all future events. + */ + onLink(listener: (url) => void): () => void; + } + + /** + * Configuration when creating a Dynamic Link (standard or short). For + * more information about each parameter, see the official Firebase docs: + * https://firebase.google.com/docs/reference/dynamic-links/link-shortener + */ + interface LinkConfiguration { + link: string, + dynamicLinkDomain: string, + androidInfo?: { + androidLink?: string, + androidPackageName: string, + androidFallbackLink?: string, + androidMinPackageVersionCode?: string, + }, + iosInfo?: { + iosBundleId: string, + iosAppStoreId?: string, + iosFallbackLink?: string, + iosCustomScheme?: string, + iosIpadBundleId?: string, + iosIpadFallbackLink?: string, + }, + socialMetaTagInfo?: { + socialTitle: string, + socialImageLink: string, + socialDescription: string, + }, + suffix?: { + option: 'SHORT' | 'UNGUESSABLE', + }, + } + } } } From f320d9243ae43b0e0a1ce0f349fd42412aa8a859 Mon Sep 17 00:00:00 2001 From: Michael Diarmid Date: Wed, 17 Jan 2018 15:21:21 +0000 Subject: [PATCH 19/21] Update index.js --- lib/utils/index.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index 09e3d657..994bab1d 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -340,30 +340,6 @@ export function nativeToJSError(code: string, message: string, additionalProps?: return error; } -/** - * TODO is this needed? - * Prepends appName arg to all native method calls - * @param appName - * @param NativeModule - */ -export function nativeWithApp(appName: string, NativeModule: Object) { - const native = {}; - const methods = Object.keys(NativeModule); - - for (let i = 0, len = methods.length; i < len; i++) { - const method = methods[i]; - if (isFunction(NativeModule[method])) { - native[method] = (...args) => { - return NativeModule[method](...[appName, ...args]); - }; - } else { - native[method] = NativeModule[method]; - } - } - - return native; -} - /** * * @param object From 983d273846660c2cbd27481eb4cc61ca6720bc8e Mon Sep 17 00:00:00 2001 From: Michael Diarmid Date: Wed, 17 Jan 2018 15:22:39 +0000 Subject: [PATCH 20/21] Update index.js --- lib/modules/auth/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/modules/auth/index.js b/lib/modules/auth/index.js index eb20e237..e5615821 100644 --- a/lib/modules/auth/index.js +++ b/lib/modules/auth/index.js @@ -353,10 +353,6 @@ export default class Auth extends ModuleBase { return this._user; } - get namespace(): string { - return 'firebase:auth'; - } - get languageCode(): string { return this._languageCode; } From 637cd81424b9a18cdec9735492a21f06be4e7ccf Mon Sep 17 00:00:00 2001 From: Michael Diarmid Date: Wed, 17 Jan 2018 18:05:54 +0000 Subject: [PATCH 21/21] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..b4fc0bbc --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at oss@invertase.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/