cordova-admob-tomitank 1.0.8 → 1.0.10
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 +6 -2
- package/src/ios/AMBPlugin.swift +26 -17
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.10"
|
|
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
|
-
|
|
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>
|
package/src/ios/AMBPlugin.swift
CHANGED
|
@@ -16,10 +16,12 @@ class AMBPlugin: CDVPlugin {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
override func pluginInitialize() {
|
|
19
|
+
|
|
20
|
+
print("DEBUG - Initialize..")
|
|
21
|
+
|
|
19
22
|
super.pluginInitialize()
|
|
20
23
|
|
|
21
24
|
AMBContext.plugin = self
|
|
22
|
-
//GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ GADSimulatorID ]
|
|
23
25
|
|
|
24
26
|
if let x = self.commandDelegate.settings["disableSDKCrashReporting".lowercased()] as? String,
|
|
25
27
|
x == "true" {
|
|
@@ -42,7 +44,25 @@ class AMBPlugin: CDVPlugin {
|
|
|
42
44
|
|
|
43
45
|
@objc func configRequest(_ command: CDVInvokedUrlCommand) {
|
|
44
46
|
let ctx = AMBContext(command)
|
|
45
|
-
|
|
47
|
+
let requestConfiguration = GADMobileAds.sharedInstance().requestConfiguration
|
|
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()
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
@objc func requestTrackingAuthorization(_ command: CDVInvokedUrlCommand) {
|
|
@@ -59,8 +79,9 @@ class AMBPlugin: CDVPlugin {
|
|
|
59
79
|
|
|
60
80
|
@objc func start(_ command: CDVInvokedUrlCommand) {
|
|
61
81
|
let ctx = AMBContext(command)
|
|
82
|
+
|
|
62
83
|
GADMobileAds.sharedInstance().start(completionHandler: { _ in
|
|
63
|
-
ctx.resolve(["version":
|
|
84
|
+
ctx.resolve(["version": GADMobileAds.sharedInstance().sdkVersion])
|
|
64
85
|
})
|
|
65
86
|
}
|
|
66
87
|
|
|
@@ -111,7 +132,7 @@ class AMBPlugin: CDVPlugin {
|
|
|
111
132
|
if ad != nil {
|
|
112
133
|
ctx.resolve()
|
|
113
134
|
} else {
|
|
114
|
-
ctx.reject("fail to create ad: \(ctx.optId() ??
|
|
135
|
+
ctx.reject("fail to create ad: \(ctx.optId() ?? -1)")
|
|
115
136
|
}
|
|
116
137
|
} else {
|
|
117
138
|
ctx.reject()
|
|
@@ -172,21 +193,9 @@ class AMBPlugin: CDVPlugin {
|
|
|
172
193
|
}
|
|
173
194
|
}
|
|
174
195
|
|
|
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
196
|
func emit(_ eventName: String, data: Any = NSNull()) {
|
|
187
197
|
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ["type": eventName, "data": data])
|
|
188
198
|
result?.setKeepCallbackAs(true)
|
|
189
199
|
self.commandDelegate.send(result, callbackId: readyCallbackId)
|
|
190
200
|
}
|
|
191
|
-
|
|
192
|
-
}
|
|
201
|
+
}
|