react-native-google-mobile-ads 14.9.0 → 14.9.1
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/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerDelegate.java +5 -2
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerDelegate.java +5 -2
- package/docs/european-user-consent.mdx +18 -19
- package/lib/commonjs/version.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/version.ts +1 -1
|
@@ -3,12 +3,15 @@ package com.facebook.react.viewmanagers;
|
|
|
3
3
|
import android.view.View;
|
|
4
4
|
import androidx.annotation.NonNull;
|
|
5
5
|
import androidx.annotation.Nullable;
|
|
6
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
6
7
|
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
7
|
-
import com.facebook.react.uimanager.
|
|
8
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
8
9
|
|
|
9
10
|
public class RNGoogleMobileAdsMediaViewManagerDelegate<
|
|
10
11
|
T extends View,
|
|
11
|
-
U extends
|
|
12
|
+
U extends
|
|
13
|
+
BaseViewManager<T, ? extends LayoutShadowNode>
|
|
14
|
+
& RNGoogleMobileAdsMediaViewManagerInterface<T>>
|
|
12
15
|
extends BaseViewManagerDelegate<T, U> {
|
|
13
16
|
public RNGoogleMobileAdsMediaViewManagerDelegate(U viewManager) {
|
|
14
17
|
super(viewManager);
|
|
@@ -4,12 +4,15 @@ import android.view.View;
|
|
|
4
4
|
import androidx.annotation.NonNull;
|
|
5
5
|
import androidx.annotation.Nullable;
|
|
6
6
|
import com.facebook.react.bridge.ReadableArray;
|
|
7
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
7
8
|
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
8
|
-
import com.facebook.react.uimanager.
|
|
9
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
9
10
|
|
|
10
11
|
public class RNGoogleMobileAdsNativeViewManagerDelegate<
|
|
11
12
|
T extends View,
|
|
12
|
-
U extends
|
|
13
|
+
U extends
|
|
14
|
+
BaseViewManager<T, ? extends LayoutShadowNode>
|
|
15
|
+
& RNGoogleMobileAdsNativeViewManagerInterface<T>>
|
|
13
16
|
extends BaseViewManagerDelegate<T, U> {
|
|
14
17
|
public RNGoogleMobileAdsNativeViewManagerDelegate(U viewManager) {
|
|
15
18
|
super(viewManager);
|
|
@@ -198,27 +198,26 @@ The UMP SDK uses the consent status from the previous session.
|
|
|
198
198
|
```js
|
|
199
199
|
import mobileAds, { AdsConsent, AdsConsentStatus } from 'react-native-google-mobile-ads';
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// using consent obtained in the previous session.
|
|
214
|
-
const {canRequestAds} = await AdsConsent.getConsentInfo()
|
|
215
|
-
if (canRequestAds) {
|
|
216
|
-
startGoogleMobileAdsSDK()
|
|
217
|
-
}
|
|
201
|
+
const isMobileAdsStartCalledRef = useRef(false);
|
|
202
|
+
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
// Request consent information and load/present a consent form if necessary.
|
|
205
|
+
AdsConsent.gatherConsent()
|
|
206
|
+
.then(startGoogleMobileAdsSDK)
|
|
207
|
+
.catch((error) => console.error('Consent gathering failed:', error));
|
|
208
|
+
|
|
209
|
+
// This sample attempts to load ads using consent obtained in the previous session.
|
|
210
|
+
// We intentionally use .then() chaining (instead of await) to ensure parallel execution.
|
|
211
|
+
startGoogleMobileAdsSDK();
|
|
212
|
+
}, []);
|
|
218
213
|
|
|
219
214
|
async function startGoogleMobileAdsSDK() {
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
const {canRequestAds} = await AdsConsent.getConsentInfo();
|
|
216
|
+
if (!canRequestAds || isMobileAdsStartCalledRef.current) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
isMobileAdsStartCalledRef.current = true;
|
|
222
221
|
|
|
223
222
|
// (Optional, iOS) Handle Apple's App Tracking Transparency manually.
|
|
224
223
|
const gdprApplies = await AdsConsent.getGdprApplies();
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.9.
|
|
1
|
+
export declare const SDK_VERSION = "14.9.1";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography, AdsConsentInfo, AdsConsentInfoOptions, AdsConsentInterface, AdsConsentPrivacyOptionsRequirementStatus, AdsConsentStatus, AdsConsentUserChoices, } from './specs/modules/NativeConsentModule';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "14.9.
|
|
1
|
+
export declare const version = "14.9.1";
|
|
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.9.
|
|
3
|
+
"version": "14.9.1",
|
|
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.9.
|
|
2
|
+
export const version = '14.9.1';
|