Refactor ChatsListScreen: Remove FCM logs dialog and related functionality
- Eliminated the FCM logs dialog and its associated state management. - Removed FCM logs display logic from the UI. - Updated drawer menu by removing FCM Token Logs option and other unused items. - Changed icon for Saved Messages from Outlined to Default.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -235,9 +235,6 @@ fun ChatsListScreen(
|
|||||||
var showStatusDialog by remember { mutableStateOf(false) }
|
var showStatusDialog by remember { mutableStateOf(false) }
|
||||||
val debugLogs by ProtocolManager.debugLogs.collectAsState()
|
val debugLogs by ProtocolManager.debugLogs.collectAsState()
|
||||||
|
|
||||||
// 📱 FCM токен диалог
|
|
||||||
var showFcmDialog by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
// 📬 Requests screen state
|
// 📬 Requests screen state
|
||||||
var showRequestsScreen by remember { mutableStateOf(false) }
|
var showRequestsScreen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
@@ -356,88 +353,6 @@ fun ChatsListScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FCM Logs dialog
|
|
||||||
if (showFcmDialog) {
|
|
||||||
val fcmLogs = com.rosetta.messenger.MainActivity.fcmLogs
|
|
||||||
AlertDialog(
|
|
||||||
onDismissRequest = { showFcmDialog = false },
|
|
||||||
title = {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
"🔔 FCM Token Logs",
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
color = textColor
|
|
||||||
)
|
|
||||||
if (fcmLogs.isNotEmpty()) {
|
|
||||||
TextButton(
|
|
||||||
onClick = {
|
|
||||||
com.rosetta.messenger.MainActivity
|
|
||||||
.clearFcmLogs()
|
|
||||||
},
|
|
||||||
contentPadding =
|
|
||||||
PaddingValues(horizontal = 8.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
"Clear",
|
|
||||||
fontSize = 13.sp,
|
|
||||||
color = PrimaryBlue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
text = {
|
|
||||||
Column(modifier = Modifier.fillMaxWidth().heightIn(max = 400.dp)) {
|
|
||||||
if (fcmLogs.isEmpty()) {
|
|
||||||
Text(
|
|
||||||
text =
|
|
||||||
"No FCM logs yet...\n\nLogs will appear here when Firebase initializes and FCM token is sent to the server.",
|
|
||||||
fontSize = 14.sp,
|
|
||||||
color = secondaryTextColor,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier =
|
|
||||||
Modifier.padding(vertical = 20.dp)
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
LazyColumn {
|
|
||||||
items(fcmLogs.size) { index ->
|
|
||||||
val log = fcmLogs[index]
|
|
||||||
Text(
|
|
||||||
text = log,
|
|
||||||
fontSize = 12.sp,
|
|
||||||
color = textColor,
|
|
||||||
fontFamily =
|
|
||||||
FontFamily
|
|
||||||
.Monospace,
|
|
||||||
lineHeight = 18.sp,
|
|
||||||
modifier =
|
|
||||||
Modifier.padding(
|
|
||||||
vertical =
|
|
||||||
2.dp
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirmButton = {
|
|
||||||
Button(
|
|
||||||
onClick = { showFcmDialog = false },
|
|
||||||
colors =
|
|
||||||
ButtonDefaults.buttonColors(
|
|
||||||
containerColor = PrimaryBlue
|
|
||||||
)
|
|
||||||
) { Text("Close", color = Color.White) }
|
|
||||||
},
|
|
||||||
containerColor = if (isDarkTheme) Color(0xFF212121) else Color.White
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simple background
|
// Simple background
|
||||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
||||||
ModalNavigationDrawer(
|
ModalNavigationDrawer(
|
||||||
@@ -701,7 +616,7 @@ fun ChatsListScreen(
|
|||||||
|
|
||||||
// 📖 Saved Messages
|
// 📖 Saved Messages
|
||||||
DrawerMenuItemEnhanced(
|
DrawerMenuItemEnhanced(
|
||||||
icon = Icons.Outlined.Bookmark,
|
icon = Icons.Default.Bookmark,
|
||||||
text = "Saved Messages",
|
text = "Saved Messages",
|
||||||
iconColor = menuIconColor,
|
iconColor = menuIconColor,
|
||||||
textColor = textColor,
|
textColor = textColor,
|
||||||
@@ -720,64 +635,6 @@ fun ChatsListScreen(
|
|||||||
|
|
||||||
DrawerDivider(isDarkTheme)
|
DrawerDivider(isDarkTheme)
|
||||||
|
|
||||||
// 👥 Contacts
|
|
||||||
DrawerMenuItemEnhanced(
|
|
||||||
icon = Icons.Outlined.Contacts,
|
|
||||||
text = "Contacts",
|
|
||||||
iconColor = menuIconColor,
|
|
||||||
textColor = textColor,
|
|
||||||
onClick = {
|
|
||||||
scope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
}
|
|
||||||
onContactsClick()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// 📞 Calls
|
|
||||||
DrawerMenuItemEnhanced(
|
|
||||||
icon = Icons.Outlined.Call,
|
|
||||||
text = "Calls",
|
|
||||||
iconColor = menuIconColor,
|
|
||||||
textColor = textColor,
|
|
||||||
onClick = {
|
|
||||||
scope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
}
|
|
||||||
onCallsClick()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// ➕ Invite Friends
|
|
||||||
DrawerMenuItemEnhanced(
|
|
||||||
icon = Icons.Outlined.PersonAdd,
|
|
||||||
text = "Invite Friends",
|
|
||||||
iconColor = menuIconColor,
|
|
||||||
textColor = textColor,
|
|
||||||
onClick = {
|
|
||||||
scope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
}
|
|
||||||
onInviteFriendsClick()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
DrawerDivider(isDarkTheme)
|
|
||||||
|
|
||||||
// 🔔 FCM Logs
|
|
||||||
DrawerMenuItemEnhanced(
|
|
||||||
icon = Icons.Outlined.Notifications,
|
|
||||||
text = "FCM Token Logs",
|
|
||||||
iconColor = menuIconColor,
|
|
||||||
textColor = textColor,
|
|
||||||
onClick = {
|
|
||||||
scope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
}
|
|
||||||
showFcmDialog = true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// ⚙️ Settings
|
// ⚙️ Settings
|
||||||
DrawerMenuItemEnhanced(
|
DrawerMenuItemEnhanced(
|
||||||
icon = Icons.Outlined.Settings,
|
icon = Icons.Outlined.Settings,
|
||||||
@@ -809,21 +666,6 @@ fun ChatsListScreen(
|
|||||||
textColor = textColor,
|
textColor = textColor,
|
||||||
onClick = { onToggleTheme() }
|
onClick = { onToggleTheme() }
|
||||||
)
|
)
|
||||||
|
|
||||||
// ❓ Help
|
|
||||||
DrawerMenuItemEnhanced(
|
|
||||||
icon = Icons.Outlined.HelpOutline,
|
|
||||||
text = "Help & FAQ",
|
|
||||||
iconColor = menuIconColor,
|
|
||||||
textColor = textColor,
|
|
||||||
onClick = {
|
|
||||||
scope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
}
|
|
||||||
// TODO: Add help screen
|
|
||||||
// navigation
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
|
|||||||
Reference in New Issue
Block a user