@ququplay/admob 7.0.1 → 7.0.3
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.swift
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import PackageDescription
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
|
-
name: "
|
|
5
|
+
name: "QuquplayAdmob",
|
|
6
6
|
platforms: [.iOS(.v14)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
|
-
name: "
|
|
9
|
+
name: "QuquplayAdmob",
|
|
10
10
|
targets: ["AdMobPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'QuquplayAdmob'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
|
+
s.swift_version = '5.1'
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
s.dependency 'Capacitor'
|
|
18
|
+
s.dependency 'Google-Mobile-Ads-SDK', '11.3.0'
|
|
19
|
+
end
|
package/android/src/main/java/com/getcapacitor/community/admob/consent/AdConsentExecutor.java
CHANGED
|
@@ -63,6 +63,44 @@ public class AdConsentExecutor extends Executor {
|
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
public boolean isConsentOutdated() {
|
|
67
|
+
Context context = contextSupplier.get();
|
|
68
|
+
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
|
69
|
+
String tcString = prefs.getString("IABTCF_TCString", "");
|
|
70
|
+
|
|
71
|
+
if (tcString == null || tcString.isEmpty()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// base64 alphabet used to store data in IABTCF string
|
|
76
|
+
String base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
77
|
+
|
|
78
|
+
// date is stored in digits 1..7 of the IABTCF string
|
|
79
|
+
String dateSubstring = tcString.substring(1, 7);
|
|
80
|
+
|
|
81
|
+
// interpret date substring as base64-encoded integer value
|
|
82
|
+
long timestamp = 0L;
|
|
83
|
+
|
|
84
|
+
for (char c : dateSubstring.toCharArray()) {
|
|
85
|
+
int value = base64.indexOf(c);
|
|
86
|
+
timestamp = timestamp * 64 + value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// timestamp is given in deci-seconds, convert to milliseconds
|
|
90
|
+
timestamp *= 100;
|
|
91
|
+
|
|
92
|
+
// compare with current timestamp to get age in days
|
|
93
|
+
long daysAgo = (System.currentTimeMillis() - timestamp) / (1000 * 60 * 60 * 24);
|
|
94
|
+
|
|
95
|
+
// delete TC string if age is over a year
|
|
96
|
+
if (daysAgo > 365) {
|
|
97
|
+
prefs.edit().remove("IABTCF_TCString").apply();
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
66
104
|
public boolean canShowAds() {
|
|
67
105
|
Context context = contextSupplier.get();
|
|
68
106
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
|
@@ -132,6 +170,7 @@ public class AdConsentExecutor extends Executor {
|
|
|
132
170
|
consentInfo.put("isConsentFormAvailable", consentInformation.isConsentFormAvailable());
|
|
133
171
|
consentInfo.put("canShowAds", canShowAds());
|
|
134
172
|
consentInfo.put("canShowPersonalizedAds", canShowPersonalizedAds());
|
|
173
|
+
consentInfo.put("isConsentOutdated", isConsentOutdated());
|
|
135
174
|
call.resolve(consentInfo);
|
|
136
175
|
},
|
|
137
176
|
formError -> call.reject(formError.getMessage())
|
|
@@ -163,6 +202,7 @@ public class AdConsentExecutor extends Executor {
|
|
|
163
202
|
consentFormInfo.put("status", getConsentStatusString(consentInformation.getConsentStatus()));
|
|
164
203
|
consentFormInfo.put("canShowAds", canShowAds());
|
|
165
204
|
consentFormInfo.put("canShowPersonalizedAds", canShowPersonalizedAds());
|
|
205
|
+
consentFormInfo.put("isConsentOutdated", isConsentOutdated());
|
|
166
206
|
call.resolve(consentFormInfo);
|
|
167
207
|
}
|
|
168
208
|
}),
|
|
@@ -27,7 +27,8 @@ class ConsentExecutor: NSObject {
|
|
|
27
27
|
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
|
|
28
28
|
"isConsentFormAvailable": UMPConsentInformation.sharedInstance.formStatus == UMPFormStatus.available,
|
|
29
29
|
"canShowAds": self.canShowAds(),
|
|
30
|
-
"canShowPersonalizedAds": self.canShowPersonalizedAds()
|
|
30
|
+
"canShowPersonalizedAds": self.canShowPersonalizedAds(),
|
|
31
|
+
"isConsentOutdated": self.isConsentOutdated()
|
|
31
32
|
])
|
|
32
33
|
}
|
|
33
34
|
})
|
|
@@ -53,7 +54,8 @@ class ConsentExecutor: NSObject {
|
|
|
53
54
|
call.resolve([
|
|
54
55
|
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
|
|
55
56
|
"canShowAds": self.canShowAds(),
|
|
56
|
-
"canShowPersonalizedAds": self.canShowPersonalizedAds()
|
|
57
|
+
"canShowPersonalizedAds": self.canShowPersonalizedAds(),
|
|
58
|
+
"isConsentOutdated": self.isConsentOutdated()
|
|
57
59
|
])
|
|
58
60
|
})
|
|
59
61
|
})
|
|
@@ -147,4 +149,40 @@ class ConsentExecutor: NSObject {
|
|
|
147
149
|
return hasConsentFor([1,3,4], purposeConsent, hasGoogleVendorConsent)
|
|
148
150
|
&& hasConsentOrLegitimateInterestFor([2,7,9,10], purposeConsent, purposeLI, hasGoogleVendorConsent, hasGoogleVendorLI)
|
|
149
151
|
}
|
|
152
|
+
|
|
153
|
+
private func isConsentOutdated() -> Bool {
|
|
154
|
+
let settings = UserDefaults.standard
|
|
155
|
+
guard let tcString = settings.string(forKey: "IABTCF_TCString"), !tcString.isEmpty else {
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// base64 alphabet used to store data in IABTCF string
|
|
160
|
+
let base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
161
|
+
|
|
162
|
+
// date is stored in digits 1..7 of the IABTCF string
|
|
163
|
+
let dateSubstring = String(tcString[tcString.index(tcString.startIndex, offsetBy: 1)..<tcString.index(tcString.startIndex, offsetBy: 7)])
|
|
164
|
+
|
|
165
|
+
// interpret date substring as base64-encoded integer value
|
|
166
|
+
var timestamp: Int64 = 0
|
|
167
|
+
|
|
168
|
+
for char in dateSubstring {
|
|
169
|
+
if let value = base64.firstIndex(of: char) {
|
|
170
|
+
timestamp = timestamp * 64 + Int64(value.utf16Offset(in: base64))
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// timestamp is given in deci-seconds, convert to milliseconds
|
|
175
|
+
timestamp *= 100
|
|
176
|
+
|
|
177
|
+
// compare with current timestamp to get age in days
|
|
178
|
+
let daysAgo = (Int64(Date().timeIntervalSince1970 * 1000) - timestamp) / (1000 * 60 * 60 * 24)
|
|
179
|
+
|
|
180
|
+
// delete TC string if age is over a year
|
|
181
|
+
if daysAgo > 365 {
|
|
182
|
+
settings.removeObject(forKey: "IABTCF_TCString")
|
|
183
|
+
return true
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return false
|
|
187
|
+
}
|
|
150
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ququplay/admob",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "A native plugin for AdMob",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"ios/Sources",
|
|
17
17
|
"ios/Tests",
|
|
18
18
|
"Package.swift",
|
|
19
|
-
"
|
|
19
|
+
"QuquplayAdmob.podspec"
|
|
20
20
|
],
|
|
21
21
|
"author": "Masahiko Sakakibara <sakakibara@rdlabo.jp>",
|
|
22
22
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
32
|
-
"verify:ios": "xcodebuild -scheme
|
|
32
|
+
"verify:ios": "xcodebuild -scheme QuquplayAdmob -destination generic/platform=iOS",
|
|
33
33
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
34
|
"verify:web": "npm run build",
|
|
35
35
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|