react-native-google-mobile-ads 14.8.1 → 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/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.mm +2 -4
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +1 -5
- 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/types/RequestOptions.d.ts +2 -4
- package/lib/typescript/types/RequestOptions.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/types/RequestOptions.ts +2 -2
- 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();
|
|
@@ -118,10 +118,8 @@ NSString *const GOOGLE_MOBILE_ADS_EVENT_REWARDED_EARNED_REWARD = @"rewarded_earn
|
|
|
118
118
|
code = @"internal-error";
|
|
119
119
|
} else if (error.code == GADErrorInvalidArgument) {
|
|
120
120
|
code = @"invalid-argument";
|
|
121
|
-
} else if (error.code ==
|
|
122
|
-
code = @"received-invalid-
|
|
123
|
-
} else if (error.code == GADErrorMediationNoFill) {
|
|
124
|
-
code = @"mediation-no-fill";
|
|
121
|
+
} else if (error.code == GADErrorReceivedInvalidAdString) {
|
|
122
|
+
code = @"received-invalid-ad-string";
|
|
125
123
|
} else if (error.code == GADErrorAdAlreadyUsed) {
|
|
126
124
|
code = @"ad-already-used";
|
|
127
125
|
} else if (error.code == GADErrorApplicationIdentifierMissing) {
|
|
@@ -146,11 +146,7 @@ RCT_EXPORT_METHOD(setAppMuted : (BOOL *)muted) {
|
|
|
146
146
|
if (requestConfiguration[@"testDeviceIdentifiers"]) {
|
|
147
147
|
NSMutableArray *devices = [@[] mutableCopy];
|
|
148
148
|
for (NSString *key in requestConfiguration[@"testDeviceIdentifiers"]) {
|
|
149
|
-
|
|
150
|
-
[devices addObject:GADSimulatorID];
|
|
151
|
-
} else {
|
|
152
|
-
[devices addObject:key];
|
|
153
|
-
}
|
|
149
|
+
[devices addObject:key];
|
|
154
150
|
}
|
|
155
151
|
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = devices;
|
|
156
152
|
}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.
|
|
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';
|
|
@@ -71,11 +71,9 @@ export interface RequestOptions {
|
|
|
71
71
|
/**
|
|
72
72
|
* key-value pairs used for custom targeting
|
|
73
73
|
*
|
|
74
|
-
* Takes an object of keys with values of string or
|
|
74
|
+
* Takes an object of keys with values of string, number, or arrays of strings/numbers.
|
|
75
75
|
*/
|
|
76
|
-
customTargeting?:
|
|
77
|
-
[key: string]: string | string[];
|
|
78
|
-
};
|
|
76
|
+
customTargeting?: Record<string, string | number | (string | number)[]>;
|
|
79
77
|
/**
|
|
80
78
|
* Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile
|
|
81
79
|
* Ads SDK should call this method to denote the platform from which the ad request originated. For example, if a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestOptions.d.ts","sourceRoot":"","sources":["../../../src/types/RequestOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,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,CAAC,EAAE,CAAC,CAAC;IAExE;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;IAE9D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "14.
|
|
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.
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"sdkVersions": {
|
|
45
45
|
"ios": {
|
|
46
|
-
"googleMobileAds": "
|
|
46
|
+
"googleMobileAds": "12.0.0",
|
|
47
47
|
"googleUmp": "2.7.0"
|
|
48
48
|
},
|
|
49
49
|
"android": {
|
|
@@ -74,9 +74,9 @@ export interface RequestOptions {
|
|
|
74
74
|
/**
|
|
75
75
|
* key-value pairs used for custom targeting
|
|
76
76
|
*
|
|
77
|
-
* Takes an object of keys with values of string or
|
|
77
|
+
* Takes an object of keys with values of string, number, or arrays of strings/numbers.
|
|
78
78
|
*/
|
|
79
|
-
customTargeting?:
|
|
79
|
+
customTargeting?: Record<string, string | number | (string | number)[]>;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Sets the request agent string to identify the ad request's origin. Third party libraries that reference the Mobile
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '14.
|
|
2
|
+
export const version = '14.9.1';
|