From 92b3860230c7ba13dda93c1dced21ca74bc81a0a Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Tue, 4 Jul 2017 15:39:56 +0100 Subject: [PATCH 1/5] [admob][ios] Fix an issue whereby interstitials on iOS could not be reused with the same adUnit ID --- ios/RNFirebase/admob/RNFirebaseAdMob.m | 11 ++++++++--- lib/modules/admob/Interstitial.js | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ios/RNFirebase/admob/RNFirebaseAdMob.m b/ios/RNFirebase/admob/RNFirebaseAdMob.m index 398f38fd..70dc4a29 100644 --- a/ios/RNFirebase/admob/RNFirebaseAdMob.m +++ b/ios/RNFirebase/admob/RNFirebaseAdMob.m @@ -35,7 +35,7 @@ RCT_EXPORT_METHOD(initialize: RCT_EXPORT_METHOD(openDebugMenu: (NSString *) appId) { GADDebugOptionsViewController *debugOptionsViewController = [GADDebugOptionsViewController debugOptionsViewControllerWithAdUnitID:appId]; - UIWindow* window = [UIApplication sharedApplication].keyWindow; + UIWindow *window = [UIApplication sharedApplication].keyWindow; [[window rootViewController] presentViewController:debugOptionsViewController animated:YES completion:nil]; } @@ -68,6 +68,11 @@ RCT_EXPORT_METHOD(rewardedVideoShowAd: [rewardedVideo show]; } +RCT_EXPORT_METHOD(clearInterstitial: + (NSString *) adUnit) { + if (_interstitials[adUnit]) [_interstitials removeObjectForKey:adUnit]; +} + - (RNFirebaseAdMobInterstitial *)getOrCreateInterstitial:(NSString *)adUnit { if (_interstitials[adUnit]) { return _interstitials[adUnit]; @@ -187,8 +192,8 @@ RCT_EXPORT_METHOD(rewardedVideoShowAd: NSString *matchText = [value substringWithRange:[match range]]; if (matchText) { NSArray *values = [matchText componentsSeparatedByString:@"x"]; - CGFloat width = (CGFloat)[values[0] intValue]; - CGFloat height = (CGFloat)[values[1] intValue]; + CGFloat width = (CGFloat) [values[0] intValue]; + CGFloat height = (CGFloat) [values[1] intValue]; return GADAdSizeFromCGSize(CGSizeMake(width, height)); } } diff --git a/lib/modules/admob/Interstitial.js b/lib/modules/admob/Interstitial.js index f072b96b..33eb5568 100644 --- a/lib/modules/admob/Interstitial.js +++ b/lib/modules/admob/Interstitial.js @@ -1,4 +1,4 @@ -import { NativeModules } from 'react-native'; +import { NativeModules, Platform } from 'react-native'; import { statics } from './'; import AdRequest from './AdRequest'; import { nativeToJSError } from '../../utils'; @@ -8,6 +8,11 @@ const FirebaseAdMob = NativeModules.RNFirebaseAdMob; export default class Interstitial { constructor(admob: Object, adUnit: string) { + // Interstitials on iOS require a new instance each time + if (Platform.OS === 'ios') { + FirebaseAdMob.clearInterstitial(adUnit); + } + this.admob = admob; this.adUnit = adUnit; this.loaded = false; From bdd25dd8fbc9776790131e9551ea3c378dad1fe9 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Tue, 4 Jul 2017 15:45:17 +0100 Subject: [PATCH 2/5] Update testing.md --- docs/contributing/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing/testing.md b/docs/contributing/testing.md index f6e76826..c79302d9 100644 --- a/docs/contributing/testing.md +++ b/docs/contributing/testing.md @@ -6,10 +6,10 @@ Currently due to the blackbox Firebase enviroment, we have found the best way to For convenience all of the required NPM scripts are packaged with the main library to run the test app. -### Step 1 - Clone +### Step 1 - Fork & Clone ```bash -git clone git@github.com:invertase/react-native-firebase.git +git clone git@github.com:/react-native-firebase.git ``` ### Step 2 - Install dependencies From 58f50839a462084019c0241bff8d4cc4dcff32a9 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Tue, 4 Jul 2017 15:58:43 +0100 Subject: [PATCH 3/5] Update perf.md --- docs/modules/perf.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/perf.md b/docs/modules/perf.md index 0939226b..e3463852 100644 --- a/docs/modules/perf.md +++ b/docs/modules/perf.md @@ -2,8 +2,8 @@ !> Performance monitoring requires react-native-firebase version 1.2.0. -?> If you plan on using this module in your own application, please ensure the optional setup instructions for -[Android](#) and [iOS](#) have been followed. +?> Android: If you plan on using this module in your own application, please ensure the optional setup instructions for +[Android](http://invertase.io/react-native-firebase/#/installation-android?id=_4-performance-monitoring-optional) have been followed. Out of the box, [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon/automatic) monitors a number of [automatic traces](https://firebase.google.com/docs/perf-mon/automatic) such as app start/background/foreground response times. From e328ce92b95fc2850fbca841952b84a699f5e2e9 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Tue, 4 Jul 2017 16:01:00 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b03577d8..ee0a1273 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ All in all, RNFirebase provides much faster performance (~2x) over the web SDK a | Performance Monitoring | ✅ | ✅ | ❌ | | Realtime Database | ✅ | ✅ | ✅ | | - Offline Persistance | ✅ | ✅ | ❌ | +| - Transactions | ✅ | ✅ | ❌ | | Remote Config | ✅ | ✅ | ❌ | | Storage | ✅ | ✅ | ❌ | From 66a2d3b7ef7723ccf0a5440f613cb33c3644f703 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Tue, 4 Jul 2017 16:01:43 +0100 Subject: [PATCH 5/5] Update transactions.md --- docs/modules/transactions.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/modules/transactions.md b/docs/modules/transactions.md index ee273c2d..261df995 100644 --- a/docs/modules/transactions.md +++ b/docs/modules/transactions.md @@ -1,8 +1,5 @@ # Transactions -!> Transactions is currently an experimental feature in RNFirebase. Whilst it does work there may still be some issues with it, especially around offline connectivity handling. Please report any issues in the usual manner. - - ?> For help on how to use firebase transactions please see the [Firebase Transaction Documentation](https://firebase.google.com/docs/reference/js/firebase.database.Reference#transaction). ### Android Implementation