@capacitor-community/admob 5.1.0 → 5.1.1

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.
@@ -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: Array<String>, _ tagForUnderAgeOfConsent: Bool) {
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
- with: parameters,
23
- completionHandler: { error in
24
- if error != nil {
25
- call.reject("Request consent info failed")
26
- } else {
27
- call.resolve([
28
- "status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
29
- "isConsentFormAvailable": UMPConsentInformation.sharedInstance.formStatus == UMPFormStatus.available
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
- } else {
44
- if UMPConsentInformation.sharedInstance.consentStatus == UMPConsentStatus.required {
45
- form?.present(from: rootViewController, completionHandler: { dismissError in
46
- if (dismissError != nil) {
47
- call.resolve([
48
- "status": self.getConsentStatusString(UMPConsentInformation.sharedInstance.consentStatus),
49
- ])
50
- } else {
51
- call.reject(dismissError?.localizedDescription ?? "Consent dismiss error")
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 (consentStatus) {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/admob",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "A native plugin for AdMob",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",