react-native-google-mobile-ads 14.4.3 → 14.6.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 +3 -3
- package/__tests__/googleMobileAds.test.ts +1 -1
- package/__tests__/interstitial.test.ts +9 -23
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +0 -28
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +13 -0
- package/ios/RNGoogleMobileAds/{common/RNJSON.h → RNGoogleMobileAdsAppOpenModule.h} +11 -9
- 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.h +13 -2
- package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsConsentModule.m → RNGoogleMobileAdsConsentModule.mm} +115 -26
- 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/RNGoogleMobileAdsModule.mm +17 -0
- package/{src/AdsConsentPrivacyOptionsRequirementStatus.ts → ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h} +21 -20
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.mm +102 -0
- package/{lib/module/AdsConsentStatus.js → ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h} +20 -12
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.mm +100 -0
- package/ios/RNGoogleMobileAds/common/{RNAppModule.m → RNAppModule.mm} +0 -76
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +0 -4
- package/ios/RNGoogleMobileAds/common/{RNSharedUtils.m → RNSharedUtils.mm} +0 -21
- package/jest.setup.ts +8 -5
- package/lib/commonjs/AdsConsent.js +16 -16
- package/lib/commonjs/AdsConsent.js.map +1 -1
- 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/common/constants.js +4 -3
- package/lib/commonjs/common/constants.js.map +1 -1
- package/lib/commonjs/index.js +34 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/{src/AdsConsentDebugGeography.ts → lib/commonjs/specs/modules/NativeAppOpenModule.js} +10 -23
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.js +67 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.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/types/index.js +0 -11
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/AdsConsent.js +2 -3
- package/lib/module/AdsConsent.js.map +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/common/constants.js +3 -3
- package/lib/module/common/constants.js.map +1 -1
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
- package/{ios/RNGoogleMobileAds/common/RNMeta.h → lib/module/specs/modules/NativeAppOpenModule.js} +3 -13
- package/lib/module/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/module/specs/modules/NativeConsentModule.js +68 -0
- package/lib/module/specs/modules/NativeConsentModule.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/types/index.js +0 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/AdsConsent.d.ts +1 -1
- package/lib/typescript/AdsConsent.d.ts.map +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 +2 -4
- package/lib/typescript/index.d.ts.map +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/{types/AdsConsent.interface.d.ts → specs/modules/NativeConsentModule.d.ts} +249 -172
- package/lib/typescript/specs/modules/NativeConsentModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +36 -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/types/index.d.ts +0 -1
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/AdsConsent.ts +17 -21
- 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/common/constants.ts +2 -2
- package/src/index.ts +9 -3
- package/src/specs/modules/NativeAppOpenModule.ts +26 -0
- package/src/{types/AdsConsent.interface.ts → specs/modules/NativeConsentModule.ts} +262 -174
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +40 -0
- package/src/specs/modules/NativeInterstitialModule.ts +26 -0
- package/src/specs/modules/NativeRewardedInterstitialModule.ts +32 -0
- package/src/{AdsConsentStatus.ts → specs/modules/NativeRewardedModule.ts} +8 -23
- package/src/types/index.ts +0 -1
- 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/ios/RNGoogleMobileAds/common/RNJSON.m +0 -93
- package/ios/RNGoogleMobileAds/common/RNMeta.m +0 -61
- package/ios/RNGoogleMobileAds/common/RNPreferences.h +0 -44
- package/ios/RNGoogleMobileAds/common/RNPreferences.m +0 -94
- package/lib/commonjs/AdsConsentDebugGeography.js +0 -34
- package/lib/commonjs/AdsConsentDebugGeography.js.map +0 -1
- package/lib/commonjs/AdsConsentPrivacyOptionsRequirementStatus.js +0 -32
- package/lib/commonjs/AdsConsentPrivacyOptionsRequirementStatus.js.map +0 -1
- package/lib/commonjs/AdsConsentStatus.js +0 -33
- package/lib/commonjs/AdsConsentStatus.js.map +0 -1
- 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/commonjs/types/AdsConsent.interface.js +0 -6
- package/lib/commonjs/types/AdsConsent.interface.js.map +0 -1
- package/lib/module/AdsConsentDebugGeography.js +0 -29
- package/lib/module/AdsConsentDebugGeography.js.map +0 -1
- package/lib/module/AdsConsentPrivacyOptionsRequirementStatus.js +0 -27
- package/lib/module/AdsConsentPrivacyOptionsRequirementStatus.js.map +0 -1
- package/lib/module/AdsConsentStatus.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/module/types/AdsConsent.interface.js +0 -2
- package/lib/module/types/AdsConsent.interface.js.map +0 -1
- package/lib/typescript/AdsConsentDebugGeography.d.ts +0 -20
- package/lib/typescript/AdsConsentDebugGeography.d.ts.map +0 -1
- package/lib/typescript/AdsConsentPrivacyOptionsRequirementStatus.d.ts +0 -18
- package/lib/typescript/AdsConsentPrivacyOptionsRequirementStatus.d.ts.map +0 -1
- package/lib/typescript/AdsConsentStatus.d.ts +0 -22
- package/lib/typescript/AdsConsentStatus.d.ts.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/lib/typescript/types/AdsConsent.interface.d.ts.map +0 -1
- package/src/NativeGoogleMobileAdsModule.ts +0 -16
- /package/ios/RNGoogleMobileAds/common/{RNRCTEventEmitter.m → RNRCTEventEmitter.mm} +0 -0
- /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,10 +39,10 @@ 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) |
|
|
43
|
-
| iOS | User Messaging Platform (Turbo Native Module) |
|
|
42
|
+
| iOS | Full Screen Ads (Turbo Native Module) | ✅ Complete |
|
|
43
|
+
| iOS | User Messaging Platform (Turbo Native Module) | ✅ Complete |
|
|
44
44
|
| iOS | EventEmitter (Turbo Native Module) | ⏳ To-Do |
|
|
45
|
-
| iOS | Revenue Precision Constants (Turbo Native Module) |
|
|
45
|
+
| iOS | Revenue Precision Constants (Turbo Native Module) | ✅ Complete |
|
|
46
46
|
| Android | Mobile Ads SDK Methods (Turbo Native Module) | ⏳ To-Do |
|
|
47
47
|
| Android | Banners (Fabric Native Component) | ⏳ To-Do |
|
|
48
48
|
| Android | Full Screen Ads (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
|
|
|
@@ -21,7 +21,6 @@ import com.facebook.react.bridge.Promise;
|
|
|
21
21
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
22
22
|
import com.facebook.react.bridge.ReactMethod;
|
|
23
23
|
import com.facebook.react.bridge.ReadableMap;
|
|
24
|
-
import com.google.android.gms.ads.AdValue;
|
|
25
24
|
import io.invertase.googlemobileads.common.RCTConvert;
|
|
26
25
|
import io.invertase.googlemobileads.common.ReactNativeEvent;
|
|
27
26
|
import io.invertase.googlemobileads.common.ReactNativeEventEmitter;
|
|
@@ -29,8 +28,6 @@ import io.invertase.googlemobileads.common.ReactNativeJSON;
|
|
|
29
28
|
import io.invertase.googlemobileads.common.ReactNativeMeta;
|
|
30
29
|
import io.invertase.googlemobileads.common.ReactNativeModule;
|
|
31
30
|
import io.invertase.googlemobileads.common.ReactNativePreferences;
|
|
32
|
-
import java.util.HashMap;
|
|
33
|
-
import java.util.Map;
|
|
34
31
|
|
|
35
32
|
public class ReactNativeAppModule extends ReactNativeModule {
|
|
36
33
|
private static final String TAG = "RNAppModule";
|
|
@@ -150,29 +147,4 @@ public class ReactNativeAppModule extends ReactNativeModule {
|
|
|
150
147
|
ReactNativePreferences.getSharedInstance().clearAll();
|
|
151
148
|
promise.resolve(null);
|
|
152
149
|
}
|
|
153
|
-
|
|
154
|
-
@Override
|
|
155
|
-
public Map<String, Object> getConstants() {
|
|
156
|
-
Map<String, Object> constants = new HashMap<>();
|
|
157
|
-
// List<Map<String, Object>> appsList = new ArrayList<>();
|
|
158
|
-
// List<ReactNativeApp> reactNativeApps = ReactNativeApp.getApps(getReactApplicationContext());
|
|
159
|
-
|
|
160
|
-
// for (ReactNativeApp app : reactNativeApps) {
|
|
161
|
-
// appsList.add(RCTConvertFirebase.reactNativeAppToMap(app));
|
|
162
|
-
// }
|
|
163
|
-
|
|
164
|
-
// constants.put("NATIVE_FIREBASE_APPS", appsList);
|
|
165
|
-
|
|
166
|
-
// constants.put("FIREBASE_RAW_JSON", ReactNativeJSON.getSharedInstance().getRawJSON());
|
|
167
|
-
|
|
168
|
-
// Precision types in ad revenue events.
|
|
169
|
-
// See:
|
|
170
|
-
// https://developers.google.com/android/reference/com/google/android/gms/ads/AdValue.PrecisionType
|
|
171
|
-
constants.put("REVENUE_PRECISION_UNKNOWN", AdValue.PrecisionType.UNKNOWN);
|
|
172
|
-
constants.put("REVENUE_PRECISION_ESTIMATED", AdValue.PrecisionType.ESTIMATED);
|
|
173
|
-
constants.put("REVENUE_PRECISION_PUBLISHER_PROVIDED", AdValue.PrecisionType.PUBLISHER_PROVIDED);
|
|
174
|
-
constants.put("REVENUE_PRECISION_PRECISE", AdValue.PrecisionType.PRECISE);
|
|
175
|
-
|
|
176
|
-
return constants;
|
|
177
|
-
}
|
|
178
150
|
}
|
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt
CHANGED
|
@@ -23,6 +23,7 @@ import com.google.android.gms.ads.initialization.OnInitializationCompleteListene
|
|
|
23
23
|
import com.google.android.gms.ads.RequestConfiguration
|
|
24
24
|
import com.google.android.gms.ads.AdInspectorError
|
|
25
25
|
import com.google.android.gms.ads.AdRequest
|
|
26
|
+
import com.google.android.gms.ads.AdValue;
|
|
26
27
|
import com.google.android.gms.ads.OnAdInspectorClosedListener
|
|
27
28
|
|
|
28
29
|
private const val SERVICE = "RNGoogleMobileAdsModule";
|
|
@@ -33,6 +34,18 @@ class ReactNativeGoogleMobileAdsModule(
|
|
|
33
34
|
|
|
34
35
|
override fun getName() = SERVICE
|
|
35
36
|
|
|
37
|
+
override fun getConstants(): Map<String, Any> {
|
|
38
|
+
return mapOf(
|
|
39
|
+
// Precision types in ad revenue events.
|
|
40
|
+
// See:
|
|
41
|
+
// https://developers.google.com/android/reference/com/google/android/gms/ads/AdValue.PrecisionType
|
|
42
|
+
"REVENUE_PRECISION_UNKNOWN" to AdValue.PrecisionType.UNKNOWN,
|
|
43
|
+
"REVENUE_PRECISION_ESTIMATED" to AdValue.PrecisionType.ESTIMATED,
|
|
44
|
+
"REVENUE_PRECISION_PUBLISHER_PROVIDED" to AdValue.PrecisionType.PUBLISHER_PROVIDED,
|
|
45
|
+
"REVENUE_PRECISION_PRECISE" to AdValue.PrecisionType.PRECISE
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
private fun buildRequestConfiguration(
|
|
37
50
|
requestConfiguration: ReadableMap
|
|
38
51
|
): RequestConfiguration {
|
|
@@ -15,20 +15,22 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
@interface RNJSON : NSObject
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <NativeAppOpenModuleSpec>
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
#else
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
#import <React/RCTBridgeModule.h>
|
|
30
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <RCTBridgeModule>
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
#endif
|
|
33
33
|
|
|
34
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
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
4
3
|
*
|
|
@@ -16,10 +15,22 @@
|
|
|
16
15
|
*
|
|
17
16
|
*/
|
|
18
17
|
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
19
20
|
#import <Foundation/Foundation.h>
|
|
20
21
|
|
|
21
|
-
#
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsConsentModule : NSObject <NativeConsentModuleSpec>
|
|
26
|
+
|
|
27
|
+
#else
|
|
22
28
|
|
|
29
|
+
#import <React/RCTBridgeModule.h>
|
|
23
30
|
@interface RNGoogleMobileAdsConsentModule : NSObject <RCTBridgeModule>
|
|
24
31
|
|
|
32
|
+
#endif
|
|
33
|
+
|
|
25
34
|
@end
|
|
35
|
+
|
|
36
|
+
#endif
|
package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsConsentModule.m → RNGoogleMobileAdsConsentModule.mm}
RENAMED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
#if !TARGET_OS_MACCATALYST
|
|
23
23
|
#include <UserMessagingPlatform/UserMessagingPlatform.h>
|
|
24
24
|
#endif
|
|
25
|
-
#
|
|
25
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
26
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
27
|
+
#endif
|
|
26
28
|
#import "RNGoogleMobileAdsConsentModule.h"
|
|
27
29
|
#import "common/RNSharedUtils.h"
|
|
28
30
|
|
|
@@ -92,7 +94,8 @@ RCT_EXPORT_METHOD(requestInfoUpdate
|
|
|
92
94
|
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
|
93
95
|
UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
|
94
96
|
|
|
95
|
-
debugSettings.geography =
|
|
97
|
+
debugSettings.geography =
|
|
98
|
+
(UMPDebugGeography)([options[@"debugGeography"] integerValue] ?: UMPDebugGeographyDisabled);
|
|
96
99
|
debugSettings.testDeviceIdentifiers =
|
|
97
100
|
[options valueForKeyPath:@"testDeviceIdentifiers"] ?: [[NSMutableArray alloc] init];
|
|
98
101
|
|
|
@@ -117,6 +120,105 @@ RCT_EXPORT_METHOD(requestInfoUpdate
|
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
RCT_EXPORT_METHOD(showForm : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
123
|
+
[self showForm:resolve reject:reject];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
RCT_EXPORT_METHOD(showPrivacyOptionsForm
|
|
127
|
+
: (RCTPromiseResolveBlock)resolve
|
|
128
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
129
|
+
[self showPrivacyOptionsForm:resolve reject:reject];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
RCT_EXPORT_METHOD(loadAndShowConsentFormIfRequired
|
|
133
|
+
: (RCTPromiseResolveBlock)resolve
|
|
134
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
135
|
+
[self loadAndShowConsentFormIfRequired:resolve reject:reject];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
RCT_EXPORT_METHOD(reset) {
|
|
139
|
+
#if !TARGET_OS_MACCATALYST
|
|
140
|
+
[UMPConsentInformation.sharedInstance reset];
|
|
141
|
+
#endif
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
RCT_EXPORT_METHOD(getConsentInfo
|
|
145
|
+
: (RCTPromiseResolveBlock)resolve
|
|
146
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
147
|
+
[self getConsentInfo:resolve reject:reject];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
RCT_EXPORT_METHOD(getTCString : (RCTPromiseResolveBlock)resolve : (RCTPromiseRejectBlock)reject) {
|
|
151
|
+
[self getTCString:resolve reject:reject];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
RCT_EXPORT_METHOD(getGdprApplies
|
|
155
|
+
: (RCTPromiseResolveBlock)resolve
|
|
156
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
157
|
+
[self getGdprApplies:resolve reject:reject];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
RCT_EXPORT_METHOD(getPurposeConsents
|
|
161
|
+
: (RCTPromiseResolveBlock)resolve
|
|
162
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
163
|
+
[self getPurposeConsents:resolve reject:reject];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
RCT_EXPORT_METHOD(getPurposeLegitimateInterests
|
|
167
|
+
: (RCTPromiseResolveBlock)resolve
|
|
168
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
169
|
+
[self getPurposeLegitimateInterests:resolve reject:reject];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
173
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
174
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
175
|
+
return std::make_shared<facebook::react::NativeConsentModuleSpecJSI>(params);
|
|
176
|
+
}
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
180
|
+
- (void)requestInfoUpdate:(JS::NativeConsentModule::AdsConsentInfoOptions &)options
|
|
181
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
182
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
183
|
+
#if !TARGET_OS_MACCATALYST
|
|
184
|
+
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
|
|
185
|
+
UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
|
|
186
|
+
|
|
187
|
+
debugSettings.geography =
|
|
188
|
+
static_cast<UMPDebugGeography>(options.debugGeography().value_or(UMPDebugGeographyDisabled));
|
|
189
|
+
debugSettings.testDeviceIdentifiers = options.testDeviceIdentifiers().has_value()
|
|
190
|
+
? ^{
|
|
191
|
+
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
192
|
+
FB::LazyVector<NSString *, id> identifiers = options.testDeviceIdentifiers().value();
|
|
193
|
+
for (NSUInteger i = 0; i < identifiers.size(); i++) {
|
|
194
|
+
[array addObject:identifiers[i]]; // Direct access by index
|
|
195
|
+
}
|
|
196
|
+
return array;
|
|
197
|
+
}()
|
|
198
|
+
: [[NSMutableArray alloc] init];
|
|
199
|
+
|
|
200
|
+
parameters.debugSettings = debugSettings;
|
|
201
|
+
parameters.tagForUnderAgeOfConsent = options.tagForUnderAgeOfConsent().value_or(FALSE);
|
|
202
|
+
|
|
203
|
+
[UMPConsentInformation.sharedInstance
|
|
204
|
+
requestConsentInfoUpdateWithParameters:parameters
|
|
205
|
+
completionHandler:^(NSError *_Nullable error) {
|
|
206
|
+
if (error) {
|
|
207
|
+
[RNSharedUtils
|
|
208
|
+
rejectPromiseWithUserInfo:reject
|
|
209
|
+
userInfo:[@{
|
|
210
|
+
@"code" : @"consent-update-failed",
|
|
211
|
+
@"message" : error.localizedDescription,
|
|
212
|
+
} mutableCopy]];
|
|
213
|
+
} else {
|
|
214
|
+
resolve([self getConsentInformation]);
|
|
215
|
+
}
|
|
216
|
+
}];
|
|
217
|
+
#endif
|
|
218
|
+
}
|
|
219
|
+
#endif
|
|
220
|
+
|
|
221
|
+
- (void)showForm:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
120
222
|
#if !TARGET_OS_MACCATALYST
|
|
121
223
|
[UMPConsentForm loadWithCompletionHandler:^(UMPConsentForm *form, NSError *loadError) {
|
|
122
224
|
if (loadError) {
|
|
@@ -145,9 +247,8 @@ RCT_EXPORT_METHOD(showForm : (RCTPromiseResolveBlock)resolve : (RCTPromiseReject
|
|
|
145
247
|
#endif
|
|
146
248
|
}
|
|
147
249
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
250
|
+
- (void)showPrivacyOptionsForm:(RCTPromiseResolveBlock)resolve
|
|
251
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
151
252
|
#if !TARGET_OS_MACCATALYST
|
|
152
253
|
[UMPConsentForm
|
|
153
254
|
presentPrivacyOptionsFormFromViewController:[UIApplication sharedApplication]
|
|
@@ -168,9 +269,8 @@ RCT_EXPORT_METHOD(showPrivacyOptionsForm
|
|
|
168
269
|
#endif
|
|
169
270
|
}
|
|
170
271
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
272
|
+
- (void)loadAndShowConsentFormIfRequired:(RCTPromiseResolveBlock)resolve
|
|
273
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
174
274
|
#if !TARGET_OS_MACCATALYST
|
|
175
275
|
[UMPConsentForm
|
|
176
276
|
loadAndPresentIfRequiredFromViewController:[UIApplication sharedApplication]
|
|
@@ -191,19 +291,13 @@ RCT_EXPORT_METHOD(loadAndShowConsentFormIfRequired
|
|
|
191
291
|
#endif
|
|
192
292
|
}
|
|
193
293
|
|
|
194
|
-
|
|
294
|
+
- (void)getConsentInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
195
295
|
#if !TARGET_OS_MACCATALYST
|
|
196
|
-
[UMPConsentInformation.sharedInstance reset];
|
|
197
|
-
#endif
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
RCT_EXPORT_METHOD(getConsentInfo
|
|
201
|
-
: (RCTPromiseResolveBlock)resolve
|
|
202
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
203
296
|
resolve([self getConsentInformation]);
|
|
297
|
+
#endif
|
|
204
298
|
}
|
|
205
299
|
|
|
206
|
-
|
|
300
|
+
- (void)getTCString:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
207
301
|
@try {
|
|
208
302
|
// https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#in-app-details
|
|
209
303
|
NSString *tcString = [[NSUserDefaults standardUserDefaults] objectForKey:@"IABTCF_TCString"];
|
|
@@ -217,9 +311,7 @@ RCT_EXPORT_METHOD(getTCString : (RCTPromiseResolveBlock)resolve : (RCTPromiseRej
|
|
|
217
311
|
}
|
|
218
312
|
}
|
|
219
313
|
|
|
220
|
-
|
|
221
|
-
: (RCTPromiseResolveBlock)resolve
|
|
222
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
314
|
+
- (void)getGdprApplies:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
223
315
|
@try {
|
|
224
316
|
BOOL gdprApplies = [[NSUserDefaults standardUserDefaults] boolForKey:@"IABTCF_gdprApplies"];
|
|
225
317
|
resolve(@(gdprApplies));
|
|
@@ -232,9 +324,7 @@ RCT_EXPORT_METHOD(getGdprApplies
|
|
|
232
324
|
}
|
|
233
325
|
}
|
|
234
326
|
|
|
235
|
-
|
|
236
|
-
: (RCTPromiseResolveBlock)resolve
|
|
237
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
327
|
+
- (void)getPurposeConsents:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
238
328
|
@try {
|
|
239
329
|
NSString *purposeConsents =
|
|
240
330
|
[[NSUserDefaults standardUserDefaults] stringForKey:@"IABTCF_PurposeConsents"];
|
|
@@ -248,9 +338,8 @@ RCT_EXPORT_METHOD(getPurposeConsents
|
|
|
248
338
|
}
|
|
249
339
|
}
|
|
250
340
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
341
|
+
- (void)getPurposeLegitimateInterests:(RCTPromiseResolveBlock)resolve
|
|
342
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
254
343
|
@try {
|
|
255
344
|
NSString *purposeLegitimateInterests =
|
|
256
345
|
[[NSUserDefaults standardUserDefaults] stringForKey:@"IABTCF_PurposeLegitimateInterests"];
|
|
@@ -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
|