@screeb/react-native 2.1.14 → 2.1.16

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.
@@ -28,7 +28,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
28
28
  @ReactMethod
29
29
  fun initSdk(channelId: String, userId: String?, properties: ReadableMap?, hooks: ReadableMap?, initOptions: ReadableMap?, language: String?) {
30
30
  Log.d("ScreebModule", "Called initSdk : $userId")
31
- Screeb.setSecondarySDK("react-native", "2.1.14")
31
+ Screeb.setSecondarySDK("react-native", "2.1.16")
32
32
  var mapHooks:HashMap<String, Any>? = null
33
33
  if (hooks != null) {
34
34
  mapHooks = hashMapOf<String, Any>()
@@ -48,7 +48,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
48
48
  }
49
49
 
50
50
  Handler(Looper.getMainLooper()).post {
51
- Screeb.pluginInit(channelId, userId, fromReadableMap(properties), mapHooks, language)
51
+ Screeb.pluginInit(channelId, userId, this.fromReadableMap(properties), mapHooks, language)
52
52
  }
53
53
  }
54
54
 
@@ -56,15 +56,20 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
56
56
  fun setIdentity(userId: String, properties: ReadableMap?) {
57
57
  Log.d("ScreebModule", "Called setIdentity : $userId")
58
58
  Handler(Looper.getMainLooper()).post {
59
- Screeb.setIdentity(userId, fromReadableMap(properties))
59
+ Screeb.setIdentity(userId, this.fromReadableMap(properties))
60
60
  }
61
61
  }
62
62
 
63
63
  @ReactMethod
64
64
  fun setProperties(properties: ReadableMap?) {
65
+ if (properties == null) {
66
+ Log.d("ScreebModule", "Called setProperties with null properties")
67
+ return
68
+ }
69
+
65
70
  Log.d("ScreebModule", "Called setProperties")
66
71
  Handler(Looper.getMainLooper()).post {
67
- Screeb.setVisitorProperties(fromReadableMap(properties))
72
+ Screeb.setVisitorProperties(this.fromReadableMap(properties)!!)
68
73
  }
69
74
  }
70
75
 
@@ -72,7 +77,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
72
77
  fun assignGroup(type: String? = null, name: String, properties: ReadableMap? = null) {
73
78
  Log.d("ScreebModule", "Called assignGroup : $name")
74
79
  Handler(Looper.getMainLooper()).post {
75
- Screeb.assignGroup(type, name, fromReadableMap(properties))
80
+ Screeb.assignGroup(type, name, this.fromReadableMap(properties))
76
81
  }
77
82
  }
78
83
 
@@ -80,7 +85,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
80
85
  fun unassignGroup(type: String? = null, name: String, properties: ReadableMap? = null) {
81
86
  Log.d("ScreebModule", "Called unassignGroup : $name")
82
87
  Handler(Looper.getMainLooper()).post {
83
- Screeb.unassignGroup(type, name, fromReadableMap(properties))
88
+ Screeb.unassignGroup(type, name, this.fromReadableMap(properties))
84
89
  }
85
90
  }
86
91
 
@@ -88,7 +93,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
88
93
  fun trackEvent(eventId: String, properties: ReadableMap?) {
89
94
  Log.d("ScreebModule", "Called trackEvent : $eventId")
90
95
  Handler(Looper.getMainLooper()).post {
91
- Screeb.trackEvent(eventId, fromReadableMap(properties))
96
+ Screeb.trackEvent(eventId, this.fromReadableMap(properties))
92
97
  }
93
98
  }
94
99
 
@@ -96,7 +101,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
96
101
  fun trackScreen(screen: String, properties: ReadableMap?) {
97
102
  Log.d("ScreebModule", "Called trackScreen : $screen")
98
103
  Handler(Looper.getMainLooper()).post {
99
- Screeb.trackScreen(screen, fromReadableMap(properties))
104
+ Screeb.trackScreen(screen, this.fromReadableMap(properties))
100
105
  }
101
106
  }
102
107
 
@@ -121,7 +126,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
121
126
  }
122
127
  }
123
128
  Handler(Looper.getMainLooper()).post {
124
- Screeb.startSurvey(surveyId, allowMultipleResponses ?: true, fromReadableMap(hiddenFields), ignoreSurveyStatus ?: true, mapHooks, language)
129
+ Screeb.startSurvey(surveyId, allowMultipleResponses ?: true, this.fromReadableMap(hiddenFields), ignoreSurveyStatus ?: true, mapHooks, language)
125
130
  }
126
131
  }
127
132
 
@@ -152,7 +157,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
152
157
  @ReactMethod
153
158
  fun onHookResult(hookId: String, payload: ReadableMap?){
154
159
  if (payload != null) {
155
- val result = fromReadableMap(payload!!)!!["result"] as Any?
160
+ val result = this.fromReadableMap(payload!!)!!["result"] as Any?
156
161
  Screeb.onHookResult(hookId, result)
157
162
  }
158
163
  }
@@ -175,16 +180,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
175
180
  if (readableMap == null) {
176
181
  return null
177
182
  }
178
- val map = HashMap<String, Any?>()
179
- val keys = readableMap.keySetIterator()
180
- while (keys.hasNextKey()) {
181
- val key = keys.nextKey()
182
- when (val value = readableMap.getValue(key)) {
183
- is ReadableMap -> map[key] = fromReadableMap(value)
184
- is ReadableArray -> map[key] = fromReadableArray(value)
185
- else -> map[key] = value
186
- }
187
- }
188
- return map
183
+
184
+ return readableMap!!.toHashMap() as HashMap<String, Any?>?
189
185
  }
190
186
  }
@@ -13,7 +13,7 @@ class ScreebModule: RCTEventEmitter {
13
13
  initOptions initOptions_: [String: Any]?,
14
14
  language language_: String?
15
15
  ) {
16
- Screeb.setSecondarySDK(name: "react-native", version: "2.1.14")
16
+ Screeb.setSecondarySDK(name: "react-native", version: "2.1.16")
17
17
  var map: [String: AnyEncodable?] = [:]
18
18
  if (properties_ != nil) {
19
19
  map = self.mapToAnyEncodable(map: properties_!)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/react-native",
3
- "version": "2.1.14",
3
+ "version": "2.1.16",
4
4
  "description": "Continuous Product Discovery",
5
5
  "scripts": {
6
6
  "clean": "rm -rf lib/",