cordova-admob-tomitank 1.0.12 → 1.1.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Based on AdMob Plus Cordova with updated SDK-s
4
4
  - Android: 24.4.0
5
- - iOS: 11.13.0
5
+ - iOS: 12.7.0
6
6
 
7
7
  [![](https://img.shields.io/static/v1?label=Sponsor%20Me&style=for-the-badge&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/tomitank)
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-admob-tomitank",
3
- "version": "1.0.12",
3
+ "version": "1.1.1",
4
4
  "description": "Trustable Google AdMob Cordova Plugin",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-admob-tomitank" version="1.0.12"
2
+ <plugin id="cordova-admob-tomitank" version="1.1.1"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  xmlns:android="http://schemas.android.com/apk/res/android">
5
5
  <name>cordova-admob-tomitank</name>
@@ -317,7 +317,7 @@
317
317
  <source url="https://cdn.cocoapods.org/" />
318
318
  </config>
319
319
  <pods use-frameworks="true">
320
- <pod name="Google-Mobile-Ads-SDK" spec="~> 11.13.0" />
320
+ <pod name="Google-Mobile-Ads-SDK" spec="~> 12.7.0" />
321
321
  </pods>
322
322
  </podspec>
323
323
  </platform>
@@ -42,7 +42,7 @@ class AMBAdBase: AMBCoreAd {
42
42
  self.emit(eventName, ["message": error.localizedDescription])
43
43
  }
44
44
 
45
- func emit(_ eventName: String, _ reward: GADAdReward) {
45
+ func emit(_ eventName: String, _ reward: AdReward) {
46
46
  self.emit(eventName, [
47
47
  "reward": [
48
48
  "amount": reward.amount,
@@ -51,7 +51,7 @@ class AMBAdBase: AMBCoreAd {
51
51
  ])
52
52
  }
53
53
 
54
- func emit(_ eventName: String, _ adSize: GADAdSize) {
54
+ func emit(_ eventName: String, _ adSize: AdSize) {
55
55
  self.emit(eventName, [
56
56
  "size": [
57
57
  "width": adSize.size.width,
@@ -66,7 +66,7 @@ class AMBAdBase: AMBCoreAd {
66
66
  plugin.emit(eventName, data: d)
67
67
  }
68
68
 
69
- func emit(_ eventName: String, _ nativeAd: GADNativeAd) {
69
+ func emit(_ eventName: String, _ nativeAd: NativeAd) {
70
70
  plugin.emit(eventName, data: ["adId": nativeAd.hashValue])
71
71
  }
72
72
  }
@@ -1,9 +1,9 @@
1
1
  import Foundation
2
2
  import GoogleMobileAds
3
3
 
4
- class AMBAppOpenAd: AMBAdBase, GADFullScreenContentDelegate {
4
+ class AMBAppOpenAd: AMBAdBase, FullScreenContentDelegate {
5
5
 
6
- var mAd: GADAppOpenAd?
6
+ var mAd: AppOpenAd?
7
7
 
8
8
  convenience init?(_ ctx: AMBContext) {
9
9
  guard let id = ctx.optId(),
@@ -13,7 +13,7 @@ class AMBAppOpenAd: AMBAdBase, GADFullScreenContentDelegate {
13
13
  }
14
14
  self.init(id: id,
15
15
  adUnitId: adUnitId,
16
- adRequest: ctx.optGADRequest())
16
+ adRequest: ctx.optRequest())
17
17
  }
18
18
 
19
19
  deinit {
@@ -27,7 +27,7 @@ class AMBAppOpenAd: AMBAdBase, GADFullScreenContentDelegate {
27
27
  override func load(_ ctx: AMBContext) {
28
28
  clear()
29
29
 
30
- GADAppOpenAd.load(
30
+ AppOpenAd.load(
31
31
  withAdUnitID: self.adUnitId,
32
32
  request: adRequest,
33
33
  completionHandler: { (ad, error) in
@@ -45,23 +45,23 @@ class AMBAppOpenAd: AMBAdBase, GADFullScreenContentDelegate {
45
45
  }
46
46
 
47
47
  override func show(_ ctx: AMBContext) {
48
- mAd?.present(fromRootViewController: AMBContext.plugin.viewController)
48
+ mAd?.present(from: AMBContext.plugin.viewController)
49
49
  }
50
50
 
51
- func adDidRecordImpression(_ ad: GADFullScreenPresentingAd) {
51
+ func adDidRecordImpression(_ ad: FullScreenPresentingAd) {
52
52
  self.emit(AMBEvents.adImpression)
53
53
  }
54
54
 
55
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
55
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
56
56
  clear()
57
57
  self.emit(AMBEvents.adShowFail, error)
58
58
  }
59
59
 
60
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
60
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
61
61
  self.emit(AMBEvents.adShow)
62
62
  }
63
63
 
64
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
64
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
65
65
  clear()
66
66
  self.emit(AMBEvents.adDismiss)
67
67
  }
@@ -37,7 +37,7 @@ class AMBBannerStackView: UIStackView {
37
37
  }
38
38
  }
39
39
 
40
- class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
40
+ class AMBBanner: AMBAdBase, BannerViewDelegate, AdSizeDelegate {
41
41
  static let stackView = AMBBannerStackView.shared
42
42
 
43
43
  static let priortyLeast = UILayoutPriority(10)
@@ -121,13 +121,13 @@ class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
121
121
  AMBBannerStackView.bottomConstraint.isActive = stackView.hasBottomBanner
122
122
  }
123
123
 
124
- let adSize: GADAdSize!
124
+ let adSize: AdSize!
125
125
  let position: String!
126
126
  let offset: CGFloat?
127
- var bannerView: GADBannerView!
127
+ var bannerView: BannerView!
128
128
  let placeholder = AMBBannerPlaceholder()
129
129
 
130
- init(id: String, adUnitId: String, adSize: GADAdSize, adRequest: GADRequest, position: String, offset: CGFloat?) {
130
+ init(id: String, adUnitId: String, adSize: AdSize, adRequest: Request, position: String, offset: CGFloat?) {
131
131
  self.adSize = adSize
132
132
  self.position = position
133
133
  self.offset = offset
@@ -144,7 +144,7 @@ class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
144
144
  self.init(id: id,
145
145
  adUnitId: adUnitId,
146
146
  adSize: ctx.optAdSize(),
147
- adRequest: ctx.optGADRequest(),
147
+ adRequest: ctx.optRequest(),
148
148
  position: ctx.optPosition(),
149
149
  offset: ctx.optOffset())
150
150
  }
@@ -165,7 +165,7 @@ class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
165
165
 
166
166
  override func load(_ ctx: AMBContext) {
167
167
  if bannerView == nil {
168
- bannerView = GADBannerView(adSize: self.adSize)
168
+ bannerView = BannerView(adSize: self.adSize)
169
169
  bannerView.delegate = self
170
170
  bannerView.adSizeDelegate = self
171
171
  bannerView.rootViewController = plugin.viewController
@@ -217,7 +217,7 @@ class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
217
217
  ctx.resolve()
218
218
  }
219
219
 
220
- func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
220
+ func bannerViewDidReceiveAd(_ bannerView: BannerView) {
221
221
  self.emit(AMBEvents.adLoad, [
222
222
  "size": [
223
223
  "width": bannerView.frame.size.width,
@@ -237,35 +237,35 @@ class AMBBanner: AMBAdBase, GADBannerViewDelegate, GADAdSizeDelegate {
237
237
  ])
238
238
  }
239
239
 
240
- func bannerView(_ bannerView: GADBannerView,
240
+ func bannerView(_ bannerView: BannerView,
241
241
  didFailToReceiveAdWithError error: Error) {
242
242
  self.emit(AMBEvents.adLoadFail, error)
243
243
  self.emit(AMBEvents.bannerLoadFail, error)
244
244
  }
245
245
 
246
- func bannerViewDidRecordImpression(_ bannerView: GADBannerView) {
246
+ func bannerViewDidRecordImpression(_ bannerView: BannerView) {
247
247
  self.emit(AMBEvents.adImpression)
248
248
  self.emit(AMBEvents.bannerImpression)
249
249
  }
250
250
 
251
- func bannerViewDidRecordClick(_ bannerView: GADBannerView) {
251
+ func bannerViewDidRecordClick(_ bannerView: BannerView) {
252
252
  self.emit(AMBEvents.adClick)
253
253
  }
254
254
 
255
- func bannerViewWillPresentScreen(_ bannerView: GADBannerView) {
255
+ func bannerViewWillPresentScreen(_ bannerView: BannerView) {
256
256
  self.emit(AMBEvents.adShow)
257
257
  self.emit(AMBEvents.bannerOpen)
258
258
  }
259
259
 
260
- func bannerViewWillDismissScreen(_ bannerView: GADBannerView) {
260
+ func bannerViewWillDismissScreen(_ bannerView: BannerView) {
261
261
  }
262
262
 
263
- func bannerViewDidDismissScreen(_ bannerView: GADBannerView) {
263
+ func bannerViewDidDismissScreen(_ bannerView: BannerView) {
264
264
  self.emit(AMBEvents.adDismiss)
265
265
  self.emit(AMBEvents.bannerClose)
266
266
  }
267
267
 
268
- func adView(_ bannerView: GADBannerView, willChangeAdSizeTo size: GADAdSize) {
268
+ func adView(_ bannerView: BannerView, willChangeAdSizeTo size: AdSize) {
269
269
  self.emit(AMBEvents.bannerSizeChange, size)
270
270
  }
271
271
 
@@ -100,19 +100,19 @@ class AMBContext: AMBCoreContext {
100
100
  }
101
101
 
102
102
  // swiftlint:disable cyclomatic_complexity
103
- func optAdSize() -> GADAdSize {
103
+ func optAdSize() -> AdSize {
104
104
  if let adSizeType = opt("size") as? Int {
105
105
  switch adSizeType {
106
106
  case 0:
107
- return GADAdSizeBanner
107
+ return AdSizeBanner
108
108
  case 1:
109
- return GADAdSizeLargeBanner
109
+ return AdSizeLargeBanner
110
110
  case 2:
111
- return GADAdSizeMediumRectangle
111
+ return AdSizeMediumRectangle
112
112
  case 3:
113
- return GADAdSizeFullBanner
113
+ return AdSizeFullBanner
114
114
  case 4:
115
- return GADAdSizeLeaderboard
115
+ return AdSizeLeaderboard
116
116
  default: break
117
117
  }
118
118
  }
@@ -124,35 +124,35 @@ class AMBContext: AMBCoreContext {
124
124
  }
125
125
  if adaptive == "inline",
126
126
  let maxHeight = adSizeDict["maxHeight"] as? CGFloat {
127
- return GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(width, maxHeight)
127
+ return inlineAdaptiveBanner(width: width, maxHeight: maxHeight)
128
128
  } else {
129
129
  switch adSizeDict["orientation"] as? String {
130
130
  case "portrait":
131
- return GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(width)
131
+ return portraitAnchoredAdaptiveBanner(width: width)
132
132
  case "landscape":
133
- return GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(width)
133
+ return landscapeAnchoredAdaptiveBanner(width: width)
134
134
  default:
135
- return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width)
135
+ return currentOrientationAnchoredAdaptiveBanner(width: width)
136
136
  }
137
137
  }
138
138
  } else if let width = adSizeDict["width"] as? Int,
139
139
  let height = adSizeDict["height"] as? Int {
140
- return GADAdSizeFromCGSize(CGSize(width: width, height: height))
140
+ return adSizeFor(cgSize: CGSize(width: width, height: height))
141
141
  }
142
142
  }
143
- return GADAdSizeBanner
143
+ return AdSizeBanner
144
144
  }
145
145
  // swiftlint:enable cyclomatic_complexity
146
146
 
147
- func optGADServerSideVerificationOptions() -> GADServerSideVerificationOptions? {
147
+ func optServerSideVerificationOptions() -> ServerSideVerificationOptions? {
148
148
  guard let ssv = opt("serverSideVerification") as? NSDictionary
149
149
  else {
150
150
  return nil
151
151
  }
152
152
 
153
- let options = GADServerSideVerificationOptions.init()
153
+ let options = ServerSideVerificationOptions.init()
154
154
  if let customData = ssv.value(forKey: "customData") as? String {
155
- options.customRewardString = customData
155
+ options.customRewardText = customData
156
156
  }
157
157
  if let userId = ssv.value(forKey: "userId") as? String {
158
158
  options.userIdentifier = userId
@@ -134,15 +134,15 @@ extension AMBCoreContext {
134
134
  return optStringArray("testDeviceIds")
135
135
  }
136
136
 
137
- func optGADRequest() -> GADRequest {
138
- let request = GADRequest()
137
+ func optRequest() -> Request {
138
+ let request = Request()
139
139
  if let contentURL = optString("contentUrl") {
140
140
  request.contentURL = contentURL
141
141
  }
142
142
  if let keywords = optStringArray("keywords") {
143
143
  request.keywords = keywords
144
144
  }
145
- let extras = GADExtras()
145
+ let extras = Extras()
146
146
  if let npa = optString("npa") {
147
147
  extras.additionalParameters = ["npa": npa]
148
148
  }
@@ -168,13 +168,13 @@ extension AMBCoreContext {
168
168
 
169
169
  func configure() {
170
170
  if let muted = optAppMuted() {
171
- GADMobileAds.sharedInstance().applicationMuted = muted
171
+ MobileAds.shared.isApplicationMuted = muted
172
172
  }
173
173
  if let volume = optAppVolume() {
174
- GADMobileAds.sharedInstance().applicationVolume = volume
174
+ MobileAds.shared.applicationVolume = volume
175
175
  }
176
176
 
177
- let requestConfiguration = GADMobileAds.sharedInstance().requestConfiguration
177
+ let requestConfiguration = MobileAds.shared.requestConfiguration
178
178
  if let maxAdContentRating = optMaxAdContentRating() {
179
179
  requestConfiguration.maxAdContentRating = maxAdContentRating
180
180
  }
@@ -204,9 +204,9 @@ class AMBCoreAd: NSObject {
204
204
 
205
205
  let id: String
206
206
  let adUnitId: String
207
- let adRequest: GADRequest
207
+ let adRequest: Request
208
208
 
209
- init(id: String, adUnitId: String, adRequest: GADRequest) {
209
+ init(id: String, adUnitId: String, adRequest: Request) {
210
210
  self.id = id
211
211
  self.adUnitId = adUnitId
212
212
  self.adRequest = adRequest
@@ -222,7 +222,7 @@ class AMBCoreAd: NSObject {
222
222
  else {
223
223
  return nil
224
224
  }
225
- self.init(id: id, adUnitId: adUnitId, adRequest: ctx.optGADRequest())
225
+ self.init(id: id, adUnitId: adUnitId, adRequest: ctx.optRequest())
226
226
  }
227
227
 
228
228
  deinit {
@@ -1,7 +1,7 @@
1
1
  import GoogleMobileAds
2
2
 
3
- class AMBInterstitial: AMBAdBase, GADFullScreenContentDelegate {
4
- var mAd: GADInterstitialAd?
3
+ class AMBInterstitial: AMBAdBase, FullScreenContentDelegate {
4
+ var mAd: InterstitialAd?
5
5
 
6
6
  deinit {
7
7
  clear()
@@ -14,8 +14,8 @@ class AMBInterstitial: AMBAdBase, GADFullScreenContentDelegate {
14
14
  override func load(_ ctx: AMBContext) {
15
15
  clear()
16
16
 
17
- GADInterstitialAd.load(
18
- withAdUnitID: adUnitId,
17
+ InterstitialAd.load(
18
+ with: adUnitId,
19
19
  request: adRequest,
20
20
  completionHandler: { ad, error in
21
21
  if error != nil {
@@ -36,27 +36,27 @@ class AMBInterstitial: AMBAdBase, GADFullScreenContentDelegate {
36
36
  }
37
37
 
38
38
  override func show(_ ctx: AMBContext) {
39
- mAd?.present(fromRootViewController: plugin.viewController)
39
+ mAd?.present(from: plugin.viewController)
40
40
  ctx.resolve()
41
41
  }
42
42
 
43
- func adDidRecordImpression(_ ad: GADFullScreenPresentingAd) {
43
+ func adDidRecordImpression(_ ad: FullScreenPresentingAd) {
44
44
  self.emit(AMBEvents.adImpression)
45
45
  self.emit(AMBEvents.interstitialImpression)
46
46
  }
47
47
 
48
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
48
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
49
49
  clear()
50
50
  self.emit(AMBEvents.adShowFail, error)
51
51
  self.emit(AMBEvents.interstitialShowFail, error)
52
52
  }
53
53
 
54
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
54
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
55
55
  self.emit(AMBEvents.adShow)
56
56
  self.emit(AMBEvents.interstitialShow)
57
57
  }
58
58
 
59
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
59
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
60
60
  clear()
61
61
  self.emit(AMBEvents.adDismiss)
62
62
  self.emit(AMBEvents.interstitialDismiss)
@@ -2,7 +2,7 @@ import Foundation
2
2
  import GoogleMobileAds
3
3
 
4
4
  protocol AMBNativeAdViewProvider: NSObjectProtocol {
5
- func createView(_ nativeAd: GADNativeAd) -> UIView
5
+ func createView(_ nativeAd: NativeAd) -> UIView
6
6
  // delegate
7
7
  func didShow(_ ad: AMBNativeAd)
8
8
  func didHide(_ ad: AMBNativeAd)
@@ -13,24 +13,24 @@ extension AMBNativeAdViewProvider {
13
13
  func didHide(_ ad: AMBNativeAd) {}
14
14
  }
15
15
 
16
- class AMBNativeAd: AMBAdBase, GADNativeAdLoaderDelegate, GADNativeAdDelegate {
16
+ class AMBNativeAd: AMBAdBase, NativeAdLoaderDelegate, NativeAdDelegate {
17
17
  static var providers = [String: AMBNativeAdViewProvider]()
18
18
 
19
- var mLoader: GADAdLoader!
19
+ var mLoader: AdLoader!
20
20
  let viewProvider: AMBNativeAdViewProvider
21
- var mAd: GADNativeAd?
21
+ var mAd: NativeAd?
22
22
  var ctxLoad: AMBContext?
23
23
 
24
24
  lazy var view: UIView = {
25
25
  return viewProvider.createView(mAd!)
26
26
  }()
27
27
 
28
- init(id: String, adUnitId: String, adRequest: GADRequest, viewProvider: AMBNativeAdViewProvider) {
28
+ init(id: String, adUnitId: String, adRequest: Request, viewProvider: AMBNativeAdViewProvider) {
29
29
  self.viewProvider = viewProvider
30
30
 
31
31
  super.init(id: id, adUnitId: adUnitId, adRequest: adRequest)
32
32
 
33
- mLoader = GADAdLoader(adUnitID: adUnitId, rootViewController: plugin.viewController,
33
+ mLoader = AdLoader(adUnitID: adUnitId, rootViewController: plugin.viewController,
34
34
  adTypes: [.native], options: nil)
35
35
  mLoader.delegate = self
36
36
  }
@@ -45,7 +45,7 @@ class AMBNativeAd: AMBAdBase, GADNativeAdLoaderDelegate, GADNativeAdDelegate {
45
45
  }
46
46
  self.init(id: id,
47
47
  adUnitId: adUnitId,
48
- adRequest: ctx.optGADRequest(),
48
+ adRequest: ctx.optRequest(),
49
49
  viewProvider: viewProvider)
50
50
  }
51
51
 
@@ -83,7 +83,7 @@ class AMBNativeAd: AMBAdBase, GADNativeAdLoaderDelegate, GADNativeAdDelegate {
83
83
  ctx.resolve()
84
84
  }
85
85
 
86
- func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
86
+ func adLoader(_ adLoader: AdLoader, didReceive nativeAd: NativeAd) {
87
87
  mAd = nativeAd
88
88
  nativeAd.delegate = self
89
89
  self.emit(AMBEvents.adLoad)
@@ -93,7 +93,7 @@ class AMBNativeAd: AMBAdBase, GADNativeAdLoaderDelegate, GADNativeAdDelegate {
93
93
  }
94
94
  }
95
95
 
96
- func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: Error) {
96
+ func adLoader(_ adLoader: AdLoader, didFailToReceiveAdWithError error: Error) {
97
97
  self.emit(AMBEvents.adLoadFail, error)
98
98
  if !adLoader.isLoading {
99
99
  ctxLoad?.reject(error)
@@ -101,27 +101,27 @@ class AMBNativeAd: AMBAdBase, GADNativeAdLoaderDelegate, GADNativeAdDelegate {
101
101
  }
102
102
  }
103
103
 
104
- func nativeAdDidRecordImpression(_ nativeAd: GADNativeAd) {
104
+ func nativeAdDidRecordImpression(_ nativeAd: NativeAd) {
105
105
  self.emit(AMBEvents.adImpression, nativeAd)
106
106
  }
107
107
 
108
- func nativeAdDidRecordClick(_ nativeAd: GADNativeAd) {
108
+ func nativeAdDidRecordClick(_ nativeAd: NativeAd) {
109
109
  self.emit(AMBEvents.adClick, nativeAd)
110
110
  }
111
111
 
112
- func nativeAdWillPresentScreen(_ nativeAd: GADNativeAd) {
112
+ func nativeAdWillPresentScreen(_ nativeAd: NativeAd) {
113
113
  self.emit(AMBEvents.adShow, nativeAd)
114
114
  }
115
115
 
116
- func nativeAdWillDismissScreen(_ nativeAd: GADNativeAd) {
116
+ func nativeAdWillDismissScreen(_ nativeAd: NativeAd) {
117
117
  // The native ad will dismiss a full screen view.
118
118
  }
119
119
 
120
- func nativeAdDidDismissScreen(_ nativeAd: GADNativeAd) {
120
+ func nativeAdDidDismissScreen(_ nativeAd: NativeAd) {
121
121
  self.emit(AMBEvents.adDismiss, nativeAd)
122
122
  }
123
123
 
124
- func nativeAdWillLeaveApplication(_ nativeAd: GADNativeAd) {
124
+ func nativeAdWillLeaveApplication(_ nativeAd: NativeAd) {
125
125
  // The native ad will cause the application to become inactive and
126
126
  // open a new application.
127
127
  }
@@ -22,7 +22,7 @@ class AMBPlugin: CDVPlugin {
22
22
 
23
23
  if let x = self.commandDelegate.settings["disableSDKCrashReporting".lowercased()] as? String,
24
24
  x == "true" {
25
- GADMobileAds.sharedInstance().disableSDKCrashReporting()
25
+ MobileAds.shared.disableSDKCrashReporting()
26
26
  }
27
27
  }
28
28
 
@@ -58,8 +58,8 @@ class AMBPlugin: CDVPlugin {
58
58
 
59
59
  @objc func start(_ command: CDVInvokedUrlCommand) {
60
60
  let ctx = AMBContext(command)
61
- GADMobileAds.sharedInstance().start(completionHandler: { _ in
62
- ctx.resolve(["version": GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)])
61
+ MobileAds.shared.start(completionHandler: { _ in
62
+ ctx.resolve(["version": string(MobileAds.shared.versionNumber)])
63
63
  })
64
64
  }
65
65
 
@@ -67,7 +67,7 @@ class AMBPlugin: CDVPlugin {
67
67
  let ctx = AMBContext(command)
68
68
 
69
69
  if let muted = ctx.opt0() as? Bool {
70
- GADMobileAds.sharedInstance().applicationMuted = muted
70
+ MobileAds.shared.isApplicationMuted = muted
71
71
  ctx.resolve()
72
72
  } else {
73
73
  ctx.reject()
@@ -78,7 +78,7 @@ class AMBPlugin: CDVPlugin {
78
78
  let ctx = AMBContext(command)
79
79
 
80
80
  if let volume = ctx.opt0() as? Float {
81
- GADMobileAds.sharedInstance().applicationVolume = volume
81
+ MobileAds.shared.applicationVolume = volume
82
82
  ctx.resolve()
83
83
  } else {
84
84
  ctx.reject()
@@ -1,7 +1,7 @@
1
1
  import GoogleMobileAds
2
2
 
3
- class AMBRewarded: AMBAdBase, GADFullScreenContentDelegate {
4
- var mAd: GADRewardedAd?
3
+ class AMBRewarded: AMBAdBase, FullScreenContentDelegate {
4
+ var mAd: RewardedAd?
5
5
 
6
6
  deinit {
7
7
  clear()
@@ -14,7 +14,7 @@ class AMBRewarded: AMBAdBase, GADFullScreenContentDelegate {
14
14
  override func load(_ ctx: AMBContext) {
15
15
  clear()
16
16
 
17
- GADRewardedAd.load(withAdUnitID: adUnitId, request: adRequest, completionHandler: { ad, error in
17
+ RewardedAd.load(with: adUnitId, request: adRequest, completionHandler: { ad, error in
18
18
  if error != nil {
19
19
  self.emit(AMBEvents.adLoadFail, error!)
20
20
  self.emit(AMBEvents.rewardedLoadFail, error!)
@@ -25,7 +25,7 @@ class AMBRewarded: AMBAdBase, GADFullScreenContentDelegate {
25
25
 
26
26
  self.mAd = ad
27
27
  ad?.fullScreenContentDelegate = self
28
- ad?.serverSideVerificationOptions = ctx.optGADServerSideVerificationOptions()
28
+ ad?.serverSideVerificationOptions = ctx.optServerSideVerificationOptions()
29
29
 
30
30
  self.emit(AMBEvents.adLoad)
31
31
  self.emit(AMBEvents.rewardedLoad)
@@ -35,7 +35,7 @@ class AMBRewarded: AMBAdBase, GADFullScreenContentDelegate {
35
35
  }
36
36
 
37
37
  override func show(_ ctx: AMBContext) {
38
- mAd?.present(fromRootViewController: plugin.viewController, userDidEarnRewardHandler: {
38
+ mAd?.present(from: plugin.viewController, userDidEarnRewardHandler: {
39
39
  let reward = self.mAd!.adReward
40
40
  self.emit(AMBEvents.adReward, reward)
41
41
  self.emit(AMBEvents.rewardedReward, reward)
@@ -43,23 +43,23 @@ class AMBRewarded: AMBAdBase, GADFullScreenContentDelegate {
43
43
  ctx.resolve()
44
44
  }
45
45
 
46
- func adDidRecordImpression(_ ad: GADFullScreenPresentingAd) {
46
+ func adDidRecordImpression(_ ad: FullScreenPresentingAd) {
47
47
  self.emit(AMBEvents.adImpression)
48
48
  self.emit(AMBEvents.rewardedImpression)
49
49
  }
50
50
 
51
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
51
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
52
52
  clear()
53
53
  self.emit(AMBEvents.adShowFail, error)
54
54
  self.emit(AMBEvents.rewardedShowFail, error)
55
55
  }
56
56
 
57
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
57
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
58
58
  self.emit(AMBEvents.adShow)
59
59
  self.emit(AMBEvents.rewardedShow)
60
60
  }
61
61
 
62
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
62
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
63
63
  clear()
64
64
  self.emit(AMBEvents.adDismiss)
65
65
  self.emit(AMBEvents.rewardedDismiss)
@@ -1,7 +1,7 @@
1
1
  import GoogleMobileAds
2
2
 
3
- class AMBRewardedInterstitial: AMBAdBase, GADFullScreenContentDelegate {
4
- var mAd: GADRewardedInterstitialAd?
3
+ class AMBRewardedInterstitial: AMBAdBase, FullScreenContentDelegate {
4
+ var mAd: RewardedInterstitialAd?
5
5
 
6
6
  deinit {
7
7
  clear()
@@ -14,7 +14,7 @@ class AMBRewardedInterstitial: AMBAdBase, GADFullScreenContentDelegate {
14
14
  override func load(_ ctx: AMBContext) {
15
15
  clear()
16
16
 
17
- GADRewardedInterstitialAd.load(withAdUnitID: adUnitId, request: adRequest, completionHandler: { ad, error in
17
+ RewardedInterstitialAd.load(with: adUnitId, request: adRequest, completionHandler: { ad, error in
18
18
  if error != nil {
19
19
  self.emit(AMBEvents.adLoadFail, error!)
20
20
  self.emit(AMBEvents.rewardedInterstitialLoadFail, error!)
@@ -25,7 +25,7 @@ class AMBRewardedInterstitial: AMBAdBase, GADFullScreenContentDelegate {
25
25
 
26
26
  self.mAd = ad
27
27
  ad?.fullScreenContentDelegate = self
28
- ad?.serverSideVerificationOptions = ctx.optGADServerSideVerificationOptions()
28
+ ad?.serverSideVerificationOptions = ctx.optServerSideVerificationOptions()
29
29
 
30
30
  self.emit(AMBEvents.adLoad)
31
31
  self.emit(AMBEvents.rewardedInterstitialLoad)
@@ -35,7 +35,7 @@ class AMBRewardedInterstitial: AMBAdBase, GADFullScreenContentDelegate {
35
35
  }
36
36
 
37
37
  override func show(_ ctx: AMBContext) {
38
- mAd?.present(fromRootViewController: plugin.viewController, userDidEarnRewardHandler: {
38
+ mAd?.present(from: plugin.viewController, userDidEarnRewardHandler: {
39
39
  let reward = self.mAd!.adReward
40
40
  self.emit(AMBEvents.adReward, reward)
41
41
  self.emit(AMBEvents.rewardedInterstitialReward, reward)
@@ -43,23 +43,23 @@ class AMBRewardedInterstitial: AMBAdBase, GADFullScreenContentDelegate {
43
43
  ctx.resolve()
44
44
  }
45
45
 
46
- func adDidRecordImpression(_ ad: GADFullScreenPresentingAd) {
46
+ func adDidRecordImpression(_ ad: FullScreenPresentingAd) {
47
47
  self.emit(AMBEvents.adImpression)
48
48
  self.emit(AMBEvents.rewardedInterstitialImpression)
49
49
  }
50
50
 
51
- func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
51
+ func ad(_ ad: FullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
52
52
  clear()
53
53
  self.emit(AMBEvents.adShowFail, error)
54
54
  self.emit(AMBEvents.rewardedInterstitialShowFail, error)
55
55
  }
56
56
 
57
- func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
57
+ func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
58
58
  self.emit(AMBEvents.adShow)
59
59
  self.emit(AMBEvents.rewardedInterstitialShow)
60
60
  }
61
61
 
62
- func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
62
+ func adDidDismissFullScreenContent(_ ad: FullScreenPresentingAd) {
63
63
  clear()
64
64
  self.emit(AMBEvents.adDismiss)
65
65
  self.emit(AMBEvents.rewardedInterstitialDismiss)