cordova-admob-tomitank 1.0.10 → 1.0.11
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 +1 -1
- package/plugin.xml +1 -1
- package/src/ios/AMBPlugin.swift +16 -26
package/package.json
CHANGED
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.
|
|
2
|
+
<plugin id="cordova-admob-tomitank" version="1.0.11"
|
|
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>
|
package/src/ios/AMBPlugin.swift
CHANGED
|
@@ -16,9 +16,6 @@ class AMBPlugin: CDVPlugin {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
override func pluginInitialize() {
|
|
19
|
-
|
|
20
|
-
print("DEBUG - Initialize..")
|
|
21
|
-
|
|
22
19
|
super.pluginInitialize()
|
|
23
20
|
|
|
24
21
|
AMBContext.plugin = self
|
|
@@ -44,25 +41,7 @@ class AMBPlugin: CDVPlugin {
|
|
|
44
41
|
|
|
45
42
|
@objc func configRequest(_ command: CDVInvokedUrlCommand) {
|
|
46
43
|
let ctx = AMBContext(command)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if let maxAdContentRating = ctx.optMaxAdContentRating() {
|
|
50
|
-
requestConfiguration.maxAdContentRating = maxAdContentRating
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if let tag = ctx.optChildDirectedTreatmentTag() {
|
|
54
|
-
requestConfiguration.tag(forChildDirectedTreatment: tag)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if let tag = ctx.optUnderAgeOfConsentTag() {
|
|
58
|
-
requestConfiguration.tagForUnderAge(ofConsent: tag)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if let testDevices = ctx.optTestDeviceIds() {
|
|
62
|
-
requestConfiguration.testDeviceIdentifiers = testDevices
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
ctx.resolve()
|
|
44
|
+
ctx.configure()
|
|
66
45
|
}
|
|
67
46
|
|
|
68
47
|
@objc func requestTrackingAuthorization(_ command: CDVInvokedUrlCommand) {
|
|
@@ -79,9 +58,8 @@ class AMBPlugin: CDVPlugin {
|
|
|
79
58
|
|
|
80
59
|
@objc func start(_ command: CDVInvokedUrlCommand) {
|
|
81
60
|
let ctx = AMBContext(command)
|
|
82
|
-
|
|
83
61
|
GADMobileAds.sharedInstance().start(completionHandler: { _ in
|
|
84
|
-
ctx.resolve(["version": GADMobileAds.sharedInstance().
|
|
62
|
+
ctx.resolve(["version": GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)])
|
|
85
63
|
})
|
|
86
64
|
}
|
|
87
65
|
|
|
@@ -132,7 +110,7 @@ class AMBPlugin: CDVPlugin {
|
|
|
132
110
|
if ad != nil {
|
|
133
111
|
ctx.resolve()
|
|
134
112
|
} else {
|
|
135
|
-
ctx.reject("fail to create ad: \(ctx.optId() ?? -
|
|
113
|
+
ctx.reject("fail to create ad: \(ctx.optId() ?? "-")")
|
|
136
114
|
}
|
|
137
115
|
} else {
|
|
138
116
|
ctx.reject()
|
|
@@ -193,9 +171,21 @@ class AMBPlugin: CDVPlugin {
|
|
|
193
171
|
}
|
|
194
172
|
}
|
|
195
173
|
|
|
174
|
+
@objc func webviewGoto(_ command: CDVInvokedUrlCommand) {
|
|
175
|
+
let ctx = AMBContext(command)
|
|
176
|
+
|
|
177
|
+
DispatchQueue.main.async {
|
|
178
|
+
if let url = URL(string: ctx.optWebviewGoto()+"#from_webview_goto") {
|
|
179
|
+
let webView = self.webViewEngine.engineWebView as! WKWebView
|
|
180
|
+
webView.load(URLRequest(url: url))
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
196
185
|
func emit(_ eventName: String, data: Any = NSNull()) {
|
|
197
186
|
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ["type": eventName, "data": data])
|
|
198
187
|
result?.setKeepCallbackAs(true)
|
|
199
188
|
self.commandDelegate.send(result, callbackId: readyCallbackId)
|
|
200
189
|
}
|
|
201
|
-
|
|
190
|
+
|
|
191
|
+
}
|