feat: Update profile saving logic to follow desktop version pattern and enhance local data handling
This commit is contained in:
@@ -439,10 +439,11 @@ fun MainScreen(
|
||||
val privateKeyHash = account?.privateKeyHash ?: ""
|
||||
|
||||
// Username state - загружается из EncryptedAccount
|
||||
// Following desktop version pattern: username is stored locally and loaded on app start
|
||||
var accountUsername by remember { mutableStateOf("") }
|
||||
var reloadTrigger by remember { mutableIntStateOf(0) }
|
||||
|
||||
// Load username from AccountManager
|
||||
// Load username from AccountManager (persisted in DataStore)
|
||||
val context = LocalContext.current
|
||||
LaunchedEffect(accountPublicKey, reloadTrigger) {
|
||||
if (accountPublicKey.isNotBlank() && accountPublicKey != "04c266b98ae5") {
|
||||
@@ -706,7 +707,10 @@ fun MainScreen(
|
||||
accountPrivateKeyHash = privateKeyHash,
|
||||
onBack = { showProfileScreen = false },
|
||||
onSaveProfile = { name, username ->
|
||||
// Update username state and trigger reload from DB
|
||||
// Following desktop version pattern:
|
||||
// 1. Server confirms save (handled in ProfileViewModel)
|
||||
// 2. Local DB updated (handled in ProfileScreen LaunchedEffect)
|
||||
// 3. This callback updates UI state (reloads username from DB)
|
||||
accountUsername = username
|
||||
reloadTrigger++
|
||||
Log.d("MainActivity", "Profile saved: name=$name, username=$username, reloading...")
|
||||
|
||||
Reference in New Issue
Block a user