@screeb/react-native 2.0.14 → 2.0.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.
@@ -25,7 +25,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
25
25
  }
26
26
 
27
27
  @ReactMethod
28
- fun initSdk(channelId: String, userId: String?, properties: ReadableMap?, hooks: ReadableMap?, isDebugMode: Boolean? = false) {
28
+ fun initSdk(channelId: String, userId: String?, properties: ReadableMap?, hooks: ReadableMap?, initOptions: ReadableMap?) {
29
29
  Log.d("ScreebModule", "Called initSdk : $userId")
30
30
  var map: HashMap<String, Any?>? = null
31
31
  if (properties != null) {
@@ -51,9 +51,6 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
51
51
 
52
52
  // TODO: pass to pluginInit
53
53
  var initOptions = Screeb.InitOptions()
54
- if (isDebugMode != null) {
55
- initOptions.isDebugMode = isDebugMode
56
- }
57
54
 
58
55
  Handler(Looper.getMainLooper()).post {
59
56
  Screeb.pluginInit(channelId, userId, map, mapHooks)
@@ -3,7 +3,7 @@
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(ScreebModule, RCTEventEmitter)
5
5
 
6
- RCT_EXTERN_METHOD(initSdk:(NSString *)channelId userId:(NSString *)userId_ properties:(NSDictionary<NSString *, id> *)properties_ hooks:(NSDictionary<NSString *, id> *)hooks_ isDebugMode:(BOOL *)isDebugMode_)
6
+ RCT_EXTERN_METHOD(initSdk:(NSString *)channelId userId:(NSString *)userId_ properties:(NSDictionary<NSString *, id> *)properties_ hooks:(NSDictionary<NSString *, id> *)hooks_ initOptions:(NSDictionary<NSString *, id> *)initOptions_)
7
7
  RCT_EXTERN_METHOD(setIdentity:(NSString *)userId properties:(NSDictionary<NSString *, id> *)properties_)
8
8
  RCT_EXTERN_METHOD(setProperties:(NSDictionary<NSString *, id> *)properties)
9
9
  RCT_EXTERN_METHOD(assignGroup:(NSString *)type name:(NSString *)name_ properties:(NSDictionary<NSString *, id> *)properties_)
@@ -4,13 +4,13 @@ import Foundation
4
4
 
5
5
  @objc(ScreebModule)
6
6
  class ScreebModule: RCTEventEmitter {
7
- @objc(initSdk:userId:properties:hooks:isDebugMode:)
7
+ @objc(initSdk:userId:properties:hooks:initOptions:)
8
8
  func initSdk(
9
9
  _ channelId: String,
10
10
  userId userId_: String?,
11
11
  properties properties_: [String: Any]?,
12
12
  hooks hooks_: [String: Any]?,
13
- isDebugMode isDebugMode_: Any?) {
13
+ initOptions initOptions_: [String: Any]?) {
14
14
  var map: [String: AnyEncodable?] = [:]
15
15
  if (properties_ != nil) {
16
16
  map = self.mapToAnyEncodable(map: properties_!)
@@ -19,7 +19,7 @@ class ScreebModule: RCTEventEmitter {
19
19
  if (hooks_ != nil) {
20
20
  mapHooks = [:]
21
21
  hooks_?.forEach{ hook in
22
- if(hook.key == "version"){
22
+ if (hook.key == "version") {
23
23
  mapHooks![hook.key] = hook.value as? String
24
24
  } else {
25
25
  mapHooks![hook.key] = {(payload:Any) -> () in self.sendEvent(withName: "ScreebEvent", body: ["hookId":hook.value,"payload":String(describing: payload)]) }
@@ -28,8 +28,10 @@ class ScreebModule: RCTEventEmitter {
28
28
  }
29
29
 
30
30
  var initOptions = InitOptions()
31
- if (isDebugMode_ != nil) {
32
- initOptions = InitOptions(isDebugMode: isDebugMode_ as! Bool)
31
+ initOptions_?.forEach{ option in
32
+ if (option.key == "isDebugMode") {
33
+ initOptions = InitOptions(isDebugMode: option.value as! Bool)
34
+ }
33
35
  }
34
36
 
35
37
  DispatchQueue.main.async {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/react-native",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
4
4
  "description": "Continuous Product Discovery",
5
5
  "scripts": {
6
6
  "clean": "rm -rf lib/",