From e1692e1535ad4bdd17340d791382054d139fb076 Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 10:44:21 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=ED=8E=98=EC=9D=B4=EC=A7=95=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design_system/component/card/ItemCard.kt | 2 +- .../OrganizationAnnouncementPagingSource.kt | 4 ++-- .../home/component/notice/NoticeView.kt | 4 ++-- .../component/viewmodel/NoticeViewModel.kt | 20 +++++++++++-------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt index 3f79e71b..77ca1950 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt @@ -57,7 +57,7 @@ fun ItemCard( .noRippleClickable { onClick() } ) { AnnouncementImage( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth().height(160.dp), imageUrl = imageUrl ) Box(modifier = Modifier diff --git a/data/organization/src/main/java/com/easyhz/noffice/data/organization/pagingsource/OrganizationAnnouncementPagingSource.kt b/data/organization/src/main/java/com/easyhz/noffice/data/organization/pagingsource/OrganizationAnnouncementPagingSource.kt index 8d5dd15d..33a65189 100644 --- a/data/organization/src/main/java/com/easyhz/noffice/data/organization/pagingsource/OrganizationAnnouncementPagingSource.kt +++ b/data/organization/src/main/java/com/easyhz/noffice/data/organization/pagingsource/OrganizationAnnouncementPagingSource.kt @@ -41,7 +41,7 @@ class OrganizationAnnouncementPagingSource( companion object { - const val PAGE_SIZE = 10 - private const val START_PAGE = 1 + const val PAGE_SIZE = 1 + private const val START_PAGE = 0 } } \ No newline at end of file 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 449a3e29..d9bb3407 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 @@ -59,7 +59,7 @@ private fun OrganizationSection( organization: Organization, navigateToAnnouncementDetail: (Int, String) -> Unit, ) { - val announcementList = noticeViewModel.announcementState.collectAsLazyPagingItems() + val announcementList = noticeViewModel.getAnnouncementStateByOrganization(organizationId = organization.id).collectAsLazyPagingItems() LaunchedEffect(organization.id) { noticeViewModel.fetchAnnouncementByOrganization(organization.id) } @@ -79,7 +79,7 @@ private fun OrganizationSection( horizontalArrangement = Arrangement.spacedBy(12.dp), contentPadding = PaddingValues(horizontal = 16.dp), ) { - items(announcementList.itemCount) {index -> + items(announcementList.itemCount, key = { announcementList[it]?.announcementId ?: -1 }) {index -> announcementList[index]?.let { ItemCard( title = it.title, diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt index a8358826..ed8467f1 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt @@ -18,20 +18,24 @@ import javax.inject.Inject class NoticeViewModel @Inject constructor( private val fetchAnnouncementsByOrganizationUseCase: FetchAnnouncementsByOrganizationUseCase ) : ViewModel() { - private val _announcementState = - MutableStateFlow>(PagingData.empty()) - val announcementState: StateFlow> = _announcementState - - private var isLoaded = false + private val _announcementStates = mutableMapOf>>() + private val _isDataLoaded = mutableMapOf() + fun getAnnouncementStateByOrganization(organizationId: Int): StateFlow> { + return _announcementStates.getOrPut(organizationId) { + MutableStateFlow(PagingData.empty()) + } + } fun fetchAnnouncementByOrganization(id: Int) = viewModelScope.launch { - if (isLoaded) return@launch + if (_isDataLoaded[id] == true) { + return@launch + } fetchAnnouncementsByOrganizationUseCase(id) .distinctUntilChanged() .cachedIn(viewModelScope) .collectLatest { - _announcementState.value = it - isLoaded = true + _announcementStates[id]?.value = it + _isDataLoaded[id] = true } } From 07d63ed7489d95ffdc01d2a63505d8b372ae8107 Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 10:51:46 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20end=20At=20dateFormat=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../announcement/mapper/announcement/AnnouncementMapper.kt | 4 ++-- .../repository/organization/OrganizationRepository.kt | 3 ++- .../repository/organization/OrganizationRepositoryImpl.kt | 4 +++- .../announcement/FetchAnnouncementsByOrganizationUseCase.kt | 5 +++-- .../feature/home/component/viewmodel/NoticeViewModel.kt | 3 ++- .../screen/detail/OrganizationDetailViewModel.kt | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt b/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt index 7893ad26..6350bf9f 100644 --- a/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt +++ b/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt @@ -38,7 +38,7 @@ fun AnnouncementParam.toRequest(): AnnouncementRequest = AnnouncementRequest( tasks = this.tasks?.map { Task(content = it.content) } ) -fun AnnouncementResponse.toDetail(): OrganizationAnnouncement = OrganizationAnnouncement( +fun AnnouncementResponse.toDetail(pattern: DateFormat.PATTERN): OrganizationAnnouncement = OrganizationAnnouncement( announcementId = this.announcementId, title = this.title, content = this.content, @@ -47,6 +47,6 @@ fun AnnouncementResponse.toDetail(): OrganizationAnnouncement = OrganizationAnno placeUrl = this.placeLinkUrl, taskSize = 0, // FIXME createdAt = DateFormat.formatDateTime(this.createdAt), - endAt = DateFormat.formatDateTimeNullable(this.endAt, pattern = DateFormat.PATTERN.DAY), + endAt = DateFormat.formatDateTimeNullable(this.endAt, pattern = pattern), updatedAt = DateFormat.formatDateTime(this.createdAt) ) \ No newline at end of file diff --git a/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepository.kt b/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepository.kt index 93811c21..83cfc0c2 100644 --- a/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepository.kt +++ b/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepository.kt @@ -1,6 +1,7 @@ package com.easyhz.noffice.data.organization.repository.organization import androidx.paging.PagingData +import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.core.model.organization.OrganizationInformation import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement @@ -12,7 +13,7 @@ interface OrganizationRepository { suspend fun fetchOrganizations(): Flow> suspend fun createOrganization(param: OrganizationCreationParam): Result suspend fun fetchOrganizationInfo(organizationId: Int): Result - suspend fun fetchAnnouncementsByOrganization(organizationId: Int): Flow> + suspend fun fetchAnnouncementsByOrganization(organizationId: Int, endAtDatePattern: DateFormat.PATTERN): Flow> suspend fun updateOrganizationCategory(organizationId: Int, category: List): Result suspend fun joinOrganization(organizationId: Int): Result } \ No newline at end of file diff --git a/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepositoryImpl.kt b/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepositoryImpl.kt index 49f9b3f8..3cf2a0ec 100644 --- a/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepositoryImpl.kt +++ b/data/organization/src/main/java/com/easyhz/noffice/data/organization/repository/organization/OrganizationRepositoryImpl.kt @@ -6,6 +6,7 @@ import androidx.paging.PagingData import androidx.paging.map import com.easyhz.noffice.core.common.di.Dispatcher import com.easyhz.noffice.core.common.di.NofficeDispatchers +import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.model.organization.Organization import com.easyhz.noffice.core.model.organization.OrganizationInformation import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement @@ -61,6 +62,7 @@ class OrganizationRepositoryImpl @Inject constructor( override suspend fun fetchAnnouncementsByOrganization( organizationId: Int, + endAtDatePattern: DateFormat.PATTERN, ): Flow> = Pager( config = PagingConfig( @@ -75,7 +77,7 @@ class OrganizationRepositoryImpl @Inject constructor( } ).flow.map { pagingData -> pagingData.map { response -> - response.toDetail() + response.toDetail(endAtDatePattern) } } diff --git a/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/announcement/FetchAnnouncementsByOrganizationUseCase.kt b/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/announcement/FetchAnnouncementsByOrganizationUseCase.kt index ef09e552..1508b099 100644 --- a/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/announcement/FetchAnnouncementsByOrganizationUseCase.kt +++ b/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/announcement/FetchAnnouncementsByOrganizationUseCase.kt @@ -1,6 +1,7 @@ package com.easyhz.noffice.domain.organization.usecase.announcement import androidx.paging.PagingData +import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement import com.easyhz.noffice.data.organization.repository.organization.OrganizationRepository import kotlinx.coroutines.flow.Flow @@ -9,7 +10,7 @@ import javax.inject.Inject class FetchAnnouncementsByOrganizationUseCase @Inject constructor( private val organizationRepository: OrganizationRepository ) { - suspend operator fun invoke(organizationId: Int): Flow> { - return organizationRepository.fetchAnnouncementsByOrganization(organizationId) + suspend operator fun invoke(organizationId: Int, pattern: DateFormat.PATTERN): Flow> { + return organizationRepository.fetchAnnouncementsByOrganization(organizationId, pattern) } } \ No newline at end of file diff --git a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt index ed8467f1..536f6023 100644 --- a/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt +++ b/feature/home/src/main/java/com/easyhz/noffice/feature/home/component/viewmodel/NoticeViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import androidx.paging.PagingData import androidx.paging.cachedIn +import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement import com.easyhz.noffice.domain.organization.usecase.announcement.FetchAnnouncementsByOrganizationUseCase import dagger.hilt.android.lifecycle.HiltViewModel @@ -30,7 +31,7 @@ class NoticeViewModel @Inject constructor( if (_isDataLoaded[id] == true) { return@launch } - fetchAnnouncementsByOrganizationUseCase(id) + fetchAnnouncementsByOrganizationUseCase(id, pattern = DateFormat.PATTERN.FULL) .distinctUntilChanged() .cachedIn(viewModelScope) .collectLatest { diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt index 6d7c2a8e..300140e6 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt @@ -7,6 +7,7 @@ import androidx.paging.PagingData import androidx.paging.cachedIn import com.easyhz.noffice.core.common.base.BaseViewModel import com.easyhz.noffice.core.common.error.handleError +import com.easyhz.noffice.core.common.util.DateFormat import com.easyhz.noffice.core.model.organization.OrganizationInformation import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement import com.easyhz.noffice.core.model.organization.category.Category @@ -108,7 +109,7 @@ class OrganizationDetailViewModel @Inject constructor( } private suspend fun fetchAnnouncements(organizationId: Int) { - fetchAnnouncementsByOrganizationUseCase(organizationId).distinctUntilChanged() + fetchAnnouncementsByOrganizationUseCase(organizationId, DateFormat.PATTERN.DAY).distinctUntilChanged() .cachedIn(viewModelScope).collectLatest { _announcementState.value = it if(currentState.isCardLoading) { From 6cf45e53180d4d9f9168a53d4ead0c28d03e6bfa Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 10:55:44 +0900 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=EC=9D=B8=ED=84=B0=EB=9E=99=EC=85=98?= =?UTF-8?q?=20clickable=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../noffice/core/design_system/component/card/ItemCard.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt index 77ca1950..e31f4bb9 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/card/ItemCard.kt @@ -3,6 +3,7 @@ package com.easyhz.noffice.core.design_system.component.card import androidx.annotation.DrawableRes import androidx.compose.foundation.Image import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -30,7 +31,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.easyhz.noffice.core.design_system.R import com.easyhz.noffice.core.design_system.component.image.AnnouncementImage -import com.easyhz.noffice.core.design_system.extension.noRippleClickable import com.easyhz.noffice.core.design_system.extension.screenHorizonPadding import com.easyhz.noffice.core.design_system.theme.CardExceptionSubTitle import com.easyhz.noffice.core.design_system.theme.CardExceptionTitle @@ -52,9 +52,9 @@ fun ItemCard( Column(modifier = modifier .width(283.dp) .height(296.dp) + .clickable { onClick() } .clip(RoundedCornerShape(16.dp)) .border(1.dp, color = Grey200, RoundedCornerShape(16.dp)) - .noRippleClickable { onClick() } ) { AnnouncementImage( modifier = Modifier.fillMaxWidth().height(160.dp), From 5e2b8da39e9caf05990622463170f6241a44a227 Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 11:36:58 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20organization=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=ED=8F=AC=ED=95=A8=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?usecase=20=EC=B6=94=EA=B0=80=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/FetchOrganizationUseCase.kt | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/organization/FetchOrganizationUseCase.kt diff --git a/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/organization/FetchOrganizationUseCase.kt b/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/organization/FetchOrganizationUseCase.kt new file mode 100644 index 00000000..98dbe771 --- /dev/null +++ b/domain/organization/src/main/java/com/easyhz/noffice/domain/organization/usecase/organization/FetchOrganizationUseCase.kt @@ -0,0 +1,46 @@ +package com.easyhz.noffice.domain.organization.usecase.organization + +import com.easyhz.noffice.core.common.base.BaseUseCase +import com.easyhz.noffice.core.common.di.Dispatcher +import com.easyhz.noffice.core.common.di.NofficeDispatchers +import com.easyhz.noffice.core.model.organization.OrganizationInformation +import com.easyhz.noffice.core.model.organization.category.Category +import com.easyhz.noffice.data.organization.repository.category.CategoryRepository +import com.easyhz.noffice.data.organization.repository.organization.OrganizationRepository +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.async +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.withContext +import javax.inject.Inject + +class FetchOrganizationUseCase @Inject constructor( + @Dispatcher(NofficeDispatchers.IO) private val dispatcher: CoroutineDispatcher, + private val categoryRepository: CategoryRepository, + private val organizationRepository: OrganizationRepository +):BaseUseCase() { + override suspend fun invoke(param: Int): Result = withContext(dispatcher) { + runCatching { + val (categoriesResult, organizationInfoResult) = coroutineScope { + val categoriesDeferred = async { fetchCategories() } + val organizationInfoDeferred = async { fetchOrganizationInfo(param) } + + categoriesDeferred.await() to organizationInfoDeferred.await() + } + + val categoryList = categoriesResult.getOrThrow() + val info = organizationInfoResult.getOrThrow() + + info.copy(category = categoryList.filter { it.id == info.id }) + } + } + + + private suspend fun fetchCategories(): Result> { + return categoryRepository.fetchCategories() + } + + private suspend fun fetchOrganizationInfo(id: Int): Result { + return organizationRepository.fetchOrganizationInfo(id) + } + +} \ No newline at end of file From 93badc9be4aed94f7e6cba04b91fd9dddc6e3e79 Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 11:37:32 +0900 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20date=20format=20=ED=8C=A8=ED=84=B4?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/easyhz/noffice/core/common/util/DateFormat.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/core/common/src/main/java/com/easyhz/noffice/core/common/util/DateFormat.kt b/core/common/src/main/java/com/easyhz/noffice/core/common/util/DateFormat.kt index 7ef70a63..0925dd95 100644 --- a/core/common/src/main/java/com/easyhz/noffice/core/common/util/DateFormat.kt +++ b/core/common/src/main/java/com/easyhz/noffice/core/common/util/DateFormat.kt @@ -13,6 +13,7 @@ object DateFormat { val value: String ) { FULL("yyyy.MM.dd(E) HH:mm"), + DATE_TIME_TEXT("yyyy.MM.dd HH:mm"), DATE_TEXT("yyyy년 MM월 dd일"), DATE_DASH("yyyy-MM-dd"), CUSTOM_REMIND("MM월 dd일 E a h:mm"), From fb643b9eb96c79c33d4b2bf02da87205aa4ac558 Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 11:41:30 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20announcement=20=EB=8B=A8=EC=9D=BC?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20=EC=B6=94=EA=B0=80=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../announcement/AnnouncementNavigation.kt | 13 +++- .../announcement/screen/AnnouncementDetail.kt | 1 + .../screen/AnnouncementSuccess.kt | 1 + .../mapper/announcement/AnnouncementMapper.kt | 7 +- .../creation/promotion/PromotionSideEffect.kt | 2 +- .../contract/detail/DetailIntent.kt | 2 +- .../contract/detail/DetailState.kt | 75 +++++++------------ .../creation/promotion/PromotionScreen.kt | 4 +- .../creation/promotion/PromotionViewModel.kt | 2 +- .../screen/detail/AnnouncementDetailScreen.kt | 57 +++++++------- .../detail/AnnouncementDetailViewModel.kt | 61 ++++++++++----- .../screen/success/SuccessScreen.kt | 5 +- .../home/component/notice/NoticeView.kt | 4 +- .../feature/home/screen/home/HomeScreen.kt | 2 +- .../contract/detail/DetailSideEffect.kt | 2 +- .../screen/detail/OrganizationDetailScreen.kt | 4 +- .../detail/OrganizationDetailViewModel.kt | 2 +- 17 files changed, 132 insertions(+), 112 deletions(-) diff --git a/app/src/main/java/com/easyhz/noffice/navigation/announcement/AnnouncementNavigation.kt b/app/src/main/java/com/easyhz/noffice/navigation/announcement/AnnouncementNavigation.kt index 3db669ce..9a16ef85 100644 --- a/app/src/main/java/com/easyhz/noffice/navigation/announcement/AnnouncementNavigation.kt +++ b/app/src/main/java/com/easyhz/noffice/navigation/announcement/AnnouncementNavigation.kt @@ -37,6 +37,7 @@ internal fun NavGraphBuilder.announcementGraph( composable { val args = it.toRoute() AnnouncementDetailScreen( + organizationId = args.organizationId, id = args.id, title = args.title, navigateToUp = navController::navigateUp @@ -136,8 +137,9 @@ internal fun NavGraphBuilder.announcementGraph( param = args.announcementParam.decode(), snackBarHostState = snackBarHostState, navigateToUp = navController::navigateUp, - navigateToSuccess = { id, title -> + navigateToSuccess = { organizationId, id, title -> navController.navigateToSuccess( + organizationId, id, title, navOptions @@ -154,20 +156,22 @@ internal fun NavGraphBuilder.announcementGraph( } } SuccessScreen( + organizationId = args.organizationId, id = args.announcementId, title = args.title, navigateToHome = { navController.navigateToHome(navOptions) }, - navigateToAnnouncementDetail = { id, title -> navController.navigateToAnnouncementDetail(id, title, navOptions)} + navigateToAnnouncementDetail = { organizationId, id, title -> navController.navigateToAnnouncementDetail(organizationId, id, title, navOptions)} ) } } internal fun NavController.navigateToAnnouncementDetail( + organizationId: Int, id: Int, title: String, navOptions: NavOptions? = null ) { - navigate(route = AnnouncementDetail(id, title), navOptions) + navigate(route = AnnouncementDetail(organizationId = organizationId, id, title), navOptions) } internal fun NavController.navigateToAnnouncementNofficeSelection() { @@ -231,9 +235,10 @@ internal fun NavController.navigateToPromotion(param: AnnouncementParam) { } internal fun NavController.navigateToSuccess( + organizationId: Int, id: Int, title: String, navOptions: NavOptions? = null ) { - navigate(route = AnnouncementSuccess(id, title), navOptions) + navigate(route = AnnouncementSuccess(organizationId, id, title), navOptions) } \ No newline at end of file diff --git a/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementDetail.kt b/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementDetail.kt index e1cd6410..9ef12388 100644 --- a/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementDetail.kt +++ b/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementDetail.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable @Serializable data class AnnouncementDetail( + val organizationId: Int, val id: Int, val title: String, ) \ No newline at end of file diff --git a/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementSuccess.kt b/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementSuccess.kt index dc8461fe..bf2997fe 100644 --- a/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementSuccess.kt +++ b/app/src/main/java/com/easyhz/noffice/navigation/announcement/screen/AnnouncementSuccess.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable @Serializable data class AnnouncementSuccess( + val organizationId: Int, val announcementId: Int, val title: String ) diff --git a/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt b/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt index 6350bf9f..623b8a51 100644 --- a/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt +++ b/data/announcement/src/main/java/com/easyhz/noffice/data/announcement/mapper/announcement/AnnouncementMapper.kt @@ -1,6 +1,7 @@ package com.easyhz.noffice.data.announcement.mapper.announcement import com.easyhz.noffice.core.common.util.DateFormat +import com.easyhz.noffice.core.common.util.DateFormat.formatDateTime import com.easyhz.noffice.core.model.announcement.Announcement import com.easyhz.noffice.core.model.announcement.param.AnnouncementParam import com.easyhz.noffice.core.model.organization.announcement.OrganizationAnnouncement @@ -11,7 +12,7 @@ import com.easyhz.noffice.core.network.model.response.announcement.AnnouncementR fun AnnouncementResponse.toModel(): Announcement = Announcement( announcementId = this.announcementId, content = this.content, - createdAt = this.createdAt, + createdAt = formatDateTime(this.createdAt, DateFormat.PATTERN.DATE_TIME_TEXT), endAt = DateFormat.formatDateTimeNullable(this.endAt), memberId = this.memberId, noticeAt = this.noticeAt, @@ -46,7 +47,7 @@ fun AnnouncementResponse.toDetail(pattern: DateFormat.PATTERN): OrganizationAnno place = this.placeLinkName, placeUrl = this.placeLinkUrl, taskSize = 0, // FIXME - createdAt = DateFormat.formatDateTime(this.createdAt), + createdAt = formatDateTime(this.createdAt), endAt = DateFormat.formatDateTimeNullable(this.endAt, pattern = pattern), - updatedAt = DateFormat.formatDateTime(this.createdAt) + updatedAt = formatDateTime(this.createdAt) ) \ No newline at end of file diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/creation/promotion/PromotionSideEffect.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/creation/promotion/PromotionSideEffect.kt index b12649db..cbaf2a6e 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/creation/promotion/PromotionSideEffect.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/creation/promotion/PromotionSideEffect.kt @@ -8,5 +8,5 @@ sealed class PromotionSideEffect: UiSideEffect() { data object HidePromotionBottomSheet: PromotionSideEffect() data class ScrollToItem(val index: Int): PromotionSideEffect() data class ShowSnackBar(@StringRes val stringId: Int): PromotionSideEffect() - data class NavigateToSuccess(val id: Int, val title: String): PromotionSideEffect() + data class NavigateToSuccess(val organizationId: Int, val id: Int, val title: String): PromotionSideEffect() } \ No newline at end of file diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailIntent.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailIntent.kt index 263c158f..05f9b0f0 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailIntent.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailIntent.kt @@ -3,7 +3,7 @@ package com.easyhz.noffice.feature.announcement.contract.detail import com.easyhz.noffice.core.common.base.UiIntent sealed class DetailIntent: UiIntent() { - data class InitScreen(val id: Int, val title: String): DetailIntent() + data class InitScreen(val organizationId: Int, val id: Int, val title: String): DetailIntent() data object NavigateToUp: DetailIntent() data object ClickPlace: DetailIntent() data object HideBottomSheet: DetailIntent() diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailState.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailState.kt index c0e0a4d2..685bbdec 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailState.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/contract/detail/DetailState.kt @@ -1,7 +1,10 @@ package com.easyhz.noffice.feature.announcement.contract.detail import com.easyhz.noffice.core.common.base.UiState +import com.easyhz.noffice.core.model.announcement.Announcement import com.easyhz.noffice.core.model.announcement.detail.AnnouncementDetail +import com.easyhz.noffice.core.model.organization.OrganizationInformation +import com.easyhz.noffice.core.model.organization.member.MemberType import com.easyhz.noffice.core.model.task.Task data class DetailState( @@ -9,7 +12,8 @@ data class DetailState( val isShowBottomSheet: Boolean, val isWebViewLoading: Boolean, val canGoBack: Boolean, - val detail: AnnouncementDetail + val announcement: Announcement, + val organizationInformation: OrganizationInformation, ): UiState() { companion object { fun init() = DetailState( @@ -17,59 +21,36 @@ data class DetailState( isShowBottomSheet = false, isWebViewLoading = true, canGoBack = false, - detail = AnnouncementDetail( - id = -1, - title = "", - creationDate = "", - organizationName = "", - organizationCategory = "", - organizationProfileImage = "", - date = "", - place = "", - placeUrl = "", + announcement = Announcement( + announcementId = -1, content = "", - taskList = emptyList() - ) + createdAt = "", + endAt = "", + memberId = -1, + noticeAt = emptyList(), + organizationId = -1, + placeLinkUrl = null, + placeLinkName = null, + profileImageUrl = null, + title = "", + updatedAt = "" + ), + organizationInformation = OrganizationInformation( + id = -1, + name = "", + profileImageUrl = "", + category = emptyList(), + members = linkedMapOf(MemberType.LEADER to 0, MemberType.MEMBER to 0), + hasStandbyMember = false, + role = MemberType.MEMBER + ), ) fun DetailState.updateDetailTitle( title: String ):DetailState = this.copy( - detail = this.detail.copy(title = title) + announcement = this.announcement.copy(title = title) ) } } -// FIXME -internal val DUMMY = AnnouncementDetail( - id = 1, - title = "5차 세션 : 최종 팀 빌딩 ~ 제목이 두 줄 일 때", - creationDate = "2024.06.29 14:02", - organizationName = "CMC 15th", - organizationCategory = "IT · 창업", - organizationProfileImage = "", - date = "2024.07.27(토) 14:02", - place = "서울 창업 허브 : 장소 이름이름이름이름..", - placeUrl = "https://naver.me/IGJAhyjN", - content = """ - 15기 챌린저 전원이 함께 모여 작업할 수 있는 모각작 세션과 UT(User Test)가 진행됩니다. - User Test는 실제 사용자가 서비스를 테스트하며 피드백하는 중요한 과정입니다. 사용자가 주어진 작업을 완료하는 데 걸리는 시간을 관찰하는 등의 방법을 통해 사용성을 평가하고, 피드백을 받아 서비스를 더욱 더 발전시킬 수 있습니다. - 사용자를 이해하는 과정을 통해 다양한 인사이트를 얻을 수 있으면 좋겠습니다. - - 이번 모각작 UT는 Maze로 진행합니다. 프로토타입을 만들어서 Maze 링크를 만들어 배포하시면 됩니다. [단, UT 세션 진행 전에 7/27에 진행할 UT 링크를 절대 배포하지 마세요.] - """.trimIndent(), - taskList = listOf( - Task( - content = "기획/디자이너 : 테스트를 진행할 메인 기능 프로토타입 최소 1개 이상 (간단해도 괜찮으니 메인 기능은 꼭 필수로)", - isDone = false - ), - Task( - content = "기획/디자이너 : UT 진행할 기기 - 스마트폰 기기 혹은 노트북", - isDone = false - ), - Task( - content = "열정과 패기 챙겨서 열심히 임해버리기 아자아자 화이팅", - isDone = false - ) - ) -) diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt index 817d6c27..f85c71ab 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt @@ -62,7 +62,7 @@ fun PromotionScreen( param: AnnouncementParam, snackBarHostState: SnackbarHostState, navigateToUp: () -> Unit, - navigateToSuccess: (Int, String) -> Unit, + navigateToSuccess: (Int, Int, String) -> Unit, ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() val scrollState = rememberLazyListState() @@ -204,7 +204,7 @@ fun PromotionScreen( ) } is PromotionSideEffect.NavigateToSuccess -> { - navigateToSuccess(sideEffect.id, sideEffect.title) + navigateToSuccess(sideEffect.organizationId, sideEffect.id, sideEffect.title) } } } diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionViewModel.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionViewModel.kt index 2720db10..6d4ab4ee 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionViewModel.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionViewModel.kt @@ -91,7 +91,7 @@ class PromotionViewModel @Inject constructor( profileImageUrl = imageUrl ) ?: return@launch createAnnouncementUseCase.invoke(param).onSuccess { - postSideEffect { PromotionSideEffect.NavigateToSuccess(it.organizationId, it.title) } + postSideEffect { PromotionSideEffect.NavigateToSuccess(it.organizationId, it.announcementId, it.title) } }.onFailure { showSnackBar(it.handleError()) }.also { diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt index 959fd513..fa6fada5 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt @@ -62,6 +62,7 @@ import com.easyhz.noffice.feature.announcement.util.detail.DetailType fun AnnouncementDetailScreen( modifier: Modifier = Modifier, viewModel: AnnouncementDetailViewModel = hiltViewModel(), + organizationId: Int, id: Int, title: String, navigateToUp: () -> Unit @@ -72,7 +73,7 @@ fun AnnouncementDetailScreen( val webView = remember { WebView(context) } LaunchedEffect(Unit) { - viewModel.postIntent(DetailIntent.InitScreen(id, title)) + viewModel.postIntent(DetailIntent.InitScreen(organizationId, id, title)) } NofficeBasicScaffold( containerColor = Grey50, @@ -101,8 +102,8 @@ fun AnnouncementDetailScreen( .padding(horizontal = 24.dp) ) { detailTitle( - title = uiState.detail.title, - date = uiState.detail.creationDate, + title = uiState.announcement.title, + date = uiState.announcement.createdAt, isLoading = uiState.isLoading ) item { @@ -114,38 +115,42 @@ fun AnnouncementDetailScreen( } organizationField( modifier = Modifier.padding(vertical = 12.dp), - organizationName = uiState.detail.organizationName, - profileImage = uiState.detail.organizationProfileImage, - category = uiState.detail.organizationCategory, + organizationName = uiState.organizationInformation.name, + profileImage = uiState.organizationInformation.profileImageUrl, + category = uiState.organizationInformation.category.map { it.title }.joinToString { "·" }, isLoading = uiState.isLoading ) - detailField( - detailType = DetailType.DATE_TIME, - value = uiState.detail.date, - isLoading = uiState.isLoading - ) { } - item { - Spacer( - modifier = Modifier - .fillMaxWidth() - .height(12.dp) - ) + uiState.announcement.endAt?.let { + detailField( + detailType = DetailType.DATE_TIME, + value = it, + isLoading = uiState.isLoading + ) { } + item { + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(12.dp) + ) + } + } + uiState.announcement.placeLinkName?.let { + detailField( + detailType = DetailType.PLACE, + value = it, + isLoading = uiState.isLoading + ) { viewModel.postIntent(DetailIntent.ClickPlace) } } - detailField( - detailType = DetailType.PLACE, - value = uiState.detail.place, - isLoading = uiState.isLoading - ) { viewModel.postIntent(DetailIntent.ClickPlace) } contentField( modifier = Modifier.padding(vertical = 16.dp), - content = uiState.detail.content, + content = uiState.announcement.content, isLoading = uiState.isLoading ) taskListField( - taskList = uiState.detail.taskList + taskList = emptyList() // FIXME ) { viewModel.postIntent(DetailIntent.CheckTask(it)) } @@ -166,7 +171,7 @@ fun AnnouncementDetailScreen( }, dragHandle = { PlaceBottomSheetTopBar( - placeUrl = uiState.detail.placeUrl, + placeUrl = uiState.announcement.placeLinkUrl ?: "", onClickUrl = { viewModel.postIntent(DetailIntent.CopyUrl) } ) { viewModel.postIntent(DetailIntent.ClickWebViewBack) @@ -179,7 +184,7 @@ fun AnnouncementDetailScreen( ) { PlaceWebView( modifier = Modifier.fillMaxSize(), - url = uiState.detail.placeUrl, + url = uiState.announcement.placeLinkUrl ?: "", webView = webView, onGoBack = { viewModel.postIntent(DetailIntent.UpdateCanGoBack(it)) diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailViewModel.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailViewModel.kt index b314f16b..8d9c07ef 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailViewModel.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailViewModel.kt @@ -2,27 +2,30 @@ package com.easyhz.noffice.feature.announcement.screen.detail import androidx.lifecycle.viewModelScope import com.easyhz.noffice.core.common.base.BaseViewModel -import com.easyhz.noffice.core.model.task.Task -import com.easyhz.noffice.feature.announcement.contract.detail.DUMMY +import com.easyhz.noffice.core.model.announcement.Announcement +import com.easyhz.noffice.core.model.organization.OrganizationInformation +import com.easyhz.noffice.domain.announcement.usecase.announcement.FetchAnnouncementUseCase +import com.easyhz.noffice.domain.organization.usecase.organization.FetchOrganizationUseCase import com.easyhz.noffice.feature.announcement.contract.detail.DetailIntent import com.easyhz.noffice.feature.announcement.contract.detail.DetailSideEffect import com.easyhz.noffice.feature.announcement.contract.detail.DetailState import com.easyhz.noffice.feature.announcement.contract.detail.DetailState.Companion.updateDetailTitle import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.delay +import kotlinx.coroutines.async import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class AnnouncementDetailViewModel @Inject constructor( - + private val fetchOrganizationUseCase: FetchOrganizationUseCase, + private val fetchAnnouncementUseCase: FetchAnnouncementUseCase ) : BaseViewModel( initialState = DetailState.init() ) { override fun handleIntent(intent: DetailIntent) { when (intent) { is DetailIntent.InitScreen -> { - initScreen(intent.id, intent.title) + initScreen(intent.organizationId, intent.id, intent.title) } is DetailIntent.NavigateToUp -> { @@ -63,15 +66,33 @@ class AnnouncementDetailViewModel @Inject constructor( } } - private fun initScreen(id: Int, title: String) { + private fun initScreen(organizationId: Int, id: Int, title: String) { reduce { updateDetailTitle(title = title) } - fetchData(id) + fetchData(organizationId, id) } - private fun fetchData(id: Int) = viewModelScope.launch { - // FIXME - delay(2000) - reduce { copy(detail = DUMMY, isLoading = false) } + private fun fetchData(organizationId: Int, id: Int) = viewModelScope.launch { + val organizationDeferred = async { fetchOrganization(organizationId) } + val announcementDeferred = async { fetchAnnouncement(id) } + + val organizationResult = organizationDeferred.await() + val announcementResult = announcementDeferred.await() + + // 상태 변경을 한 번에 모아서 처리 + reduce { + copy( + organizationInformation = organizationResult.getOrNull() ?: organizationInformation, + announcement = announcementResult.getOrNull() ?: announcement, + isLoading = false + ) + } + } + + private suspend fun fetchOrganization(organizationId: Int): Result { + return fetchOrganizationUseCase(organizationId) + } + private suspend fun fetchAnnouncement(id: Int): Result { + return fetchAnnouncementUseCase(id) } private fun navigateToUp() { @@ -91,11 +112,15 @@ class AnnouncementDetailViewModel @Inject constructor( } private fun onClickOpenBrowser() { - postSideEffect { DetailSideEffect.OpenBrowser(currentState.detail.placeUrl) } + currentState.announcement.placeLinkUrl?.let { + postSideEffect { DetailSideEffect.OpenBrowser(it) } + } } private fun onCopyUrl() { - postSideEffect { DetailSideEffect.CopyUrl(currentState.detail.placeUrl) } + currentState.announcement.placeLinkUrl?.let { + postSideEffect { DetailSideEffect.CopyUrl(it) } + } } private fun onClickWebViewBack() { @@ -111,10 +136,10 @@ class AnnouncementDetailViewModel @Inject constructor( } private fun onCheckTask(index: Int) { - val updatedTaskList = currentState.detail.taskList.mapIndexed { i, task -> - if (i == index) task.copy(isDone = !task.isDone) else task - }.sortedWith(compareBy { it.isDone }.thenBy { it.content }) - val newState = currentState.detail.copy(taskList = updatedTaskList) - reduce { copy(detail = newState) } +// val updatedTaskList = currentState.detail.taskList.mapIndexed { i, task -> +// if (i == index) task.copy(isDone = !task.isDone) else task +// }.sortedWith(compareBy { it.isDone }.thenBy { it.content }) +// val newState = currentState.detail.copy(taskList = updatedTaskList) +// reduce { copy(detail = newState) } } } \ No newline at end of file diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/success/SuccessScreen.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/success/SuccessScreen.kt index af271525..c2614c04 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/success/SuccessScreen.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/success/SuccessScreen.kt @@ -33,10 +33,11 @@ import com.easyhz.noffice.core.design_system.util.topBar.DetailTopBarMenu @Composable fun SuccessScreen( modifier: Modifier = Modifier, + organizationId: Int, id: Int, title: String, navigateToHome: () -> Unit, - navigateToAnnouncementDetail: (Int, String) -> Unit, + navigateToAnnouncementDetail: (Int, Int, String) -> Unit, ) { NofficeBasicScaffold( statusBarColor = White, @@ -75,7 +76,7 @@ fun SuccessScreen( modifier = Modifier.weight(1f), text = stringResource(id = R.string.announcement_creation_success_to_detail) ) { - navigateToAnnouncementDetail(id, title) + navigateToAnnouncementDetail(organizationId, id, title) } } } 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 d9bb3407..6a2954fb 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 @@ -32,7 +32,7 @@ fun NoticeView( name: String, dayOfWeek: String, organizationList: LazyPagingItems, - navigateToAnnouncementDetail: (Int, String) -> Unit, + navigateToAnnouncementDetail: (Int, Int, String) -> Unit, ) { LazyColumn( modifier = modifier, @@ -45,7 +45,7 @@ fun NoticeView( organizationList[index]?.let { OrganizationSection( organization = it, - navigateToAnnouncementDetail = navigateToAnnouncementDetail + navigateToAnnouncementDetail = {id, title -> navigateToAnnouncementDetail(it.id, id, title) } ) } } 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 26c8b701..b4e81395 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 @@ -32,7 +32,7 @@ import com.easyhz.noffice.feature.home.util.HomeTopBarMenu fun HomeScreen( modifier: Modifier = Modifier, viewModel: HomeViewModel = hiltViewModel(), - navigateToAnnouncementDetail: (Int, String) -> Unit, + navigateToAnnouncementDetail: (Int, Int, String) -> Unit, navigateToMyPage: () -> Unit ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/detail/DetailSideEffect.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/detail/DetailSideEffect.kt index fa68b8ca..547c9d7a 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/detail/DetailSideEffect.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/contract/detail/DetailSideEffect.kt @@ -6,7 +6,7 @@ import com.easyhz.noffice.core.model.organization.OrganizationInformation sealed class DetailSideEffect: UiSideEffect() { data object NavigateToUp: DetailSideEffect() - data class NavigateToAnnouncementDetail(val id: Int, val title: String): DetailSideEffect() + data class NavigateToAnnouncementDetail(val organizationId: Int, val id: Int, val title: String): DetailSideEffect() data class NavigateToStandbyMember(val id: Int): DetailSideEffect() data class NavigateToOrganizationManagement(val information: OrganizationInformation): DetailSideEffect() data class ShowSnackBar(@StringRes val stringId: Int): DetailSideEffect() diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailScreen.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailScreen.kt index 77caa1e1..5f042fb9 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailScreen.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailScreen.kt @@ -55,7 +55,7 @@ fun OrganizationDetailScreen( organizationName: String, snackBarHostState: SnackbarHostState, navigateToUp: () -> Unit, - navigateToAnnouncementDetail: (Int, String) -> Unit, + navigateToAnnouncementDetail: (Int, Int, String) -> Unit, navigateToStandbyMember: (Int) -> Unit, navigateToOrganizationManagement: (OrganizationInformation) -> Unit ) { @@ -179,7 +179,7 @@ fun OrganizationDetailScreen( } is DetailSideEffect.NavigateToAnnouncementDetail -> { - navigateToAnnouncementDetail(sideEffect.id, sideEffect.title) + navigateToAnnouncementDetail(sideEffect.organizationId, sideEffect.id, sideEffect.title) } is DetailSideEffect.NavigateToOrganizationManagement -> { diff --git a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt index 300140e6..c420494a 100644 --- a/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt +++ b/feature/organization/src/main/java/com/easyhz/noffice/feature/organization/screen/detail/OrganizationDetailViewModel.kt @@ -120,7 +120,7 @@ class OrganizationDetailViewModel @Inject constructor( private fun onClickAnnouncement(id: Int, title: String) { postSideEffect { - DetailSideEffect.NavigateToAnnouncementDetail(id, title) + DetailSideEffect.NavigateToAnnouncementDetail(currentState.organizationInformation.id, id, title) } } From f35c97da7a088d5609f0d3d4b379cb079ed40abd Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 11:43:37 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20layout=20=EC=88=98=EC=A0=95=20#113?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/announcement/component/detail/DetailTitle.kt | 1 - .../announcement/screen/detail/AnnouncementDetailScreen.kt | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/component/detail/DetailTitle.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/component/detail/DetailTitle.kt index 075959e3..68c220d9 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/component/detail/DetailTitle.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/component/detail/DetailTitle.kt @@ -65,7 +65,6 @@ internal fun LazyListScope.detailTitle( overflow = TextOverflow.Ellipsis ) } - Spacer(modifier = Modifier.height(8.dp)) } } } \ No newline at end of file diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt index fa6fada5..865ac3cd 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/detail/AnnouncementDetailScreen.kt @@ -127,6 +127,8 @@ fun AnnouncementDetailScreen( value = it, isLoading = uiState.isLoading ) { } + } + uiState.announcement.placeLinkName?.let { item { Spacer( modifier = Modifier @@ -134,8 +136,6 @@ fun AnnouncementDetailScreen( .height(12.dp) ) } - } - uiState.announcement.placeLinkName?.let { detailField( detailType = DetailType.PLACE, value = it, From b3a11eb61ad885cc28d7608832e82238ac3670fb Mon Sep 17 00:00:00 2001 From: easyhz Date: Wed, 21 Aug 2024 12:27:49 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20android.yml=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/android.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 13d0b6ee..b36ad833 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -12,6 +12,7 @@ jobs: LOCAL_PROPERTIES_CONTENTS: ${{ secrets.LOCAL_PROPERTIES_CONTENTS }} KEYSTORE_PROPERTIES_CONTENTS: ${{ secrets.KEYSTORE_PROPERTIES_CONTENTS }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} steps: - uses: actions/checkout@v4 @@ -38,6 +39,9 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Create google-services.json + run: echo "$GOOGLE_SERVICES_JSON" > app/google-services.json + - name: Decode and create keystore.jks run: echo $SIGNING_KEY | base64 --decode > app/keystore.jks