react-native-google-mobile-ads 14.4.2 → 14.4.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/README.md CHANGED
@@ -31,19 +31,24 @@ React Native Google Mobile Ads is built with three key principals in mind;
31
31
  - full reference & installation documentation alongside detailed guides and FAQs
32
32
 
33
33
  ## Migrating to the New Architecture Status (backwards compatible)
34
+
34
35
  This package can be used in both The Old and [The New Architecture](https://reactnative.dev/docs/the-new-architecture/landing-page).
35
36
  When using The New Architecture, some legacy code will still be used though. See status below:
36
37
 
37
- - **iOS**
38
- - Mobile Ads SDK Methods (Turbo Native Module) 🟢🟢🟢🟢
39
- - Banners (Fabric Native Component) 🟢🟢🟢🟢
40
- - Full Screen Ads (Turbo Native Module) ⚪⚪⚪⚪
41
- - User Messaging Platform (Turbo Native Module) ⚪⚪⚪⚪
42
- - **Android**
43
- - Mobile Ads SDK Methods (Turbo Native Module) ⚪⚪⚪⚪
44
- - Banners (Fabric Native Component) ⚪⚪⚪⚪
45
- - Full Screen Ads (Turbo Native Module) ⚪⚪⚪⚪
46
- - User Messaging Platform (Turbo Native Module) ⚪⚪⚪⚪
38
+ | Platform | Feature | Status |
39
+ | -------- | ------------------------------------------------- | ----------- |
40
+ | iOS | Mobile Ads SDK Methods (Turbo Native Module) | ✅ Complete |
41
+ | iOS | Banners (Fabric Native Component) | ✅ Complete |
42
+ | iOS | Full Screen Ads (Turbo Native Module) | ⏳ To-Do |
43
+ | iOS | User Messaging Platform (Turbo Native Module) | ⏳ To-Do |
44
+ | iOS | EventEmitter (Turbo Native Module) | ⏳ To-Do |
45
+ | iOS | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do |
46
+ | Android | Mobile Ads SDK Methods (Turbo Native Module) | ⏳ To-Do |
47
+ | Android | Banners (Fabric Native Component) | ⏳ To-Do |
48
+ | Android | Full Screen Ads (Turbo Native Module) | ⏳ To-Do |
49
+ | Android | User Messaging Platform (Turbo Native Module) | ⏳ To-Do |
50
+ | Android | EventEmitter (Turbo Native Module) | ⏳ To-Do |
51
+ | Android | Revenue Precision Constants (Turbo Native Module) | ⏳ To-Do |
47
52
 
48
53
  ## Documentation
49
54
 
@@ -95,7 +95,12 @@ class ReactNativeGoogleMobileAdsModule(
95
95
  @ReactMethod
96
96
  fun initialize(promise: Promise) {
97
97
  MobileAds.initialize(
98
- reactApplicationContext,
98
+ // in react-native, the Activity instance *may* go away, becoming null after initialize
99
+ // it is not clear if that can happen here without an initialize necessarily following the Activity lifecycle
100
+ // it is not clear if that will cause problems even if it happens, but users that have widely deployed this
101
+ // with the use of currentActivity have not seen problems
102
+ // reference if it needs attention: https://github.com/invertase/react-native-google-mobile-ads/pull/664
103
+ currentActivity ?: reactApplicationContext,
99
104
  OnInitializationCompleteListener { initializationStatus ->
100
105
  val result = Arguments.createArray()
101
106
  for ((key, value) in initializationStatus.adapterStatusMap) {
@@ -91,7 +91,7 @@ To listen to events, such as when the advert from the network has loaded or when
91
91
 
92
92
  ```jsx
93
93
  import React, { useEffect, useState } from 'react';
94
- import { Button } from 'react-native';
94
+ import { Button, Platform, StatusBar } from 'react-native';
95
95
  import { InterstitialAd, AdEventType, TestIds } from 'react-native-google-mobile-ads';
96
96
 
97
97
  const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
@@ -104,15 +104,32 @@ function App() {
104
104
  const [loaded, setLoaded] = useState(false);
105
105
 
106
106
  useEffect(() => {
107
- const unsubscribe = interstitial.addAdEventListener(AdEventType.LOADED, () => {
107
+ const unsubscribeLoaded = interstitial.addAdEventListener(AdEventType.LOADED, () => {
108
108
  setLoaded(true);
109
109
  });
110
110
 
111
+ const unsubscribeOpened = interstitial.addAdEventListener(AdEventType.OPENED, () => {
112
+ if (Platform.OS === 'ios') {
113
+ // Prevent the close button from being unreachable by hiding the status bar on iOS
114
+ StatusBar.setHidden(true)
115
+ }
116
+ });
117
+
118
+ const unsubscribeClosed = interstitial.addAdEventListener(AdEventType.CLOSED, () => {
119
+ if (Platform.OS === 'ios') {
120
+ StatusBar.setHidden(false)
121
+ }
122
+ });
123
+
111
124
  // Start loading the interstitial straight away
112
125
  interstitial.load();
113
126
 
114
127
  // Unsubscribe from events on unmount
115
- return unsubscribe;
128
+ return () => {
129
+ unsubscribeLoaded();
130
+ unsubscribeOpened();
131
+ unsubscribeClosed();
132
+ };
116
133
  }, []);
117
134
 
118
135
  // No advert ready to show yet
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- const version = exports.version = '14.4.2';
8
+ const version = exports.version = '14.4.3';
9
9
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '14.4.2';
2
+ export const version = '14.4.3';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "14.4.2";
1
+ export declare const SDK_VERSION = "14.4.3";
2
2
  export { default, MobileAds } from './MobileAds';
3
3
  export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
4
4
  export { AdsConsentPurposes } from './AdsConsentPurposes';
@@ -1,2 +1,2 @@
1
- export declare const version = "14.4.2";
1
+ export declare const version = "14.4.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-mobile-ads",
3
- "version": "14.4.2",
3
+ "version": "14.4.3",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
6
6
  "main": "lib/commonjs/index.js",
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '14.4.2';
2
+ export const version = '14.4.3';