@javascriptcommon/react-native-google-mobile-ads 16.3.3
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/LICENSE +32 -0
- package/README.md +181 -0
- package/RNGoogleMobileAds.podspec +74 -0
- package/__tests__/banner.test.tsx +53 -0
- package/__tests__/consent.test.ts +33 -0
- package/__tests__/googleMobileAds.test.ts +108 -0
- package/__tests__/interstitial.test.ts +140 -0
- package/__tests__/nativeEventEmitter.test.ts +72 -0
- package/__tests__/requestOptions.test.tsx +82 -0
- package/__tests__/rewarded.test.tsx +4 -0
- package/__tests__/showOptions.test.tsx +4 -0
- package/android/.editorconfig +10 -0
- package/android/app-json.gradle +69 -0
- package/android/build.gradle +149 -0
- package/android/lint.xml +5 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +23 -0
- package/android/src/main/java/io/invertase/googlemobileads/OnNativeEvent.kt +23 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +152 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.kt +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +303 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +277 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +293 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +76 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsFullScreenAdModule.kt +201 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.kt +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsMediaViewManager.java +79 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +178 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeAdViewManager.java +164 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeModule.kt +172 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt +113 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedInterstitialModule.kt +127 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.kt +121 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/RCTConvert.java +111 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeAdView.java +128 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeApp.java +34 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEvent.java +41 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEventEmitter.java +150 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeInitProvider.java +77 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeJSON.java +107 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeMeta.java +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeModule.java +96 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativePreferences.java +86 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +429 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/TaskExecutorService.java +124 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/ContextProvider.java +30 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeError.java +28 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeEvent.java +26 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerDelegate.java +32 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerInterface.java +10 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerDelegate.java +36 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerInterface.java +10 -0
- package/android/src/oldarch/io/invertase/googlemobileads/NativeGoogleMobileAdsNativeModuleSpec.kt +18 -0
- package/app.plugin.js +1 -0
- package/babel.config.js +8 -0
- package/docs/ad-inspector.mdx +47 -0
- package/docs/common-reasons-for-ads-not-showing.mdx +111 -0
- package/docs/displaying-ads-hook.mdx +103 -0
- package/docs/displaying-ads.mdx +512 -0
- package/docs/european-user-consent.mdx +315 -0
- package/docs/img/logo_admob_192px.svg +19 -0
- package/docs/impression-level-ad-revenue.mdx +41 -0
- package/docs/index.mdx +508 -0
- package/docs/mediation.mdx +323 -0
- package/docs/migrating-to-v15.mdx +7 -0
- package/docs/migrating-to-v5.mdx +63 -0
- package/docs/migrating-to-v6.mdx +111 -0
- package/docs/native-ads.mdx +385 -0
- package/docs/testing.mdx +17 -0
- package/docs/video-ad_volume-control.mdx +49 -0
- package/docs.json +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAds-Bridging-Header.h +5 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.mm +104 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +44 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +221 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.h +34 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +282 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.mm +87 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +72 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.mm +248 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.mm +356 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.h +53 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.mm +220 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.mm +80 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.mm +106 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.h +52 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm +155 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +32 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +180 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.h +35 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +321 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.h +51 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm +251 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h +37 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.mm +106 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.mm +104 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.h +24 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.mm +95 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.h +73 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.mm +150 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +43 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.mm +34 -0
- package/ios/RNGoogleMobileAds.xcodeproj/project.pbxproj +377 -0
- package/ios/RNGoogleMobileAds.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
- package/ios_config.sh +192 -0
- package/jest.config.js +7 -0
- package/jest.setup.ts +92 -0
- package/lib/commonjs/AdEventType.js +72 -0
- package/lib/commonjs/AdEventType.js.map +1 -0
- package/lib/commonjs/AdsConsent.js +117 -0
- package/lib/commonjs/AdsConsent.js.map +1 -0
- package/lib/commonjs/AdsConsentPurposes.js +180 -0
- package/lib/commonjs/AdsConsentPurposes.js.map +1 -0
- package/lib/commonjs/AdsConsentSpecialFeatures.js +54 -0
- package/lib/commonjs/AdsConsentSpecialFeatures.js.map +1 -0
- package/lib/commonjs/BannerAdSize.js +75 -0
- package/lib/commonjs/BannerAdSize.js.map +1 -0
- package/lib/commonjs/GAMAdEventType.js +44 -0
- package/lib/commonjs/GAMAdEventType.js.map +1 -0
- package/lib/commonjs/MaxAdContentRating.js +42 -0
- package/lib/commonjs/MaxAdContentRating.js.map +1 -0
- package/lib/commonjs/MobileAds.js +63 -0
- package/lib/commonjs/MobileAds.js.map +1 -0
- package/lib/commonjs/NativeAdEventType.js +50 -0
- package/lib/commonjs/NativeAdEventType.js.map +1 -0
- package/lib/commonjs/RewardedAdEventType.js +66 -0
- package/lib/commonjs/RewardedAdEventType.js.map +1 -0
- package/lib/commonjs/TestIds.js +66 -0
- package/lib/commonjs/TestIds.js.map +1 -0
- package/lib/commonjs/ads/AppOpenAd.js +54 -0
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -0
- package/lib/commonjs/ads/BannerAd.js +45 -0
- package/lib/commonjs/ads/BannerAd.js.map +1 -0
- package/lib/commonjs/ads/BaseAd.js +155 -0
- package/lib/commonjs/ads/BaseAd.js.map +1 -0
- package/lib/commonjs/ads/GAMBannerAd.js +49 -0
- package/lib/commonjs/ads/GAMBannerAd.js.map +1 -0
- package/lib/commonjs/ads/GAMInterstitialAd.js +42 -0
- package/lib/commonjs/ads/GAMInterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/InterstitialAd.js +115 -0
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/MobileAd.js +153 -0
- package/lib/commonjs/ads/MobileAd.js.map +1 -0
- package/lib/commonjs/ads/RewardedAd.js +128 -0
- package/lib/commonjs/ads/RewardedAd.js.map +1 -0
- package/lib/commonjs/ads/RewardedInterstitialAd.js +128 -0
- package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAd.js +123 -0
- package/lib/commonjs/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js +26 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js +52 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js +70 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js +61 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/commonjs/common/constants.js +17 -0
- package/lib/commonjs/common/constants.js.map +1 -0
- package/lib/commonjs/common/debounce.js +18 -0
- package/lib/commonjs/common/debounce.js.map +1 -0
- package/lib/commonjs/common/index.js +47 -0
- package/lib/commonjs/common/index.js.map +1 -0
- package/lib/commonjs/common/ref.js +46 -0
- package/lib/commonjs/common/ref.js.map +1 -0
- package/lib/commonjs/common/validate.js +132 -0
- package/lib/commonjs/common/validate.js.map +1 -0
- package/lib/commonjs/declarations.d.js +2 -0
- package/lib/commonjs/declarations.d.js.map +1 -0
- package/lib/commonjs/hooks/useAppOpenAd.js +44 -0
- package/lib/commonjs/hooks/useAppOpenAd.js.map +1 -0
- package/lib/commonjs/hooks/useForeground.js +45 -0
- package/lib/commonjs/hooks/useForeground.js.map +1 -0
- package/lib/commonjs/hooks/useFullScreenAd.js +121 -0
- package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +44 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +44 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedInterstitialAd.js +44 -0
- package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -0
- package/lib/commonjs/index.js +337 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +54 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/internal/NativeError.js +53 -0
- package/lib/commonjs/internal/NativeError.js.map +1 -0
- package/lib/commonjs/internal/SharedEventEmitter.js +27 -0
- package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/commonjs/specs/modules/NativeAppModule.js +24 -0
- package/lib/commonjs/specs/modules/NativeAppModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.js +105 -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/NativeGoogleMobileAdsNativeModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.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/AdEventListener.js +6 -0
- package/lib/commonjs/types/AdEventListener.js.map +1 -0
- package/lib/commonjs/types/AdEventsListener.js +6 -0
- package/lib/commonjs/types/AdEventsListener.js.map +1 -0
- package/lib/commonjs/types/AdShowOptions.js +2 -0
- package/lib/commonjs/types/AdShowOptions.js.map +1 -0
- package/lib/commonjs/types/AdStates.js +6 -0
- package/lib/commonjs/types/AdStates.js.map +1 -0
- package/lib/commonjs/types/AdapterStatus.js +21 -0
- package/lib/commonjs/types/AdapterStatus.js.map +1 -0
- package/lib/commonjs/types/AppEvent.js +2 -0
- package/lib/commonjs/types/AppEvent.js.map +1 -0
- package/lib/commonjs/types/BannerAdProps.js +6 -0
- package/lib/commonjs/types/BannerAdProps.js.map +1 -0
- package/lib/commonjs/types/MobileAd.interface.js +6 -0
- package/lib/commonjs/types/MobileAd.interface.js.map +1 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js +6 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js +37 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/commonjs/types/PaidEventListener.js +6 -0
- package/lib/commonjs/types/PaidEventListener.js.map +1 -0
- package/lib/commonjs/types/RequestConfiguration.js +6 -0
- package/lib/commonjs/types/RequestConfiguration.js.map +1 -0
- package/lib/commonjs/types/RequestOptions.js +2 -0
- package/lib/commonjs/types/RequestOptions.js.map +1 -0
- package/lib/commonjs/types/RewardedAdReward.js +2 -0
- package/lib/commonjs/types/RewardedAdReward.js.map +1 -0
- package/lib/commonjs/types/index.js +138 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/validateAdRequestConfiguration.js +57 -0
- package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -0
- package/lib/commonjs/validateAdRequestOptions.js +121 -0
- package/lib/commonjs/validateAdRequestOptions.js.map +1 -0
- package/lib/commonjs/validateAdShowOptions.js +41 -0
- package/lib/commonjs/validateAdShowOptions.js.map +1 -0
- package/lib/commonjs/validateNativeAdRequestOptions.js +51 -0
- package/lib/commonjs/validateNativeAdRequestOptions.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/AdEventType.js +69 -0
- package/lib/module/AdEventType.js.map +1 -0
- package/lib/module/AdsConsent.js +113 -0
- package/lib/module/AdsConsent.js.map +1 -0
- package/lib/module/AdsConsentPurposes.js +177 -0
- package/lib/module/AdsConsentPurposes.js.map +1 -0
- package/lib/module/AdsConsentSpecialFeatures.js +51 -0
- package/lib/module/AdsConsentSpecialFeatures.js.map +1 -0
- package/lib/module/BannerAdSize.js +72 -0
- package/lib/module/BannerAdSize.js.map +1 -0
- package/lib/module/GAMAdEventType.js +41 -0
- package/lib/module/GAMAdEventType.js.map +1 -0
- package/lib/module/MaxAdContentRating.js +39 -0
- package/lib/module/MaxAdContentRating.js.map +1 -0
- package/lib/module/MobileAds.js +57 -0
- package/lib/module/MobileAds.js.map +1 -0
- package/lib/module/NativeAdEventType.js +46 -0
- package/lib/module/NativeAdEventType.js.map +1 -0
- package/lib/module/RewardedAdEventType.js +63 -0
- package/lib/module/RewardedAdEventType.js.map +1 -0
- package/lib/module/TestIds.js +62 -0
- package/lib/module/TestIds.js.map +1 -0
- package/lib/module/ads/AppOpenAd.js +48 -0
- package/lib/module/ads/AppOpenAd.js.map +1 -0
- package/lib/module/ads/BannerAd.js +39 -0
- package/lib/module/ads/BannerAd.js.map +1 -0
- package/lib/module/ads/BaseAd.js +149 -0
- package/lib/module/ads/BaseAd.js.map +1 -0
- package/lib/module/ads/GAMBannerAd.js +43 -0
- package/lib/module/ads/GAMBannerAd.js.map +1 -0
- package/lib/module/ads/GAMInterstitialAd.js +37 -0
- package/lib/module/ads/GAMInterstitialAd.js.map +1 -0
- package/lib/module/ads/InterstitialAd.js +110 -0
- package/lib/module/ads/InterstitialAd.js.map +1 -0
- package/lib/module/ads/MobileAd.js +148 -0
- package/lib/module/ads/MobileAd.js.map +1 -0
- package/lib/module/ads/RewardedAd.js +123 -0
- package/lib/module/ads/RewardedAd.js.map +1 -0
- package/lib/module/ads/RewardedInterstitialAd.js +123 -0
- package/lib/module/ads/RewardedInterstitialAd.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAd.js +117 -0
- package/lib/module/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdContext.js +22 -0
- package/lib/module/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdView.js +45 -0
- package/lib/module/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAsset.js +65 -0
- package/lib/module/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/module/ads/native-ad/NativeMediaView.js +54 -0
- package/lib/module/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/module/common/constants.js +13 -0
- package/lib/module/common/constants.js.map +1 -0
- package/lib/module/common/debounce.js +13 -0
- package/lib/module/common/debounce.js.map +1 -0
- package/lib/module/common/index.js +28 -0
- package/lib/module/common/index.js.map +1 -0
- package/lib/module/common/ref.js +41 -0
- package/lib/module/common/ref.js.map +1 -0
- package/lib/module/common/validate.js +119 -0
- package/lib/module/common/validate.js.map +1 -0
- package/lib/module/declarations.d.js +2 -0
- package/lib/module/declarations.d.js.map +1 -0
- package/lib/module/hooks/useAppOpenAd.js +40 -0
- package/lib/module/hooks/useAppOpenAd.js.map +1 -0
- package/lib/module/hooks/useForeground.js +42 -0
- package/lib/module/hooks/useForeground.js.map +1 -0
- package/lib/module/hooks/useFullScreenAd.js +117 -0
- package/lib/module/hooks/useFullScreenAd.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +40 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +40 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/hooks/useRewardedInterstitialAd.js +40 -0
- package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -0
- package/lib/module/index.js +54 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +49 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/module/internal/NativeError.js +48 -0
- package/lib/module/internal/NativeError.js.map +1 -0
- package/lib/module/internal/SharedEventEmitter.js +22 -0
- package/lib/module/internal/SharedEventEmitter.js.map +1 -0
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/module/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/module/specs/modules/NativeAppModule.js +21 -0
- package/lib/module/specs/modules/NativeAppModule.js.map +1 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js +22 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/module/specs/modules/NativeConsentModule.js +108 -0
- package/lib/module/specs/modules/NativeConsentModule.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js +22 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js +22 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js +22 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js +22 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedModule.js +22 -0
- package/lib/module/specs/modules/NativeRewardedModule.js.map +1 -0
- package/lib/module/types/AdEventListener.js +4 -0
- package/lib/module/types/AdEventListener.js.map +1 -0
- package/lib/module/types/AdEventsListener.js +4 -0
- package/lib/module/types/AdEventsListener.js.map +1 -0
- package/lib/module/types/AdShowOptions.js +2 -0
- package/lib/module/types/AdShowOptions.js.map +1 -0
- package/lib/module/types/AdStates.js +4 -0
- package/lib/module/types/AdStates.js.map +1 -0
- package/lib/module/types/AdapterStatus.js +18 -0
- package/lib/module/types/AdapterStatus.js.map +1 -0
- package/lib/module/types/AppEvent.js +2 -0
- package/lib/module/types/AppEvent.js.map +1 -0
- package/lib/module/types/BannerAdProps.js +4 -0
- package/lib/module/types/BannerAdProps.js.map +1 -0
- package/lib/module/types/MobileAd.interface.js +4 -0
- package/lib/module/types/MobileAd.interface.js.map +1 -0
- package/lib/module/types/MobileAdsModule.interface.js +4 -0
- package/lib/module/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/module/types/NativeAdRequestOptions.js +34 -0
- package/lib/module/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/module/types/PaidEventListener.js +4 -0
- package/lib/module/types/PaidEventListener.js.map +1 -0
- package/lib/module/types/RequestConfiguration.js +4 -0
- package/lib/module/types/RequestConfiguration.js.map +1 -0
- package/lib/module/types/RequestOptions.js +2 -0
- package/lib/module/types/RequestOptions.js.map +1 -0
- package/lib/module/types/RewardedAdReward.js +2 -0
- package/lib/module/types/RewardedAdReward.js.map +1 -0
- package/lib/module/types/index.js +32 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/validateAdRequestConfiguration.js +53 -0
- package/lib/module/validateAdRequestConfiguration.js.map +1 -0
- package/lib/module/validateAdRequestOptions.js +117 -0
- package/lib/module/validateAdRequestOptions.js.map +1 -0
- package/lib/module/validateAdShowOptions.js +37 -0
- package/lib/module/validateAdShowOptions.js.map +1 -0
- package/lib/module/validateNativeAdRequestOptions.js +47 -0
- package/lib/module/validateNativeAdRequestOptions.js.map +1 -0
- package/lib/module/version.js +5 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/AdEventType.d.ts +49 -0
- package/lib/typescript/AdEventType.d.ts.map +1 -0
- package/lib/typescript/AdsConsent.d.ts +3 -0
- package/lib/typescript/AdsConsent.d.ts.map +1 -0
- package/lib/typescript/AdsConsentPurposes.d.ts +149 -0
- package/lib/typescript/AdsConsentPurposes.d.ts.map +1 -0
- package/lib/typescript/AdsConsentSpecialFeatures.d.ts +23 -0
- package/lib/typescript/AdsConsentSpecialFeatures.d.ts.map +1 -0
- package/lib/typescript/BannerAdSize.d.ts +91 -0
- package/lib/typescript/BannerAdSize.d.ts.map +1 -0
- package/lib/typescript/GAMAdEventType.d.ts +21 -0
- package/lib/typescript/GAMAdEventType.d.ts.map +1 -0
- package/lib/typescript/MaxAdContentRating.d.ts +19 -0
- package/lib/typescript/MaxAdContentRating.d.ts.map +1 -0
- package/lib/typescript/MobileAds.d.ts +15 -0
- package/lib/typescript/MobileAds.d.ts.map +1 -0
- package/lib/typescript/NativeAdEventType.d.ts +43 -0
- package/lib/typescript/NativeAdEventType.d.ts.map +1 -0
- package/lib/typescript/RewardedAdEventType.d.ts +43 -0
- package/lib/typescript/RewardedAdEventType.d.ts.map +1 -0
- package/lib/typescript/TestIds.d.ts +19 -0
- package/lib/typescript/TestIds.d.ts.map +1 -0
- package/lib/typescript/ads/AppOpenAd.d.ts +12 -0
- package/lib/typescript/ads/AppOpenAd.d.ts.map +1 -0
- package/lib/typescript/ads/BannerAd.d.ts +8 -0
- package/lib/typescript/ads/BannerAd.d.ts.map +1 -0
- package/lib/typescript/ads/BaseAd.d.ts +4 -0
- package/lib/typescript/ads/BaseAd.d.ts.map +1 -0
- package/lib/typescript/ads/GAMBannerAd.d.ts +9 -0
- package/lib/typescript/ads/GAMBannerAd.d.ts.map +1 -0
- package/lib/typescript/ads/GAMInterstitialAd.d.ts +34 -0
- package/lib/typescript/ads/GAMInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/InterstitialAd.d.ts +73 -0
- package/lib/typescript/ads/InterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/MobileAd.d.ts +54 -0
- package/lib/typescript/ads/MobileAd.d.ts.map +1 -0
- package/lib/typescript/ads/RewardedAd.d.ts +83 -0
- package/lib/typescript/ads/RewardedAd.d.ts.map +1 -0
- package/lib/typescript/ads/RewardedInterstitialAd.d.ts +83 -0
- package/lib/typescript/ads/RewardedInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAd.d.ts +48 -0
- package/lib/typescript/ads/native-ad/NativeAd.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts +10 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts +8 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts +18 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts +7 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts.map +1 -0
- package/lib/typescript/common/constants.d.ts +7 -0
- package/lib/typescript/common/constants.d.ts.map +1 -0
- package/lib/typescript/common/debounce.d.ts +2 -0
- package/lib/typescript/common/debounce.d.ts.map +1 -0
- package/lib/typescript/common/index.d.ts +4 -0
- package/lib/typescript/common/index.d.ts.map +1 -0
- package/lib/typescript/common/ref.d.ts +13 -0
- package/lib/typescript/common/ref.d.ts.map +1 -0
- package/lib/typescript/common/validate.d.ts +62 -0
- package/lib/typescript/common/validate.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppOpenAd.d.ts +10 -0
- package/lib/typescript/hooks/useAppOpenAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useForeground.d.ts +7 -0
- package/lib/typescript/hooks/useForeground.d.ts.map +1 -0
- package/lib/typescript/hooks/useFullScreenAd.d.ts +7 -0
- package/lib/typescript/hooks/useFullScreenAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useInterstitialAd.d.ts +10 -0
- package/lib/typescript/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useRewardedAd.d.ts +10 -0
- package/lib/typescript/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts +10 -0
- package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +32 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +13 -0
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts.map +1 -0
- package/lib/typescript/internal/NativeError.d.ts +27 -0
- package/lib/typescript/internal/NativeError.d.ts.map +1 -0
- package/lib/typescript/internal/SharedEventEmitter.d.ts +3 -0
- package/lib/typescript/internal/SharedEventEmitter.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts +35 -0
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts +9 -0
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts +14 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeAppModule.d.ts +23 -0
- package/lib/typescript/specs/modules/NativeAppModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeConsentModule.d.ts +498 -0
- package/lib/typescript/specs/modules/NativeConsentModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +14 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts +42 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.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/AdEventListener.d.ts +8 -0
- package/lib/typescript/types/AdEventListener.d.ts.map +1 -0
- package/lib/typescript/types/AdEventsListener.d.ts +9 -0
- package/lib/typescript/types/AdEventsListener.d.ts.map +1 -0
- package/lib/typescript/types/AdShowOptions.d.ts +13 -0
- package/lib/typescript/types/AdShowOptions.d.ts.map +1 -0
- package/lib/typescript/types/AdStates.d.ts +91 -0
- package/lib/typescript/types/AdStates.d.ts.map +1 -0
- package/lib/typescript/types/AdapterStatus.d.ts +19 -0
- package/lib/typescript/types/AdapterStatus.d.ts.map +1 -0
- package/lib/typescript/types/AppEvent.d.ts +14 -0
- package/lib/typescript/types/AppEvent.d.ts.map +1 -0
- package/lib/typescript/types/BannerAdProps.d.ts +175 -0
- package/lib/typescript/types/BannerAdProps.d.ts.map +1 -0
- package/lib/typescript/types/MobileAd.interface.d.ts +90 -0
- package/lib/typescript/types/MobileAd.interface.d.ts.map +1 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts +75 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts +36 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/types/PaidEventListener.d.ts +8 -0
- package/lib/typescript/types/PaidEventListener.d.ts.map +1 -0
- package/lib/typescript/types/RequestConfiguration.d.ts +37 -0
- package/lib/typescript/types/RequestConfiguration.d.ts.map +1 -0
- package/lib/typescript/types/RequestOptions.d.ts +133 -0
- package/lib/typescript/types/RequestOptions.d.ts.map +1 -0
- package/lib/typescript/types/RewardedAdReward.d.ts +14 -0
- package/lib/typescript/types/RewardedAdReward.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +13 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/validateAdRequestConfiguration.d.ts +3 -0
- package/lib/typescript/validateAdRequestConfiguration.d.ts.map +1 -0
- package/lib/typescript/validateAdRequestOptions.d.ts +3 -0
- package/lib/typescript/validateAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/validateAdShowOptions.d.ts +3 -0
- package/lib/typescript/validateAdShowOptions.d.ts.map +1 -0
- package/lib/typescript/validateNativeAdRequestOptions.d.ts +3 -0
- package/lib/typescript/validateNativeAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +2 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +176 -0
- package/plugin/__tests__/__snapshots__/plugin.test.ts.snap +739 -0
- package/plugin/__tests__/fixtures/app.config.js +24 -0
- package/plugin/__tests__/fixtures/app.config.ts +24 -0
- package/plugin/__tests__/fixtures/app.json +24 -0
- package/plugin/__tests__/fixtures/package.json +19 -0
- package/plugin/__tests__/fixtures/without-params/app.config.js +11 -0
- package/plugin/__tests__/fixtures/without-params/app.config.ts +11 -0
- package/plugin/__tests__/fixtures/without-params/app.json +11 -0
- package/plugin/__tests__/plugin.test.ts +115 -0
- package/plugin/build/index.d.ts +12 -0
- package/plugin/build/index.js +109 -0
- package/plugin/jest.config.js +1 -0
- package/plugin/src/index.ts +205 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/react-native.config.js +19 -0
- package/src/AdEventType.ts +70 -0
- package/src/AdsConsent.ts +170 -0
- package/src/AdsConsentPurposes.ts +182 -0
- package/src/AdsConsentSpecialFeatures.ts +48 -0
- package/src/BannerAdSize.ts +78 -0
- package/src/GAMAdEventType.ts +37 -0
- package/src/MaxAdContentRating.ts +38 -0
- package/src/MobileAds.ts +77 -0
- package/src/NativeAdEventType.ts +51 -0
- package/src/RewardedAdEventType.ts +60 -0
- package/src/TestIds.ts +60 -0
- package/src/ads/AppOpenAd.ts +62 -0
- package/src/ads/BannerAd.tsx +37 -0
- package/src/ads/BaseAd.tsx +185 -0
- package/src/ads/GAMBannerAd.tsx +43 -0
- package/src/ads/GAMInterstitialAd.ts +45 -0
- package/src/ads/InterstitialAd.ts +122 -0
- package/src/ads/MobileAd.ts +227 -0
- package/src/ads/RewardedAd.ts +142 -0
- package/src/ads/RewardedInterstitialAd.ts +144 -0
- package/src/ads/native-ad/NativeAd.ts +159 -0
- package/src/ads/native-ad/NativeAdContext.ts +26 -0
- package/src/ads/native-ad/NativeAdView.tsx +43 -0
- package/src/ads/native-ad/NativeAsset.tsx +66 -0
- package/src/ads/native-ad/NativeMediaView.tsx +44 -0
- package/src/common/constants.ts +9 -0
- package/src/common/debounce.ts +15 -0
- package/src/common/index.ts +30 -0
- package/src/common/ref.ts +46 -0
- package/src/common/validate.ts +116 -0
- package/src/declarations.d.ts +3 -0
- package/src/hooks/useAppOpenAd.ts +46 -0
- package/src/hooks/useForeground.ts +41 -0
- package/src/hooks/useFullScreenAd.ts +112 -0
- package/src/hooks/useInterstitialAd.ts +46 -0
- package/src/hooks/useRewardedAd.ts +46 -0
- package/src/hooks/useRewardedInterstitialAd.ts +47 -0
- package/src/index.ts +60 -0
- package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +58 -0
- package/src/internal/NativeError.ts +56 -0
- package/src/internal/SharedEventEmitter.ts +20 -0
- package/src/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/src/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/src/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/src/specs/modules/NativeAppModule.ts +57 -0
- package/src/specs/modules/NativeAppOpenModule.ts +26 -0
- package/src/specs/modules/NativeConsentModule.ts +532 -0
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +33 -0
- package/src/specs/modules/NativeGoogleMobileAdsNativeModule.ts +70 -0
- package/src/specs/modules/NativeInterstitialModule.ts +26 -0
- package/src/specs/modules/NativeRewardedInterstitialModule.ts +32 -0
- package/src/specs/modules/NativeRewardedModule.ts +26 -0
- package/src/types/AdEventListener.ts +34 -0
- package/src/types/AdEventsListener.ts +24 -0
- package/src/types/AdShowOptions.ts +12 -0
- package/src/types/AdStates.ts +92 -0
- package/src/types/AdapterStatus.ts +20 -0
- package/src/types/AppEvent.ts +14 -0
- package/src/types/BannerAdProps.ts +184 -0
- package/src/types/MobileAd.interface.ts +113 -0
- package/src/types/MobileAdsModule.interface.ts +80 -0
- package/src/types/NativeAdRequestOptions.ts +55 -0
- package/src/types/PaidEventListener.ts +9 -0
- package/src/types/RequestConfiguration.ts +40 -0
- package/src/types/RequestOptions.ts +137 -0
- package/src/types/RewardedAdReward.ts +14 -0
- package/src/types/index.ts +29 -0
- package/src/validateAdRequestConfiguration.ts +66 -0
- package/src/validateAdRequestOptions.ts +154 -0
- package/src/validateAdShowOptions.ts +41 -0
- package/src/validateNativeAdRequestOptions.ts +50 -0
- package/src/version.ts +2 -0
package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
package io.invertase.googlemobileads
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import com.facebook.react.TurboReactPackage
|
|
21
|
+
import com.facebook.react.bridge.NativeModule
|
|
22
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
23
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
24
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
25
|
+
import com.facebook.react.uimanager.ViewManager
|
|
26
|
+
|
|
27
|
+
@SuppressWarnings("unused")
|
|
28
|
+
class ReactNativeGoogleMobileAdsPackage : TurboReactPackage() {
|
|
29
|
+
override fun createViewManagers(
|
|
30
|
+
reactContext: ReactApplicationContext
|
|
31
|
+
): List<ViewManager<*, *>> {
|
|
32
|
+
return listOf(
|
|
33
|
+
ReactNativeGoogleMobileAdsBannerAdViewManager(),
|
|
34
|
+
ReactNativeGoogleMobileAdsNativeAdViewManager(),
|
|
35
|
+
ReactNativeGoogleMobileAdsMediaViewManager()
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
40
|
+
when (name) {
|
|
41
|
+
ReactNativeAppModule.NAME -> return ReactNativeAppModule(reactContext)
|
|
42
|
+
ReactNativeGoogleMobileAdsModule.NAME -> return ReactNativeGoogleMobileAdsModule(reactContext)
|
|
43
|
+
ReactNativeGoogleMobileAdsConsentModule.NAME -> return ReactNativeGoogleMobileAdsConsentModule(reactContext)
|
|
44
|
+
ReactNativeGoogleMobileAdsAppOpenModule.NAME -> return ReactNativeGoogleMobileAdsAppOpenModule(reactContext)
|
|
45
|
+
ReactNativeGoogleMobileAdsInterstitialModule.NAME -> return ReactNativeGoogleMobileAdsInterstitialModule(reactContext)
|
|
46
|
+
ReactNativeGoogleMobileAdsNativeModule.NAME -> return ReactNativeGoogleMobileAdsNativeModule(reactContext)
|
|
47
|
+
ReactNativeGoogleMobileAdsRewardedModule.NAME -> return ReactNativeGoogleMobileAdsRewardedModule(reactContext)
|
|
48
|
+
ReactNativeGoogleMobileAdsRewardedInterstitialModule.NAME -> return ReactNativeGoogleMobileAdsRewardedInterstitialModule(reactContext)
|
|
49
|
+
}
|
|
50
|
+
return null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
|
54
|
+
ReactModuleInfoProvider {
|
|
55
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
56
|
+
val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
57
|
+
moduleInfos[ReactNativeAppModule.NAME] =
|
|
58
|
+
ReactModuleInfo(
|
|
59
|
+
ReactNativeAppModule.NAME,
|
|
60
|
+
ReactNativeAppModule::class.java.name,
|
|
61
|
+
false, // canOverrideExistingModule
|
|
62
|
+
false, // needsEagerInit
|
|
63
|
+
false, // isCxxModule
|
|
64
|
+
isTurboModule,
|
|
65
|
+
)
|
|
66
|
+
moduleInfos[ReactNativeGoogleMobileAdsModule.NAME] =
|
|
67
|
+
ReactModuleInfo(
|
|
68
|
+
ReactNativeGoogleMobileAdsModule.NAME,
|
|
69
|
+
ReactNativeGoogleMobileAdsModule.NAME,
|
|
70
|
+
false,
|
|
71
|
+
false,
|
|
72
|
+
false,
|
|
73
|
+
false,
|
|
74
|
+
)
|
|
75
|
+
moduleInfos[ReactNativeGoogleMobileAdsConsentModule.NAME] =
|
|
76
|
+
ReactModuleInfo(
|
|
77
|
+
ReactNativeGoogleMobileAdsConsentModule.NAME,
|
|
78
|
+
ReactNativeGoogleMobileAdsConsentModule.NAME,
|
|
79
|
+
false,
|
|
80
|
+
false,
|
|
81
|
+
false,
|
|
82
|
+
false,
|
|
83
|
+
)
|
|
84
|
+
moduleInfos[ReactNativeGoogleMobileAdsAppOpenModule.NAME] =
|
|
85
|
+
ReactModuleInfo(
|
|
86
|
+
ReactNativeGoogleMobileAdsAppOpenModule.NAME,
|
|
87
|
+
ReactNativeGoogleMobileAdsAppOpenModule.NAME,
|
|
88
|
+
false,
|
|
89
|
+
false,
|
|
90
|
+
false,
|
|
91
|
+
false,
|
|
92
|
+
)
|
|
93
|
+
moduleInfos[ReactNativeGoogleMobileAdsInterstitialModule.NAME] =
|
|
94
|
+
ReactModuleInfo(
|
|
95
|
+
ReactNativeGoogleMobileAdsInterstitialModule.NAME,
|
|
96
|
+
ReactNativeGoogleMobileAdsInterstitialModule.NAME,
|
|
97
|
+
false,
|
|
98
|
+
false,
|
|
99
|
+
false,
|
|
100
|
+
false,
|
|
101
|
+
)
|
|
102
|
+
// Native + Rewarded + RewardedInterstitial share the default module-info shape.
|
|
103
|
+
for (stubName in listOf(
|
|
104
|
+
ReactNativeGoogleMobileAdsNativeModule.NAME,
|
|
105
|
+
ReactNativeGoogleMobileAdsRewardedModule.NAME,
|
|
106
|
+
ReactNativeGoogleMobileAdsRewardedInterstitialModule.NAME,
|
|
107
|
+
)) {
|
|
108
|
+
moduleInfos[stubName] =
|
|
109
|
+
ReactModuleInfo(stubName, stubName, false, false, false, false)
|
|
110
|
+
}
|
|
111
|
+
moduleInfos
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
package io.invertase.googlemobileads
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Migrated to the GMA Next-Gen SDK (Android). Shares the reward/earned-reward dispatch shape with
|
|
21
|
+
// the standard Rewarded format; only the ad type and event channel differ.
|
|
22
|
+
|
|
23
|
+
import android.app.Activity
|
|
24
|
+
import com.facebook.react.bridge.Arguments
|
|
25
|
+
import com.facebook.react.bridge.Promise
|
|
26
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
27
|
+
import com.facebook.react.bridge.ReactMethod
|
|
28
|
+
import com.facebook.react.bridge.ReadableMap
|
|
29
|
+
import com.facebook.react.bridge.WritableMap
|
|
30
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback
|
|
31
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdRequest
|
|
32
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdValue
|
|
33
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.OnUserEarnedRewardListener
|
|
34
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.RewardItem
|
|
35
|
+
import com.google.android.libraries.ads.mobile.sdk.rewardedinterstitial.RewardedInterstitialAd
|
|
36
|
+
import com.google.android.libraries.ads.mobile.sdk.rewardedinterstitial.RewardedInterstitialAdEventCallback
|
|
37
|
+
|
|
38
|
+
class ReactNativeGoogleMobileAdsRewardedInterstitialModule(reactContext: ReactApplicationContext?) :
|
|
39
|
+
ReactNativeGoogleMobileAdsFullScreenAdModule<RewardedInterstitialAd>(reactContext, NAME) {
|
|
40
|
+
|
|
41
|
+
override fun getAdEventName(): String {
|
|
42
|
+
return ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED_INTERSTITIAL
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@ReactMethod
|
|
46
|
+
fun rewardedInterstitialLoad(requestId: Int, adUnitId: String, adRequestOptions: ReadableMap) {
|
|
47
|
+
load(requestId, adUnitId, adRequestOptions)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun rewardedInterstitialShow(
|
|
52
|
+
requestId: Int, adUnitId: String, showOptions: ReadableMap, promise: Promise
|
|
53
|
+
) {
|
|
54
|
+
show(requestId, adUnitId, showOptions, promise)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun loadAd(
|
|
58
|
+
adRequest: AdRequest,
|
|
59
|
+
adLoadCallback: AdLoadCallback<RewardedInterstitialAd>
|
|
60
|
+
) {
|
|
61
|
+
RewardedInterstitialAd.load(adRequest, adLoadCallback)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override fun attachAdEventCallback(
|
|
65
|
+
ad: RewardedInterstitialAd,
|
|
66
|
+
requestId: Int,
|
|
67
|
+
adUnitId: String
|
|
68
|
+
) {
|
|
69
|
+
ad.adEventCallback =
|
|
70
|
+
object : RewardedInterstitialAdEventCallback {
|
|
71
|
+
override fun onAdShowedFullScreenContent() {
|
|
72
|
+
dispatchFullScreenEvent(
|
|
73
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_OPENED, requestId, adUnitId)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
override fun onAdDismissedFullScreenContent() {
|
|
77
|
+
dispatchFullScreenEvent(
|
|
78
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLOSED, requestId, adUnitId)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun onAdClicked() {
|
|
82
|
+
dispatchFullScreenEvent(
|
|
83
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLICKED, requestId, adUnitId)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override fun onAdPaid(adValue: AdValue) {
|
|
87
|
+
dispatchPaidEvent(requestId, adUnitId, adValue)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
dispatchFullScreenEventWithData(
|
|
92
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED,
|
|
93
|
+
requestId,
|
|
94
|
+
adUnitId,
|
|
95
|
+
buildRewardPayload(ad.rewardItem))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
override fun showAd(
|
|
99
|
+
ad: RewardedInterstitialAd,
|
|
100
|
+
activity: Activity,
|
|
101
|
+
immersiveModeEnabled: Boolean,
|
|
102
|
+
requestId: Int,
|
|
103
|
+
adUnitId: String
|
|
104
|
+
) {
|
|
105
|
+
ad.setImmersiveMode(immersiveModeEnabled)
|
|
106
|
+
ad.show(
|
|
107
|
+
activity,
|
|
108
|
+
OnUserEarnedRewardListener { rewardItem ->
|
|
109
|
+
dispatchFullScreenEventWithData(
|
|
110
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD,
|
|
111
|
+
requestId,
|
|
112
|
+
adUnitId,
|
|
113
|
+
buildRewardPayload(rewardItem))
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private fun buildRewardPayload(rewardItem: RewardItem): WritableMap {
|
|
118
|
+
val reward = Arguments.createMap()
|
|
119
|
+
reward.putString("type", rewardItem.type)
|
|
120
|
+
reward.putDouble("amount", rewardItem.amount.toDouble())
|
|
121
|
+
return reward
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
companion object {
|
|
125
|
+
const val NAME = "RNGoogleMobileAdsRewardedInterstitialModule"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
package io.invertase.googlemobileads
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Migrated to the GMA Next-Gen SDK (Android). Rewarded ads load via RewardedAd.load and show with
|
|
21
|
+
// an OnUserEarnedRewardListener that surfaces the reward item to JS.
|
|
22
|
+
|
|
23
|
+
import android.app.Activity
|
|
24
|
+
import com.facebook.react.bridge.Arguments
|
|
25
|
+
import com.facebook.react.bridge.Promise
|
|
26
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
27
|
+
import com.facebook.react.bridge.ReactMethod
|
|
28
|
+
import com.facebook.react.bridge.ReadableMap
|
|
29
|
+
import com.facebook.react.bridge.WritableMap
|
|
30
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback
|
|
31
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdRequest
|
|
32
|
+
import com.google.android.libraries.ads.mobile.sdk.common.AdValue
|
|
33
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.OnUserEarnedRewardListener
|
|
34
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.RewardItem
|
|
35
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.RewardedAd
|
|
36
|
+
import com.google.android.libraries.ads.mobile.sdk.rewarded.RewardedAdEventCallback
|
|
37
|
+
|
|
38
|
+
class ReactNativeGoogleMobileAdsRewardedModule(reactContext: ReactApplicationContext?) :
|
|
39
|
+
ReactNativeGoogleMobileAdsFullScreenAdModule<RewardedAd>(reactContext, NAME) {
|
|
40
|
+
|
|
41
|
+
override fun getAdEventName(): String {
|
|
42
|
+
return ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@ReactMethod
|
|
46
|
+
fun rewardedLoad(requestId: Int, adUnitId: String, adRequestOptions: ReadableMap) {
|
|
47
|
+
load(requestId, adUnitId, adRequestOptions)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@ReactMethod
|
|
51
|
+
fun rewardedShow(
|
|
52
|
+
requestId: Int, adUnitId: String, showOptions: ReadableMap, promise: Promise
|
|
53
|
+
) {
|
|
54
|
+
show(requestId, adUnitId, showOptions, promise)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun loadAd(adRequest: AdRequest, adLoadCallback: AdLoadCallback<RewardedAd>) {
|
|
58
|
+
RewardedAd.load(adRequest, adLoadCallback)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun attachAdEventCallback(ad: RewardedAd, requestId: Int, adUnitId: String) {
|
|
62
|
+
ad.adEventCallback =
|
|
63
|
+
object : RewardedAdEventCallback {
|
|
64
|
+
override fun onAdShowedFullScreenContent() {
|
|
65
|
+
dispatchFullScreenEvent(
|
|
66
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_OPENED, requestId, adUnitId)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override fun onAdDismissedFullScreenContent() {
|
|
70
|
+
dispatchFullScreenEvent(
|
|
71
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLOSED, requestId, adUnitId)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
override fun onAdClicked() {
|
|
75
|
+
dispatchFullScreenEvent(
|
|
76
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_CLICKED, requestId, adUnitId)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override fun onAdPaid(adValue: AdValue) {
|
|
80
|
+
dispatchPaidEvent(requestId, adUnitId, adValue)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Surface the reward item alongside the loaded event (RewardedAdEventType.LOADED in JS).
|
|
85
|
+
dispatchFullScreenEventWithData(
|
|
86
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED_LOADED,
|
|
87
|
+
requestId,
|
|
88
|
+
adUnitId,
|
|
89
|
+
buildRewardPayload(ad.rewardItem))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override fun showAd(
|
|
93
|
+
ad: RewardedAd,
|
|
94
|
+
activity: Activity,
|
|
95
|
+
immersiveModeEnabled: Boolean,
|
|
96
|
+
requestId: Int,
|
|
97
|
+
adUnitId: String
|
|
98
|
+
) {
|
|
99
|
+
ad.setImmersiveMode(immersiveModeEnabled)
|
|
100
|
+
ad.show(
|
|
101
|
+
activity,
|
|
102
|
+
OnUserEarnedRewardListener { rewardItem ->
|
|
103
|
+
dispatchFullScreenEventWithData(
|
|
104
|
+
ReactNativeGoogleMobileAdsEvent.GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD,
|
|
105
|
+
requestId,
|
|
106
|
+
adUnitId,
|
|
107
|
+
buildRewardPayload(rewardItem))
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private fun buildRewardPayload(rewardItem: RewardItem): WritableMap {
|
|
112
|
+
val reward = Arguments.createMap()
|
|
113
|
+
reward.putString("type", rewardItem.type)
|
|
114
|
+
reward.putDouble("amount", rewardItem.amount.toDouble())
|
|
115
|
+
return reward
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
companion object {
|
|
119
|
+
const val NAME = "RNGoogleMobileAdsRewardedModule"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
package io.invertase.googlemobileads.common;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import android.util.Log;
|
|
21
|
+
import com.facebook.react.bridge.Arguments;
|
|
22
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
23
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
24
|
+
import com.facebook.react.bridge.WritableMap;
|
|
25
|
+
import java.util.List;
|
|
26
|
+
import java.util.Map;
|
|
27
|
+
import javax.annotation.Nullable;
|
|
28
|
+
|
|
29
|
+
/** Utilities to convert to and from React Native bridge formats. */
|
|
30
|
+
public class RCTConvert {
|
|
31
|
+
private static String TAG = "RCTConvert";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Takes a value and calls the appropriate setter for its type on the target map + key
|
|
35
|
+
*
|
|
36
|
+
* @param key String key to set on target map
|
|
37
|
+
* @param value Object value to set on target map
|
|
38
|
+
* @param map WritableMap target map to write the value to
|
|
39
|
+
*/
|
|
40
|
+
@SuppressWarnings("unchecked")
|
|
41
|
+
public static WritableMap mapPutValue(String key, @Nullable Object value, WritableMap map) {
|
|
42
|
+
if (value == null) {
|
|
43
|
+
map.putNull(key);
|
|
44
|
+
return map;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
String type = value.getClass().getName();
|
|
48
|
+
|
|
49
|
+
switch (type) {
|
|
50
|
+
case "java.lang.Boolean":
|
|
51
|
+
map.putBoolean(key, (Boolean) value);
|
|
52
|
+
break;
|
|
53
|
+
case "java.lang.Long":
|
|
54
|
+
Long longVal = (Long) value;
|
|
55
|
+
map.putDouble(key, (double) longVal);
|
|
56
|
+
break;
|
|
57
|
+
case "java.lang.Float":
|
|
58
|
+
float floatVal = (float) value;
|
|
59
|
+
map.putDouble(key, (double) floatVal);
|
|
60
|
+
break;
|
|
61
|
+
case "java.lang.Double":
|
|
62
|
+
map.putDouble(key, (Double) value);
|
|
63
|
+
break;
|
|
64
|
+
case "java.lang.Integer":
|
|
65
|
+
map.putInt(key, (int) value);
|
|
66
|
+
break;
|
|
67
|
+
case "java.lang.String":
|
|
68
|
+
map.putString(key, (String) value);
|
|
69
|
+
break;
|
|
70
|
+
case "org.json.JSONObject$1":
|
|
71
|
+
map.putString(key, value.toString());
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
if (List.class.isAssignableFrom(value.getClass())) {
|
|
75
|
+
map.putArray(key, Arguments.makeNativeArray((List<Object>) value));
|
|
76
|
+
} else if (Map.class.isAssignableFrom(value.getClass())) {
|
|
77
|
+
WritableMap childMap = Arguments.createMap();
|
|
78
|
+
Map<String, Object> valueMap = (Map<String, Object>) value;
|
|
79
|
+
|
|
80
|
+
for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
|
|
81
|
+
mapPutValue(entry.getKey(), entry.getValue(), childMap);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
map.putMap(key, childMap);
|
|
85
|
+
} else {
|
|
86
|
+
Log.d(TAG, "utils:mapPutValue:unknownType:" + type);
|
|
87
|
+
map.putNull(key);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return map;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// TODO Remove me - also in SharedUtils
|
|
95
|
+
public static WritableMap readableMapToWritableMap(ReadableMap map) {
|
|
96
|
+
WritableMap writableMap = Arguments.createMap();
|
|
97
|
+
// https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeMap.java#L58
|
|
98
|
+
writableMap.merge(map);
|
|
99
|
+
return writableMap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public static Map<String, Object> toHashMap(ReadableMap readableMap) {
|
|
103
|
+
// https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java#L263
|
|
104
|
+
return readableMap.toHashMap();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public static List<Object> toArrayList(ReadableArray readableArray) {
|
|
108
|
+
// https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java#L140
|
|
109
|
+
return readableArray.toArrayList();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
package io.invertase.googlemobileads.common;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.widget.FrameLayout;
|
|
5
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
6
|
+
import com.google.android.libraries.ads.mobile.sdk.banner.AdSize;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Using FrameLayout instead of ReactViewGroup
|
|
11
|
+
*
|
|
12
|
+
* <p>This is because in the case of fluid ads, - JS side will usually not specify the ad height -
|
|
13
|
+
* Also, after loading the fluid ad, we need to measure the ad height and update the layout Which
|
|
14
|
+
* isn't possible with ReactViewGroup since it overrides requestLayout by a noop
|
|
15
|
+
*
|
|
16
|
+
* <p>See https://github.com/facebook/react-native/issues/17968 for more details
|
|
17
|
+
*/
|
|
18
|
+
public class ReactNativeAdView extends FrameLayout {
|
|
19
|
+
// Next-Gen builds the BannerAdRequest at load time (it needs adUnitId + adSize), so we keep the
|
|
20
|
+
// raw JS request options instead of a pre-built request object.
|
|
21
|
+
private ReadableMap requestOptions;
|
|
22
|
+
private List<AdSize> sizes;
|
|
23
|
+
private float maxAdHeight;
|
|
24
|
+
private float adWidth;
|
|
25
|
+
private String unitId;
|
|
26
|
+
private boolean manualImpressionsEnabled;
|
|
27
|
+
private boolean propsChanged;
|
|
28
|
+
private boolean isFluid;
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public void requestLayout() {
|
|
32
|
+
super.requestLayout();
|
|
33
|
+
post(measureAndLayout);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* This ensures the adview is properly measured and laid out if its layout changed after being
|
|
38
|
+
* loaded This happens everytime for fluid ads, but cannot happen for fixed size ads loading
|
|
39
|
+
* additional content
|
|
40
|
+
*
|
|
41
|
+
* <p>See https://github.com/facebook/react-native/issues/17968 for more details
|
|
42
|
+
*/
|
|
43
|
+
private final Runnable measureAndLayout =
|
|
44
|
+
() -> {
|
|
45
|
+
/**
|
|
46
|
+
* For fluid ads, we usually don't specify the ad height from JS side, so mark it as
|
|
47
|
+
* unspecified and let it dynamically determine its size
|
|
48
|
+
*
|
|
49
|
+
* <p>See
|
|
50
|
+
* https://developers.google.com/ad-manager/mobile-ads-sdk/android/native/styles#fluid_size
|
|
51
|
+
*/
|
|
52
|
+
int heightMeasureSpec =
|
|
53
|
+
isFluid
|
|
54
|
+
? MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
|
|
55
|
+
: MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY);
|
|
56
|
+
|
|
57
|
+
measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY), heightMeasureSpec);
|
|
58
|
+
layout(getLeft(), getTop(), getRight(), getTop() + getHeight());
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
public ReactNativeAdView(final Context context) {
|
|
62
|
+
super(context);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public void setRequestOptions(ReadableMap requestOptions) {
|
|
66
|
+
this.requestOptions = requestOptions;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public ReadableMap getRequestOptions() {
|
|
70
|
+
return this.requestOptions;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public void setSizes(List<AdSize> sizes) {
|
|
74
|
+
this.sizes = sizes;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public List<AdSize> getSizes() {
|
|
78
|
+
return this.sizes;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public void setMaxAdHeight(float maxAdHeight) {
|
|
82
|
+
this.maxAdHeight = maxAdHeight;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public float getMaxAdHeight() {
|
|
86
|
+
return this.maxAdHeight;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public void setAdWidth(float adWidth) {
|
|
90
|
+
this.adWidth = adWidth;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public float getAdWidth() {
|
|
94
|
+
return this.adWidth;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public void setUnitId(String unitId) {
|
|
98
|
+
this.unitId = unitId;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public String getUnitId() {
|
|
102
|
+
return this.unitId;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public void setManualImpressionsEnabled(boolean manualImpressionsEnabled) {
|
|
106
|
+
this.manualImpressionsEnabled = manualImpressionsEnabled;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public boolean getManualImpressionsEnabled() {
|
|
110
|
+
return this.manualImpressionsEnabled;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public void setPropsChanged(boolean propsChanged) {
|
|
114
|
+
this.propsChanged = propsChanged;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public boolean getPropsChanged() {
|
|
118
|
+
return this.propsChanged;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public void setIsFluid(boolean isFluid) {
|
|
122
|
+
this.isFluid = isFluid;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public boolean getIsFluid() {
|
|
126
|
+
return this.isFluid;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package io.invertase.googlemobileads.common;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import android.content.Context;
|
|
21
|
+
import android.util.Log;
|
|
22
|
+
|
|
23
|
+
public class ReactNativeApp {
|
|
24
|
+
private static Context applicationContext;
|
|
25
|
+
|
|
26
|
+
public static Context getApplicationContext() {
|
|
27
|
+
return applicationContext;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static void setApplicationContext(Context applicationContext) {
|
|
31
|
+
Log.d("ReactNativeApp", "received application context.");
|
|
32
|
+
ReactNativeApp.applicationContext = applicationContext;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package io.invertase.googlemobileads.common;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import com.facebook.react.bridge.WritableMap;
|
|
21
|
+
import io.invertase.googlemobileads.interfaces.NativeEvent;
|
|
22
|
+
|
|
23
|
+
public class ReactNativeEvent implements NativeEvent {
|
|
24
|
+
private String eventName;
|
|
25
|
+
private WritableMap eventBody;
|
|
26
|
+
|
|
27
|
+
public ReactNativeEvent(String eventName, WritableMap eventBody) {
|
|
28
|
+
this.eventName = eventName;
|
|
29
|
+
this.eventBody = eventBody;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Override
|
|
33
|
+
public String getEventName() {
|
|
34
|
+
return eventName;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public WritableMap getEventBody() {
|
|
39
|
+
return eventBody;
|
|
40
|
+
}
|
|
41
|
+
}
|