react-native-google-mobile-ads 14.4.3 → 14.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/__tests__/googleMobileAds.test.ts +1 -1
- package/__tests__/interstitial.test.ts +9 -23
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.mm +100 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.h +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +6 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +2 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.h +53 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.mm +220 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.mm +80 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.mm +102 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h +37 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.mm +102 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.mm +100 -0
- package/jest.setup.ts +8 -5
- package/lib/commonjs/MobileAds.js +1 -1
- package/lib/commonjs/ads/AppOpenAd.js +3 -1
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
- package/lib/commonjs/ads/BannerAd.js +1 -1
- package/lib/commonjs/ads/BannerAd.js.map +1 -1
- package/lib/commonjs/ads/BaseAd.js +1 -1
- package/lib/commonjs/ads/GAMBannerAd.js +1 -1
- package/lib/commonjs/ads/GAMBannerAd.js.map +1 -1
- package/lib/commonjs/ads/InterstitialAd.js +3 -1
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
- package/lib/commonjs/ads/MobileAd.js +5 -18
- package/lib/commonjs/ads/MobileAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedAd.js +3 -1
- package/lib/commonjs/ads/RewardedAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedInterstitialAd.js +3 -1
- package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeInterstitialModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeInterstitialModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeRewardedInterstitialModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeRewardedInterstitialModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeRewardedModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeRewardedModule.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/MobileAds.js +1 -1
- package/lib/module/MobileAds.js.map +1 -1
- package/lib/module/ads/AppOpenAd.js +2 -1
- package/lib/module/ads/AppOpenAd.js.map +1 -1
- package/lib/module/ads/BannerAd.js +1 -1
- package/lib/module/ads/BannerAd.js.map +1 -1
- package/lib/module/ads/BaseAd.js +1 -1
- package/lib/module/ads/BaseAd.js.map +1 -1
- package/lib/module/ads/GAMBannerAd.js +1 -1
- package/lib/module/ads/GAMBannerAd.js.map +1 -1
- package/lib/module/ads/InterstitialAd.js +3 -1
- package/lib/module/ads/InterstitialAd.js.map +1 -1
- package/lib/module/ads/MobileAd.js +5 -18
- package/lib/module/ads/MobileAd.js.map +1 -1
- package/lib/module/ads/RewardedAd.js +3 -1
- package/lib/module/ads/RewardedAd.js.map +1 -1
- package/lib/module/ads/RewardedInterstitialAd.js +3 -1
- package/lib/module/ads/RewardedInterstitialAd.js.map +1 -1
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js +20 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js +20 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js +20 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js +20 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedModule.js +20 -0
- package/lib/module/specs/modules/NativeRewardedModule.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/ads/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/ads/BannerAd.d.ts.map +1 -1
- package/lib/typescript/ads/BaseAd.d.ts +1 -1
- package/lib/typescript/ads/BaseAd.d.ts.map +1 -1
- package/lib/typescript/ads/GAMBannerAd.d.ts.map +1 -1
- package/lib/typescript/ads/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/ads/MobileAd.d.ts +5 -4
- package/lib/typescript/ads/MobileAd.d.ts.map +1 -1
- package/lib/typescript/ads/RewardedAd.d.ts.map +1 -1
- package/lib/typescript/ads/RewardedInterstitialAd.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +30 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeInterstitialModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeInterstitialModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeRewardedInterstitialModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeRewardedInterstitialModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeRewardedModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeRewardedModule.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/MobileAds.ts +1 -1
- package/src/ads/AppOpenAd.ts +3 -1
- package/src/ads/BannerAd.tsx +3 -1
- package/src/ads/BaseAd.tsx +2 -2
- package/src/ads/GAMBannerAd.tsx +3 -1
- package/src/ads/InterstitialAd.ts +3 -1
- package/src/ads/MobileAd.ts +9 -25
- package/src/ads/RewardedAd.ts +3 -1
- package/src/ads/RewardedInterstitialAd.ts +3 -1
- package/src/specs/modules/NativeAppOpenModule.ts +26 -0
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +33 -0
- package/src/specs/modules/NativeInterstitialModule.ts +26 -0
- package/src/specs/modules/NativeRewardedInterstitialModule.ts +32 -0
- package/src/specs/modules/NativeRewardedModule.ts +26 -0
- package/src/version.ts +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +0 -46
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift +0 -85
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift +0 -231
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift +0 -76
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +0 -46
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift +0 -123
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +0 -46
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift +0 -85
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +0 -46
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift +0 -85
- package/lib/commonjs/NativeGoogleMobileAdsModule.js +0 -9
- package/lib/commonjs/NativeGoogleMobileAdsModule.js.map +0 -1
- package/lib/commonjs/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +0 -1
- package/lib/module/NativeGoogleMobileAdsModule.js +0 -3
- package/lib/module/NativeGoogleMobileAdsModule.js.map +0 -1
- package/lib/module/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +0 -1
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts +0 -14
- package/lib/typescript/NativeGoogleMobileAdsModule.d.ts.map +0 -1
- package/lib/typescript/ads/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +0 -1
- package/src/NativeGoogleMobileAdsModule.ts +0 -16
- /package/lib/commonjs/{ads → specs/components}/GoogleMobileAdsBannerViewNativeComponent.js +0 -0
- /package/lib/module/{ads → specs/components}/GoogleMobileAdsBannerViewNativeComponent.js +0 -0
- /package/lib/typescript/{ads → specs/components}/GoogleMobileAdsBannerViewNativeComponent.d.ts +0 -0
- /package/src/{ads → specs/components}/GoogleMobileAdsBannerViewNativeComponent.ts +0 -0
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ When using The New Architecture, some legacy code will still be used though. See
|
|
|
39
39
|
| -------- | ------------------------------------------------- | ----------- |
|
|
40
40
|
| iOS | Mobile Ads SDK Methods (Turbo Native Module) | ✅ Complete |
|
|
41
41
|
| iOS | Banners (Fabric Native Component) | ✅ Complete |
|
|
42
|
-
| iOS | Full Screen Ads (Turbo Native Module) |
|
|
42
|
+
| iOS | Full Screen Ads (Turbo Native Module) | ✅ Complete |
|
|
43
43
|
| iOS | User Messaging Platform (Turbo Native Module) | ⏳ To-Do |
|
|
44
44
|
| iOS | EventEmitter (Turbo Native Module) | ⏳ To-Do |
|
|
45
45
|
| iOS | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import admob, { MaxAdContentRating } from '../src';
|
|
2
|
-
import RNGoogleMobileAdsModule from '../src/NativeGoogleMobileAdsModule';
|
|
2
|
+
import RNGoogleMobileAdsModule from '../src/specs/modules/NativeGoogleMobileAdsModule';
|
|
3
3
|
|
|
4
4
|
describe('Admob', function () {
|
|
5
5
|
describe('setRequestConfiguration()', function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AdEventType, InterstitialAd } from '../src';
|
|
2
|
-
import
|
|
2
|
+
import NativeInterstitialModule from '../src/specs/modules/NativeInterstitialModule';
|
|
3
3
|
|
|
4
4
|
describe('Google Mobile Ads Interstitial', function () {
|
|
5
5
|
describe('createForAdRequest', function () {
|
|
@@ -34,23 +34,17 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
34
34
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
35
35
|
|
|
36
36
|
ad.load();
|
|
37
|
-
expect(
|
|
38
|
-
1,
|
|
39
|
-
);
|
|
37
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(1);
|
|
40
38
|
});
|
|
41
39
|
|
|
42
40
|
it('does nothing if ad currently loading', () => {
|
|
43
41
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
44
42
|
|
|
45
43
|
ad.load();
|
|
46
|
-
expect(
|
|
47
|
-
1,
|
|
48
|
-
);
|
|
44
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(1);
|
|
49
45
|
|
|
50
46
|
ad.load();
|
|
51
|
-
expect(
|
|
52
|
-
1,
|
|
53
|
-
);
|
|
47
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(1);
|
|
54
48
|
});
|
|
55
49
|
|
|
56
50
|
it('does nothing if ad is already loaded', () => {
|
|
@@ -60,41 +54,33 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
60
54
|
ad._handleAdEvent({ body: { type: AdEventType.LOADED } });
|
|
61
55
|
|
|
62
56
|
ad.load();
|
|
63
|
-
expect(
|
|
57
|
+
expect(NativeInterstitialModule.interstitialLoad).not.toBeCalled();
|
|
64
58
|
});
|
|
65
59
|
|
|
66
60
|
it('can be called again after ad was closed', () => {
|
|
67
61
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
68
62
|
|
|
69
63
|
ad.load();
|
|
70
|
-
expect(
|
|
71
|
-
1,
|
|
72
|
-
);
|
|
64
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(1);
|
|
73
65
|
|
|
74
66
|
// @ts-ignore
|
|
75
67
|
ad._handleAdEvent({ body: { type: AdEventType.CLOSED } });
|
|
76
68
|
|
|
77
69
|
ad.load();
|
|
78
|
-
expect(
|
|
79
|
-
2,
|
|
80
|
-
);
|
|
70
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(2);
|
|
81
71
|
});
|
|
82
72
|
|
|
83
73
|
it('can be called again after ad failed to load', () => {
|
|
84
74
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
85
75
|
|
|
86
76
|
ad.load();
|
|
87
|
-
expect(
|
|
88
|
-
1,
|
|
89
|
-
);
|
|
77
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(1);
|
|
90
78
|
|
|
91
79
|
// @ts-ignore
|
|
92
80
|
ad._handleAdEvent({ body: { type: AdEventType.ERROR } });
|
|
93
81
|
|
|
94
82
|
ad.load();
|
|
95
|
-
expect(
|
|
96
|
-
2,
|
|
97
|
-
);
|
|
83
|
+
expect(NativeInterstitialModule.interstitialLoad).toBeCalledTimes(2);
|
|
98
84
|
});
|
|
99
85
|
});
|
|
100
86
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <NativeAppOpenModuleSpec>
|
|
26
|
+
|
|
27
|
+
#else
|
|
28
|
+
|
|
29
|
+
#import <React/RCTBridgeModule.h>
|
|
30
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <RCTBridgeModule>
|
|
31
|
+
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
#endif
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsAppOpenModule.h"
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
24
|
+
#endif
|
|
25
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
26
|
+
#import "RNGoogleMobileAdsFullScreenAd.h"
|
|
27
|
+
|
|
28
|
+
@interface RNGoogleMobileAdsAppOpenAd : RNGoogleMobileAdsFullScreenAd
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation RNGoogleMobileAdsAppOpenAd
|
|
33
|
+
|
|
34
|
+
- (NSString *)getAdEventName {
|
|
35
|
+
return GOOGLE_MOBILE_ADS_EVENT_APP_OPEN;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
39
|
+
adRequest:(GAMRequest *)adRequest
|
|
40
|
+
completionHandler:
|
|
41
|
+
(void (^)(GADAppOpenAd *_Nullable ad, NSError *_Nullable error))completionHandler {
|
|
42
|
+
[GADAppOpenAd loadWithAdUnitID:adUnitId request:adRequest completionHandler:completionHandler];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@end
|
|
46
|
+
|
|
47
|
+
@implementation RNGoogleMobileAdsAppOpenModule {
|
|
48
|
+
RNGoogleMobileAdsAppOpenAd *_ad;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_MODULE();
|
|
52
|
+
|
|
53
|
+
- (dispatch_queue_t)methodQueue {
|
|
54
|
+
return dispatch_get_main_queue();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
RCT_EXPORT_METHOD(appOpenLoad
|
|
58
|
+
: (double)requestId adUnitId
|
|
59
|
+
: (NSString *)adUnitId requestOptions
|
|
60
|
+
: (NSDictionary *)requestOptions) {
|
|
61
|
+
[_ad loadWithRequestId:requestId adUnitId:adUnitId adRequestOptions:requestOptions];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RCT_EXPORT_METHOD(appOpenShow
|
|
65
|
+
: (double)requestId adUnitId
|
|
66
|
+
: (NSString *)adUnitId showOptions
|
|
67
|
+
: (NSDictionary *)showOptions resolve
|
|
68
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
69
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
70
|
+
[_ad showWithRequestId:requestId
|
|
71
|
+
adUnitId:adUnitId
|
|
72
|
+
showOptions:showOptions
|
|
73
|
+
resolve:resolve
|
|
74
|
+
reject:reject];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
RCT_EXPORT_METHOD(invalidate) { [_ad invalidate]; }
|
|
78
|
+
|
|
79
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
80
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
81
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
82
|
+
return std::make_shared<facebook::react::NativeAppOpenModuleSpecJSI>(params);
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
- (instancetype)init {
|
|
87
|
+
self = [super init];
|
|
88
|
+
if (self) {
|
|
89
|
+
_ad = [[RNGoogleMobileAdsAppOpenAd alloc] init];
|
|
90
|
+
}
|
|
91
|
+
return self;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (void)dealloc {
|
|
95
|
+
[self invalidate];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@end
|
|
99
|
+
|
|
100
|
+
#endif
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#if !TARGET_OS_MACCATALYST
|
|
2
|
+
|
|
1
3
|
// This guard prevent this file to be compiled in the old architecture.
|
|
2
4
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
5
|
#import <GoogleMobileAds/GADAppEventDelegate.h>
|
|
@@ -28,3 +30,5 @@ NS_ASSUME_NONNULL_END
|
|
|
28
30
|
|
|
29
31
|
#endif /* NativeComponentExampleComponentView_h */
|
|
30
32
|
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#if !TARGET_OS_MACCATALYST
|
|
2
|
+
|
|
1
3
|
// This guard prevent the code from being compiled in the old architecture
|
|
2
4
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
5
|
#import "RNGoogleMobileAdsBannerView.h"
|
|
@@ -236,11 +238,14 @@ using namespace facebook::react;
|
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
240
|
|
|
241
|
+
@end
|
|
242
|
+
|
|
239
243
|
#pragma mark - RNGoogleMobileAdsBannerViewCls
|
|
240
244
|
|
|
241
245
|
Class<RCTComponentViewProtocol> RNGoogleMobileAdsBannerViewCls(void) {
|
|
242
246
|
return RNGoogleMobileAdsBannerView.class;
|
|
243
247
|
}
|
|
244
248
|
|
|
245
|
-
@end
|
|
246
249
|
#endif
|
|
250
|
+
|
|
251
|
+
#endif
|
|
@@ -200,7 +200,9 @@ RCT_EXPORT_METHOD(reset) {
|
|
|
200
200
|
RCT_EXPORT_METHOD(getConsentInfo
|
|
201
201
|
: (RCTPromiseResolveBlock)resolve
|
|
202
202
|
: (RCTPromiseRejectBlock)reject) {
|
|
203
|
+
#if !TARGET_OS_MACCATALYST
|
|
203
204
|
resolve([self getConsentInformation]);
|
|
205
|
+
#endif
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
RCT_EXPORT_METHOD(getTCString : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
#import "RNGoogleMobileAdsFullScreenContentDelegate.h"
|
|
23
|
+
#import "RNSharedUtils.h"
|
|
24
|
+
|
|
25
|
+
@interface RNGoogleMobileAdsFullScreenAd : NSObject
|
|
26
|
+
|
|
27
|
+
@property(nonatomic, strong) NSMutableDictionary<NSNumber *, id<GADFullScreenPresentingAd>> *adMap;
|
|
28
|
+
@property(nonatomic, strong)
|
|
29
|
+
NSMutableDictionary<NSNumber *, RNGoogleMobileAdsFullScreenContentDelegate *> *delegateMap;
|
|
30
|
+
|
|
31
|
+
- (instancetype)init;
|
|
32
|
+
- (void)invalidate;
|
|
33
|
+
- (NSString *)getAdEventName;
|
|
34
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
35
|
+
adRequest:(GAMRequest *)adRequest
|
|
36
|
+
completionHandler:(void (^)(id<GADFullScreenPresentingAd> ad, NSError *error))completionHandler;
|
|
37
|
+
- (void)sendAdEvent:(NSString *)type
|
|
38
|
+
requestId:(int)requestId
|
|
39
|
+
adUnitId:(NSString *)adUnitId
|
|
40
|
+
error:(NSDictionary *)error
|
|
41
|
+
data:(NSDictionary *)data;
|
|
42
|
+
- (void)loadWithRequestId:(int)requestId
|
|
43
|
+
adUnitId:(NSString *)adUnitId
|
|
44
|
+
adRequestOptions:(NSDictionary *)adRequestOptions;
|
|
45
|
+
- (void)showWithRequestId:(int)requestId
|
|
46
|
+
adUnitId:(NSString *)adUnitId
|
|
47
|
+
showOptions:(NSDictionary *)showOptions
|
|
48
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
49
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
50
|
+
|
|
51
|
+
@end
|
|
52
|
+
|
|
53
|
+
#endif
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsFullScreenAd.h"
|
|
21
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
22
|
+
|
|
23
|
+
@implementation RNGoogleMobileAdsFullScreenAd
|
|
24
|
+
|
|
25
|
+
- (instancetype)init {
|
|
26
|
+
if (self = [super init]) {
|
|
27
|
+
_adMap = [NSMutableDictionary new];
|
|
28
|
+
_delegateMap = [NSMutableDictionary new];
|
|
29
|
+
}
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (void)dealloc {
|
|
34
|
+
[self invalidate];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (void)invalidate {
|
|
38
|
+
[_adMap removeAllObjects];
|
|
39
|
+
[_delegateMap removeAllObjects];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (NSString *)getAdEventName {
|
|
43
|
+
@throw [NSException exceptionWithName:@"MethodNotImplemented"
|
|
44
|
+
reason:@"Method `getAdEventName` must be overridden"
|
|
45
|
+
userInfo:nil];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
49
|
+
adRequest:(GAMRequest *)adRequest
|
|
50
|
+
completionHandler:
|
|
51
|
+
(void (^)(id<GADFullScreenPresentingAd> ad, NSError *error))completionHandler {
|
|
52
|
+
@throw [NSException exceptionWithName:@"MethodNotImplemented"
|
|
53
|
+
reason:@"Method `loadAd` must be overridden"
|
|
54
|
+
userInfo:nil];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)sendAdEvent:(NSString *)type
|
|
58
|
+
requestId:(int)requestId
|
|
59
|
+
adUnitId:(NSString *)adUnitId
|
|
60
|
+
error:(NSDictionary *)error
|
|
61
|
+
data:(NSDictionary *)data {
|
|
62
|
+
[RNGoogleMobileAdsCommon sendAdEvent:[self getAdEventName]
|
|
63
|
+
requestId:@(requestId)
|
|
64
|
+
type:type
|
|
65
|
+
adUnitId:adUnitId
|
|
66
|
+
error:error
|
|
67
|
+
data:data];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)loadWithRequestId:(int)requestId
|
|
71
|
+
adUnitId:(NSString *)adUnitId
|
|
72
|
+
adRequestOptions:(NSDictionary *)adRequestOptions {
|
|
73
|
+
GAMRequest *adRequest = [RNGoogleMobileAdsCommon buildAdRequest:adRequestOptions];
|
|
74
|
+
RNGoogleMobileAdsFullScreenContentDelegate *delegate =
|
|
75
|
+
[[RNGoogleMobileAdsFullScreenContentDelegate alloc] initWithAdEventName:[self getAdEventName]
|
|
76
|
+
requestId:requestId
|
|
77
|
+
adUnitId:adUnitId];
|
|
78
|
+
|
|
79
|
+
__weak __typeof(self) weakSelf = self;
|
|
80
|
+
[self loadAd:adUnitId
|
|
81
|
+
adRequest:adRequest
|
|
82
|
+
completionHandler:^(id<GADFullScreenPresentingAd> ad, NSError *error) {
|
|
83
|
+
if (error) {
|
|
84
|
+
NSDictionary *codeAndMessage =
|
|
85
|
+
[RNGoogleMobileAdsCommon getCodeAndMessageFromAdError:error];
|
|
86
|
+
[weakSelf sendAdEvent:GOOGLE_MOBILE_ADS_EVENT_ERROR
|
|
87
|
+
requestId:requestId
|
|
88
|
+
adUnitId:adUnitId
|
|
89
|
+
error:codeAndMessage
|
|
90
|
+
data:nil];
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
NSString *eventType = GOOGLE_MOBILE_ADS_EVENT_LOADED;
|
|
95
|
+
NSDictionary *data = nil;
|
|
96
|
+
|
|
97
|
+
// Set up paid event handler
|
|
98
|
+
GADPaidEventHandler paidEventHandler = ^(GADAdValue *value) {
|
|
99
|
+
[weakSelf sendAdEvent:@"paid"
|
|
100
|
+
requestId:requestId
|
|
101
|
+
adUnitId:adUnitId
|
|
102
|
+
error:nil
|
|
103
|
+
data:@{
|
|
104
|
+
@"value" : value.value,
|
|
105
|
+
@"precision" : @(value.precision),
|
|
106
|
+
@"currency" : value.currencyCode
|
|
107
|
+
}];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if ([ad isKindOfClass:[GADRewardedAd class]]) {
|
|
111
|
+
[(GADRewardedAd *)ad setPaidEventHandler:paidEventHandler];
|
|
112
|
+
} else if ([ad isKindOfClass:[GADRewardedInterstitialAd class]]) {
|
|
113
|
+
[(GADRewardedInterstitialAd *)ad setPaidEventHandler:paidEventHandler];
|
|
114
|
+
} else if ([ad isKindOfClass:[GADInterstitialAd class]]) {
|
|
115
|
+
[(GADInterstitialAd *)ad setPaidEventHandler:paidEventHandler];
|
|
116
|
+
} else if ([ad isKindOfClass:[GADAppOpenAd class]]) {
|
|
117
|
+
[(GADAppOpenAd *)ad setPaidEventHandler:paidEventHandler];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if ([ad isKindOfClass:[GADRewardedAd class]] ||
|
|
121
|
+
[ad isKindOfClass:[GADRewardedInterstitialAd class]]) {
|
|
122
|
+
NSDictionary *serverSideVerificationOptions =
|
|
123
|
+
adRequestOptions[@"serverSideVerificationOptions"];
|
|
124
|
+
if (serverSideVerificationOptions) {
|
|
125
|
+
GADServerSideVerificationOptions *options =
|
|
126
|
+
[[GADServerSideVerificationOptions alloc] init];
|
|
127
|
+
options.userIdentifier = serverSideVerificationOptions[@"userId"];
|
|
128
|
+
options.customRewardString = serverSideVerificationOptions[@"customData"];
|
|
129
|
+
|
|
130
|
+
if ([ad isKindOfClass:[GADRewardedAd class]]) {
|
|
131
|
+
[(GADRewardedAd *)ad setServerSideVerificationOptions:options];
|
|
132
|
+
} else if ([ad isKindOfClass:[GADRewardedInterstitialAd class]]) {
|
|
133
|
+
[(GADRewardedInterstitialAd *)ad setServerSideVerificationOptions:options];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
eventType = GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED;
|
|
138
|
+
GADAdReward *adReward =
|
|
139
|
+
[(GADRewardedAd *)ad adReward] ?: [(GADRewardedInterstitialAd *)ad adReward];
|
|
140
|
+
data = @{@"type" : adReward.type, @"amount" : adReward.amount};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if ([ad isKindOfClass:[GAMInterstitialAd class]]) {
|
|
144
|
+
[(GAMInterstitialAd *)ad setAppEventDelegate:delegate];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
ad.fullScreenContentDelegate = delegate;
|
|
148
|
+
weakSelf.adMap[@(requestId)] = ad;
|
|
149
|
+
weakSelf.delegateMap[@(requestId)] = delegate;
|
|
150
|
+
|
|
151
|
+
[weakSelf sendAdEvent:eventType requestId:requestId adUnitId:adUnitId error:nil data:data];
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
- (void)showWithRequestId:(int)requestId
|
|
156
|
+
adUnitId:(NSString *)adUnitId
|
|
157
|
+
showOptions:(NSDictionary *)showOptions
|
|
158
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
159
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
160
|
+
UIViewController *viewController = [RNGoogleMobileAdsCommon currentViewController];
|
|
161
|
+
if (!viewController) {
|
|
162
|
+
[RNSharedUtils
|
|
163
|
+
rejectPromiseWithUserInfo:reject
|
|
164
|
+
userInfo:@{
|
|
165
|
+
@"code" : @"nil-vc",
|
|
166
|
+
@"message" :
|
|
167
|
+
@"Ad attempted to show but the current View Controller was nil."
|
|
168
|
+
}];
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
id<GADFullScreenPresentingAd> ad = self.adMap[@(requestId)];
|
|
173
|
+
if (!ad) {
|
|
174
|
+
[RNSharedUtils rejectPromiseWithUserInfo:reject
|
|
175
|
+
userInfo:@{
|
|
176
|
+
@"code" : @"not-ready",
|
|
177
|
+
@"message" : @"Ad attempted to show but was not ready."
|
|
178
|
+
}];
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if ([ad isKindOfClass:[GADAppOpenAd class]]) {
|
|
183
|
+
[(GADAppOpenAd *)ad presentFromRootViewController:viewController];
|
|
184
|
+
} else if ([ad isKindOfClass:[GADInterstitialAd class]]) {
|
|
185
|
+
[(GADInterstitialAd *)ad presentFromRootViewController:viewController];
|
|
186
|
+
} else if ([ad isKindOfClass:[GADRewardedAd class]]) {
|
|
187
|
+
[(GADRewardedAd *)ad presentFromRootViewController:viewController
|
|
188
|
+
userDidEarnRewardHandler:^{
|
|
189
|
+
NSDictionary *rewardData = @{
|
|
190
|
+
@"type" : [(GADRewardedAd *)ad adReward].type,
|
|
191
|
+
@"amount" : [(GADRewardedAd *)ad adReward].amount
|
|
192
|
+
};
|
|
193
|
+
[self sendAdEvent:GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD
|
|
194
|
+
requestId:requestId
|
|
195
|
+
adUnitId:adUnitId
|
|
196
|
+
error:nil
|
|
197
|
+
data:rewardData];
|
|
198
|
+
}];
|
|
199
|
+
} else if ([ad isKindOfClass:[GADRewardedInterstitialAd class]]) {
|
|
200
|
+
[(GADRewardedInterstitialAd *)ad
|
|
201
|
+
presentFromRootViewController:viewController
|
|
202
|
+
userDidEarnRewardHandler:^{
|
|
203
|
+
NSDictionary *rewardData = @{
|
|
204
|
+
@"type" : [(GADRewardedInterstitialAd *)ad adReward].type,
|
|
205
|
+
@"amount" : [(GADRewardedInterstitialAd *)ad adReward].amount
|
|
206
|
+
};
|
|
207
|
+
[self sendAdEvent:GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD
|
|
208
|
+
requestId:requestId
|
|
209
|
+
adUnitId:adUnitId
|
|
210
|
+
error:nil
|
|
211
|
+
data:rewardData];
|
|
212
|
+
}];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
resolve(nil);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@end
|
|
219
|
+
|
|
220
|
+
#endif
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
|
|
23
|
+
@interface RNGoogleMobileAdsFullScreenContentDelegate
|
|
24
|
+
: NSObject <GADFullScreenContentDelegate, GADAppEventDelegate>
|
|
25
|
+
|
|
26
|
+
@property(nonatomic, strong, readonly) NSString *adEventName;
|
|
27
|
+
@property(nonatomic, assign, readonly) int requestId;
|
|
28
|
+
@property(nonatomic, strong, readonly) NSString *adUnitId;
|
|
29
|
+
|
|
30
|
+
- (instancetype)initWithAdEventName:(NSString *)adEventName
|
|
31
|
+
requestId:(int)requestId
|
|
32
|
+
adUnitId:(NSString *)adUnitId;
|
|
33
|
+
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
#endif
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsFullScreenContentDelegate.h"
|
|
21
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
22
|
+
|
|
23
|
+
@implementation RNGoogleMobileAdsFullScreenContentDelegate
|
|
24
|
+
|
|
25
|
+
- (instancetype)initWithAdEventName:(NSString *)adEventName
|
|
26
|
+
requestId:(int)requestId
|
|
27
|
+
adUnitId:(NSString *)adUnitId {
|
|
28
|
+
if (self = [super init]) {
|
|
29
|
+
_adEventName = adEventName;
|
|
30
|
+
_requestId = requestId;
|
|
31
|
+
_adUnitId = adUnitId;
|
|
32
|
+
}
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (void)adWillPresentFullScreenContent:(id<GADFullScreenPresentingAd>)ad {
|
|
37
|
+
[self sendAdEventWithType:GOOGLE_MOBILE_ADS_EVENT_OPENED error:nil data:nil];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (void)ad:(id<GADFullScreenPresentingAd>)ad
|
|
41
|
+
didFailToPresentFullScreenContentWithError:(NSError *)error {
|
|
42
|
+
NSDictionary *errorInfo = [RNGoogleMobileAdsCommon getCodeAndMessageFromAdError:error];
|
|
43
|
+
[self sendAdEventWithType:GOOGLE_MOBILE_ADS_EVENT_ERROR error:errorInfo data:nil];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)adDidDismissFullScreenContent:(id<GADFullScreenPresentingAd>)ad {
|
|
47
|
+
[self sendAdEventWithType:GOOGLE_MOBILE_ADS_EVENT_CLOSED error:nil data:nil];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)adDidRecordClick:(id<GADFullScreenPresentingAd>)ad {
|
|
51
|
+
[self sendAdEventWithType:GOOGLE_MOBILE_ADS_EVENT_CLICKED error:nil data:nil];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (void)adDidRecordImpression:(id<GADFullScreenPresentingAd>)ad {
|
|
55
|
+
// Not implemented yet
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)interstitialAd:(GADInterstitialAd *)interstitialAd
|
|
59
|
+
didReceiveAppEvent:(NSString *)name
|
|
60
|
+
withInfo:(nullable NSString *)info {
|
|
61
|
+
NSDictionary *data = @{@"name" : name, @"data" : info ?: @""};
|
|
62
|
+
[self sendAdEventWithType:GOOGLE_MOBILE_ADS_EVENT_APP_EVENT error:nil data:data];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#pragma mark - Private
|
|
66
|
+
|
|
67
|
+
- (void)sendAdEventWithType:(NSString *)type
|
|
68
|
+
error:(nullable NSDictionary *)error
|
|
69
|
+
data:(nullable NSDictionary *)data {
|
|
70
|
+
[RNGoogleMobileAdsCommon sendAdEvent:self.adEventName
|
|
71
|
+
requestId:@(self.requestId)
|
|
72
|
+
type:type
|
|
73
|
+
adUnitId:self.adUnitId
|
|
74
|
+
error:error
|
|
75
|
+
data:data];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@end
|
|
79
|
+
|
|
80
|
+
#endif
|