@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
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#import "RNGoogleMobileAdsNativeView.h"
|
|
19
|
+
#import "RNGoogleMobileAdsMediaView.h"
|
|
20
|
+
#import "RNGoogleMobileAdsNativeModule.h"
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
#import <react/renderer/components/RNGoogleMobileAdsSpec/ComponentDescriptors.h>
|
|
24
|
+
#import <react/renderer/components/RNGoogleMobileAdsSpec/EventEmitters.h>
|
|
25
|
+
#import <react/renderer/components/RNGoogleMobileAdsSpec/Props.h>
|
|
26
|
+
#import <react/renderer/components/RNGoogleMobileAdsSpec/RCTComponentViewHelpers.h>
|
|
27
|
+
|
|
28
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
@interface RCTBridge (Private)
|
|
32
|
+
+ (RCTBridge *)currentBridge;
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
36
|
+
using namespace facebook::react;
|
|
37
|
+
|
|
38
|
+
@interface RNGoogleMobileAdsNativeView () <RCTRNGoogleMobileAdsNativeViewViewProtocol>
|
|
39
|
+
@end
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
@implementation RNGoogleMobileAdsNativeView {
|
|
43
|
+
__weak RCTBridge *_bridge;
|
|
44
|
+
__weak RNGoogleMobileAdsNativeModule *_nativeModule;
|
|
45
|
+
__weak GADNativeAd *_nativeAd;
|
|
46
|
+
GADNativeAdView *_nativeAdView;
|
|
47
|
+
dispatch_block_t _debouncedReload;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
51
|
+
#pragma mark - Fabric specific
|
|
52
|
+
|
|
53
|
+
@dynamic contentView; // provided by superclass, but we narrow the type in our declaration
|
|
54
|
+
|
|
55
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
56
|
+
if (self = [super initWithFrame:frame]) {
|
|
57
|
+
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsNativeViewProps>();
|
|
58
|
+
_props = defaultProps;
|
|
59
|
+
|
|
60
|
+
_bridge = [RCTBridge currentBridge];
|
|
61
|
+
_nativeModule = [_bridge moduleForClass:RNGoogleMobileAdsNativeModule.class];
|
|
62
|
+
_nativeAdView = [[GADNativeAdView alloc] init];
|
|
63
|
+
self.contentView = _nativeAdView;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return self;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#pragma mark - RCTComponentViewProtocol
|
|
70
|
+
|
|
71
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
72
|
+
return concreteComponentDescriptorProvider<RNGoogleMobileAdsNativeViewComponentDescriptor>();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
+ (BOOL)shouldBeRecycled {
|
|
76
|
+
return NO;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
80
|
+
index:(NSInteger)index {
|
|
81
|
+
[_nativeAdView insertSubview:childComponentView atIndex:index];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
85
|
+
index:(NSInteger)index {
|
|
86
|
+
[childComponentView removeFromSuperview];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
|
|
90
|
+
const auto &oldViewProps =
|
|
91
|
+
*std::static_pointer_cast<RNGoogleMobileAdsNativeViewProps const>(_props);
|
|
92
|
+
const auto &newViewProps =
|
|
93
|
+
*std::static_pointer_cast<RNGoogleMobileAdsNativeViewProps const>(props);
|
|
94
|
+
|
|
95
|
+
if (oldViewProps.responseId != newViewProps.responseId) {
|
|
96
|
+
NSString *responseId = [[NSString alloc] initWithUTF8String:newViewProps.responseId.c_str()];
|
|
97
|
+
[self setResponseId:responseId];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[super updateProps:props oldProps:oldProps];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args {
|
|
104
|
+
RCTRNGoogleMobileAdsNativeViewHandleCommand(self, commandName, args);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (UIView *)findViewByTag:(NSInteger)targetTag inView:(UIView *)parentView {
|
|
108
|
+
for (UIView *subview in parentView.subviews) {
|
|
109
|
+
if (subview.tag == targetTag) {
|
|
110
|
+
return subview;
|
|
111
|
+
}
|
|
112
|
+
if ([subview isKindOfClass:[RCTViewComponentView class]]) {
|
|
113
|
+
UIView *contentView = ((RCTViewComponentView *)subview).contentView;
|
|
114
|
+
if (contentView && contentView.tag == targetTag) {
|
|
115
|
+
return contentView;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
UIView *found = [self findViewByTag:targetTag inView:subview];
|
|
119
|
+
if (found) return found;
|
|
120
|
+
}
|
|
121
|
+
return nil;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#else
|
|
125
|
+
#pragma mark - Paper specific
|
|
126
|
+
|
|
127
|
+
- (instancetype)initWithBridge:(RCTBridge *)bridge {
|
|
128
|
+
if (self = [super init]) {
|
|
129
|
+
_bridge = bridge;
|
|
130
|
+
_nativeModule = [_bridge moduleForClass:RNGoogleMobileAdsNativeModule.class];
|
|
131
|
+
_nativeAdView = self;
|
|
132
|
+
}
|
|
133
|
+
return self;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
137
|
+
|
|
138
|
+
#pragma mark - Common logics
|
|
139
|
+
|
|
140
|
+
- (void)setResponseId:(NSString *)responseId {
|
|
141
|
+
_responseId = responseId;
|
|
142
|
+
_nativeAd = [_nativeModule nativeAdForResponseId:responseId];
|
|
143
|
+
[self reloadAd];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
- (void)registerAsset:(NSString *)assetType reactTag:(NSInteger)reactTag {
|
|
147
|
+
RCTExecuteOnMainQueue(^{
|
|
148
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
149
|
+
UIView *view = [self findViewByTag:reactTag inView:_nativeAdView];
|
|
150
|
+
if (!view) {
|
|
151
|
+
view = [self findViewByTag:reactTag inView:self];
|
|
152
|
+
}
|
|
153
|
+
#else
|
|
154
|
+
UIView *view = [_bridge.uiManager viewForReactTag:@(reactTag)];
|
|
155
|
+
#endif
|
|
156
|
+
if (!view) {
|
|
157
|
+
RCTLogError(@"Cannot find NativeAssetView with tag #%zd while registering asset type %@",
|
|
158
|
+
reactTag, assetType);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if ([assetType isEqual:@"media"] && [view isKindOfClass:RNGoogleMobileAdsMediaView.class]) {
|
|
163
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
164
|
+
GADMediaView *mediaView = ((RNGoogleMobileAdsMediaView *)view).contentView;
|
|
165
|
+
#else
|
|
166
|
+
GADMediaView *mediaView = (RNGoogleMobileAdsMediaView *) view;
|
|
167
|
+
#endif
|
|
168
|
+
[_nativeAdView setMediaView:mediaView];
|
|
169
|
+
[self reloadAd];
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
NSDictionary *viewMappings = @{
|
|
174
|
+
@"advertiser" : @"advertiserView",
|
|
175
|
+
@"body" : @"bodyView",
|
|
176
|
+
@"callToAction" : @"callToActionView",
|
|
177
|
+
@"headline" : @"headlineView",
|
|
178
|
+
@"price" : @"priceView",
|
|
179
|
+
@"store" : @"storeView",
|
|
180
|
+
@"starRating" : @"starRatingView",
|
|
181
|
+
@"icon" : @"iconView",
|
|
182
|
+
@"image" : @"imageView",
|
|
183
|
+
};
|
|
184
|
+
NSString *property = viewMappings[assetType];
|
|
185
|
+
if (property) {
|
|
186
|
+
view.userInteractionEnabled = NO;
|
|
187
|
+
[_nativeAdView setValue:view forKey:property];
|
|
188
|
+
[self reloadAd];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
- (void)reloadAd {
|
|
194
|
+
if (_debouncedReload != nil) {
|
|
195
|
+
dispatch_block_cancel(_debouncedReload);
|
|
196
|
+
}
|
|
197
|
+
_debouncedReload = dispatch_block_create(DISPATCH_BLOCK_NO_QOS_CLASS, ^{
|
|
198
|
+
if (_nativeAd != nil) {
|
|
199
|
+
_nativeAdView.nativeAd = _nativeAd;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC);
|
|
203
|
+
dispatch_after(time, dispatch_get_main_queue(), _debouncedReload);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (void)dealloc {
|
|
207
|
+
_nativeAdView = nil;
|
|
208
|
+
if (_debouncedReload != nil) {
|
|
209
|
+
dispatch_block_cancel(_debouncedReload);
|
|
210
|
+
_debouncedReload = nil;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@end
|
|
215
|
+
|
|
216
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
217
|
+
|
|
218
|
+
@implementation RNGoogleMobileAdsNativeViewManager
|
|
219
|
+
|
|
220
|
+
RCT_EXPORT_MODULE(RNGoogleMobileAdsNativeView)
|
|
221
|
+
|
|
222
|
+
RCT_EXPORT_VIEW_PROPERTY(responseId, NSString)
|
|
223
|
+
|
|
224
|
+
- (UIView *)view {
|
|
225
|
+
return [[RNGoogleMobileAdsNativeView alloc] initWithBridge:self.bridge];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
RCT_EXPORT_METHOD(registerAsset
|
|
229
|
+
: (nonnull NSNumber *)reactTag assetType
|
|
230
|
+
: (nonnull NSString *)assetType assetReactTag
|
|
231
|
+
: (nonnull NSNumber *)assetReactTag) {
|
|
232
|
+
[self.bridge.uiManager
|
|
233
|
+
addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
234
|
+
RNGoogleMobileAdsNativeView *view = viewRegistry[reactTag];
|
|
235
|
+
if (!view || ![view isKindOfClass:[RNGoogleMobileAdsNativeView class]]) {
|
|
236
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
[view registerAsset:assetType reactTag:assetReactTag.intValue];
|
|
240
|
+
}];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@end
|
|
244
|
+
|
|
245
|
+
#endif
|
|
246
|
+
|
|
247
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
248
|
+
Class<RCTComponentViewProtocol> RNGoogleMobileAdsNativeViewCls(void) {
|
|
249
|
+
return RNGoogleMobileAdsNativeView.class;
|
|
250
|
+
}
|
|
251
|
+
#endif
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsRewardedInterstitialModule
|
|
26
|
+
: NSObject <NativeRewardedInterstitialModuleSpec>
|
|
27
|
+
|
|
28
|
+
#else
|
|
29
|
+
|
|
30
|
+
#import <React/RCTBridgeModule.h>
|
|
31
|
+
@interface RNGoogleMobileAdsRewardedInterstitialModule : NSObject <RCTBridgeModule>
|
|
32
|
+
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
@end
|
|
36
|
+
|
|
37
|
+
#endif
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsRewardedInterstitialModule.h"
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
24
|
+
#endif
|
|
25
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
26
|
+
#import "RNGoogleMobileAdsFullScreenAd.h"
|
|
27
|
+
|
|
28
|
+
@interface RNGoogleMobileAdsRewardedInterstitialAd : RNGoogleMobileAdsFullScreenAd
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation RNGoogleMobileAdsRewardedInterstitialAd
|
|
33
|
+
|
|
34
|
+
- (NSString *)getAdEventName {
|
|
35
|
+
return GOOGLE_MOBILE_ADS_EVENT_REWARDED_INTERSTITIAL;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
39
|
+
adRequest:(GAMRequest *)adRequest
|
|
40
|
+
completionHandler:(void (^)(GADRewardedInterstitialAd *_Nullable ad,
|
|
41
|
+
NSError *_Nullable error))completionHandler {
|
|
42
|
+
[GADRewardedInterstitialAd loadWithAdUnitID:adUnitId
|
|
43
|
+
request:adRequest
|
|
44
|
+
completionHandler:completionHandler];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@end
|
|
48
|
+
|
|
49
|
+
@implementation RNGoogleMobileAdsRewardedInterstitialModule {
|
|
50
|
+
RNGoogleMobileAdsRewardedInterstitialAd *_ad;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
RCT_EXPORT_MODULE();
|
|
54
|
+
|
|
55
|
+
- (dispatch_queue_t)methodQueue {
|
|
56
|
+
return dispatch_get_main_queue();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
60
|
+
return YES;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
RCT_EXPORT_METHOD(rewardedInterstitialLoad
|
|
64
|
+
: (double)requestId adUnitId
|
|
65
|
+
: (NSString *)adUnitId requestOptions
|
|
66
|
+
: (NSDictionary *)requestOptions) {
|
|
67
|
+
[_ad loadWithRequestId:requestId adUnitId:adUnitId adRequestOptions:requestOptions];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
RCT_EXPORT_METHOD(rewardedInterstitialShow
|
|
71
|
+
: (double)requestId adUnitId
|
|
72
|
+
: (NSString *)adUnitId showOptions
|
|
73
|
+
: (NSDictionary *)showOptions resolve
|
|
74
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
75
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
76
|
+
[_ad showWithRequestId:requestId
|
|
77
|
+
adUnitId:adUnitId
|
|
78
|
+
showOptions:showOptions
|
|
79
|
+
resolve:resolve
|
|
80
|
+
reject:reject];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
RCT_EXPORT_METHOD(invalidate) { [_ad invalidate]; }
|
|
84
|
+
|
|
85
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
86
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
87
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
88
|
+
return std::make_shared<facebook::react::NativeRewardedInterstitialModuleSpecJSI>(params);
|
|
89
|
+
}
|
|
90
|
+
#endif
|
|
91
|
+
|
|
92
|
+
- (instancetype)init {
|
|
93
|
+
self = [super init];
|
|
94
|
+
if (self) {
|
|
95
|
+
_ad = [[RNGoogleMobileAdsRewardedInterstitialAd alloc] init];
|
|
96
|
+
}
|
|
97
|
+
return self;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (void)dealloc {
|
|
101
|
+
[self invalidate];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@end
|
|
105
|
+
|
|
106
|
+
#endif
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsRewardedModule : NSObject <NativeRewardedModuleSpec>
|
|
26
|
+
|
|
27
|
+
#else
|
|
28
|
+
|
|
29
|
+
#import <React/RCTBridgeModule.h>
|
|
30
|
+
@interface RNGoogleMobileAdsRewardedModule : NSObject <RCTBridgeModule>
|
|
31
|
+
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
#endif
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsRewardedModule.h"
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
24
|
+
#endif
|
|
25
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
26
|
+
#import "RNGoogleMobileAdsFullScreenAd.h"
|
|
27
|
+
|
|
28
|
+
@interface RNGoogleMobileAdsRewardedAd : RNGoogleMobileAdsFullScreenAd
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation RNGoogleMobileAdsRewardedAd
|
|
33
|
+
|
|
34
|
+
- (NSString *)getAdEventName {
|
|
35
|
+
return GOOGLE_MOBILE_ADS_EVENT_REWARDED;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
39
|
+
adRequest:(GAMRequest *)adRequest
|
|
40
|
+
completionHandler:
|
|
41
|
+
(void (^)(GADRewardedAd *_Nullable ad, NSError *_Nullable error))completionHandler {
|
|
42
|
+
[GADRewardedAd loadWithAdUnitID:adUnitId request:adRequest completionHandler:completionHandler];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@end
|
|
46
|
+
|
|
47
|
+
@implementation RNGoogleMobileAdsRewardedModule {
|
|
48
|
+
RNGoogleMobileAdsRewardedAd *_ad;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_MODULE();
|
|
52
|
+
|
|
53
|
+
- (dispatch_queue_t)methodQueue {
|
|
54
|
+
return dispatch_get_main_queue();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
58
|
+
return YES;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
RCT_EXPORT_METHOD(rewardedLoad
|
|
62
|
+
: (double)requestId adUnitId
|
|
63
|
+
: (NSString *)adUnitId requestOptions
|
|
64
|
+
: (NSDictionary *)requestOptions) {
|
|
65
|
+
[_ad loadWithRequestId:requestId adUnitId:adUnitId adRequestOptions:requestOptions];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
RCT_EXPORT_METHOD(rewardedShow
|
|
69
|
+
: (double)requestId adUnitId
|
|
70
|
+
: (NSString *)adUnitId showOptions
|
|
71
|
+
: (NSDictionary *)showOptions resolve
|
|
72
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
73
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
74
|
+
[_ad showWithRequestId:requestId
|
|
75
|
+
adUnitId:adUnitId
|
|
76
|
+
showOptions:showOptions
|
|
77
|
+
resolve:resolve
|
|
78
|
+
reject:reject];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
RCT_EXPORT_METHOD(invalidate) { [_ad invalidate]; }
|
|
82
|
+
|
|
83
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
84
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
85
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
86
|
+
return std::make_shared<facebook::react::NativeRewardedModuleSpecJSI>(params);
|
|
87
|
+
}
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
- (instancetype)init {
|
|
91
|
+
self = [super init];
|
|
92
|
+
if (self) {
|
|
93
|
+
_ad = [[RNGoogleMobileAdsRewardedAd alloc] init];
|
|
94
|
+
}
|
|
95
|
+
return self;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)dealloc {
|
|
99
|
+
[self invalidate];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@end
|
|
103
|
+
|
|
104
|
+
#endif
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#import <Foundation/Foundation.h>
|
|
19
|
+
|
|
20
|
+
#import <React/RCTBridgeModule.h>
|
|
21
|
+
|
|
22
|
+
@interface RNAppModule : NSObject <RCTBridgeModule>
|
|
23
|
+
|
|
24
|
+
@end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#import <React/RCTUtils.h>
|
|
19
|
+
|
|
20
|
+
#import "RNAppModule.h"
|
|
21
|
+
#import "RNRCTEventEmitter.h"
|
|
22
|
+
#import "RNSharedUtils.h"
|
|
23
|
+
|
|
24
|
+
@implementation RNAppModule
|
|
25
|
+
|
|
26
|
+
#pragma mark -
|
|
27
|
+
#pragma mark Module Setup
|
|
28
|
+
|
|
29
|
+
RCT_EXPORT_MODULE();
|
|
30
|
+
|
|
31
|
+
- (dispatch_queue_t)methodQueue {
|
|
32
|
+
return dispatch_get_main_queue();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (void)setBridge:(RCTBridge *)bridge {
|
|
36
|
+
[RNRCTEventEmitter shared].bridge = bridge;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
- (RCTBridge *)bridge {
|
|
40
|
+
return [RNRCTEventEmitter shared].bridge;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (id)init {
|
|
44
|
+
return self;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)invalidate {
|
|
48
|
+
[[RNRCTEventEmitter shared] invalidate];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#pragma mark -
|
|
52
|
+
#pragma mark Event Methods
|
|
53
|
+
|
|
54
|
+
RCT_EXPORT_METHOD(eventsNotifyReady : (BOOL)ready) {
|
|
55
|
+
[[RNRCTEventEmitter shared] notifyJsReady:ready];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
RCT_EXPORT_METHOD(eventsGetListeners
|
|
59
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
|
60
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
61
|
+
resolve([[RNRCTEventEmitter shared] getListenersDictionary]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RCT_EXPORT_METHOD(eventsPing
|
|
65
|
+
: (NSString *)eventName eventBody
|
|
66
|
+
: (NSDictionary *)eventBody resolver
|
|
67
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
|
68
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
69
|
+
[[RNRCTEventEmitter shared] sendEventWithName:eventName body:eventBody];
|
|
70
|
+
resolve(eventBody);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
RCT_EXPORT_METHOD(eventsAddListener : (NSString *)eventName) {
|
|
74
|
+
[[RNRCTEventEmitter shared] addListener:eventName];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
RCT_EXPORT_METHOD(eventsRemoveListener : (NSString *)eventName all : (BOOL)all) {
|
|
78
|
+
[[RNRCTEventEmitter shared] removeListeners:eventName all:all];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#pragma mark -
|
|
82
|
+
#pragma mark Events Unused
|
|
83
|
+
|
|
84
|
+
RCT_EXPORT_METHOD(addListener : (NSString *)eventName) {
|
|
85
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
RCT_EXPORT_METHOD(removeListeners : (NSInteger)count) {
|
|
89
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
93
|
+
return YES;
|
|
94
|
+
}
|
|
95
|
+
@end
|