feat: Add Profile Logs Screen and integrate logging functionality

- Introduced ProfileLogsScreen for displaying logs related to profile operations.
- Enhanced MainScreen to include navigation to the new logs screen.
- Updated ProfileViewModel to manage logs and handle profile save operations.
- Implemented back navigation and log clearing functionality in ProfileLogsScreen.
- Improved SafetyScreen and ThemeScreen with back gesture handling.
- Refactored BackupScreen and OtherProfileScreen for consistency and better UX.
- Adjusted UI elements for better visibility and interaction feedback.
This commit is contained in:
k1ngsterr1
2026-01-20 23:42:02 +05:00
parent 9edcb712fc
commit db61ebb79f
10 changed files with 714 additions and 168 deletions

View File

@@ -452,6 +452,11 @@ fun MainScreen(
var showThemeScreen by remember { mutableStateOf(false) }
var showSafetyScreen by remember { mutableStateOf(false) }
var showBackupScreen by remember { mutableStateOf(false) }
var showLogsScreen by remember { mutableStateOf(false) }
// ProfileViewModel для логов
val profileViewModel: com.rosetta.messenger.ui.settings.ProfileViewModel = androidx.lifecycle.viewmodel.compose.viewModel()
val profileState by profileViewModel.state.collectAsState()
// 🔥 Простая навигация с fade-in анимацией
Box(modifier = Modifier.fillMaxSize()) {
@@ -459,7 +464,7 @@ fun MainScreen(
androidx.compose.animation.AnimatedVisibility(
visible = !showBackupScreen && !showSafetyScreen && !showThemeScreen &&
!showUpdatesScreen && selectedUser == null && !showSearchScreen &&
!showProfileScreen && !showOtherProfileScreen,
!showProfileScreen && !showOtherProfileScreen && !showLogsScreen,
enter = fadeIn(animationSpec = tween(300)),
exit = fadeOut(animationSpec = tween(200))
) {
@@ -516,7 +521,10 @@ fun MainScreen(
if (showBackupScreen) {
BackupScreen(
isDarkTheme = isDarkTheme,
onBack = { showBackupScreen = false },
onBack = {
showBackupScreen = false
showSafetyScreen = true
},
onVerifyPassword = { password ->
// TODO: Implement password verification
if (password == "test") {
@@ -536,8 +544,15 @@ fun MainScreen(
SafetyScreen(
isDarkTheme = isDarkTheme,
accountPublicKey = accountPublicKey,
onBack = { showSafetyScreen = false },
onBackupClick = { showBackupScreen = true },
accountPrivateKey = accountPrivateKey,
onBack = {
showSafetyScreen = false
showProfileScreen = true
},
onBackupClick = {
showSafetyScreen = false
showBackupScreen = true
},
onDeleteAccount = {
// TODO: Implement account deletion
Log.d("MainActivity", "Delete account requested")
@@ -554,7 +569,10 @@ fun MainScreen(
if (showThemeScreen) {
ThemeScreen(
isDarkTheme = isDarkTheme,
onBack = { showThemeScreen = false },
onBack = {
showThemeScreen = false
showProfileScreen = true
},
onThemeChange = { isDark ->
onToggleTheme()
}
@@ -644,10 +662,11 @@ fun MainScreen(
accountName = accountName,
accountUsername = "", // TODO: Get from account
accountPublicKey = accountPublicKey,
accountPrivateKeyHash = privateKeyHash,
onBack = { showProfileScreen = false },
onSaveProfile = { name, username ->
// TODO: Save profile changes
Log.d("MainActivity", "Saving profile: name=$name, username=$username")
// Profile saved via ViewModel
Log.d("MainActivity", "Profile saved: name=$name, username=$username")
},
onLogout = onLogout,
onNavigateToTheme = {
@@ -657,7 +676,32 @@ fun MainScreen(
onNavigateToSafety = {
showProfileScreen = false
showSafetyScreen = true
}
},
onNavigateToLogs = {
showProfileScreen = false
showLogsScreen = true
},
viewModel = profileViewModel
)
}
}
androidx.compose.animation.AnimatedVisibility(
visible = showLogsScreen,
enter = fadeIn(animationSpec = tween(300)),
exit = fadeOut(animationSpec = tween(200))
) {
if (showLogsScreen) {
com.rosetta.messenger.ui.settings.ProfileLogsScreen(
isDarkTheme = isDarkTheme,
logs = profileState.logs,
onBack = {
showLogsScreen = false
showProfileScreen = true
},
onClearLogs = {
profileViewModel.clearLogs()
}
)
}
}