From efd31901cc468be97188c714b28d02c3c993397a Mon Sep 17 00:00:00 2001 From: easyhz Date: Fri, 23 Aug 2024 00:20:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20image=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/image/AnnouncementImage.kt | 46 +++++++++++-------- .../component/image/OpenGraphImage.kt | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/AnnouncementImage.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/AnnouncementImage.kt index c2b89956..bb8bb8d4 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/AnnouncementImage.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/AnnouncementImage.kt @@ -1,16 +1,18 @@ package com.easyhz.noffice.core.design_system.component.image -import androidx.compose.foundation.Image +import androidx.compose.animation.AnimatedContent +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.painter.ColorPainter import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.res.painterResource import com.bumptech.glide.integration.compose.CrossFade import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi import com.bumptech.glide.integration.compose.GlideImage import com.bumptech.glide.integration.compose.placeholder -import com.easyhz.noffice.core.design_system.R +import com.easyhz.noffice.core.design_system.theme.Grey50 @OptIn(ExperimentalGlideComposeApi::class) @Composable @@ -18,22 +20,26 @@ fun AnnouncementImage( modifier: Modifier = Modifier, imageUrl: String ) { - if (imageUrl.isBlank() || imageUrl == "null") { - Image( - modifier = modifier.fillMaxWidth(), - painter = painterResource(id = R.drawable.img_illust_1), - contentScale = ContentScale.Crop, - contentDescription = "image" - ) - } else { - GlideImage( - modifier = modifier, - model = imageUrl, - contentDescription = imageUrl, - loading = placeholder(R.drawable.img_illust_1), - failure = placeholder(R.drawable.img_illust_1), - contentScale = ContentScale.Crop, - transition = CrossFade, - ) + AnimatedContent(targetState = imageUrl, label = "announcementImage") { + when (it.isBlank() || imageUrl == "null") { + true -> { + Box( + modifier = modifier + .fillMaxWidth() + .background(Grey50), + ) + } + false -> { + GlideImage( + modifier = modifier, + model = imageUrl, + contentDescription = imageUrl, + loading = placeholder(ColorPainter(Grey50)), + failure = placeholder(ColorPainter(Grey50)), + contentScale = ContentScale.Crop, + transition = CrossFade, + ) + } + } } } \ No newline at end of file diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/OpenGraphImage.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/OpenGraphImage.kt index a14d40a2..cd372bd4 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/OpenGraphImage.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/image/OpenGraphImage.kt @@ -27,7 +27,7 @@ fun OpenGraphImage( model = image, contentDescription = image, loading = placeholder(ColorPainter(Yellow300)), - failure = placeholder(ColorPainter(Yellow300)), // TODO 이 부분 색깔 랜덤으로 나오면 좋을듯 해서 3개 정도만 색깔 뽑아 달라 하자 + failure = placeholder(ColorPainter(Yellow300)), contentScale = ContentScale.Crop, transition = CrossFade ) From 46119fb84cd7bcf41ca0f5f1a365642a025c77f7 Mon Sep 17 00:00:00 2001 From: easyhz Date: Fri, 23 Aug 2024 00:34:11 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20home=20screen=20navigation=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../noffice/navigation/home/HomeNavigation.kt | 2 ++ .../home/component/notice/NoticeView.kt | 15 +++++----- .../feature/home/contract/home/HomeIntent.kt | 3 ++ .../home/contract/home/HomeSideEffect.kt | 2 ++ .../feature/home/screen/home/HomeScreen.kt | 30 +++++++++++++++++-- .../feature/home/screen/home/HomeViewModel.kt | 12 +++++++- 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/easyhz/noffice/navigation/home/HomeNavigation.kt b/app/src/main/java/com/easyhz/noffice/navigation/home/HomeNavigation.kt index b2e8fb1d..d438c344 100644 --- a/app/src/main/java/com/easyhz/noffice/navigation/home/HomeNavigation.kt +++ b/app/src/main/java/com/easyhz/noffice/navigation/home/HomeNavigation.kt @@ -20,6 +20,7 @@ import com.easyhz.noffice.navigation.home.screen.Home import com.easyhz.noffice.navigation.home.screen.Onboarding import com.easyhz.noffice.navigation.home.screen.Splash import com.easyhz.noffice.navigation.my_page.navigateToMyPage +import com.easyhz.noffice.navigation.organization.navigateToOrganizationDetail import com.easyhz.noffice.navigation.organization.navigateToOrganizationJoin import com.easyhz.noffice.navigation.sign.navigateToLogIn import com.easyhz.noffice.navigation.sign.screen.LogIn @@ -57,6 +58,7 @@ internal fun NavGraphBuilder.homeGraph( modifier = modifier, snackBarHostState = snackBarHostState, navigateToAnnouncementDetail = navController::navigateToAnnouncementDetail, + navigateToOrganizationDetail = navController::navigateToOrganizationDetail, navigateToMyPage = navController::navigateToMyPage, navigateToOrganizationJoin = navController::navigateToOrganizationJoin ) diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/notice/NoticeView.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/notice/NoticeView.kt index 93add446..1b880fce 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/notice/NoticeView.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/notice/NoticeView.kt @@ -39,7 +39,8 @@ fun NoticeView( organizationList: LazyPagingItems, isLoading: Boolean, isRefreshing: Boolean, - navigateToAnnouncementDetail: (Int, Int, String) -> Unit, + onClickOrganizationHeader: (Organization) -> Unit, + onClickAnnouncementCard: (organizationId: Int, announcementId: Int, announcementTitle: String) -> Unit, ) { LazyColumn( modifier = modifier, @@ -60,7 +61,8 @@ fun NoticeView( OrganizationSection( organization = it, isRefreshing = isRefreshing, - navigateToAnnouncementDetail = {id, title -> navigateToAnnouncementDetail(it.id, id, title) } + onClickOrganizationHeader = { onClickOrganizationHeader(it) }, + onClickItemCard = { id, title -> onClickAnnouncementCard(it.id, id, title) } ) } } @@ -73,7 +75,8 @@ private fun OrganizationSection( noticeViewModel: NoticeViewModel = hiltViewModel(), organization: Organization, isRefreshing: Boolean, - navigateToAnnouncementDetail: (Int, String) -> Unit, + onClickOrganizationHeader: () -> Unit, + onClickItemCard: (announcementId: Int, announcementTitle: String) -> Unit, ) { val announcementList = noticeViewModel.getAnnouncementStateByOrganization(organizationId = organization.id).collectAsLazyPagingItems() val isRefreshingAnnouncement = announcementList.loadState.refresh == LoadState.Loading @@ -94,9 +97,7 @@ private fun OrganizationSection( .screenHorizonPadding() .padding(vertical = 8.dp), organizationName = organization.name - ) { - - } + ) { onClickOrganizationHeader() } LazyRow( userScrollEnabled = (organization.joinStatus != JoinStatus.PENDING) && (announcementList.itemCount != 0), horizontalArrangement = Arrangement.spacedBy(12.dp), @@ -122,7 +123,7 @@ private fun OrganizationSection( ) ) ) { - navigateToAnnouncementDetail(it.announcementId, it.title) + onClickItemCard(it.announcementId, it.title) } } } diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt index 2fd371c4..ccab5d34 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt @@ -2,11 +2,14 @@ package com.easyhz.noffice.feature.home.contract.home import com.easyhz.noffice.core.common.base.UiIntent import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu +import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.feature.home.util.HomeTopBarMenu sealed class HomeIntent: UiIntent() { data class ChangeTopBarMenu(val topBarMenu: HomeTopBarMenu): HomeIntent() data class ClickTopBarIconMenu(val iconMenu: TopBarIconMenu): HomeIntent() + data class ClickOrganizationHeader(val organization: Organization): HomeIntent() + data class ClickAnnouncementCard(val organizationId: Int, val announcementId: Int, val announcementTitle: String): HomeIntent() data class JoinToOrganization(val organizationId: Int): HomeIntent() data object SetInitLoading: HomeIntent() data object Refresh: HomeIntent() diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeSideEffect.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeSideEffect.kt index 5908a52d..f84124ee 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeSideEffect.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeSideEffect.kt @@ -7,6 +7,8 @@ import com.easyhz.noffice.core.model.organization.OrganizationSignUpInformation sealed class HomeSideEffect: UiSideEffect() { data object NavigateToMyPage: HomeSideEffect() data class NavigateToOrganizationJoin(val organizationSignUpInformation: OrganizationSignUpInformation): HomeSideEffect() + data class NavigateToOrganizationDetail(val organizationId: Int, val organizationName: String): HomeSideEffect() + data class NavigateToAnnouncementDetail(val organizationId: Int, val announcementId: Int, val announcementTitle: String): HomeSideEffect() data class ShowSnackBar(@StringRes val stringId: Int): HomeSideEffect() data object Refresh: HomeSideEffect() } \ No newline at end of file diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt index 4b3f0bc1..5f63221f 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt @@ -48,6 +48,7 @@ fun HomeScreen( viewModel: HomeViewModel = hiltViewModel(), snackBarHostState: SnackbarHostState, navigateToAnnouncementDetail: (Int, Int, String) -> Unit, + navigateToOrganizationDetail: (Int, String) -> Unit, navigateToMyPage: () -> Unit, navigateToOrganizationJoin: (OrganizationSignUpInformation) -> Unit ) { @@ -82,7 +83,9 @@ fun HomeScreen( viewModel.postIntent(HomeIntent.JoinToOrganization(organizationIdToJoin)) } LaunchedEffect(key1 = organizationList.loadState) { - if (organizationList.loadState.prepend.endOfPaginationReached) { viewModel.postIntent(HomeIntent.SetInitLoading) } + if (organizationList.loadState.prepend.endOfPaginationReached) { + viewModel.postIntent(HomeIntent.SetInitLoading) + } } LoadingScreenProvider( isLoading = uiState.isJoinLoading @@ -124,7 +127,22 @@ fun HomeScreen( organizationList = organizationList, isLoading = uiState.isInitLoading, isRefreshing = isRefreshing, - navigateToAnnouncementDetail = navigateToAnnouncementDetail + onClickOrganizationHeader = { + viewModel.postIntent( + HomeIntent.ClickOrganizationHeader( + it + ) + ) + }, + onClickAnnouncementCard = { organizationId, announcementId, announcementTitle -> + viewModel.postIntent( + HomeIntent.ClickAnnouncementCard( + organizationId, + announcementId, + announcementTitle + ) + ) + } ) } @@ -136,7 +154,7 @@ fun HomeScreen( } } } - if(!uiState.isInitLoading) { + if (!uiState.isInitLoading) { PullRefreshIndicator( refreshing = isRefreshing, contentColor = Green500, @@ -156,6 +174,12 @@ fun HomeScreen( navigateToMyPage() } + is HomeSideEffect.NavigateToOrganizationDetail -> { + navigateToOrganizationDetail(sideEffect.organizationId, sideEffect.organizationName) + } + is HomeSideEffect.NavigateToAnnouncementDetail -> { + navigateToAnnouncementDetail(sideEffect.organizationId, sideEffect.announcementId, sideEffect.announcementTitle) + } is HomeSideEffect.NavigateToOrganizationJoin -> { navigateToOrganizationJoin(sideEffect.organizationSignUpInformation) } diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt index 91ddcbe1..58080828 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt @@ -10,12 +10,12 @@ import com.easyhz.noffice.core.common.error.handleError import com.easyhz.noffice.core.common.manager.DeepLinkManager import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.common.util.errorLogging +import com.easyhz.noffice.core.design_system.R import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.domain.home.usecase.member.FetchUserInfoUseCase import com.easyhz.noffice.domain.organization.usecase.organization.FetchOrganizationSignUpInfoUseCase import com.easyhz.noffice.domain.organization.usecase.organization.FetchOrganizationsUseCase -import com.easyhz.noffice.core.design_system.R import com.easyhz.noffice.feature.home.contract.home.HomeIntent import com.easyhz.noffice.feature.home.contract.home.HomeSideEffect import com.easyhz.noffice.feature.home.contract.home.HomeState @@ -48,6 +48,8 @@ class HomeViewModel @Inject constructor( is HomeIntent.JoinToOrganization -> { joinToOrganization(intent.organizationId) } is HomeIntent.Refresh -> { refresh() } is HomeIntent.SetInitLoading -> { reduce { copy(isInitLoading = false) }} + is HomeIntent.ClickOrganizationHeader -> { navigateToOrganizationDetail(intent.organization) } + is HomeIntent.ClickAnnouncementCard -> { navigateToAnnouncementDetail(intent.organizationId, intent.announcementId, intent.announcementTitle) } } } @@ -87,6 +89,14 @@ class HomeViewModel @Inject constructor( postSideEffect { HomeSideEffect.NavigateToMyPage } } + private fun navigateToOrganizationDetail(organization: Organization) { + postSideEffect { HomeSideEffect.NavigateToOrganizationDetail(organizationId = organization.id, organizationName = organization.name) } + } + + private fun navigateToAnnouncementDetail(organizationId: Int, id: Int, title: String) { + postSideEffect { HomeSideEffect.NavigateToAnnouncementDetail(organizationId, id, title) } + } + private fun fetchOrganizations() = viewModelScope.launch { fetchOrganizationsUseCase.invoke() From fed3e171da1900029307624f6621e7a18248e923 Mon Sep 17 00:00:00 2001 From: easyhz Date: Fri, 23 Aug 2024 00:40:33 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20organization=20screen=20navigation?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - navigate -> MyPage --- .../organization/OrganizationNavigation.kt | 2 ++ .../contract/organization/OrganizationIntent.kt | 2 ++ .../organization/OrganizationSideEffect.kt | 2 +- .../screen/organization/OrganizationScreen.kt | 8 ++++---- .../screen/organization/OrganizationViewModel.kt | 14 ++++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/easyhz/noffice/navigation/organization/OrganizationNavigation.kt b/app/src/main/java/com/easyhz/noffice/navigation/organization/OrganizationNavigation.kt index d9ad1c72..9828c63a 100644 --- a/app/src/main/java/com/easyhz/noffice/navigation/organization/OrganizationNavigation.kt +++ b/app/src/main/java/com/easyhz/noffice/navigation/organization/OrganizationNavigation.kt @@ -23,6 +23,7 @@ import com.easyhz.noffice.feature.organization.screen.organization.OrganizationS import com.easyhz.noffice.feature.organization.screen.standby.StandbyMemberScreen import com.easyhz.noffice.navigation.announcement.navigateToAnnouncementDetail import com.easyhz.noffice.navigation.home.navigateToHome +import com.easyhz.noffice.navigation.my_page.navigateToMyPage import com.easyhz.noffice.navigation.organization.screen.MemberManagement import com.easyhz.noffice.navigation.organization.screen.Organization import com.easyhz.noffice.navigation.organization.screen.OrganizationCreation @@ -49,6 +50,7 @@ internal fun NavGraphBuilder.organizationGraph( ) { OrganizationScreen( modifier = modifier, + navigateToMyPage = navController::navigateToMyPage, navigateToCreation = navController::navigateToOrganizationCreation, navigateToDetail = navController::navigateToOrganizationDetail ) diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationIntent.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationIntent.kt index ab226f57..47bf2b10 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationIntent.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationIntent.kt @@ -1,8 +1,10 @@ package com.easyhz.noffice.feature.organization.contract.organization import com.easyhz.noffice.core.common.base.UiIntent +import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu sealed class OrganizationIntent: UiIntent() { data object ClickOrganizationCreation: OrganizationIntent() + data class ClickTopBarIconMenu(val iconMenu: TopBarIconMenu): OrganizationIntent() data class ClickOrganization(val id: Int, val name: String): OrganizationIntent() } \ No newline at end of file diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationSideEffect.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationSideEffect.kt index a6a87686..f54643cd 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationSideEffect.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/organization/OrganizationSideEffect.kt @@ -3,7 +3,7 @@ package com.easyhz.noffice.feature.organization.contract.organization import com.easyhz.noffice.core.common.base.UiSideEffect sealed class OrganizationSideEffect: UiSideEffect() { - data object NavigateToCreation: OrganizationSideEffect() data class NavigateToDetail(val id: Int, val name: String): OrganizationSideEffect() + data object NavigateToMyPage: OrganizationSideEffect() } \ No newline at end of file diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationScreen.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationScreen.kt index 6d9be26a..4b3f1acb 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationScreen.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationScreen.kt @@ -30,6 +30,7 @@ import com.easyhz.noffice.feature.organization.util.OrganizationTopBarMenu fun OrganizationScreen( modifier: Modifier = Modifier, viewModel: OrganizationViewModel = hiltViewModel(), + navigateToMyPage: () -> Unit, navigateToDetail: (Int, String) -> Unit, navigateToCreation: () -> Unit ) { @@ -38,10 +39,8 @@ fun OrganizationScreen( topBar = { HomeTopBar( tabs = enumValues(), - onClickIconMenu = { } - ) { - - } + onClickIconMenu = { viewModel.postIntent(OrganizationIntent.ClickTopBarIconMenu(it)) } + ) { } } ) { paddingValues -> if(organizationList.itemCount == 0 && organizationList.loadState.refresh != LoadState.Loading) { @@ -95,6 +94,7 @@ fun OrganizationScreen( when(sideEffect) { is OrganizationSideEffect.NavigateToCreation -> { navigateToCreation() } is OrganizationSideEffect.NavigateToDetail -> { navigateToDetail(sideEffect.id, sideEffect.name) } + is OrganizationSideEffect.NavigateToMyPage -> { navigateToMyPage() } } } } \ No newline at end of file diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationViewModel.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationViewModel.kt index 90884202..cfb823ec 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationViewModel.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/organization/OrganizationViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.viewModelScope import androidx.paging.PagingData import androidx.paging.cachedIn import com.easyhz.noffice.core.common.base.BaseViewModel +import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.domain.organization.usecase.organization.FetchOrganizationsUseCase import com.easyhz.noffice.feature.organization.contract.organization.OrganizationIntent @@ -35,6 +36,8 @@ class OrganizationViewModel @Inject constructor( is OrganizationIntent.ClickOrganization -> { onClickOrganization(intent.id, intent.name) } + + is OrganizationIntent.ClickTopBarIconMenu -> { onClickTopBarIconMenu(intent.iconMenu) } } } @@ -50,6 +53,13 @@ class OrganizationViewModel @Inject constructor( } } + private fun onClickTopBarIconMenu(iconMenu: TopBarIconMenu) { + when(iconMenu) { + TopBarIconMenu.NOTIFICATION -> { /* TODO 네비게이션 처리 */ } + TopBarIconMenu.USER -> { navigateToMyPage() } + } + } + private fun onClickOrganizationCreation() { postSideEffect { OrganizationSideEffect.NavigateToCreation } } @@ -60,4 +70,8 @@ class OrganizationViewModel @Inject constructor( OrganizationSideEffect.NavigateToDetail(id, name) } } + + private fun navigateToMyPage() { + postSideEffect { OrganizationSideEffect.NavigateToMyPage } + } } \ No newline at end of file From 3d05aff0c9f0179066d68d9af7762b264d1a35c7 Mon Sep 17 00:00:00 2001 From: easyhz Date: Fri, 23 Aug 2024 00:49:14 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20homeScreen=20=EC=97=90=EC=84=9C=20`o?= =?UTF-8?q?rganizationDetail`=EB=A1=9C=20=EA=B0=80=EB=8A=94=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95=20(#134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - task screen -> organization detail --- .../noffice/feature/home/component/task/TaskView.kt | 5 +++-- .../noffice/feature/home/contract/home/HomeIntent.kt | 3 +-- .../noffice/feature/home/screen/home/HomeScreen.kt | 10 ++++------ .../noffice/feature/home/screen/home/HomeViewModel.kt | 6 +++--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt index 986ff132..2b48c699 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/task/TaskView.kt @@ -24,7 +24,8 @@ import com.easyhz.noffice.feature.home.component.viewmodel.TaskViewModel @Composable internal fun TaskView( modifier: Modifier = Modifier, - viewModel: TaskViewModel = hiltViewModel() + viewModel: TaskViewModel = hiltViewModel(), + onClickOrganizationHeader: (organizationId: Int, organizationTitle: String) -> Unit, ) { val taskList = viewModel.taskListState.collectAsLazyPagingItems() LazyColumn( @@ -41,7 +42,7 @@ internal fun TaskView( modifier = Modifier .fillMaxWidth(), organizationName = item.organizationName - ) { } + ) { onClickOrganizationHeader(item.organizationId, item.organizationName) } item.tasks.forEach { task -> TaskItem( modifier = Modifier diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt index ccab5d34..c42db6d4 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/contract/home/HomeIntent.kt @@ -2,13 +2,12 @@ package com.easyhz.noffice.feature.home.contract.home import com.easyhz.noffice.core.common.base.UiIntent import com.easyhz.noffice.core.design_system.util.topBar.TopBarIconMenu -import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.feature.home.util.HomeTopBarMenu sealed class HomeIntent: UiIntent() { data class ChangeTopBarMenu(val topBarMenu: HomeTopBarMenu): HomeIntent() data class ClickTopBarIconMenu(val iconMenu: TopBarIconMenu): HomeIntent() - data class ClickOrganizationHeader(val organization: Organization): HomeIntent() + data class ClickOrganizationHeader(val organizationId: Int, val organizationName: String): HomeIntent() data class ClickAnnouncementCard(val organizationId: Int, val announcementId: Int, val announcementTitle: String): HomeIntent() data class JoinToOrganization(val organizationId: Int): HomeIntent() data object SetInitLoading: HomeIntent() diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt index 5f63221f..eb47f648 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeScreen.kt @@ -128,11 +128,7 @@ fun HomeScreen( isLoading = uiState.isInitLoading, isRefreshing = isRefreshing, onClickOrganizationHeader = { - viewModel.postIntent( - HomeIntent.ClickOrganizationHeader( - it - ) - ) + viewModel.postIntent(HomeIntent.ClickOrganizationHeader(it.id, it.name)) }, onClickAnnouncementCard = { organizationId, announcementId, announcementTitle -> viewModel.postIntent( @@ -150,7 +146,9 @@ fun HomeScreen( TaskView( modifier = Modifier .screenHorizonPadding() - ) + ) { organizationId, organizationName -> + viewModel.postIntent(HomeIntent.ClickOrganizationHeader(organizationId, organizationName)) + } } } } diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt index 58080828..5be729fc 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/screen/home/HomeViewModel.kt @@ -48,7 +48,7 @@ class HomeViewModel @Inject constructor( is HomeIntent.JoinToOrganization -> { joinToOrganization(intent.organizationId) } is HomeIntent.Refresh -> { refresh() } is HomeIntent.SetInitLoading -> { reduce { copy(isInitLoading = false) }} - is HomeIntent.ClickOrganizationHeader -> { navigateToOrganizationDetail(intent.organization) } + is HomeIntent.ClickOrganizationHeader -> { navigateToOrganizationDetail(intent.organizationId, intent.organizationName) } is HomeIntent.ClickAnnouncementCard -> { navigateToAnnouncementDetail(intent.organizationId, intent.announcementId, intent.announcementTitle) } } } @@ -89,8 +89,8 @@ class HomeViewModel @Inject constructor( postSideEffect { HomeSideEffect.NavigateToMyPage } } - private fun navigateToOrganizationDetail(organization: Organization) { - postSideEffect { HomeSideEffect.NavigateToOrganizationDetail(organizationId = organization.id, organizationName = organization.name) } + private fun navigateToOrganizationDetail(id: Int, name: String) { + postSideEffect { HomeSideEffect.NavigateToOrganizationDetail(organizationId = id, organizationName = name) } } private fun navigateToAnnouncementDetail(organizationId: Int, id: Int, title: String) {