react-native-nami-sdk 2.0.5 → 3.0.9

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 +7 -51
  6. package/android/src/main/java/com/nami/reactlibrary/NamiBridgePackage.java +1 -0
  7. package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +136 -0
  8. package/android/src/main/java/com/nami/reactlibrary/NamiCustomerManagerBridge.kt +97 -18
  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 +133 -149
  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 +112 -0
  22. package/ios/NamiCustomerManager.m +22 -23
  23. package/ios/NamiCustomerManager.swift +132 -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 +83 -11
  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 +57 -0
  43. package/src/NamiCampaignManager.js +54 -0
  44. package/src/NamiCustomerManager.d.ts +41 -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 +82 -0
  51. package/src/NamiPaywallManager.js +37 -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.9"
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
 
@@ -15,9 +15,14 @@
15
15
  EB75992124F031E900430D98 /* NamiCustomerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EB75992024F031E900430D98 /* NamiCustomerManager.m */; };
16
16
  EB7B50CE243E314900EBA6B7 /* NamiEntitlementManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */; };
17
17
  EBC59E5D23C5514B008A123A /* Nami.m in Sources */ = {isa = PBXBuildFile; fileRef = EBC59E5C23C5514B008A123A /* Nami.m */; };
18
- EBC59E6023C7E2EC008A123A /* NamiAnalyticsEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = EBC59E5F23C7E2EC008A123A /* NamiAnalyticsEmitter.m */; };
19
18
  EBC59E6323C7F634008A123A /* NamiBridgeUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */; };
20
19
  EBEEAC10243C29C800E01389 /* NamiMLManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */; };
20
+ FA3AB38529E009F300FD2E8D /* NamiPaywallManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */; };
21
+ FA4CEE3D29DEE01600058372 /* NamiPurchaseManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */; };
22
+ FA86299F29DDA881000090C6 /* NamiEntitlementManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */; };
23
+ FAADDB4F29D376590096591A /* NamiCampaignManagerBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */; };
24
+ FAADDB5229D377560096591A /* NamiCampaignManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */; };
25
+ FAD132F729D6BD5E001059A2 /* NamiCustomerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */; };
21
26
  /* End PBXBuildFile section */
22
27
 
23
28
  /* Begin PBXCopyFilesBuildPhase section */
@@ -45,10 +50,16 @@
45
50
  EB75992024F031E900430D98 /* NamiCustomerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiCustomerManager.m; sourceTree = "<group>"; };
46
51
  EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiEntitlementManagerBridge.m; sourceTree = "<group>"; };
47
52
  EBC59E5C23C5514B008A123A /* Nami.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Nami.m; sourceTree = "<group>"; };
48
- EBC59E5F23C7E2EC008A123A /* NamiAnalyticsEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiAnalyticsEmitter.m; sourceTree = "<group>"; };
49
53
  EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiBridgeUtil.m; sourceTree = "<group>"; };
50
54
  EBC59E6423C7F7A0008A123A /* NamiBridgeUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NamiBridgeUtil.h; sourceTree = "<group>"; };
51
55
  EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NamiMLManagerBridge.m; sourceTree = "<group>"; };
56
+ FA02430629D2EAE00018CA56 /* RNNami-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNNami-Bridging-Header.h"; sourceTree = "<group>"; };
57
+ FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiPaywallManagerBridge.swift; sourceTree = "<group>"; };
58
+ FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiPurchaseManagerBridge.swift; sourceTree = "<group>"; };
59
+ FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiEntitlementManagerBridge.swift; sourceTree = "<group>"; };
60
+ FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamiCampaignManagerBridge.swift; sourceTree = "<group>"; };
61
+ FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamiCampaignManagerBridge.m; sourceTree = "<group>"; };
62
+ FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamiCustomerManager.swift; sourceTree = "<group>"; };
52
63
  /* End PBXFileReference section */
53
64
 
54
65
  /* Begin PBXFrameworksBuildPhase section */
@@ -74,18 +85,19 @@
74
85
  58B511D21A9E6C8500147676 = {
75
86
  isa = PBXGroup;
76
87
  children = (
88
+ FA3AB38329E009D200FD2E8D /* NamiPaywallManager */,
89
+ FA4CEE3E29DEE01E00058372 /* NamiPurchaseManager */,
90
+ FA8629A029DDA8A5000090C6 /* NamiEntitlementManager */,
91
+ FADE7CFB29DD9875000BF262 /* NamiCustomerManager */,
92
+ FADE7CFA29DD984E000BF262 /* NamiCampaignManager */,
93
+ FA02430629D2EAE00018CA56 /* RNNami-Bridging-Header.h */,
77
94
  EBC59E6423C7F7A0008A123A /* NamiBridgeUtil.h */,
78
95
  EBC59E6223C7F634008A123A /* NamiBridgeUtil.m */,
79
96
  B3E7B5881CC2AC0600A0062D /* RNNami.h */,
80
97
  B3E7B5891CC2AC0600A0062D /* RNNami.m */,
81
98
  EBC59E5C23C5514B008A123A /* Nami.m */,
82
99
  EB1C9AFA23BE9C5700CAD548 /* NamiEmitter.m */,
83
- EBC59E5F23C7E2EC008A123A /* NamiAnalyticsEmitter.m */,
84
- EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */,
85
- EB75992024F031E900430D98 /* NamiCustomerManager.m */,
86
- EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */,
87
100
  EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */,
88
- EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */,
89
101
  134814211AA4EA7D00B7C361 /* Products */,
90
102
  82475599A9F3B58440ACDC6E /* Frameworks */,
91
103
  A17A44E9FF56BDEADE788165 /* Pods */,
@@ -109,6 +121,51 @@
109
121
  path = Pods;
110
122
  sourceTree = "<group>";
111
123
  };
124
+ FA3AB38329E009D200FD2E8D /* NamiPaywallManager */ = {
125
+ isa = PBXGroup;
126
+ children = (
127
+ EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */,
128
+ FA3AB38429E009F300FD2E8D /* NamiPaywallManagerBridge.swift */,
129
+ );
130
+ name = NamiPaywallManager;
131
+ sourceTree = "<group>";
132
+ };
133
+ FA4CEE3E29DEE01E00058372 /* NamiPurchaseManager */ = {
134
+ isa = PBXGroup;
135
+ children = (
136
+ FA4CEE3C29DEE01600058372 /* NamiPurchaseManagerBridge.swift */,
137
+ EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */,
138
+ );
139
+ name = NamiPurchaseManager;
140
+ sourceTree = "<group>";
141
+ };
142
+ FA8629A029DDA8A5000090C6 /* NamiEntitlementManager */ = {
143
+ isa = PBXGroup;
144
+ children = (
145
+ FA86299E29DDA881000090C6 /* NamiEntitlementManagerBridge.swift */,
146
+ EB7B50CD243E314900EBA6B7 /* NamiEntitlementManagerBridge.m */,
147
+ );
148
+ name = NamiEntitlementManager;
149
+ sourceTree = "<group>";
150
+ };
151
+ FADE7CFA29DD984E000BF262 /* NamiCampaignManager */ = {
152
+ isa = PBXGroup;
153
+ children = (
154
+ FAADDB5129D377560096591A /* NamiCampaignManagerBridge.m */,
155
+ FAADDB4D29D376590096591A /* NamiCampaignManagerBridge.swift */,
156
+ );
157
+ name = NamiCampaignManager;
158
+ sourceTree = "<group>";
159
+ };
160
+ FADE7CFB29DD9875000BF262 /* NamiCustomerManager */ = {
161
+ isa = PBXGroup;
162
+ children = (
163
+ FAD132F629D6BD5E001059A2 /* NamiCustomerManager.swift */,
164
+ EB75992024F031E900430D98 /* NamiCustomerManager.m */,
165
+ );
166
+ name = NamiCustomerManager;
167
+ sourceTree = "<group>";
168
+ };
112
169
  /* End PBXGroup section */
113
170
 
114
171
  /* Begin PBXNativeTarget section */
@@ -141,6 +198,7 @@
141
198
  TargetAttributes = {
142
199
  58B511DA1A9E6C8500147676 = {
143
200
  CreatedOnToolsVersion = 6.1.1;
201
+ LastSwiftMigration = 1420;
144
202
  };
145
203
  };
146
204
  };
@@ -192,12 +250,17 @@
192
250
  isa = PBXSourcesBuildPhase;
193
251
  buildActionMask = 2147483647;
194
252
  files = (
195
- EBC59E6023C7E2EC008A123A /* NamiAnalyticsEmitter.m in Sources */,
253
+ FA3AB38529E009F300FD2E8D /* NamiPaywallManagerBridge.swift in Sources */,
196
254
  EBC59E5D23C5514B008A123A /* Nami.m in Sources */,
197
255
  EB1C9AFB23BE9C5700CAD548 /* NamiPurchaseManagerBridge.m in Sources */,
198
256
  EB1C9AFC23BE9C5700CAD548 /* NamiPaywallManagerBridge.m in Sources */,
199
257
  EBC59E6323C7F634008A123A /* NamiBridgeUtil.m in Sources */,
258
+ FA4CEE3D29DEE01600058372 /* NamiPurchaseManagerBridge.swift in Sources */,
259
+ FA86299F29DDA881000090C6 /* NamiEntitlementManagerBridge.swift in Sources */,
260
+ FAD132F729D6BD5E001059A2 /* NamiCustomerManager.swift in Sources */,
200
261
  B3E7B58A1CC2AC0600A0062D /* RNNami.m in Sources */,
262
+ FAADDB4F29D376590096591A /* NamiCampaignManagerBridge.swift in Sources */,
263
+ FAADDB5229D377560096591A /* NamiCampaignManagerBridge.m in Sources */,
201
264
  EB75992124F031E900430D98 /* NamiCustomerManager.m in Sources */,
202
265
  EB7B50CE243E314900EBA6B7 /* NamiEntitlementManagerBridge.m in Sources */,
203
266
  EBEEAC10243C29C800E01389 /* NamiMLManagerBridge.m in Sources */,
@@ -246,7 +309,7 @@
246
309
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
247
310
  GCC_WARN_UNUSED_FUNCTION = YES;
248
311
  GCC_WARN_UNUSED_VARIABLE = YES;
249
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
312
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
250
313
  MTL_ENABLE_DEBUG_INFO = YES;
251
314
  ONLY_ACTIVE_ARCH = YES;
252
315
  SDKROOT = iphoneos;
@@ -275,7 +338,7 @@
275
338
  COPY_PHASE_STRIP = YES;
276
339
  ENABLE_NS_ASSERTIONS = NO;
277
340
  ENABLE_STRICT_OBJC_MSGSEND = YES;
278
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
341
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
279
342
  GCC_C_LANGUAGE_STANDARD = gnu99;
280
343
  GCC_NO_COMMON_BLOCKS = YES;
281
344
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -284,7 +347,7 @@
284
347
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
285
348
  GCC_WARN_UNUSED_FUNCTION = YES;
286
349
  GCC_WARN_UNUSED_VARIABLE = YES;
287
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
350
+ IPHONEOS_DEPLOYMENT_TARGET = 14.0;
288
351
  MTL_ENABLE_DEBUG_INFO = NO;
289
352
  SDKROOT = iphoneos;
290
353
  VALIDATE_PRODUCT = YES;
@@ -295,6 +358,7 @@
295
358
  isa = XCBuildConfiguration;
296
359
  baseConfigurationReference = 5C0ED6F1EABFB69B20A67C29 /* Pods-RNNami.debug.xcconfig */;
297
360
  buildSettings = {
361
+ CLANG_ENABLE_MODULES = YES;
298
362
  HEADER_SEARCH_PATHS = (
299
363
  "$(inherited)",
300
364
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -302,10 +366,14 @@
302
366
  "$(SRCROOT)/../../react-native/React/**",
303
367
  "$(SRCROOT)/../../react-native/React/**",
304
368
  );
369
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
305
370
  LIBRARY_SEARCH_PATHS = "$(inherited)";
306
371
  OTHER_LDFLAGS = "-ObjC";
307
372
  PRODUCT_NAME = RNNami;
308
373
  SKIP_INSTALL = YES;
374
+ SWIFT_OBJC_BRIDGING_HEADER = "RNNami-Bridging-Header.h";
375
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
376
+ SWIFT_VERSION = 5.0;
309
377
  };
310
378
  name = Debug;
311
379
  };
@@ -313,6 +381,7 @@
313
381
  isa = XCBuildConfiguration;
314
382
  baseConfigurationReference = 90B290F36EAE177CDC017BA3 /* Pods-RNNami.release.xcconfig */;
315
383
  buildSettings = {
384
+ CLANG_ENABLE_MODULES = YES;
316
385
  HEADER_SEARCH_PATHS = (
317
386
  "$(inherited)",
318
387
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
@@ -320,10 +389,13 @@
320
389
  "$(SRCROOT)/../../react-native/React/**",
321
390
  "$(SRCROOT)/../../react-native/React/**",
322
391
  );
392
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
323
393
  LIBRARY_SEARCH_PATHS = "$(inherited)";
324
394
  OTHER_LDFLAGS = "-ObjC";
325
395
  PRODUCT_NAME = RNNami;
326
396
  SKIP_INSTALL = YES;
397
+ SWIFT_OBJC_BRIDGING_HEADER = "RNNami-Bridging-Header.h";
398
+ SWIFT_VERSION = 5.0;
327
399
  };
328
400
  name = Release;
329
401
  };
@@ -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.9",
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.9'
22
22
  s.dependency 'React'
23
23
 
24
24
  end