react-native-nami-sdk 2.0.5 → 3.0.8

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.
Files changed (56) hide show
  1. package/.github/workflows/app_stg.yaml +203 -0
  2. package/.pre-commit-config.yaml +1 -1
  3. package/android/build.gradle +24 -13
  4. package/android/gradle/wrapper/gradle-wrapper.properties +5 -1
  5. package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +6 -50
  6. package/android/src/main/java/com/nami/reactlibrary/NamiBridgePackage.java +1 -0
  7. package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +133 -0
  8. package/android/src/main/java/com/nami/reactlibrary/NamiCustomerManagerBridge.kt +88 -19
  9. package/android/src/main/java/com/nami/reactlibrary/NamiEmitter.kt +24 -24
  10. package/android/src/main/java/com/nami/reactlibrary/NamiEntitlementManagerBridgeModule.kt +30 -129
  11. package/android/src/main/java/com/nami/reactlibrary/NamiPaywallManagerBridgeModule.kt +36 -147
  12. package/android/src/main/java/com/nami/reactlibrary/NamiPurchaseManagerBridge.kt +36 -38
  13. package/android/src/main/java/com/nami/reactlibrary/NamiUtil.kt +50 -180
  14. package/build-utils/get_version_code.py +140 -0
  15. package/index.d.ts +20 -0
  16. package/index.js +7 -6
  17. package/ios/Nami.m +9 -63
  18. package/ios/NamiBridgeUtil.h +4 -6
  19. package/ios/NamiBridgeUtil.m +16 -78
  20. package/ios/NamiCampaignManagerBridge.m +26 -0
  21. package/ios/NamiCampaignManagerBridge.swift +107 -0
  22. package/ios/NamiCustomerManager.m +18 -23
  23. package/ios/NamiCustomerManager.swift +122 -0
  24. package/ios/NamiEmitter.m +55 -65
  25. package/ios/NamiEntitlementManagerBridge.m +7 -107
  26. package/ios/NamiEntitlementManagerBridge.swift +74 -0
  27. package/ios/NamiMLManagerBridge.m +2 -2
  28. package/ios/NamiPaywallManagerBridge.m +22 -94
  29. package/ios/NamiPaywallManagerBridge.swift +93 -0
  30. package/ios/NamiPurchaseManagerBridge.m +38 -69
  31. package/ios/NamiPurchaseManagerBridge.swift +174 -0
  32. package/ios/Podfile +2 -2
  33. package/ios/RNNami-Bridging-Header.h +5 -0
  34. package/ios/RNNami.h +0 -1
  35. package/ios/RNNami.m +1 -1
  36. package/ios/RNNami.xcodeproj/project.pbxproj +84 -8
  37. package/ios/RNNami.xcodeproj/xcshareddata/xcschemes/RNNami.xcscheme +67 -0
  38. package/package.json +1 -1
  39. package/react-native-nami-sdk.podspec +3 -3
  40. package/src/Nami.d.ts +112 -0
  41. package/src/Nami.js +10 -0
  42. package/src/NamiCampaignManager.d.ts +54 -0
  43. package/src/NamiCampaignManager.js +43 -0
  44. package/src/NamiCustomerManager.d.ts +39 -0
  45. package/src/NamiCustomerManager.js +43 -0
  46. package/src/NamiEntitlementManager.d.ts +24 -0
  47. package/src/NamiEntitlementManager.js +23 -0
  48. package/src/NamiMLManager.d.ts +5 -0
  49. package/src/NamiMLManager.js +7 -0
  50. package/src/NamiPaywallManager.d.ts +57 -0
  51. package/src/NamiPaywallManager.js +28 -0
  52. package/src/NamiPurchaseManager.d.ts +57 -0
  53. package/src/NamiPurchaseManager.js +37 -0
  54. package/src/types.ts +36 -0
  55. package/android/src/main/java/com/nami/reactlibrary/NamiAnalyticsEmitter.kt +0 -121
  56. package/ios/NamiAnalyticsEmitter.m +0 -146
@@ -7,7 +7,7 @@
7
7
  //
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
- #import <Nami/Nami.h>
10
+ #import <NamiApple/NamiApple.h>
11
11
  #import "NamiBridgeUtil.h"
12
12
 
13
13
  #import <React/RCTBridgeModule.h>
@@ -15,6 +15,26 @@
15
15
 
16
16
  #import "React/RCTViewManager.h"
17
17
 
18
+ @interface RCT_EXTERN_MODULE(RNNamiPurchaseManager, NSObject)
19
+
20
+ RCT_EXTERN_METHOD(allPurchases:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
21
+
22
+ RCT_EXTERN_METHOD(skuPurchased:(NSString *)skuId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
23
+
24
+ RCT_EXTERN_METHOD(anySkuPurchased:(NSArray*)skuIds resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
25
+
26
+ RCT_EXTERN_METHOD(consumePurchasedSku:(NSString *)skuId)
27
+
28
+ RCT_EXTERN_METHOD(registerPurchasesChangedHandler)
29
+
30
+ RCT_EXTERN_METHOD(registerRestorePurchasesHandler)
31
+
32
+ + (BOOL)requiresMainQueueSetup {
33
+ return YES;
34
+ }
35
+
36
+ @end
37
+
18
38
  @interface NamiEmitter : RCTEventEmitter
19
39
  - (void)sendRestorePurchasesStateChanged: (enum NamiRestorePurchasesState) state
20
40
  newPurchases: (NSArray<NamiPurchase *> * _Nonnull) newPurchases
@@ -37,27 +57,6 @@ RCT_EXTERN_METHOD(clearBypassStorePurchases)
37
57
  [NamiPurchaseManager clearBypassStorePurchases];
38
58
  }
39
59
 
40
- RCT_EXPORT_METHOD(purchases:(RCTResponseSenderBlock)completion)
41
- {
42
- NSArray <NamiPurchase *> *purchases = [NamiPurchaseManager allPurchases];
43
- NSMutableArray *convertedPurchaseDicts = [NSMutableArray new];
44
- BOOL anyProductNil = NO;
45
- for ( NamiPurchase *purchaseRecord in purchases ) {
46
- if ( purchaseRecord.skuID == nil ) {
47
- anyProductNil = YES;
48
- }
49
- NSDictionary *purchaseDict = [NamiBridgeUtil purchaseToPurchaseDict:purchaseRecord];
50
- [convertedPurchaseDicts addObject:purchaseDict];
51
- }
52
-
53
- completion(@[convertedPurchaseDicts]);
54
- }
55
-
56
- RCT_EXPORT_METHOD(isSKUIDPurchased:(nonnull NSString*)skuID completion:(RCTResponseSenderBlock)completion)
57
- {
58
- BOOL active = [NamiPurchaseManager isSKUIDPurchased:skuID];
59
- completion(@[[NSNumber numberWithBool:active]]);
60
- }
61
60
 
62
61
  RCT_EXPORT_METHOD(restorePurchasesWithCompletionHandler:(RCTResponseSenderBlock)completion)
63
62
  {
@@ -78,25 +77,6 @@ RCT_EXPORT_METHOD(restorePurchases)
78
77
  }];
79
78
  }
80
79
 
81
- /// Determines if any one of the passed in SKUID's have been purchased.
82
- RCT_EXPORT_METHOD(anySKUIDPurchased:(nonnull NSArray*)skuIDs completion:(RCTResponseSenderBlock)completion)
83
- {
84
- BOOL active = false;
85
- for (NamiPurchase *purchase in [NamiPurchaseManager allPurchases]) {
86
- if ( [skuIDs containsObject:purchase.skuID] ) {
87
- active = true;
88
- break;
89
- }
90
- }
91
-
92
- completion(@[[NSNumber numberWithBool:active]]);
93
- }
94
-
95
- /// For consumable purchases, removes the SKU from Nami so a product may be purchased again.
96
- RCT_EXPORT_METHOD(consumePurchasedSKU:(nonnull NSString*)skuID)
97
- {
98
- [NamiPurchaseManager consumePurchasedSKUWithSkuID:skuID];
99
- }
100
80
 
101
81
  /// For consumable purchases, removes the SKU from Nami so a product may be purchased again.
102
82
  RCT_EXPORT_METHOD(presentCodeRedemptionSheet)
@@ -118,34 +98,23 @@ RCT_EXPORT_METHOD(canPresentCodeRedemptionSheet:(RCTResponseSenderBlock)completi
118
98
  }
119
99
 
120
100
  /// This method does the purchase work, and can optionally be fed a paywall metadata object to pass along to the purchase flow.
121
- - (void) doSKUPurchaseWithSKUID:(nonnull NSString*)skuID namiPaywall:(NamiPaywall * _Nullable)namiPaywall completion:(RCTResponseSenderBlock)completion {
122
- [NamiPurchaseManager skusForSKUIDsWithSkuIDs:@[skuID] productHandler:^(BOOL success, NSArray<NamiSKU *> * _Nullable products, NSArray<NSString *> * _Nullable invalidProducts, NSError * _Nullable error) {
123
- NSLog(@"NamiBridge: Info: Products found are %@, product fetch error is %@", products, [error localizedDescription]);
124
- NamiSKU *useProduct = products.firstObject;
125
- if (useProduct != nil) {
126
- [NamiPurchaseManager buySKU:useProduct fromPaywall:namiPaywall responseHandler:^(NSArray<NamiPurchase *> * _Nonnull purchase, NamiPurchaseState purchaseState, NSError * _Nullable error) {
127
- NSLog(@"NamiBridge: Info: Purchase result is %@, purchased is %d, purchaseState is %@, error is %@", purchase, (purchaseState == NamiPurchaseStatePurchased), [NSNumber numberWithInt:(int)purchaseState], [error localizedDescription]);
128
- if (purchaseState == NamiPurchaseStatePurchased) {
129
- completion(@[[NSNumber numberWithBool:true]]);
130
- }
131
- }];
132
- } else {
133
- completion(@[[NSNumber numberWithBool:false]]);
134
- }
135
- }];
136
-
137
- }
138
-
139
- RCT_EXPORT_METHOD(buySKU:(nonnull NSString*)skuID paywallDeveloperID:(nonnull NSString*)paywallDeveloperID completion:(RCTResponseSenderBlock)completion)
140
- {
141
- if (paywallDeveloperID.length > 0) {
142
- [NamiPaywallManager fetchCustomPaywallMetaForDeveloperID:paywallDeveloperID :^(NSArray<NamiSKU *> * _Nullable products, NSString * _Nonnull developerPaywallID, NamiPaywall * _Nullable namiPaywall) {
143
- [self doSKUPurchaseWithSKUID:skuID namiPaywall:namiPaywall completion:completion];
144
- }];
145
- } else {
146
- [self doSKUPurchaseWithSKUID:skuID namiPaywall:nil completion:completion];
147
- }
148
- }
101
+ //- (void) doSKUPurchaseWithSKUID:(nonnull NSString*)skuID namiPaywall:(NamiPaywall * _Nullable)namiPaywall completion:(RCTResponseSenderBlock)completion {
102
+ // [NamiPurchaseManager skusForSKUIdsWithSkuIds:@[skuID] productHandler:^(BOOL success, NSArray<NamiSKU *> * _Nullable products, NSArray<NSString *> * _Nullable invalidProducts, NSError * _Nullable error) {
103
+ // NSLog(@"NamiBridge: Info: Products found are %@, product fetch error is %@", products, [error localizedDescription]);
104
+ // NamiSKU *useProduct = products.firstObject;
105
+ // if (useProduct != nil) {
106
+ // [NamiPurchaseManager buySku:useProduct responseHandler:^(NSArray<NamiPurchase *> * _Nonnull purchase, enum NamiPurchaseState purchaseState, NSError * _Nullable error) {
107
+ // NSLog(@"NamiBridge: Info: Purchase result is %@, purchased is %d, purchaseState is %@, error is %@", purchase, (purchaseState == NamiPurchaseStatePurchased), [NSNumber numberWithInt:(int)purchaseState], [error localizedDescription]);
108
+ // if (purchaseState == NamiPurchaseStatePurchased) {
109
+ // completion(@[[NSNumber numberWithBool:true]]);
110
+ // }
111
+ // }];
112
+ // } else {
113
+ // completion(@[[NSNumber numberWithBool:false]]);
114
+ // }
115
+ // }];
116
+ //
117
+ //}
149
118
 
150
119
  @end
151
120
 
@@ -0,0 +1,174 @@
1
+ //
2
+ // NamiPurchaseManagerBridge.swift
3
+ // RNNami
4
+ //
5
+ // Copyright © 2023 Nami ML Inc. All rights reserved.
6
+ //
7
+
8
+ import Foundation
9
+ import NamiApple
10
+ import React
11
+
12
+ @objc(RNNamiPurchaseManager)
13
+ class RNNamiPurchaseManager: RCTEventEmitter {
14
+ override func supportedEvents() -> [String]! {
15
+ return ["PurchasesChanged", "RestorePurchasesStateChanged"]
16
+ }
17
+
18
+ static func productToDict(_ product: SKProduct) -> NSDictionary {
19
+ let productDict: [String: Any?] = [
20
+ "localizedTitle": product.localizedTitle,
21
+ "localizedDescription": product.localizedDescription,
22
+ "localizedPrice": product.localizedPrice,
23
+ "localizedMultipliedPrice": product.localizedMultipliedPrice,
24
+ "price": product.price.stringValue,
25
+ "priceLanguage": product.priceLocale.languageCode,
26
+ "priceCurrency": product.priceLocale.currencyCode,
27
+ ]
28
+ return NSDictionary(dictionary: productDict.compactMapValues { $0 })
29
+ }
30
+
31
+ static func skuToSKUDict(_ sku: NamiSKU) -> NSDictionary {
32
+ var productDict: NSDictionary?
33
+ if let product = sku.product {
34
+ productDict = productToDict(product)
35
+ }
36
+
37
+ let typeString: String
38
+ switch sku.type {
39
+ case .unknown:
40
+ typeString = "unknown"
41
+ case .one_time_purchase:
42
+ typeString = "one_time_purchase"
43
+ case .subscription:
44
+ typeString = "subscription"
45
+ @unknown default:
46
+ typeString = "unknown"
47
+ }
48
+
49
+ let skuDict: [String: Any?] = [
50
+ "name": sku.name,
51
+ "skuId": sku.skuId,
52
+ "type": typeString,
53
+ "product": productDict,
54
+ // "displayText": sku.localizedDisplayText,
55
+ // "displaySubText": sku.localizedSubDisplayText,
56
+ ]
57
+
58
+ return NSDictionary(dictionary: skuDict.compactMapValues { $0 })
59
+ }
60
+
61
+ static func purchaseToPurchaseDict(_ purchase: NamiPurchase) -> NSDictionary {
62
+ var skuDictionary: NSDictionary?
63
+ if let sku = purchase.sku {
64
+ skuDictionary = RNNamiPurchaseManager.skuToSKUDict(sku)
65
+ }
66
+ let dateFormatter = DateFormatter()
67
+ dateFormatter.locale = .init(identifier: "en_US_POSIX")
68
+ dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
69
+ let expiresString = dateFormatter.string(from: purchase.expires ?? Date())
70
+ let purchaseInitiatedString = dateFormatter.string(from: purchase.purchaseInitiatedTimestamp)
71
+ let purchaseDict: [String: Any?] = [
72
+ "skuId": purchase.skuId,
73
+ "transactionIdentifier": purchase.transactionIdentifier,
74
+ "sku": skuDictionary,
75
+ "expires": expiresString,
76
+ "purchaseInitiatedTimestamp": purchaseInitiatedString,
77
+ ]
78
+ return NSDictionary(dictionary: purchaseDict.compactMapValues { $0 })
79
+ }
80
+
81
+ @objc(allPurchases:rejecter:)
82
+ func allPurchases(resolve: @escaping RCTPromiseResolveBlock, reject _: @escaping RCTPromiseRejectBlock) {
83
+ let allPurchases = NamiPurchaseManager.allPurchases()
84
+ let purchaseDictionaries = allPurchases.map { purchase in
85
+ RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
86
+ }
87
+ resolve(purchaseDictionaries)
88
+ }
89
+
90
+ @objc(skuPurchased:resolver:rejecter:)
91
+ func skuPurchased(skuId: String, resolve: @escaping RCTPromiseResolveBlock, reject _: @escaping RCTPromiseRejectBlock) {
92
+ let isSkuPurchased = NamiPurchaseManager.skuPurchased(skuId)
93
+ resolve(isSkuPurchased)
94
+ }
95
+
96
+ @objc(anySkuPurchased:resolver:rejecter:)
97
+ func anySkuPurchased(skuIds: [String], resolve: @escaping RCTPromiseResolveBlock, reject _: @escaping RCTPromiseRejectBlock) {
98
+ let isSkusPurchased = NamiPurchaseManager.anySkuPurchased(skuIds)
99
+ resolve(isSkusPurchased)
100
+ }
101
+
102
+ @objc(consumePurchasedSku:)
103
+ func consumePurchasedSku(skuId: String) {
104
+ NamiPurchaseManager.consumePurchasedSku(skuId: skuId)
105
+ }
106
+
107
+ @objc(registerPurchasesChangedHandler)
108
+ func registerPurchasesChangedHandler() {
109
+ NamiPurchaseManager.registerPurchasesChangedHandler { purchases, purchaseState, error in
110
+ let purchaseDictionaries = purchases.map { purchase in
111
+ RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
112
+ }
113
+ let stateString: String
114
+ switch purchaseState {
115
+ case .pending:
116
+ stateString = "pending"
117
+ case .purchased:
118
+ stateString = "purchased"
119
+ case .consumed:
120
+ stateString = "consumed"
121
+ case .resubscribed:
122
+ stateString = "resubscribed"
123
+ case .unsubscribed:
124
+ stateString = "unsubscribed"
125
+ case .deferred:
126
+ stateString = "deferred"
127
+ case .failed:
128
+ stateString = "failed"
129
+ case .cancelled:
130
+ stateString = "cancelled"
131
+ case .unknown:
132
+ stateString = "unknown"
133
+ @unknown default:
134
+ stateString = "unknown"
135
+ }
136
+
137
+ let payload: [String: Any?] = [
138
+ "purchases": purchaseDictionaries,
139
+ "purchaseState": stateString,
140
+ "error": error?.localizedDescription,
141
+ ]
142
+ self.sendEvent(withName: "PurchasesChanged", body: payload)
143
+ }
144
+ }
145
+
146
+ @objc(registerRestorePurchasesHandler)
147
+ func registerRestorePurchasesHandler() {
148
+ NamiPurchaseManager.registerRestorePurchasesHandler { state, newPurchases, oldPurchases, _ in
149
+ let stateString: String
150
+ switch state {
151
+ case .started:
152
+ stateString = "started"
153
+ case .finished:
154
+ stateString = "finished"
155
+ case .error:
156
+ stateString = "error"
157
+ @unknown default:
158
+ stateString = "error"
159
+ }
160
+ let newPurchasesDictionaries = newPurchases.map { purchase in
161
+ RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
162
+ }
163
+ let oldPurchasesDictionaries = oldPurchases.map { purchase in
164
+ RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
165
+ }
166
+ let payload: [String: Any?] = [
167
+ "state": stateString,
168
+ "newPurchases": newPurchasesDictionaries,
169
+ "oldPurchases": oldPurchasesDictionaries,
170
+ ]
171
+ self.sendEvent(withName: "RestorePurchasesStateChanged", body: payload)
172
+ }
173
+ }
174
+ }
package/ios/Podfile CHANGED
@@ -2,13 +2,13 @@
2
2
  require_relative '../node_modules/react-native/scripts/react_native_pods'
3
3
  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
4
4
 
5
- platform :ios, '11.2'
5
+ platform :ios, '14.0'
6
6
 
7
7
  source 'https://cdn.cocoapods.org/'
8
8
 
9
9
  target 'RNNami' do
10
10
  config = use_native_modules!
11
- pod 'Nami', '2.9.6'
11
+ pod "Nami", "3.0.8"
12
12
 
13
13
  use_react_native!(
14
14
  :path => config[:reactNativePath],
@@ -0,0 +1,5 @@
1
+ //
2
+ // Use this file to import your target's public headers that you would like to expose to Swift.
3
+ //
4
+ #import <React/RCTBridgeModule.h>
5
+ #import "NamiBridgeUtil.h"
package/ios/RNNami.h CHANGED
@@ -8,4 +8,3 @@
8
8
  @interface RNNami : NSObject <RCTBridgeModule>
9
9
 
10
10
  @end
11
-
package/ios/RNNami.m CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  #import "RNNami.h"
3
- #import <Nami/Nami.h>
3
+ #import <NamiApple/NamiApple.h>
4
4
 
5
5
  @implementation RNNami
6
6
 
@@ -18,6 +18,12 @@
18
18
  EBC59E6023C7E2EC008A123A /* NamiAnalyticsEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = EBC59E5F23C7E2EC008A123A /* NamiAnalyticsEmitter.m */; };
19
19
  EBC59E6323C7F634008A123A /* NamiBridgeUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */; };
20
20
  EBEEAC10243C29C800E01389 /* NamiMLManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */; };
21
+ FA3AB38529E009F300FD2E8D /* NamiPaywallManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */; };
22
+ FA4CEE3D29DEE01600058372 /* NamiPurchaseManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */; };
23
+ FA86299F29DDA881000090C6 /* NamiEntitlementManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */; };
24
+ FAADDB4F29D376590096591A /* NamiCampaignManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */; };
25
+ FAADDB5229D377560096591A /* NamiCampaignManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */; };
26
+ FAD132F729D6BD5E001059A2 /* NamiCustomerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */; };
21
27
  /* End PBXBuildFile section */
22
28
 
23
29
  /* Begin PBXCopyFilesBuildPhase section */
@@ -49,6 +55,13 @@
49
55
  EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiBridgeUtil.m; sourceTree = "<group>"; };
50
56
  EBC59E6423C7F7A0008A123A /* NamiBridgeUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NamiBridgeUtil.h; sourceTree = "<group>"; };
51
57
  EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiMLManagerBridge.m; sourceTree = "<group>"; };
58
+ FA02430629D2EAE00018CA56 /* RNNami-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNNami-Bridging-Header.h"; sourceTree = "<group>"; };
59
+ FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiPaywallManagerBridge.swift; sourceTree = "<group>"; };
60
+ FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiPurchaseManagerBridge.swift; sourceTree = "<group>"; };
61
+ FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiEntitlementManagerBridge.swift; sourceTree = "<group>"; };
62
+ FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamiCampaignManagerBridge.swift; sourceTree = "<group>"; };
63
+ FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamiCampaignManagerBridge.m; sourceTree = "<group>"; };
64
+ FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiCustomerManager.swift; sourceTree = "<group>"; };
52
65
  /* End PBXFileReference section */
53
66
 
54
67
  /* Begin PBXFrameworksBuildPhase section */
@@ -74,6 +87,12 @@
74
87
  58B511D21A9E6C8500147676 = {
75
88
  isa = PBXGroup;
76
89
  children = (
90
+ FA3AB38329E009D200FD2E8D /* NamiPaywallManager */,
91
+ FA4CEE3E29DEE01E00058372 /* NamiPurchaseManager */,
92
+ FA8629A029DDA8A5000090C6 /* NamiEntitlementManager */,
93
+ FADE7CFB29DD9875000BF262 /* NamiCustomerManager */,
94
+ FADE7CFA29DD984E000BF262 /* NamiCampaignManager */,
95
+ FA02430629D2EAE00018CA56 /* RNNami-Bridging-Header.h */,
77
96
  EBC59E6423C7F7A0008A123A /* NamiBridgeUtil.h */,
78
97
  EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */,
79
98
  B3E7B5881CC2AC0600A0062D /* RNNami.h */,
@@ -81,11 +100,7 @@
81
100
  EBC59E5C23C5514B008A123A /* Nami.m */,
82
101
  EB1C9AFA23BE9C5700CAD548 /* NamiEmitter.m */,
83
102
  EBC59E5F23C7E2EC008A123A /* NamiAnalyticsEmitter.m */,
84
- EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */,
85
- EB75992024F031E900430D98 /* NamiCustomerManager.m */,
86
- EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */,
87
103
  EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */,
88
- EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */,
89
104
  134814211AA4EA7D00B7C361 /* Products */,
90
105
  82475599A9F3B58440ACDC6E /* Frameworks */,
91
106
  A17A44E9FF56BDEADE788165 /* Pods */,
@@ -109,6 +124,51 @@
109
124
  path = Pods;
110
125
  sourceTree = "<group>";
111
126
  };
127
+ FA3AB38329E009D200FD2E8D /* NamiPaywallManager */ = {
128
+ isa = PBXGroup;
129
+ children = (
130
+ EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */,
131
+ FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */,
132
+ );
133
+ name = NamiPaywallManager;
134
+ sourceTree = "<group>";
135
+ };
136
+ FA4CEE3E29DEE01E00058372 /* NamiPurchaseManager */ = {
137
+ isa = PBXGroup;
138
+ children = (
139
+ FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */,
140
+ EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */,
141
+ );
142
+ name = NamiPurchaseManager;
143
+ sourceTree = "<group>";
144
+ };
145
+ FA8629A029DDA8A5000090C6 /* NamiEntitlementManager */ = {
146
+ isa = PBXGroup;
147
+ children = (
148
+ FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */,
149
+ EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */,
150
+ );
151
+ name = NamiEntitlementManager;
152
+ sourceTree = "<group>";
153
+ };
154
+ FADE7CFA29DD984E000BF262 /* NamiCampaignManager */ = {
155
+ isa = PBXGroup;
156
+ children = (
157
+ FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */,
158
+ FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */,
159
+ );
160
+ name = NamiCampaignManager;
161
+ sourceTree = "<group>";
162
+ };
163
+ FADE7CFB29DD9875000BF262 /* NamiCustomerManager */ = {
164
+ isa = PBXGroup;
165
+ children = (
166
+ FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */,
167
+ EB75992024F031E900430D98 /* NamiCustomerManager.m */,
168
+ );
169
+ name = NamiCustomerManager;
170
+ sourceTree = "<group>";
171
+ };
112
172
  /* End PBXGroup section */
113
173
 
114
174
  /* Begin PBXNativeTarget section */
@@ -141,6 +201,7 @@
141
201
  TargetAttributes = {
142
202
  58B511DA1A9E6C8500147676 = {
143
203
  CreatedOnToolsVersion = 6.1.1;
204
+ LastSwiftMigration = 1420;
144
205
  };
145
206
  };
146
207
  };
@@ -192,12 +253,18 @@
192
253
  isa = PBXSourcesBuildPhase;
193
254
  buildActionMask = 2147483647;
194
255
  files = (
256
+ FA3AB38529E009F300FD2E8D /* NamiPaywallManagerBridge.swift in Sources */,
195
257
  EBC59E6023C7E2EC008A123A /* NamiAnalyticsEmitter.m in Sources */,
196
258
  EBC59E5D23C5514B008A123A /* Nami.m in Sources */,
197
259
  EB1C9AFB23BE9C5700CAD548 /* NamiPurchaseManagerBridge.m in Sources */,
198
260
  EB1C9AFC23BE9C5700CAD548 /* NamiPaywallManagerBridge.m in Sources */,
199
261
  EBC59E6323C7F634008A123A /* NamiBridgeUtil.m in Sources */,
262
+ FA4CEE3D29DEE01600058372 /* NamiPurchaseManagerBridge.swift in Sources */,
263
+ FA86299F29DDA881000090C6 /* NamiEntitlementManagerBridge.swift in Sources */,
264
+ FAD132F729D6BD5E001059A2 /* NamiCustomerManager.swift in Sources */,
200
265
  B3E7B58A1CC2AC0600A0062D /* RNNami.m in Sources */,
266
+ FAADDB4F29D376590096591A /* NamiCampaignManagerBridge.swift in Sources */,
267
+ FAADDB5229D377560096591A /* NamiCampaignManagerBridge.m in Sources */,
201
268
  EB75992124F031E900430D98 /* NamiCustomerManager.m in Sources */,
202
269
  EB7B50CE243E314900EBA6B7 /* NamiEntitlementManagerBridge.m in Sources */,
203
270
  EBEEAC10243C29C800E01389 /* NamiMLManagerBridge.m in Sources */,
@@ -230,7 +297,7 @@
230
297
  COPY_PHASE_STRIP = NO;
231
298
  ENABLE_STRICT_OBJC_MSGSEND = YES;
232
299
  ENABLE_TESTABILITY = YES;
233
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
300
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
234
301
  GCC_C_LANGUAGE_STANDARD = gnu99;
235
302
  GCC_DYNAMIC_NO_PIC = NO;
236
303
  GCC_NO_COMMON_BLOCKS = YES;
@@ -246,7 +313,7 @@
246
313
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
247
314
  GCC_WARN_UNUSED_FUNCTION = YES;
248
315
  GCC_WARN_UNUSED_VARIABLE = YES;
249
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
316
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
250
317
  MTL_ENABLE_DEBUG_INFO = YES;
251
318
  ONLY_ACTIVE_ARCH = YES;
252
319
  SDKROOT = iphoneos;
@@ -275,7 +342,7 @@
275
342
  COPY_PHASE_STRIP = YES;
276
343
  ENABLE_NS_ASSERTIONS = NO;
277
344
  ENABLE_STRICT_OBJC_MSGSEND = YES;
278
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
345
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
279
346
  GCC_C_LANGUAGE_STANDARD = gnu99;
280
347
  GCC_NO_COMMON_BLOCKS = YES;
281
348
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -284,7 +351,7 @@
284
351
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
285
352
  GCC_WARN_UNUSED_FUNCTION = YES;
286
353
  GCC_WARN_UNUSED_VARIABLE = YES;
287
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
354
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
288
355
  MTL_ENABLE_DEBUG_INFO = NO;
289
356
  SDKROOT = iphoneos;
290
357
  VALIDATE_PRODUCT = YES;
@@ -295,6 +362,7 @@
295
362
  isa = XCBuildConfiguration;
296
363
  baseConfigurationReference = 5C0ED6F1EABFB69B20A67C29 /* Pods-RNNami.debug.xcconfig */;
297
364
  buildSettings = {
365
+ CLANG_ENABLE_MODULES = YES;
298
366
  HEADER_SEARCH_PATHS = (
299
367
  "$(inherited)",
300
368
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -302,10 +370,14 @@
302
370
  "$(SRCROOT)/../../react-native/React/**",
303
371
  "$(SRCROOT)/../../react-native/React/**",
304
372
  );
373
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
305
374
  LIBRARY_SEARCH_PATHS = "$(inherited)";
306
375
  OTHER_LDFLAGS = "-ObjC";
307
376
  PRODUCT_NAME = RNNami;
308
377
  SKIP_INSTALL = YES;
378
+ SWIFT_OBJC_BRIDGING_HEADER = "RNNami-Bridging-Header.h";
379
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
380
+ SWIFT_VERSION = 5.0;
309
381
  };
310
382
  name = Debug;
311
383
  };
@@ -313,6 +385,7 @@
313
385
  isa = XCBuildConfiguration;
314
386
  baseConfigurationReference = 90B290F36EAE177CDC017BA3 /* Pods-RNNami.release.xcconfig */;
315
387
  buildSettings = {
388
+ CLANG_ENABLE_MODULES = YES;
316
389
  HEADER_SEARCH_PATHS = (
317
390
  "$(inherited)",
318
391
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -320,10 +393,13 @@
320
393
  "$(SRCROOT)/../../react-native/React/**",
321
394
  "$(SRCROOT)/../../react-native/React/**",
322
395
  );
396
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
323
397
  LIBRARY_SEARCH_PATHS = "$(inherited)";
324
398
  OTHER_LDFLAGS = "-ObjC";
325
399
  PRODUCT_NAME = RNNami;
326
400
  SKIP_INSTALL = YES;
401
+ SWIFT_OBJC_BRIDGING_HEADER = "RNNami-Bridging-Header.h";
402
+ SWIFT_VERSION = 5.0;
327
403
  };
328
404
  name = Release;
329
405
  };
@@ -0,0 +1,67 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1420"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "58B511DA1A9E6C8500147676"
18
+ BuildableName = "libRNNami.a"
19
+ BlueprintName = "RNNami"
20
+ ReferencedContainer = "container:RNNami.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ </Testables>
32
+ </TestAction>
33
+ <LaunchAction
34
+ buildConfiguration = "Debug"
35
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+ launchStyle = "0"
38
+ useCustomWorkingDirectory = "NO"
39
+ ignoresPersistentStateOnLaunch = "NO"
40
+ debugDocumentVersioning = "YES"
41
+ debugServiceExtension = "internal"
42
+ allowLocationSimulation = "YES">
43
+ </LaunchAction>
44
+ <ProfileAction
45
+ buildConfiguration = "Release"
46
+ shouldUseLaunchSchemeArgsEnv = "YES"
47
+ savedToolIdentifier = ""
48
+ useCustomWorkingDirectory = "NO"
49
+ debugDocumentVersioning = "YES">
50
+ <MacroExpansion>
51
+ <BuildableReference
52
+ BuildableIdentifier = "primary"
53
+ BlueprintIdentifier = "58B511DA1A9E6C8500147676"
54
+ BuildableName = "libRNNami.a"
55
+ BlueprintName = "RNNami"
56
+ ReferencedContainer = "container:RNNami.xcodeproj">
57
+ </BuildableReference>
58
+ </MacroExpansion>
59
+ </ProfileAction>
60
+ <AnalyzeAction
61
+ buildConfiguration = "Debug">
62
+ </AnalyzeAction>
63
+ <ArchiveAction
64
+ buildConfiguration = "Release"
65
+ revealArchiveInOrganizer = "YES">
66
+ </ArchiveAction>
67
+ </Scheme>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nami-sdk",
3
- "version": "2.0.5",
3
+ "version": "3.0.8",
4
4
  "description": "React Native Module for Nami - Easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,12 +13,12 @@ Pod::Spec.new do |s|
13
13
  s.homepage = package['homepage']
14
14
  s.license = package['license']
15
15
 
16
- s.platform = :ios, "11.2"
16
+ s.platform = :ios, "14.0"
17
17
  s.source = { :git => "https://github.com/namiml/react-native-nami-sdk.git", :tag => "#{s.version}" }
18
- s.source_files = "ios/**/*.{h,m}"
18
+ s.source_files = "ios/**/*.{h,m,swift}"
19
19
  s.requires_arc = true
20
20
 
21
- s.dependency 'Nami', '2.9.6'
21
+ s.dependency 'Nami', '3.0.8'
22
22
  s.dependency 'React'
23
23
 
24
24
  end