feat: Enhance FCM token management by adding unsubscribe logic to prevent duplicate registrations

This commit is contained in:
2026-02-26 14:56:21 +05:00
parent 48861633ee
commit f526a442b0
11 changed files with 1007 additions and 309 deletions

View File

@@ -41,6 +41,7 @@ import com.rosetta.messenger.ui.auth.AuthFlow
import com.rosetta.messenger.ui.auth.DeviceConfirmScreen
import com.rosetta.messenger.ui.chats.ChatDetailScreen
import com.rosetta.messenger.ui.chats.ChatsListScreen
import com.rosetta.messenger.ui.chats.ConnectionLogsScreen
import com.rosetta.messenger.ui.chats.RequestsListScreen
import com.rosetta.messenger.ui.chats.SearchScreen
import com.rosetta.messenger.ui.components.OptimizedEmojiCache
@@ -506,6 +507,7 @@ sealed class Screen {
data object CrashLogs : Screen()
data object Biometric : Screen()
data object Appearance : Screen()
data object DebugLogs : Screen()
}
@Composable
@@ -614,6 +616,9 @@ fun MainScreen(
val isAppearanceVisible by remember {
derivedStateOf { navStack.any { it is Screen.Appearance } }
}
val isDebugLogsVisible by remember {
derivedStateOf { navStack.any { it is Screen.DebugLogs } }
}
// Navigation helpers
fun pushScreen(screen: Screen) {
@@ -635,7 +640,8 @@ fun MainScreen(
it is Screen.Logs ||
it is Screen.CrashLogs ||
it is Screen.Biometric ||
it is Screen.Appearance
it is Screen.Appearance ||
it is Screen.DebugLogs
}
}
fun popChatAndChildren() {
@@ -712,6 +718,7 @@ fun MainScreen(
)
},
onSettingsClick = { pushScreen(Screen.Profile) },
onLogsClick = { pushScreen(Screen.DebugLogs) },
onInviteFriendsClick = {
// TODO: Share invite link
},
@@ -1003,6 +1010,17 @@ fun MainScreen(
)
}
SwipeBackContainer(
isVisible = isDebugLogsVisible,
onBack = { navStack = navStack.filterNot { it is Screen.DebugLogs } },
isDarkTheme = isDarkTheme
) {
ConnectionLogsScreen(
isDarkTheme = isDarkTheme,
onBack = { navStack = navStack.filterNot { it is Screen.DebugLogs } }
)
}
var isOtherProfileSwipeEnabled by remember { mutableStateOf(true) }
LaunchedEffect(selectedOtherUser?.publicKey) {
isOtherProfileSwipeEnabled = true