@capacitor-community/admob 5.1.0 → 5.2.0
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/README.md
CHANGED
|
@@ -177,6 +177,13 @@ If you testing on real device, you have to set `debugGeography` and add your dev
|
|
|
177
177
|
|
|
178
178
|
**Note**: When testing, if you choose not consent (Manage -> Confirm Choices). The ads may not load/show. Even on testing enviroment. This is normal. It will work on Production so don't worry.
|
|
179
179
|
|
|
180
|
+
**Note**: The order in which they are combined with other methods is as follows.
|
|
181
|
+
|
|
182
|
+
1. AdMob.initialize
|
|
183
|
+
2. AdMob.requestConsentInfo
|
|
184
|
+
3. AdMob.showConsentForm (If consent form required )
|
|
185
|
+
3/ AdMob.showBanner
|
|
186
|
+
|
|
180
187
|
### Show Banner
|
|
181
188
|
|
|
182
189
|
```ts
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,7 @@ ext {
|
|
|
4
4
|
androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
|
|
5
5
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
6
6
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
7
|
-
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '22.
|
|
7
|
+
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '22.4.0'
|
|
8
8
|
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.10.0'
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -3,60 +3,60 @@ import Capacitor
|
|
|
3
3
|
import GoogleMobileAds
|
|
4
4
|
import UserMessagingPlatform
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
class ConsentExecutor: NSObject {
|
|
8
7
|
public weak var plugin: AdMob?
|
|
9
8
|
|
|
10
|
-
func requestConsentInfo(_ call: CAPPluginCall, _ debugGeography: Int, _ testDeviceIdentifiers:
|
|
9
|
+
func requestConsentInfo(_ call: CAPPluginCall, _ debugGeography: Int, _ testDeviceIdentifiers: [String], _ tagForUnderAgeOfConsent: Bool) {
|
|
11
10
|
let parameters = UMPRequestParameters()
|
|
12
11
|
let debugSettings = UMPDebugSettings()
|
|
13
|
-
|
|
12
|
+
|
|
14
13
|
debugSettings.geography = UMPDebugGeography(rawValue: debugGeography) ?? UMPDebugGeography.disabled
|
|
15
14
|
debugSettings.testDeviceIdentifiers = testDeviceIdentifiers
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
parameters.debugSettings = debugSettings
|
|
18
17
|
parameters.tagForUnderAgeOfConsent = tagForUnderAgeOfConsent
|
|
19
18
|
|
|
20
19
|
// Request an update to the consent information.
|
|
21
20
|
UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
with: parameters,
|
|
22
|
+
completionHandler: { error in
|
|
23
|
+
if error != nil {
|
|
24
|
+
call.reject("Request consent info failed")
|
|
25
|
+
} else {
|
|
26
|
+
call.resolve([
|
|
27
|
+
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
|
|
28
|
+
"isConsentFormAvailable": UMPConsentInformation.sharedInstance.formStatus == UMPFormStatus.available
|
|
29
|
+
])
|
|
30
|
+
}
|
|
31
|
+
})
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
func showConsentForm(_ call: CAPPluginCall) {
|
|
36
35
|
if let rootViewController = plugin?.getRootVC() {
|
|
37
36
|
let formStatus = UMPConsentInformation.sharedInstance.formStatus
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
if formStatus == UMPFormStatus.available {
|
|
40
39
|
UMPConsentForm.load(completionHandler: {form, loadError in
|
|
41
40
|
if loadError != nil {
|
|
42
41
|
call.reject(loadError?.localizedDescription ?? "Load consent form error")
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if UMPConsentInformation.sharedInstance.consentStatus == UMPConsentStatus.required {
|
|
46
|
+
form?.present(from: rootViewController, completionHandler: { dismissError in
|
|
47
|
+
if dismissError != nil {
|
|
48
|
+
call.reject(dismissError?.localizedDescription ?? "Consent dismiss error")
|
|
49
|
+
return
|
|
50
|
+
}
|
|
52
51
|
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
} else {
|
|
56
52
|
call.resolve([
|
|
57
|
-
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus)
|
|
53
|
+
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus)
|
|
58
54
|
])
|
|
59
|
-
}
|
|
55
|
+
})
|
|
56
|
+
} else {
|
|
57
|
+
call.resolve([
|
|
58
|
+
"status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus)
|
|
59
|
+
])
|
|
60
60
|
}
|
|
61
61
|
})
|
|
62
62
|
} else {
|
|
@@ -71,17 +71,17 @@ class ConsentExecutor: NSObject {
|
|
|
71
71
|
UMPConsentInformation.sharedInstance.reset()
|
|
72
72
|
call.resolve()
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
func getConsentStatusString(_ consentStatus: UMPConsentStatus) -> String {
|
|
76
|
-
switch
|
|
76
|
+
switch consentStatus {
|
|
77
77
|
case UMPConsentStatus.required:
|
|
78
|
-
return "REQUIRED"
|
|
78
|
+
return "REQUIRED"
|
|
79
79
|
case UMPConsentStatus.notRequired:
|
|
80
|
-
return "NOT_REQUIRED"
|
|
80
|
+
return "NOT_REQUIRED"
|
|
81
81
|
case UMPConsentStatus.obtained:
|
|
82
|
-
return "OBTAINED"
|
|
82
|
+
return "OBTAINED"
|
|
83
83
|
default:
|
|
84
|
-
return "UNKNOWN"
|
|
84
|
+
return "UNKNOWN"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|