动态详情页交互功能增加游客登录判断

This commit is contained in:
2025-09-05 15:21:09 +08:00
parent 9dceb99a98
commit 18a0bb8494

View File

@@ -423,12 +423,8 @@ fun PostScreen(
// 检查游客模式,如果是游客则跳转登录 // 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.FOLLOW_USER)) { if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.FOLLOW_USER)) {
debouncedNavigation { debouncedNavigation {
debouncedNavigation {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route) navController.navigate(NavigationRoute.Login.route)
} }
}
}
} else { } else {
scope.launch { scope.launch {
if (viewModel.moment?.followStatus == true) { if (viewModel.moment?.followStatus == true) {
@@ -450,17 +446,14 @@ fun PostScreen(
// 检查游客模式,如果是游客则跳转登录 // 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)) { if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)) {
debouncedNavigation { debouncedNavigation {
debouncedNavigation {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route) navController.navigate(NavigationRoute.Login.route)
} }
}
}
} else { } else {
showReportDialog = true showReportDialog = true
} }
} }
) )
LazyColumn( LazyColumn(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -943,7 +936,13 @@ fun Header(
.height(24.dp) .height(24.dp)
.padding(end = 8.dp) .padding(end = 8.dp)
.noRippleClickable { .noRippleClickable {
if(GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)){
debouncedNavigation{
navController.navigate(NavigationRoute.Login.route)
}
}else {
expanded = true expanded = true
}
}, },
painter = painterResource(id = R.drawable.rider_pro_more_horizon), painter = painterResource(id = R.drawable.rider_pro_more_horizon),
contentDescription = "", contentDescription = "",
@@ -1436,10 +1435,18 @@ fun CommentItem(
AnimatedLikeIcon( AnimatedLikeIcon(
liked = commentEntity.liked, liked = commentEntity.liked,
onClick = { onClick = {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.LIKE_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onLike(commentEntity) onLike(commentEntity)
}
}, },
modifier = Modifier.size(16.dp) modifier = Modifier.size(16.dp)
) )
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Text( Text(
text = commentEntity.likes.toString(), text = commentEntity.likes.toString(),
@@ -1468,18 +1475,22 @@ fun CommentItem(
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
color = AppColors.nonActiveText, color = AppColors.nonActiveText,
modifier = Modifier.noRippleClickable { modifier = Modifier.noRippleClickable {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReply( onReply(
commentEntity, commentEntity,
commentEntity.replyUserId, commentEntity.replyUserId,
commentEntity.replyUserNickname, commentEntity.replyUserNickname,
commentEntity.replyUserAvatar commentEntity.replyUserAvatar
) )
}
}, },
) )
} }
} }
} }
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
@@ -1538,6 +1549,8 @@ fun PostBottomBar(
momentEntity: MomentEntity? momentEntity: MomentEntity?
) { ) {
val AppColors = LocalAppTheme.current val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
Column( Column(
modifier = Modifier.background( modifier = Modifier.background(
@@ -1567,8 +1580,15 @@ fun PostBottomBar(
.height(31.dp) .height(31.dp)
.padding(8.dp) .padding(8.dp)
.noRippleClickable { .noRippleClickable {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onCreateCommentClick() onCreateCommentClick()
} }
}
) { ) {
Row( Row(
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
@@ -1589,7 +1609,16 @@ fun PostBottomBar(
Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.width(16.dp))
AnimatedLikeIcon( AnimatedLikeIcon(
liked = momentEntity?.liked == true, liked = momentEntity?.liked == true,
onClick = onLikeClick, onClick = {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.LIKE_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onLikeClick()
}
},
modifier = Modifier.size(24.dp) modifier = Modifier.size(24.dp)
) )
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
@@ -1597,7 +1626,16 @@ fun PostBottomBar(
Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.width(16.dp))
AnimatedFavouriteIcon( AnimatedFavouriteIcon(
isFavourite = momentEntity?.isFavorite == true, isFavourite = momentEntity?.isFavorite == true,
onClick = onFavoriteClick, onClick = {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.LIKE_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onFavoriteClick()
}
},
modifier = Modifier.size(24.dp) modifier = Modifier.size(24.dp)
) )
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
@@ -1611,6 +1649,7 @@ fun PostBottomBar(
} }
@Composable @Composable
fun PostMenuModal( fun PostMenuModal(
onDeleteClick: () -> Unit = {}, onDeleteClick: () -> Unit = {},
@@ -1618,6 +1657,8 @@ fun PostMenuModal(
userId: Int? = 0 userId: Int? = 0
) { ) {
val AppColors = LocalAppTheme.current val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
Row( Row(
modifier = Modifier modifier = Modifier
@@ -1679,8 +1720,15 @@ fun PostMenuModal(
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.noRippleClickable { .noRippleClickable {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReportClick() onReportClick()
} }
}
) { ) {
Image( Image(
painter = painterResource(id = R.drawable.rider_pro_moment_report), painter = painterResource(id = R.drawable.rider_pro_moment_report),
@@ -1705,6 +1753,7 @@ fun PostMenuModal(
} }
} }
@Composable @Composable
fun MenuActionItem( fun MenuActionItem(
icon: Int? = null, icon: Int? = null,
@@ -1761,6 +1810,8 @@ fun CommentMenuModal(
) { ) {
val clipboard = LocalClipboardManager.current val clipboard = LocalClipboardManager.current
val AppColors = LocalAppTheme.current val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
fun copyToClipboard() { fun copyToClipboard() {
commentEntity?.let { commentEntity?.let {
@@ -1860,7 +1911,16 @@ fun CommentMenuModal(
content = { content = {
AnimatedLikeIcon( AnimatedLikeIcon(
liked = it.liked, liked = it.liked,
onClick = onLikeClick, onClick = {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.LIKE_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onLikeClick()
}
},
modifier = Modifier.size(24.dp) modifier = Modifier.size(24.dp)
) )
} }
@@ -1874,14 +1934,23 @@ fun CommentMenuModal(
icon = R.drawable.rider_pro_comment, icon = R.drawable.rider_pro_comment,
text = stringResource(R.string.reply) text = stringResource(R.string.reply)
) { ) {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReplyClick() onReplyClick()
} }
}
} }
Spacer(modifier = Modifier.height(48.dp)) Spacer(modifier = Modifier.height(48.dp))
} }
} }
@Composable @Composable
fun OrderSelectionComponent( fun OrderSelectionComponent(
onSelected: (String) -> Unit = {} onSelected: (String) -> Unit = {}