lemnisk-react-native 0.1.26 → 0.2.0
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/README.md +111 -0
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkModule.java +75 -37
- package/ios/LemniskSdk.m +39 -32
- package/lemnisk-react-native.podspec +3 -1
- package/lib/commonjs/index.js +38 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +38 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -0
- package/package.json +17 -5
- package/src/index.tsx +44 -15
- package/android/.gradle/7.5/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.5/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.5/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.5/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.5/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.5/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.5/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.5/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.5/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -119
- package/ios/LemniskSdk.xcodeproj/project.xcworkspace/xcuserdata/koteswaruduakula.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/LemniskSdk.xcodeproj/xcuserdata/koteswaruduakula.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
package/README.md
CHANGED
|
@@ -25,6 +25,87 @@ Please import Lemnisk native module in your react-native application.
|
|
|
25
25
|
import LemniskSdk from 'lemnisk-react-native';
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## Initialization
|
|
29
|
+
|
|
30
|
+
The SDK supports two ways to initialize. **Use one — not both.**
|
|
31
|
+
|
|
32
|
+
### Path 1 (recommended): native auto-init from config files
|
|
33
|
+
|
|
34
|
+
Because a React Native app is still a native iOS app and a native Android app, the Lemnisk SDK can initialize itself at **native launch — before the JS bundle loads** — by reading static config from the platform config files. This is the same model as Firebase (`GoogleService-Info.plist` / `google-services.json`): you add the keys once per platform and call **nothing** from JavaScript. This gives the earliest possible init and requires no wrapper code.
|
|
35
|
+
|
|
36
|
+
Add the following logical keys to each platform's config file:
|
|
37
|
+
|
|
38
|
+
| Logical key | Android — `AndroidManifest.xml` `<meta-data android:name=…>` | iOS — `Info.plist` key |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| Write key **(required — arms auto-init)** | `Lemnisk.WRITE_KEY` | `LemniskWriteKey` |
|
|
41
|
+
| Server URL **(required)** | `Lemnisk.SERVER_URL` | `LemniskServerUrl` |
|
|
42
|
+
| Consent URL | `Lemnisk.Consent_URL` | `LemniskConsentServerUrl` |
|
|
43
|
+
| Notification-center URL | `Lemnisk.NOTIFICATION_CENTER_URL` | `LemniskNotificationCenterUrl` |
|
|
44
|
+
| Auto-init opt-out (Bool) | `Lemnisk.AUTO_INIT` (`false` disables) | `LemniskAutoInit` (`false` disables) |
|
|
45
|
+
| Push enabled (Bool) | `Lemnisk.ENABLE_PUSH` | `LemniskPushEnabled` |
|
|
46
|
+
| Analytics enabled (Bool) | `Lemnisk.ENABLE_ANALYTICS` | `LemniskAnalyticsEnabled` |
|
|
47
|
+
| In-app enabled (Bool) | `Lemnisk.ENABLE_INAPP` | `LemniskInAppEnabled` |
|
|
48
|
+
| App Group ID (iOS only) | — | `LemniskAppGroupId` |
|
|
49
|
+
| Debug logs (Android only) | `Lemnisk.DEBUG_MODE` | — |
|
|
50
|
+
|
|
51
|
+
Android `AndroidManifest.xml` (inside `<application>`):
|
|
52
|
+
```xml
|
|
53
|
+
<meta-data android:name="Lemnisk.WRITE_KEY" android:value="your_android_write_key" />
|
|
54
|
+
<meta-data android:name="Lemnisk.SERVER_URL" android:value="https://your.lemnisk.co/" />
|
|
55
|
+
<meta-data android:name="Lemnisk.NOTIFICATION_CENTER_URL" android:value="https://your-nc.lemnisk.co/" />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
iOS `Info.plist`:
|
|
59
|
+
```xml
|
|
60
|
+
<key>LemniskWriteKey</key>
|
|
61
|
+
<string>your_ios_write_key</string>
|
|
62
|
+
<key>LemniskServerUrl</key>
|
|
63
|
+
<string>https://your.lemnisk.co</string>
|
|
64
|
+
<key>LemniskNotificationCenterUrl</key>
|
|
65
|
+
<string>https://your-nc.lemnisk.co</string>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Auto-init runs whenever the write key is present. To opt out while keeping the keys in place, set `Lemnisk.AUTO_INIT` / `LemniskAutoInit` to `false`.
|
|
69
|
+
|
|
70
|
+
### Path 2 (backward compatible): explicit JS init
|
|
71
|
+
|
|
72
|
+
If you prefer to configure at runtime from JavaScript (the pre-existing behaviour), do **not** add the write key to the native files, and call:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
LemniskSdk.init({
|
|
76
|
+
writeKeyAndroid: '<android_write_key>',
|
|
77
|
+
writeKeyIOS: '<ios_write_key>',
|
|
78
|
+
serverUrl: 'https://your.lemnisk.co',
|
|
79
|
+
consentUrl: 'https://your-consent.lemnisk.co', // optional
|
|
80
|
+
notificationCenterUrl: 'https://your-nc.lemnisk.co', // optional
|
|
81
|
+
enablePush: true, // optional
|
|
82
|
+
enablePullNotifications: false, // optional
|
|
83
|
+
enableAnalytics: true, // optional
|
|
84
|
+
enableInApp: true, // optional
|
|
85
|
+
enableDebugMode: false, // optional
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> iOS App Group: set `LemniskAppGroupId` in your **Info.plist** (and the same value natively in your notification extensions) — it's build-time/entitlement-bound, so it is **not** a JS init option.
|
|
90
|
+
|
|
91
|
+
All options are passed to native as a single config object (not positional args), so new options can be added without changing the bridge. Omitted keys fall back to the SDK/manifest defaults. This initializes later than native auto-init (JS has to load first), but is fully supported.
|
|
92
|
+
|
|
93
|
+
### Precedence rule
|
|
94
|
+
|
|
95
|
+
The native SDK arbitrates safely if both are present — you do not need to guard this yourself:
|
|
96
|
+
|
|
97
|
+
> **The first write key to arrive wins. A later `init()` with the same write key is a no-op. A later `init()` with a different write key reconfigures the SDK.**
|
|
98
|
+
|
|
99
|
+
So a client who adds native keys **and** also calls `LemniskSdk.init()` with the same key will not get a double init.
|
|
100
|
+
|
|
101
|
+
### Checking init status
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
const ready = LemniskSdk.isInitialized(); // boolean
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Returns `true` once the SDK has configured at least once (via native auto-init or an explicit `init()`).
|
|
108
|
+
|
|
28
109
|
Now, you can log an event to Lemnisk by using the following method call in your react-native application.
|
|
29
110
|
|
|
30
111
|
#### <a id="react-native-identify"></a>Identify
|
|
@@ -111,6 +192,36 @@ LemniskSdk.screen('Home', {
|
|
|
111
192
|
}, null)
|
|
112
193
|
```
|
|
113
194
|
|
|
195
|
+
#### <a id="react-native-setcontext"></a>In-App Context
|
|
196
|
+
|
|
197
|
+
Use `setContext` to tell the SDK which logical screen/flow the user is in (e.g. `"checkout_flow"`, `"kyc_step1"`). The context is attached to outbound track/screen events and is used by the in-app engine for `screen_load` context-membership checks when deciding which popup to show. Call `clearContext` to clear it.
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
LemniskSdk.setContext('checkout_flow');
|
|
201
|
+
// ...later
|
|
202
|
+
LemniskSdk.clearContext();
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
| Method | Parameter | Description |
|
|
206
|
+
|--------|-----------|-------------|
|
|
207
|
+
| `setContext` | `context` (String) | Sets the current SDK context used as an in-app trigger selector. |
|
|
208
|
+
| `clearContext` | — | Clears the current context. |
|
|
209
|
+
|
|
210
|
+
#### <a id="react-native-pauseinapp"></a>Pausing In-App Messages
|
|
211
|
+
|
|
212
|
+
Use `pauseInApp` to temporarily suppress in-app popups (for example while a sensitive screen is on display) and `resumeInApp` to re-enable them. Popups stay suppressed until `resumeInApp` is called.
|
|
213
|
+
|
|
214
|
+
```javascript
|
|
215
|
+
LemniskSdk.pauseInApp();
|
|
216
|
+
// ...later
|
|
217
|
+
LemniskSdk.resumeInApp();
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
| Method | Description |
|
|
221
|
+
|--------|-------------|
|
|
222
|
+
| `pauseInApp` | Silences the in-app channel; popups stay suppressed until resumed. |
|
|
223
|
+
| `resumeInApp` | Re-enables the in-app channel after a `pauseInApp`. |
|
|
224
|
+
|
|
114
225
|
|
|
115
226
|
## Contributing
|
|
116
227
|
|
package/android/build.gradle
CHANGED
|
@@ -50,7 +50,7 @@ android {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
android.defaultConfig {
|
|
53
|
-
buildConfigField "String", "REACT_NATIVE_SDK_VERSION", "\"0.
|
|
53
|
+
buildConfigField "String", "REACT_NATIVE_SDK_VERSION", "\"0.2.0\""
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
repositories {
|
|
@@ -66,7 +66,7 @@ repositories {
|
|
|
66
66
|
dependencies {
|
|
67
67
|
//noinspection GradleDynamicVersion
|
|
68
68
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
69
|
-
implementation 'co.lemnisk.app.android:AndroidSDK:1.
|
|
69
|
+
implementation 'co.lemnisk.app.android:AndroidSDK:1.2.0'
|
|
70
70
|
implementation 'org.apache.commons:commons-text:1.11.0'
|
|
71
71
|
//implementation(name:'AndroidSDK-release', ext:'aar')
|
|
72
72
|
implementation group: 'joda-time', name: 'joda-time', version: '2.12.5'
|
|
@@ -75,7 +75,7 @@ dependencies {
|
|
|
75
75
|
implementation 'com.google.firebase:firebase-messaging'
|
|
76
76
|
implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0'
|
|
77
77
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
78
|
-
implementation 'androidx.work:work-runtime:2.10.
|
|
78
|
+
implementation 'androidx.work:work-runtime:2.10.5'
|
|
79
79
|
implementation 'com.google.code.gson:gson:2.11.0'
|
|
80
80
|
implementation 'androidx.lifecycle:lifecycle-process:2.9.0'
|
|
81
81
|
implementation 'androidx.lifecycle:lifecycle-common-java8:2.9.0'
|
|
@@ -47,38 +47,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
47
47
|
|
|
48
48
|
LemniskHelper helper = LemniskHelper.getInstance(reactContext);
|
|
49
49
|
|
|
50
|
+
// Do NOT call helper.init() here. Native auto-init (LemniskInitProvider)
|
|
51
|
+
// owns initialization when manifest keys are present; the JS init(config)
|
|
52
|
+
// drives the runtime path when they aren't. This mirrors iOS, which has
|
|
53
|
+
// no constructor-init. We only tag the cross-platform SDK version so
|
|
54
|
+
// outbound events carry "react-native-<version>".
|
|
50
55
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
51
56
|
@Override
|
|
52
57
|
public void run() {
|
|
53
58
|
try {
|
|
54
|
-
android.content.pm.ApplicationInfo ai = reactContext.getPackageManager().getApplicationInfo(
|
|
55
|
-
reactContext.getPackageName(),
|
|
56
|
-
android.content.pm.PackageManager.GET_META_DATA
|
|
57
|
-
);
|
|
58
|
-
String notificationCenterUrl = ai.metaData.getString(NOTIFICATION_CENTER_URL);
|
|
59
|
-
|
|
60
|
-
if (notificationCenterUrl != null && !notificationCenterUrl.isEmpty()) {
|
|
61
|
-
helper.init(null, null, null, notificationCenterUrl, null, null);
|
|
62
|
-
} else {
|
|
63
|
-
helper.init();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Set cross-platform SDK version for React Native
|
|
67
59
|
helper.setCrossPlatformSDKVersion("react-native-" + BuildConfig.REACT_NATIVE_SDK_VERSION);
|
|
68
|
-
|
|
69
60
|
} catch (Exception e) {
|
|
70
|
-
Log.e("LemniskSdk", "Failed to
|
|
71
|
-
helper.init();
|
|
72
|
-
// Still set cross-platform SDK version even if init fails
|
|
73
|
-
try {
|
|
74
|
-
helper.setCrossPlatformSDKVersion("react-native-" + BuildConfig.REACT_NATIVE_SDK_VERSION);
|
|
75
|
-
} catch (Exception ex) {
|
|
76
|
-
Log.e("LemniskSdk", "Failed to set cross-platform SDK version: " + ex.getMessage());
|
|
77
|
-
}
|
|
61
|
+
Log.e("LemniskSdk", "Failed to set cross-platform SDK version: " + e.getMessage());
|
|
78
62
|
}
|
|
79
63
|
}
|
|
80
64
|
});
|
|
81
|
-
|
|
65
|
+
|
|
82
66
|
}
|
|
83
67
|
|
|
84
68
|
@Override
|
|
@@ -87,28 +71,25 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
87
71
|
return NAME;
|
|
88
72
|
}
|
|
89
73
|
|
|
74
|
+
// Runtime init (backward-compat / no-manifest path). Accepts a single config
|
|
75
|
+
// object of friendly keys (writeKey, serverUrl, consentUrl,
|
|
76
|
+
// notificationCenterUrl, enablePush, enableAnalytics, enableInApp,
|
|
77
|
+
// enableDebugMode). The native SDK maps these to its own config keys.
|
|
78
|
+
// Adding a new config = add a key in JS + native mapping; no signature churn.
|
|
79
|
+
// No-op when native auto-init already owns initialization (Lemnisk.AUTO_INIT).
|
|
90
80
|
@ReactMethod
|
|
91
|
-
public void init(
|
|
92
|
-
Log.d("LemniskSdk", "init called from JS bridge
|
|
81
|
+
public void init(ReadableMap config) {
|
|
82
|
+
Log.d("LemniskSdk", "init(config) called from JS bridge");
|
|
93
83
|
// Must run on main thread because lifecycle.addObserver requires main thread
|
|
94
84
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
95
85
|
@Override
|
|
96
86
|
public void run() {
|
|
97
87
|
try {
|
|
98
88
|
android.app.Application application = (android.app.Application) getReactApplicationContext().getApplicationContext();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
application,
|
|
102
|
-
writeKey,
|
|
103
|
-
serverUrl,
|
|
104
|
-
consentUrl != null ? consentUrl : serverUrl,
|
|
105
|
-
notificationCenterUrl != null ? notificationCenterUrl : "",
|
|
106
|
-
enablePush,
|
|
107
|
-
enableDebugMode,
|
|
108
|
-
enableAnalytics
|
|
109
|
-
);
|
|
89
|
+
JSONObject configJson = new JSONObject(config.toHashMap());
|
|
90
|
+
LemniskHelper.getInstance(getReactApplicationContext()).init(application, configJson);
|
|
110
91
|
} catch (Exception e) {
|
|
111
|
-
Log.e("LemniskSdk", "Exception in init", e);
|
|
92
|
+
Log.e("LemniskSdk", "Exception in init(config)", e);
|
|
112
93
|
}
|
|
113
94
|
}
|
|
114
95
|
});
|
|
@@ -234,6 +215,48 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
234
215
|
}
|
|
235
216
|
}
|
|
236
217
|
|
|
218
|
+
// --- InApp context & channel control (app-172) ---
|
|
219
|
+
|
|
220
|
+
@ReactMethod
|
|
221
|
+
public void setContext(String context) {
|
|
222
|
+
Log.d("Lemnisk: ", "setContext: " + context);
|
|
223
|
+
try {
|
|
224
|
+
LemniskHelper.getInstance(getReactApplicationContext()).setContext(context);
|
|
225
|
+
} catch (Exception e) {
|
|
226
|
+
Log.e("Lemnisk", "Exception in setContext", e);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@ReactMethod
|
|
231
|
+
public void clearContext() {
|
|
232
|
+
Log.d("Lemnisk: ", "clearContext");
|
|
233
|
+
try {
|
|
234
|
+
LemniskHelper.getInstance(getReactApplicationContext()).clearContext();
|
|
235
|
+
} catch (Exception e) {
|
|
236
|
+
Log.e("Lemnisk", "Exception in clearContext", e);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@ReactMethod
|
|
241
|
+
public void pauseInApp() {
|
|
242
|
+
Log.d("Lemnisk: ", "pauseInApp");
|
|
243
|
+
try {
|
|
244
|
+
LemniskHelper.getInstance(getReactApplicationContext()).pauseInApp();
|
|
245
|
+
} catch (Exception e) {
|
|
246
|
+
Log.e("Lemnisk", "Exception in pauseInApp", e);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
@ReactMethod
|
|
251
|
+
public void resumeInApp() {
|
|
252
|
+
Log.d("Lemnisk: ", "resumeInApp");
|
|
253
|
+
try {
|
|
254
|
+
LemniskHelper.getInstance(getReactApplicationContext()).resumeInApp();
|
|
255
|
+
} catch (Exception e) {
|
|
256
|
+
Log.e("Lemnisk", "Exception in resumeInApp", e);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
237
260
|
@ReactMethod
|
|
238
261
|
public void registerForPush( String title, String message){
|
|
239
262
|
Activity activity = reactContext.getCurrentActivity();
|
|
@@ -297,6 +320,21 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
297
320
|
}
|
|
298
321
|
}
|
|
299
322
|
|
|
323
|
+
// Returns true once the SDK has configured at least once — via native
|
|
324
|
+
// manifest auto-init (LemniskInitProvider) OR an explicit init() call.
|
|
325
|
+
// Informational only: it does NOT need to gate init(), because the native
|
|
326
|
+
// ConfigManager already treats a same-writeKey re-init as a no-op and a
|
|
327
|
+
// different-writeKey init as a reconfigure.
|
|
328
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
329
|
+
public boolean isInitialized() {
|
|
330
|
+
try {
|
|
331
|
+
return LemniskHelper.getInstance(getReactApplicationContext()).isInitialized();
|
|
332
|
+
} catch (Exception e) {
|
|
333
|
+
Log.e("Lemnisk", "Exception in isInitialized", e);
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
300
338
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
301
339
|
public String getUniqueUserId() {
|
|
302
340
|
Log.d("Lemnisk: ", "getUniqueUserId");
|
package/ios/LemniskSdk.m
CHANGED
|
@@ -25,38 +25,16 @@ RCT_EXPORT_MODULE()
|
|
|
25
25
|
return sdkVersion;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
RCTLogInfo(@"LemniskSdk init called from JS bridge
|
|
37
|
-
|
|
38
|
-
// Set log level based on enableDebugMode
|
|
39
|
-
if (enableDebugMode) {
|
|
40
|
-
[[Lemnisk shared] setLogLevel:@"DEBUG"];
|
|
41
|
-
} else {
|
|
42
|
-
[[Lemnisk shared] setLogLevel:@"OFF"];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Configure with writeKey, serverUrl, and notificationCenterUrl
|
|
46
|
-
NSString *notifCenterUrl = (notificationCenterUrl != nil && notificationCenterUrl.length > 0) ? notificationCenterUrl : serverUrl;
|
|
47
|
-
[[Lemnisk shared] configureWithWriteKey:writeKey serverUrl:serverUrl notifcationCenterUrl:notifCenterUrl];
|
|
48
|
-
|
|
49
|
-
if (consentUrl != nil && consentUrl.length > 0) {
|
|
50
|
-
NSString *finalConsentUrl = consentUrl;
|
|
51
|
-
if (![finalConsentUrl hasSuffix:@"/consent/"] && ![finalConsentUrl hasSuffix:@"/consent"]) {
|
|
52
|
-
if ([finalConsentUrl hasSuffix:@"/"]) {
|
|
53
|
-
finalConsentUrl = [finalConsentUrl stringByAppendingString:@"consent/"];
|
|
54
|
-
} else {
|
|
55
|
-
finalConsentUrl = [finalConsentUrl stringByAppendingString:@"/consent/"];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
[[Lemnisk shared] setConsentServerUrlWithServerUrl:finalConsentUrl];
|
|
59
|
-
}
|
|
28
|
+
// Runtime init (backward-compat / no-Info.plist path). Accepts a single config
|
|
29
|
+
// dictionary of friendly keys (writeKey, serverUrl, consentUrl,
|
|
30
|
+
// notificationCenterUrl, enablePush, enableAnalytics, enableInApp,
|
|
31
|
+
// enableDebugMode, appGroupId). The native SDK maps these to its own config and
|
|
32
|
+
// runs the runtime configure path. Adding a new config = add a key in JS +
|
|
33
|
+
// native mapping; no bridge signature change. No-op when native auto-init
|
|
34
|
+
// already owns initialization (LemniskAutoInit).
|
|
35
|
+
RCT_EXPORT_METHOD(init:(NSDictionary *)config) {
|
|
36
|
+
RCTLogInfo(@"LemniskSdk init(config) called from JS bridge");
|
|
37
|
+
[[Lemnisk shared] configureWithConfig:config];
|
|
60
38
|
}
|
|
61
39
|
|
|
62
40
|
// Example method
|
|
@@ -114,6 +92,27 @@ RCT_EXPORT_METHOD(registerForPush) {
|
|
|
114
92
|
[[Lemnisk shared] registerForPushNotifications];
|
|
115
93
|
}
|
|
116
94
|
|
|
95
|
+
// --- InApp context & channel control (app-172) ---
|
|
96
|
+
RCT_EXPORT_METHOD(setContext:(NSString * _Nullable)context) {
|
|
97
|
+
RCTLogInfo(@"setContext: %@", context);
|
|
98
|
+
[[Lemnisk shared] setContext:context];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
RCT_EXPORT_METHOD(clearContext) {
|
|
102
|
+
RCTLogInfo(@"clearContext");
|
|
103
|
+
[[Lemnisk shared] clearContext];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
RCT_EXPORT_METHOD(pauseInApp) {
|
|
107
|
+
RCTLogInfo(@"pauseInApp");
|
|
108
|
+
[[Lemnisk shared] pauseInApp];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
RCT_EXPORT_METHOD(resumeInApp) {
|
|
112
|
+
RCTLogInfo(@"resumeInApp");
|
|
113
|
+
[[Lemnisk shared] resumeInApp];
|
|
114
|
+
}
|
|
115
|
+
|
|
117
116
|
RCT_EXPORT_METHOD(setUniqueUserId:(NSString *) tokenized_cid) {
|
|
118
117
|
RCTLogInfo(@"calling setUniqueUserId");
|
|
119
118
|
[[Lemnisk shared] setUniqueUserId:tokenized_cid];
|
|
@@ -130,6 +129,14 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getUniqueUserId) {
|
|
|
130
129
|
return uniqueUserId ?: @"";
|
|
131
130
|
}
|
|
132
131
|
|
|
132
|
+
// Returns true once the SDK has configured at least once — via native
|
|
133
|
+
// Info.plist auto-init OR an explicit init() call. Informational only: it does
|
|
134
|
+
// NOT need to gate init(), because configureBasic already treats a same-writeKey
|
|
135
|
+
// re-configure as a no-op and a different-writeKey configure as a reconfigure.
|
|
136
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, isInitialized) {
|
|
137
|
+
return @([[Lemnisk shared] isConfigured]);
|
|
138
|
+
}
|
|
139
|
+
|
|
133
140
|
// Set Custom Consent method
|
|
134
141
|
RCT_EXPORT_METHOD(setCustomConsent:(BOOL)transConsent promoConsent:(BOOL)promoConsent) {
|
|
135
142
|
RCTLogInfo(@"Setting custom consent: transConsent=%d, promoConsent=%d", transConsent, promoConsent);
|
|
@@ -21,6 +21,8 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
s.dependency 'React-Core'
|
|
24
|
-
s.dependency 'Lemnisk-iOS-SDK', '3.
|
|
24
|
+
s.dependency 'Lemnisk-iOS-SDK', '3.10.0'
|
|
25
|
+
# LOCAL TEST (swap in for on-device work against the local xcframework via the
|
|
26
|
+
# example Podfile's `pod 'Lemnisk-iOS-SDK-Local', :path => '../../../../ios-swift-sdk'`):
|
|
25
27
|
# s.dependency 'Lemnisk-iOS-SDK-Local'
|
|
26
28
|
end
|
package/lib/commonjs/index.js
CHANGED
|
@@ -16,16 +16,40 @@ const LemniskSdkWrapper = {
|
|
|
16
16
|
writeKeyAndroid,
|
|
17
17
|
writeKeyIOS,
|
|
18
18
|
serverUrl,
|
|
19
|
-
consentUrl
|
|
20
|
-
notificationCenterUrl
|
|
21
|
-
enablePush
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
consentUrl,
|
|
20
|
+
notificationCenterUrl,
|
|
21
|
+
enablePush,
|
|
22
|
+
enablePullNotifications,
|
|
23
|
+
enableDebugMode,
|
|
24
|
+
enableAnalytics,
|
|
25
|
+
enableInApp
|
|
24
26
|
} = options;
|
|
25
27
|
|
|
26
28
|
// Use platform-specific writeKey
|
|
27
29
|
const writeKey = _reactNative.Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
|
|
28
|
-
|
|
30
|
+
|
|
31
|
+
// Send ONE config object over the bridge. Native maps these friendly keys
|
|
32
|
+
// to its own config keys and runs the runtime init/configure path. To add a
|
|
33
|
+
// new config, add a key here (+ InitOptions + docs) — no bridge signature
|
|
34
|
+
// change. Omitted keys mean "leave the SDK/manifest default".
|
|
35
|
+
const config = {
|
|
36
|
+
writeKey,
|
|
37
|
+
serverUrl
|
|
38
|
+
};
|
|
39
|
+
if (consentUrl != null) config.consentUrl = consentUrl;
|
|
40
|
+
if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
|
|
41
|
+
// Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
|
|
42
|
+
// the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
|
|
43
|
+
// which won because NS_RT > NS_MFST on Android. The native default for
|
|
44
|
+
// push on Android is false (opt-in via manifest), so omitting the key
|
|
45
|
+
// here would silently disable push for existing RN hosts on upgrade.
|
|
46
|
+
// Default to true and let the caller pass false explicitly to opt out.
|
|
47
|
+
config.enablePush = enablePush ?? true;
|
|
48
|
+
config.enableAnalytics = enableAnalytics ?? true;
|
|
49
|
+
if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
|
|
50
|
+
if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
|
|
51
|
+
if (enableInApp != null) config.enableInApp = enableInApp;
|
|
52
|
+
return LemniskSdk.init(config);
|
|
29
53
|
},
|
|
30
54
|
// Track method with overloads
|
|
31
55
|
track: function (eventName, properties, otherIds) {
|
|
@@ -86,7 +110,14 @@ const LemniskSdkWrapper = {
|
|
|
86
110
|
markBulkDelete: LemniskSdk.markBulkDelete,
|
|
87
111
|
readAll: LemniskSdk.readAll,
|
|
88
112
|
deleteAll: LemniskSdk.deleteAll,
|
|
89
|
-
resetUser: LemniskSdk.resetUser
|
|
113
|
+
resetUser: LemniskSdk.resetUser,
|
|
114
|
+
// InApp context & channel control
|
|
115
|
+
setContext: LemniskSdk.setContext,
|
|
116
|
+
clearContext: LemniskSdk.clearContext,
|
|
117
|
+
pauseInApp: LemniskSdk.pauseInApp,
|
|
118
|
+
resumeInApp: LemniskSdk.resumeInApp,
|
|
119
|
+
// Auto-init status (native manifest/Info.plist auto-init OR explicit init)
|
|
120
|
+
isInitialized: LemniskSdk.isInitialized
|
|
90
121
|
};
|
|
91
122
|
var _default = exports.default = LemniskSdkWrapper;
|
|
92
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enableDebugMode","enableAnalytics","writeKey","Platform","OS","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl = null,\n notificationCenterUrl = null,\n enablePush = true,\n enableDebugMode = false,\n enableAnalytics = true,\n } = options;\n \n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n \n return LemniskSdk.init(\n writeKey,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enableDebugMode,\n enableAnalytics\n );\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AA6CpC;AACA,MAAMC,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU,GAAG,IAAI;MACjBC,qBAAqB,GAAG,IAAI;MAC5BC,UAAU,GAAG,IAAI;MACjBC,eAAe,GAAG,KAAK;MACvBC,eAAe,GAAG;IACpB,CAAC,GAAGR,OAAO;;IAEX;IACA,MAAMS,QAAQ,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAGT,WAAW,GAAGD,eAAe;IAEtE,OAAOL,UAAU,CAACG,IAAI,CACpBU,QAAQ,EACRN,SAAS,EACTC,UAAU,EACVC,qBAAqB,EACrBC,UAAU,EACVC,eAAe,EACfC,eACF,CAAC;EACH,CAAC;EAED;EACAI,KAAK,EAAE,SAAAA,CAASC,SAAiB,EAAEC,UAAkB,EAAEC,QAAiB,EAAO;IAC7E,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAOpB,UAAU,CAACqB,YAAY,CAACJ,SAAS,EAAEC,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAOnB,UAAU,CAACgB,KAAK,CAACC,SAAS,EAAEC,UAAU,CAAC;IAChD;EACF,CAAC;EAED;EACAI,MAAM,EAAE,SAAAA,CAASC,IAAY,EAAEL,UAAkB,EAAEC,QAAiB,EAAO;IACzE,IAAIA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,UAAU,CAACsC,kBAAkB;EACjDC,eAAe,EAAEvC,UAAU,CAACuC,eAAe;EAC3CC,eAAe,EAAExC,UAAU,CAACwC,eAAe;EAC3CC,YAAY,EAAEzC,UAAU,CAACyC,YAAY;EACrCC,mBAAmB,EAAE1C,UAAU,CAAC0C,mBAAmB;EACnDC,gBAAgB,EAAE3C,UAAU,CAAC2C,gBAAgB;EAC7CC,cAAc,EAAE5C,UAAU,CAAC4C,cAAc;EACzCC,QAAQ,EAAE7C,UAAU,CAAC6C,QAAQ;EAC7BC,YAAY,EAAE9C,UAAU,CAAC8C,YAAY;EACrCC,UAAU,EAAE/C,UAAU,CAAC+C,UAAU;EACjCC,cAAc,EAAEhD,UAAU,CAACgD,cAAc;EACzCC,OAAO,EAAEjD,UAAU,CAACiD,OAAO;EAC3BC,SAAS,EAAElD,UAAU,CAACkD,SAAS;EAC/BC,SAAS,EAAEnD,UAAU,CAACmD;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapD,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enablePullNotifications","enableDebugMode","enableAnalytics","enableInApp","writeKey","Platform","OS","config","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","setContext","clearContext","pauseInApp","resumeInApp","isInitialized","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enablePullNotifications?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n enableInApp?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n setContext(context: string): void;\n clearContext(): void;\n pauseInApp(): void;\n resumeInApp(): void;\n isInitialized(): boolean;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enablePullNotifications,\n enableDebugMode,\n enableAnalytics,\n enableInApp,\n } = options;\n\n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n\n // Send ONE config object over the bridge. Native maps these friendly keys\n // to its own config keys and runs the runtime init/configure path. To add a\n // new config, add a key here (+ InitOptions + docs) — no bridge signature\n // change. Omitted keys mean \"leave the SDK/manifest default\".\n const config: { [key: string]: string | boolean } = { writeKey, serverUrl };\n if (consentUrl != null) config.consentUrl = consentUrl;\n if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;\n // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on\n // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,\n // which won because NS_RT > NS_MFST on Android. The native default for\n // push on Android is false (opt-in via manifest), so omitting the key\n // here would silently disable push for existing RN hosts on upgrade.\n // Default to true and let the caller pass false explicitly to opt out.\n config.enablePush = enablePush ?? true;\n config.enableAnalytics = enableAnalytics ?? true;\n if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;\n if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;\n if (enableInApp != null) config.enableInApp = enableInApp;\n\n return LemniskSdk.init(config);\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n\n // InApp context & channel control\n setContext: LemniskSdk.setContext,\n clearContext: LemniskSdk.clearContext,\n pauseInApp: LemniskSdk.pauseInApp,\n resumeInApp: LemniskSdk.resumeInApp,\n\n // Auto-init status (native manifest/Info.plist auto-init OR explicit init)\n isInitialized: LemniskSdk.isInitialized,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAoDpC;AACA,MAAMC,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU;MACVC,qBAAqB;MACrBC,UAAU;MACVC,uBAAuB;MACvBC,eAAe;MACfC,eAAe;MACfC;IACF,CAAC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CAAC2C,eAAe;EAC3CC,YAAY,EAAE5C,UAAU,CAAC4C,YAAY;EACrCC,mBAAmB,EAAE7C,UAAU,CAAC6C,mBAAmB;EACnDC,gBAAgB,EAAE9C,UAAU,CAAC8C,gBAAgB;EAC7CC,cAAc,EAAE/C,UAAU,CAAC+C,cAAc;EACzCC,QAAQ,EAAEhD,UAAU,CAACgD,QAAQ;EAC7BC,YAAY,EAAEjD,UAAU,CAACiD,YAAY;EACrCC,UAAU,EAAElD,UAAU,CAACkD,UAAU;EACjCC,cAAc,EAAEnD,UAAU,CAACmD,cAAc;EACzCC,OAAO,EAAEpD,UAAU,CAACoD,OAAO;EAC3BC,SAAS,EAAErD,UAAU,CAACqD,SAAS;EAC/BC,SAAS,EAAEtD,UAAU,CAACsD,SAAS;EAE/B;EACAC,UAAU,EAAEvD,UAAU,CAACuD,UAAU;EACjCC,YAAY,EAAExD,UAAU,CAACwD,YAAY;EACrCC,UAAU,EAAEzD,UAAU,CAACyD,UAAU;EACjCC,WAAW,EAAE1D,UAAU,CAAC0D,WAAW;EAEnC;EACAC,aAAa,EAAE3D,UAAU,CAAC2D;AAC5B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa5D,iBAAiB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -10,16 +10,40 @@ const LemniskSdkWrapper = {
|
|
|
10
10
|
writeKeyAndroid,
|
|
11
11
|
writeKeyIOS,
|
|
12
12
|
serverUrl,
|
|
13
|
-
consentUrl
|
|
14
|
-
notificationCenterUrl
|
|
15
|
-
enablePush
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
consentUrl,
|
|
14
|
+
notificationCenterUrl,
|
|
15
|
+
enablePush,
|
|
16
|
+
enablePullNotifications,
|
|
17
|
+
enableDebugMode,
|
|
18
|
+
enableAnalytics,
|
|
19
|
+
enableInApp
|
|
18
20
|
} = options;
|
|
19
21
|
|
|
20
22
|
// Use platform-specific writeKey
|
|
21
23
|
const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
// Send ONE config object over the bridge. Native maps these friendly keys
|
|
26
|
+
// to its own config keys and runs the runtime init/configure path. To add a
|
|
27
|
+
// new config, add a key here (+ InitOptions + docs) — no bridge signature
|
|
28
|
+
// change. Omitted keys mean "leave the SDK/manifest default".
|
|
29
|
+
const config = {
|
|
30
|
+
writeKey,
|
|
31
|
+
serverUrl
|
|
32
|
+
};
|
|
33
|
+
if (consentUrl != null) config.consentUrl = consentUrl;
|
|
34
|
+
if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
|
|
35
|
+
// Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
|
|
36
|
+
// the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
|
|
37
|
+
// which won because NS_RT > NS_MFST on Android. The native default for
|
|
38
|
+
// push on Android is false (opt-in via manifest), so omitting the key
|
|
39
|
+
// here would silently disable push for existing RN hosts on upgrade.
|
|
40
|
+
// Default to true and let the caller pass false explicitly to opt out.
|
|
41
|
+
config.enablePush = enablePush ?? true;
|
|
42
|
+
config.enableAnalytics = enableAnalytics ?? true;
|
|
43
|
+
if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
|
|
44
|
+
if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
|
|
45
|
+
if (enableInApp != null) config.enableInApp = enableInApp;
|
|
46
|
+
return LemniskSdk.init(config);
|
|
23
47
|
},
|
|
24
48
|
// Track method with overloads
|
|
25
49
|
track: function (eventName, properties, otherIds) {
|
|
@@ -80,7 +104,14 @@ const LemniskSdkWrapper = {
|
|
|
80
104
|
markBulkDelete: LemniskSdk.markBulkDelete,
|
|
81
105
|
readAll: LemniskSdk.readAll,
|
|
82
106
|
deleteAll: LemniskSdk.deleteAll,
|
|
83
|
-
resetUser: LemniskSdk.resetUser
|
|
107
|
+
resetUser: LemniskSdk.resetUser,
|
|
108
|
+
// InApp context & channel control
|
|
109
|
+
setContext: LemniskSdk.setContext,
|
|
110
|
+
clearContext: LemniskSdk.clearContext,
|
|
111
|
+
pauseInApp: LemniskSdk.pauseInApp,
|
|
112
|
+
resumeInApp: LemniskSdk.resumeInApp,
|
|
113
|
+
// Auto-init status (native manifest/Info.plist auto-init OR explicit init)
|
|
114
|
+
isInitialized: LemniskSdk.isInitialized
|
|
84
115
|
};
|
|
85
116
|
export default LemniskSdkWrapper;
|
|
86
117
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LemniskSdk","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enableDebugMode","enableAnalytics","writeKey","OS","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl = null,\n notificationCenterUrl = null,\n enablePush = true,\n enableDebugMode = false,\n enableAnalytics = true,\n } = options;\n \n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n \n return LemniskSdk.init(\n writeKey,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enableDebugMode,\n enableAnalytics\n );\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AA6CpC;AACA,MAAMG,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU,GAAG,IAAI;MACjBC,qBAAqB,GAAG,IAAI;MAC5BC,UAAU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S;EAC/BC,SAAS,EAAEjD,UAAU,CAACiD;AACxB,CAAC;AAED,eAAehD,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LemniskSdk","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enablePullNotifications","enableDebugMode","enableAnalytics","enableInApp","writeKey","OS","config","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","setContext","clearContext","pauseInApp","resumeInApp","isInitialized"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enablePullNotifications?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n enableInApp?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n setContext(context: string): void;\n clearContext(): void;\n pauseInApp(): void;\n resumeInApp(): void;\n isInitialized(): boolean;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enablePullNotifications,\n enableDebugMode,\n enableAnalytics,\n enableInApp,\n } = options;\n\n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n\n // Send ONE config object over the bridge. Native maps these friendly keys\n // to its own config keys and runs the runtime init/configure path. To add a\n // new config, add a key here (+ InitOptions + docs) — no bridge signature\n // change. Omitted keys mean \"leave the SDK/manifest default\".\n const config: { [key: string]: string | boolean } = { writeKey, serverUrl };\n if (consentUrl != null) config.consentUrl = consentUrl;\n if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;\n // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on\n // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,\n // which won because NS_RT > NS_MFST on Android. The native default for\n // push on Android is false (opt-in via manifest), so omitting the key\n // here would silently disable push for existing RN hosts on upgrade.\n // Default to true and let the caller pass false explicitly to opt out.\n config.enablePush = enablePush ?? true;\n config.enableAnalytics = enableAnalytics ?? true;\n if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;\n if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;\n if (enableInApp != null) config.enableInApp = enableInApp;\n\n return LemniskSdk.init(config);\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n\n // InApp context & channel control\n setContext: LemniskSdk.setContext,\n clearContext: LemniskSdk.clearContext,\n pauseInApp: LemniskSdk.pauseInApp,\n resumeInApp: LemniskSdk.resumeInApp,\n\n // Auto-init status (native manifest/Info.plist auto-init OR explicit init)\n isInitialized: LemniskSdk.isInitialized,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AAoDpC;AACA,MAAMG,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU;MACVC,qBAAqB;MACrBC,UAAU;MACVC,uBAAuB;MACvBC,eAAe;MACfC,eAAe;MACfC;IACF,CAAC,GAAGV,OAAO;;IAEX;IACA,MAAMW,QAAQ,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGV,WAAW,GAAGD,eAAe;;IAEtE;IACA;IACA;IACA;IACA,MAAMY,MAA2C,GAAG;MAAEF,QAAQ;MAAER;IAAU,CAAC;IAC3E,IAAIC,UAAU,IAAI,IAAI,EAAES,MAAM,CAACT,UAAU,GAAGA,UAAU;IACtD,IAAIC,qBAAqB,IAAI,IAAI,EAAEQ,MAAM,CAACR,qBAAqB,GAAGA,qBAAqB;IACvF;IACA;IACA;IACA;IACA;IACA;IACAQ,MAAM,CAACP,UAAU,GAAOA,UAAU,IAAQ,IAAI;IAC9CO,MAAM,CAACJ,eAAe,GAAGA,eAAe,IAAI,IAAI;IAChD,IAAIF,uBAAuB,IAAI,IAAI,EAAEM,MAAM,CAACN,uBAAuB,GAAGA,uBAAuB;IAC7F,IAAIC,eAAe,IAAI,IAAI,EAAEK,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vD,UAAU,CAACuD,UAAU;EACjCC,WAAW,EAAExD,UAAU,CAACwD,WAAW;EAEnC;EACAC,aAAa,EAAEzD,UAAU,CAACyD;AAC5B,CAAC;AAED,eAAexD,iBAAiB","ignoreList":[]}
|
|
@@ -9,8 +9,10 @@ type InitOptions = {
|
|
|
9
9
|
consentUrl?: string;
|
|
10
10
|
notificationCenterUrl?: string;
|
|
11
11
|
enablePush?: boolean;
|
|
12
|
+
enablePullNotifications?: boolean;
|
|
12
13
|
enableDebugMode?: boolean;
|
|
13
14
|
enableAnalytics?: boolean;
|
|
15
|
+
enableInApp?: boolean;
|
|
14
16
|
};
|
|
15
17
|
type LemniskSdkType = {
|
|
16
18
|
init(options: InitOptions): void;
|
|
@@ -40,6 +42,11 @@ type LemniskSdkType = {
|
|
|
40
42
|
readAll(tokenizedCid: string, type: string): Promise<boolean>;
|
|
41
43
|
deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
|
|
42
44
|
resetUser(): void;
|
|
45
|
+
setContext(context: string): void;
|
|
46
|
+
clearContext(): void;
|
|
47
|
+
pauseInApp(): void;
|
|
48
|
+
resumeInApp(): void;
|
|
49
|
+
isInitialized(): boolean;
|
|
43
50
|
};
|
|
44
51
|
declare const _default: LemniskSdkType;
|
|
45
52
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lemnisk-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "plugin to setup the lemnisk sdk on both android and ios platform",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -10,13 +10,26 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
12
|
"lib",
|
|
13
|
-
"android",
|
|
13
|
+
"android/src",
|
|
14
|
+
"android/build.gradle",
|
|
15
|
+
"android/gradle.properties",
|
|
16
|
+
"android/AndroidManifest.xml",
|
|
14
17
|
"ios",
|
|
15
18
|
"cpp",
|
|
16
19
|
"lemnisk-react-native.podspec",
|
|
17
20
|
"!lib/typescript/example",
|
|
18
21
|
"!android/build",
|
|
22
|
+
"!android/bin",
|
|
23
|
+
"!android/.gradle",
|
|
24
|
+
"!android/.project",
|
|
25
|
+
"!android/.settings",
|
|
26
|
+
"!android/gradle",
|
|
27
|
+
"!android/gradlew",
|
|
28
|
+
"!android/gradlew.bat",
|
|
29
|
+
"!**/*.class",
|
|
30
|
+
"!**/*.jar",
|
|
19
31
|
"!ios/build",
|
|
32
|
+
"!ios/**/xcuserdata",
|
|
20
33
|
"!**/__tests__",
|
|
21
34
|
"!**/__fixtures__",
|
|
22
35
|
"!**/__mocks__",
|
|
@@ -42,6 +55,7 @@
|
|
|
42
55
|
"url": "git+https://github.com/Immensitas/lemnisk-app-sdk"
|
|
43
56
|
},
|
|
44
57
|
"author": "Lemnisk",
|
|
58
|
+
"license": "MIT",
|
|
45
59
|
"bugs": {
|
|
46
60
|
"url": "https://github.com/Immensitas/lemnisk-app-sdk/issues"
|
|
47
61
|
},
|
|
@@ -151,7 +165,5 @@
|
|
|
151
165
|
]
|
|
152
166
|
]
|
|
153
167
|
},
|
|
154
|
-
"dependencies": {
|
|
155
|
-
"extract-zip": "^1.6.6"
|
|
156
|
-
}
|
|
168
|
+
"dependencies": {}
|
|
157
169
|
}
|
package/src/index.tsx
CHANGED
|
@@ -14,8 +14,10 @@ type InitOptions = {
|
|
|
14
14
|
consentUrl?: string;
|
|
15
15
|
notificationCenterUrl?: string;
|
|
16
16
|
enablePush?: boolean;
|
|
17
|
+
enablePullNotifications?: boolean;
|
|
17
18
|
enableDebugMode?: boolean;
|
|
18
19
|
enableAnalytics?: boolean;
|
|
20
|
+
enableInApp?: boolean;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
type LemniskSdkType = {
|
|
@@ -43,6 +45,11 @@ type LemniskSdkType = {
|
|
|
43
45
|
readAll(tokenizedCid: string, type: string): Promise<boolean>;
|
|
44
46
|
deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
|
|
45
47
|
resetUser(): void;
|
|
48
|
+
setContext(context: string): void;
|
|
49
|
+
clearContext(): void;
|
|
50
|
+
pauseInApp(): void;
|
|
51
|
+
resumeInApp(): void;
|
|
52
|
+
isInitialized(): boolean;
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
// Create wrapper with overloaded methods
|
|
@@ -53,25 +60,38 @@ const LemniskSdkWrapper = {
|
|
|
53
60
|
writeKeyAndroid,
|
|
54
61
|
writeKeyIOS,
|
|
55
62
|
serverUrl,
|
|
56
|
-
consentUrl = null,
|
|
57
|
-
notificationCenterUrl = null,
|
|
58
|
-
enablePush = true,
|
|
59
|
-
enableDebugMode = false,
|
|
60
|
-
enableAnalytics = true,
|
|
61
|
-
} = options;
|
|
62
|
-
|
|
63
|
-
// Use platform-specific writeKey
|
|
64
|
-
const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
|
|
65
|
-
|
|
66
|
-
return LemniskSdk.init(
|
|
67
|
-
writeKey,
|
|
68
|
-
serverUrl,
|
|
69
63
|
consentUrl,
|
|
70
64
|
notificationCenterUrl,
|
|
71
65
|
enablePush,
|
|
66
|
+
enablePullNotifications,
|
|
72
67
|
enableDebugMode,
|
|
73
|
-
enableAnalytics
|
|
74
|
-
|
|
68
|
+
enableAnalytics,
|
|
69
|
+
enableInApp,
|
|
70
|
+
} = options;
|
|
71
|
+
|
|
72
|
+
// Use platform-specific writeKey
|
|
73
|
+
const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
|
|
74
|
+
|
|
75
|
+
// Send ONE config object over the bridge. Native maps these friendly keys
|
|
76
|
+
// to its own config keys and runs the runtime init/configure path. To add a
|
|
77
|
+
// new config, add a key here (+ InitOptions + docs) — no bridge signature
|
|
78
|
+
// change. Omitted keys mean "leave the SDK/manifest default".
|
|
79
|
+
const config: { [key: string]: string | boolean } = { writeKey, serverUrl };
|
|
80
|
+
if (consentUrl != null) config.consentUrl = consentUrl;
|
|
81
|
+
if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
|
|
82
|
+
// Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
|
|
83
|
+
// the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
|
|
84
|
+
// which won because NS_RT > NS_MFST on Android. The native default for
|
|
85
|
+
// push on Android is false (opt-in via manifest), so omitting the key
|
|
86
|
+
// here would silently disable push for existing RN hosts on upgrade.
|
|
87
|
+
// Default to true and let the caller pass false explicitly to opt out.
|
|
88
|
+
config.enablePush = enablePush ?? true;
|
|
89
|
+
config.enableAnalytics = enableAnalytics ?? true;
|
|
90
|
+
if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
|
|
91
|
+
if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
|
|
92
|
+
if (enableInApp != null) config.enableInApp = enableInApp;
|
|
93
|
+
|
|
94
|
+
return LemniskSdk.init(config);
|
|
75
95
|
},
|
|
76
96
|
|
|
77
97
|
// Track method with overloads
|
|
@@ -140,6 +160,15 @@ const LemniskSdkWrapper = {
|
|
|
140
160
|
readAll: LemniskSdk.readAll,
|
|
141
161
|
deleteAll: LemniskSdk.deleteAll,
|
|
142
162
|
resetUser: LemniskSdk.resetUser,
|
|
163
|
+
|
|
164
|
+
// InApp context & channel control
|
|
165
|
+
setContext: LemniskSdk.setContext,
|
|
166
|
+
clearContext: LemniskSdk.clearContext,
|
|
167
|
+
pauseInApp: LemniskSdk.pauseInApp,
|
|
168
|
+
resumeInApp: LemniskSdk.resumeInApp,
|
|
169
|
+
|
|
170
|
+
// Auto-init status (native manifest/Info.plist auto-init OR explicit init)
|
|
171
|
+
isInitialized: LemniskSdk.isInitialized,
|
|
143
172
|
};
|
|
144
173
|
|
|
145
174
|
export default LemniskSdkWrapper as LemniskSdkType;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
package/android/gradlew
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2015 the original author or authors.
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
##############################################################################
|
|
20
|
-
##
|
|
21
|
-
## Gradle start up script for UN*X
|
|
22
|
-
##
|
|
23
|
-
##############################################################################
|
|
24
|
-
|
|
25
|
-
# Attempt to set APP_HOME
|
|
26
|
-
# Resolve links: $0 may be a link
|
|
27
|
-
PRG="$0"
|
|
28
|
-
# Need this for relative symlinks.
|
|
29
|
-
while [ -h "$PRG" ] ; do
|
|
30
|
-
ls=`ls -ld "$PRG"`
|
|
31
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
32
|
-
if expr "$link" : '/.*' > /dev/null; then
|
|
33
|
-
PRG="$link"
|
|
34
|
-
else
|
|
35
|
-
PRG=`dirname "$PRG"`"/$link"
|
|
36
|
-
fi
|
|
37
|
-
done
|
|
38
|
-
SAVED="`pwd`"
|
|
39
|
-
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
40
|
-
APP_HOME="`pwd -P`"
|
|
41
|
-
cd "$SAVED" >/dev/null
|
|
42
|
-
|
|
43
|
-
APP_NAME="Gradle"
|
|
44
|
-
APP_BASE_NAME=`basename "$0"`
|
|
45
|
-
|
|
46
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
47
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
48
|
-
|
|
49
|
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
50
|
-
MAX_FD="maximum"
|
|
51
|
-
|
|
52
|
-
warn () {
|
|
53
|
-
echo "$*"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
die () {
|
|
57
|
-
echo
|
|
58
|
-
echo "$*"
|
|
59
|
-
echo
|
|
60
|
-
exit 1
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# OS specific support (must be 'true' or 'false').
|
|
64
|
-
cygwin=false
|
|
65
|
-
msys=false
|
|
66
|
-
darwin=false
|
|
67
|
-
nonstop=false
|
|
68
|
-
case "`uname`" in
|
|
69
|
-
CYGWIN* )
|
|
70
|
-
cygwin=true
|
|
71
|
-
;;
|
|
72
|
-
Darwin* )
|
|
73
|
-
darwin=true
|
|
74
|
-
;;
|
|
75
|
-
MINGW* )
|
|
76
|
-
msys=true
|
|
77
|
-
;;
|
|
78
|
-
NONSTOP* )
|
|
79
|
-
nonstop=true
|
|
80
|
-
;;
|
|
81
|
-
esac
|
|
82
|
-
|
|
83
|
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# Determine the Java command to use to start the JVM.
|
|
87
|
-
if [ -n "$JAVA_HOME" ] ; then
|
|
88
|
-
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
89
|
-
# IBM's JDK on AIX uses strange locations for the executables
|
|
90
|
-
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
91
|
-
else
|
|
92
|
-
JAVACMD="$JAVA_HOME/bin/java"
|
|
93
|
-
fi
|
|
94
|
-
if [ ! -x "$JAVACMD" ] ; then
|
|
95
|
-
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
96
|
-
|
|
97
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
98
|
-
location of your Java installation."
|
|
99
|
-
fi
|
|
100
|
-
else
|
|
101
|
-
JAVACMD="java"
|
|
102
|
-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
103
|
-
|
|
104
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
105
|
-
location of your Java installation."
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Increase the maximum file descriptors if we can.
|
|
109
|
-
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
110
|
-
MAX_FD_LIMIT=`ulimit -H -n`
|
|
111
|
-
if [ $? -eq 0 ] ; then
|
|
112
|
-
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
113
|
-
MAX_FD="$MAX_FD_LIMIT"
|
|
114
|
-
fi
|
|
115
|
-
ulimit -n $MAX_FD
|
|
116
|
-
if [ $? -ne 0 ] ; then
|
|
117
|
-
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
118
|
-
fi
|
|
119
|
-
else
|
|
120
|
-
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
121
|
-
fi
|
|
122
|
-
fi
|
|
123
|
-
|
|
124
|
-
# For Darwin, add options to specify how the application appears in the dock
|
|
125
|
-
if $darwin; then
|
|
126
|
-
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
130
|
-
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
131
|
-
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
132
|
-
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
133
|
-
|
|
134
|
-
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
135
|
-
|
|
136
|
-
# We build the pattern for arguments to be converted via cygpath
|
|
137
|
-
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
138
|
-
SEP=""
|
|
139
|
-
for dir in $ROOTDIRSRAW ; do
|
|
140
|
-
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
141
|
-
SEP="|"
|
|
142
|
-
done
|
|
143
|
-
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
144
|
-
# Add a user-defined pattern to the cygpath arguments
|
|
145
|
-
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
146
|
-
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
147
|
-
fi
|
|
148
|
-
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
149
|
-
i=0
|
|
150
|
-
for arg in "$@" ; do
|
|
151
|
-
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
152
|
-
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
153
|
-
|
|
154
|
-
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
155
|
-
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
156
|
-
else
|
|
157
|
-
eval `echo args$i`="\"$arg\""
|
|
158
|
-
fi
|
|
159
|
-
i=`expr $i + 1`
|
|
160
|
-
done
|
|
161
|
-
case $i in
|
|
162
|
-
0) set -- ;;
|
|
163
|
-
1) set -- "$args0" ;;
|
|
164
|
-
2) set -- "$args0" "$args1" ;;
|
|
165
|
-
3) set -- "$args0" "$args1" "$args2" ;;
|
|
166
|
-
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
167
|
-
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
168
|
-
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
169
|
-
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
170
|
-
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
171
|
-
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
172
|
-
esac
|
|
173
|
-
fi
|
|
174
|
-
|
|
175
|
-
# Escape application args
|
|
176
|
-
save () {
|
|
177
|
-
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
178
|
-
echo " "
|
|
179
|
-
}
|
|
180
|
-
APP_ARGS=`save "$@"`
|
|
181
|
-
|
|
182
|
-
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
183
|
-
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
184
|
-
|
|
185
|
-
exec "$JAVACMD" "$@"
|
package/android/gradlew.bat
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
@rem
|
|
2
|
-
@rem Copyright 2015 the original author or authors.
|
|
3
|
-
@rem
|
|
4
|
-
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
@rem you may not use this file except in compliance with the License.
|
|
6
|
-
@rem You may obtain a copy of the License at
|
|
7
|
-
@rem
|
|
8
|
-
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
@rem
|
|
10
|
-
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
@rem See the License for the specific language governing permissions and
|
|
14
|
-
@rem limitations under the License.
|
|
15
|
-
@rem
|
|
16
|
-
|
|
17
|
-
@if "%DEBUG%" == "" @echo off
|
|
18
|
-
@rem ##########################################################################
|
|
19
|
-
@rem
|
|
20
|
-
@rem Gradle startup script for Windows
|
|
21
|
-
@rem
|
|
22
|
-
@rem ##########################################################################
|
|
23
|
-
|
|
24
|
-
@rem Set local scope for the variables with windows NT shell
|
|
25
|
-
if "%OS%"=="Windows_NT" setlocal
|
|
26
|
-
|
|
27
|
-
set DIRNAME=%~dp0
|
|
28
|
-
if "%DIRNAME%" == "" set DIRNAME=.
|
|
29
|
-
set APP_BASE_NAME=%~n0
|
|
30
|
-
set APP_HOME=%DIRNAME%
|
|
31
|
-
|
|
32
|
-
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
33
|
-
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
34
|
-
|
|
35
|
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
36
|
-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
37
|
-
|
|
38
|
-
@rem Find java.exe
|
|
39
|
-
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
40
|
-
|
|
41
|
-
set JAVA_EXE=java.exe
|
|
42
|
-
%JAVA_EXE% -version >NUL 2>&1
|
|
43
|
-
<<<<<<< HEAD:ios-swift-sdk/Examples/LemniskReactDemo/android/gradlew.bat
|
|
44
|
-
if "%ERRORLEVEL%" == "0" goto execute
|
|
45
|
-
=======
|
|
46
|
-
if "%ERRORLEVEL%" == "0" goto init
|
|
47
|
-
>>>>>>> master:react-native/android/gradlew.bat
|
|
48
|
-
|
|
49
|
-
echo.
|
|
50
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
51
|
-
echo.
|
|
52
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
53
|
-
echo location of your Java installation.
|
|
54
|
-
|
|
55
|
-
goto fail
|
|
56
|
-
|
|
57
|
-
:findJavaFromJavaHome
|
|
58
|
-
set JAVA_HOME=%JAVA_HOME:"=%
|
|
59
|
-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
60
|
-
|
|
61
|
-
<<<<<<< HEAD:ios-swift-sdk/Examples/LemniskReactDemo/android/gradlew.bat
|
|
62
|
-
if exist "%JAVA_EXE%" goto execute
|
|
63
|
-
=======
|
|
64
|
-
if exist "%JAVA_EXE%" goto init
|
|
65
|
-
>>>>>>> master:react-native/android/gradlew.bat
|
|
66
|
-
|
|
67
|
-
echo.
|
|
68
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
69
|
-
echo.
|
|
70
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
71
|
-
echo location of your Java installation.
|
|
72
|
-
|
|
73
|
-
goto fail
|
|
74
|
-
|
|
75
|
-
<<<<<<< HEAD:ios-swift-sdk/Examples/LemniskReactDemo/android/gradlew.bat
|
|
76
|
-
=======
|
|
77
|
-
:init
|
|
78
|
-
@rem Get command-line arguments, handling Windows variants
|
|
79
|
-
|
|
80
|
-
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
81
|
-
|
|
82
|
-
:win9xME_args
|
|
83
|
-
@rem Slurp the command line arguments.
|
|
84
|
-
set CMD_LINE_ARGS=
|
|
85
|
-
set _SKIP=2
|
|
86
|
-
|
|
87
|
-
:win9xME_args_slurp
|
|
88
|
-
if "x%~1" == "x" goto execute
|
|
89
|
-
|
|
90
|
-
set CMD_LINE_ARGS=%*
|
|
91
|
-
|
|
92
|
-
>>>>>>> master:react-native/android/gradlew.bat
|
|
93
|
-
:execute
|
|
94
|
-
@rem Setup the command line
|
|
95
|
-
|
|
96
|
-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
@rem Execute Gradle
|
|
100
|
-
<<<<<<< HEAD:ios-swift-sdk/Examples/LemniskReactDemo/android/gradlew.bat
|
|
101
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
102
|
-
=======
|
|
103
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
104
|
-
>>>>>>> master:react-native/android/gradlew.bat
|
|
105
|
-
|
|
106
|
-
:end
|
|
107
|
-
@rem End local scope for the variables with windows NT shell
|
|
108
|
-
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
109
|
-
|
|
110
|
-
:fail
|
|
111
|
-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
112
|
-
rem the _cmd.exe /c_ return code!
|
|
113
|
-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
114
|
-
exit /b 1
|
|
115
|
-
|
|
116
|
-
:mainEnd
|
|
117
|
-
if "%OS%"=="Windows_NT" endlocal
|
|
118
|
-
|
|
119
|
-
:omega
|
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>LemniskSdk.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>0</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|