feat: Add ChatDetailScreen and implement chat navigation with animated transitions
This commit is contained in:
@@ -26,6 +26,8 @@ import com.rosetta.messenger.data.PreferencesManager
|
||||
import com.rosetta.messenger.ui.auth.AccountInfo
|
||||
import com.rosetta.messenger.ui.auth.AuthFlow
|
||||
import com.rosetta.messenger.ui.chats.ChatsListScreen
|
||||
import com.rosetta.messenger.ui.chats.ChatDetailScreen
|
||||
import com.rosetta.messenger.network.SearchUser
|
||||
import com.rosetta.messenger.ui.onboarding.OnboardingScreen
|
||||
import com.rosetta.messenger.ui.splash.SplashScreen
|
||||
import com.rosetta.messenger.ui.theme.RosettaAndroidTheme
|
||||
@@ -214,44 +216,84 @@ fun MainScreen(
|
||||
val accountPublicKey = account?.publicKey ?: "04c266b98ae5"
|
||||
val privateKeyHash = account?.privateKeyHash ?: ""
|
||||
|
||||
ChatsListScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
accountName = accountName,
|
||||
accountPhone = accountPhone,
|
||||
accountPublicKey = accountPublicKey,
|
||||
privateKeyHash = privateKeyHash,
|
||||
onToggleTheme = onToggleTheme,
|
||||
onProfileClick = {
|
||||
// TODO: Navigate to profile
|
||||
// Навигация между экранами
|
||||
var selectedUser by remember { mutableStateOf<SearchUser?>(null) }
|
||||
|
||||
// Анимированный переход между чатами
|
||||
AnimatedContent(
|
||||
targetState = selectedUser,
|
||||
transitionSpec = {
|
||||
if (targetState != null) {
|
||||
// Открытие чата - слайд слева
|
||||
slideInHorizontally(
|
||||
initialOffsetX = { it },
|
||||
animationSpec = tween(300)
|
||||
) togetherWith slideOutHorizontally(
|
||||
targetOffsetX = { -it / 3 },
|
||||
animationSpec = tween(300)
|
||||
)
|
||||
} else {
|
||||
// Закрытие чата - слайд справа
|
||||
slideInHorizontally(
|
||||
initialOffsetX = { -it / 3 },
|
||||
animationSpec = tween(300)
|
||||
) togetherWith slideOutHorizontally(
|
||||
targetOffsetX = { it },
|
||||
animationSpec = tween(300)
|
||||
)
|
||||
}
|
||||
},
|
||||
onNewGroupClick = {
|
||||
// TODO: Navigate to new group
|
||||
},
|
||||
onContactsClick = {
|
||||
// TODO: Navigate to contacts
|
||||
},
|
||||
onCallsClick = {
|
||||
// TODO: Navigate to calls
|
||||
},
|
||||
onSavedMessagesClick = {
|
||||
// TODO: Navigate to saved messages
|
||||
},
|
||||
onSettingsClick = {
|
||||
// TODO: Navigate to settings
|
||||
},
|
||||
onInviteFriendsClick = {
|
||||
// TODO: Share invite link
|
||||
},
|
||||
onSearchClick = {
|
||||
// TODO: Show search
|
||||
},
|
||||
onNewChat = {
|
||||
// TODO: Show new chat screen
|
||||
},
|
||||
onUserSelect = { user ->
|
||||
// TODO: Navigate to chat with selected user
|
||||
android.util.Log.d("MainScreen", "User selected: ${user.publicKey}")
|
||||
},
|
||||
onLogout = onLogout
|
||||
)
|
||||
label = "chatNavigation"
|
||||
) { user ->
|
||||
if (user != null) {
|
||||
// Экран чата
|
||||
ChatDetailScreen(
|
||||
user = user,
|
||||
currentUserPublicKey = accountPublicKey,
|
||||
isDarkTheme = isDarkTheme,
|
||||
onBack = { selectedUser = null }
|
||||
)
|
||||
} else {
|
||||
// Список чатов
|
||||
ChatsListScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
accountName = accountName,
|
||||
accountPhone = accountPhone,
|
||||
accountPublicKey = accountPublicKey,
|
||||
privateKeyHash = privateKeyHash,
|
||||
onToggleTheme = onToggleTheme,
|
||||
onProfileClick = {
|
||||
// TODO: Navigate to profile
|
||||
},
|
||||
onNewGroupClick = {
|
||||
// TODO: Navigate to new group
|
||||
},
|
||||
onContactsClick = {
|
||||
// TODO: Navigate to contacts
|
||||
},
|
||||
onCallsClick = {
|
||||
// TODO: Navigate to calls
|
||||
},
|
||||
onSavedMessagesClick = {
|
||||
// TODO: Navigate to saved messages
|
||||
},
|
||||
onSettingsClick = {
|
||||
// TODO: Navigate to settings
|
||||
},
|
||||
onInviteFriendsClick = {
|
||||
// TODO: Share invite link
|
||||
},
|
||||
onSearchClick = {
|
||||
// TODO: Show search
|
||||
},
|
||||
onNewChat = {
|
||||
// TODO: Show new chat screen
|
||||
},
|
||||
onUserSelect = { user ->
|
||||
selectedUser = user
|
||||
},
|
||||
onLogout = onLogout
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user