Skip to content

Commit

Permalink
feat: 댓글창 닫을때 갱신
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Feb 3, 2024
1 parent 33e9186 commit 6ba0633
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fun PostViewContent(
addRealEmojiViewModel: AddRealEmojiViewModel = hiltViewModel(),
postRealEmojiListViewModel: MemberRealEmojiListViewModel = hiltViewModel(),
addEmojiBarState: MutableState<Boolean> = remember { mutableStateOf(false) },
postCommentDialogState: MutableState<Boolean> = remember { mutableStateOf(false) },
) {
val memberId = LocalSessionState.current.memberId
val memberRealEmojiState by postRealEmojiListViewModel.uiState.collectAsState()
Expand Down Expand Up @@ -150,6 +151,7 @@ fun PostViewContent(
familyPostReactionBarViewModel = familyPostReactionBarViewModel,
removePostReactionViewModel = removePostReactionViewModel,
addPostReactionViewModel = addPostReactionViewModel,
postCommentDialogState = postCommentDialogState,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
Expand Down Expand Up @@ -55,6 +56,7 @@ import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
import com.no5ing.bbibbi.util.LocalSessionState
import com.no5ing.bbibbi.util.asyncImagePainter
import com.no5ing.bbibbi.util.toLocalizedDate
import timber.log.Timber

@OptIn(ExperimentalFoundationApi::class)
@Composable
Expand All @@ -71,6 +73,7 @@ fun PostViewPage(
familyPostReactionBarViewModel: PostReactionBarViewModel = hiltViewModel(),
removePostReactionViewModel: RemovePostReactionViewModel = hiltViewModel(),
addPostReactionViewModel: AddPostReactionViewModel = hiltViewModel(),
postCommentDialogState: MutableState<Boolean> = remember { mutableStateOf(false) },
) {
LaunchedEffect(Unit) {
familyPostViewModel.invoke(Arguments(resourceId = postId))
Expand Down Expand Up @@ -101,6 +104,18 @@ fun PostViewPage(
)
}
}
LaunchedEffect(postState, postCommentDialogState.value) {
if (!postCommentDialogState.value && postState.isReady()) {
val currentPost = postState.data.post
familyPostsViewModel.invoke(
Arguments(
arguments = mapOf(
"date" to currentPost.createdAt.toLocalDate().toString(),
)
)
)
}
}
LaunchedEffect(siblingPostState) {
if (siblingPostState.isReady()) {
isPagerReady = true
Expand Down Expand Up @@ -161,6 +176,7 @@ fun PostViewPage(
removePostReactionViewModel = removePostReactionViewModel,
addPostReactionViewModel = addPostReactionViewModel,
postData = postData,
postCommentDialogState = postCommentDialogState,
)
}
} else {
Expand All @@ -172,6 +188,7 @@ fun PostViewPage(
removePostReactionViewModel = removePostReactionViewModel,
addPostReactionViewModel = addPostReactionViewModel,
postData = postState.data,
postCommentDialogState = postCommentDialogState,
)
}

Expand All @@ -191,6 +208,7 @@ fun PostViewBody(
familyPostReactionBarViewModel: PostReactionBarViewModel,
removePostReactionViewModel: RemovePostReactionViewModel,
addPostReactionViewModel: AddPostReactionViewModel,
postCommentDialogState: MutableState<Boolean> = remember { mutableStateOf(false) },
) {
Column {
PostViewTopBar(
Expand All @@ -208,6 +226,7 @@ fun PostViewBody(
removePostReactionViewModel = removePostReactionViewModel,
addPostReactionViewModel = addPostReactionViewModel,
onTapRealEmojiCreate = onTapRealEmojiCreate,
postCommentDialogState = postCommentDialogState,
)
}
}
Expand Down

0 comments on commit 6ba0633

Please sign in to comment.