react-native-nami-sdk 2.0.2 → 2.0.4
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.
- package/.github/workflows/build.yml +3 -1
- package/README.md +13 -2
- package/android/build.gradle +5 -3
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +16 -5
- package/ios/Nami.m +14 -8
- package/ios/Podfile +1 -1
- package/ios/RNNami.xcodeproj/project.pbxproj +2 -2
- package/package.json +1 -1
- package/react-native-nami-sdk.podspec +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# React Native Bridge for the Nami SDK
|
|
4
4
|
|
|
5
|
-
Nami is
|
|
5
|
+
Nami is easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This library helps you easily offer in-app purchases and subscriptions using Apple App Store StoreKit & Google Play Billing APIs.
|
|
8
|
+
- No IAP code to write.
|
|
9
|
+
- Focus on your app experience.
|
|
10
|
+
- All edge cases are handled and no server is required.
|
|
11
|
+
- Includes is powerful built-in paywalls templates, built with native SwiftUI and Jetpack Compose
|
|
12
|
+
- Update paywalls easily using a browser-based paywall CMS.
|
|
13
|
+
- Conduct paywall A/B tests, to improve your conversion rate.
|
|
14
|
+
- Robust subscription analytics, webhooks, and much more.
|
|
15
|
+
|
|
16
|
+
Requires an account with Nami. The free tier is generous and includes everything you need to get up and running.
|
|
17
|
+
|
|
18
|
+
See https://www.namiml.com for more details and to create a free account.
|
|
8
19
|
|
|
9
20
|
## Getting started with React Native and Nami
|
|
10
21
|
|
package/android/build.gradle
CHANGED
|
@@ -17,8 +17,9 @@ def safeExtGet(prop, fallback) {
|
|
|
17
17
|
apply plugin: 'com.android.library'
|
|
18
18
|
apply plugin: 'maven'
|
|
19
19
|
apply plugin: "kotlin-android"
|
|
20
|
+
apply plugin: "kotlin-android-extensions"
|
|
20
21
|
buildscript {
|
|
21
|
-
ext.kotlin_version = '1.
|
|
22
|
+
ext.kotlin_version = '1.6.10'
|
|
22
23
|
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
23
24
|
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
24
25
|
// module dependency in an application project.
|
|
@@ -57,7 +58,8 @@ android {
|
|
|
57
58
|
repositories {
|
|
58
59
|
mavenCentral()
|
|
59
60
|
// ref: https://www.baeldung.com/maven-local-repository
|
|
60
|
-
|
|
61
|
+
mavenLocal()
|
|
62
|
+
maven { url("https://packages.namiml.com/NamiSDK/Android/") }
|
|
61
63
|
maven {
|
|
62
64
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
63
65
|
url("$rootDir/../node_modules/react-native/android")
|
|
@@ -74,7 +76,7 @@ dependencies {
|
|
|
74
76
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
75
77
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
76
78
|
|
|
77
|
-
implementation "com.namiml:sdk-android:2.0.
|
|
79
|
+
implementation "com.namiml:sdk-android:2.0.2"
|
|
78
80
|
|
|
79
81
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
80
82
|
}
|
|
@@ -17,6 +17,7 @@ import com.namiml.NamiConfiguration
|
|
|
17
17
|
import com.namiml.NamiExternalIdentifierType
|
|
18
18
|
import com.namiml.NamiLanguageCode
|
|
19
19
|
import com.namiml.NamiLogLevel
|
|
20
|
+
//import com.namiml.NamiApiResponseHandler
|
|
20
21
|
|
|
21
22
|
class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
22
23
|
ReactContextBaseJavaModule(reactContext) {
|
|
@@ -127,7 +128,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
127
128
|
} else {
|
|
128
129
|
Arguments.createArray()
|
|
129
130
|
}
|
|
130
|
-
val settingsList = mutableListOf("extendedClientInfo:react-native:
|
|
131
|
+
val settingsList = mutableListOf("extendedClientInfo:react-native:2.0.4")
|
|
131
132
|
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
|
|
132
133
|
settingsList.addAll(commandsFromReact)
|
|
133
134
|
}
|
|
@@ -144,7 +145,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
@ReactMethod
|
|
147
|
-
fun setExternalIdentifier(externalIdentifier: String, externalIDType: String) {
|
|
148
|
+
fun setExternalIdentifier(externalIdentifier: String, externalIDType: String, completion: Callback) {
|
|
148
149
|
|
|
149
150
|
Log.i(LOG_TAG, "Setting external identifier $externalIdentifier of type $externalIDType")
|
|
150
151
|
|
|
@@ -155,7 +156,12 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
reactApplicationContext.runOnUiQueueThread {
|
|
158
|
-
Nami.setExternalIdentifier(externalIdentifier, useType)
|
|
159
|
+
Nami.setExternalIdentifier(externalIdentifier, useType) { success, error ->
|
|
160
|
+
if (error != null) {
|
|
161
|
+
completion.invoke(error)
|
|
162
|
+
}
|
|
163
|
+
completion.invoke(null)
|
|
164
|
+
}
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
167
|
|
|
@@ -172,10 +178,15 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
172
178
|
}
|
|
173
179
|
|
|
174
180
|
@ReactMethod
|
|
175
|
-
fun clearExternalIdentifier() {
|
|
181
|
+
fun clearExternalIdentifier(completion: Callback) {
|
|
176
182
|
Log.i(LOG_TAG, "Clearing external identifier.")
|
|
177
183
|
reactApplicationContext.runOnUiQueueThread {
|
|
178
|
-
Nami.clearExternalIdentifier()
|
|
184
|
+
Nami.clearExternalIdentifier() { success, error ->
|
|
185
|
+
if (error != null) {
|
|
186
|
+
completion.invoke(error)
|
|
187
|
+
}
|
|
188
|
+
completion.invoke(null)
|
|
189
|
+
}
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
}
|
package/ios/Nami.m
CHANGED
|
@@ -83,7 +83,7 @@ RCT_EXPORT_METHOD(configure: (NSDictionary *)configDict) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Start commands with header iformation for Nami to let them know this is a React client.
|
|
86
|
-
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:2.0.
|
|
86
|
+
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:2.0.4"]];
|
|
87
87
|
|
|
88
88
|
// Add additional namiCommands app may have sent in.
|
|
89
89
|
NSObject *appCommandStrings = configDict[@"namiCommands"];
|
|
@@ -109,7 +109,7 @@ RCT_EXPORT_METHOD(performNamiCommand: (NSString *)command) {
|
|
|
109
109
|
[NamiCommand performCommand:command];
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
RCT_EXPORT_METHOD(setExternalIdentifier: (NSString *)externalIdentifier type:(NSString *)type) {
|
|
112
|
+
RCT_EXPORT_METHOD(setExternalIdentifier: (NSString *)externalIdentifier type:(NSString *)type completion: (RCTResponseSenderBlock) completion) {
|
|
113
113
|
|
|
114
114
|
NamiExternalIdentifierType useType;
|
|
115
115
|
|
|
@@ -121,7 +121,12 @@ RCT_EXPORT_METHOD(setExternalIdentifier: (NSString *)externalIdentifier type:(N
|
|
|
121
121
|
|
|
122
122
|
NSLog(@"NamiBridge: Setting external identifier %@ of type %@", externalIdentifier, type);
|
|
123
123
|
|
|
124
|
-
[Nami setExternalIdentifierWithExternalIdentifier:externalIdentifier type:useType
|
|
124
|
+
[Nami setExternalIdentifierWithExternalIdentifier:externalIdentifier type:useType completion:^(BOOL success, NSError * _Nullable error) {
|
|
125
|
+
if (error) {
|
|
126
|
+
completion(@[error]);
|
|
127
|
+
}
|
|
128
|
+
completion(nil);
|
|
129
|
+
}];
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
RCT_EXPORT_METHOD(getExternalIdentifier:(RCTResponseSenderBlock)completion)
|
|
@@ -135,14 +140,15 @@ RCT_EXPORT_METHOD(getExternalIdentifier:(RCTResponseSenderBlock)completion)
|
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
|
|
138
|
-
RCT_EXPORT_METHOD(clearExternalIdentifier) {
|
|
143
|
+
RCT_EXPORT_METHOD(clearExternalIdentifier:(RCTResponseSenderBlock)completion) {
|
|
139
144
|
NSLog(@"NamiBridge: Clearing external identifier.");
|
|
140
|
-
[Nami
|
|
145
|
+
[Nami clearExternalIdentifierWithCompletion:^(BOOL success, NSError * _Nullable error) {
|
|
146
|
+
if (error) {
|
|
147
|
+
success }
|
|
148
|
+
completion(nil);
|
|
149
|
+
}];
|
|
141
150
|
}
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
152
|
@end
|
|
147
153
|
|
|
148
154
|
@implementation NamiBridge
|
package/ios/Podfile
CHANGED
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
COPY_PHASE_STRIP = NO;
|
|
231
231
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
232
232
|
ENABLE_TESTABILITY = YES;
|
|
233
|
-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
|
|
233
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
|
|
234
234
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
235
235
|
GCC_DYNAMIC_NO_PIC = NO;
|
|
236
236
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
COPY_PHASE_STRIP = YES;
|
|
276
276
|
ENABLE_NS_ASSERTIONS = NO;
|
|
277
277
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
278
|
-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = " ";
|
|
278
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 ";
|
|
279
279
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
280
280
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
281
281
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
package/package.json
CHANGED