@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.
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.swift_version = '5.1'
16
16
  s.static_framework = true
17
17
  s.dependency 'Capacitor'
18
- s.dependency 'Google-Mobile-Ads-SDK', '10.1.0'
18
+ s.dependency 'Google-Mobile-Ads-SDK', '10.12.0'
19
19
  end
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
@@ -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.0.0'
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: 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.2.0",
4
4
  "description": "A native plugin for AdMob",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",