cordova-admob-tomitank 1.0.8 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-admob-tomitank",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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.8"
2
+ <plugin id="cordova-admob-tomitank" version="1.0.9"
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>
@@ -91,7 +91,11 @@
91
91
  <string>$USAGE</string>
92
92
  </config-file>
93
93
 
94
- <config-file platform="ios" target="*-Info.plist" parent="SKAdNetworkItems">
94
+ <config-file target="*-Info.plist" parent="GADIntegrationManager">
95
+ <string>webview</string>
96
+ </config-file>
97
+
98
+ <config-file target="*-Info.plist" parent="SKAdNetworkItems">
95
99
  <array>
96
100
  <dict>
97
101
  <key>SKAdNetworkIdentifier</key>
@@ -16,10 +16,11 @@ class AMBPlugin: CDVPlugin {
16
16
  }
17
17
 
18
18
  override func pluginInitialize() {
19
+ print("Initialize..");
20
+
19
21
  super.pluginInitialize()
20
22
 
21
23
  AMBContext.plugin = self
22
- //GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ GADSimulatorID ]
23
24
 
24
25
  if let x = self.commandDelegate.settings["disableSDKCrashReporting".lowercased()] as? String,
25
26
  x == "true" {
@@ -42,7 +43,25 @@ class AMBPlugin: CDVPlugin {
42
43
 
43
44
  @objc func configRequest(_ command: CDVInvokedUrlCommand) {
44
45
  let ctx = AMBContext(command)
45
- ctx.configure()
46
+ let requestConfiguration = GADMobileAds.sharedInstance().requestConfiguration
47
+
48
+ if let maxAdContentRating = ctx.optMaxAdContentRating() {
49
+ requestConfiguration.maxAdContentRating = maxAdContentRating
50
+ }
51
+
52
+ if let tag = ctx.optChildDirectedTreatmentTag() {
53
+ requestConfiguration.tag(forChildDirectedTreatment: tag)
54
+ }
55
+
56
+ if let tag = ctx.optUnderAgeOfConsentTag() {
57
+ requestConfiguration.tagForUnderAge(ofConsent: tag)
58
+ }
59
+
60
+ if let testDevices = ctx.optTestDeviceIds() {
61
+ requestConfiguration.testDeviceIdentifiers = testDevices
62
+ }
63
+
64
+ ctx.resolve()
46
65
  }
47
66
 
48
67
  @objc func requestTrackingAuthorization(_ command: CDVInvokedUrlCommand) {
@@ -59,8 +78,9 @@ class AMBPlugin: CDVPlugin {
59
78
 
60
79
  @objc func start(_ command: CDVInvokedUrlCommand) {
61
80
  let ctx = AMBContext(command)
81
+
62
82
  GADMobileAds.sharedInstance().start(completionHandler: { _ in
63
- ctx.resolve(["version": GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)])
83
+ ctx.resolve(["version": GADMobileAds.sharedInstance().sdkVersion])
64
84
  })
65
85
  }
66
86
 
@@ -111,7 +131,7 @@ class AMBPlugin: CDVPlugin {
111
131
  if ad != nil {
112
132
  ctx.resolve()
113
133
  } else {
114
- ctx.reject("fail to create ad: \(ctx.optId() ?? "-")")
134
+ ctx.reject("fail to create ad: \(ctx.optId() ?? -1)")
115
135
  }
116
136
  } else {
117
137
  ctx.reject()
@@ -172,21 +192,9 @@ class AMBPlugin: CDVPlugin {
172
192
  }
173
193
  }
174
194
 
175
- @objc func webviewGoto(_ command: CDVInvokedUrlCommand) {
176
- let ctx = AMBContext(command)
177
-
178
- DispatchQueue.main.async {
179
- if let url = URL(string: ctx.optWebviewGoto()+"#from_webview_goto") {
180
- let webView = self.webViewEngine.engineWebView as! WKWebView
181
- webView.load(URLRequest(url: url))
182
- }
183
- }
184
- }
185
-
186
195
  func emit(_ eventName: String, data: Any = NSNull()) {
187
196
  let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ["type": eventName, "data": data])
188
197
  result?.setKeepCallbackAs(true)
189
198
  self.commandDelegate.send(result, callbackId: readyCallbackId)
190
199
  }
191
-
192
- }
200
+ }