@sodyo/react-native-sodyo-sdk 5.1.0 → 5.1.1

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.
@@ -61,9 +61,10 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
61
61
 
62
62
  @Override
63
63
  public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) {
64
- Log.i(TAG, "onActivityResult()");
64
+ Log.i(TAG, "onActivityResult() - requestCode: " + requestCode + ", resultCode: " + resultCode + ", activity: " + activity);
65
65
 
66
66
  if (requestCode == SODYO_SCANNER_REQUEST_CODE) {
67
+ Log.i(TAG, "onActivityResult() - scanner request code matched, sending EventCloseSodyoScanner");
67
68
  sendEvent("EventCloseSodyoScanner", null);
68
69
  }
69
70
  }
@@ -94,6 +95,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
94
95
  private boolean isCallbackUsed;
95
96
 
96
97
  public SodyoCallback(Callback successCallback, Callback errorCallback) {
98
+ Log.d(TAG, "SodyoCallback() - successCallback: " + (successCallback != null ? "provided" : "nil") + ", errorCallback: " + (errorCallback != null ? "provided" : "nil"));
97
99
  this.successCallback = successCallback;
98
100
  this.errorCallback = errorCallback;
99
101
  }
@@ -102,10 +104,10 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
102
104
  * SodyoInitCallback implementation
103
105
  */
104
106
  public void onSodyoAppLoadSuccess() {
105
- String message = "onSodyoAppLoadSuccess";
106
- Log.i(TAG, message);
107
+ Log.i(TAG, "onSodyoAppLoadSuccess - successCallback: " + (this.successCallback != null ? "provided" : "nil") + ", isCallbackUsed: " + this.isCallbackUsed);
107
108
 
108
109
  if (this.successCallback == null || this.isCallbackUsed) {
110
+ Log.w(TAG, "onSodyoAppLoadSuccess - skipping: callback=" + (this.successCallback == null ? "null" : "exists") + ", used=" + this.isCallbackUsed);
109
111
  return;
110
112
  }
111
113
 
@@ -122,10 +124,10 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
122
124
  * SodyoInitCallback implementation
123
125
  */
124
126
  public void onSodyoAppLoadFailed(String error) {
125
- String message = "onSodyoAppLoadFailed. Error=\"" + error + "\"";
126
- Log.e(TAG, message);
127
+ Log.e(TAG, "onSodyoAppLoadFailed - error: " + error + ", errorCallback: " + (this.errorCallback != null ? "provided" : "nil") + ", isCallbackUsed: " + this.isCallbackUsed);
127
128
 
128
129
  if (this.errorCallback == null || this.isCallbackUsed) {
130
+ Log.w(TAG, "onSodyoAppLoadFailed - skipping: callback=" + (this.errorCallback == null ? "null" : "exists") + ", used=" + this.isCallbackUsed);
129
131
  return;
130
132
  }
131
133
 
@@ -134,6 +136,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
134
136
  }
135
137
 
136
138
  public void permissionError(String err1, String err2) {
139
+ Log.w(TAG, "permissionError - err1: " + err1 + ", err2: " + err2);
137
140
  }
138
141
 
139
142
  /**
@@ -141,8 +144,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
141
144
  */
142
145
  @Override
143
146
  public void sodyoError(Error err) {
144
- String message = "sodyoError. Error=\"" + err + "\"";
145
- Log.e(TAG, message);
147
+ Log.e(TAG, "sodyoError - error: " + err + ", message: " + (err != null ? err.getMessage() : "null"));
146
148
 
147
149
  WritableMap params = Arguments.createMap();
148
150
  params.putString("error", err.getMessage());
@@ -154,7 +156,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
154
156
  */
155
157
  @Override
156
158
  public void onMarkerDetect(String markerType, String data, String error) {
157
- Log.i(TAG, "onMarkerDetect()");
159
+ Log.i(TAG, "onMarkerDetect() - markerType: " + markerType + ", data: " + data + ", error: " + error);
158
160
 
159
161
  if (data == null) {
160
162
  data = "null";
@@ -182,7 +184,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
182
184
  */
183
185
  @Override
184
186
  public void onMarkerContent(String markerId, JSONObject data) {
185
- Log.i(TAG, "onMarkerContent()");
187
+ Log.i(TAG, "onMarkerContent() - markerId: " + markerId + ", data: " + data);
186
188
 
187
189
  WritableMap params = Arguments.createMap();
188
190
  params.putString("markerId", markerId);
@@ -201,7 +203,7 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
201
203
  */
202
204
  @Override
203
205
  public void onModeChange(SettingsHelper.ScannerViewMode oldMode, SettingsHelper.ScannerViewMode newMode) {
204
- Log.i(TAG, "onModeChange()");
206
+ Log.i(TAG, "onModeChange() - oldMode: " + oldMode + ", newMode: " + newMode);
205
207
 
206
208
  WritableMap params = Arguments.createMap();
207
209
 
@@ -215,10 +217,10 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
215
217
  // Issue #7 fix: invoke success callback if already initialized
216
218
  @ReactMethod
217
219
  public void init(final String apiKey, Callback successCallback, Callback errorCallback) {
218
- Log.i(TAG, "init()");
220
+ Log.i(TAG, "init() - apiKey: " + apiKey + ", successCallback: " + (successCallback != null ? "provided" : "nil") + ", errorCallback: " + (errorCallback != null ? "provided" : "nil"));
219
221
 
220
222
  if (Sodyo.isInitialized()) {
221
- Log.i(TAG, "init(): already initialized");
223
+ Log.i(TAG, "init(): already initialized, invoking success callback directly");
222
224
  if (successCallback != null) {
223
225
  successCallback.invoke();
224
226
  }
@@ -242,22 +244,25 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
242
244
  // Issue #1 fix: null-check getCurrentActivity()
243
245
  @ReactMethod
244
246
  public void start() {
245
- Log.i(TAG, "start()");
247
+ Log.i(TAG, "start() - launching scanner");
246
248
  Activity activity = getCurrentActivity();
249
+ Log.d(TAG, "start() - currentActivity: " + activity);
247
250
  if (activity == null) {
248
- Log.e(TAG, "start(): current activity is null");
251
+ Log.e(TAG, "start(): current activity is null, aborting");
249
252
  return;
250
253
  }
251
254
  Intent intent = new Intent(activity, SodyoScannerActivity.class);
255
+ Log.d(TAG, "start() - starting SodyoScannerActivity with requestCode: " + SODYO_SCANNER_REQUEST_CODE);
252
256
  activity.startActivityForResult(intent, SODYO_SCANNER_REQUEST_CODE);
253
257
  }
254
258
 
255
259
  @ReactMethod
256
260
  public void close() {
257
- Log.i(TAG, "close()");
261
+ Log.i(TAG, "close() - closing scanner");
258
262
  Activity activity = getCurrentActivity();
263
+ Log.d(TAG, "close() - currentActivity: " + activity);
259
264
  if (activity == null) {
260
- Log.e(TAG, "close(): current activity is null");
265
+ Log.e(TAG, "close(): current activity is null, aborting");
261
266
  return;
262
267
  }
263
268
  activity.finishActivity(SODYO_SCANNER_REQUEST_CODE);
@@ -266,39 +271,44 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
266
271
  // Issue #6 fix: guard against uninitialized SDK
267
272
  @ReactMethod
268
273
  public void setUserInfo(ReadableMap userInfo) {
269
- Log.i(TAG, "setUserInfo()");
274
+ Log.i(TAG, "setUserInfo() - userInfo: " + userInfo);
270
275
 
271
276
  if (!Sodyo.isInitialized()) {
272
- Log.w(TAG, "setUserInfo(): SDK not initialized yet");
277
+ Log.w(TAG, "setUserInfo(): SDK not initialized yet, aborting");
273
278
  return;
274
279
  }
275
280
 
276
281
  if(userInfo != null) {
282
+ Log.d(TAG, "setUserInfo() - converted map: " + ConversionUtil.toMap(userInfo));
277
283
  Sodyo.getInstance().setUserInfo(ConversionUtil.toMap(userInfo));
284
+ } else {
285
+ Log.w(TAG, "setUserInfo() - userInfo is null, skipping");
278
286
  }
279
287
  }
280
288
 
281
289
  @ReactMethod
282
290
  public void setCustomAdLabel(String label) {
283
- Log.i(TAG, "setCustomAdLabel()");
291
+ Log.i(TAG, "setCustomAdLabel() - label: " + label);
284
292
  Sodyo.setCustomAdLabel(label);
285
293
  }
286
294
 
287
295
  @ReactMethod
288
296
  public void setAppUserId(String userId) {
289
- Log.i(TAG, "setAppUserId()");
297
+ Log.i(TAG, "setAppUserId() - userId: " + userId);
290
298
  Sodyo.setAppUserId(userId);
291
299
  }
292
300
 
293
301
  @ReactMethod
294
302
  public void setScannerParams(ReadableMap scannerPreferences) {
295
- Log.i(TAG, "setScannerParams()");
296
- Sodyo.setScannerParams(ConversionUtil.toFlatMap(scannerPreferences));
303
+ Log.i(TAG, "setScannerParams() - scannerPreferences: " + scannerPreferences);
304
+ Map<String, String> flatMap = ConversionUtil.toFlatMap(scannerPreferences);
305
+ Log.d(TAG, "setScannerParams() - flatMap: " + flatMap);
306
+ Sodyo.setScannerParams(flatMap);
297
307
  }
298
308
 
299
309
  @ReactMethod
300
310
  public void addScannerParam(String key, String value) {
301
- Log.i(TAG, "addScannerParam()");
311
+ Log.i(TAG, "addScannerParam() - key: " + key + ", value: " + value);
302
312
  Sodyo.addScannerParams(key, value);
303
313
  }
304
314
 
@@ -316,36 +326,43 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
316
326
 
317
327
  @ReactMethod
318
328
  public void setDynamicProfile(ReadableMap profile) {
319
- Log.i(TAG, "setDynamicProfile()");
329
+ Log.i(TAG, "setDynamicProfile() - profile: " + profile);
320
330
  if (profile != null) {
321
331
  HashMap<String, Object> profileMap = new HashMap<>(ConversionUtil.toMap(profile));
332
+ Log.d(TAG, "setDynamicProfile() - profileMap: " + profileMap);
322
333
  Sodyo.setDynamicProfile(profileMap);
334
+ } else {
335
+ Log.w(TAG, "setDynamicProfile() - profile is null, skipping");
323
336
  }
324
337
  }
325
338
 
326
339
  @ReactMethod
327
340
  public void setDynamicProfileValue(String key, String value) {
328
- Log.i(TAG, "setDynamicProfileValue()");
341
+ Log.i(TAG, "setDynamicProfileValue() - key: " + key + ", value: " + value);
329
342
  Sodyo.setDynamicProfileValue(key, value);
330
343
  }
331
344
 
332
345
  @ReactMethod
333
346
  public void performMarker(String markerId, ReadableMap customProperties) {
334
- Log.i(TAG, "performMarker()");
347
+ Log.i(TAG, "performMarker() - markerId: " + markerId + ", customProperties: " + customProperties);
335
348
  Activity activity = getCurrentActivity();
349
+ Log.d(TAG, "performMarker() - currentActivity: " + activity);
336
350
  if (activity == null) {
337
- Log.e(TAG, "performMarker(): current activity is null");
351
+ Log.e(TAG, "performMarker(): current activity is null, aborting");
338
352
  return;
339
353
  }
340
- Sodyo.performMarker(markerId, activity, ConversionUtil.toMap(customProperties));
354
+ Map<String, Object> propsMap = ConversionUtil.toMap(customProperties);
355
+ Log.d(TAG, "performMarker() - converted customProperties: " + propsMap);
356
+ Sodyo.performMarker(markerId, activity, propsMap);
341
357
  }
342
358
 
343
359
  @ReactMethod
344
360
  public void startTroubleshoot() {
345
361
  Log.i(TAG, "startTroubleshoot()");
346
362
  Activity activity = getCurrentActivity();
363
+ Log.d(TAG, "startTroubleshoot() - currentActivity: " + activity);
347
364
  if (activity == null) {
348
- Log.e(TAG, "startTroubleshoot(): current activity is null");
365
+ Log.e(TAG, "startTroubleshoot(): current activity is null, aborting");
349
366
  return;
350
367
  }
351
368
  Sodyo.startTroubleshoot(activity);
@@ -355,10 +372,12 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
355
372
  public void setTroubleshootMode() {
356
373
  Log.i(TAG, "setTroubleshootMode()");
357
374
  Activity activity = getCurrentActivity();
375
+ Log.d(TAG, "setTroubleshootMode() - currentActivity: " + activity);
358
376
  if (activity == null) {
359
- Log.e(TAG, "setTroubleshootMode(): current activity is null");
377
+ Log.e(TAG, "setTroubleshootMode(): current activity is null, aborting");
360
378
  return;
361
379
  }
380
+ Log.d(TAG, "setTroubleshootMode() - setting mode to Troubleshoot");
362
381
  Sodyo.setMode(activity, SettingsHelper.ScannerViewMode.Troubleshoot);
363
382
  }
364
383
 
@@ -366,31 +385,35 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
366
385
  public void setNormalMode() {
367
386
  Log.i(TAG, "setNormalMode()");
368
387
  Activity activity = getCurrentActivity();
388
+ Log.d(TAG, "setNormalMode() - currentActivity: " + activity);
369
389
  if (activity == null) {
370
- Log.e(TAG, "setNormalMode(): current activity is null");
390
+ Log.e(TAG, "setNormalMode(): current activity is null, aborting");
371
391
  return;
372
392
  }
393
+ Log.d(TAG, "setNormalMode() - setting mode to Normal");
373
394
  Sodyo.setMode(activity, SettingsHelper.ScannerViewMode.Normal);
374
395
  }
375
396
 
376
397
  @ReactMethod(isBlockingSynchronousMethod = true)
377
398
  public String getMode() {
378
- return Sodyo.getMode().name();
399
+ String mode = Sodyo.getMode().name();
400
+ Log.i(TAG, "getMode() - mode: " + mode);
401
+ return mode;
379
402
  }
380
403
 
381
404
  @ReactMethod
382
405
  public void setSodyoLogoVisible(Boolean isVisible) {
383
- Log.i(TAG, "setSodyoLogoVisible()");
406
+ Log.i(TAG, "setSodyoLogoVisible() - isVisible: " + isVisible);
384
407
  Sodyo.setSodyoLogoVisible(isVisible);
385
408
  }
386
409
 
387
410
  // Issue #2 fix: validate env input, Issue #10 fix: public instead of private
388
411
  @ReactMethod
389
412
  public void setEnv(String env) {
390
- Log.i(TAG, "setEnv:" + env);
413
+ Log.i(TAG, "setEnv() - env: " + env);
391
414
 
392
415
  if (env == null) {
393
- Log.e(TAG, "setEnv: env is null");
416
+ Log.e(TAG, "setEnv(): env is null, aborting");
394
417
  return;
395
418
  }
396
419
 
@@ -399,15 +422,18 @@ public class RNSodyoSdkModule extends ReactContextBaseJavaModule {
399
422
  Map<String, String> params = new HashMap<>();
400
423
  params.put("webad_env", String.valueOf(sodyoEnv.getValue()));
401
424
  params.put("scanner_QR_code_enabled", "false");
425
+ Log.d(TAG, "setEnv() - resolved sodyoEnv: " + sodyoEnv + " (value: " + sodyoEnv.getValue() + "), params: " + params);
402
426
  Sodyo.setScannerParams(params);
403
427
  } catch (IllegalArgumentException e) {
404
- Log.e(TAG, "setEnv: unknown env '" + env + "', expected DEV/QA/PROD");
428
+ Log.e(TAG, "setEnv(): unknown env '" + env + "', expected DEV/QA/PROD", e);
405
429
  }
406
430
  }
407
431
 
408
432
  // Issue #12 fix: check for active React instance before sending events
409
433
  private void sendEvent(String eventName, @Nullable WritableMap params) {
434
+ Log.d(TAG, "sendEvent() - eventName: " + eventName + ", params: " + params);
410
435
  if (!reactContext.hasActiveReactInstance()) {
436
+ Log.w(TAG, "sendEvent() - no active React instance, dropping event: " + eventName);
411
437
  return;
412
438
  }
413
439
  reactContext
package/ios/RNSodyoSdk.m CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  #import "RNSodyoSdk.h"
3
2
  #import "RNSodyoScanner.h"
4
3
 
@@ -16,7 +15,7 @@ RCT_EXPORT_METHOD(
16
15
  errorCallback:(RCTResponseSenderBlock)errorCallback
17
16
  )
18
17
  {
19
- RCTLogInfo(@"SodyoSDK: init()");
18
+ RCTLogInfo(@"SodyoSDK: init() - apiKey: %@, successCallback: %@, errorCallback: %@", apiKey, successCallback ? @"provided" : @"nil", errorCallback ? @"provided" : @"nil");
20
19
 
21
20
  self.successStartCallback = successCallback;
22
21
  self.errorStartCallback = errorCallback;
@@ -25,9 +24,10 @@ RCT_EXPORT_METHOD(
25
24
 
26
25
  RCT_EXPORT_METHOD(createCloseContentListener)
27
26
  {
28
- RCTLogInfo(@"SodyoSDK: createCloseContentListener()");
27
+ RCTLogInfo(@"SodyoSDK: createCloseContentListener() - isCloseContentObserverExist: %@", self.isCloseContentObserverExist ? @"YES" : @"NO");
29
28
 
30
29
  if (self.isCloseContentObserverExist) {
30
+ NSLog(@"SodyoSDK: createCloseContentListener - observer already exists, skipping");
31
31
  return;
32
32
  }
33
33
 
@@ -42,92 +42,96 @@ RCT_EXPORT_METHOD(createCloseContentListener)
42
42
 
43
43
  RCT_EXPORT_METHOD(start)
44
44
  {
45
- NSLog(@"start");
45
+ NSLog(@"SodyoSDK: start - launching scanner");
46
46
  [self launchSodyoScanner];
47
47
  }
48
48
 
49
49
  RCT_EXPORT_METHOD(close)
50
50
  {
51
- NSLog(@"close");
51
+ NSLog(@"SodyoSDK: close - closing scanner");
52
52
  [self closeScanner];
53
53
  }
54
54
 
55
55
  RCT_EXPORT_METHOD(setCustomAdLabel:(NSString *)labels)
56
56
  {
57
- NSLog(@"setCustomAdLabel");
57
+ NSLog(@"SodyoSDK: setCustomAdLabel - labels: %@", labels);
58
58
  [SodyoSDK setCustomAdLabel:labels];
59
59
  }
60
60
 
61
61
  RCT_EXPORT_METHOD(setAppUserId:(NSString *)userId)
62
62
  {
63
- NSLog(@"setAppUserId");
63
+ NSLog(@"SodyoSDK: setAppUserId - userId: %@", userId);
64
64
  [SodyoSDK setUserId:userId];
65
65
  }
66
66
 
67
67
  RCT_EXPORT_METHOD(setUserInfo:(NSDictionary *) userInfo)
68
68
  {
69
- NSLog(@"setUserInfo");
69
+ NSLog(@"SodyoSDK: setUserInfo - userInfo: %@", userInfo);
70
70
  [SodyoSDK setUserInfo:userInfo];
71
71
  }
72
72
 
73
73
  RCT_EXPORT_METHOD(setScannerParams:(NSDictionary *) params)
74
74
  {
75
- NSLog(@"setScannerParams");
75
+ NSLog(@"SodyoSDK: setScannerParams - params: %@", params);
76
76
  [SodyoSDK setScannerParams:params];
77
77
  }
78
78
 
79
79
  RCT_EXPORT_METHOD(addScannerParam:(NSString *) key value:(NSString *) value)
80
80
  {
81
- NSLog(@"addScannerParam");
81
+ NSLog(@"SodyoSDK: addScannerParam - key: %@, value: %@", key, value);
82
82
  [SodyoSDK addScannerParams:key value:value];
83
83
  }
84
84
 
85
85
  RCT_EXPORT_METHOD(setDynamicProfile:(NSDictionary *) profile)
86
86
  {
87
- NSLog(@"setDynamicProfile");
87
+ NSLog(@"SodyoSDK: setDynamicProfile - profile: %@", profile);
88
88
  [SodyoSDK setDynamicProfile:profile];
89
89
  }
90
90
 
91
91
  RCT_EXPORT_METHOD(setDynamicProfileValue:(NSString *) key value:(NSString *) value)
92
92
  {
93
- NSLog(@"setDynamicProfileValue");
93
+ NSLog(@"SodyoSDK: setDynamicProfileValue - key: %@, value: %@", key, value);
94
94
  [SodyoSDK setDynamicProfileValue:key value:value];
95
95
  }
96
96
 
97
97
  RCT_EXPORT_METHOD(performMarker:(NSString *) markerId customProperties:(NSDictionary *) customProperties)
98
98
  {
99
- NSLog(@"performMarker");
99
+ NSLog(@"SodyoSDK: performMarker - markerId: %@, customProperties: %@", markerId, customProperties);
100
100
  UIViewController *rootViewController = [self getRootViewController];
101
+ NSLog(@"SodyoSDK: performMarker - rootViewController: %@", rootViewController);
101
102
  [SodyoSDK setPresentingViewController:rootViewController];
102
103
  [SodyoSDK performMarker:markerId customProperties:customProperties];
103
104
  }
104
105
 
105
106
  RCT_EXPORT_METHOD(startTroubleshoot)
106
107
  {
107
- NSLog(@"startTroubleshoot");
108
+ NSLog(@"SodyoSDK: startTroubleshoot");
108
109
  UIViewController *scanner = [RNSodyoScanner getSodyoScanner];
110
+ NSLog(@"SodyoSDK: startTroubleshoot - scanner: %@", scanner);
109
111
  [SodyoSDK startTroubleshoot:scanner];
110
112
  }
111
113
 
112
114
 
113
115
  RCT_EXPORT_METHOD(setTroubleshootMode)
114
116
  {
115
- NSLog(@"setTroubleshootMode");
117
+ NSLog(@"SodyoSDK: setTroubleshootMode");
116
118
  UIViewController *scanner = [RNSodyoScanner getSodyoScanner];
119
+ NSLog(@"SodyoSDK: setTroubleshootMode - scanner: %@", scanner);
117
120
  [SodyoSDK setMode:scanner mode:SodyoModeTroubleshoot];
118
121
  }
119
122
 
120
123
  RCT_EXPORT_METHOD(setNormalMode)
121
124
  {
122
- NSLog(@"setNormalMode");
125
+ NSLog(@"SodyoSDK: setNormalMode");
123
126
  UIViewController *scanner = [RNSodyoScanner getSodyoScanner];
127
+ NSLog(@"SodyoSDK: setNormalMode - scanner: %@", scanner);
124
128
  [SodyoSDK setMode:scanner mode:SodyoModeNormal];
125
129
  }
126
130
 
127
131
  // Issue #3 fix: BOOL instead of BOOL*
128
132
  RCT_EXPORT_METHOD(setSodyoLogoVisible:(BOOL) isVisible)
129
133
  {
130
- NSLog(@"setSodyoLogoVisible");
134
+ NSLog(@"SodyoSDK: setSodyoLogoVisible - isVisible: %@", isVisible ? @"YES" : @"NO");
131
135
  if (isVisible) {
132
136
  return [SodyoSDK showDefaultOverlay];
133
137
  }
@@ -138,15 +142,16 @@ RCT_EXPORT_METHOD(setSodyoLogoVisible:(BOOL) isVisible)
138
142
  // Issue #8 fix: guard against nil env value
139
143
  RCT_EXPORT_METHOD(setEnv:(NSString *) env)
140
144
  {
141
- NSLog(@"setEnv");
145
+ NSLog(@"SodyoSDK: setEnv - env: %@", env);
142
146
 
143
147
  NSDictionary *envs = @{ @"DEV": @"3", @"QA": @"1", @"PROD": @"0" };
144
148
  NSString *envValue = envs[env];
145
149
  if (!envValue) {
146
- NSLog(@"RNSodyoSdk: Unknown env '%@', defaulting to PROD", env);
150
+ NSLog(@"SodyoSDK: setEnv - Unknown env '%@', defaulting to PROD", env);
147
151
  envValue = @"0";
148
152
  }
149
153
  NSDictionary *params = @{ @"SodyoAdEnv": envValue, @"ScanQR": @"false" };
154
+ NSLog(@"SodyoSDK: setEnv - resolved params: %@", params);
150
155
  [SodyoSDK setScannerParams:params];
151
156
  }
152
157
 
@@ -157,37 +162,41 @@ RCT_EXPORT_METHOD(setEnv:(NSString *) env)
157
162
 
158
163
  // Issue #2 fix: inverted null-check + use shared scanner accessor
159
164
  - (void) launchSodyoScanner {
160
- NSLog(@"launchSodyoScanner");
165
+ NSLog(@"SodyoSDK: launchSodyoScanner");
161
166
  UIViewController *scanner = [RNSodyoScanner getSodyoScanner];
167
+ NSLog(@"SodyoSDK: launchSodyoScanner - scanner: %@", scanner);
162
168
 
163
169
  if (!scanner) {
164
- NSLog(@"Sodyo scanner not initialized");
170
+ NSLog(@"SodyoSDK: launchSodyoScanner - scanner not initialized, aborting");
165
171
  return;
166
172
  }
167
173
 
168
174
  if (scanner.isViewLoaded && scanner.view.window) {
169
- NSLog(@"Sodyo scanner already active");
175
+ NSLog(@"SodyoSDK: launchSodyoScanner - scanner already active (isViewLoaded: %@, window: %@)", scanner.isViewLoaded ? @"YES" : @"NO", scanner.view.window);
170
176
  return;
171
177
  }
172
178
 
173
179
  UIViewController *rootViewController = [self getRootViewController];
180
+ NSLog(@"SodyoSDK: launchSodyoScanner - rootViewController: %@", rootViewController);
174
181
  scanner.modalPresentationStyle = UIModalPresentationFullScreen;
175
182
  [SodyoSDK setPresentingViewController:rootViewController];
176
183
  [rootViewController presentViewController:scanner animated:YES completion:nil];
177
184
  }
178
185
 
179
186
  - (void) closeScanner {
180
- NSLog(@"closeScanner");
187
+ NSLog(@"SodyoSDK: closeScanner");
181
188
  UIViewController *rootViewController = [self getRootViewController];
189
+ NSLog(@"SodyoSDK: closeScanner - rootViewController: %@", rootViewController);
182
190
  [rootViewController dismissViewControllerAnimated:YES completion:nil];
183
191
  }
184
192
 
185
193
  - (void) sendCloseContentEvent {
186
- NSLog(@"sendCloseContentEvent");
194
+ NSLog(@"SodyoSDK: sendCloseContentEvent - sending EventCloseSodyoContent");
187
195
  [self sendEventWithName:@"EventCloseSodyoContent" body:nil];
188
196
  }
189
197
 
190
198
  - (NSString *) convertScannerModeToString:(SodyoMode)mode {
199
+ NSLog(@"SodyoSDK: convertScannerModeToString - mode: %ld", (long)mode);
191
200
  switch (mode) {
192
201
  case SodyoModeTroubleshoot:
193
202
  return @"Troubleshoot";
@@ -223,7 +232,7 @@ RCT_EXPORT_METHOD(setEnv:(NSString *) env)
223
232
  #pragma mark - SodyoSDKDelegate
224
233
  // Issue #5 fix: nil both callbacks after either fires
225
234
  - (void) onSodyoAppLoadSuccess:(NSInteger)AppID {
226
- NSLog(@"onSodyoAppLoadSuccess");
235
+ NSLog(@"SodyoSDK: onSodyoAppLoadSuccess - AppID: %ld, successCallback: %@", (long)AppID, self.successStartCallback ? @"provided" : @"nil");
227
236
 
228
237
  if (self.successStartCallback != nil) {
229
238
  self.successStartCallback(@[[NSNull null]]);
@@ -234,7 +243,7 @@ RCT_EXPORT_METHOD(setEnv:(NSString *) env)
234
243
 
235
244
  // Issue #6 fix: serialize NSError to string
236
245
  - (void) onSodyoAppLoadFailed:(NSInteger)AppID error:(NSError *)error {
237
- NSLog(@"Failed loading Sodyo: %@", error);
246
+ NSLog(@"SodyoSDK: onSodyoAppLoadFailed - AppID: %ld, error: %@, errorCode: %ld, errorDomain: %@", (long)AppID, error.localizedDescription, (long)error.code, error.domain);
238
247
  if (self.errorStartCallback != nil) {
239
248
  NSString *message = error.localizedDescription ?: @"Unknown error";
240
249
  self.errorStartCallback(@[@{@"error": message}]);
@@ -247,29 +256,29 @@ RCT_EXPORT_METHOD(setEnv:(NSString *) env)
247
256
  - (void) sodyoError:(NSError *)error {
248
257
  dispatch_async(dispatch_get_main_queue(), ^{
249
258
  NSString *desc = error.localizedDescription ?: @"Unknown error";
250
- NSLog(@"sodyoError: %@", desc);
259
+ NSLog(@"SodyoSDK: sodyoError - description: %@, code: %ld, domain: %@, userInfo: %@", desc, (long)error.code, error.domain, error.userInfo);
251
260
  [self sendEventWithName:@"EventSodyoError" body:@{@"error": desc}];
252
261
  });
253
262
  }
254
263
 
255
264
  // Issue #9 fix: guard against nil marker data
256
265
  - (void) SodyoMarkerDetectedWithData:(NSDictionary*)Data {
257
- NSLog(@"SodyoMarkerDetectedWithData: %@", Data[@"sodyoMarkerData"]);
266
+ NSLog(@"SodyoSDK: SodyoMarkerDetectedWithData - fullData: %@, sodyoMarkerData: %@", Data, Data[@"sodyoMarkerData"]);
258
267
  id markerData = Data[@"sodyoMarkerData"] ?: [NSNull null];
259
268
  [self sendEventWithName:@"EventMarkerDetectSuccess" body:@{@"data": markerData}];
260
269
  }
261
270
 
262
271
  - (void) SodyoMarkerContent:(NSString *)markerId Data:(NSDictionary *)Data {
263
- NSLog(@"SodyoMarkerContent: %@", Data);
272
+ NSLog(@"SodyoSDK: SodyoMarkerContent - markerId: %@, Data: %@", markerId, Data);
264
273
  id data = Data ?: @{};
265
274
  [self sendEventWithName:@"EventMarkerContent" body:@{@"markerId": markerId ?: @"", @"data": data}];
266
275
  }
267
276
 
268
277
 
269
278
  - (void) onModeChange:(SodyoMode)from to:(SodyoMode)to {
270
- NSLog(@"onModeChange");
271
279
  NSString* fromConverted = [self convertScannerModeToString:from];
272
280
  NSString* toConverted = [self convertScannerModeToString:to];
281
+ NSLog(@"SodyoSDK: onModeChange - from: %@ (%ld) to: %@ (%ld)", fromConverted, (long)from, toConverted, (long)to);
273
282
 
274
283
  [self sendEventWithName:@"ModeChangeCallback" body:@{@"oldMode": fromConverted, @"newMode": toConverted}];
275
284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sodyo/react-native-sodyo-sdk",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "RNSodyoSdk",
5
5
  "main": "sodyosdk.js",
6
6
  "typings": "./sodyosdk.d.ts",