react-native-google-mobile-ads 11.6.0 → 11.6.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/README.md +2 -9
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +47 -41
- 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
package/README.md
CHANGED
|
@@ -50,19 +50,12 @@ When using The New Architecture, some legacy code will still be used though. See
|
|
|
50
50
|
- [Installation](https://docs.page/invertase/react-native-google-mobile-ads)
|
|
51
51
|
- [Displaying Ads](https://docs.page/invertase/react-native-google-mobile-ads/displaying-ads)
|
|
52
52
|
|
|
53
|
-
<!--
|
|
54
|
-
- [Quick Start](https://rnfirebase.io/)
|
|
55
|
-
- [Reference API](https://rnfirebase.io/reference) -->
|
|
56
|
-
|
|
57
53
|
## Contributing
|
|
58
54
|
|
|
59
|
-
<!-- - [Overview](https://rnfirebase.io) -->
|
|
60
|
-
|
|
61
55
|
- [Issues](https://github.com/invertase/react-native-google-mobile-ads/issues)
|
|
62
56
|
- [PRs](https://github.com/invertase/react-native-google-mobile-ads/pulls)
|
|
63
|
-
|
|
64
|
-
- [
|
|
65
|
-
- [Code of Conduct](https://github.com/invertase/meta/blob/master/CODE_OF_CONDUCT.md)
|
|
57
|
+
- [Guidelines](https://github.com/invertase/react-native-google-mobile-ads/blob/main/CONTRIBUTING.md)
|
|
58
|
+
- [Code of Conduct](https://github.com/invertase/meta/blob/main/CODE_OF_CONDUCT.md)
|
|
66
59
|
|
|
67
60
|
## License
|
|
68
61
|
|
|
@@ -16,6 +16,7 @@ package io.invertase.googlemobileads;
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
+
import android.app.Activity;
|
|
19
20
|
import android.content.SharedPreferences;
|
|
20
21
|
import android.preference.PreferenceManager;
|
|
21
22
|
import com.facebook.react.bridge.Arguments;
|
|
@@ -96,7 +97,9 @@ public class ReactNativeGoogleMobileAdsConsentModule extends ReactNativeModule {
|
|
|
96
97
|
|
|
97
98
|
ConsentRequestParameters consentRequestParameters = paramsBuilder.build();
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
Activity currentActivity = getCurrentActivity();
|
|
101
|
+
|
|
102
|
+
if (currentActivity == null) {
|
|
100
103
|
rejectPromiseWithCodeAndMessage(
|
|
101
104
|
promise,
|
|
102
105
|
"null-activity",
|
|
@@ -105,7 +108,7 @@ public class ReactNativeGoogleMobileAdsConsentModule extends ReactNativeModule {
|
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
consentInformation.requestConsentInfoUpdate(
|
|
108
|
-
|
|
111
|
+
currentActivity,
|
|
109
112
|
consentRequestParameters,
|
|
110
113
|
() -> {
|
|
111
114
|
WritableMap requestInfoMap = Arguments.createMap();
|
|
@@ -131,37 +134,38 @@ public class ReactNativeGoogleMobileAdsConsentModule extends ReactNativeModule {
|
|
|
131
134
|
@ReactMethod
|
|
132
135
|
public void showForm(final Promise promise) {
|
|
133
136
|
try {
|
|
134
|
-
|
|
137
|
+
Activity currentActivity = getCurrentActivity();
|
|
138
|
+
|
|
139
|
+
if (currentActivity == null) {
|
|
135
140
|
rejectPromiseWithCodeAndMessage(
|
|
136
141
|
promise,
|
|
137
142
|
"null-activity",
|
|
138
143
|
"Consent form attempted to show but the current Activity was null.");
|
|
139
144
|
return;
|
|
140
145
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
promise, "consent-form-error", formError.getMessage())));
|
|
146
|
+
|
|
147
|
+
currentActivity.runOnUiThread(
|
|
148
|
+
() ->
|
|
149
|
+
UserMessagingPlatform.loadConsentForm(
|
|
150
|
+
getReactApplicationContext(),
|
|
151
|
+
consentForm ->
|
|
152
|
+
consentForm.show(
|
|
153
|
+
currentActivity,
|
|
154
|
+
formError -> {
|
|
155
|
+
if (formError != null) {
|
|
156
|
+
rejectPromiseWithCodeAndMessage(
|
|
157
|
+
promise, "consent-form-error", formError.getMessage());
|
|
158
|
+
} else {
|
|
159
|
+
WritableMap consentFormMap = Arguments.createMap();
|
|
160
|
+
consentFormMap.putString(
|
|
161
|
+
"status",
|
|
162
|
+
getConsentStatusString(consentInformation.getConsentStatus()));
|
|
163
|
+
promise.resolve(consentFormMap);
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
formError ->
|
|
167
|
+
rejectPromiseWithCodeAndMessage(
|
|
168
|
+
promise, "consent-form-error", formError.getMessage())));
|
|
165
169
|
} catch (Exception e) {
|
|
166
170
|
rejectPromiseWithCodeAndMessage(promise, "consent-form-error", e.toString());
|
|
167
171
|
}
|
|
@@ -170,26 +174,28 @@ public class ReactNativeGoogleMobileAdsConsentModule extends ReactNativeModule {
|
|
|
170
174
|
@ReactMethod
|
|
171
175
|
public void showPrivacyOptionsForm(final Promise promise) {
|
|
172
176
|
try {
|
|
173
|
-
|
|
177
|
+
Activity currentActivity = getCurrentActivity();
|
|
178
|
+
|
|
179
|
+
if (currentActivity == null) {
|
|
174
180
|
rejectPromiseWithCodeAndMessage(
|
|
175
181
|
promise,
|
|
176
182
|
"null-activity",
|
|
177
183
|
"Privacy options form attempted to show but the current Activity was null.");
|
|
178
184
|
return;
|
|
179
185
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
|
|
187
|
+
currentActivity.runOnUiThread(
|
|
188
|
+
() ->
|
|
189
|
+
UserMessagingPlatform.showPrivacyOptionsForm(
|
|
190
|
+
currentActivity,
|
|
191
|
+
formError -> {
|
|
192
|
+
if (formError != null) {
|
|
193
|
+
rejectPromiseWithCodeAndMessage(
|
|
194
|
+
promise, "privacy-options-form-error", formError.getMessage());
|
|
195
|
+
} else {
|
|
196
|
+
promise.resolve("Privacy options form presented successfully.");
|
|
197
|
+
}
|
|
198
|
+
}));
|
|
193
199
|
} catch (Exception e) {
|
|
194
200
|
rejectPromiseWithCodeAndMessage(promise, "consent-form-error", e.toString());
|
|
195
201
|
}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "11.6.
|
|
1
|
+
export declare const SDK_VERSION = "11.6.1";
|
|
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 = "11.6.
|
|
1
|
+
export declare const version = "11.6.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": "11.6.
|
|
3
|
+
"version": "11.6.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 = '11.6.
|
|
2
|
+
export const version = '11.6.1';
|