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

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)) {
debouncedNavigation {
debouncedNavigation {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
navController.navigate(NavigationRoute.Login.route)
}
}
} else {
scope.launch {
if (viewModel.moment?.followStatus == true) {
@@ -450,17 +446,14 @@ fun PostScreen(
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)) {
debouncedNavigation {
debouncedNavigation {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
navController.navigate(NavigationRoute.Login.route)
}
}
} else {
showReportDialog = true
}
}
)
LazyColumn(
modifier = Modifier
.fillMaxWidth()
@@ -943,7 +936,13 @@ fun Header(
.height(24.dp)
.padding(end = 8.dp)
.noRippleClickable {
expanded = true
if(GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)){
debouncedNavigation{
navController.navigate(NavigationRoute.Login.route)
}
}else {
expanded = true
}
},
painter = painterResource(id = R.drawable.rider_pro_more_horizon),
contentDescription = "",
@@ -1436,10 +1435,18 @@ fun CommentItem(
AnimatedLikeIcon(
liked = commentEntity.liked,
onClick = {
onLike(commentEntity)
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.LIKE_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onLike(commentEntity)
}
},
modifier = Modifier.size(16.dp)
)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = commentEntity.likes.toString(),
@@ -1462,24 +1469,28 @@ fun CommentItem(
tint = AppColors.nonActiveText
)
Spacer(modifier = Modifier.width(4.dp))
Text(
text = stringResource(R.string.reply),
fontSize = 12.sp,
fontWeight = FontWeight.Bold,
color = AppColors.nonActiveText,
modifier = Modifier.noRippleClickable {
Text(
text = stringResource(R.string.reply),
fontSize = 12.sp,
fontWeight = FontWeight.Bold,
color = AppColors.nonActiveText,
modifier = Modifier.noRippleClickable {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReply(
commentEntity,
commentEntity.replyUserId,
commentEntity.replyUserNickname,
commentEntity.replyUserAvatar
)
},
)
}
},
)
}
}
}
Spacer(modifier = Modifier.height(8.dp))
@@ -1538,6 +1549,8 @@ fun PostBottomBar(
momentEntity: MomentEntity?
) {
val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
Column(
modifier = Modifier.background(
@@ -1567,7 +1580,14 @@ fun PostBottomBar(
.height(31.dp)
.padding(8.dp)
.noRippleClickable {
onCreateCommentClick()
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onCreateCommentClick()
}
}
) {
Row(
@@ -1589,7 +1609,16 @@ fun PostBottomBar(
Spacer(modifier = Modifier.width(16.dp))
AnimatedLikeIcon(
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)
)
Spacer(modifier = Modifier.width(4.dp))
@@ -1597,7 +1626,16 @@ fun PostBottomBar(
Spacer(modifier = Modifier.width(16.dp))
AnimatedFavouriteIcon(
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)
)
Spacer(modifier = Modifier.width(4.dp))
@@ -1611,6 +1649,7 @@ fun PostBottomBar(
}
@Composable
fun PostMenuModal(
onDeleteClick: () -> Unit = {},
@@ -1618,6 +1657,8 @@ fun PostMenuModal(
userId: Int? = 0
) {
val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
Row(
modifier = Modifier
@@ -1627,11 +1668,11 @@ fun PostMenuModal(
.padding(vertical = 47.dp, horizontal = 20.dp)
) {
if(AppState.UserId == userId){
Row(
modifier = Modifier
.size(60.dp),
verticalAlignment = Alignment.CenterVertically
) {
Row(
modifier = Modifier
.size(60.dp),
verticalAlignment = Alignment.CenterVertically
) {
Column(
modifier = Modifier.padding(end = 16.dp),
verticalArrangement = Arrangement.Center,
@@ -1670,41 +1711,49 @@ fun PostMenuModal(
.size(60.dp),
verticalAlignment = Alignment.CenterVertically
) {
Column(
modifier = Modifier.padding(end = 16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Box(
modifier = Modifier
.clip(CircleShape)
.noRippleClickable {
Column(
modifier = Modifier.padding(end = 16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Box(
modifier = Modifier
.clip(CircleShape)
.noRippleClickable {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.REPORT_CONTENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReportClick()
}
) {
Image(
painter = painterResource(id = R.drawable.rider_pro_moment_report),
contentDescription = "",
modifier = Modifier.size(24.dp),
colorFilter = ColorFilter.tint(
AppColors.error
)
}
) {
Image(
painter = painterResource(id = R.drawable.rider_pro_moment_report),
contentDescription = "",
modifier = Modifier.size(24.dp),
colorFilter = ColorFilter.tint(
AppColors.error
)
}
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(R.string.report),
fontSize = 12.sp,
fontWeight = FontWeight.Bold,
color = AppColors.error
)
}
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(R.string.report),
fontSize = 12.sp,
fontWeight = FontWeight.Bold,
color = AppColors.error
)
}
}
}
}
@Composable
fun MenuActionItem(
icon: Int? = null,
@@ -1761,6 +1810,8 @@ fun CommentMenuModal(
) {
val clipboard = LocalClipboardManager.current
val AppColors = LocalAppTheme.current
val navController = LocalNavController.current
val debouncedNavigation = rememberDebouncedNavigation()
fun copyToClipboard() {
commentEntity?.let {
@@ -1860,7 +1911,16 @@ fun CommentMenuModal(
content = {
AnimatedLikeIcon(
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)
)
}
@@ -1869,19 +1929,28 @@ fun CommentMenuModal(
}
}
//自己也可以回复自己
Spacer(modifier = Modifier.width(48.dp))
MenuActionItem(
icon = R.drawable.rider_pro_comment,
text = stringResource(R.string.reply)
) {
Spacer(modifier = Modifier.width(48.dp))
MenuActionItem(
icon = R.drawable.rider_pro_comment,
text = stringResource(R.string.reply)
) {
// 检查游客模式,如果是游客则跳转登录
if (GuestLoginCheckOut.needLogin(GuestLoginCheckOutScene.COMMENT_MOMENT)) {
debouncedNavigation {
navController.navigate(NavigationRoute.Login.route)
}
} else {
onReplyClick()
}
}
}
Spacer(modifier = Modifier.height(48.dp))
}
}
@Composable
fun OrderSelectionComponent(
onSelected: (String) -> Unit = {}