2
0
mirror of synced 2025-01-22 20:31:59 +00:00

[android][ios][core] initialize app parameters no longer prefixed by platform name i.e iosClientId becomes clientId. Use react native platform module to provide platform specific options.

This commit is contained in:
Salakar 2017-07-17 19:43:36 +01:00
parent 471539a1aa
commit 075cd690ce
4 changed files with 16 additions and 8 deletions

View File

@ -53,12 +53,13 @@ public class RNFirebaseModule extends ReactContextBaseJavaModule implements Life
public void initializeApp(String name, ReadableMap options, Callback callback) {
FirebaseOptions.Builder builder = new FirebaseOptions.Builder();
builder.setApplicationId(options.getString("androidAppId"));
builder.setApplicationId(options.getString("appId"));
builder.setGcmSenderId(options.getString("messagingSenderId"));
builder.setApiKey(options.getString("apiKey"));
builder.setProjectId(options.getString("projectId"));
builder.setDatabaseUrl(options.getString("databaseURL"));
builder.setStorageBucket(options.getString("storageBucket"));
// todo firebase sdk has no client id setter
FirebaseApp.initializeApp(getReactApplicationContext(), builder.build(), name);

View File

@ -47,10 +47,6 @@ import io.invertase.firebase.Utils;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
class RNFirebaseAuth extends ReactContextBaseJavaModule {
private static final String TAG = "RNFirebaseAuth";
// itts been a while ;p
private ReactContext mReactContext;
private HashMap<String, FirebaseAuth.AuthStateListener> mAuthListeners = new HashMap<>();

View File

@ -31,11 +31,11 @@ RCT_EXPORT_METHOD(initializeApp:
FIRApp *existingApp = [FIRApp appNamed:name];
if (!existingApp) {
FIROptions *firOptions = [[FIROptions alloc] initWithGoogleAppID:[options valueForKey:@"iosAppId"] GCMSenderID:[options valueForKey:@"messagingSenderId"]];
FIROptions *firOptions = [[FIROptions alloc] initWithGoogleAppID:[options valueForKey:@"appId"] GCMSenderID:[options valueForKey:@"messagingSenderId"]];
firOptions.APIKey = [options valueForKey:@"apiKey"];
firOptions.projectID = [options valueForKey:@"projectId"];
firOptions.clientID = [options valueForKey:@"iosClientId"];
firOptions.clientID = [options valueForKey:@"clientId"];
firOptions.trackingID = [options valueForKey:@"trackingId"];
firOptions.databaseURL = [options valueForKey:@"databaseURL"];
firOptions.storageBucket = [options valueForKey:@"storageBucket"];

View File

@ -972,7 +972,18 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *) appName
@return NSDictionary
*/
- (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
NSMutableDictionary *userDict = [@{@"uid": user.uid, @"email": user.email ? user.email : [NSNull null], @"emailVerified": @(user.emailVerified), @"isAnonymous": @(user.anonymous), @"displayName": user.displayName ? user.displayName : [NSNull null], @"refreshToken": user.refreshToken, @"providerId": [user.providerID lowercaseString], @"providerData": [self convertProviderData:user.providerData]} mutableCopy];
NSMutableDictionary *userDict = [
@{
@"uid": user.uid,
@"email": user.email ? user.email : [NSNull null],
@"emailVerified": @(user.emailVerified),
@"isAnonymous": @(user.anonymous),
@"displayName": user.displayName ? user.displayName : [NSNull null],
@"refreshToken": user.refreshToken,
@"providerId": [user.providerID lowercaseString],
@"providerData": [self convertProviderData:user.providerData]
} mutableCopy
];
if ([user valueForKey:@"photoURL"] != nil) {
[userDict setValue:[user.photoURL absoluteString] forKey:@"photoURL"];