[ios][admob] Use static helper methods over delegate methods
This commit is contained in:
parent
f6db5656ae
commit
0525672860
|
@ -6,7 +6,7 @@
|
|||
#if __has_include(<GoogleMobileAds/GADMobileAds.h>)
|
||||
#import "Firebase.h"
|
||||
#import "RNFirebaseEvents.h"
|
||||
#import <React/RCTEventEmitter.h>
|
||||
#import "React/RCTEventEmitter.h"
|
||||
#import "GoogleMobileAds/GADInterstitialDelegate.h"
|
||||
#import "GoogleMobileAds/GADRewardBasedVideoAdDelegate.h"
|
||||
#import "GoogleMobileAds/GADAdDelegate.h"
|
||||
|
@ -16,8 +16,9 @@
|
|||
@property NSMutableDictionary *interstitials;
|
||||
@property NSMutableDictionary *rewardedVideos;
|
||||
|
||||
- (GADRequest *)buildRequest:(NSDictionary *)request;
|
||||
- (NSDictionary *)errorCodeToDictionary:(NSError *)error;
|
||||
+ (GADRequest *)buildRequest:(NSDictionary *)request;
|
||||
+ (NSDictionary *)errorCodeToDictionary:(NSError *)error;
|
||||
+ (GADAdSize)stringToAdSize:(NSString *)value;
|
||||
@end
|
||||
|
||||
#else
|
||||
|
|
|
@ -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 "React/RCTEventEmitter.h"
|
||||
#import "RNFirebaseAdMob.h"
|
||||
|
||||
@interface RNFirebaseAdMobInterstitial : NSObject <GADInterstitialDelegate>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
|
||||
- (void)loadAd:(NSDictionary *)request {
|
||||
[_interstitial loadRequest:[_delegate buildRequest:request]];
|
||||
[_interstitial loadRequest:[RNFirebaseAdMob buildRequest:request]];
|
||||
}
|
||||
|
||||
- (void)show {
|
||||
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
|
||||
- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error {
|
||||
[self sendJSEvent:@"onAdFailedToLoad" payload:[_delegate errorCodeToDictionary:error]];
|
||||
[self sendJSEvent:@"onAdFailedToLoad" payload:[RNFirebaseAdMob errorCodeToDictionary:error]];
|
||||
}
|
||||
|
||||
- (void)interstitialWillPresentScreen:(GADInterstitial *)ad {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#import "RNFirebaseAdMobRewardedVideo.h"
|
||||
|
||||
|
||||
@implementation RNFirebaseAdMobRewardedVideo
|
||||
|
||||
- (id)initWithProps:(NSString *)adUnit delegate:(RNFirebaseAdMob *)delegate {
|
||||
|
@ -20,7 +19,7 @@
|
|||
}
|
||||
|
||||
- (void)loadAd:(NSDictionary *)request {
|
||||
[_videoAd loadRequest:[_delegate buildRequest:request] withAdUnitID:_adUnitID];
|
||||
[_videoAd loadRequest:[RNFirebaseAdMob buildRequest:request] withAdUnitID:_adUnitID];
|
||||
}
|
||||
|
||||
- (void)show {
|
||||
|
@ -67,7 +66,7 @@
|
|||
|
||||
- (void)rewardBasedVideoAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd
|
||||
didFailToLoadWithError:(NSError *)error {
|
||||
[self sendJSEvent:@"onAdFailedToLoad" payload:[_delegate errorCodeToDictionary:error]];
|
||||
[self sendJSEvent:@"onAdFailedToLoad" payload:[RNFirebaseAdMob errorCodeToDictionary:error]];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue