@capacitor-community/admob 8.0.1 → 8.1.0
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/CapacitorCommunityAdmob.podspec +1 -1
- package/Package.swift +1 -1
- package/README.md +470 -186
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdManager.kt +7 -1
- package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdPlugin.kt +26 -8
- package/android/src/main/java/com/getcapacitor/community/admob/appopen/AppOpenAdPluginEvents.kt +1 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdPluginEvents.kt +2 -1
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerExecutor.java +79 -29
- package/android/src/main/java/com/getcapacitor/community/admob/helpers/FullscreenPluginCallback.kt +7 -2
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/AdInterstitialExecutor.java +21 -3
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdCallbackAndListeners.kt +12 -2
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdPluginPluginEvent.kt +1 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/AdMobRevenueData.kt +15 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/AdRewardExecutor.java +20 -3
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardAdPluginEvents.kt +1 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardedAdCallbackAndListeners.kt +14 -4
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/AdRewardInterstitialExecutor.java +20 -3
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardInterstitialAdPluginEvents.kt +1 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardedInterstitialAdCallbackAndListeners.kt +14 -3
- package/dist/docs.json +511 -178
- package/dist/esm/app-open/app-open-ad-options.interface.d.ts +6 -0
- package/dist/esm/app-open/app-open-ad-plugin-events.enum.d.ts +20 -1
- package/dist/esm/app-open/app-open-ad-plugin-events.enum.js +19 -0
- package/dist/esm/app-open/app-open-ad-plugin-events.enum.js.map +1 -1
- package/dist/esm/app-open/app-open-definitions.interface.d.ts +31 -8
- package/dist/esm/banner/banner-ad-options.interface.d.ts +5 -6
- package/dist/esm/banner/banner-ad-plugin-events.enum.d.ts +17 -4
- package/dist/esm/banner/banner-ad-plugin-events.enum.js +16 -3
- package/dist/esm/banner/banner-ad-plugin-events.enum.js.map +1 -1
- package/dist/esm/banner/banner-ad-position.enum.d.ts +3 -3
- package/dist/esm/banner/banner-ad-position.enum.js +3 -3
- package/dist/esm/banner/banner-ad-size.enum.d.ts +4 -3
- package/dist/esm/banner/banner-ad-size.enum.js +4 -3
- package/dist/esm/banner/banner-ad-size.enum.js.map +1 -1
- package/dist/esm/banner/banner-definitions.interface.d.ts +17 -10
- package/dist/esm/banner/banner-size.interface.d.ts +8 -1
- package/dist/esm/definitions.d.ts +17 -16
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.d.ts +10 -6
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js +9 -5
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js.map +1 -1
- package/dist/esm/interstitial/interstitial-definitions.interface.d.ts +24 -4
- package/dist/esm/reward/reward-ad-options.interface.d.ts +7 -6
- package/dist/esm/reward/reward-ad-plugin-events.enum.d.ts +13 -12
- package/dist/esm/reward/reward-ad-plugin-events.enum.js +12 -11
- package/dist/esm/reward/reward-ad-plugin-events.enum.js.map +1 -1
- package/dist/esm/reward/reward-definitions.interface.d.ts +27 -4
- package/dist/esm/reward/reward-item.interface.d.ts +3 -4
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.d.ts +7 -6
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.d.ts +13 -12
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js +12 -11
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js.map +1 -1
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.d.ts +30 -7
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.d.ts +3 -4
- package/dist/esm/shared/ad-load-info.interface.d.ts +6 -0
- package/dist/esm/shared/ad-mob-revenue-data.interface.d.ts +50 -0
- package/dist/esm/shared/ad-mob-revenue-data.interface.js +23 -0
- package/dist/esm/shared/ad-mob-revenue-data.interface.js.map +1 -0
- package/dist/esm/shared/ad-options.interface.d.ts +9 -11
- package/dist/esm/shared/ad-show-options.interface.d.ts +12 -0
- package/dist/esm/shared/ad-show-options.interface.js +2 -0
- package/dist/esm/shared/ad-show-options.interface.js.map +1 -0
- package/dist/esm/shared/admob-error.interface.d.ts +3 -2
- package/dist/esm/shared/index.d.ts +2 -0
- package/dist/esm/shared/index.js +2 -0
- package/dist/esm/shared/index.js.map +1 -1
- package/dist/esm/shared/tracking-authorization-status.interface.d.ts +6 -1
- package/dist/esm/web.d.ts +6 -6
- package/dist/esm/web.js +11 -6
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +109 -42
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +109 -42
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdManager.swift +12 -1
- package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdPlugin.swift +40 -10
- package/ios/Sources/AdMobPlugin/AppOpen/AppOpenAdPluginEvents.swift +1 -0
- package/ios/Sources/AdMobPlugin/Banner/BannerAdPluginEvents.swift +1 -0
- package/ios/Sources/AdMobPlugin/Banner/BannerExecutor.swift +14 -0
- package/ios/Sources/AdMobPlugin/Interstitial/AdInterstitialExecutor.swift +41 -5
- package/ios/Sources/AdMobPlugin/Interstitial/InterstitialAdPluginEvents.swift +1 -0
- package/ios/Sources/AdMobPlugin/Rewarded/AdRewardExecutor.swift +44 -5
- package/ios/Sources/AdMobPlugin/Rewarded/RewardAdPluginEvents.swift +1 -0
- package/ios/Sources/AdMobPlugin/RewardedInterstitial/AdRewardInterstitialExecutor.swift +45 -6
- package/ios/Sources/AdMobPlugin/RewardedInterstitial/RewardInterstitialAdPluginEvents.swift +1 -0
- package/package.json +1 -1
|
@@ -4,7 +4,9 @@ import GoogleMobileAds
|
|
|
4
4
|
|
|
5
5
|
class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
6
6
|
weak var plugin: AdMobPlugin?
|
|
7
|
-
var
|
|
7
|
+
private var preparedAds: [String: InterstitialAd] = [:]
|
|
8
|
+
private var lastPreparedAdId: String?
|
|
9
|
+
private var currentlyShowingAdId: String?
|
|
8
10
|
|
|
9
11
|
func prepareInterstitial(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
|
|
10
12
|
InterstitialAd.load(
|
|
@@ -12,7 +14,7 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
12
14
|
request: request,
|
|
13
15
|
completionHandler: { (ad, error) in
|
|
14
16
|
if let error = error {
|
|
15
|
-
NSLog("
|
|
17
|
+
NSLog("Interstitial ad failed to load with error: \(error.localizedDescription)")
|
|
16
18
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.FailedToLoad.rawValue, data: [
|
|
17
19
|
"code": 0,
|
|
18
20
|
"message": error.localizedDescription
|
|
@@ -21,8 +23,23 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
21
23
|
return
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
if let ad = ad {
|
|
27
|
+
ad.fullScreenContentDelegate = self
|
|
28
|
+
ad.paidEventHandler = { adValue in
|
|
29
|
+
let networkName = ad.responseInfo.loadedAdNetworkResponseInfo?.adNetworkClassName ?? ""
|
|
30
|
+
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
31
|
+
self.plugin?.notifyListeners(InterstitialAdPluginEvents.AdImpression.rawValue, data: [
|
|
32
|
+
"adUnitId": adUnitID,
|
|
33
|
+
"valueMicros": adValue.value.int64Value,
|
|
34
|
+
"currencyCode": adValue.currencyCode,
|
|
35
|
+
"precision": adValue.precision.rawValue,
|
|
36
|
+
"networkName": networkName,
|
|
37
|
+
"impressionId": impressionId
|
|
38
|
+
])
|
|
39
|
+
}
|
|
40
|
+
self.preparedAds[adUnitID] = ad
|
|
41
|
+
self.lastPreparedAdId = adUnitID
|
|
42
|
+
}
|
|
26
43
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Loaded.rawValue, data: [
|
|
27
44
|
"adUnitId": adUnitID
|
|
28
45
|
])
|
|
@@ -34,8 +51,18 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
func showInterstitial(_ call: CAPPluginCall) {
|
|
54
|
+
guard let adId = call.getString("adId") ?? lastPreparedAdId else {
|
|
55
|
+
call.reject("No ad prepared")
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
guard currentlyShowingAdId == nil else {
|
|
59
|
+
call.reject("An ad is already showing")
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
|
|
37
63
|
if let rootViewController = plugin?.getRootVC() {
|
|
38
|
-
if let ad =
|
|
64
|
+
if let ad = preparedAds[adId] {
|
|
65
|
+
currentlyShowingAdId = adId
|
|
39
66
|
ad.present(from: rootViewController)
|
|
40
67
|
call.resolve([:])
|
|
41
68
|
} else {
|
|
@@ -46,6 +73,7 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
46
73
|
}
|
|
47
74
|
|
|
48
75
|
func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
76
|
+
removeCurrentlyShowingAd()
|
|
49
77
|
NSLog("InterstitialFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
50
78
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.FailedToShow.rawValue, data: [
|
|
51
79
|
"code": 0,
|
|
@@ -59,7 +87,15 @@ class AdInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
59
87
|
}
|
|
60
88
|
|
|
61
89
|
func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
|
|
90
|
+
removeCurrentlyShowingAd()
|
|
62
91
|
NSLog("InterstitialFullScreenDelegate Ad did dismiss full screen content.")
|
|
63
92
|
self.plugin?.notifyListeners(InterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
64
93
|
}
|
|
94
|
+
|
|
95
|
+
private func removeCurrentlyShowingAd() {
|
|
96
|
+
guard let adId = currentlyShowingAdId else { return }
|
|
97
|
+
preparedAds.removeValue(forKey: adId)
|
|
98
|
+
if lastPreparedAdId == adId { lastPreparedAdId = Array(preparedAds.keys).last }
|
|
99
|
+
currentlyShowingAdId = nil
|
|
100
|
+
}
|
|
65
101
|
}
|
|
@@ -4,7 +4,9 @@ import GoogleMobileAds
|
|
|
4
4
|
|
|
5
5
|
class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
6
6
|
weak var plugin: AdMobPlugin?
|
|
7
|
-
var
|
|
7
|
+
private var preparedAds: [String: RewardedAd] = [:]
|
|
8
|
+
private var lastPreparedAdId: String?
|
|
9
|
+
private var currentlyShowingAdId: String?
|
|
8
10
|
|
|
9
11
|
func prepareRewardVideoAd(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
|
|
10
12
|
RewardedAd.load(
|
|
@@ -21,7 +23,10 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
21
23
|
return
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
guard let ad = ad else {
|
|
27
|
+
call.reject("Loading failed")
|
|
28
|
+
return
|
|
29
|
+
}
|
|
25
30
|
|
|
26
31
|
if let providedOptions = call.getObject("ssv") {
|
|
27
32
|
let ssvOptions = ServerSideVerificationOptions()
|
|
@@ -36,10 +41,25 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
36
41
|
ssvOptions.userIdentifier = userId
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
ad.serverSideVerificationOptions = ssvOptions
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ad.fullScreenContentDelegate = self
|
|
48
|
+
ad.paidEventHandler = { adValue in
|
|
49
|
+
let networkName = ad.responseInfo.loadedAdNetworkResponseInfo?.adNetworkClassName ?? ""
|
|
50
|
+
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
51
|
+
self.plugin?.notifyListeners(RewardAdPluginEvents.AdImpression.rawValue, data: [
|
|
52
|
+
"adUnitId": adUnitID,
|
|
53
|
+
"valueMicros": adValue.value.int64Value,
|
|
54
|
+
"currencyCode": adValue.currencyCode,
|
|
55
|
+
"precision": adValue.precision.rawValue,
|
|
56
|
+
"networkName": networkName,
|
|
57
|
+
"impressionId": impressionId
|
|
58
|
+
])
|
|
40
59
|
}
|
|
60
|
+
self.preparedAds[adUnitID] = ad
|
|
61
|
+
self.lastPreparedAdId = adUnitID
|
|
41
62
|
|
|
42
|
-
self.rewardedAd?.fullScreenContentDelegate = self
|
|
43
63
|
self.plugin?.notifyListeners(RewardAdPluginEvents.Loaded.rawValue, data: [
|
|
44
64
|
"adUnitId": adUnitID
|
|
45
65
|
])
|
|
@@ -51,8 +71,18 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
func showRewardVideoAd(_ call: CAPPluginCall) {
|
|
74
|
+
guard let adId = call.getString("adId") ?? lastPreparedAdId else {
|
|
75
|
+
call.reject("No ad prepared")
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
guard currentlyShowingAdId == nil else {
|
|
79
|
+
call.reject("An ad is already showing")
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
54
83
|
if let rootViewController = plugin?.getRootVC() {
|
|
55
|
-
if let ad =
|
|
84
|
+
if let ad = preparedAds[adId] {
|
|
85
|
+
currentlyShowingAdId = adId
|
|
56
86
|
ad.present(from: rootViewController,
|
|
57
87
|
userDidEarnRewardHandler: {
|
|
58
88
|
let reward = ad.adReward
|
|
@@ -67,6 +97,7 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
67
97
|
}
|
|
68
98
|
|
|
69
99
|
func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
100
|
+
removeCurrentlyShowingAd()
|
|
70
101
|
NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
71
102
|
self.plugin?.notifyListeners(RewardAdPluginEvents.FailedToShow.rawValue, data: [
|
|
72
103
|
"code": 0,
|
|
@@ -80,7 +111,15 @@ class AdRewardExecutor: NSObject, FullScreenContentDelegate {
|
|
|
80
111
|
}
|
|
81
112
|
|
|
82
113
|
func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
|
|
114
|
+
removeCurrentlyShowingAd()
|
|
83
115
|
NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
|
|
84
116
|
self.plugin?.notifyListeners(RewardAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
85
117
|
}
|
|
118
|
+
|
|
119
|
+
private func removeCurrentlyShowingAd() {
|
|
120
|
+
guard let adId = currentlyShowingAdId else { return }
|
|
121
|
+
preparedAds.removeValue(forKey: adId)
|
|
122
|
+
if lastPreparedAdId == adId { lastPreparedAdId = Array(preparedAds.keys).last }
|
|
123
|
+
currentlyShowingAdId = nil
|
|
124
|
+
}
|
|
86
125
|
}
|
|
@@ -4,7 +4,9 @@ import GoogleMobileAds
|
|
|
4
4
|
|
|
5
5
|
class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
6
6
|
weak var plugin: AdMobPlugin?
|
|
7
|
-
var
|
|
7
|
+
private var preparedAds: [String: RewardedInterstitialAd] = [:]
|
|
8
|
+
private var lastPreparedAdId: String?
|
|
9
|
+
private var currentlyShowingAdId: String?
|
|
8
10
|
|
|
9
11
|
func prepareRewardInterstitialAd(_ call: CAPPluginCall, _ request: Request, _ adUnitID: String) {
|
|
10
12
|
RewardedInterstitialAd.load(
|
|
@@ -12,7 +14,7 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
12
14
|
request: request,
|
|
13
15
|
completionHandler: { (ad, error) in
|
|
14
16
|
if let error = error {
|
|
15
|
-
NSLog("Rewarded ad failed to load with error: \(error.localizedDescription)")
|
|
17
|
+
NSLog("Rewarded interstitial ad failed to load with error: \(error.localizedDescription)")
|
|
16
18
|
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.FailedToLoad.rawValue, data: [
|
|
17
19
|
"code": 0,
|
|
18
20
|
"message": error.localizedDescription
|
|
@@ -21,7 +23,10 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
21
23
|
return
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
guard let ad = ad else {
|
|
27
|
+
call.reject("Loading failed")
|
|
28
|
+
return
|
|
29
|
+
}
|
|
25
30
|
|
|
26
31
|
if let providedOptions = call.getObject("ssv") {
|
|
27
32
|
let ssvOptions = ServerSideVerificationOptions()
|
|
@@ -36,10 +41,25 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
36
41
|
ssvOptions.userIdentifier = userId
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
ad.serverSideVerificationOptions = ssvOptions
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ad.fullScreenContentDelegate = self
|
|
48
|
+
ad.paidEventHandler = { adValue in
|
|
49
|
+
let networkName = ad.responseInfo.loadedAdNetworkResponseInfo?.adNetworkClassName ?? ""
|
|
50
|
+
let impressionId = ad.responseInfo.responseIdentifier ?? ""
|
|
51
|
+
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.AdImpression.rawValue, data: [
|
|
52
|
+
"adUnitId": adUnitID,
|
|
53
|
+
"valueMicros": adValue.value.int64Value,
|
|
54
|
+
"currencyCode": adValue.currencyCode,
|
|
55
|
+
"precision": adValue.precision.rawValue,
|
|
56
|
+
"networkName": networkName,
|
|
57
|
+
"impressionId": impressionId
|
|
58
|
+
])
|
|
40
59
|
}
|
|
60
|
+
self.preparedAds[adUnitID] = ad
|
|
61
|
+
self.lastPreparedAdId = adUnitID
|
|
41
62
|
|
|
42
|
-
self.rewardedInterstitialAd?.fullScreenContentDelegate = self
|
|
43
63
|
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Loaded.rawValue, data: [
|
|
44
64
|
"adUnitId": adUnitID
|
|
45
65
|
])
|
|
@@ -51,8 +71,18 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
func showRewardInterstitialAd(_ call: CAPPluginCall) {
|
|
74
|
+
guard let adId = call.getString("adId") ?? lastPreparedAdId else {
|
|
75
|
+
call.reject("No ad prepared")
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
guard currentlyShowingAdId == nil else {
|
|
79
|
+
call.reject("An ad is already showing")
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
54
83
|
if let rootViewController = plugin?.getRootVC() {
|
|
55
|
-
if let ad =
|
|
84
|
+
if let ad = preparedAds[adId] {
|
|
85
|
+
currentlyShowingAdId = adId
|
|
56
86
|
ad.present(from: rootViewController,
|
|
57
87
|
userDidEarnRewardHandler: {
|
|
58
88
|
let reward = ad.adReward
|
|
@@ -67,6 +97,7 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
67
97
|
}
|
|
68
98
|
|
|
69
99
|
func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
|
|
100
|
+
removeCurrentlyShowingAd()
|
|
70
101
|
NSLog("RewardFullScreenDelegate Ad failed to present full screen content with error \(error.localizedDescription).")
|
|
71
102
|
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.FailedToShow.rawValue, data: [
|
|
72
103
|
"code": 0,
|
|
@@ -80,7 +111,15 @@ class AdRewardInterstitialExecutor: NSObject, FullScreenContentDelegate {
|
|
|
80
111
|
}
|
|
81
112
|
|
|
82
113
|
func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
|
|
114
|
+
removeCurrentlyShowingAd()
|
|
83
115
|
NSLog("RewardFullScreenDelegate Ad did dismiss full screen content.")
|
|
84
116
|
self.plugin?.notifyListeners(RewardInterstitialAdPluginEvents.Dismissed.rawValue, data: [:])
|
|
85
117
|
}
|
|
118
|
+
|
|
119
|
+
private func removeCurrentlyShowingAd() {
|
|
120
|
+
guard let adId = currentlyShowingAdId else { return }
|
|
121
|
+
preparedAds.removeValue(forKey: adId)
|
|
122
|
+
if lastPreparedAdId == adId { lastPreparedAdId = Array(preparedAds.keys).last }
|
|
123
|
+
currentlyShowingAdId = nil
|
|
124
|
+
}
|
|
86
125
|
}
|
|
@@ -5,4 +5,5 @@ public enum RewardInterstitialAdPluginEvents: String {
|
|
|
5
5
|
case FailedToShow = "onRewardedInterstitialAdFailedToShow"
|
|
6
6
|
case Dismissed = "onRewardedInterstitialAdDismissed"
|
|
7
7
|
case Rewarded = "onRewardedInterstitialAdReward"
|
|
8
|
+
case AdImpression = "onRewardedInterstitialAdImpression"
|
|
8
9
|
}
|