@capacitor-community/admob 8.1.0-beta.pr462.sha2032c4d5e682 → 8.1.0-beta.pr467.shae026ce60ff8a
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/main/java/com/getcapacitor/community/admob/AdMob.java +4 -1
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerExecutor.java +24 -18
- package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdManager.swift +1 -1
- package/ios/Sources/AdMobPlugin/Banner/BannerExecutor.swift +1 -1
- package/ios/Sources/AdMobPlugin/Interstitial/AdInterstitialExecutor.swift +1 -1
- package/ios/Sources/AdMobPlugin/Rewarded/AdRewardExecutor.swift +1 -1
- package/ios/Sources/AdMobPlugin/RewardedInterstitial/AdRewardInterstitialExecutor.swift +1 -1
- package/package.json +1 -1
|
@@ -192,7 +192,10 @@ public class AdMob extends Plugin {
|
|
|
192
192
|
|
|
193
193
|
@PluginMethod
|
|
194
194
|
public void showBanner(final PluginCall call) {
|
|
195
|
-
|
|
195
|
+
boolean systemBarsHandlesInsets = !"disable".equals(
|
|
196
|
+
getBridge().getConfig().getPluginConfiguration("SystemBars").getString("insetsHandling", "css")
|
|
197
|
+
);
|
|
198
|
+
bannerExecutor.showBanner(call, systemBarsHandlesInsets);
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
@PluginMethod
|
|
@@ -2,7 +2,6 @@ package com.getcapacitor.community.admob.banner;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.Context;
|
|
5
|
-
import android.os.Build;
|
|
6
5
|
import android.os.Handler;
|
|
7
6
|
import android.os.Looper;
|
|
8
7
|
import android.util.DisplayMetrics;
|
|
@@ -15,8 +14,10 @@ import android.view.WindowManager;
|
|
|
15
14
|
import android.widget.RelativeLayout;
|
|
16
15
|
import androidx.annotation.NonNull;
|
|
17
16
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
17
|
+
import androidx.core.graphics.Insets;
|
|
18
18
|
import androidx.core.util.Consumer;
|
|
19
19
|
import androidx.core.util.Supplier;
|
|
20
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
20
21
|
import com.getcapacitor.JSObject;
|
|
21
22
|
import com.getcapacitor.PluginCall;
|
|
22
23
|
import com.getcapacitor.community.admob.helpers.AdViewIdHelper;
|
|
@@ -161,7 +162,7 @@ public class BannerExecutor extends Executor {
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
public void showBanner(final PluginCall call) {
|
|
165
|
+
public void showBanner(final PluginCall call, boolean systemBarsHandlesInsets) {
|
|
165
166
|
final AdOptions adOptions = AdOptions.getFactory().createBannerOptions(call);
|
|
166
167
|
float density = contextSupplier.get().getResources().getDisplayMetrics().density;
|
|
167
168
|
|
|
@@ -243,23 +244,27 @@ public class BannerExecutor extends Executor {
|
|
|
243
244
|
mAdViewLayoutParams.setMargins(sideMargin, densityMargin, sideMargin, densityMargin);
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
//
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
// Use the insets remaining after Capacitor's parent layout has handled them.
|
|
248
|
+
// Replacing the decor-view listener would override SystemBars' safe-area handling.
|
|
249
|
+
mAdViewLayout.setOnApplyWindowInsetsListener((v, insets) -> {
|
|
250
|
+
WindowInsetsCompat compat = WindowInsetsCompat.toWindowInsetsCompat(insets, v);
|
|
251
|
+
Insets safeArea = compat.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout());
|
|
252
|
+
boolean keyboardVisible =
|
|
253
|
+
compat.isVisible(WindowInsetsCompat.Type.ime()) && compat.getInsets(WindowInsetsCompat.Type.ime()).bottom > 0;
|
|
254
|
+
// SystemBars already pads the parent for the keyboard. Neither the IME
|
|
255
|
+
// height nor the navigation bar belongs in the banner's margin then.
|
|
256
|
+
// With insetsHandling=disable, the host app owns keyboard avoidance.
|
|
257
|
+
int bottomInset = keyboardVisible && systemBarsHandlesInsets ? 0 : safeArea.bottom;
|
|
258
|
+
|
|
259
|
+
if ("TOP_CENTER".equals(adOptions.position)) {
|
|
260
|
+
mAdViewLayoutParams.setMargins(margins[0], margins[1] + safeArea.top, margins[2], margins[3]);
|
|
261
|
+
} else {
|
|
262
|
+
mAdViewLayoutParams.setMargins(margins[0], margins[1], margins[2], margins[3] + bottomInset);
|
|
263
|
+
}
|
|
258
264
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
265
|
+
v.setLayoutParams(mAdViewLayoutParams);
|
|
266
|
+
return insets;
|
|
267
|
+
});
|
|
263
268
|
|
|
264
269
|
createNewAdView(adOptions);
|
|
265
270
|
|
|
@@ -469,6 +474,7 @@ public class BannerExecutor extends Executor {
|
|
|
469
474
|
final ViewGroup bannerParent = resolveViewGroup();
|
|
470
475
|
if (bannerParent != null) {
|
|
471
476
|
bannerParent.addView(mAdViewLayout);
|
|
477
|
+
mAdViewLayout.requestApplyInsets();
|
|
472
478
|
} else {
|
|
473
479
|
Log.w(logTag, "Banner not attached: parent unavailable");
|
|
474
480
|
}
|
|
@@ -38,7 +38,7 @@ import UIKit
|
|
|
38
38
|
let networkName = ad.responseInfo.loadedAdNetworkResponseInfo?.adNetworkClassName ?? ""
|
|
39
39
|
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
40
40
|
onPaidEvent(
|
|
41
|
-
adValue.value.int64Value,
|
|
41
|
+
adValue.value.multiplying(byPowerOf10: 6).int64Value,
|
|
42
42
|
adValue.currencyCode,
|
|
43
43
|
adValue.precision.rawValue,
|
|
44
44
|
networkName,
|
|
@@ -55,7 +55,7 @@ class BannerExecutor: NSObject, BannerViewDelegate {
|
|
|
55
55
|
let impressionId = self.bannerView.responseInfo?.responseIdentifier ?? ""
|
|
56
56
|
self.plugin?.notifyListeners(BannerAdPluginEvents.AdPaid.rawValue, data: [
|
|
57
57
|
"adUnitId": self.bannerView.adUnitID ?? "",
|
|
58
|
-
"valueMicros": adValue.value.int64Value,
|
|
58
|
+
"valueMicros": adValue.value.multiplying(byPowerOf10: 6).int64Value,
|
|
59
59
|
"currencyCode": adValue.currencyCode,
|
|
60
60
|
"precision": adValue.precision.rawValue,
|
|
61
61
|
"networkName": networkName,
|
|
@@ -30,7 +30,7 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
30
30
|
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
31
31
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.AdImpression.rawValue, data: [
|
|
32
32
|
"adUnitId": adUnitID,
|
|
33
|
-
"valueMicros": adValue.value.int64Value,
|
|
33
|
+
"valueMicros": adValue.value.multiplying(byPowerOf10: 6).int64Value,
|
|
34
34
|
"currencyCode": adValue.currencyCode,
|
|
35
35
|
"precision": adValue.precision.rawValue,
|
|
36
36
|
"networkName": networkName,
|
|
@@ -50,7 +50,7 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
50
50
|
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
51
51
|
self.plugin?.notifyListeners(RewardAdPluginEvents.AdImpression.rawValue, data: [
|
|
52
52
|
"adUnitId": adUnitID,
|
|
53
|
-
"valueMicros": adValue.value.int64Value,
|
|
53
|
+
"valueMicros": adValue.value.multiplying(byPowerOf10: 6).int64Value,
|
|
54
54
|
"currencyCode": adValue.currencyCode,
|
|
55
55
|
"precision": adValue.precision.rawValue,
|
|
56
56
|
"networkName": networkName,
|
|
@@ -50,7 +50,7 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
50
50
|
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
51
51
|
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.AdImpression.rawValue, data: [
|
|
52
52
|
"adUnitId": adUnitID,
|
|
53
|
-
"valueMicros": adValue.value.int64Value,
|
|
53
|
+
"valueMicros": adValue.value.multiplying(byPowerOf10: 6).int64Value,
|
|
54
54
|
"currencyCode": adValue.currencyCode,
|
|
55
55
|
"precision": adValue.precision.rawValue,
|
|
56
56
|
"networkName": networkName,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/admob",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "8.1.0-beta.
|
|
4
|
+
"version": "8.1.0-beta.pr467.shae026ce60ff8a",
|
|
5
5
|
"description": "A native plugin for AdMob",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|