react-native-nami-sdk 3.2.1-beta.2 → 3.2.2-2
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/android/build.gradle +2 -2
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +1 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +64 -47
- package/build-utils/preflight.py +2 -1
- package/ios/Nami.m +1 -1
- package/package.json +1 -1
- package/react-native-nami-sdk.podspec +1 -1
package/android/build.gradle
CHANGED
|
@@ -85,8 +85,8 @@ dependencies {
|
|
|
85
85
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
86
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
87
87
|
|
|
88
|
-
playImplementation "com.namiml:sdk-android:3.2.
|
|
89
|
-
amazonImplementation "com.namiml:sdk-amazon:3.2.
|
|
88
|
+
playImplementation "com.namiml:sdk-android:3.2.2"
|
|
89
|
+
amazonImplementation "com.namiml:sdk-amazon:3.2.2"
|
|
90
90
|
|
|
91
91
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
92
92
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
|
|
@@ -106,7 +106,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
106
106
|
} else {
|
|
107
107
|
Arguments.createArray()
|
|
108
108
|
}
|
|
109
|
-
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.
|
|
109
|
+
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.2")
|
|
110
110
|
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
|
|
111
111
|
settingsList.addAll(commandsFromReact)
|
|
112
112
|
}
|
|
@@ -51,7 +51,13 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
@ReactMethod
|
|
54
|
-
fun launch(
|
|
54
|
+
fun launch(
|
|
55
|
+
label: String?,
|
|
56
|
+
withUrl: String?,
|
|
57
|
+
context: ReadableMap?,
|
|
58
|
+
resultCallback: Callback,
|
|
59
|
+
actionCallback: Callback,
|
|
60
|
+
) {
|
|
55
61
|
var theActivity: Activity? = null
|
|
56
62
|
if (reactApplicationContext.hasCurrentActivity()) {
|
|
57
63
|
theActivity = reactApplicationContext.getCurrentActivity()
|
|
@@ -61,7 +67,7 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
61
67
|
if (context != null) {
|
|
62
68
|
val productGroups: MutableList<String> = mutableListOf()
|
|
63
69
|
val customAttributes: MutableMap<String, String> = mutableMapOf()
|
|
64
|
-
|
|
70
|
+
var customObject: MutableMap<String, Any> = mutableMapOf()
|
|
65
71
|
|
|
66
72
|
if (context.hasKey("productGroups")) {
|
|
67
73
|
val groups = context.getArray("productGroups")
|
|
@@ -91,12 +97,11 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
91
97
|
if (context.hasKey("customObject")) {
|
|
92
98
|
val attr = context.getMap("customObject")
|
|
93
99
|
if (attr != null) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
try {
|
|
101
|
+
customObject = attr.toHashMap().toMutableMap()
|
|
102
|
+
} catch (e: Exception) {
|
|
103
|
+
Log.d(LOG_TAG, "Unable to parse PaywallLaunchContext customObject $customObject")
|
|
98
104
|
}
|
|
99
|
-
Log.d(LOG_TAG, "customObject $customObject")
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -152,44 +157,46 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
152
157
|
|
|
153
158
|
val purchasesArray = createPurchaseArray(paywallEvent.purchases)
|
|
154
159
|
|
|
155
|
-
val resultMap =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
160
|
+
val resultMap =
|
|
161
|
+
Arguments.createMap().apply {
|
|
162
|
+
putString(CAMPAIGN_ID, paywallEvent.campaignId)
|
|
163
|
+
putString(CAMPAIGN_LABEL, paywallEvent.campaignLabel ?: "")
|
|
164
|
+
putString(PAYWALL_ID, paywallEvent.paywallId)
|
|
165
|
+
putString(ACTION, actionString)
|
|
166
|
+
putString(SKU_ID, skuString)
|
|
167
|
+
putString(PURCHASE_ERROR, paywallEvent.purchaseError ?: "")
|
|
168
|
+
putArray(PURCHASES, purchasesArray)
|
|
169
|
+
putString(CAMPAIGN_NAME, paywallEvent.campaignName ?: "")
|
|
170
|
+
putString(CAMPAIGN_TYPE, paywallEvent.campaignType ?: "")
|
|
171
|
+
putString(CAMPAIGN_URL, paywallEvent.campaignUrl ?: "")
|
|
172
|
+
putString(PAYWALL_NAME, paywallEvent.paywallName ?: "")
|
|
173
|
+
putString(SEGMENT_ID, paywallEvent.segmentId ?: "")
|
|
174
|
+
putString(EXTERNAL_SEGMENT_ID, paywallEvent.externalSegmentId ?: "")
|
|
175
|
+
putString(DEEP_LINK_URL, paywallEvent.deeplinkUrl ?: "")
|
|
176
|
+
}
|
|
172
177
|
|
|
173
178
|
if (paywallEvent.componentChange != null) {
|
|
174
|
-
val componentChangeMap =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
val componentChangeMap =
|
|
180
|
+
Arguments.createMap().apply {
|
|
181
|
+
putString("id", paywallEvent.componentChange?.id ?: "")
|
|
182
|
+
putString("name", paywallEvent.componentChange?.name ?: "")
|
|
183
|
+
}
|
|
178
184
|
|
|
179
185
|
resultMap.putMap(COMPONENT_CHANGE, componentChangeMap)
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
if (paywallEvent.videoMetadata != null) {
|
|
183
|
-
val videoMetadataMap =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
val videoMetadataMap =
|
|
190
|
+
Arguments.createMap().apply {
|
|
191
|
+
putString("id", paywallEvent.videoMetadata?.id ?: "")
|
|
192
|
+
putString("name", paywallEvent.videoMetadata?.name ?: "")
|
|
193
|
+
putString("url", paywallEvent.videoMetadata?.url ?: "")
|
|
194
|
+
putBoolean("autoplayVideo", paywallEvent.videoMetadata?.autoplayVideo ?: false)
|
|
195
|
+
putBoolean("muteByDefault", paywallEvent.videoMetadata?.muteByDefault ?: false)
|
|
196
|
+
putBoolean("loopVideo", paywallEvent.videoMetadata?.loopVideo ?: false)
|
|
197
|
+
putDouble("contentDuration", paywallEvent.videoMetadata?.contentDuration ?: 0.0)
|
|
198
|
+
putDouble("contentTimecode", paywallEvent.videoMetadata?.contentTimecode ?: 0.0)
|
|
199
|
+
}
|
|
193
200
|
|
|
194
201
|
resultMap.putMap(VIDEO_METADATA, videoMetadataMap)
|
|
195
202
|
}
|
|
@@ -213,7 +220,10 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
213
220
|
}
|
|
214
221
|
}
|
|
215
222
|
|
|
216
|
-
private fun emitEvent(
|
|
223
|
+
private fun emitEvent(
|
|
224
|
+
event: String,
|
|
225
|
+
map: WritableMap,
|
|
226
|
+
) {
|
|
217
227
|
val emitter = reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
218
228
|
if (emitter is DeviceEventManagerModule.RCTDeviceEventEmitter) {
|
|
219
229
|
emitter.emit(event, map)
|
|
@@ -222,7 +232,10 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
222
232
|
}
|
|
223
233
|
}
|
|
224
234
|
|
|
225
|
-
private fun handleResult(
|
|
235
|
+
private fun handleResult(
|
|
236
|
+
result: LaunchCampaignResult,
|
|
237
|
+
resultCallback: Callback,
|
|
238
|
+
) {
|
|
226
239
|
val resultMap = Arguments.createMap()
|
|
227
240
|
when (result) {
|
|
228
241
|
is LaunchCampaignResult.Success -> {
|
|
@@ -258,18 +271,22 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
258
271
|
}
|
|
259
272
|
|
|
260
273
|
@ReactMethod
|
|
261
|
-
fun isCampaignAvailable(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
274
|
+
fun isCampaignAvailable(
|
|
275
|
+
campaignSource: String?,
|
|
276
|
+
promise: Promise,
|
|
277
|
+
) {
|
|
278
|
+
val isCampaignAvailable =
|
|
279
|
+
when {
|
|
280
|
+
campaignSource == null -> NamiCampaignManager.isCampaignAvailable()
|
|
281
|
+
Uri.parse(campaignSource)?.scheme != null -> NamiCampaignManager.isCampaignAvailable(Uri.parse(campaignSource))
|
|
282
|
+
else -> NamiCampaignManager.isCampaignAvailable(campaignSource)
|
|
283
|
+
}
|
|
267
284
|
promise.resolve(isCampaignAvailable)
|
|
268
285
|
}
|
|
269
286
|
|
|
270
287
|
@ReactMethod
|
|
271
288
|
fun refresh() {
|
|
272
|
-
NamiCampaignManager.refresh
|
|
289
|
+
NamiCampaignManager.refresh { }
|
|
273
290
|
}
|
|
274
291
|
|
|
275
292
|
@ReactMethod
|
package/build-utils/preflight.py
CHANGED
|
@@ -6,6 +6,7 @@ import subprocess
|
|
|
6
6
|
|
|
7
7
|
# Regex to validate version numbers
|
|
8
8
|
PROD_VERSION_RE = re.compile(r"^\d+\.\d+\.\d+$")
|
|
9
|
+
PROD_VERSION_EXT_RE = re.compile(r"^\d+\.\d+\.\d+-\d$")
|
|
9
10
|
PRERELEASE_VERSION_RE = re.compile(r"^\d+\.\d+\.\d+-(alpha|beta|rc)\.\d+$")
|
|
10
11
|
|
|
11
12
|
early_access = str(os.getenv("EARLY_ACCESS"))
|
|
@@ -21,7 +22,7 @@ git_long_hash = (
|
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
# Check what kind of release this is and guard against non-conforming version numbers
|
|
24
|
-
if PROD_VERSION_RE.match(nami_sdk_version):
|
|
25
|
+
if PROD_VERSION_RE.match(nami_sdk_version) or PROD_VERSION_EXT_RE.match(nami_sdk_version):
|
|
25
26
|
if early_access == "true":
|
|
26
27
|
print(f"Early access value ('{early_access}') is not compatible with production version format '{nami_sdk_version}'")
|
|
27
28
|
sys.exit(1)
|
package/ios/Nami.m
CHANGED
|
@@ -50,7 +50,7 @@ RCT_EXPORT_METHOD(configure: (NSDictionary *)configDict completion: (RCTResponse
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Start commands with header iformation for Nami to let them know this is a React client.
|
|
53
|
-
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.2.
|
|
53
|
+
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.2.2"]];
|
|
54
54
|
|
|
55
55
|
// Add additional namiCommands app may have sent in.
|
|
56
56
|
NSObject *appCommandStrings = configDict[@"namiCommands"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nami-sdk",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2-2",
|
|
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.ts",
|
|
6
6
|
"types": "index.d.ts",
|