feat: Update account creation flow to return DecryptedAccount and configure kapt for Room

This commit is contained in:
k1ngsterr1
2026-01-11 16:44:58 +05:00
parent 70ed7fbc6e
commit 161a4fe61b
3 changed files with 15 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
plugins { plugins {
id("com.android.application") id("com.android.application")
id("org.jetbrains.kotlin.android") id("org.jetbrains.kotlin.android")
id("kotlin-kapt")
} }
android { android {
@@ -79,7 +80,7 @@ dependencies {
// Room for database // Room for database
implementation("androidx.room:room-runtime:2.6.1") implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1") implementation("androidx.room:room-ktx:2.6.1")
annotationProcessor("androidx.room:room-compiler:2.6.1") kapt("androidx.room:room-compiler:2.6.1")
// Biometric authentication // Biometric authentication
implementation("androidx.biometric:biometric:1.1.0") implementation("androidx.biometric:biometric:1.1.0")

View File

@@ -130,7 +130,7 @@ fun AuthFlow(
currentScreen = AuthScreen.CONFIRM_SEED currentScreen = AuthScreen.CONFIRM_SEED
} }
}, },
onAccountCreated = { onAuthComplete(null) } onAccountCreated = { account -> onAuthComplete(account) }
) )
} }

View File

@@ -27,6 +27,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.rosetta.messenger.crypto.CryptoManager import com.rosetta.messenger.crypto.CryptoManager
import com.rosetta.messenger.data.AccountManager import com.rosetta.messenger.data.AccountManager
import com.rosetta.messenger.data.DecryptedAccount
import com.rosetta.messenger.data.EncryptedAccount import com.rosetta.messenger.data.EncryptedAccount
import com.rosetta.messenger.network.ProtocolManager import com.rosetta.messenger.network.ProtocolManager
import com.rosetta.messenger.ui.onboarding.PrimaryBlue import com.rosetta.messenger.ui.onboarding.PrimaryBlue
@@ -38,7 +39,7 @@ fun SetPasswordScreen(
seedPhrase: List<String>, seedPhrase: List<String>,
isDarkTheme: Boolean, isDarkTheme: Boolean,
onBack: () -> Unit, onBack: () -> Unit,
onAccountCreated: () -> Unit onAccountCreated: (DecryptedAccount) -> Unit
) { ) {
val themeAnimSpec = tween<Color>(durationMillis = 500, easing = CubicBezierEasing(0.4f, 0f, 0.2f, 1f)) val themeAnimSpec = tween<Color>(durationMillis = 500, easing = CubicBezierEasing(0.4f, 0f, 0.2f, 1f))
val backgroundColor by animateColorAsState(if (isDarkTheme) AuthBackground else AuthBackgroundLight, animationSpec = themeAnimSpec) val backgroundColor by animateColorAsState(if (isDarkTheme) AuthBackground else AuthBackgroundLight, animationSpec = themeAnimSpec)
@@ -502,7 +503,16 @@ fun SetPasswordScreen(
kotlinx.coroutines.delay(500) kotlinx.coroutines.delay(500)
ProtocolManager.authenticate(keyPair.publicKey, privateKeyHash) ProtocolManager.authenticate(keyPair.publicKey, privateKeyHash)
onAccountCreated() // Create DecryptedAccount to pass to callback
val decryptedAccount = DecryptedAccount(
publicKey = keyPair.publicKey,
privateKey = keyPair.privateKey,
seedPhrase = seedPhrase,
privateKeyHash = privateKeyHash,
name = truncatedKey
)
onAccountCreated(decryptedAccount)
} catch (e: Exception) { } catch (e: Exception) {
error = "Failed to create account: ${e.message}" error = "Failed to create account: ${e.message}"
isCreating = false isCreating = false