lemnisk-react-native 0.1.6 → 0.1.7
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/LICENSE +21 -21
- package/README.md +121 -121
- package/android/.gradle/6.7/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.7/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +72 -72
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
- package/android/gradle.properties +22 -22
- package/android/gradlew +185 -185
- package/android/gradlew.bat +15 -0
- package/android/src/main/AndroidManifest.xml +4 -4
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkModule.java +158 -158
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkPackage.java +28 -28
- package/ios/LemniskSdk.h +5 -5
- package/ios/LemniskSdk.m +38 -38
- package/lemnisk-react-native.podspec +21 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +9 -9
- package/package.json +156 -156
- package/src/index.tsx +20 -20
- package/android/.gradle/6.5/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.5/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.5/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.5/fileContent/fileContent.lock +0 -0
- package/android/.gradle/6.5/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.5/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.5/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.5/gc.properties +0 -0
- package/android/.gradle/6.5/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.7/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.7/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.7/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.7/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.7/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.7/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.7/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
@@ -1,158 +1,158 @@
|
|
1
|
-
package com.reactnativelemnisksdk;
|
2
|
-
|
3
|
-
import android.util.Log;
|
4
|
-
import android.app.Activity;
|
5
|
-
import androidx.annotation.NonNull;
|
6
|
-
|
7
|
-
import com.facebook.react.bridge.Promise;
|
8
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
9
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
10
|
-
import com.facebook.react.bridge.ReactMethod;
|
11
|
-
import com.facebook.react.bridge.ReadableMap;
|
12
|
-
import com.facebook.react.module.annotations.ReactModule;
|
13
|
-
import com.google.android.gms.tasks.OnSuccessListener;
|
14
|
-
import com.google.android.gms.tasks.Task;
|
15
|
-
import com.google.firebase.messaging.FirebaseMessaging;
|
16
|
-
import javax.annotation.Nullable;
|
17
|
-
import org.json.JSONObject;
|
18
|
-
import java.util.Iterator;
|
19
|
-
|
20
|
-
import co.lemnisk.app.android.AttributeBuilder;
|
21
|
-
import co.lemnisk.app.android.LemniskHelper;
|
22
|
-
|
23
|
-
@ReactModule(name = LemniskSdkModule.NAME)
|
24
|
-
public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
25
|
-
public static final String NAME = "LemniskSdk";
|
26
|
-
private ReactApplicationContext reactContext;
|
27
|
-
|
28
|
-
public LemniskSdkModule(ReactApplicationContext reactContext) {
|
29
|
-
super(reactContext);
|
30
|
-
this.reactContext = reactContext;
|
31
|
-
LemniskHelper helper = LemniskHelper.getInstance(reactContext);
|
32
|
-
|
33
|
-
Task<String> task = FirebaseMessaging.getInstance().getToken();
|
34
|
-
task.addOnSuccessListener(new OnSuccessListener<String>() {
|
35
|
-
@Override
|
36
|
-
public void onSuccess(@NonNull String s) {
|
37
|
-
Log.d("Firebase Token","onSuccess ========> : "+s);
|
38
|
-
helper.setGCMToken(s);
|
39
|
-
helper.init();
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
@Override
|
45
|
-
@NonNull
|
46
|
-
public String getName() {
|
47
|
-
return NAME;
|
48
|
-
}
|
49
|
-
|
50
|
-
@ReactMethod
|
51
|
-
private AttributeBuilder getAttributeBuilderFromMap(ReadableMap object) {
|
52
|
-
try {
|
53
|
-
JSONObject attr = new JSONObject(object.toString());
|
54
|
-
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
55
|
-
if (attr.has("NativeMap")) {
|
56
|
-
JSONObject nativeMap = attr.getJSONObject("NativeMap");
|
57
|
-
Iterator<String> keys = nativeMap.keys();
|
58
|
-
while (keys.hasNext()) {
|
59
|
-
String key = keys.next();
|
60
|
-
builder.addAttribute(key, nativeMap.get(key).toString());
|
61
|
-
}
|
62
|
-
}
|
63
|
-
return builder.build();
|
64
|
-
}
|
65
|
-
catch (Exception e) {
|
66
|
-
Log.e("TAG", "Exception in creating AttributeBuilder From ReadbleMap", e);
|
67
|
-
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
68
|
-
return builder.build();
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
@ReactMethod
|
73
|
-
public void track(String eventName, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
74
|
-
Log.d("TAG: ", "eventLogging: track: ");
|
75
|
-
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
76
|
-
try {
|
77
|
-
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
78
|
-
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
79
|
-
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder,otherIdsBuilder);
|
80
|
-
}
|
81
|
-
catch (Exception e) {
|
82
|
-
Log.e("TAG", "Exception in track event", e);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
@ReactMethod
|
87
|
-
public void screen(String name, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
88
|
-
Log.d("TAG: ", "eventLogging: track: ");
|
89
|
-
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
90
|
-
try {
|
91
|
-
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
92
|
-
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
93
|
-
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder,otherIdsBuilder);
|
94
|
-
}
|
95
|
-
catch (Exception e) {
|
96
|
-
Log.e("TAG", "Exception in screen event", e);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
@ReactMethod
|
101
|
-
public void identify(String userId, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
102
|
-
Log.d("TAG: ", "eventLogging: track: ");
|
103
|
-
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
104
|
-
try {
|
105
|
-
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
106
|
-
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
107
|
-
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder,otherIdsBuilder);
|
108
|
-
}
|
109
|
-
catch (Exception e) {
|
110
|
-
Log.e("TAG", "Exception in identify event", e);
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
|
-
@ReactMethod
|
115
|
-
public void registerForPush( String title, String message){
|
116
|
-
Activity activity = reactContext.getCurrentActivity();
|
117
|
-
try{
|
118
|
-
if(title != null && message != null){
|
119
|
-
Log.d("Lemnisk: ", "registerForPushNotifications");
|
120
|
-
LemniskHelper.getInstance(getReactApplicationContext()).registerForPushNotifications(activity, title, message);
|
121
|
-
}
|
122
|
-
else{
|
123
|
-
Log.d("Lemnisk: ", "Default registerForPushNotifications");
|
124
|
-
LemniskHelper.getInstance(getReactApplicationContext()).registerForPushNotifications(activity);
|
125
|
-
}
|
126
|
-
|
127
|
-
}
|
128
|
-
catch (Exception e) {
|
129
|
-
Log.e("Lemnisk", "Exception in registerForPushNotifications", e);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
// Example method
|
134
|
-
// See https://reactnative.dev/docs/native-modules-android
|
135
|
-
@ReactMethod
|
136
|
-
public void createLemniskEvent(String name, ReadableMap object) {
|
137
|
-
Log.d("TAG: ", "eventLogging: name: " + name);
|
138
|
-
Log.d("TAG: ", "eventLogging: object: " + object.toString());
|
139
|
-
try {
|
140
|
-
JSONObject attr = new JSONObject(object.toString());
|
141
|
-
if (attr.has("NativeMap")) {
|
142
|
-
JSONObject nativeMap = attr.getJSONObject("NativeMap");
|
143
|
-
|
144
|
-
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
145
|
-
Iterator<String> keys = nativeMap.keys();
|
146
|
-
while (keys.hasNext()) {
|
147
|
-
String key = keys.next();
|
148
|
-
builder.addAttribute(key, nativeMap.get(key).toString());
|
149
|
-
}
|
150
|
-
LemniskHelper.getInstance(getReactApplicationContext()).logEvent(name, builder.build());
|
151
|
-
}
|
152
|
-
} catch (Exception e) {
|
153
|
-
Log.e("Lemnisk", "Exception in createLemniskEvent", e);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
public static native int nativeMultiply(int a, int b);
|
158
|
-
}
|
1
|
+
package com.reactnativelemnisksdk;
|
2
|
+
|
3
|
+
import android.util.Log;
|
4
|
+
import android.app.Activity;
|
5
|
+
import androidx.annotation.NonNull;
|
6
|
+
|
7
|
+
import com.facebook.react.bridge.Promise;
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
9
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
10
|
+
import com.facebook.react.bridge.ReactMethod;
|
11
|
+
import com.facebook.react.bridge.ReadableMap;
|
12
|
+
import com.facebook.react.module.annotations.ReactModule;
|
13
|
+
import com.google.android.gms.tasks.OnSuccessListener;
|
14
|
+
import com.google.android.gms.tasks.Task;
|
15
|
+
import com.google.firebase.messaging.FirebaseMessaging;
|
16
|
+
import javax.annotation.Nullable;
|
17
|
+
import org.json.JSONObject;
|
18
|
+
import java.util.Iterator;
|
19
|
+
|
20
|
+
import co.lemnisk.app.android.AttributeBuilder;
|
21
|
+
import co.lemnisk.app.android.LemniskHelper;
|
22
|
+
|
23
|
+
@ReactModule(name = LemniskSdkModule.NAME)
|
24
|
+
public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
25
|
+
public static final String NAME = "LemniskSdk";
|
26
|
+
private ReactApplicationContext reactContext;
|
27
|
+
|
28
|
+
public LemniskSdkModule(ReactApplicationContext reactContext) {
|
29
|
+
super(reactContext);
|
30
|
+
this.reactContext = reactContext;
|
31
|
+
LemniskHelper helper = LemniskHelper.getInstance(reactContext);
|
32
|
+
|
33
|
+
Task<String> task = FirebaseMessaging.getInstance().getToken();
|
34
|
+
task.addOnSuccessListener(new OnSuccessListener<String>() {
|
35
|
+
@Override
|
36
|
+
public void onSuccess(@NonNull String s) {
|
37
|
+
Log.d("Firebase Token","onSuccess ========> : "+s);
|
38
|
+
helper.setGCMToken(s);
|
39
|
+
helper.init();
|
40
|
+
}
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
@Override
|
45
|
+
@NonNull
|
46
|
+
public String getName() {
|
47
|
+
return NAME;
|
48
|
+
}
|
49
|
+
|
50
|
+
@ReactMethod
|
51
|
+
private AttributeBuilder getAttributeBuilderFromMap(ReadableMap object) {
|
52
|
+
try {
|
53
|
+
JSONObject attr = new JSONObject(object.toString());
|
54
|
+
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
55
|
+
if (attr.has("NativeMap")) {
|
56
|
+
JSONObject nativeMap = attr.getJSONObject("NativeMap");
|
57
|
+
Iterator<String> keys = nativeMap.keys();
|
58
|
+
while (keys.hasNext()) {
|
59
|
+
String key = keys.next();
|
60
|
+
builder.addAttribute(key, nativeMap.get(key).toString());
|
61
|
+
}
|
62
|
+
}
|
63
|
+
return builder.build();
|
64
|
+
}
|
65
|
+
catch (Exception e) {
|
66
|
+
Log.e("TAG", "Exception in creating AttributeBuilder From ReadbleMap", e);
|
67
|
+
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
68
|
+
return builder.build();
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
@ReactMethod
|
73
|
+
public void track(String eventName, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
74
|
+
Log.d("TAG: ", "eventLogging: track: ");
|
75
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
76
|
+
try {
|
77
|
+
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
78
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
79
|
+
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder,otherIdsBuilder);
|
80
|
+
}
|
81
|
+
catch (Exception e) {
|
82
|
+
Log.e("TAG", "Exception in track event", e);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
@ReactMethod
|
87
|
+
public void screen(String name, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
88
|
+
Log.d("TAG: ", "eventLogging: track: ");
|
89
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
90
|
+
try {
|
91
|
+
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
92
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
93
|
+
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder,otherIdsBuilder);
|
94
|
+
}
|
95
|
+
catch (Exception e) {
|
96
|
+
Log.e("TAG", "Exception in screen event", e);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
@ReactMethod
|
101
|
+
public void identify(String userId, ReadableMap propertiesObject, ReadableMap otherIdsObject) {
|
102
|
+
Log.d("TAG: ", "eventLogging: track: ");
|
103
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
104
|
+
try {
|
105
|
+
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
106
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
107
|
+
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder,otherIdsBuilder);
|
108
|
+
}
|
109
|
+
catch (Exception e) {
|
110
|
+
Log.e("TAG", "Exception in identify event", e);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
@ReactMethod
|
115
|
+
public void registerForPush( String title, String message){
|
116
|
+
Activity activity = reactContext.getCurrentActivity();
|
117
|
+
try{
|
118
|
+
if(title != null && message != null){
|
119
|
+
Log.d("Lemnisk: ", "registerForPushNotifications");
|
120
|
+
LemniskHelper.getInstance(getReactApplicationContext()).registerForPushNotifications(activity, title, message);
|
121
|
+
}
|
122
|
+
else{
|
123
|
+
Log.d("Lemnisk: ", "Default registerForPushNotifications");
|
124
|
+
LemniskHelper.getInstance(getReactApplicationContext()).registerForPushNotifications(activity);
|
125
|
+
}
|
126
|
+
|
127
|
+
}
|
128
|
+
catch (Exception e) {
|
129
|
+
Log.e("Lemnisk", "Exception in registerForPushNotifications", e);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
// Example method
|
134
|
+
// See https://reactnative.dev/docs/native-modules-android
|
135
|
+
@ReactMethod
|
136
|
+
public void createLemniskEvent(String name, ReadableMap object) {
|
137
|
+
Log.d("TAG: ", "eventLogging: name: " + name);
|
138
|
+
Log.d("TAG: ", "eventLogging: object: " + object.toString());
|
139
|
+
try {
|
140
|
+
JSONObject attr = new JSONObject(object.toString());
|
141
|
+
if (attr.has("NativeMap")) {
|
142
|
+
JSONObject nativeMap = attr.getJSONObject("NativeMap");
|
143
|
+
|
144
|
+
AttributeBuilder.Builder builder = new AttributeBuilder.Builder();
|
145
|
+
Iterator<String> keys = nativeMap.keys();
|
146
|
+
while (keys.hasNext()) {
|
147
|
+
String key = keys.next();
|
148
|
+
builder.addAttribute(key, nativeMap.get(key).toString());
|
149
|
+
}
|
150
|
+
LemniskHelper.getInstance(getReactApplicationContext()).logEvent(name, builder.build());
|
151
|
+
}
|
152
|
+
} catch (Exception e) {
|
153
|
+
Log.e("Lemnisk", "Exception in createLemniskEvent", e);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
public static native int nativeMultiply(int a, int b);
|
158
|
+
}
|
@@ -1,28 +1,28 @@
|
|
1
|
-
package com.reactnativelemnisksdk;
|
2
|
-
|
3
|
-
import androidx.annotation.NonNull;
|
4
|
-
|
5
|
-
import com.facebook.react.ReactPackage;
|
6
|
-
import com.facebook.react.bridge.NativeModule;
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
8
|
-
import com.facebook.react.uimanager.ViewManager;
|
9
|
-
|
10
|
-
import java.util.ArrayList;
|
11
|
-
import java.util.Collections;
|
12
|
-
import java.util.List;
|
13
|
-
|
14
|
-
public class LemniskSdkPackage implements ReactPackage {
|
15
|
-
@NonNull
|
16
|
-
@Override
|
17
|
-
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
18
|
-
List<NativeModule> modules = new ArrayList<>();
|
19
|
-
modules.add(new LemniskSdkModule(reactContext));
|
20
|
-
return modules;
|
21
|
-
}
|
22
|
-
|
23
|
-
@NonNull
|
24
|
-
@Override
|
25
|
-
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
26
|
-
return Collections.emptyList();
|
27
|
-
}
|
28
|
-
}
|
1
|
+
package com.reactnativelemnisksdk;
|
2
|
+
|
3
|
+
import androidx.annotation.NonNull;
|
4
|
+
|
5
|
+
import com.facebook.react.ReactPackage;
|
6
|
+
import com.facebook.react.bridge.NativeModule;
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
8
|
+
import com.facebook.react.uimanager.ViewManager;
|
9
|
+
|
10
|
+
import java.util.ArrayList;
|
11
|
+
import java.util.Collections;
|
12
|
+
import java.util.List;
|
13
|
+
|
14
|
+
public class LemniskSdkPackage implements ReactPackage {
|
15
|
+
@NonNull
|
16
|
+
@Override
|
17
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
18
|
+
List<NativeModule> modules = new ArrayList<>();
|
19
|
+
modules.add(new LemniskSdkModule(reactContext));
|
20
|
+
return modules;
|
21
|
+
}
|
22
|
+
|
23
|
+
@NonNull
|
24
|
+
@Override
|
25
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
26
|
+
return Collections.emptyList();
|
27
|
+
}
|
28
|
+
}
|
package/ios/LemniskSdk.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
2
|
-
|
3
|
-
@interface LemniskSdk : NSObject <RCTBridgeModule>
|
4
|
-
|
5
|
-
@end
|
1
|
+
#import <React/RCTBridgeModule.h>
|
2
|
+
|
3
|
+
@interface LemniskSdk : NSObject <RCTBridgeModule>
|
4
|
+
|
5
|
+
@end
|
package/ios/LemniskSdk.m
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
#import "LemniskSdk.h"
|
2
|
-
#import <Foundation/Foundation.h>
|
3
|
-
#import <React/RCTLog.h>
|
4
|
-
#import <Lemnisk/Lemnisk.h>
|
5
|
-
|
6
|
-
@implementation LemniskSdk
|
7
|
-
|
8
|
-
RCT_EXPORT_MODULE()
|
9
|
-
|
10
|
-
// Example method
|
11
|
-
// See // https://reactnative.dev/docs/native-modules-ios
|
12
|
-
// RCT_REMAP_METHOD
|
13
|
-
RCT_EXPORT_METHOD(createLemniskEvent:(NSString *)name object:(NSDictionary *)object) {
|
14
|
-
RCTLogInfo(@"Logging Lemnisk Event %@ object %@ ", name, object);
|
15
|
-
LemniskAnalytics *lemAnalytics = [LemniskAnalytics shared];
|
16
|
-
[lemAnalytics logActivityWithName:name traits:object];
|
17
|
-
}
|
18
|
-
|
19
|
-
RCT_EXPORT_METHOD(identify:(NSString *)userId object:(NSDictionary *)traits object:(NSDictionary *)otherIds) {
|
20
|
-
RCTLogInfo(@"Logging Lemnisk Identify event with userId %@, properties: %@, otherIds: %@", userId, traits, otherIds);
|
21
|
-
[[Lemnisk shared] identify:userId traits:traits otherIds:otherIds];
|
22
|
-
}
|
23
|
-
|
24
|
-
RCT_EXPORT_METHOD(track:(NSString *)event object:(NSDictionary *)properties object:(NSDictionary *)otherIds) {
|
25
|
-
RCTLogInfo(@"Logging Lemnisk Track event with event %@, properties: %@, otherIds: %@", event, properties, otherIds);
|
26
|
-
[[Lemnisk shared] track:event properties:properties otherIds:otherIds];
|
27
|
-
}
|
28
|
-
|
29
|
-
RCT_EXPORT_METHOD(screen:(NSString *)name object:(NSDictionary *)properties object:(NSDictionary *)otherIds) {
|
30
|
-
RCTLogInfo(@"Logging Lemnisk Screen event with name %@, properties: %@, otherIds: %@", name, properties, otherIds);
|
31
|
-
[[Lemnisk shared] screen:name properties:properties otherIds:otherIds];
|
32
|
-
}
|
33
|
-
|
34
|
-
RCT_EXPORT_METHOD(registerForPushNotifications) {
|
35
|
-
RCTLogInfo(@"calling registerForPushNotifications");
|
36
|
-
[[Lemnisk shared] registerForPushNotifications];
|
37
|
-
}
|
38
|
-
@end
|
1
|
+
#import "LemniskSdk.h"
|
2
|
+
#import <Foundation/Foundation.h>
|
3
|
+
#import <React/RCTLog.h>
|
4
|
+
#import <Lemnisk/Lemnisk.h>
|
5
|
+
|
6
|
+
@implementation LemniskSdk
|
7
|
+
|
8
|
+
RCT_EXPORT_MODULE()
|
9
|
+
|
10
|
+
// Example method
|
11
|
+
// See // https://reactnative.dev/docs/native-modules-ios
|
12
|
+
// RCT_REMAP_METHOD
|
13
|
+
RCT_EXPORT_METHOD(createLemniskEvent:(NSString *)name object:(NSDictionary *)object) {
|
14
|
+
RCTLogInfo(@"Logging Lemnisk Event %@ object %@ ", name, object);
|
15
|
+
LemniskAnalytics *lemAnalytics = [LemniskAnalytics shared];
|
16
|
+
[lemAnalytics logActivityWithName:name traits:object];
|
17
|
+
}
|
18
|
+
|
19
|
+
RCT_EXPORT_METHOD(identify:(NSString *)userId object:(NSDictionary *)traits object:(NSDictionary *)otherIds) {
|
20
|
+
RCTLogInfo(@"Logging Lemnisk Identify event with userId %@, properties: %@, otherIds: %@", userId, traits, otherIds);
|
21
|
+
[[Lemnisk shared] identify:userId traits:traits otherIds:otherIds];
|
22
|
+
}
|
23
|
+
|
24
|
+
RCT_EXPORT_METHOD(track:(NSString *)event object:(NSDictionary *)properties object:(NSDictionary *)otherIds) {
|
25
|
+
RCTLogInfo(@"Logging Lemnisk Track event with event %@, properties: %@, otherIds: %@", event, properties, otherIds);
|
26
|
+
[[Lemnisk shared] track:event properties:properties otherIds:otherIds];
|
27
|
+
}
|
28
|
+
|
29
|
+
RCT_EXPORT_METHOD(screen:(NSString *)name object:(NSDictionary *)properties object:(NSDictionary *)otherIds) {
|
30
|
+
RCTLogInfo(@"Logging Lemnisk Screen event with name %@, properties: %@, otherIds: %@", name, properties, otherIds);
|
31
|
+
[[Lemnisk shared] screen:name properties:properties otherIds:otherIds];
|
32
|
+
}
|
33
|
+
|
34
|
+
RCT_EXPORT_METHOD(registerForPushNotifications) {
|
35
|
+
RCTLogInfo(@"calling registerForPushNotifications");
|
36
|
+
[[Lemnisk shared] registerForPushNotifications];
|
37
|
+
}
|
38
|
+
@end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
4
|
-
|
5
|
-
Pod::Spec.new do |s|
|
6
|
-
s.name = 'lemnisk-react-native'
|
7
|
-
s.version = package['version']
|
8
|
-
s.summary = package['description']
|
9
|
-
s.homepage = package['homepage']
|
10
|
-
s.license = package['license']
|
11
|
-
s.authors = package['author']
|
12
|
-
|
13
|
-
s.requires_arc = true
|
14
|
-
s.platforms = { :ios => '10.0' }
|
15
|
-
s.source = { :git => 'https://github.com/Immensitas/lemnisk-react', :tag => s.version }
|
16
|
-
|
17
|
-
s.source_files = 'ios/**/*.{h,m,mm}'
|
18
|
-
|
19
|
-
s.dependency 'React-Core'
|
20
|
-
s.dependency 'Lemnisk-iOS-SDK', '3.7.
|
21
|
-
end
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
4
|
+
|
5
|
+
Pod::Spec.new do |s|
|
6
|
+
s.name = 'lemnisk-react-native'
|
7
|
+
s.version = package['version']
|
8
|
+
s.summary = package['description']
|
9
|
+
s.homepage = package['homepage']
|
10
|
+
s.license = package['license']
|
11
|
+
s.authors = package['author']
|
12
|
+
|
13
|
+
s.requires_arc = true
|
14
|
+
s.platforms = { :ios => '10.0' }
|
15
|
+
s.source = { :git => 'https://github.com/Immensitas/lemnisk-react', :tag => s.version }
|
16
|
+
|
17
|
+
s.source_files = 'ios/**/*.{h,m,mm}'
|
18
|
+
|
19
|
+
s.dependency 'React-Core'
|
20
|
+
s.dependency 'Lemnisk-iOS-SDK', '3.7.7'
|
21
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","registerForPushNotifications","title","message","registerForPush","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\n\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n LemniskSdk.registerForPush(title, message);\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 \n};\n\n\nexport default LemniskSdk as LemniskSdkType;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAGpCD,UAAU,CAACE,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1EJ,UAAU,CAACK,eAAe,CAACF,KAAK,EAAEC,OAAO,CAAC;AAC5C,CAAC;AAAA,IAAAE,QAAA,GAYcN,UAAU;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
1
|
+
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","registerForPushNotifications","title","message","registerForPush","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\r\n\r\nconst { LemniskSdk } = NativeModules;\r\n\r\n\r\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\r\n LemniskSdk.registerForPush(title, message);\r\n}\r\n\r\ntype LemniskSdkType = {\r\n createLemniskEvent(name: string, object: object): any;\r\n track(eventName: string, properties: object, otherIds: object): any;\r\n screen(name: string, properties: object, otherIds: object): any;\r\n identify(userId: string, properties: object, otherIds: object): any;\r\n registerForPushNotifications( title?: string, message?: string): any ;\r\n \r\n};\r\n\r\n\r\nexport default LemniskSdk as LemniskSdkType;\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAGpCD,UAAU,CAACE,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1EJ,UAAU,CAACK,eAAe,CAACF,KAAK,EAAEC,OAAO,CAAC;AAC5C,CAAC;AAAA,IAAAE,QAAA,GAYcN,UAAU;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","LemniskSdk","registerForPushNotifications","title","message","registerForPush"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\n\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\n LemniskSdk.registerForPush(title, message);\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 \n};\n\n\nexport default LemniskSdk as LemniskSdkType;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAM;EAAEC;AAAW,CAAC,GAAGD,aAAa;AAGpCC,UAAU,CAACC,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1EH,UAAU,CAACI,eAAe,CAACF,KAAK,EAAEC,OAAO,CAAC;AAC5C,CAAC;AAYD,eAAeH,UAAU"}
|
1
|
+
{"version":3,"names":["NativeModules","LemniskSdk","registerForPushNotifications","title","message","registerForPush"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\r\n\r\nconst { LemniskSdk } = NativeModules;\r\n\r\n\r\nLemniskSdk.registerForPushNotifications = (title: string, message: string)=>{\r\n LemniskSdk.registerForPush(title, message);\r\n}\r\n\r\ntype LemniskSdkType = {\r\n createLemniskEvent(name: string, object: object): any;\r\n track(eventName: string, properties: object, otherIds: object): any;\r\n screen(name: string, properties: object, otherIds: object): any;\r\n identify(userId: string, properties: object, otherIds: object): any;\r\n registerForPushNotifications( title?: string, message?: string): any ;\r\n \r\n};\r\n\r\n\r\nexport default LemniskSdk as LemniskSdkType;\r\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAM;EAAEC;AAAW,CAAC,GAAGD,aAAa;AAGpCC,UAAU,CAACC,4BAA4B,GAAG,CAACC,KAAa,EAAEC,OAAe,KAAG;EAC1EH,UAAU,CAACI,eAAe,CAACF,KAAK,EAAEC,OAAO,CAAC;AAC5C,CAAC;AAYD,eAAeH,UAAU"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
type LemniskSdkType = {
|
2
|
-
createLemniskEvent(name: string, object: object): any;
|
3
|
-
track(eventName: string, properties: object, otherIds: object): any;
|
4
|
-
screen(name: string, properties: object, otherIds: object): any;
|
5
|
-
identify(userId: string, properties: object, otherIds: object): any;
|
6
|
-
registerForPushNotifications(title?: string, message?: string): any;
|
7
|
-
};
|
8
|
-
declare const _default: LemniskSdkType;
|
9
|
-
export default _default;
|
1
|
+
type LemniskSdkType = {
|
2
|
+
createLemniskEvent(name: string, object: object): any;
|
3
|
+
track(eventName: string, properties: object, otherIds: object): any;
|
4
|
+
screen(name: string, properties: object, otherIds: object): any;
|
5
|
+
identify(userId: string, properties: object, otherIds: object): any;
|
6
|
+
registerForPushNotifications(title?: string, message?: string): any;
|
7
|
+
};
|
8
|
+
declare const _default: LemniskSdkType;
|
9
|
+
export default _default;
|