Skip to content

Commit f68ee59

Browse files
author
Alexandr Makarov
committed
feat: add purchase method
1 parent 6521006 commit f68ee59

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ios/ApphudSdk.m

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ @interface RCT_EXTERN_MODULE(ApphudSdk, NSObject)
2626
withResolver:(RCTPromiseResolveBlock)resolve
2727
withRejecter:(RCTPromiseRejectBlock)reject)
2828

29+
RCT_EXTERN_METHOD(purchaseProduct:(NSDictionary)product
30+
withResolver:(RCTPromiseResolveBlock)resolve
31+
withRejecter:(RCTPromiseRejectBlock)reject)
32+
2933
RCT_EXTERN_METHOD(handlePushNotification:(NSDictionary)apsInfo
3034
withResolver:(RCTPromiseResolveBlock)resolve
3135
withRejecter:(RCTPromiseRejectBlock)reject)

ios/ApphudSdk.swift

+7
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ class ApphudSdk: NSObject {
7979
}
8080
}
8181

82+
@objc(purchaseProduct:withResolver:withRejecter:)
83+
func purchaseProduct(product: ApphudProduct, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
84+
Apphud.purchase(product) { result in
85+
resolve(result)
86+
}
87+
}
88+
8289
@objc(willPurchaseFromPaywall:withResolver:withRejecter:)
8390
func willPurchaseFromPaywall(productIdentifier:String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
8491
Apphud.willPurchaseProductFromPaywall(productIdentifier);

0 commit comments

Comments
 (0)