cordova-admob-tomitank 1.0.9 → 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 -25
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,8 +16,6 @@ class AMBPlugin: CDVPlugin {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
override func pluginInitialize() {
|
|
19
|
-
print("Initialize..");
|
|
20
|
-
|
|
21
19
|
super.pluginInitialize()
|
|
22
20
|
|
|
23
21
|
AMBContext.plugin = self
|
|
@@ -43,25 +41,7 @@ class AMBPlugin: CDVPlugin {
|
|
|
43
41
|
|
|
44
42
|
@objc func configRequest(_ command: CDVInvokedUrlCommand) {
|
|
45
43
|
let ctx = AMBContext(command)
|
|
46
|
-
|
|
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()
|
|
44
|
+
ctx.configure()
|
|
65
45
|
}
|
|
66
46
|
|
|
67
47
|
@objc func requestTrackingAuthorization(_ command: CDVInvokedUrlCommand) {
|
|
@@ -78,9 +58,8 @@ class AMBPlugin: CDVPlugin {
|
|
|
78
58
|
|
|
79
59
|
@objc func start(_ command: CDVInvokedUrlCommand) {
|
|
80
60
|
let ctx = AMBContext(command)
|
|
81
|
-
|
|
82
61
|
GADMobileAds.sharedInstance().start(completionHandler: { _ in
|
|
83
|
-
ctx.resolve(["version": GADMobileAds.sharedInstance().
|
|
62
|
+
ctx.resolve(["version": GADGetStringFromVersionNumber(GADMobileAds.sharedInstance().versionNumber)])
|
|
84
63
|
})
|
|
85
64
|
}
|
|
86
65
|
|
|
@@ -131,7 +110,7 @@ class AMBPlugin: CDVPlugin {
|
|
|
131
110
|
if ad != nil {
|
|
132
111
|
ctx.resolve()
|
|
133
112
|
} else {
|
|
134
|
-
ctx.reject("fail to create ad: \(ctx.optId() ?? -
|
|
113
|
+
ctx.reject("fail to create ad: \(ctx.optId() ?? "-")")
|
|
135
114
|
}
|
|
136
115
|
} else {
|
|
137
116
|
ctx.reject()
|
|
@@ -192,9 +171,21 @@ class AMBPlugin: CDVPlugin {
|
|
|
192
171
|
}
|
|
193
172
|
}
|
|
194
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
|
+
|
|
195
185
|
func emit(_ eventName: String, data: Any = NSNull()) {
|
|
196
186
|
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ["type": eventName, "data": data])
|
|
197
187
|
result?.setKeepCallbackAs(true)
|
|
198
188
|
self.commandDelegate.send(result, callbackId: readyCallbackId)
|
|
199
189
|
}
|
|
200
|
-
|
|
190
|
+
|
|
191
|
+
}
|