Merge remote-tracking branch 'origin/v3' into v3

This commit is contained in:
Salakar 2017-08-17 17:58:37 +01:00
commit 5f30fb09cb
15 changed files with 161 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#import "RNFirebase.h"
#import "FirebaseCore/FirebaseCore.h"
#import <FirebaseCore/FirebaseCore.h>
@implementation RNFirebase
RCT_EXPORT_MODULE(RNFirebase);

View File

@ -3,8 +3,8 @@
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
#import "GoogleMobileAds/GADBannerView.h"
#import "GoogleMobileAds/GADBannerViewDelegate.h"
#import <GoogleMobileAds/GADBannerView.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
@interface BannerComponent : UIView <GADBannerViewDelegate>

View File

@ -1,6 +1,6 @@
#import "BannerComponent.h"
#import "RNFirebaseAdMob.h"
#import "React/UIView+React.h"
#import <React/UIView+React.h>
@implementation BannerComponent

View File

@ -3,8 +3,8 @@
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
#import "GoogleMobileAds/GADNativeExpressAdView.h"
#import "GoogleMobileAds/GADVideoControllerDelegate.h"
#import <GoogleMobileAds/GADNativeExpressAdView.h>
#import <GoogleMobileAds/GADVideoControllerDelegate.h>
@interface NativeExpressComponent : UIView <GADNativeExpressAdViewDelegate, GADVideoControllerDelegate>

View File

@ -1,6 +1,6 @@
#import "NativeExpressComponent.h"
#import "RNFirebaseAdMob.h"
#import "React/UIView+React.h"
#import <React/UIView+React.h>
@implementation NativeExpressComponent

View File

@ -3,13 +3,13 @@
#import <Foundation/Foundation.h>
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
#import "Firebase.h"
#import <Firebase.h>
#import "RNFirebaseEvents.h"
#import <React/RCTBridgeModule.h>
#import "React/RCTEventEmitter.h"
#import "GoogleMobileAds/GADInterstitialDelegate.h"
#import "GoogleMobileAds/GADRewardBasedVideoAdDelegate.h"
#import "GoogleMobileAds/GADAdDelegate.h"
#import <React/RCTEventEmitter.h>
#import <GoogleMobileAds/GADInterstitialDelegate.h>
#import <GoogleMobileAds/GADRewardBasedVideoAdDelegate.h>
#import <GoogleMobileAds/GADAdDelegate.h>
@interface RNFirebaseAdMob : RCTEventEmitter <RCTBridgeModule>

View File

@ -1,14 +1,14 @@
#ifndef RNFirebaseAdMobInterstitial_h
#define RNFirebaseAdMobInterstitial_h
#import "React/RCTBridgeModule.h"
#import <React/RCTBridgeModule.h>
#import "RNFirebaseEvents.h"
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
#import "GoogleMobileAds/GADInterstitialDelegate.h"
#import "GoogleMobileAds/GADInterstitial.h"
#import "React/RCTEventEmitter.h"
#import <GoogleMobileAds/GADInterstitialDelegate.h>
#import <GoogleMobileAds/GADInterstitial.h>
#import <React/RCTEventEmitter.h>
#import "RNFirebaseAdMob.h"
@interface RNFirebaseAdMobInterstitial : NSObject <GADInterstitialDelegate>
@ -31,4 +31,3 @@
#endif
#endif

View File

@ -6,8 +6,8 @@
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
#import "GoogleMobileAds/GADRewardBasedVideoAdDelegate.h"
#import "GoogleMobileAds/GADRewardBasedVideoAd.h"
#import <GoogleMobileAds/GADRewardBasedVideoAdDelegate.h>
#import <GoogleMobileAds/GADRewardBasedVideoAd.h>
#import <React/RCTEventEmitter.h>
#import "RNFirebaseAdMob.h"
@ -31,4 +31,3 @@
#endif
#endif

View File

@ -3,7 +3,7 @@
#import <Foundation/Foundation.h>
#if __has_include(<FirebaseAuth/FIRAuth.h>)
#import "Firebase.h"
#import <Firebase.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>

View File

@ -0,0 +1,136 @@
#import "RNFirebaseRemoteConfig.h"
#if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>)
#import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>
NSString *convertFIRRemoteConfigFetchStatusToNSString(FIRRemoteConfigFetchStatus value) {
switch (value) {
case FIRRemoteConfigFetchStatusNoFetchYet:
return @"config/no_fetch_yet";
case FIRRemoteConfigFetchStatusSuccess:
return @"config/success";
case FIRRemoteConfigFetchStatusThrottled:
return @"config/throttled";
default:
return @"config/failure";
}
}
NSString *convertFIRRemoteConfigSourceToNSString(FIRRemoteConfigSource value) {
switch (value) {
case FIRRemoteConfigSourceDefault:
return @"default";
case FIRRemoteConfigSourceRemote:
return @"remote";
default:
return @"static";
}
}
NSDictionary *convertFIRRemoteConfigValueToNSDictionary(FIRRemoteConfigValue *value) {
return @{@"stringValue": value.stringValue ?: [NSNull null], @"numberValue": value.numberValue ?: [NSNull null], @"dataValue": value.dataValue ? [value.dataValue base64EncodedStringWithOptions:0] : [NSNull null], @"boolValue": @(value.boolValue), @"source": convertFIRRemoteConfigSourceToNSString(value.source)};
}
@implementation RNFirebaseRemoteConfig
RCT_EXPORT_MODULE(RNFirebaseRemoteConfig);
RCT_EXPORT_METHOD(enableDeveloperMode) {
FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] initWithDeveloperModeEnabled:YES];
[FIRRemoteConfig remoteConfig].configSettings = remoteConfigSettings;
}
RCT_EXPORT_METHOD(fetch:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
[[FIRRemoteConfig remoteConfig] fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError *__nullable error) {
if (error) {
RCTLogError(@"\nError: %@", RCTJSErrorFromNSError(error));
reject(convertFIRRemoteConfigFetchStatusToNSString(status), error.localizedDescription, error);
} else {
resolve(convertFIRRemoteConfigFetchStatusToNSString(status));
}
}];
}
RCT_EXPORT_METHOD(fetchWithExpirationDuration:
(nonnull
NSNumber *)expirationDuration
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
[[FIRRemoteConfig remoteConfig] fetchWithExpirationDuration:expirationDuration.doubleValue completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *__nullable error) {
if (error) {
RCTLogError(@"\nError: %@", RCTJSErrorFromNSError(error));
reject(convertFIRRemoteConfigFetchStatusToNSString(status), error.localizedDescription, error);
} else {
resolve(convertFIRRemoteConfigFetchStatusToNSString(status));
}
}];
}
RCT_EXPORT_METHOD(activateFetched:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
BOOL status = [[FIRRemoteConfig remoteConfig] activateFetched];
resolve(@(status));
}
RCT_EXPORT_METHOD(getValue:
(NSString *) key
resolver:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
FIRRemoteConfigValue *value = [[FIRRemoteConfig remoteConfig] configValueForKey:key];
resolve(convertFIRRemoteConfigValueToNSDictionary(value));
}
RCT_EXPORT_METHOD(getValues:
(NSArray *) keys
resolver:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
NSMutableArray *valuesArray = [[NSMutableArray alloc] init];
for (NSString *key in keys) {
FIRRemoteConfigValue *value = [[FIRRemoteConfig remoteConfig] configValueForKey:key];
[valuesArray addObject:convertFIRRemoteConfigValueToNSDictionary(value)];
}
resolve(valuesArray);
}
RCT_EXPORT_METHOD(getKeysByPrefix:
(NSString *) prefix
resolver:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
NSSet *keys = [[FIRRemoteConfig remoteConfig] keysWithPrefix:prefix];
NSMutableArray *keysArray = [[NSMutableArray alloc] init];
for (NSString *key in keys) {
[keysArray addObject:key];
}
resolve(keysArray);
}
RCT_EXPORT_METHOD(setDefaults:
(NSDictionary *) defaults) {
[[FIRRemoteConfig remoteConfig] setDefaults:defaults];
}
RCT_EXPORT_METHOD(setDefaultsFromResource:
(NSString *) fileName) {
[[FIRRemoteConfig remoteConfig] setDefaultsFromPlistFileName:fileName];
}
@end
#else
@implementation RNFirebaseRemoteConfig
@end
#endif

View File

@ -2,7 +2,7 @@
#if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>)
#import "FirebaseRemoteConfig/FirebaseRemoteConfig.h"
#import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>

View File

@ -1,7 +1,7 @@
#import "RNFirebaseCrash.h"
#if __has_include(<FirebaseCrash/FIRCrashLog.h>)
#import "FirebaseCrash/FIRCrashLog.h"
#import <FirebaseCrash/FIRCrashLog.h>
@implementation RNFirebaseCrash
RCT_EXPORT_MODULE();

View File

@ -2,6 +2,7 @@
#if __has_include(<FirebaseDatabase/FIRDatabase.h>)
#import <Firebase.h>
#import "RNFirebaseDatabaseReference.h"
#import "RNFirebaseEvents.h"

View File

@ -7,7 +7,6 @@
#import "RNFirebaseDatabase.h"
#import "RNFirebaseEvents.h"
#import <React/RCTEventEmitter.h>
#import "Firebase.h"
@interface RNFirebaseDatabaseReference : NSObject
@property RCTEventEmitter *emitter;

View File

@ -4,7 +4,7 @@
#import "RNFirebaseEvents.h"
#import <Photos/Photos.h>
#import "Firebase.h"
#import <Firebase.h>
@implementation RNFirebaseStorage