@bits-innovate/react-native-vstarcam 1.0.22 → 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.
|
@@ -564,23 +564,32 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
564
564
|
|
|
565
565
|
Log.d(TAG, "Calling JNIApi.login(" + clientInfo.sdkClientPtr + ", " + username + ", ***)");
|
|
566
566
|
|
|
567
|
+
boolean loginSuccess = false;
|
|
567
568
|
try {
|
|
568
569
|
loginMethod.invoke(null, clientInfo.sdkClientPtr, username, password);
|
|
569
570
|
Log.d(TAG, "JNIApi.login returned normally");
|
|
571
|
+
loginSuccess = true;
|
|
570
572
|
} catch (java.lang.reflect.InvocationTargetException ite) {
|
|
571
|
-
|
|
572
|
-
|
|
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;
|
|
573
578
|
} catch (Throwable t) {
|
|
574
579
|
Log.e(TAG, "JNIApi.login crashed: " + t.getMessage(), t);
|
|
575
|
-
|
|
580
|
+
// Don't rethrow - return false instead to prevent crash
|
|
581
|
+
promise.resolve(false);
|
|
582
|
+
return;
|
|
576
583
|
}
|
|
577
584
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
585
|
+
if (loginSuccess) {
|
|
586
|
+
clientInfo.isLoggedIn = true;
|
|
587
|
+
clientInfo.username = username;
|
|
588
|
+
clientInfo.password = password;
|
|
589
|
+
}
|
|
582
590
|
|
|
583
|
-
|
|
591
|
+
Log.d(TAG, "JNIApi.login completed with result: " + loginSuccess);
|
|
592
|
+
promise.resolve(loginSuccess);
|
|
584
593
|
} catch (Exception e) {
|
|
585
594
|
Log.e(TAG, "clientLogin failed", e);
|
|
586
595
|
promise.reject("LOGIN_ERROR", e.getMessage());
|