From c736a6bb5144626eee4a20151900d9da9525ae97 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 30 Nov 2017 12:08:12 +0000 Subject: [PATCH] [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