react-native-google-mobile-ads 15.8.3 → 16.0.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/__tests__/consent.test.ts +4 -4
- package/__tests__/googleMobileAds.test.ts +14 -14
- package/__tests__/interstitial.test.ts +14 -14
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +0 -12
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +3 -3
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +24 -24
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.mm +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.h +1 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm +2 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +5 -20
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +1 -1
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.h +1 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm +2 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +1 -2
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.mm +1 -2
- package/ios_config.sh +12 -12
- package/jest.setup.ts +10 -0
- package/lib/commonjs/AdEventType.js +40 -0
- package/lib/commonjs/AdEventType.js.map +1 -1
- package/lib/commonjs/AdsConsent.js +3 -2
- package/lib/commonjs/AdsConsent.js.map +1 -1
- package/lib/commonjs/AdsConsentPurposes.js +136 -0
- package/lib/commonjs/AdsConsentPurposes.js.map +1 -1
- package/lib/commonjs/AdsConsentSpecialFeatures.js +18 -0
- package/lib/commonjs/AdsConsentSpecialFeatures.js.map +1 -1
- package/lib/commonjs/BannerAdSize.js +28 -0
- package/lib/commonjs/BannerAdSize.js.map +1 -1
- package/lib/commonjs/GAMAdEventType.js +17 -0
- package/lib/commonjs/GAMAdEventType.js.map +1 -1
- package/lib/commonjs/MaxAdContentRating.js +12 -0
- package/lib/commonjs/MaxAdContentRating.js.map +1 -1
- package/lib/commonjs/MobileAds.js +2 -4
- package/lib/commonjs/MobileAds.js.map +1 -1
- package/lib/commonjs/NativeAdEventType.js +30 -0
- package/lib/commonjs/NativeAdEventType.js.map +1 -1
- package/lib/commonjs/RewardedAdEventType.js +38 -0
- package/lib/commonjs/RewardedAdEventType.js.map +1 -1
- package/lib/commonjs/TestIds.js.map +1 -1
- package/lib/commonjs/ads/AppOpenAd.js +1 -1
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
- package/lib/commonjs/ads/BannerAd.js +7 -4
- package/lib/commonjs/ads/BannerAd.js.map +1 -1
- package/lib/commonjs/ads/BaseAd.js +2 -2
- package/lib/commonjs/ads/BaseAd.js.map +1 -1
- package/lib/commonjs/ads/GAMBannerAd.js +7 -4
- package/lib/commonjs/ads/GAMBannerAd.js.map +1 -1
- package/lib/commonjs/ads/GAMInterstitialAd.js.map +1 -1
- package/lib/commonjs/ads/InterstitialAd.js +1 -1
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
- package/lib/commonjs/ads/MobileAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedAd.js +1 -1
- package/lib/commonjs/ads/RewardedAd.js.map +1 -1
- package/lib/commonjs/ads/RewardedInterstitialAd.js +1 -1
- package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAd.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAdContext.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAdView.js +14 -9
- package/lib/commonjs/ads/native-ad/NativeAdView.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAsset.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeMediaView.js +14 -10
- package/lib/commonjs/ads/native-ad/NativeMediaView.js.map +1 -1
- package/lib/commonjs/common/constants.js +7 -13
- package/lib/commonjs/common/constants.js.map +1 -1
- package/lib/commonjs/common/debounce.js.map +1 -1
- package/lib/commonjs/common/index.js.map +1 -1
- package/lib/commonjs/common/ref.js +6 -5
- package/lib/commonjs/common/ref.js.map +1 -1
- package/lib/commonjs/common/validate.js.map +1 -1
- package/lib/commonjs/declarations.d.js.map +1 -1
- package/lib/commonjs/hooks/useAppOpenAd.js.map +1 -1
- package/lib/commonjs/hooks/useForeground.js.map +1 -1
- package/lib/commonjs/hooks/useFullScreenAd.js +14 -12
- package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -1
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -1
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -1
- package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +4 -37
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
- package/lib/commonjs/internal/NativeError.js.map +1 -1
- package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/{module/specs/components/GoogleMobileAdsMediaViewNativeComponent.js → commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts} +12 -2
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeConsentModule.js +36 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeInterstitialModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeRewardedInterstitialModule.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeRewardedModule.js.map +1 -1
- package/lib/commonjs/types/AdEventListener.js.map +1 -1
- package/lib/commonjs/types/AdEventsListener.js.map +1 -1
- package/lib/commonjs/types/AdShowOptions.js.map +1 -1
- package/lib/commonjs/types/AdStates.js.map +1 -1
- package/lib/commonjs/types/AdapterStatus.js +6 -0
- package/lib/commonjs/types/AdapterStatus.js.map +1 -1
- package/lib/commonjs/types/AppEvent.js.map +1 -1
- package/lib/commonjs/types/BannerAdProps.js.map +1 -1
- package/lib/commonjs/types/MobileAd.interface.js.map +1 -1
- package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -1
- package/lib/commonjs/types/NativeAdRequestOptions.js.map +1 -1
- package/lib/commonjs/types/PaidEventListener.js.map +1 -1
- package/lib/commonjs/types/RequestConfiguration.js.map +1 -1
- package/lib/commonjs/types/RequestOptions.js.map +1 -1
- package/lib/commonjs/types/RewardedAdReward.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/validateAdRequestConfiguration.js +2 -2
- package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -1
- package/lib/commonjs/validateAdRequestOptions.js.map +1 -1
- package/lib/commonjs/validateAdShowOptions.js.map +1 -1
- package/lib/commonjs/validateNativeAdRequestOptions.js +3 -3
- package/lib/commonjs/validateNativeAdRequestOptions.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/AdEventType.js +42 -0
- package/lib/module/AdEventType.js.map +1 -1
- package/lib/module/AdsConsent.js +5 -2
- package/lib/module/AdsConsent.js.map +1 -1
- package/lib/module/AdsConsentPurposes.js +138 -0
- package/lib/module/AdsConsentPurposes.js.map +1 -1
- package/lib/module/AdsConsentSpecialFeatures.js +20 -0
- package/lib/module/AdsConsentSpecialFeatures.js.map +1 -1
- package/lib/module/BannerAdSize.js +30 -0
- package/lib/module/BannerAdSize.js.map +1 -1
- package/lib/module/GAMAdEventType.js +19 -0
- package/lib/module/GAMAdEventType.js.map +1 -1
- package/lib/module/MaxAdContentRating.js +14 -0
- package/lib/module/MaxAdContentRating.js.map +1 -1
- package/lib/module/MobileAds.js +4 -4
- package/lib/module/MobileAds.js.map +1 -1
- package/lib/module/NativeAdEventType.js +32 -0
- package/lib/module/NativeAdEventType.js.map +1 -1
- package/lib/module/RewardedAdEventType.js +40 -0
- package/lib/module/RewardedAdEventType.js.map +1 -1
- package/lib/module/TestIds.js +2 -0
- package/lib/module/TestIds.js.map +1 -1
- package/lib/module/ads/AppOpenAd.js +3 -1
- package/lib/module/ads/AppOpenAd.js.map +1 -1
- package/lib/module/ads/BannerAd.js +7 -4
- package/lib/module/ads/BannerAd.js.map +1 -1
- package/lib/module/ads/BaseAd.js +4 -2
- package/lib/module/ads/BaseAd.js.map +1 -1
- package/lib/module/ads/GAMBannerAd.js +7 -4
- package/lib/module/ads/GAMBannerAd.js.map +1 -1
- package/lib/module/ads/GAMInterstitialAd.js +2 -0
- package/lib/module/ads/GAMInterstitialAd.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 +2 -0
- 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/ads/native-ad/NativeAd.js +2 -0
- package/lib/module/ads/native-ad/NativeAd.js.map +1 -1
- package/lib/module/ads/native-ad/NativeAdContext.js +2 -0
- package/lib/module/ads/native-ad/NativeAdContext.js.map +1 -1
- package/lib/module/ads/native-ad/NativeAdView.js +14 -9
- package/lib/module/ads/native-ad/NativeAdView.js.map +1 -1
- package/lib/module/ads/native-ad/NativeAsset.js +2 -0
- package/lib/module/ads/native-ad/NativeAsset.js.map +1 -1
- package/lib/module/ads/native-ad/NativeMediaView.js +14 -10
- package/lib/module/ads/native-ad/NativeMediaView.js.map +1 -1
- package/lib/module/common/constants.js +9 -12
- package/lib/module/common/constants.js.map +1 -1
- package/lib/module/common/debounce.js +2 -0
- package/lib/module/common/debounce.js.map +1 -1
- package/lib/module/common/index.js +2 -0
- package/lib/module/common/index.js.map +1 -1
- package/lib/module/common/ref.js +8 -5
- package/lib/module/common/ref.js.map +1 -1
- package/lib/module/common/validate.js +2 -0
- package/lib/module/common/validate.js.map +1 -1
- package/lib/module/declarations.d.js +1 -1
- package/lib/module/declarations.d.js.map +1 -1
- package/lib/module/hooks/useAppOpenAd.js +2 -0
- package/lib/module/hooks/useAppOpenAd.js.map +1 -1
- package/lib/module/hooks/useForeground.js +2 -0
- package/lib/module/hooks/useForeground.js.map +1 -1
- package/lib/module/hooks/useFullScreenAd.js +16 -12
- package/lib/module/hooks/useFullScreenAd.js.map +1 -1
- package/lib/module/hooks/useInterstitialAd.js +2 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -1
- package/lib/module/hooks/useRewardedAd.js +2 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -1
- package/lib/module/hooks/useRewardedInterstitialAd.js +2 -0
- package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +6 -37
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
- package/lib/module/internal/NativeError.js +2 -0
- package/lib/module/internal/NativeError.js.map +1 -1
- package/lib/module/internal/SharedEventEmitter.js +2 -0
- package/lib/module/internal/SharedEventEmitter.js.map +1 -1
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/module/specs/components/{GoogleMobileAdsNativeViewNativeComponent.js → GoogleMobileAdsMediaViewNativeComponent.ts} +12 -6
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js +2 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js.map +1 -1
- package/lib/module/specs/modules/NativeConsentModule.js +38 -0
- package/lib/module/specs/modules/NativeConsentModule.js.map +1 -1
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js +2 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -1
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js +2 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -1
- package/lib/module/specs/modules/NativeInterstitialModule.js +2 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js.map +1 -1
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js +2 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js.map +1 -1
- package/lib/module/specs/modules/NativeRewardedModule.js +2 -0
- package/lib/module/specs/modules/NativeRewardedModule.js.map +1 -1
- package/lib/module/types/AdEventListener.js +2 -0
- package/lib/module/types/AdEventListener.js.map +1 -1
- package/lib/module/types/AdEventsListener.js +2 -0
- package/lib/module/types/AdEventsListener.js.map +1 -1
- package/lib/module/types/AdShowOptions.js +1 -1
- package/lib/module/types/AdShowOptions.js.map +1 -1
- package/lib/module/types/AdStates.js +2 -0
- package/lib/module/types/AdStates.js.map +1 -1
- package/lib/module/types/AdapterStatus.js +8 -0
- package/lib/module/types/AdapterStatus.js.map +1 -1
- package/lib/module/types/AppEvent.js +1 -1
- package/lib/module/types/AppEvent.js.map +1 -1
- package/lib/module/types/BannerAdProps.js +2 -0
- package/lib/module/types/BannerAdProps.js.map +1 -1
- package/lib/module/types/MobileAd.interface.js +2 -0
- package/lib/module/types/MobileAd.interface.js.map +1 -1
- package/lib/module/types/MobileAdsModule.interface.js +2 -0
- package/lib/module/types/MobileAdsModule.interface.js.map +1 -1
- package/lib/module/types/NativeAdRequestOptions.js +2 -0
- package/lib/module/types/NativeAdRequestOptions.js.map +1 -1
- package/lib/module/types/PaidEventListener.js +2 -0
- package/lib/module/types/PaidEventListener.js.map +1 -1
- package/lib/module/types/RequestConfiguration.js +2 -0
- package/lib/module/types/RequestConfiguration.js.map +1 -1
- package/lib/module/types/RequestOptions.js +1 -1
- package/lib/module/types/RequestOptions.js.map +1 -1
- package/lib/module/types/RewardedAdReward.js +1 -1
- package/lib/module/types/RewardedAdReward.js.map +1 -1
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/validateAdRequestConfiguration.js +4 -2
- package/lib/module/validateAdRequestConfiguration.js.map +1 -1
- package/lib/module/validateAdRequestOptions.js +2 -0
- package/lib/module/validateAdRequestOptions.js.map +1 -1
- package/lib/module/validateAdShowOptions.js +2 -0
- package/lib/module/validateAdShowOptions.js.map +1 -1
- package/lib/module/validateNativeAdRequestOptions.js +5 -3
- package/lib/module/validateNativeAdRequestOptions.js.map +1 -1
- package/lib/module/version.js +3 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/AdsConsent.d.ts.map +1 -1
- package/lib/typescript/MobileAds.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/native-ad/NativeAdContext.d.ts +1 -1
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts.map +1 -1
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts.map +1 -1
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts +1 -1
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts.map +1 -1
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts.map +1 -1
- package/lib/typescript/common/constants.d.ts +4 -4
- package/lib/typescript/common/constants.d.ts.map +1 -1
- package/lib/typescript/common/debounce.d.ts +1 -1
- package/lib/typescript/common/debounce.d.ts.map +1 -1
- package/lib/typescript/common/ref.d.ts.map +1 -1
- package/lib/typescript/hooks/useFullScreenAd.d.ts +1 -1
- package/lib/typescript/hooks/useFullScreenAd.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +2 -3
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts.map +1 -1
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +0 -6
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -1
- package/lib/typescript/types/AdEventListener.d.ts.map +1 -1
- package/lib/typescript/validateAdRequestConfiguration.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +40 -51
- package/plugin/__tests__/__snapshots__/plugin.test.ts.snap +79 -175
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/src/AdsConsent.ts +4 -7
- package/src/MobileAds.ts +2 -4
- package/src/ads/AppOpenAd.ts +2 -2
- package/src/ads/BannerAd.tsx +1 -1
- package/src/ads/BaseAd.tsx +1 -2
- package/src/ads/GAMBannerAd.tsx +1 -1
- package/src/ads/InterstitialAd.ts +2 -2
- package/src/ads/RewardedAd.ts +2 -2
- package/src/ads/RewardedInterstitialAd.ts +2 -2
- package/src/ads/native-ad/NativeAdContext.ts +1 -1
- package/src/ads/native-ad/NativeAdView.tsx +1 -1
- package/src/common/constants.ts +7 -13
- package/src/common/debounce.ts +2 -2
- package/src/common/ref.ts +7 -5
- package/src/hooks/useFullScreenAd.ts +19 -17
- package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +11 -36
- package/src/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +2 -0
- package/src/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +1 -0
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +0 -7
- package/src/types/AdEventListener.ts +4 -4
- package/src/validateAdRequestConfiguration.ts +2 -7
- package/src/version.ts +1 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js +0 -33
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.js +0 -26
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.js +0 -31
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.js.map +0 -1
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js +0 -26
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +0 -1
- package/lib/module/specs/components/GoogleMobileAdsMediaViewNativeComponent.js.map +0 -1
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.js.map +0 -1
|
@@ -4,28 +4,28 @@ describe('Google Mobile Ads AdsConsent', function () {
|
|
|
4
4
|
describe('requestInfoUpdate', function () {
|
|
5
5
|
it('throws if options are not an object', function () {
|
|
6
6
|
// @ts-ignore
|
|
7
|
-
expect(() => AdsConsent.requestInfoUpdate('123')).
|
|
7
|
+
expect(() => AdsConsent.requestInfoUpdate('123')).toThrow(
|
|
8
8
|
"AdsConsent.requestInfoUpdate(*) 'options' expected an object value.",
|
|
9
9
|
);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it('throws if options.debugGeography is not a valid value.', function () {
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
expect(() => AdsConsent.requestInfoUpdate({ debugGeography: -1 })).
|
|
14
|
+
expect(() => AdsConsent.requestInfoUpdate({ debugGeography: -1 })).toThrow(
|
|
15
15
|
"AdsConsent.requestInfoUpdate(*) 'options.debugGeography' expected one of AdsConsentDebugGeography.DISABLED, AdsConsentDebugGeography.EEA, AdsConsentDebugGeography.NOT_EEA, AdsConsentDebugGeography.REGULATED_US_STATE or AdsConsentDebugGeography.OTHER.",
|
|
16
16
|
);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it('throws if options.tagForUnderAgeOfConsent is not a boolean.', function () {
|
|
20
20
|
// @ts-ignore
|
|
21
|
-
expect(() => AdsConsent.requestInfoUpdate({ tagForUnderAgeOfConsent: '123' })).
|
|
21
|
+
expect(() => AdsConsent.requestInfoUpdate({ tagForUnderAgeOfConsent: '123' })).toThrow(
|
|
22
22
|
"AdsConsent.requestInfoUpdate(*) 'options.tagForUnderAgeOfConsent' expected a boolean value.",
|
|
23
23
|
);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('throws if options.testDeviceIdentifiers is not an array', function () {
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
expect(() => AdsConsent.requestInfoUpdate({ testDeviceIdentifiers: '123' })).
|
|
28
|
+
expect(() => AdsConsent.requestInfoUpdate({ testDeviceIdentifiers: '123' })).toThrow(
|
|
29
29
|
"AdsConsent.requestInfoUpdate(*) 'options.testDeviceIdentifiers' expected an array of string values.",
|
|
30
30
|
);
|
|
31
31
|
});
|
|
@@ -5,7 +5,7 @@ describe('Admob', function () {
|
|
|
5
5
|
describe('setRequestConfiguration()', function () {
|
|
6
6
|
it('throws if config is not an object', function () {
|
|
7
7
|
// @ts-ignore
|
|
8
|
-
expect(() => admob().setRequestConfiguration('123')).
|
|
8
|
+
expect(() => admob().setRequestConfiguration('123')).toThrow(
|
|
9
9
|
"setRequestConfiguration(*) 'requestConfiguration' expected an object value",
|
|
10
10
|
);
|
|
11
11
|
});
|
|
@@ -16,8 +16,8 @@ describe('Admob', function () {
|
|
|
16
16
|
admob().setRequestConfiguration({
|
|
17
17
|
maxAdContentRating: 'Y' as MaxAdContentRating,
|
|
18
18
|
}),
|
|
19
|
-
).
|
|
20
|
-
"setRequestConfiguration(*) 'requestConfiguration.maxAdContentRating' expected
|
|
19
|
+
).toThrow(
|
|
20
|
+
"setRequestConfiguration(*) 'requestConfiguration.maxAdContentRating' expected one of G, PG, T, MA",
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -29,7 +29,7 @@ describe('Admob', function () {
|
|
|
29
29
|
// @ts-ignore
|
|
30
30
|
tagForChildDirectedTreatment: 'true',
|
|
31
31
|
}),
|
|
32
|
-
).
|
|
32
|
+
).toThrow(
|
|
33
33
|
"setRequestConfiguration(*) 'requestConfiguration.tagForChildDirectedTreatment' expected a boolean value",
|
|
34
34
|
);
|
|
35
35
|
});
|
|
@@ -42,7 +42,7 @@ describe('Admob', function () {
|
|
|
42
42
|
// @ts-ignore
|
|
43
43
|
tagForUnderAgeOfConsent: 'false',
|
|
44
44
|
}),
|
|
45
|
-
).
|
|
45
|
+
).toThrow(
|
|
46
46
|
"setRequestConfiguration(*) 'requestConfiguration.tagForUnderAgeOfConsent' expected a boolean value",
|
|
47
47
|
);
|
|
48
48
|
});
|
|
@@ -55,7 +55,7 @@ describe('Admob', function () {
|
|
|
55
55
|
// @ts-ignore
|
|
56
56
|
testDeviceIdentifiers: 'EMULATOR',
|
|
57
57
|
}),
|
|
58
|
-
).
|
|
58
|
+
).toThrow(
|
|
59
59
|
"setRequestConfiguration(*) 'requestConfiguration.testDeviceIdentifiers' expected an array value",
|
|
60
60
|
);
|
|
61
61
|
});
|
|
@@ -64,44 +64,44 @@ describe('Admob', function () {
|
|
|
64
64
|
describe('testDebugMenu', function () {
|
|
65
65
|
it('does call native initialize method', () => {
|
|
66
66
|
admob().initialize();
|
|
67
|
-
expect(RNGoogleMobileAdsModule.initialize).
|
|
67
|
+
expect(RNGoogleMobileAdsModule.initialize).toHaveBeenCalledTimes(1);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it('does call native setRequestConfiguration method', () => {
|
|
71
71
|
admob().setRequestConfiguration({ tagForChildDirectedTreatment: true });
|
|
72
|
-
expect(RNGoogleMobileAdsModule.setRequestConfiguration).
|
|
72
|
+
expect(RNGoogleMobileAdsModule.setRequestConfiguration).toHaveBeenCalledTimes(1);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it('does call native openAdInspector method', () => {
|
|
76
76
|
admob().openAdInspector();
|
|
77
|
-
expect(RNGoogleMobileAdsModule.openAdInspector).
|
|
77
|
+
expect(RNGoogleMobileAdsModule.openAdInspector).toHaveBeenCalledTimes(1);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('does call native openDebugMenu method', () => {
|
|
81
81
|
admob().openDebugMenu('12345');
|
|
82
|
-
expect(RNGoogleMobileAdsModule.openDebugMenu).
|
|
82
|
+
expect(RNGoogleMobileAdsModule.openDebugMenu).toHaveBeenCalledTimes(1);
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
it('throws if adUnit is empty', function () {
|
|
86
86
|
expect(() => {
|
|
87
87
|
admob().openDebugMenu('');
|
|
88
|
-
}).
|
|
88
|
+
}).toThrow('openDebugMenu expected a non-empty string value');
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
it('does call native setAppVolume method', () => {
|
|
92
92
|
admob().setAppVolume(0.5);
|
|
93
|
-
expect(RNGoogleMobileAdsModule.setAppVolume).
|
|
93
|
+
expect(RNGoogleMobileAdsModule.setAppVolume).toHaveBeenCalledTimes(1);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
it('throws if setAppVolume is greater than 1', function () {
|
|
97
97
|
expect(() => {
|
|
98
98
|
admob().setAppVolume(2);
|
|
99
|
-
}).
|
|
99
|
+
}).toThrow('The app volume must be a value between 0 and 1 inclusive.');
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
it('does call native setAppMuted method', () => {
|
|
103
103
|
admob().setAppMuted(true);
|
|
104
|
-
expect(RNGoogleMobileAdsModule.setAppMuted).
|
|
104
|
+
expect(RNGoogleMobileAdsModule.setAppMuted).toHaveBeenCalledTimes(1);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
});
|
|
@@ -5,14 +5,14 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
5
5
|
describe('createForAdRequest', function () {
|
|
6
6
|
it('throws if adUnitId is invalid', function () {
|
|
7
7
|
// @ts-ignore
|
|
8
|
-
expect(() => InterstitialAd.createForAdRequest(123)).
|
|
8
|
+
expect(() => InterstitialAd.createForAdRequest(123)).toThrow(
|
|
9
9
|
"'adUnitId' expected an string value",
|
|
10
10
|
);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it('throws if requestOptions are invalid', function () {
|
|
14
14
|
// @ts-ignore
|
|
15
|
-
expect(() => InterstitialAd.createForAdRequest('123', 123)).
|
|
15
|
+
expect(() => InterstitialAd.createForAdRequest('123', 123)).toThrow(
|
|
16
16
|
"InterstitialAd.createForAdRequest(_, *) 'options' expected an object value.",
|
|
17
17
|
);
|
|
18
18
|
});
|
|
@@ -34,17 +34,17 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
34
34
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
35
35
|
|
|
36
36
|
ad.load();
|
|
37
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
37
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(1);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('does nothing if ad currently loading', () => {
|
|
41
41
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
42
42
|
|
|
43
43
|
ad.load();
|
|
44
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
44
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(1);
|
|
45
45
|
|
|
46
46
|
ad.load();
|
|
47
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
47
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(1);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('does nothing if ad is already loaded', () => {
|
|
@@ -54,33 +54,33 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
54
54
|
ad._handleAdEvent({ body: { type: AdEventType.LOADED } });
|
|
55
55
|
|
|
56
56
|
ad.load();
|
|
57
|
-
expect(NativeInterstitialModule.interstitialLoad).not.
|
|
57
|
+
expect(NativeInterstitialModule.interstitialLoad).not.toHaveBeenCalled();
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('can be called again after ad was closed', () => {
|
|
61
61
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
62
62
|
|
|
63
63
|
ad.load();
|
|
64
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
64
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(1);
|
|
65
65
|
|
|
66
66
|
// @ts-ignore
|
|
67
67
|
ad._handleAdEvent({ body: { type: AdEventType.CLOSED } });
|
|
68
68
|
|
|
69
69
|
ad.load();
|
|
70
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
70
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(2);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it('can be called again after ad failed to load', () => {
|
|
74
74
|
const ad = InterstitialAd.createForAdRequest('abc');
|
|
75
75
|
|
|
76
76
|
ad.load();
|
|
77
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
77
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(1);
|
|
78
78
|
|
|
79
79
|
// @ts-ignore
|
|
80
80
|
ad._handleAdEvent({ body: { type: AdEventType.ERROR } });
|
|
81
81
|
|
|
82
82
|
ad.load();
|
|
83
|
-
expect(NativeInterstitialModule.interstitialLoad).
|
|
83
|
+
expect(NativeInterstitialModule.interstitialLoad).toHaveBeenCalledTimes(2);
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -88,7 +88,7 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
88
88
|
it('throws if showing before loaded', function () {
|
|
89
89
|
const i = InterstitialAd.createForAdRequest('abc');
|
|
90
90
|
|
|
91
|
-
expect(() => i.show()).
|
|
91
|
+
expect(() => i.show()).toThrow(
|
|
92
92
|
'The requested InterstitialAd has not loaded and could not be shown',
|
|
93
93
|
);
|
|
94
94
|
});
|
|
@@ -99,7 +99,7 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
99
99
|
const i = InterstitialAd.createForAdRequest('abc');
|
|
100
100
|
|
|
101
101
|
// @ts-ignore
|
|
102
|
-
expect(() => i.addAdEventsListener('foo')).
|
|
102
|
+
expect(() => i.addAdEventsListener('foo')).toThrow("'listener' expected a function");
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
it('returns an unsubscriber function', function () {
|
|
@@ -115,7 +115,7 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
115
115
|
const i = InterstitialAd.createForAdRequest('abc');
|
|
116
116
|
|
|
117
117
|
// @ts-ignore
|
|
118
|
-
expect(() => i.addAdEventListener('foo')).
|
|
118
|
+
expect(() => i.addAdEventListener('foo')).toThrow(
|
|
119
119
|
"'type' expected a valid event type value.",
|
|
120
120
|
);
|
|
121
121
|
});
|
|
@@ -124,7 +124,7 @@ describe('Google Mobile Ads Interstitial', function () {
|
|
|
124
124
|
const i = InterstitialAd.createForAdRequest('abc');
|
|
125
125
|
|
|
126
126
|
// @ts-ignore
|
|
127
|
-
expect(() => i.addAdEventListener(AdEventType.LOADED, 'foo')).
|
|
127
|
+
expect(() => i.addAdEventListener(AdEventType.LOADED, 'foo')).toThrow(
|
|
128
128
|
"'listener' expected a function",
|
|
129
129
|
);
|
|
130
130
|
});
|
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt
CHANGED
|
@@ -32,18 +32,6 @@ class ReactNativeGoogleMobileAdsModule(
|
|
|
32
32
|
|
|
33
33
|
override fun getName() = NAME
|
|
34
34
|
|
|
35
|
-
override fun getConstants(): Map<String, Any> {
|
|
36
|
-
return mapOf(
|
|
37
|
-
// Precision types in ad revenue events.
|
|
38
|
-
// See:
|
|
39
|
-
// https://developers.google.com/android/reference/com/google/android/gms/ads/AdValue.PrecisionType
|
|
40
|
-
"REVENUE_PRECISION_UNKNOWN" to AdValue.PrecisionType.UNKNOWN,
|
|
41
|
-
"REVENUE_PRECISION_ESTIMATED" to AdValue.PrecisionType.ESTIMATED,
|
|
42
|
-
"REVENUE_PRECISION_PUBLISHER_PROVIDED" to AdValue.PrecisionType.PUBLISHER_PROVIDED,
|
|
43
|
-
"REVENUE_PRECISION_PRECISE" to AdValue.PrecisionType.PRECISE
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
35
|
private fun buildRequestConfiguration(
|
|
48
36
|
requestConfiguration: ReadableMap
|
|
49
37
|
): RequestConfiguration {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
@property(nonatomic, copy) NSDictionary *sizeConfig;
|
|
31
31
|
@property(nonatomic, copy) NSString *unitId;
|
|
32
32
|
@property(nonatomic, copy) NSDictionary *request;
|
|
33
|
-
@property(nonatomic,
|
|
33
|
+
@property(nonatomic, assign) BOOL manualImpressionsEnabled;
|
|
34
34
|
@property(nonatomic, assign) BOOL propsChanged;
|
|
35
35
|
|
|
36
36
|
@property(nonatomic, copy) RCTBubblingEventBlock onNativeEvent;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
((GAMBannerView *)_banner).validAdSizes = _sizeConfig[@"sizes"];
|
|
53
53
|
((GAMBannerView *)_banner).appEventDelegate = self;
|
|
54
|
-
((GAMBannerView *)_banner).enableManualImpressions =
|
|
54
|
+
((GAMBannerView *)_banner).enableManualImpressions = _manualImpressionsEnabled;
|
|
55
55
|
} else {
|
|
56
56
|
_banner = [[GADBannerView alloc] initWithAdSize:adSize];
|
|
57
57
|
}
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
_propsChanged = true;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
- (void)setManualImpressionsEnabled:(BOOL
|
|
101
|
-
_manualImpressionsEnabled =
|
|
100
|
+
- (void)setManualImpressionsEnabled:(BOOL)manualImpressionsEnabled {
|
|
101
|
+
_manualImpressionsEnabled = manualImpressionsEnabled;
|
|
102
102
|
_propsChanged = true;
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -23,50 +23,50 @@
|
|
|
23
23
|
|
|
24
24
|
@interface RNGoogleMobileAdsCommon : NSObject
|
|
25
25
|
|
|
26
|
-
+ (GAMRequest *)buildAdRequest:(NSDictionary *)adRequestOptions;
|
|
26
|
+
+ (GAMRequest *_Nonnull)buildAdRequest:(NSDictionary *_Nonnull)adRequestOptions;
|
|
27
27
|
|
|
28
|
-
+ (NSDictionary *)getCodeAndMessageFromAdError:(NSError *)error;
|
|
28
|
+
+ (NSDictionary *_Nonnull)getCodeAndMessageFromAdError:(NSError *_Nonnull)error;
|
|
29
29
|
|
|
30
|
-
+ (void)sendAdEvent:(NSString *)event
|
|
31
|
-
requestId:(NSNumber *)requestId
|
|
32
|
-
type:(NSString *)type
|
|
33
|
-
adUnitId:(NSString *)adUnitId
|
|
30
|
+
+ (void)sendAdEvent:(NSString *_Nonnull)event
|
|
31
|
+
requestId:(NSNumber *_Nonnull)requestId
|
|
32
|
+
type:(NSString *_Nonnull)type
|
|
33
|
+
adUnitId:(NSString *_Nonnull)adUnitId
|
|
34
34
|
error:(nullable NSDictionary *)error
|
|
35
35
|
data:(nullable NSDictionary *)data;
|
|
36
36
|
|
|
37
|
-
+ (GADAdSize)stringToAdSize:(NSString *)value
|
|
37
|
+
+ (GADAdSize)stringToAdSize:(NSString *_Nonnull)value
|
|
38
38
|
withMaxHeight:(CGFloat)maxHeight
|
|
39
39
|
andWidth:(CGFloat)adWidth;
|
|
40
40
|
|
|
41
|
-
+ (BOOL)isAdManagerUnit:(NSString *)unitId;
|
|
41
|
+
+ (BOOL)isAdManagerUnit:(NSString *_Nonnull)unitId;
|
|
42
42
|
|
|
43
43
|
+ (nullable UIViewController *)currentViewController;
|
|
44
44
|
|
|
45
45
|
@end
|
|
46
46
|
|
|
47
47
|
@interface RNGADInterstitial : GADInterstitialAd
|
|
48
|
-
@property(nonatomic) NSNumber *requestId;
|
|
49
|
-
- (void)setRequestId:(NSNumber *)requestId;
|
|
48
|
+
@property(nonatomic) NSNumber *_Nonnull requestId;
|
|
49
|
+
- (void)setRequestId:(NSNumber *_Nonnull)requestId;
|
|
50
50
|
@end
|
|
51
51
|
|
|
52
52
|
@interface RNGADRewarded : GADRewardedAd
|
|
53
|
-
@property(nonatomic) NSNumber *requestId;
|
|
54
|
-
- (void)setRequestId:(NSNumber *)requestId;
|
|
53
|
+
@property(nonatomic) NSNumber *_Nonnull requestId;
|
|
54
|
+
- (void)setRequestId:(NSNumber *_Nonnull)requestId;
|
|
55
55
|
@end
|
|
56
56
|
|
|
57
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_APP_OPEN;
|
|
58
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_INTERSTITIAL;
|
|
59
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED;
|
|
60
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_INTERSTITIAL;
|
|
57
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_APP_OPEN;
|
|
58
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_INTERSTITIAL;
|
|
59
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_REWARDED;
|
|
60
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_REWARDED_INTERSTITIAL;
|
|
61
61
|
|
|
62
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_LOADED;
|
|
63
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_ERROR;
|
|
64
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_OPENED;
|
|
65
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_CLICKED;
|
|
66
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_CLOSED;
|
|
67
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_APP_EVENT;
|
|
62
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_LOADED;
|
|
63
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_ERROR;
|
|
64
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_OPENED;
|
|
65
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_CLICKED;
|
|
66
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_CLOSED;
|
|
67
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_APP_EVENT;
|
|
68
68
|
|
|
69
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED;
|
|
70
|
-
extern NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD;
|
|
69
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED;
|
|
70
|
+
extern NSString *_Nonnull const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD;
|
|
71
71
|
|
|
72
72
|
#endif
|
|
@@ -190,7 +190,7 @@ RCT_EXPORT_METHOD(getPurposeLegitimateInterests
|
|
|
190
190
|
? ^{
|
|
191
191
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
|
192
192
|
FB::LazyVector<NSString *, id> identifiers = options.testDeviceIdentifiers().value();
|
|
193
|
-
for (
|
|
193
|
+
for (int i = 0; i < identifiers.size(); i++) {
|
|
194
194
|
[array addObject:identifiers[i]]; // Direct access by index
|
|
195
195
|
}
|
|
196
196
|
return array;
|
|
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
30
30
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
31
31
|
@interface RNGoogleMobileAdsMediaView : RCTViewComponentView
|
|
32
32
|
|
|
33
|
+
// this setters/getters here are provided by RCTViewComponentView super, we just narrow the type.
|
|
33
34
|
@property(nonatomic, strong, nullable) GADMediaView *contentView;
|
|
34
35
|
#else
|
|
35
36
|
@interface RNGoogleMobileAdsMediaView : GADMediaView
|
|
@@ -48,6 +48,8 @@ using namespace facebook::react;
|
|
|
48
48
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
49
49
|
#pragma mark - Fabric specific
|
|
50
50
|
|
|
51
|
+
@dynamic contentView; // provided by superclass, but we narrow the type in our declaration
|
|
52
|
+
|
|
51
53
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
52
54
|
if (self = [super initWithFrame:frame]) {
|
|
53
55
|
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsBannerViewProps>();
|
|
@@ -71,13 +71,13 @@ RCT_EXPORT_METHOD(openDebugMenu : (NSString *)adUnit) {
|
|
|
71
71
|
#endif
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
RCT_EXPORT_METHOD(setAppVolume : (
|
|
74
|
+
RCT_EXPORT_METHOD(setAppVolume : (double)volume) {
|
|
75
75
|
#if !TARGET_OS_MACCATALYST
|
|
76
76
|
GADMobileAds.sharedInstance.applicationVolume = volume;
|
|
77
77
|
#endif
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
RCT_EXPORT_METHOD(setAppMuted : (BOOL
|
|
80
|
+
RCT_EXPORT_METHOD(setAppMuted : (BOOL)muted) {
|
|
81
81
|
#if !TARGET_OS_MACCATALYST
|
|
82
82
|
GADMobileAds.sharedInstance.applicationMuted = muted;
|
|
83
83
|
#endif
|
|
@@ -165,7 +165,9 @@ RCT_EXPORT_METHOD(setAppMuted : (BOOL *)muted) {
|
|
|
165
165
|
rejectPromiseWithUserInfo:reject
|
|
166
166
|
userInfo:[@{
|
|
167
167
|
@"code" : [NSString
|
|
168
|
-
stringWithFormat:@"CODE_%
|
|
168
|
+
stringWithFormat:@"CODE_%ld",
|
|
169
|
+
static_cast<long>(
|
|
170
|
+
error.code)],
|
|
169
171
|
@"message" : error.description,
|
|
170
172
|
} mutableCopy]];
|
|
171
173
|
} else {
|
|
@@ -175,21 +177,4 @@ RCT_EXPORT_METHOD(setAppMuted : (BOOL *)muted) {
|
|
|
175
177
|
#endif
|
|
176
178
|
}
|
|
177
179
|
|
|
178
|
-
- (NSDictionary *)constantsToExport {
|
|
179
|
-
return @{
|
|
180
|
-
// Precision types in ad revenue events.
|
|
181
|
-
// See: https://developers.google.com/admob/ios/impression-level-ad-revenue#objective-c
|
|
182
|
-
#if !TARGET_OS_MACCATALYST
|
|
183
|
-
@"REVENUE_PRECISION_UNKNOWN" : @(GADAdValuePrecisionUnknown),
|
|
184
|
-
@"REVENUE_PRECISION_ESTIMATED" : @(GADAdValuePrecisionEstimated),
|
|
185
|
-
@"REVENUE_PRECISION_PUBLISHER_PROVIDED" : @(GADAdValuePrecisionPublisherProvided),
|
|
186
|
-
@"REVENUE_PRECISION_PRECISE" : @(GADAdValuePrecisionPrecise)
|
|
187
|
-
};
|
|
188
|
-
#endif
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
- (NSDictionary *)getConstants {
|
|
192
|
-
return [self constantsToExport];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
180
|
@end
|
|
@@ -145,7 +145,7 @@ RCT_EXPORT_METHOD(destroy
|
|
|
145
145
|
|
|
146
146
|
- (instancetype)initWithNativeModule:(RNGoogleMobileAdsNativeModule *)nativeModule
|
|
147
147
|
adUnitId:(NSString *)adUnitId
|
|
148
|
-
requestOptions:(NSDictionary *)requestOptions {
|
|
148
|
+
requestOptions:(NSDictionary *_Nonnull)requestOptions {
|
|
149
149
|
if (self = [super init]) {
|
|
150
150
|
_nativeModule = nativeModule;
|
|
151
151
|
|
|
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
30
30
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
31
31
|
@interface RNGoogleMobileAdsNativeView : RCTViewComponentView
|
|
32
32
|
|
|
33
|
+
// provided by superclass, but we narrow the type in our declaration
|
|
33
34
|
@property(nonatomic, strong, nullable) GADNativeAdView *contentView;
|
|
34
35
|
#else
|
|
35
36
|
@interface RNGoogleMobileAdsNativeView : GADNativeAdView
|
|
@@ -50,6 +50,8 @@ using namespace facebook::react;
|
|
|
50
50
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
51
51
|
#pragma mark - Fabric specific
|
|
52
52
|
|
|
53
|
+
@dynamic contentView; // provided by superclass, but we narrow the type in our declaration
|
|
54
|
+
|
|
53
55
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
54
56
|
if (self = [super initWithFrame:frame]) {
|
|
55
57
|
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsNativeViewProps>();
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
#pragma mark -
|
|
37
37
|
#pragma mark Methods
|
|
38
38
|
|
|
39
|
-
+ (void)rejectPromiseWithUserInfo:(RCTPromiseRejectBlock)reject
|
|
40
|
-
userInfo:(NSMutableDictionary *)userInfo;
|
|
39
|
+
+ (void)rejectPromiseWithUserInfo:(RCTPromiseRejectBlock)reject userInfo:(NSDictionary *)userInfo;
|
|
41
40
|
|
|
42
41
|
@end
|
|
43
42
|
|
|
@@ -26,8 +26,7 @@ static NSString *const RNErrorDomain = @"RNErrorDomain";
|
|
|
26
26
|
#pragma mark -
|
|
27
27
|
#pragma mark Methods
|
|
28
28
|
|
|
29
|
-
+ (void)rejectPromiseWithUserInfo:(RCTPromiseRejectBlock)reject
|
|
30
|
-
userInfo:(NSMutableDictionary *)userInfo {
|
|
29
|
+
+ (void)rejectPromiseWithUserInfo:(RCTPromiseRejectBlock)reject userInfo:(NSDictionary *)userInfo {
|
|
31
30
|
NSError *error = [NSError errorWithDomain:RNErrorDomain code:666 userInfo:userInfo];
|
|
32
31
|
reject(userInfo[@"code"], userInfo[@"message"], error);
|
|
33
32
|
}
|
package/ios_config.sh
CHANGED
|
@@ -48,8 +48,8 @@ _PLIST_ENTRY_TYPES=()
|
|
|
48
48
|
_PLIST_ENTRY_VALUES=()
|
|
49
49
|
|
|
50
50
|
function setPlistValue {
|
|
51
|
-
echo "
|
|
52
|
-
${_PLIST_BUDDY} -c "Add :$1 $2 '$3'" $4 || echo "
|
|
51
|
+
echo "note: setting plist entry '$1' of type '$2' in file '$4'"
|
|
52
|
+
${_PLIST_BUDDY} -c "Add :$1 $2 '$3'" $4 || echo "note: '$1' already exists"
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function getJsonKeyValue () {
|
|
@@ -69,8 +69,8 @@ function jsonBoolToYesNo () {
|
|
|
69
69
|
fi
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
echo "
|
|
73
|
-
echo "
|
|
72
|
+
echo "note: -> ${_PROJECT_ABBREVIATION} build script started"
|
|
73
|
+
echo "note: 1) Locating ${_JSON_FILE_NAME} file:"
|
|
74
74
|
|
|
75
75
|
if [[ -z ${_CURRENT_SEARCH_DIR} ]]; then
|
|
76
76
|
_CURRENT_SEARCH_DIR=$(pwd)
|
|
@@ -78,11 +78,12 @@ fi;
|
|
|
78
78
|
|
|
79
79
|
while true; do
|
|
80
80
|
_CURRENT_SEARCH_DIR=$(dirname "$_CURRENT_SEARCH_DIR")
|
|
81
|
+
if [[ "$_CURRENT_SEARCH_DIR" == *.generated ]]; then continue; fi
|
|
81
82
|
if [[ "$_CURRENT_SEARCH_DIR" == "/" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then break; fi;
|
|
82
|
-
echo "
|
|
83
|
+
echo "note: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME} file."
|
|
83
84
|
_SEARCH_RESULT=$(find "$_CURRENT_SEARCH_DIR" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | /usr/bin/head -n 1)
|
|
84
85
|
if [[ ${_SEARCH_RESULT} ]]; then
|
|
85
|
-
echo "
|
|
86
|
+
echo "note: ${_JSON_FILE_NAME} found at $_SEARCH_RESULT"
|
|
86
87
|
break;
|
|
87
88
|
fi;
|
|
88
89
|
_CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))
|
|
@@ -93,7 +94,7 @@ if [[ ${_SEARCH_RESULT} ]]; then
|
|
|
93
94
|
_RN_ROOT_EXISTS=$(ruby -KU -e "require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]" || echo '')
|
|
94
95
|
|
|
95
96
|
if [[ ${_RN_ROOT_EXISTS} ]]; then
|
|
96
|
-
if ! python3 --version >/dev/null 2>&1; then echo "python3 not found, app.json file processing error." && exit 1; fi
|
|
97
|
+
if ! python3 --version >/dev/null 2>&1; then echo "error: python3 not found, app.json file processing error." && exit 1; fi
|
|
97
98
|
_JSON_OUTPUT_BASE64=$(python3 -c 'import json,sys,base64;print(base64.b64encode(bytes(json.dumps(json.loads(open('"'${_SEARCH_RESULT}'"', '"'rb'"').read())['${_JSON_ROOT}']), '"'utf-8'"')).decode())' || echo "e30=")
|
|
98
99
|
fi
|
|
99
100
|
|
|
@@ -147,10 +148,10 @@ else
|
|
|
147
148
|
_PLIST_ENTRY_KEYS+=("google_mobile_ads_json_raw")
|
|
148
149
|
_PLIST_ENTRY_TYPES+=("string")
|
|
149
150
|
_PLIST_ENTRY_VALUES+=("$_JSON_OUTPUT_BASE64")
|
|
150
|
-
echo "
|
|
151
|
+
echo "note: An ${_JSON_FILE_NAME} file was not found, whilst this file is optional it is recommended to include it to auto-configure services."
|
|
151
152
|
fi;
|
|
152
153
|
|
|
153
|
-
echo "
|
|
154
|
+
echo "note: 2) Injecting Info.plist entries: "
|
|
154
155
|
|
|
155
156
|
# Log out the keys we're adding
|
|
156
157
|
for i in "${!_PLIST_ENTRY_KEYS[@]}"; do
|
|
@@ -163,8 +164,7 @@ if ! [[ -f "${_TARGET_PLIST}" ]]; then
|
|
|
163
164
|
fi
|
|
164
165
|
|
|
165
166
|
if ! [[ $_IOS_APP_ID ]]; then
|
|
166
|
-
echo "warning:
|
|
167
|
-
echo " You can safely ignore this warning if you are using our Expo config plugin."
|
|
167
|
+
echo "warning: ios_app_id key not found in react-native-google-mobile-ads key in app.json. App will crash without it. You may safely ignore this warning if you are using our Expo config plugin."
|
|
168
168
|
exit 0
|
|
169
169
|
fi
|
|
170
170
|
|
|
@@ -189,4 +189,4 @@ for plist in "${_TARGET_PLIST}" "${_DSYM_PLIST}" ; do
|
|
|
189
189
|
fi
|
|
190
190
|
done
|
|
191
191
|
|
|
192
|
-
echo "
|
|
192
|
+
echo "note: <- ${_PROJECT_ABBREVIATION} build script finished"
|
package/jest.setup.ts
CHANGED
|
@@ -57,3 +57,13 @@ jest.doMock('./src/specs/components/GoogleMobileAdsNativeViewNativeComponent', (
|
|
|
57
57
|
default: ReactNative.View,
|
|
58
58
|
};
|
|
59
59
|
});
|
|
60
|
+
jest.doMock('./src/specs/modules/NativeInterstitialModule', () => {
|
|
61
|
+
return {
|
|
62
|
+
__esModule: true,
|
|
63
|
+
Commands: {},
|
|
64
|
+
default: {
|
|
65
|
+
interstitialLoad: jest.fn(),
|
|
66
|
+
interstitialShow: jest.fn(),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
});
|
|
@@ -21,11 +21,51 @@ exports.AdEventType = void 0;
|
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
23
|
let AdEventType = exports.AdEventType = /*#__PURE__*/function (AdEventType) {
|
|
24
|
+
/**
|
|
25
|
+
* When an ad has loaded. At this point, the ad is ready to be shown to the user.
|
|
26
|
+
*
|
|
27
|
+
* #### Example
|
|
28
|
+
*
|
|
29
|
+
* ```js
|
|
30
|
+
* import { AdEventType } from 'react-native-google-mobile-ads';
|
|
31
|
+
*
|
|
32
|
+
* advert.addEventListener(AdEventType.LOADED, () => {
|
|
33
|
+
* advert.show();
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
24
37
|
AdEventType["LOADED"] = "loaded";
|
|
38
|
+
/**
|
|
39
|
+
* The ad has thrown an error. See the error parameter the listener callback for more information.
|
|
40
|
+
*
|
|
41
|
+
* #### Example
|
|
42
|
+
*
|
|
43
|
+
* ```js
|
|
44
|
+
* import { AdEventType } from 'react-native-google-mobile-ads';
|
|
45
|
+
*
|
|
46
|
+
* advert.addEventListener(AdEventType.ERROR, (error) => {
|
|
47
|
+
* console.log('Ad error:', error);
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
25
51
|
AdEventType["ERROR"] = "error";
|
|
52
|
+
/**
|
|
53
|
+
* The ad opened and is currently visible to the user. This event is fired after the `show()`
|
|
54
|
+
* method has been called.
|
|
55
|
+
*/
|
|
26
56
|
AdEventType["OPENED"] = "opened";
|
|
57
|
+
/**
|
|
58
|
+
* Called when ad generates revenue.
|
|
59
|
+
* See: https://developers.google.com/admob/android/impression-level-ad-revenue
|
|
60
|
+
*/
|
|
27
61
|
AdEventType["PAID"] = "paid";
|
|
62
|
+
/**
|
|
63
|
+
* The user clicked the advert.
|
|
64
|
+
*/
|
|
28
65
|
AdEventType["CLICKED"] = "clicked";
|
|
66
|
+
/**
|
|
67
|
+
* The user closed the ad and has returned back to your application.
|
|
68
|
+
*/
|
|
29
69
|
AdEventType["CLOSED"] = "closed";
|
|
30
70
|
return AdEventType;
|
|
31
71
|
}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AdEventType","exports"],"sourceRoot":"../../src","sources":["AdEventType.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,IAiBYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;
|
|
1
|
+
{"version":3,"names":["AdEventType","exports"],"sourceRoot":"../../src","sources":["AdEventType.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,IAiBYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EACrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAbYA,WAAW;EAgBrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EA5BYA,WAAW;EA+BrB;AACF;AACA;AACA;EAlCYA,WAAW;EAqCrB;AACF;AACA;AACA;EAxCYA,WAAW;EA2CrB;AACF;AACA;EA7CYA,WAAW;EAgDrB;AACF;AACA;EAlDYA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
|