lemnisk-react-native 0.1.17 → 0.1.19
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/.gradle/6.7/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.7/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.7/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.7/gc.properties +0 -0
- 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.lock +0 -0
- package/android/.gradle/7.5/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.5/fileHashes/fileHashes.lock +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 +2 -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/vcs-1/gc.properties +0 -0
- package/android/build.gradle +7 -7
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkModule.java +277 -16
- package/ios/LemniskSdk.m +161 -0
- package/ios/LemniskSdk.xcodeproj/project.pbxproj +2 -0
- package/ios/LemniskSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/LemniskSdk.xcodeproj/project.xcworkspace/xcuserdata/koteswaruduakula.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/LemniskSdk.xcodeproj/xcuserdata/koteswaruduakula.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lemnisk-react-native.podspec +2 -2
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +22 -0
- package/package.json +1 -1
- package/src/index.tsx +35 -2
Binary file
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
package/android/build.gradle
CHANGED
@@ -7,7 +7,7 @@ buildscript {
|
|
7
7
|
}
|
8
8
|
|
9
9
|
dependencies {
|
10
|
-
classpath 'com.android.tools.build:gradle:4.
|
10
|
+
classpath 'com.android.tools.build:gradle:7.4.2'
|
11
11
|
}
|
12
12
|
}
|
13
13
|
}
|
@@ -19,11 +19,11 @@ def safeExtGet(prop, fallback) {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
android {
|
22
|
-
compileSdkVersion safeExtGet('LemniskSdk_compileSdkVersion',
|
23
|
-
buildToolsVersion safeExtGet('LemniskSdk_buildToolsVersion', '
|
22
|
+
compileSdkVersion safeExtGet('LemniskSdk_compileSdkVersion', 34)
|
23
|
+
buildToolsVersion safeExtGet('LemniskSdk_buildToolsVersion', '34.0.0')
|
24
24
|
defaultConfig {
|
25
25
|
minSdkVersion safeExtGet('LemniskSdk_minSdkVersion', 21)
|
26
|
-
targetSdkVersion safeExtGet('LemniskSdk_targetSdkVersion',
|
26
|
+
targetSdkVersion safeExtGet('LemniskSdk_targetSdkVersion', 34)
|
27
27
|
versionCode 1
|
28
28
|
versionName "1.0"
|
29
29
|
|
@@ -38,8 +38,8 @@ android {
|
|
38
38
|
disable 'GradleCompatible'
|
39
39
|
}
|
40
40
|
compileOptions {
|
41
|
-
sourceCompatibility JavaVersion.
|
42
|
-
targetCompatibility JavaVersion.
|
41
|
+
sourceCompatibility JavaVersion.VERSION_11
|
42
|
+
targetCompatibility JavaVersion.VERSION_11
|
43
43
|
}
|
44
44
|
}
|
45
45
|
|
@@ -56,7 +56,7 @@ repositories {
|
|
56
56
|
dependencies {
|
57
57
|
//noinspection GradleDynamicVersion
|
58
58
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
59
|
-
implementation 'co.lemnisk.app.android:AndroidSDK:1.1.
|
59
|
+
implementation 'co.lemnisk.app.android:AndroidSDK:1.1.52'
|
60
60
|
implementation 'org.apache.commons:commons-text:1.9'
|
61
61
|
//implementation(name:'AndroidSDK-release', ext:'aar')
|
62
62
|
implementation group: 'joda-time', name: 'joda-time', version: '2.10.10'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
2
2
|
distributionPath=wrapper/dists
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
9
9
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
10
10
|
import com.facebook.react.bridge.ReactMethod;
|
11
11
|
import com.facebook.react.bridge.ReadableMap;
|
12
|
+
import com.facebook.react.bridge.ReadableArray;
|
12
13
|
import com.facebook.react.module.annotations.ReactModule;
|
13
14
|
import com.google.android.gms.tasks.OnSuccessListener;
|
14
15
|
import com.google.android.gms.tasks.Task;
|
@@ -23,30 +24,50 @@ import co.lemnisk.app.android.LemniskHelper;
|
|
23
24
|
import co.lemnisk.app.android.Utils;
|
24
25
|
import co.lemnisk.app.android.LemConstants;
|
25
26
|
import android.text.TextUtils;
|
27
|
+
import android.os.Handler;
|
28
|
+
import android.os.Looper;
|
29
|
+
import com.facebook.react.bridge.Callback;
|
30
|
+
import com.facebook.react.bridge.WritableArray;
|
31
|
+
import com.facebook.react.bridge.Arguments;
|
32
|
+
import java.util.List;
|
33
|
+
import java.util.ArrayList;
|
34
|
+
|
35
|
+
import co.lemnisk.app.android.NotificationCenter;
|
26
36
|
|
27
37
|
@ReactModule(name = LemniskSdkModule.NAME)
|
28
38
|
public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
29
39
|
public static final String NAME = "LemniskSdk";
|
40
|
+
public static final String NOTIFICATION_CENTER_URL = "Lemnisk.Notification_Center_URL";
|
30
41
|
private ReactApplicationContext reactContext;
|
31
42
|
|
32
43
|
public LemniskSdkModule(ReactApplicationContext reactContext) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
super(reactContext);
|
45
|
+
this.reactContext = reactContext;
|
46
|
+
|
47
|
+
LemniskHelper helper = LemniskHelper.getInstance(reactContext);
|
48
|
+
|
49
|
+
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
50
|
+
@Override
|
51
|
+
public void run() {
|
52
|
+
try {
|
53
|
+
android.content.pm.ApplicationInfo ai = reactContext.getPackageManager().getApplicationInfo(
|
54
|
+
reactContext.getPackageName(),
|
55
|
+
android.content.pm.PackageManager.GET_META_DATA
|
56
|
+
);
|
57
|
+
String notificationCenterUrl = ai.metaData.getString(NOTIFICATION_CENTER_URL);
|
58
|
+
|
59
|
+
if (notificationCenterUrl != null && !notificationCenterUrl.isEmpty()) {
|
60
|
+
helper.init(null, null, null, notificationCenterUrl, null, null);
|
61
|
+
} else {
|
62
|
+
helper.init();
|
63
|
+
}
|
64
|
+
} catch (Exception e) {
|
65
|
+
Log.e("LemniskSdk", "Failed to load meta-data: " + e.getMessage());
|
66
|
+
helper.init();
|
48
67
|
}
|
49
|
-
}
|
68
|
+
}
|
69
|
+
});
|
70
|
+
|
50
71
|
}
|
51
72
|
|
52
73
|
@Override
|
@@ -169,5 +190,245 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
169
190
|
}
|
170
191
|
}
|
171
192
|
|
193
|
+
@ReactMethod
|
194
|
+
public void setUniqueUserId(String tokenizedCid) {
|
195
|
+
Log.d("Lemnisk: ", "setUniqueUserId: " + tokenizedCid);
|
196
|
+
try {
|
197
|
+
LemniskHelper.getInstance(getReactApplicationContext()).setUniqueUserId(tokenizedCid);
|
198
|
+
} catch (Exception e) {
|
199
|
+
Log.e("Lemnisk", "Exception in setUniqueUserId", e);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
@ReactMethod
|
204
|
+
public void resetUser(){
|
205
|
+
Log.d("Lemnisk: ", "resetUser");
|
206
|
+
try {
|
207
|
+
LemniskHelper.getInstance(getReactApplicationContext()).resetUser();
|
208
|
+
} catch (Exception e) {
|
209
|
+
Log.e("Lemnisk", "Exception in resetUser", e);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
214
|
+
public String getUniqueUserId() {
|
215
|
+
Log.d("Lemnisk: ", "getUniqueUserId");
|
216
|
+
try {
|
217
|
+
String uniqueUserId = LemniskHelper.getInstance(getReactApplicationContext()).getUniqueUserId();
|
218
|
+
return uniqueUserId != null ? uniqueUserId : "";
|
219
|
+
} catch (Exception e) {
|
220
|
+
Log.e("Lemnisk", "Exception in getUniqueUserId", e);
|
221
|
+
return "";
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
@ReactMethod
|
226
|
+
public void setCustomConsent(boolean transConsent, boolean promoConsent) {
|
227
|
+
Log.d("Lemnisk: ", "setCustomConsent: transConsent=" + transConsent + ", promoConsent=" + promoConsent);
|
228
|
+
try {
|
229
|
+
JSONObject consent = new JSONObject();
|
230
|
+
consent.put("trans_consent", transConsent);
|
231
|
+
consent.put("promo_consent", promoConsent);
|
232
|
+
LemniskHelper.getInstance(getReactApplicationContext()).setCustomConsent(consent);
|
233
|
+
} catch (Exception e) {
|
234
|
+
Log.e("Lemnisk", "Exception in setCustomConsent", e);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
@ReactMethod
|
239
|
+
public void getCustomConsent(final Callback callback) {
|
240
|
+
Log.d("Lemnisk: ", "getCustomConsent");
|
241
|
+
try {
|
242
|
+
LemniskHelper.getInstance(getReactApplicationContext()).getCustomConsent(new LemniskHelper.ConsentCallback() {
|
243
|
+
@Override
|
244
|
+
public void getConsent(JSONObject consent) {
|
245
|
+
WritableArray result = Arguments.createArray();
|
246
|
+
if (consent != null) {
|
247
|
+
boolean transConsent = consent.optBoolean("trans_consent");
|
248
|
+
boolean promoConsent = consent.optBoolean("promo_consent");
|
249
|
+
result.pushBoolean(transConsent);
|
250
|
+
result.pushBoolean(promoConsent);
|
251
|
+
} else {
|
252
|
+
result.pushNull();
|
253
|
+
result.pushNull();
|
254
|
+
}
|
255
|
+
callback.invoke(result);
|
256
|
+
}
|
257
|
+
});
|
258
|
+
} catch (Exception e) {
|
259
|
+
Log.e("Lemnisk", "Exception in getCustomConsent", e);
|
260
|
+
WritableArray result = Arguments.createArray();
|
261
|
+
result.pushNull();
|
262
|
+
result.pushNull();
|
263
|
+
callback.invoke(result);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
267
|
+
@ReactMethod
|
268
|
+
public void getOSConsent(final Callback callback) {
|
269
|
+
Log.d("Lemnisk: ", "getOSConsent");
|
270
|
+
try {
|
271
|
+
int consent = LemniskHelper.getInstance(getReactApplicationContext()).getOSConsent();
|
272
|
+
callback.invoke(consent);
|
273
|
+
} catch (Exception e) {
|
274
|
+
Log.e("Lemnisk", "Exception in getOSConsent", e);
|
275
|
+
callback.invoke(3); // Unknown consent
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
@ReactMethod
|
280
|
+
public void setCustomerDeviceId(String deviceId) {
|
281
|
+
Log.d("Lemnisk: ", "setCustomerDeviceId: " + deviceId);
|
282
|
+
try {
|
283
|
+
LemniskHelper.getInstance(getReactApplicationContext()).setCustomerDeviceId(deviceId);
|
284
|
+
} catch (Exception e) {
|
285
|
+
Log.e("Lemnisk", "Exception in setCustomerDeviceId", e);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
@ReactMethod
|
290
|
+
public void overrideDeviceId(String deviceId) {
|
291
|
+
Log.d("Lemnisk: ", "overrideDeviceId: " + deviceId);
|
292
|
+
try {
|
293
|
+
LemniskHelper.getInstance(getReactApplicationContext()).overrideDeviceId(deviceId);
|
294
|
+
} catch (Exception e) {
|
295
|
+
Log.e("Lemnisk", "Exception in overrideDeviceId", e);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
@ReactMethod
|
300
|
+
public void getUnreadCount(String tokenizedCid, final Promise promise) {
|
301
|
+
Log.d("Lemnisk: ", "getUnreadCount: " + tokenizedCid);
|
302
|
+
try {
|
303
|
+
LemniskHelper.getInstance(getReactApplicationContext()).getUnreadCount(tokenizedCid,
|
304
|
+
new NotificationCenter.NotificationCenterListener<Integer>() {
|
305
|
+
@Override
|
306
|
+
public void onResponse(Integer unreadCount) {
|
307
|
+
promise.resolve(unreadCount);
|
308
|
+
}
|
309
|
+
}
|
310
|
+
);
|
311
|
+
} catch (Exception e) {
|
312
|
+
Log.e("Lemnisk", "Exception in getUnreadCount", e);
|
313
|
+
promise.reject("ERROR", "Failed to get unread count", e);
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
@ReactMethod
|
318
|
+
public void markRead(String tokenizedCid, String pid, final Promise promise) {
|
319
|
+
Log.d("Lemnisk: ", "markRead: tokenizedCid=" + tokenizedCid + ", pid=" + pid);
|
320
|
+
try {
|
321
|
+
LemniskHelper.getInstance(getReactApplicationContext()).markRead(tokenizedCid, pid,
|
322
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
323
|
+
@Override
|
324
|
+
public void onResponse(Boolean success) {
|
325
|
+
promise.resolve(success);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
);
|
329
|
+
} catch (Exception e) {
|
330
|
+
Log.e("Lemnisk", "Exception in markRead", e);
|
331
|
+
promise.reject("ERROR", "Failed to mark as read", e);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
@ReactMethod
|
336
|
+
public void markBulkRead(String tokenizedCid, ReadableArray pidsArray, final Promise promise) {
|
337
|
+
Log.d("Lemnisk: ", "markBulkRead: tokenizedCid=" + tokenizedCid);
|
338
|
+
try {
|
339
|
+
List<String> pids = new ArrayList<>();
|
340
|
+
for (int i = 0; i < pidsArray.size(); i++) {
|
341
|
+
pids.add(pidsArray.getString(i));
|
342
|
+
}
|
343
|
+
LemniskHelper.getInstance(getReactApplicationContext()).markBulkRead(tokenizedCid, pids,
|
344
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
345
|
+
@Override
|
346
|
+
public void onResponse(Boolean success) {
|
347
|
+
promise.resolve(success);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
);
|
351
|
+
} catch (Exception e) {
|
352
|
+
Log.e("Lemnisk", "Exception in markBulkRead", e);
|
353
|
+
promise.reject("ERROR", "Failed to mark bulk as read", e);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
|
357
|
+
@ReactMethod
|
358
|
+
public void markDelete(String tokenizedCid, String pid, final Promise promise) {
|
359
|
+
Log.d("Lemnisk: ", "markDelete: tokenizedCid=" + tokenizedCid + ", pid=" + pid);
|
360
|
+
try {
|
361
|
+
LemniskHelper.getInstance(getReactApplicationContext()).markDelete(tokenizedCid, pid,
|
362
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
363
|
+
@Override
|
364
|
+
public void onResponse(Boolean success) {
|
365
|
+
promise.resolve(success);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
);
|
369
|
+
} catch (Exception e) {
|
370
|
+
Log.e("Lemnisk", "Exception in markDelete", e);
|
371
|
+
promise.reject("ERROR", "Failed to mark as deleted", e);
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
@ReactMethod
|
376
|
+
public void markBulkDelete(String tokenizedCid, ReadableArray pidsArray, final Promise promise) {
|
377
|
+
Log.d("Lemnisk: ", "markBulkDelete: tokenizedCid=" + tokenizedCid);
|
378
|
+
try {
|
379
|
+
List<String> pids = new ArrayList<>();
|
380
|
+
for (int i = 0; i < pidsArray.size(); i++) {
|
381
|
+
pids.add(pidsArray.getString(i));
|
382
|
+
}
|
383
|
+
LemniskHelper.getInstance(getReactApplicationContext()).markBulkDelete(tokenizedCid, pids,
|
384
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
385
|
+
@Override
|
386
|
+
public void onResponse(Boolean success) {
|
387
|
+
promise.resolve(success);
|
388
|
+
}
|
389
|
+
}
|
390
|
+
);
|
391
|
+
} catch (Exception e) {
|
392
|
+
Log.e("Lemnisk", "Exception in markBulkDelete", e);
|
393
|
+
promise.reject("ERROR", "Failed to mark bulk as deleted", e);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
@ReactMethod
|
398
|
+
public void readAll(String tokenizedCid, String type, final Promise promise) {
|
399
|
+
Log.d("Lemnisk: ", "readAll: tokenizedCid=" + tokenizedCid + ", type=" + type);
|
400
|
+
try {
|
401
|
+
LemniskHelper.getInstance(getReactApplicationContext()).readAll(tokenizedCid, type,
|
402
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
403
|
+
@Override
|
404
|
+
public void onResponse(Boolean success) {
|
405
|
+
promise.resolve(success);
|
406
|
+
}
|
407
|
+
}
|
408
|
+
);
|
409
|
+
} catch (Exception e) {
|
410
|
+
Log.e("Lemnisk", "Exception in readAll", e);
|
411
|
+
promise.reject("ERROR", "Failed to mark all as read", e);
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
@ReactMethod
|
416
|
+
public void deleteAll(String tokenizedCid, String type, final Promise promise) {
|
417
|
+
Log.d("Lemnisk: ", "deleteAll: tokenizedCid=" + tokenizedCid + ", type=" + type);
|
418
|
+
try {
|
419
|
+
LemniskHelper.getInstance(getReactApplicationContext()).deleteAll(tokenizedCid, type,
|
420
|
+
new NotificationCenter.NotificationCenterListener<Boolean>() {
|
421
|
+
@Override
|
422
|
+
public void onResponse(Boolean success) {
|
423
|
+
promise.resolve(success);
|
424
|
+
}
|
425
|
+
}
|
426
|
+
);
|
427
|
+
} catch (Exception e) {
|
428
|
+
Log.e("Lemnisk", "Exception in deleteAll", e);
|
429
|
+
promise.reject("ERROR", "Failed to mark all as deleted", e);
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
172
433
|
public static native int nativeMultiply(int a, int b);
|
173
434
|
}
|
package/ios/LemniskSdk.m
CHANGED
@@ -35,4 +35,165 @@ RCT_EXPORT_METHOD(registerForPush) {
|
|
35
35
|
RCTLogInfo(@"calling registerForPushNotifications");
|
36
36
|
[[Lemnisk shared] registerForPushNotifications];
|
37
37
|
}
|
38
|
+
|
39
|
+
RCT_EXPORT_METHOD(setUniqueUserId:(NSString *) tokenized_cid) {
|
40
|
+
RCTLogInfo(@"calling setUniqueUserId");
|
41
|
+
[[Lemnisk shared] setUniqueUserId:tokenized_cid];
|
42
|
+
}
|
43
|
+
|
44
|
+
RCT_EXPORT_METHOD(resetUser) {
|
45
|
+
RCTLogInfo(@"calling resetuser");
|
46
|
+
[[Lemnisk shared] resetUser];
|
47
|
+
}
|
48
|
+
|
49
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getUniqueUserId) {
|
50
|
+
RCTLogInfo(@"Getting unique user ID");
|
51
|
+
NSString *uniqueUserId = [[Lemnisk shared] getUniqueUserId];
|
52
|
+
return uniqueUserId ?: @"";
|
53
|
+
}
|
54
|
+
|
55
|
+
// Set Custom Consent method
|
56
|
+
RCT_EXPORT_METHOD(setCustomConsent:(BOOL)transConsent promoConsent:(BOOL)promoConsent) {
|
57
|
+
RCTLogInfo(@"Setting custom consent: transConsent=%d, promoConsent=%d", transConsent, promoConsent);
|
58
|
+
[[Lemnisk shared] setCustomConsentWithTransConsent:transConsent promoConsent:promoConsent];
|
59
|
+
}
|
60
|
+
|
61
|
+
// Get Custom Consent method (asynchronous with callback)
|
62
|
+
RCT_EXPORT_METHOD(getCustomConsent:(RCTResponseSenderBlock)callback) {
|
63
|
+
RCTLogInfo(@"Getting custom consent");
|
64
|
+
[[Lemnisk shared] getCustomConsentObjcWithCompletion:^(NSNumber * _Nullable transConsent, NSNumber * _Nullable promoConsent) {
|
65
|
+
NSArray *response;
|
66
|
+
if (transConsent != nil && promoConsent != nil) {
|
67
|
+
response = @[transConsent, promoConsent];
|
68
|
+
} else {
|
69
|
+
response = @[NSNull.null, NSNull.null];
|
70
|
+
}
|
71
|
+
callback(@[response]);
|
72
|
+
}];
|
73
|
+
}
|
74
|
+
|
75
|
+
// Get OS Consent method (asynchronous with callback)
|
76
|
+
RCT_EXPORT_METHOD(getOSConsent:(RCTResponseSenderBlock)callback) {
|
77
|
+
RCTLogInfo(@"Getting OS consent");
|
78
|
+
[[Lemnisk shared] getOSConsentWithCompletion:^(NSInteger consent) {
|
79
|
+
callback(@[@(consent)]);
|
80
|
+
}];
|
81
|
+
}
|
82
|
+
|
83
|
+
// Set Custom Device ID method
|
84
|
+
RCT_EXPORT_METHOD(setCustomerDeviceId:(NSString *)deviceId) {
|
85
|
+
RCTLogInfo(@"Setting custom device ID: %@", deviceId);
|
86
|
+
[[Lemnisk shared] setCustomerDeviceIdWithDeviceId:deviceId];
|
87
|
+
}
|
88
|
+
|
89
|
+
// Override Device ID method
|
90
|
+
RCT_EXPORT_METHOD(overrideDeviceId:(NSString *)deviceId) {
|
91
|
+
RCTLogInfo(@"Overriding device ID: %@", deviceId);
|
92
|
+
[[Lemnisk shared] overrideDeviceIdWithDeviceId:deviceId];
|
93
|
+
}
|
94
|
+
|
95
|
+
// Get Unread Count
|
96
|
+
RCT_EXPORT_METHOD(getUnreadCount:(NSString *)tokenizedCid
|
97
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
98
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
99
|
+
RCTLogInfo(@"Getting unread count for tokenizedCid: %@", tokenizedCid);
|
100
|
+
[[Lemnisk shared] getUnreadCountObjcWithTokenizedCid:tokenizedCid completion:^(NSNumber * _Nullable count) {
|
101
|
+
if (count != nil) {
|
102
|
+
resolve(count);
|
103
|
+
} else {
|
104
|
+
reject(@"error", @"Failed to get unread count", nil);
|
105
|
+
}
|
106
|
+
}];
|
107
|
+
}
|
108
|
+
|
109
|
+
// Mark as Read
|
110
|
+
RCT_EXPORT_METHOD(markRead:(NSString *)tokenizedCid
|
111
|
+
pid:(NSString *)pid
|
112
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
113
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
114
|
+
RCTLogInfo(@"Marking notification as read for tokenizedCid: %@, pid: %@", tokenizedCid, pid);
|
115
|
+
[[Lemnisk shared] markReadObjcWithTokenizedCid:tokenizedCid pid:pid completion:^(NSNumber * _Nullable success) {
|
116
|
+
if (success != nil) {
|
117
|
+
resolve(success);
|
118
|
+
} else {
|
119
|
+
reject(@"error", @"Failed to mark as read", nil);
|
120
|
+
}
|
121
|
+
}];
|
122
|
+
}
|
123
|
+
|
124
|
+
// Mark as Deleted
|
125
|
+
RCT_EXPORT_METHOD(markDelete:(NSString *)tokenizedCid
|
126
|
+
pid:(NSString *)pid
|
127
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
128
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
129
|
+
RCTLogInfo(@"Marking notification as deleted for tokenizedCid: %@, pid: %@", tokenizedCid, pid);
|
130
|
+
[[Lemnisk shared] markDeleteObjcWithTokenizedCid:tokenizedCid pid:pid completion:^(NSNumber * _Nullable success) {
|
131
|
+
if (success != nil) {
|
132
|
+
resolve(success);
|
133
|
+
} else {
|
134
|
+
reject(@"error", @"Failed to mark as deleted", nil);
|
135
|
+
}
|
136
|
+
}];
|
137
|
+
}
|
138
|
+
|
139
|
+
// Mark as Read (Bulk)
|
140
|
+
RCT_EXPORT_METHOD(markBulkRead:(NSString *)tokenizedCid
|
141
|
+
pids:(NSArray *)pids
|
142
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
143
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
144
|
+
RCTLogInfo(@"Marking bulk notifications as read for tokenizedCid: %@, pids: %@", tokenizedCid, pids);
|
145
|
+
[[Lemnisk shared] markBulkReadObjcWithTokenizedCid:tokenizedCid pids:pids completion:^(NSNumber * _Nullable success) {
|
146
|
+
if (success != nil) {
|
147
|
+
resolve(success);
|
148
|
+
} else {
|
149
|
+
reject(@"error", @"Failed to mark bulk as read", nil);
|
150
|
+
}
|
151
|
+
}];
|
152
|
+
}
|
153
|
+
|
154
|
+
// Mark as Deleted (Bulk)
|
155
|
+
RCT_EXPORT_METHOD(markBulkDelete:(NSString *)tokenizedCid
|
156
|
+
pids:(NSArray *)pids
|
157
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
158
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
159
|
+
RCTLogInfo(@"Marking bulk notifications as deleted for tokenizedCid: %@, pids: %@", tokenizedCid, pids);
|
160
|
+
[[Lemnisk shared] markBulkDeleteObjcWithTokenizedCid:tokenizedCid pids:pids completion:^(NSNumber * _Nullable success) {
|
161
|
+
if (success != nil) {
|
162
|
+
resolve(success);
|
163
|
+
} else {
|
164
|
+
reject(@"error", @"Failed to mark bulk as deleted", nil);
|
165
|
+
}
|
166
|
+
}];
|
167
|
+
}
|
168
|
+
|
169
|
+
// Read All
|
170
|
+
RCT_EXPORT_METHOD(readAll:(NSString *)tokenizedCid
|
171
|
+
type:(NSString *)type
|
172
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
173
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
174
|
+
RCTLogInfo(@"Reading all notifications for tokenizedCid: %@, type: %@", tokenizedCid, type);
|
175
|
+
[[Lemnisk shared] readAllObjcWithTokenizedCid:tokenizedCid type:type completion:^(NSNumber * _Nullable success) {
|
176
|
+
if (success != nil) {
|
177
|
+
resolve(success);
|
178
|
+
} else {
|
179
|
+
reject(@"error", @"Failed to read all", nil);
|
180
|
+
}
|
181
|
+
}];
|
182
|
+
}
|
183
|
+
|
184
|
+
// Delete All
|
185
|
+
RCT_EXPORT_METHOD(deleteAll:(NSString *)tokenizedCid
|
186
|
+
type:(NSString *)type
|
187
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
188
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
189
|
+
RCTLogInfo(@"Deleting all notifications for tokenizedCid: %@, type: %@", tokenizedCid, type);
|
190
|
+
[[Lemnisk shared] deleteAllObjcWithTokenizedCid:tokenizedCid type:type completion:^(NSNumber * _Nullable success) {
|
191
|
+
if (success != nil) {
|
192
|
+
resolve(success);
|
193
|
+
} else {
|
194
|
+
reject(@"error", @"Failed to delete all", nil);
|
195
|
+
}
|
196
|
+
}];
|
197
|
+
}
|
198
|
+
|
38
199
|
@end
|
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
/* Begin PBXFileReference section */
|
22
22
|
134814201AA4EA6300B7C361 /* libLemniskSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLemniskSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
23
|
+
6E0930EA2D92C3F500D3A5E4 /* Lemnisk.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Lemnisk.xcframework; path = "../../ios-swift-sdk/LemniskFrameworkCode/build/Lemnisk/Lemnisk.xcframework"; sourceTree = "<group>"; };
|
23
24
|
B3E7B5881CC2AC0600A0062D /* LemniskSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LemniskSdk.h; sourceTree = "<group>"; };
|
24
25
|
B3E7B5891CC2AC0600A0062D /* LemniskSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LemniskSdk.m; sourceTree = "<group>"; };
|
25
26
|
/* End PBXFileReference section */
|
@@ -56,6 +57,7 @@
|
|
56
57
|
6D63E5B47AF0FDB6B5CFD387 /* Frameworks */ = {
|
57
58
|
isa = PBXGroup;
|
58
59
|
children = (
|
60
|
+
6E0930EA2D92C3F500D3A5E4 /* Lemnisk.xcframework */,
|
59
61
|
);
|
60
62
|
name = Frameworks;
|
61
63
|
sourceTree = "<group>";
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
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>
|
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
|
|
15
15
|
s.source = { :git => 'https://github.com/Immensitas/lemnisk-react', :tag => s.version }
|
16
16
|
|
17
17
|
s.source_files = 'ios/**/*.{h,m,mm}'
|
18
|
-
|
18
|
+
|
19
19
|
s.dependency 'React-Core'
|
20
|
-
s.dependency 'Lemnisk-iOS-SDK', '3.9.
|
20
|
+
s.dependency 'Lemnisk-iOS-SDK', '3.9.7'
|
21
21
|
end
|
package/lib/commonjs/index.js
CHANGED
@@ -15,5 +15,18 @@ LemniskSdk.registerForPushNotifications = (title, message) => {
|
|
15
15
|
LemniskSdk.registerForPush();
|
16
16
|
}
|
17
17
|
};
|
18
|
+
const originalSetCustomConsent = LemniskSdk.setCustomConsent;
|
19
|
+
LemniskSdk.setCustomConsent = options => {
|
20
|
+
return originalSetCustomConsent(options.transactional, options.promotional);
|
21
|
+
};
|
22
|
+
const originalGetCustomConsent = LemniskSdk.getCustomConsent;
|
23
|
+
LemniskSdk.getCustomConsent = callback => {
|
24
|
+
originalGetCustomConsent(consent => {
|
25
|
+
callback({
|
26
|
+
transactional: consent[0],
|
27
|
+
promotional: consent[1]
|
28
|
+
});
|
29
|
+
});
|
30
|
+
};
|
18
31
|
var _default = exports.default = LemniskSdk;
|
19
32
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","registerForPushNotifications","title","message","Platform","OS","registerForPush","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\n\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n if(Platform.OS == \"android\"){\n LemniskSdk.registerForPush(title, message);\n }\n else if(Platform.OS == \"ios\"){\n LemniskSdk.registerForPush();\n }\n}\n\ntype LemniskSdkType = {\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(
|
1
|
+
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","registerForPushNotifications","title","message","Platform","OS","registerForPush","originalSetCustomConsent","setCustomConsent","options","transactional","promotional","originalGetCustomConsent","getCustomConsent","callback","consent","_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\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n if(Platform.OS == \"android\"){\n LemniskSdk.registerForPush(title, message);\n }\n else if(Platform.OS == \"ios\"){\n LemniskSdk.registerForPush();\n }\n}\n\ntype LemniskSdkType = {\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object, otherIds: 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\nconst originalSetCustomConsent = LemniskSdk.setCustomConsent;\nLemniskSdk.setCustomConsent = (options: ConsentOptions) => {\n return originalSetCustomConsent(options.transactional, options.promotional);\n};\n\n\nconst originalGetCustomConsent = LemniskSdk.getCustomConsent;\nLemniskSdk.getCustomConsent = (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n originalGetCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n};\n\nexport default LemniskSdk as LemniskSdkType;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAOpCD,UAAU,CAACE,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1E,IAAGC,qBAAQ,CAACC,EAAE,IAAI,SAAS,EAAC;IAC1BN,UAAU,CAACO,eAAe,CAACJ,KAAK,EAAEC,OAAO,CAAC;EAC5C,CAAC,MACI,IAAGC,qBAAQ,CAACC,EAAE,IAAI,KAAK,EAAC;IAC3BN,UAAU,CAACO,eAAe,CAAC,CAAC;EAC9B;AACF,CAAC;AAyBD,MAAMC,wBAAwB,GAAGR,UAAU,CAACS,gBAAgB;AAC5DT,UAAU,CAACS,gBAAgB,GAAIC,OAAuB,IAAK;EACzD,OAAOF,wBAAwB,CAACE,OAAO,CAACC,aAAa,EAAED,OAAO,CAACE,WAAW,CAAC;AAC7E,CAAC;AAGD,MAAMC,wBAAwB,GAAGb,UAAU,CAACc,gBAAgB;AAC5Dd,UAAU,CAACc,gBAAgB,GAAIC,QAA2F,IAAK;EAC7HF,wBAAwB,CAAEG,OAAyC,IAAK;IACtED,QAAQ,CAAC;MACPJ,aAAa,EAAEK,OAAO,CAAC,CAAC,CAAC;MACzBJ,WAAW,EAAEI,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanB,UAAU","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -9,5 +9,18 @@ LemniskSdk.registerForPushNotifications = (title, message) => {
|
|
9
9
|
LemniskSdk.registerForPush();
|
10
10
|
}
|
11
11
|
};
|
12
|
+
const originalSetCustomConsent = LemniskSdk.setCustomConsent;
|
13
|
+
LemniskSdk.setCustomConsent = options => {
|
14
|
+
return originalSetCustomConsent(options.transactional, options.promotional);
|
15
|
+
};
|
16
|
+
const originalGetCustomConsent = LemniskSdk.getCustomConsent;
|
17
|
+
LemniskSdk.getCustomConsent = callback => {
|
18
|
+
originalGetCustomConsent(consent => {
|
19
|
+
callback({
|
20
|
+
transactional: consent[0],
|
21
|
+
promotional: consent[1]
|
22
|
+
});
|
23
|
+
});
|
24
|
+
};
|
12
25
|
export default LemniskSdk;
|
13
26
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LemniskSdk","registerForPushNotifications","title","message","OS","registerForPush"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\n\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n if(Platform.OS == \"android\"){\n LemniskSdk.registerForPush(title, message);\n }\n else if(Platform.OS == \"ios\"){\n LemniskSdk.registerForPush();\n }\n}\n\ntype LemniskSdkType = {\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LemniskSdk","registerForPushNotifications","title","message","OS","registerForPush","originalSetCustomConsent","setCustomConsent","options","transactional","promotional","originalGetCustomConsent","getCustomConsent","callback","consent"],"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\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n if(Platform.OS == \"android\"){\n LemniskSdk.registerForPush(title, message);\n }\n else if(Platform.OS == \"ios\"){\n LemniskSdk.registerForPush();\n }\n}\n\ntype LemniskSdkType = {\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object, otherIds: 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\nconst originalSetCustomConsent = LemniskSdk.setCustomConsent;\nLemniskSdk.setCustomConsent = (options: ConsentOptions) => {\n return originalSetCustomConsent(options.transactional, options.promotional);\n};\n\n\nconst originalGetCustomConsent = LemniskSdk.getCustomConsent;\nLemniskSdk.getCustomConsent = (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n originalGetCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n};\n\nexport default LemniskSdk as LemniskSdkType;\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AAOpCE,UAAU,CAACC,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1E,IAAGJ,QAAQ,CAACK,EAAE,IAAI,SAAS,EAAC;IAC1BJ,UAAU,CAACK,eAAe,CAACH,KAAK,EAAEC,OAAO,CAAC;EAC5C,CAAC,MACI,IAAGJ,QAAQ,CAACK,EAAE,IAAI,KAAK,EAAC;IAC3BJ,UAAU,CAACK,eAAe,CAAC,CAAC;EAC9B;AACF,CAAC;AAyBD,MAAMC,wBAAwB,GAAGN,UAAU,CAACO,gBAAgB;AAC5DP,UAAU,CAACO,gBAAgB,GAAIC,OAAuB,IAAK;EACzD,OAAOF,wBAAwB,CAACE,OAAO,CAACC,aAAa,EAAED,OAAO,CAACE,WAAW,CAAC;AAC7E,CAAC;AAGD,MAAMC,wBAAwB,GAAGX,UAAU,CAACY,gBAAgB;AAC5DZ,UAAU,CAACY,gBAAgB,GAAIC,QAA2F,IAAK;EAC7HF,wBAAwB,CAAEG,OAAyC,IAAK;IACtED,QAAQ,CAAC;MACPJ,aAAa,EAAEK,OAAO,CAAC,CAAC,CAAC;MACzBJ,WAAW,EAAEI,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAED,eAAed,UAAU","ignoreList":[]}
|
@@ -1,9 +1,31 @@
|
|
1
|
+
type ConsentOptions = {
|
2
|
+
transactional: boolean;
|
3
|
+
promotional: boolean;
|
4
|
+
};
|
1
5
|
type LemniskSdkType = {
|
2
6
|
createLemniskEvent(name: string, object: object): any;
|
3
7
|
track(eventName: string, properties: object, otherIds: object): any;
|
4
8
|
screen(name: string, properties: object, otherIds: object): any;
|
5
9
|
identify(userId: string, properties: object, otherIds: object): any;
|
6
10
|
registerForPushNotifications(title?: string, message?: string): any;
|
11
|
+
setUniqueUserId(tokenizedCid: string): void;
|
12
|
+
getUniqueUserId(): string;
|
13
|
+
setCustomConsent(options: ConsentOptions): void;
|
14
|
+
getCustomConsent(callback: (consent: {
|
15
|
+
transactional: boolean | null;
|
16
|
+
promotional: boolean | null;
|
17
|
+
}) => void): void;
|
18
|
+
getOSConsent(callback: (consent: number) => void): void;
|
19
|
+
setCustomerDeviceId(deviceId: string): void;
|
20
|
+
overrideDeviceId(deviceId: string): void;
|
21
|
+
getUnreadCount(tokenizedCid: string): Promise<number>;
|
22
|
+
markRead(tokenizedCid: string, pid: string): Promise<boolean>;
|
23
|
+
markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;
|
24
|
+
markDelete(tokenizedCid: string, pid: string): Promise<boolean>;
|
25
|
+
markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;
|
26
|
+
readAll(tokenizedCid: string, type: string): Promise<boolean>;
|
27
|
+
deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
|
28
|
+
resetUser(): void;
|
7
29
|
};
|
8
30
|
declare const _default: LemniskSdkType;
|
9
31
|
export default _default;
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
@@ -2,6 +2,10 @@ import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
|
3
3
|
const { LemniskSdk } = NativeModules;
|
4
4
|
|
5
|
+
type ConsentOptions = {
|
6
|
+
transactional: boolean;
|
7
|
+
promotional: boolean;
|
8
|
+
};
|
5
9
|
|
6
10
|
LemniskSdk.registerForPushNotifications = (title: string, message: string)=>{
|
7
11
|
if(Platform.OS == "android"){
|
@@ -17,9 +21,38 @@ type LemniskSdkType = {
|
|
17
21
|
track(eventName: string, properties: object, otherIds: object): any;
|
18
22
|
screen(name: string, properties: object, otherIds: object): any;
|
19
23
|
identify(userId: string, properties: object, otherIds: object): any;
|
20
|
-
registerForPushNotifications(
|
21
|
-
|
24
|
+
registerForPushNotifications(title?: string, message?: string): any;
|
25
|
+
setUniqueUserId(tokenizedCid: string): void;
|
26
|
+
getUniqueUserId(): string;
|
27
|
+
setCustomConsent(options: ConsentOptions): void;
|
28
|
+
getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;
|
29
|
+
getOSConsent(callback: (consent: number) => void): void;
|
30
|
+
setCustomerDeviceId(deviceId: string): void;
|
31
|
+
overrideDeviceId(deviceId: string): void;
|
32
|
+
getUnreadCount(tokenizedCid: string): Promise<number>;
|
33
|
+
markRead(tokenizedCid: string, pid: string): Promise<boolean>;
|
34
|
+
markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;
|
35
|
+
markDelete(tokenizedCid: string, pid: string): Promise<boolean>;
|
36
|
+
markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;
|
37
|
+
readAll(tokenizedCid: string, type: string): Promise<boolean>;
|
38
|
+
deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
|
39
|
+
resetUser(): void;
|
40
|
+
};
|
41
|
+
|
42
|
+
const originalSetCustomConsent = LemniskSdk.setCustomConsent;
|
43
|
+
LemniskSdk.setCustomConsent = (options: ConsentOptions) => {
|
44
|
+
return originalSetCustomConsent(options.transactional, options.promotional);
|
22
45
|
};
|
23
46
|
|
24
47
|
|
48
|
+
const originalGetCustomConsent = LemniskSdk.getCustomConsent;
|
49
|
+
LemniskSdk.getCustomConsent = (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {
|
50
|
+
originalGetCustomConsent((consent: [boolean | null, boolean | null]) => {
|
51
|
+
callback({
|
52
|
+
transactional: consent[0],
|
53
|
+
promotional: consent[1]
|
54
|
+
});
|
55
|
+
});
|
56
|
+
};
|
57
|
+
|
25
58
|
export default LemniskSdk as LemniskSdkType;
|