@bits-innovate/react-native-vstarcam 1.0.21 → 1.0.23

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.
@@ -48,6 +48,16 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
48
48
  private static final String TAG = "VStarCamModule";
49
49
  private static final String MODULE_NAME = "VStarCam";
50
50
 
51
+ // Set to true for verbose logging during development
52
+ private static final boolean DEBUG_LOGGING = false;
53
+
54
+ // Helper for conditional debug logging
55
+ private static void logDebug(String message) {
56
+ if (DEBUG_LOGGING) {
57
+ Log.d(TAG, message);
58
+ }
59
+ }
60
+
51
61
  // P2P Server parameters by DID prefix (from Flutter SDK)
52
62
  private static final Map<String, String> SERVICE_PARAM_MAP = new HashMap<String, String>() {{
53
63
  put("VSTC", "EBGBEMBMKGJMGAJPEIGIFKEGHBMCHMNFGKEGBFCBBMJELILDCJADCIOLHHLLJBKEAMMBLCDGONMDBJCJJPNFJP");
@@ -554,23 +564,32 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
554
564
 
555
565
  Log.d(TAG, "Calling JNIApi.login(" + clientInfo.sdkClientPtr + ", " + username + ", ***)");
556
566
 
567
+ boolean loginSuccess = false;
557
568
  try {
558
569
  loginMethod.invoke(null, clientInfo.sdkClientPtr, username, password);
559
570
  Log.d(TAG, "JNIApi.login returned normally");
571
+ loginSuccess = true;
560
572
  } catch (java.lang.reflect.InvocationTargetException ite) {
561
- Log.e(TAG, "JNIApi.login threw exception: " + ite.getCause(), ite.getCause());
562
- throw ite;
573
+ Throwable cause = ite.getCause();
574
+ Log.e(TAG, "JNIApi.login threw exception: " + cause, cause);
575
+ // Don't rethrow - return false instead to prevent crash
576
+ promise.resolve(false);
577
+ return;
563
578
  } catch (Throwable t) {
564
579
  Log.e(TAG, "JNIApi.login crashed: " + t.getMessage(), t);
565
- throw t;
580
+ // Don't rethrow - return false instead to prevent crash
581
+ promise.resolve(false);
582
+ return;
566
583
  }
567
584
 
568
- clientInfo.isLoggedIn = true;
569
- clientInfo.username = username;
570
- clientInfo.password = password;
571
- Log.d(TAG, "JNIApi.login called successfully");
585
+ if (loginSuccess) {
586
+ clientInfo.isLoggedIn = true;
587
+ clientInfo.username = username;
588
+ clientInfo.password = password;
589
+ }
572
590
 
573
- promise.resolve(true);
591
+ Log.d(TAG, "JNIApi.login completed with result: " + loginSuccess);
592
+ promise.resolve(loginSuccess);
574
593
  } catch (Exception e) {
575
594
  Log.e(TAG, "clientLogin failed", e);
576
595
  promise.reject("LOGIN_ERROR", e.getMessage());
@@ -835,7 +854,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
835
854
  @ReactMethod
836
855
  public void getSdkVersion(Promise promise) {
837
856
  WritableMap result = Arguments.createMap();
838
- result.putString("version", "1.0.21");
857
+ result.putString("version", "1.0.22");
839
858
  result.putBoolean("nativeLoaded", isNativeLibraryLoaded);
840
859
  result.putString("nativeLib", "OKSMARTPPCS");
841
860
  result.putBoolean("p2pInitialized", isP2PInitialized);
@@ -20,6 +20,15 @@ public class VStarCamVideoView extends FrameLayout
20
20
  implements TextureView.SurfaceTextureListener {
21
21
 
22
22
  private static final String TAG = "VStarCamVideoView";
23
+
24
+ // Set to true for verbose logging during development
25
+ private static final boolean DEBUG_LOGGING = false;
26
+
27
+ private static void logDebug(String message) {
28
+ if (DEBUG_LOGGING) {
29
+ Log.d(TAG, message);
30
+ }
31
+ }
23
32
 
24
33
  private TextureView textureView;
25
34
  private TextView statusView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bits-innovate/react-native-vstarcam",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "React Native bridge for VStarCam P2P SDK",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",