From a999651f1469705029046aee2452c9f119d906f1 Mon Sep 17 00:00:00 2001 From: Sadturtleman Date: Tue, 25 Aug 2026 09:31:05 +0900 Subject: [PATCH] =?UTF-8?q?refactor(model):=20=ED=99=88=C2=B7=EB=A7=88?= =?UTF-8?q?=EC=9D=8C=EC=9D=98=20=EA=B8=B0=EB=A1=9D=20=EC=A0=84=EC=9A=A9=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=EC=9D=84=20=EC=93=B0=EB=8A=94=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=EB=A1=9C=20=EB=82=B4=EB=A6=B0=EB=8B=A4=20(#1085)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit core:model 은 11개 모듈이 의존하는 자리인데, 두 타입을 아는 모듈은 홈·마음의 기록·app 셋뿐이었다. - HomeSummary → feature:home:presentation.usecase — 유일한 생산자인 GetHomeSummaryUseCase 옆. 소비처도 같은 모듈의 HomeTabViewModel 하나다. - MindRecordCategory → feature:mindrecord:presentation.model — 표시용 MindRecordCategoryUi 옆. 세 모듈이 이미 이 모듈에 의존하고 있어 새 모듈 의존이 생기지 않는다. MindRecordCategory 의 KDoc 이 "UI 리소스는 확장 프로퍼티로 제공한다" 고 적혀 있었으나 실제로는 같은 패키지의 sealed class 라 사실에 맞췄다. 파일이 짧아 git 이 rename 대신 D+A 로 잡을 수 있는데, 패키지·주석 외 내용은 그대로다. Co-Authored-By: Claude Opus 5 (1M context) --- .../AppAndReceiverCompletionAndroidTest.kt | 2 +- .../navigation/AppNavigationActions.kt | 2 +- .../afternote/core/model/MindRecordCategory.kt | 12 ------------ .../feature/home/presentation/HomeTabScreen.kt | 2 +- .../feature/home/presentation/HomeTabViewModel.kt | 4 ++-- .../presentation/usecase/GetHomeSummaryUseCase.kt | 2 +- .../home/presentation/usecase}/HomeSummary.kt | 2 +- .../presentation/HomeTabScreenScreenshotTest.kt | 2 +- .../home/presentation/HomeTabViewModelTest.kt | 2 +- .../hometab/HomeTabMindRecordLazyItems.kt | 2 +- .../presentation/model/MindRecordCategory.kt | 15 +++++++++++++++ .../presentation/model/MindRecordCategoryUi.kt | 2 +- 12 files changed, 26 insertions(+), 23 deletions(-) delete mode 100644 core/model/src/main/kotlin/com/afternote/core/model/MindRecordCategory.kt rename {core/model/src/main/kotlin/com/afternote/core/model => feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase}/HomeSummary.kt (88%) create mode 100644 feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategory.kt diff --git a/app/src/androidTest/java/com/afternote/afternote_fe/AppAndReceiverCompletionAndroidTest.kt b/app/src/androidTest/java/com/afternote/afternote_fe/AppAndReceiverCompletionAndroidTest.kt index 3435509b55..1a5bc10532 100644 --- a/app/src/androidTest/java/com/afternote/afternote_fe/AppAndReceiverCompletionAndroidTest.kt +++ b/app/src/androidTest/java/com/afternote/afternote_fe/AppAndReceiverCompletionAndroidTest.kt @@ -40,7 +40,6 @@ import com.afternote.core.common.reporting.ErrorReporter import com.afternote.core.domain.error.InvalidLoginCredentialsException import com.afternote.core.domain.repository.UserProfileRepository import com.afternote.core.domain.repository.auth.AuthRepository -import com.afternote.core.model.MindRecordCategory import com.afternote.core.model.Session import com.afternote.core.ui.Route import com.afternote.core.ui.theme.AfternoteTheme @@ -49,6 +48,7 @@ import com.afternote.feature.afternote.domain.model.LeaveMessageBlock import com.afternote.feature.home.presentation.HomeTabActions import com.afternote.feature.mindrecord.domain.model.ReceiverMindRecords import com.afternote.feature.mindrecord.domain.repository.MindRecordReceiverRepository +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import com.afternote.feature.receiver.domain.error.ReceiverEmailAuthException import com.afternote.feature.receiver.domain.model.AfterNoteListItem import com.afternote.feature.receiver.domain.model.AfterNotesListResult diff --git a/app/src/main/java/com/afternote/afternote_fe/navigation/AppNavigationActions.kt b/app/src/main/java/com/afternote/afternote_fe/navigation/AppNavigationActions.kt index 2b706fe469..9dc8e04c7a 100644 --- a/app/src/main/java/com/afternote/afternote_fe/navigation/AppNavigationActions.kt +++ b/app/src/main/java/com/afternote/afternote_fe/navigation/AppNavigationActions.kt @@ -5,13 +5,13 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.rememberUpdatedState import androidx.navigation.NavController -import com.afternote.core.model.MindRecordCategory import com.afternote.core.ui.Route import com.afternote.core.ui.bottombar.BottomNavTab import com.afternote.feature.afternote.presentation.author.editor.model.EditorCategory import com.afternote.feature.afternote.presentation.author.navigation.AfternoteNavActions import com.afternote.feature.afternote.presentation.author.navigation.model.AfternoteRoute import com.afternote.feature.home.presentation.HomeTabActions +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import com.afternote.feature.mindrecord.presentation.navigation.MindRecordNavActions import com.afternote.feature.mindrecord.presentation.navigation.MindRecordRoute import com.afternote.feature.onboarding.presentation.navigation.OnboardingNavActions diff --git a/core/model/src/main/kotlin/com/afternote/core/model/MindRecordCategory.kt b/core/model/src/main/kotlin/com/afternote/core/model/MindRecordCategory.kt deleted file mode 100644 index 15d271ea00..0000000000 --- a/core/model/src/main/kotlin/com/afternote/core/model/MindRecordCategory.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.afternote.core.model - -/** - * 마음의 기록 카테고리. - * - * UI 리소스(아이콘·표시 문자열)는 피처 모듈에서 확장 프로퍼티로 제공한다. - */ -enum class MindRecordCategory { - DAILY_QUESTION, - DIARY, - WEEKLY_REPORT, -} diff --git a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabScreen.kt b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabScreen.kt index 63e8d05af6..3c4e761cd8 100644 --- a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabScreen.kt +++ b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabScreen.kt @@ -23,7 +23,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import com.afternote.core.model.MindRecordCategory import com.afternote.core.ui.AfternoteOutlinedCard import com.afternote.core.ui.AfternoteSectionHeader import com.afternote.core.ui.badge.RecipientDesignationBadge @@ -34,6 +33,7 @@ import com.afternote.core.ui.theme.AfternoteTheme import com.afternote.core.ui.topbar.HomeTopBar import com.afternote.feature.mindrecord.presentation.hometab.homeTabMindRecordMemoriesSection import com.afternote.feature.mindrecord.presentation.hometab.homeTabMindRecordQuestionAndCategories +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import java.time.LocalDate import java.time.format.DateTimeFormatter diff --git a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabViewModel.kt b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabViewModel.kt index bf2abcc3ef..90adebc021 100644 --- a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabViewModel.kt +++ b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/HomeTabViewModel.kt @@ -5,11 +5,11 @@ import androidx.lifecycle.viewModelScope import com.afternote.core.common.reporting.ErrorReporter import com.afternote.core.common.result.runCatchingCancellable import com.afternote.core.domain.repository.UserProfileRepository -import com.afternote.core.model.HomeSummary -import com.afternote.core.model.MindRecordCategory import com.afternote.feature.home.presentation.reporting.HomeFailureStage import com.afternote.feature.home.presentation.reporting.recordHomeFailure import com.afternote.feature.home.presentation.usecase.GetHomeSummaryUseCase +import com.afternote.feature.home.presentation.usecase.HomeSummary +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow diff --git a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/GetHomeSummaryUseCase.kt b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/GetHomeSummaryUseCase.kt index f5951d4712..2e4ac15a3b 100644 --- a/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/GetHomeSummaryUseCase.kt +++ b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/GetHomeSummaryUseCase.kt @@ -2,7 +2,7 @@ package com.afternote.feature.home.presentation.usecase import com.afternote.core.common.result.runCatchingCancellable import com.afternote.core.domain.repository.UserRepository -import com.afternote.core.model.HomeSummary +import com.afternote.feature.home.presentation.usecase.HomeSummary import com.afternote.feature.mindrecord.domain.repository.DailyQuestionRepository import com.afternote.feature.mindrecord.domain.repository.DiaryRepository import kotlinx.coroutines.async diff --git a/core/model/src/main/kotlin/com/afternote/core/model/HomeSummary.kt b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/HomeSummary.kt similarity index 88% rename from core/model/src/main/kotlin/com/afternote/core/model/HomeSummary.kt rename to feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/HomeSummary.kt index 690beb50ff..3e43634039 100644 --- a/core/model/src/main/kotlin/com/afternote/core/model/HomeSummary.kt +++ b/feature/home/presentation/src/main/kotlin/com/afternote/feature/home/presentation/usecase/HomeSummary.kt @@ -1,4 +1,4 @@ -package com.afternote.core.model +package com.afternote.feature.home.presentation.usecase data class HomeSummary( val userName: String, diff --git a/feature/home/presentation/src/screenshotTest/kotlin/com/afternote/feature/home/presentation/HomeTabScreenScreenshotTest.kt b/feature/home/presentation/src/screenshotTest/kotlin/com/afternote/feature/home/presentation/HomeTabScreenScreenshotTest.kt index 51c269caf4..928cb7accf 100644 --- a/feature/home/presentation/src/screenshotTest/kotlin/com/afternote/feature/home/presentation/HomeTabScreenScreenshotTest.kt +++ b/feature/home/presentation/src/screenshotTest/kotlin/com/afternote/feature/home/presentation/HomeTabScreenScreenshotTest.kt @@ -2,8 +2,8 @@ package com.afternote.feature.home.presentation import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview -import com.afternote.core.model.MindRecordCategory import com.afternote.core.ui.theme.AfternoteTheme +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import com.android.tools.screenshot.PreviewTest /** diff --git a/feature/home/presentation/src/test/kotlin/com/afternote/feature/home/presentation/HomeTabViewModelTest.kt b/feature/home/presentation/src/test/kotlin/com/afternote/feature/home/presentation/HomeTabViewModelTest.kt index bc1e219bb8..5ef0464a5a 100644 --- a/feature/home/presentation/src/test/kotlin/com/afternote/feature/home/presentation/HomeTabViewModelTest.kt +++ b/feature/home/presentation/src/test/kotlin/com/afternote/feature/home/presentation/HomeTabViewModelTest.kt @@ -3,7 +3,6 @@ package com.afternote.feature.home.presentation import com.afternote.core.common.reporting.ErrorReporter import com.afternote.core.domain.repository.UserProfileRepository import com.afternote.core.domain.repository.UserRepository -import com.afternote.core.model.MindRecordCategory import com.afternote.core.model.delivery.DeliveryConditionItem import com.afternote.core.model.delivery.ReceiverDeliveryConditions import com.afternote.core.model.user.Receiver @@ -22,6 +21,7 @@ import com.afternote.feature.mindrecord.domain.model.DiaryUpdatePayload import com.afternote.feature.mindrecord.domain.model.TodayDailyQuestion import com.afternote.feature.mindrecord.domain.repository.DailyQuestionRepository import com.afternote.feature.mindrecord.domain.repository.DiaryRepository +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/hometab/HomeTabMindRecordLazyItems.kt b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/hometab/HomeTabMindRecordLazyItems.kt index ca9f33b806..3193959fe3 100644 --- a/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/hometab/HomeTabMindRecordLazyItems.kt +++ b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/hometab/HomeTabMindRecordLazyItems.kt @@ -22,7 +22,6 @@ import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.Lifecycle import androidx.lifecycle.compose.LifecycleEventEffect import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.afternote.core.model.MindRecordCategory import com.afternote.core.ui.AfternoteSectionHeader import com.afternote.core.ui.theme.AfternoteTheme import com.afternote.feature.mindrecord.presentation.R.string.mindrecord_home_tab_memories_section_click_label @@ -30,6 +29,7 @@ import com.afternote.feature.mindrecord.presentation.R.string.mindrecord_home_ta import com.afternote.feature.mindrecord.presentation.component.MemoriesCard import com.afternote.feature.mindrecord.presentation.component.TodayQuestionCard import com.afternote.feature.mindrecord.presentation.component.hometab.RecordCategoryCard +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import com.afternote.feature.mindrecord.presentation.model.MindRecordCategoryUi import com.afternote.feature.mindrecord.presentation.util.htmlToPlainText import com.afternote.feature.mindrecord.presentation.viewmodel.MemoriesCardViewModel diff --git a/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategory.kt b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategory.kt new file mode 100644 index 0000000000..b9b36c09b2 --- /dev/null +++ b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategory.kt @@ -0,0 +1,15 @@ +package com.afternote.feature.mindrecord.presentation.model + +/** + * 마음의 기록 카테고리. + * + * 표시용 아이콘·문구는 같은 패키지의 [MindRecordCategoryUi] 가 들고 있다. + * + * 이 타입을 아는 모듈은 홈·마음의 기록·app 셋뿐이라 core:model(11개 모듈이 의존)에 두지 + * 않는다. 셋 다 이미 이 모듈에 의존하고 있어 새 모듈 의존이 생기지 않는다 (#1085). + */ +enum class MindRecordCategory { + DAILY_QUESTION, + DIARY, + WEEKLY_REPORT, +} diff --git a/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategoryUi.kt b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategoryUi.kt index b23dc31929..66aa9287b1 100644 --- a/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategoryUi.kt +++ b/feature/mindrecord/presentation/src/main/kotlin/com/afternote/feature/mindrecord/presentation/model/MindRecordCategoryUi.kt @@ -12,8 +12,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.afternote.core.model.MindRecordCategory import com.afternote.feature.mindrecord.presentation.R +import com.afternote.feature.mindrecord.presentation.model.MindRecordCategory import com.afternote.core.ui.R as CoreUiR sealed class MindRecordCategoryUi(