@revenuecat/purchases-capacitor 11.3.0 → 11.3.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.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommon', '17.23.0'
16
+ s.dependency 'PurchasesHybridCommon', '17.24.0'
17
17
  s.swift_version = '5.1'
18
18
  end
@@ -11,7 +11,7 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:8.13.1'
14
+ classpath 'com.android.tools.build:gradle:8.13.2'
15
15
  classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20'
16
16
  }
17
17
  }
@@ -56,7 +56,7 @@ dependencies {
56
56
  implementation fileTree(dir: 'libs', include: ['*.jar'])
57
57
  implementation project(':capacitor-android')
58
58
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
59
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.23.0'
59
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.24.0'
60
60
  testImplementation "junit:junit:$junitVersion"
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -83,7 +83,7 @@ class PurchasesPlugin : Plugin() {
83
83
 
84
84
  companion object {
85
85
  private const val PLATFORM_NAME = "capacitor"
86
- private const val PLUGIN_VERSION = "11.3.0"
86
+ private const val PLUGIN_VERSION = "11.3.1"
87
87
 
88
88
  private const val CUSTOMER_INFO_KEY = "customerInfo"
89
89
  }
@@ -20,6 +20,27 @@ internal extension PurchasesPlugin {
20
20
  call.reject("\(error.message)", "\(error.code)", error.error)
21
21
  }
22
22
 
23
+ func getNullableCompletionBlockHandler(_ call: CAPPluginCall,
24
+ wrapperKey: String? = nil) -> (([String: Any]?, ErrorContainer?) -> Void) {
25
+ func handleResponse(response: [String: Any]?, error: ErrorContainer?) {
26
+ if let error {
27
+ rejectWithErrorContainer(call, error: error)
28
+ } else if let response {
29
+ let mapToResolve: [String: Any] = {
30
+ if let wrapperKey {
31
+ return [wrapperKey: response]
32
+ } else {
33
+ return response
34
+ }
35
+ }()
36
+ call.resolve(mapToResolve)
37
+ } else {
38
+ call.resolve()
39
+ }
40
+ }
41
+ return handleResponse
42
+ }
43
+
23
44
  func getCompletionBlockHandler(_ call: CAPPluginCall,
24
45
  wrapperKey: String? = nil) -> (([String: Any]?, ErrorContainer?) -> Void) {
25
46
  func handleResponse(response: [String: Any]?, error: ErrorContainer?) {
@@ -88,7 +88,7 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate, CAPBridgedPlugin {
88
88
  CAPPluginMethod(name: "removeShouldPurchasePromoProductListener", returnType: CAPPluginReturnPromise),
89
89
  ]
90
90
  private let platformFlavor = "capacitor"
91
- private let platformVersion = "11.3.0"
91
+ private let platformVersion = "11.3.1"
92
92
 
93
93
  private let customerInfoKey = "customerInfo"
94
94
  private let transactionKey = "transaction"
@@ -234,7 +234,7 @@ public class PurchasesPlugin: CAPPlugin, PurchasesDelegate, CAPBridgedPlugin {
234
234
  @objc func getCurrentOfferingForPlacement(_ call: CAPPluginCall) {
235
235
  guard self.rejectIfPurchasesNotConfigured(call) else { return }
236
236
  guard let placementIdentifier = call.getOrRejectString("placementIdentifier") else { return }
237
- CommonFunctionality.getCurrentOffering(forPlacement: placementIdentifier, completion: self.getCompletionBlockHandler(call))
237
+ CommonFunctionality.getCurrentOffering(forPlacement: placementIdentifier, completion: self.getNullableCompletionBlockHandler(call))
238
238
  }
239
239
 
240
240
  @objc func syncAttributesAndOfferingsIfNeeded(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-capacitor",
3
- "version": "11.3.0",
3
+ "version": "11.3.1",
4
4
  "description": "Capacitor in-app purchases and subscriptions made easy. Support for iOS and Android.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -76,6 +76,6 @@
76
76
  }
77
77
  },
78
78
  "dependencies": {
79
- "@revenuecat/purchases-typescript-internal-esm": "17.23.0"
79
+ "@revenuecat/purchases-typescript-internal-esm": "17.24.0"
80
80
  }
81
81
  }