react-native-google-mobile-ads 11.1.0 → 11.2.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/RNGoogleMobileAds.podspec +4 -0
- package/__tests__/interstitial.test.ts +22 -8
- package/android/build.gradle +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.m +6 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +13 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.m +10 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +4 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift +4 -0
- package/jest.setup.ts +2 -1
- package/lib/commonjs/MobileAds.js +28 -31
- package/lib/commonjs/MobileAds.js.map +1 -1
- package/lib/commonjs/ads/AppOpenAd.js +1 -2
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
- package/lib/commonjs/ads/InterstitialAd.js +1 -2
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
- package/lib/commonjs/ads/MobileAd.js +8 -6
- package/lib/commonjs/ads/MobileAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedAd.js +1 -2
- package/lib/commonjs/ads/RewardedAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedInterstitialAd.js +1 -2
- package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -1
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/MobileAds.js +28 -31
- package/lib/module/MobileAds.js.map +1 -1
- package/lib/module/ads/AppOpenAd.js +1 -2
- package/lib/module/ads/AppOpenAd.js.map +1 -1
- package/lib/module/ads/InterstitialAd.js +1 -2
- package/lib/module/ads/InterstitialAd.js.map +1 -1
- package/lib/module/ads/MobileAd.js +8 -6
- package/lib/module/ads/MobileAd.js.map +1 -1
- package/lib/module/ads/RewardedAd.js +1 -2
- package/lib/module/ads/RewardedAd.js.map +1 -1
- package/lib/module/ads/RewardedInterstitialAd.js +1 -2
- package/lib/module/ads/RewardedInterstitialAd.js.map +1 -1
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/MobileAds.d.ts +6 -7
- package/lib/typescript/MobileAds.d.ts.map +1 -1
- package/lib/typescript/ads/AppOpenAd.d.ts.map +1 -1
- package/lib/typescript/ads/InterstitialAd.d.ts.map +1 -1
- package/lib/typescript/ads/MobileAd.d.ts +6 -5
- 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/internal/GoogleMobileAdsNativeEventEmitter.d.ts +2 -1
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts.map +1 -1
- package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +0 -13
- package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts.map +1 -1
- package/lib/typescript/types/MobileAdsModule.interface.d.ts +0 -10
- package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/MobileAds.ts +32 -62
- package/src/ads/AppOpenAd.ts +7 -2
- package/src/ads/InterstitialAd.ts +7 -2
- package/src/ads/MobileAd.ts +22 -10
- package/src/ads/RewardedAd.ts +7 -2
- package/src/ads/RewardedInterstitialAd.ts +1 -2
- package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +1 -1
- package/src/types/GoogleMobileAdsNativeModule.ts +0 -17
- package/src/types/MobileAdsModule.interface.ts +0 -13
- package/src/version.ts +1 -1
- package/lib/commonjs/internal/Module.js +0 -44
- package/lib/commonjs/internal/Module.js.map +0 -1
- package/lib/commonjs/internal/index.js +0 -44
- package/lib/commonjs/internal/index.js.map +0 -1
- package/lib/commonjs/internal/registry/nativeModule.js +0 -180
- package/lib/commonjs/internal/registry/nativeModule.js.map +0 -1
- package/lib/commonjs/types/Module.interface.js +0 -2
- package/lib/commonjs/types/Module.interface.js.map +0 -1
- package/lib/module/internal/Module.js +0 -54
- package/lib/module/internal/Module.js.map +0 -1
- package/lib/module/internal/index.js +0 -22
- package/lib/module/internal/index.js.map +0 -1
- package/lib/module/internal/registry/nativeModule.js +0 -174
- package/lib/module/internal/registry/nativeModule.js.map +0 -1
- package/lib/module/types/Module.interface.js +0 -2
- package/lib/module/types/Module.interface.js.map +0 -1
- package/lib/typescript/internal/Module.d.ts +0 -14
- package/lib/typescript/internal/Module.d.ts.map +0 -1
- package/lib/typescript/internal/index.d.ts +0 -5
- package/lib/typescript/internal/index.d.ts.map +0 -1
- package/lib/typescript/internal/registry/nativeModule.d.ts +0 -10
- package/lib/typescript/internal/registry/nativeModule.d.ts.map +0 -1
- package/lib/typescript/types/Module.interface.d.ts +0 -15
- package/lib/typescript/types/Module.interface.d.ts.map +0 -1
- package/src/internal/Module.ts +0 -58
- package/src/internal/index.ts +0 -21
- package/src/internal/registry/nativeModule.ts +0 -205
- package/src/types/Module.interface.ts +0 -16
|
@@ -30,7 +30,9 @@ Pod::Spec.new do |s|
|
|
|
30
30
|
google_ump_sdk_version = $RNGoogleUmpSDKVersion
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
if !ENV['MAC_CATALYST']
|
|
33
34
|
s.dependency 'GoogleUserMessagingPlatform', google_ump_sdk_version
|
|
35
|
+
end
|
|
34
36
|
|
|
35
37
|
if defined?($RNGoogleMobileAdsSDKVersion)
|
|
36
38
|
Pod::UI.puts "#{s.name}: Using user specified Google Mobile-Ads SDK version '#{$RNGoogleMobileAdsSDKVersion}'"
|
|
@@ -38,7 +40,9 @@ Pod::Spec.new do |s|
|
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
# AdMob dependencies
|
|
43
|
+
if !ENV['MAC_CATALYST']
|
|
41
44
|
s.dependency 'Google-Mobile-Ads-SDK', google_mobile_ads_sdk_version
|
|
45
|
+
end
|
|
42
46
|
|
|
43
47
|
if defined?($RNGoogleMobileAdsAsStaticFramework)
|
|
44
48
|
Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNGoogleMobileAdsAsStaticFramework}'"
|
|
@@ -34,17 +34,23 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
34
34
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
35
35
|
|
|
36
36
|
ad.load();
|
|
37
|
-
expect(NativeModules.
|
|
37
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
38
|
+
1,
|
|
39
|
+
);
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
it('does nothing if ad currently loading', () => {
|
|
41
43
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
42
44
|
|
|
43
45
|
ad.load();
|
|
44
|
-
expect(NativeModules.
|
|
46
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
47
|
+
1,
|
|
48
|
+
);
|
|
45
49
|
|
|
46
50
|
ad.load();
|
|
47
|
-
expect(NativeModules.
|
|
51
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
52
|
+
1,
|
|
53
|
+
);
|
|
48
54
|
});
|
|
49
55
|
|
|
50
56
|
it('does nothing if ad is already loaded', () => {
|
|
@@ -54,33 +60,41 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
54
60
|
ad._handleAdEvent({ body: { type: AdEventType.LOADED } });
|
|
55
61
|
|
|
56
62
|
ad.load();
|
|
57
|
-
expect(NativeModules.
|
|
63
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).not.toBeCalled();
|
|
58
64
|
});
|
|
59
65
|
|
|
60
66
|
it('can be called again after ad was closed', () => {
|
|
61
67
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
62
68
|
|
|
63
69
|
ad.load();
|
|
64
|
-
expect(NativeModules.
|
|
70
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
71
|
+
1,
|
|
72
|
+
);
|
|
65
73
|
|
|
66
74
|
// @ts-ignore
|
|
67
75
|
ad._handleAdEvent({ body: { type: AdEventType.CLOSED } });
|
|
68
76
|
|
|
69
77
|
ad.load();
|
|
70
|
-
expect(NativeModules.
|
|
78
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
79
|
+
2,
|
|
80
|
+
);
|
|
71
81
|
});
|
|
72
82
|
|
|
73
83
|
it('can be called again after ad failed to load', () => {
|
|
74
84
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
75
85
|
|
|
76
86
|
ad.load();
|
|
77
|
-
expect(NativeModules.
|
|
87
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
88
|
+
1,
|
|
89
|
+
);
|
|
78
90
|
|
|
79
91
|
// @ts-ignore
|
|
80
92
|
ad._handleAdEvent({ body: { type: AdEventType.ERROR } });
|
|
81
93
|
|
|
82
94
|
ad.load();
|
|
83
|
-
expect(NativeModules.
|
|
95
|
+
expect(NativeModules.RNGoogleMobileAdsInterstitialModule.interstitialLoad).toBeCalledTimes(
|
|
96
|
+
2,
|
|
97
|
+
);
|
|
84
98
|
});
|
|
85
99
|
});
|
|
86
100
|
|
package/android/build.gradle
CHANGED
|
@@ -117,7 +117,7 @@ repositories {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
dependencies {
|
|
120
|
-
implementation("com.google.android.gms:play-services-ads:${googleMobileAdsVersion}")
|
|
120
|
+
implementation("com.google.android.gms:play-services-ads:${googleMobileAdsVersion}")
|
|
121
121
|
api "com.google.android.ump:user-messaging-platform:${googleUmpVersion}"
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
18
20
|
#import <React/RCTBridgeModule.h>
|
|
19
21
|
|
|
20
22
|
@interface RCT_EXTERN_MODULE (RNGoogleMobileAdsAppOpenModule, NSObject)
|
|
@@ -40,3 +42,5 @@ RCT_EXTERN_METHOD(appOpenShow
|
|
|
40
42
|
: (RCTPromiseRejectBlock)reject)
|
|
41
43
|
|
|
42
44
|
@end
|
|
45
|
+
|
|
46
|
+
#endif
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
18
20
|
#import <GoogleMobileAds/GADAppEventDelegate.h>
|
|
19
21
|
#import <GoogleMobileAds/GADBannerView.h>
|
|
20
22
|
#import <GoogleMobileAds/GADBannerViewDelegate.h>
|
|
@@ -37,3 +39,5 @@
|
|
|
37
39
|
- (void)recordManualImpression;
|
|
38
40
|
|
|
39
41
|
@end
|
|
42
|
+
|
|
43
|
+
#endif
|
|
@@ -35,6 +35,7 @@ RCT_EXPORT_VIEW_PROPERTY(manualImpressionsEnabled, BOOL);
|
|
|
35
35
|
RCT_EXPORT_VIEW_PROPERTY(onNativeEvent, RCTBubblingEventBlock);
|
|
36
36
|
|
|
37
37
|
RCT_EXPORT_METHOD(recordManualImpression : (nonnull NSNumber *)reactTag) {
|
|
38
|
+
#if !TARGET_OS_MACCATALYST
|
|
38
39
|
[self.bridge.uiManager
|
|
39
40
|
addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
40
41
|
RNGoogleMobileAdsBannerComponent *banner = viewRegistry[reactTag];
|
|
@@ -44,13 +45,18 @@ RCT_EXPORT_METHOD(recordManualImpression : (nonnull NSNumber *)reactTag) {
|
|
|
44
45
|
}
|
|
45
46
|
[banner recordManualImpression];
|
|
46
47
|
}];
|
|
48
|
+
#endif
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
@synthesize bridge = _bridge;
|
|
50
52
|
|
|
51
53
|
- (UIView *)view {
|
|
54
|
+
#if TARGET_OS_MACCATALYST
|
|
55
|
+
return nil;
|
|
56
|
+
#else
|
|
52
57
|
RNGoogleMobileAdsBannerComponent *banner = [RNGoogleMobileAdsBannerComponent new];
|
|
53
58
|
return banner;
|
|
59
|
+
#endif
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
- (dispatch_queue_t)methodQueue {
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
#if !TARGET_OS_MACCATALYST
|
|
20
|
+
|
|
19
21
|
#import <React/RCTBridgeModule.h>
|
|
20
22
|
@import GoogleMobileAds;
|
|
21
23
|
|
|
@@ -64,3 +66,5 @@ extern NSString *const GOOGLE_MOBILE_ADS_EVENT_APP_EVENT;
|
|
|
64
66
|
|
|
65
67
|
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED;
|
|
66
68
|
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD;
|
|
69
|
+
|
|
70
|
+
#endif
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
#if !TARGET_OS_MACCATALYST
|
|
20
|
+
|
|
19
21
|
#import "RNGoogleMobileAdsCommon.h"
|
|
20
22
|
#import "common/RNRCTEventEmitter.h"
|
|
21
23
|
|
|
@@ -231,3 +233,5 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
@end
|
|
236
|
+
|
|
237
|
+
#endif
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
#import <React/RCTUtils.h>
|
|
20
20
|
|
|
21
21
|
#import <React/RCTConvert.h>
|
|
22
|
+
#if !TARGET_OS_MACCATALYST
|
|
22
23
|
#include <UserMessagingPlatform/UserMessagingPlatform.h>
|
|
24
|
+
#endif
|
|
23
25
|
#import "RCTBridgeModule.h"
|
|
24
26
|
#import "RNGoogleMobileAdsConsentModule.h"
|
|
25
27
|
#import "common/RNSharedUtils.h"
|
|
@@ -37,6 +39,7 @@ RCT_EXPORT_MODULE();
|
|
|
37
39
|
#pragma mark -
|
|
38
40
|
#pragma mark Google Mobile Ads Methods
|
|
39
41
|
|
|
42
|
+
#if !TARGET_OS_MACCATALYST
|
|
40
43
|
- (NSString *)getConsentStatusString:(UMPConsentStatus)consentStatus {
|
|
41
44
|
switch (consentStatus) {
|
|
42
45
|
case UMPConsentStatusRequired:
|
|
@@ -50,11 +53,13 @@ RCT_EXPORT_MODULE();
|
|
|
50
53
|
return @"UNKNOWN";
|
|
51
54
|
}
|
|
52
55
|
}
|
|
56
|
+
#endif
|
|
53
57
|
|
|
54
58
|
RCT_EXPORT_METHOD(requestInfoUpdate
|
|
55
59
|
: (NSDictionary *)options
|
|
56
60
|
: (RCTPromiseResolveBlock)resolve
|
|
57
61
|
: (RCTPromiseRejectBlock)reject) {
|
|
62
|
+
#if !TARGET_OS_MACCATALYST
|
|
58
63
|
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
|
59
64
|
UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
|
60
65
|
|
|
@@ -86,9 +91,11 @@ RCT_EXPORT_METHOD(requestInfoUpdate
|
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
93
|
}];
|
|
94
|
+
#endif
|
|
89
95
|
}
|
|
90
96
|
|
|
91
97
|
RCT_EXPORT_METHOD(showForm : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
98
|
+
#if !TARGET_OS_MACCATALYST
|
|
92
99
|
[UMPConsentForm loadWithCompletionHandler:^(UMPConsentForm *form, NSError *loadError) {
|
|
93
100
|
if (loadError) {
|
|
94
101
|
[RNSharedUtils rejectPromiseWithUserInfo:reject
|
|
@@ -117,9 +124,14 @@ RCT_EXPORT_METHOD(showForm : (RCTPromiseResolveBlock)resolve : (RCTPromiseReject
|
|
|
117
124
|
}];
|
|
118
125
|
}
|
|
119
126
|
}];
|
|
127
|
+
#endif
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
RCT_EXPORT_METHOD(reset) {
|
|
130
|
+
RCT_EXPORT_METHOD(reset) {
|
|
131
|
+
#if !TARGET_OS_MACCATALYST
|
|
132
|
+
[UMPConsentInformation.sharedInstance reset];
|
|
133
|
+
#endif
|
|
134
|
+
}
|
|
123
135
|
|
|
124
136
|
RCT_EXPORT_METHOD(getTCString : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
125
137
|
@try {
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !targetEnvironment(macCatalyst)
|
|
19
|
+
|
|
18
20
|
import Foundation
|
|
19
21
|
import GoogleMobileAds
|
|
20
22
|
|
|
@@ -206,3 +208,5 @@ class RNGoogleMobileAdsFullScreenAd<T>: NSObject where T : GADFullScreenPresenti
|
|
|
206
208
|
resolve!(nil)
|
|
207
209
|
}
|
|
208
210
|
}
|
|
211
|
+
|
|
212
|
+
#endif
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
18
20
|
#import <React/RCTBridgeModule.h>
|
|
19
21
|
|
|
20
22
|
@interface RCT_EXTERN_MODULE (RNGoogleMobileAdsInterstitialModule, NSObject)
|
|
@@ -40,3 +42,5 @@ RCT_EXTERN_METHOD(interstitialShow
|
|
|
40
42
|
: (RCTPromiseRejectBlock)reject)
|
|
41
43
|
|
|
42
44
|
@end
|
|
45
|
+
|
|
46
|
+
#endif
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
18
19
|
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
20
|
+
#endif
|
|
19
21
|
#import <React/RCTUtils.h>
|
|
20
22
|
|
|
21
23
|
#import "RNGoogleMobileAdsModule.h"
|
|
@@ -35,6 +37,7 @@ RCT_EXPORT_MODULE();
|
|
|
35
37
|
#pragma mark Google Mobile Ads Methods
|
|
36
38
|
|
|
37
39
|
RCT_EXPORT_METHOD(initialize : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
40
|
+
#if !TARGET_OS_MACCATALYST
|
|
38
41
|
[[GADMobileAds sharedInstance]
|
|
39
42
|
startWithCompletionHandler:^(GADInitializationStatus *_Nonnull status) {
|
|
40
43
|
NSDictionary *adapterStatuses = [status adapterStatusesByClassName];
|
|
@@ -50,6 +53,7 @@ RCT_EXPORT_METHOD(initialize : (RCTPromiseResolveBlock)resolve : (RCTPromiseReje
|
|
|
50
53
|
}
|
|
51
54
|
resolve(result);
|
|
52
55
|
}];
|
|
56
|
+
#endif
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
RCT_EXPORT_METHOD(setRequestConfiguration
|
|
@@ -61,6 +65,7 @@ RCT_EXPORT_METHOD(setRequestConfiguration
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
- (void)setRequestConfiguration:(NSDictionary *)requestConfiguration {
|
|
68
|
+
#if !TARGET_OS_MACCATALYST
|
|
64
69
|
if (requestConfiguration[@"maxAdContentRating"]) {
|
|
65
70
|
NSString *rating = requestConfiguration[@"maxAdContentRating"];
|
|
66
71
|
if ([rating isEqualToString:@"G"]) {
|
|
@@ -99,11 +104,13 @@ RCT_EXPORT_METHOD(setRequestConfiguration
|
|
|
99
104
|
}
|
|
100
105
|
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = devices;
|
|
101
106
|
}
|
|
107
|
+
#endif
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
RCT_EXPORT_METHOD(openAdInspector
|
|
105
111
|
: (RCTPromiseResolveBlock)resolve
|
|
106
112
|
: (RCTPromiseRejectBlock)reject) {
|
|
113
|
+
#if !TARGET_OS_MACCATALYST
|
|
107
114
|
[GADMobileAds.sharedInstance
|
|
108
115
|
presentAdInspectorFromViewController:RCTSharedApplication().delegate.window.rootViewController
|
|
109
116
|
completionHandler:^(NSError *_Nullable error) {
|
|
@@ -119,15 +126,18 @@ RCT_EXPORT_METHOD(openAdInspector
|
|
|
119
126
|
resolve(nil);
|
|
120
127
|
}
|
|
121
128
|
}];
|
|
129
|
+
#endif
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) {
|
|
133
|
+
#if !TARGET_OS_MACCATALYST
|
|
125
134
|
GADDebugOptionsViewController *debugOptionsViewController =
|
|
126
135
|
[GADDebugOptionsViewController debugOptionsViewControllerWithAdUnitID:adUnit];
|
|
127
136
|
[RCTSharedApplication().delegate.window.rootViewController
|
|
128
137
|
presentViewController:debugOptionsViewController
|
|
129
138
|
animated:YES
|
|
130
139
|
completion:nil];
|
|
140
|
+
#endif
|
|
131
141
|
}
|
|
132
142
|
|
|
133
143
|
@end
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
18
20
|
#import <React/RCTBridgeModule.h>
|
|
19
21
|
|
|
20
22
|
@interface RCT_EXTERN_MODULE (RNGoogleMobileAdsRewardedInterstitialModule, NSObject)
|
|
@@ -40,3 +42,5 @@ RCT_EXTERN_METHOD(rewardedInterstitialShow
|
|
|
40
42
|
: (RCTPromiseRejectBlock)reject)
|
|
41
43
|
|
|
42
44
|
@end
|
|
45
|
+
|
|
46
|
+
#endif
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
18
20
|
#import <React/RCTBridgeModule.h>
|
|
19
21
|
|
|
20
22
|
@interface RCT_EXTERN_MODULE (RNGoogleMobileAdsRewardedModule, NSObject)
|
|
@@ -40,3 +42,5 @@ RCT_EXTERN_METHOD(rewardedShow
|
|
|
40
42
|
: (RCTPromiseRejectBlock)reject)
|
|
41
43
|
|
|
42
44
|
@end
|
|
45
|
+
|
|
46
|
+
#endif
|
package/jest.setup.ts
CHANGED
|
@@ -20,9 +20,10 @@ jest.doMock('react-native', () => {
|
|
|
20
20
|
removeListeners: jest.fn(),
|
|
21
21
|
eventsAddListener: jest.fn(),
|
|
22
22
|
eventsNotifyReady: jest.fn(),
|
|
23
|
+
},
|
|
24
|
+
RNGoogleMobileAdsInterstitialModule: {
|
|
23
25
|
interstitialLoad: jest.fn(),
|
|
24
26
|
},
|
|
25
|
-
RNGoogleMobileAdsInterstitialModule: {},
|
|
26
27
|
RNGoogleMobileAdsRewardedModule: {},
|
|
27
28
|
RNGoogleMobileAdsConsentModule: {},
|
|
28
29
|
},
|
|
@@ -4,29 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.MobileAds = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
8
|
var _validateAdRequestConfiguration = require("./validateAdRequestConfiguration");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
var _SharedEventEmitter = require("./internal/SharedEventEmitter");
|
|
10
|
+
var _GoogleMobileAdsNativeEventEmitter = require("./internal/GoogleMobileAdsNativeEventEmitter");
|
|
11
|
+
const {
|
|
12
|
+
RNGoogleMobileAdsModule
|
|
13
|
+
} = _reactNative.NativeModules;
|
|
14
|
+
const NATIVE_MODULE_EVENT_SUBSCRIPTIONS = {};
|
|
15
|
+
const nativeEvents = ['google_mobile_ads_app_open_event', 'google_mobile_ads_interstitial_event', 'google_mobile_ads_rewarded_event', 'google_mobile_ads_rewarded_interstitial_event'];
|
|
16
|
+
class MobileAdsModule {
|
|
17
|
+
constructor() {
|
|
18
|
+
if (nativeEvents && nativeEvents.length) {
|
|
19
|
+
for (let i = 0, len = nativeEvents.length; i < len; i++) {
|
|
20
|
+
this.subscribeToNativeModuleEvent(nativeEvents[i]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
subscribeToNativeModuleEvent(eventName) {
|
|
25
|
+
if (!NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName]) {
|
|
26
|
+
_GoogleMobileAdsNativeEventEmitter.GoogleMobileAdsNativeEventEmitter.addListener(eventName, event => {
|
|
27
|
+
_SharedEventEmitter.SharedEventEmitter.emit(`${eventName}:${event.adUnitId}:${event.requestId}`, event);
|
|
28
|
+
});
|
|
29
|
+
NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName] = true;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
initialize() {
|
|
29
|
-
return
|
|
33
|
+
return RNGoogleMobileAdsModule.initialize();
|
|
30
34
|
}
|
|
31
35
|
setRequestConfiguration(requestConfiguration) {
|
|
32
36
|
let config;
|
|
@@ -37,24 +41,17 @@ class MobileAdsModule extends _internal.Module {
|
|
|
37
41
|
throw new Error(`googleMobileAds.setRequestConfiguration(*) ${e.message}`);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
return
|
|
44
|
+
return RNGoogleMobileAdsModule.setRequestConfiguration(config);
|
|
41
45
|
}
|
|
42
46
|
openAdInspector() {
|
|
43
|
-
return
|
|
47
|
+
return RNGoogleMobileAdsModule.openAdInspector();
|
|
44
48
|
}
|
|
45
49
|
openDebugMenu(adUnit) {
|
|
46
50
|
if (!adUnit) throw new Error('googleMobileAds.openDebugMenu expected a non-empty string value');
|
|
47
|
-
|
|
51
|
+
RNGoogleMobileAdsModule.openDebugMenu(adUnit);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
const MobileAdsInstance = new MobileAdsModule(
|
|
51
|
-
name: 'AppName'
|
|
52
|
-
}, {
|
|
53
|
-
version: _version.version,
|
|
54
|
-
namespace,
|
|
55
|
-
nativeModuleName,
|
|
56
|
-
nativeEvents: ['google_mobile_ads_app_open_event', 'google_mobile_ads_interstitial_event', 'google_mobile_ads_rewarded_event', 'google_mobile_ads_rewarded_interstitial_event']
|
|
57
|
-
});
|
|
54
|
+
const MobileAdsInstance = new MobileAdsModule();
|
|
58
55
|
const MobileAds = () => {
|
|
59
56
|
return MobileAdsInstance;
|
|
60
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["RNGoogleMobileAdsModule","NativeModules","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeEvents","MobileAdsModule","constructor","length","i","len","subscribeToNativeModuleEvent","eventName","GoogleMobileAdsNativeEventEmitter","addListener","event","SharedEventEmitter","emit","adUnitId","requestId","initialize","setRequestConfiguration","requestConfiguration","config","validateAdRequestConfiguration","e","Error","message","openAdInspector","openDebugMenu","adUnit","MobileAdsInstance","MobileAds"],"sourceRoot":"../../src","sources":["MobileAds.ts"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AAIA,MAAM;EAAEA;AAAwB,CAAC,GAAGC,0BAAa;AAEjD,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,MAAMC,YAAY,GAAG,CACnB,kCAAkC,EAClC,sCAAsC,EACtC,kCAAkC,EAClC,+CAA+C,CAChD;AAED,MAAMC,eAAe,CAAqC;EACxDC,WAAW,GAAG;IACZ,IAAIF,YAAY,IAAIA,YAAY,CAACG,MAAM,EAAE;MACvC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGL,YAAY,CAACG,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAE;QACvD,IAAI,CAACE,4BAA4B,CAACN,YAAY,CAACI,CAAC,CAAC,CAAC;MACpD;IACF;EACF;EAEAE,4BAA4B,CAACC,SAAiB,EAAE;IAC9C,IAAI,CAACR,iCAAiC,CAACQ,SAAS,CAAC,EAAE;MACjDC,oEAAiC,CAACC,WAAW,CAACF,SAAS,EAAEG,KAAK,IAAI;QAChEC,sCAAkB,CAACC,IAAI,CAAE,GAAEL,SAAU,IAAGG,KAAK,CAACG,QAAS,IAAGH,KAAK,CAACI,SAAU,EAAC,EAAEJ,KAAK,CAAC;MACrF,CAAC,CAAC;MAEFX,iCAAiC,CAACQ,SAAS,CAAC,GAAG,IAAI;IACrD;EACF;EAEAQ,UAAU,GAAG;IACX,OAAOlB,uBAAuB,CAACkB,UAAU,EAAE;EAC7C;EAEAC,uBAAuB,CAACC,oBAA0C,EAAE;IAClE,IAAIC,MAAM;IACV,IAAI;MACFA,MAAM,GAAG,IAAAC,8DAA8B,EAACF,oBAAoB,CAAC;IAC/D,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYC,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,8CAA6CD,CAAC,CAACE,OAAQ,EAAC,CAAC;MAC5E;IACF;IAEA,OAAOzB,uBAAuB,CAACmB,uBAAuB,CAACE,MAAM,CAAC;EAChE;EAEAK,eAAe,GAAG;IAChB,OAAO1B,uBAAuB,CAAC0B,eAAe,EAAE;EAClD;EAEAC,aAAa,CAACC,MAAc,EAAE;IAC5B,IAAI,CAACA,MAAM,EAAE,MAAM,IAAIJ,KAAK,CAAC,iEAAiE,CAAC;IAC/FxB,uBAAuB,CAAC2B,aAAa,CAACC,MAAM,CAAC;EAC/C;AACF;AAEA,MAAMC,iBAAiB,GAAG,IAAIzB,eAAe,EAAE;AAExC,MAAM0B,SAAS,GAAG,MAAM;EAC7B,OAAOD,iBAAiB;AAC1B,CAAC;AAAC;AAAA,eAEaC,SAAS;AAAA"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AppOpenAd = void 0;
|
|
7
7
|
var _common = require("../common");
|
|
8
|
-
var _MobileAds = require("../MobileAds");
|
|
9
8
|
var _validateAdRequestOptions = require("../validateAdRequestOptions");
|
|
10
9
|
var _MobileAd = require("./MobileAd");
|
|
11
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -23,7 +22,7 @@ class AppOpenAd extends _MobileAd.MobileAd {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
const requestId = AppOpenAd._appOpenRequest++;
|
|
26
|
-
return new AppOpenAd('app_open',
|
|
25
|
+
return new AppOpenAd('app_open', 'RNGoogleMobileAdsAppOpenModule', requestId, adUnitId, options);
|
|
27
26
|
}
|
|
28
27
|
addAdEventsListener(listener) {
|
|
29
28
|
return this._addAdEventsListener(listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AppOpenAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_appOpenRequest","
|
|
1
|
+
{"version":3,"names":["AppOpenAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_appOpenRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","_addAdEventListener"],"sourceRoot":"../../src","sources":["AppOpenAd.ts"],"mappings":";;;;;;AAiBA;AACA;AACA;AAAsC;AAM/B,MAAMA,SAAS,SAASC,kBAAQ,CAAC;EAGtC,OAAOC,kBAAkB,CAACC,QAAgB,EAAEC,cAA+B,EAAE;IAC3E,IAAI,CAAC,IAAAC,gBAAQ,EAACF,QAAQ,CAAC,EAAE;MACvB,MAAM,IAAIG,KAAK,CAAC,sEAAsE,CAAC;IACzF;IAEA,IAAIC,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI;MACFA,OAAO,GAAG,IAAAC,kDAAwB,EAACJ,cAAc,CAAC;IACpD,CAAC,CAAC,OAAOK,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYH,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,sCAAqCG,CAAC,CAACC,OAAQ,GAAE,CAAC;MACrE;IACF;IAEA,MAAMC,SAAS,GAAGX,SAAS,CAACY,eAAe,EAAE;IAC7C,OAAO,IAAIZ,SAAS,CAClB,UAAU,EACV,gCAAgC,EAChCW,SAAS,EACTR,QAAQ,EACRI,OAAO,CACR;EACH;EAEAM,mBAAmB,CAAwBC,QAA6B,EAAc;IACpF,OAAO,IAAI,CAACC,oBAAoB,CAACD,QAAQ,CAAC;EAC5C;EAEAE,kBAAkB,CAAwBC,IAAO,EAAEH,QAA4B,EAAE;IAC/E,OAAO,IAAI,CAACI,mBAAmB,CAACD,IAAI,EAAEH,QAAQ,CAAC;EACjD;AACF;AAAC;AAAA,gBAlCYd,SAAS,qBACe,CAAC"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.InterstitialAd = void 0;
|
|
7
7
|
var _common = require("../common");
|
|
8
|
-
var _MobileAds = require("../MobileAds");
|
|
9
8
|
var _validateAdRequestOptions = require("../validateAdRequestOptions");
|
|
10
9
|
var _MobileAd = require("./MobileAd");
|
|
11
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -84,7 +83,7 @@ class InterstitialAd extends _MobileAd.MobileAd {
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
const requestId = InterstitialAd._interstitialRequest++;
|
|
87
|
-
return new InterstitialAd('interstitial',
|
|
86
|
+
return new InterstitialAd('interstitial', 'RNGoogleMobileAdsInterstitialModule', requestId, adUnitId, options);
|
|
88
87
|
}
|
|
89
88
|
addAdEventsListener(listener) {
|
|
90
89
|
return this._addAdEventsListener(listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InterstitialAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_interstitialRequest","
|
|
1
|
+
{"version":3,"names":["InterstitialAd","MobileAd","createForAdRequest","adUnitId","requestOptions","isString","Error","options","validateAdRequestOptions","e","message","requestId","_interstitialRequest","addAdEventsListener","listener","_addAdEventsListener","addAdEventListener","type","_addAdEventListener"],"sourceRoot":"../../src","sources":["InterstitialAd.ts"],"mappings":";;;;;;AAiBA;AACA;AACA;AAAsC;AAMtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,SAASC,kBAAQ,CAAC;EAE3C;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,kBAAkB,CAACC,QAAgB,EAAEC,cAA+B,EAAE;IAC3E,IAAI,CAAC,IAAAC,gBAAQ,EAACF,QAAQ,CAAC,EAAE;MACvB,MAAM,IAAIG,KAAK,CAAC,2EAA2E,CAAC;IAC9F;IAEA,IAAIC,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI;MACFA,OAAO,GAAG,IAAAC,kDAAwB,EAACJ,cAAc,CAAC;IACpD,CAAC,CAAC,OAAOK,CAAC,EAAE;MACV,IAAIA,CAAC,YAAYH,KAAK,EAAE;QACtB,MAAM,IAAIA,KAAK,CAAE,2CAA0CG,CAAC,CAACC,OAAQ,GAAE,CAAC;MAC1E;IACF;IAEA,MAAMC,SAAS,GAAGX,cAAc,CAACY,oBAAoB,EAAE;IACvD,OAAO,IAAIZ,cAAc,CACvB,cAAc,EACd,qCAAqC,EACrCW,SAAS,EACTR,QAAQ,EACRI,OAAO,CACR;EACH;EAEAM,mBAAmB,CAAwBC,QAA6B,EAAE;IACxE,OAAO,IAAI,CAACC,oBAAoB,CAACD,QAAQ,CAAC;EAC5C;EAEAE,kBAAkB,CAAwBC,IAAO,EAAEH,QAA4B,EAAE;IAC/E,OAAO,IAAI,CAACI,mBAAmB,CAACD,IAAI,EAAEH,QAAQ,CAAC;EACjD;AACF;AAAC;AAAA,gBAvDYd,cAAc,0BACe,CAAC"}
|