feat: Fix WebSocket connection issues after account registration by ensuring connection before authentication
This commit is contained in:
@@ -497,6 +497,9 @@ fun SetPasswordScreen(
|
||||
// 🔌 Connect to server and authenticate
|
||||
val privateKeyHash = CryptoManager.generatePrivateKeyHash(keyPair.privateKey)
|
||||
Log.d("SetPasswordScreen", "🔌 Connecting to server...")
|
||||
ProtocolManager.connect()
|
||||
// Give WebSocket time to connect before authenticating
|
||||
kotlinx.coroutines.delay(500)
|
||||
ProtocolManager.authenticate(keyPair.publicKey, privateKeyHash)
|
||||
|
||||
onAccountCreated()
|
||||
|
||||
@@ -581,6 +581,9 @@ fun UnlockScreen(
|
||||
|
||||
// Connect to server and authenticate
|
||||
Log.d("UnlockScreen", "Connecting to server...")
|
||||
ProtocolManager.connect()
|
||||
// Give WebSocket time to connect before authenticating
|
||||
kotlinx.coroutines.delay(500)
|
||||
ProtocolManager.authenticate(account.publicKey, privateKeyHash)
|
||||
|
||||
accountManager.setCurrentAccount(account.publicKey)
|
||||
|
||||
Reference in New Issue
Block a user