From 62ab30f35bb4eccdc29df9832054f834b78023aa Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 16:58:37 +0900 Subject: [PATCH 01/25] =?UTF-8?q?=F0=9F=8D=B1=20Chore:=20string=20?= =?UTF-8?q?=EB=A6=AC=EC=86=8C=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/design-system/src/main/res/values/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/design-system/src/main/res/values/strings.xml b/core/design-system/src/main/res/values/strings.xml index c9901cfa..6d41963e 100644 --- a/core/design-system/src/main/res/values/strings.xml +++ b/core/design-system/src/main/res/values/strings.xml @@ -38,5 +38,6 @@ 종료 날짜가 시작 날짜보다 이전입니다. 목표 조회에 실패했습니다. + 목표 생성에 실패했습니다. \ No newline at end of file From c3b0ca12d04afd493d7ce3c8b4168500556dd07c Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 16:59:41 +0900 Subject: [PATCH 02/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20CreateGoalResponse=20?= =?UTF-8?q?->=20CreatedGoal=20Mapper=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/response/goal/mapper/GoalMapper.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/network/src/main/java/com/twix/network/model/response/goal/mapper/GoalMapper.kt b/core/network/src/main/java/com/twix/network/model/response/goal/mapper/GoalMapper.kt index 715c671d..6ef6d1a1 100644 --- a/core/network/src/main/java/com/twix/network/model/response/goal/mapper/GoalMapper.kt +++ b/core/network/src/main/java/com/twix/network/model/response/goal/mapper/GoalMapper.kt @@ -2,12 +2,15 @@ package com.twix.network.model.response.goal.mapper import com.twix.domain.model.enums.GoalIconType import com.twix.domain.model.enums.RepeatCycle +import com.twix.domain.model.goal.CreatedGoal import com.twix.domain.model.goal.Goal import com.twix.domain.model.goal.GoalList import com.twix.domain.model.goal.GoalVerification +import com.twix.network.model.response.goal.model.CreateGoalResponse import com.twix.network.model.response.goal.model.GoalListResponse import com.twix.network.model.response.goal.model.GoalResponse import com.twix.network.model.response.goal.model.VerificationResponse +import java.time.LocalDate fun GoalListResponse.toDomain(): GoalList = GoalList( @@ -36,3 +39,15 @@ fun VerificationResponse.toDomainOrNull(): GoalVerification? = reaction = reaction, uploadedAt = uploadedAt, ) + +fun CreateGoalResponse.toDomain(): CreatedGoal = + CreatedGoal( + goalId = goalId, + name = name, + icon = GoalIconType.fromApi(icon), + repeatCycle = RepeatCycle.fromApi(repeatCycle), + repeatCount = repeatCount, + startDate = LocalDate.parse(startDate), + endDate = endDate?.let(LocalDate::parse), + createdAt = createdAt, + ) From baa20ae7f71753abde503f71c5ca9a1ce270ebec Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:00:04 +0900 Subject: [PATCH 03/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20API=20=ED=86=B5=EC=8B=A0=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/twix/network/service/GoalService.kt | 9 +++++++++ .../com/twix/data/repository/DefaultGoalRepository.kt | 8 ++++++++ .../java/com/twix/domain/repository/GoalRepository.kt | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/core/network/src/main/java/com/twix/network/service/GoalService.kt b/core/network/src/main/java/com/twix/network/service/GoalService.kt index 8ff116e7..3a46205d 100644 --- a/core/network/src/main/java/com/twix/network/service/GoalService.kt +++ b/core/network/src/main/java/com/twix/network/service/GoalService.kt @@ -1,7 +1,11 @@ package com.twix.network.service +import com.twix.network.model.request.goal.model.CreateGoalRequest +import com.twix.network.model.response.goal.model.CreateGoalResponse import com.twix.network.model.response.goal.model.GoalListResponse +import de.jensklingenberg.ktorfit.http.Body import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST import de.jensklingenberg.ktorfit.http.Query interface GoalService { @@ -9,4 +13,9 @@ interface GoalService { suspend fun fetchGoals( @Query("date") date: String, ): GoalListResponse + + @POST("api/v1/goals") + suspend fun createGoal( + @Body body: CreateGoalRequest, + ): CreateGoalResponse } diff --git a/data/src/main/java/com/twix/data/repository/DefaultGoalRepository.kt b/data/src/main/java/com/twix/data/repository/DefaultGoalRepository.kt index f145b393..1cf57d01 100644 --- a/data/src/main/java/com/twix/data/repository/DefaultGoalRepository.kt +++ b/data/src/main/java/com/twix/data/repository/DefaultGoalRepository.kt @@ -1,8 +1,11 @@ package com.twix.data.repository +import com.twix.domain.model.goal.CreateGoalParam +import com.twix.domain.model.goal.CreatedGoal import com.twix.domain.model.goal.GoalList import com.twix.domain.repository.GoalRepository import com.twix.network.execute.safeApiCall +import com.twix.network.model.request.goal.mapper.toRequest import com.twix.network.model.response.goal.mapper.toDomain import com.twix.network.service.GoalService import com.twix.result.AppResult @@ -11,4 +14,9 @@ class DefaultGoalRepository( private val service: GoalService, ) : GoalRepository { override suspend fun fetchGoalList(date: String): AppResult = safeApiCall { service.fetchGoals(date).toDomain() } + + override suspend fun createGoal(param: CreateGoalParam): AppResult = + safeApiCall { + service.createGoal(param.toRequest()).toDomain() + } } diff --git a/domain/src/main/java/com/twix/domain/repository/GoalRepository.kt b/domain/src/main/java/com/twix/domain/repository/GoalRepository.kt index be0958f9..c79b7732 100644 --- a/domain/src/main/java/com/twix/domain/repository/GoalRepository.kt +++ b/domain/src/main/java/com/twix/domain/repository/GoalRepository.kt @@ -1,8 +1,12 @@ package com.twix.domain.repository +import com.twix.domain.model.goal.CreateGoalParam +import com.twix.domain.model.goal.CreatedGoal import com.twix.domain.model.goal.GoalList import com.twix.result.AppResult interface GoalRepository { suspend fun fetchGoalList(date: String): AppResult + + suspend fun createGoal(param: CreateGoalParam): AppResult } From 2910aebdbe5646e1968ff1922492e5812573da0b Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:00:22 +0900 Subject: [PATCH 04/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20toApi=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/twix/domain/model/enums/GoalIconType.kt | 12 ++++++++++++ .../java/com/twix/domain/model/enums/RepeatCycle.kt | 2 ++ 2 files changed, 14 insertions(+) diff --git a/domain/src/main/java/com/twix/domain/model/enums/GoalIconType.kt b/domain/src/main/java/com/twix/domain/model/enums/GoalIconType.kt index 0f4870e4..7e5a84bc 100644 --- a/domain/src/main/java/com/twix/domain/model/enums/GoalIconType.kt +++ b/domain/src/main/java/com/twix/domain/model/enums/GoalIconType.kt @@ -11,6 +11,18 @@ enum class GoalIconType { LAPTOP, ; + fun toApi(): String = + when (this) { + DEFAULT -> "ICON_DEFAULT" + CLEAN -> "ICON_CLEAN" + EXERCISE -> "ICON_EXERCISE" + BOOK -> "ICON_BOOK" + PENCIL -> "ICON_PENCIL" + HEALTH -> "ICON_HEALTH" + HEART -> "ICON_HEART" + LAPTOP -> "ICON_LAPTOP" + } + companion object { fun fromApi(icon: String): GoalIconType = when (icon) { diff --git a/domain/src/main/java/com/twix/domain/model/enums/RepeatCycle.kt b/domain/src/main/java/com/twix/domain/model/enums/RepeatCycle.kt index 2931eaf9..5948f781 100644 --- a/domain/src/main/java/com/twix/domain/model/enums/RepeatCycle.kt +++ b/domain/src/main/java/com/twix/domain/model/enums/RepeatCycle.kt @@ -6,6 +6,8 @@ enum class RepeatCycle { MONTHLY, ; + fun toApi(): String = name + companion object { fun fromApi(value: String): RepeatCycle = runCatching { valueOf(value) }.getOrElse { DAILY } } From 894382504219ac09bfebb313bbcb1c34b4a950b1 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:00:39 +0900 Subject: [PATCH 05/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20tryEmit=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/ui/src/main/java/com/twix/ui/base/SideEffectHolder.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/ui/src/main/java/com/twix/ui/base/SideEffectHolder.kt b/core/ui/src/main/java/com/twix/ui/base/SideEffectHolder.kt index 83d09440..8db5436a 100644 --- a/core/ui/src/main/java/com/twix/ui/base/SideEffectHolder.kt +++ b/core/ui/src/main/java/com/twix/ui/base/SideEffectHolder.kt @@ -10,4 +10,8 @@ class SideEffectHolder { suspend fun emit(effect: S) { channel.send(effect) } + + fun tryEmit(effect: S) { + channel.trySend(effect) + } } From 87f24953d4f5760b9d40cfa5b1a3644d70e4dc8e Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:00:51 +0900 Subject: [PATCH 06/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20tryEmitSideEffect=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt b/core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt index 09b49864..8334db70 100644 --- a/core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt +++ b/core/ui/src/main/java/com/twix/ui/base/BaseViewModel.kt @@ -69,6 +69,10 @@ abstract class BaseViewModel( sideEffectHolder.emit(effect) } + protected fun tryEmitSideEffect(effect: SE) { + sideEffectHolder.tryEmit(effect) + } + /** * Intent를 처리하는 메서드 * */ From 06ea3cc4980ca13fb8412324534bc4d23ddf9a51 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:01:16 +0900 Subject: [PATCH 07/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=B9=84=EC=A6=88=EB=8B=88=EC=8A=A4=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../twix/goal_editor/GoalEditorViewModel.kt | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt index ce841bac..3a23cb31 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt @@ -5,13 +5,16 @@ import com.twix.designsystem.R import com.twix.designsystem.components.toast.model.ToastType import com.twix.domain.model.enums.GoalIconType import com.twix.domain.model.enums.RepeatCycle +import com.twix.domain.model.goal.CreateGoalParam +import com.twix.domain.repository.GoalRepository import com.twix.goal_editor.model.GoalEditorUiState import com.twix.ui.base.BaseViewModel import kotlinx.coroutines.launch import java.time.LocalDate -class GoalEditorViewModel : - BaseViewModel( +class GoalEditorViewModel( + private val goalRepository: GoalRepository, +) : BaseViewModel( GoalEditorUiState(), ) { override suspend fun handleIntent(intent: GoalEditorIntent) { @@ -68,5 +71,21 @@ class GoalEditorViewModel : } return } + + launchResult( + block = { goalRepository.createGoal(currentState.toCreateParam()) }, + onSuccess = { tryEmitSideEffect(GoalEditorSideEffect.NavigateToHome) }, + onError = { emitSideEffect(GoalEditorSideEffect.ShowToast(R.string.toast_create_goal_failed, ToastType.ERROR)) }, + ) } + + private fun GoalEditorUiState.toCreateParam(): CreateGoalParam = + CreateGoalParam( + name = goalTitle.trim(), + icon = selectedIcon, + repeatCycle = selectedRepeatCycle, + repeatCount = repeatCount, + startDate = startDate, + endDate = if (endDateEnabled) endDate else null, + ) } From ec73e2e6278e473ef2aaddfd2d0b8c444096de82 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:01:33 +0900 Subject: [PATCH 08/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=9D=B4=ED=9B=84=20=ED=99=88=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=9C=BC=EB=A1=9C=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/twix/goal_editor/GoalEditorScreen.kt | 1 + .../src/main/java/com/twix/goal_editor/GoalEditorSideEffect.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt index 13fce06a..fa799e8b 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt @@ -85,6 +85,7 @@ fun GoalEditorRoute( viewModel.sideEffect.collect { effect -> when (effect) { is GoalEditorSideEffect.ShowToast -> toastManager.tryShow(ToastData(currentContext.getString(effect.resId), effect.type)) + is GoalEditorSideEffect.NavigateToHome -> navigateToBack() } } } diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorSideEffect.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorSideEffect.kt index 6e2fcd2a..0594cdb3 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorSideEffect.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorSideEffect.kt @@ -9,4 +9,6 @@ interface GoalEditorSideEffect : SideEffect { @param:StringRes val resId: Int, val type: ToastType, ) : GoalEditorSideEffect + + object NavigateToHome : GoalEditorSideEffect } From 2dd4a5deb5523ded9ca7d2375ff83d32ee85ee21 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:06:26 +0900 Subject: [PATCH 09/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=A6=AC=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EA=B0=B1=EC=8B=A0=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/main/src/main/java/com/twix/home/HomeIntent.kt | 2 ++ feature/main/src/main/java/com/twix/home/HomeScreen.kt | 5 +++++ feature/main/src/main/java/com/twix/home/HomeViewModel.kt | 1 + 3 files changed, 8 insertions(+) diff --git a/feature/main/src/main/java/com/twix/home/HomeIntent.kt b/feature/main/src/main/java/com/twix/home/HomeIntent.kt index d41c316a..07204904 100644 --- a/feature/main/src/main/java/com/twix/home/HomeIntent.kt +++ b/feature/main/src/main/java/com/twix/home/HomeIntent.kt @@ -17,4 +17,6 @@ sealed interface HomeIntent : Intent { data class UpdateVisibleDate( val date: LocalDate, ) : HomeIntent + + data object RefreshGoals : HomeIntent } diff --git a/feature/main/src/main/java/com/twix/home/HomeScreen.kt b/feature/main/src/main/java/com/twix/home/HomeScreen.kt index 422138df..fe51e912 100644 --- a/feature/main/src/main/java/com/twix/home/HomeScreen.kt +++ b/feature/main/src/main/java/com/twix/home/HomeScreen.kt @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -39,6 +40,10 @@ fun HomeRoute( ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() + LaunchedEffect(Unit) { + viewModel + } + HomeScreen( uiState = uiState, onSelectDate = { viewModel.dispatch(HomeIntent.SelectDate(it)) }, diff --git a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt index 66465446..93b66ec8 100644 --- a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt +++ b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt @@ -51,6 +51,7 @@ class HomeViewModel( HomeIntent.PreviousWeek -> shiftWeek(WeekNavigation.PREVIOUS) HomeIntent.MoveToToday -> shiftWeek(WeekNavigation.TODAY) is HomeIntent.UpdateVisibleDate -> updateVisibleDate(intent.date) + HomeIntent.RefreshGoals -> fetchGoalList() } } From 32ab8d2525d55873bfa1a75b89dd0066358478db Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:06:58 +0900 Subject: [PATCH 10/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20CreateGoalParam=20->?= =?UTF-8?q?=20CreateGoalRequest=20Mapper=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/request/goal/mapper/GoalMapper.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 core/network/src/main/java/com/twix/network/model/request/goal/mapper/GoalMapper.kt diff --git a/core/network/src/main/java/com/twix/network/model/request/goal/mapper/GoalMapper.kt b/core/network/src/main/java/com/twix/network/model/request/goal/mapper/GoalMapper.kt new file mode 100644 index 00000000..c93d9a12 --- /dev/null +++ b/core/network/src/main/java/com/twix/network/model/request/goal/mapper/GoalMapper.kt @@ -0,0 +1,14 @@ +package com.twix.network.model.request.goal.mapper + +import com.twix.domain.model.goal.CreateGoalParam +import com.twix.network.model.request.goal.model.CreateGoalRequest + +fun CreateGoalParam.toRequest(): CreateGoalRequest = + CreateGoalRequest( + name = name, + icon = icon.toApi(), + repeatCycle = repeatCycle.toApi(), + repeatCount = repeatCount, + startDate = startDate.toString(), + endDate = endDate?.toString(), + ) From d8063efba42dd9808d11298942e151a005c5eac3 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:07:22 +0900 Subject: [PATCH 11/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20DTO,=20Domain=20Model=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/request/goal/model/CreateGoalRequest.kt | 14 ++++++++++++++ .../com/twix/domain/model/goal/CreateGoalParam.kt | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 core/network/src/main/java/com/twix/network/model/request/goal/model/CreateGoalRequest.kt create mode 100644 domain/src/main/java/com/twix/domain/model/goal/CreateGoalParam.kt diff --git a/core/network/src/main/java/com/twix/network/model/request/goal/model/CreateGoalRequest.kt b/core/network/src/main/java/com/twix/network/model/request/goal/model/CreateGoalRequest.kt new file mode 100644 index 00000000..f5c8c602 --- /dev/null +++ b/core/network/src/main/java/com/twix/network/model/request/goal/model/CreateGoalRequest.kt @@ -0,0 +1,14 @@ +package com.twix.network.model.request.goal.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CreateGoalRequest( + @SerialName("name") val name: String, + @SerialName("icon") val icon: String, + @SerialName("repeatCycle") val repeatCycle: String, + @SerialName("repeatCount") val repeatCount: Int, + @SerialName("startDate") val startDate: String, + @SerialName("endDate") val endDate: String?, +) diff --git a/domain/src/main/java/com/twix/domain/model/goal/CreateGoalParam.kt b/domain/src/main/java/com/twix/domain/model/goal/CreateGoalParam.kt new file mode 100644 index 00000000..b4a0bee7 --- /dev/null +++ b/domain/src/main/java/com/twix/domain/model/goal/CreateGoalParam.kt @@ -0,0 +1,14 @@ +package com.twix.domain.model.goal + +import com.twix.domain.model.enums.GoalIconType +import com.twix.domain.model.enums.RepeatCycle +import java.time.LocalDate + +data class CreateGoalParam( + val name: String, + val icon: GoalIconType, + val repeatCycle: RepeatCycle, + val repeatCount: Int, + val startDate: LocalDate, + val endDate: LocalDate?, +) From 965d4a9564771c56380435e16583a874b7e6cb69 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:07:35 +0900 Subject: [PATCH 12/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=9D=91=EB=8B=B5=20DTO=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/goal/model/CreateGoalResponse.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 core/network/src/main/java/com/twix/network/model/response/goal/model/CreateGoalResponse.kt diff --git a/core/network/src/main/java/com/twix/network/model/response/goal/model/CreateGoalResponse.kt b/core/network/src/main/java/com/twix/network/model/response/goal/model/CreateGoalResponse.kt new file mode 100644 index 00000000..7150b5a6 --- /dev/null +++ b/core/network/src/main/java/com/twix/network/model/response/goal/model/CreateGoalResponse.kt @@ -0,0 +1,17 @@ +package com.twix.network.model.response.goal.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class CreateGoalResponse( + @SerialName("goalId") val goalId: Long, + @SerialName("name") val name: String, + @SerialName("icon") val icon: String, + @SerialName("repeatCycle") val repeatCycle: String, + @SerialName("repeatCount") val repeatCount: Int, + @SerialName("startDate") val startDate: String, + @SerialName("endDate") val endDate: String?, + @SerialName("goalStatus") val goalStatus: String, + @SerialName("createdAt") val createdAt: String, +) From 866326a626bd6956e403adb6e482daa06f10a94f Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:07:50 +0900 Subject: [PATCH 13/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20=EB=AA=A9=ED=91=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=9D=91=EB=8B=B5=20Domain=20Model=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/twix/domain/model/goal/CreatedGoal.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 domain/src/main/java/com/twix/domain/model/goal/CreatedGoal.kt diff --git a/domain/src/main/java/com/twix/domain/model/goal/CreatedGoal.kt b/domain/src/main/java/com/twix/domain/model/goal/CreatedGoal.kt new file mode 100644 index 00000000..fdb95343 --- /dev/null +++ b/domain/src/main/java/com/twix/domain/model/goal/CreatedGoal.kt @@ -0,0 +1,16 @@ +package com.twix.domain.model.goal + +import com.twix.domain.model.enums.GoalIconType +import com.twix.domain.model.enums.RepeatCycle +import java.time.LocalDate + +data class CreatedGoal( + val goalId: Long, + val name: String, + val icon: GoalIconType, + val repeatCycle: RepeatCycle, + val repeatCount: Int, + val startDate: LocalDate, + val endDate: LocalDate?, + val createdAt: String, +) From d181776b7905618ed46425b4aaeac617dca3e506 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:09:02 +0900 Subject: [PATCH 14/25] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20Init=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20LaunchedEffect=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/main/src/main/java/com/twix/home/HomeScreen.kt | 2 +- feature/main/src/main/java/com/twix/home/HomeViewModel.kt | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/feature/main/src/main/java/com/twix/home/HomeScreen.kt b/feature/main/src/main/java/com/twix/home/HomeScreen.kt index fe51e912..5024cc5e 100644 --- a/feature/main/src/main/java/com/twix/home/HomeScreen.kt +++ b/feature/main/src/main/java/com/twix/home/HomeScreen.kt @@ -41,7 +41,7 @@ fun HomeRoute( val uiState by viewModel.uiState.collectAsStateWithLifecycle() LaunchedEffect(Unit) { - viewModel + viewModel.dispatch(HomeIntent.RefreshGoals) } HomeScreen( diff --git a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt index 93b66ec8..36760e29 100644 --- a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt +++ b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt @@ -40,10 +40,6 @@ class HomeViewModel( ), ) - init { - fetchGoalList() - } - override suspend fun handleIntent(intent: HomeIntent) { when (intent) { is HomeIntent.SelectDate -> updateDate(intent.date) From 26b8450d06b34701a93d0fe129d22f54ea777fbc Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:13:20 +0900 Subject: [PATCH 15/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20safeContentPadding=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/yapp/twix/main/MainActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/yapp/twix/main/MainActivity.kt b/app/src/main/java/com/yapp/twix/main/MainActivity.kt index 81e672c9..501149bc 100644 --- a/app/src/main/java/com/yapp/twix/main/MainActivity.kt +++ b/app/src/main/java/com/yapp/twix/main/MainActivity.kt @@ -6,6 +6,7 @@ import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.safeContentPadding import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.core.view.WindowCompat @@ -30,7 +31,8 @@ class MainActivity : ComponentActivity() { Box( modifier = Modifier - .fillMaxSize(), + .fillMaxSize() + .safeContentPadding(), ) { AppNavHost() From 481e9a61c6ad82be6b0b80c0f10a0d576ebdbdb2 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:13:53 +0900 Subject: [PATCH 16/25] =?UTF-8?q?=F0=9F=94=A5=20Remove:=20=EB=8D=94?= =?UTF-8?q?=EB=AF=B8=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/twix/home/model/HomeUiState.kt | 75 +------------------ 1 file changed, 1 insertion(+), 74 deletions(-) diff --git a/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt b/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt index 90b34936..bf948ad9 100644 --- a/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt +++ b/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt @@ -17,80 +17,7 @@ data class HomeUiState( val visibleDate: LocalDate = LocalDate.now(), // 홈 화면 상단에 존재하는 월, 년 텍스트를 위한 상태 변수 val selectedDate: LocalDate = LocalDate.now(), val referenceDate: LocalDate = LocalDate.now(), // 7일 달력을 생성하기 위한 레퍼런스 날짜 - val goalList: GoalList = - GoalList( - goals = - listOf( - Goal( - goalId = 1, - name = "운동", - icon = GoalIconType.EXERCISE, - repeatCycle = RepeatCycle.WEEKLY, - myCompleted = true, - partnerCompleted = false, - myVerification = null, - partnerVerification = null, - ), - Goal( - goalId = 2, - name = "운동", - icon = GoalIconType.EXERCISE, - repeatCycle = RepeatCycle.WEEKLY, - myCompleted = true, - partnerCompleted = false, - myVerification = - GoalVerification( - photologId = 1, - imageUrl = "https://picsum.photos/400/300", - comment = null, - reaction = GoalReactionType.LOVE, - uploadedAt = "2023-05-05", - ), - partnerVerification = null, - ), - Goal( - goalId = 3, - name = "잠자기", - icon = GoalIconType.HEART, - repeatCycle = RepeatCycle.WEEKLY, - myCompleted = false, - partnerCompleted = true, - myVerification = null, - partnerVerification = - GoalVerification( - photologId = 1, - imageUrl = "https://picsum.photos/400/300", - comment = null, - reaction = GoalReactionType.LOVE, - uploadedAt = "2023-05-05", - ), - ), - Goal( - goalId = 4, - name = "밥무라", - icon = GoalIconType.DEFAULT, - repeatCycle = RepeatCycle.WEEKLY, - myCompleted = true, - partnerCompleted = true, - myVerification = - GoalVerification( - photologId = 1, - imageUrl = "https://picsum.photos/400/300", - comment = null, - reaction = GoalReactionType.LOVE, - uploadedAt = "2023-05-05", - ), - partnerVerification = - GoalVerification( - photologId = 1, - imageUrl = "https://picsum.photos/400/300", - comment = null, - reaction = GoalReactionType.LOVE, - uploadedAt = "2023-05-05", - ), - ), - ), - ), + val goalList: GoalList = GoalList(), ) : State { val monthYear: String get() = "${visibleDate.month.value}월 ${visibleDate.year}" From f552e5f5fd525a65c99fc6f0c6a1fc45bfb59490 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:34:30 +0900 Subject: [PATCH 17/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20UtilModule=20Koin=20?= =?UTF-8?q?=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/yapp/twix/di/InitKoin.kt | 2 ++ core/util/src/main/java/com/twix/util/di/UtilModule.kt | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 core/util/src/main/java/com/twix/util/di/UtilModule.kt diff --git a/app/src/main/java/com/yapp/twix/di/InitKoin.kt b/app/src/main/java/com/yapp/twix/di/InitKoin.kt index 54cea66b..2c333cef 100644 --- a/app/src/main/java/com/yapp/twix/di/InitKoin.kt +++ b/app/src/main/java/com/yapp/twix/di/InitKoin.kt @@ -4,6 +4,7 @@ import android.content.Context import com.twix.data.di.dataModule import com.twix.datastore.di.dataStoreModule import com.twix.network.di.networkModule +import com.twix.util.di.utilModule import org.koin.android.ext.koin.androidContext import org.koin.core.context.startKoin import org.koin.core.module.Module @@ -24,6 +25,7 @@ fun initKoin( add(uiModule) add(dataStoreModule) add(appModule) + add(utilModule) }, ) } diff --git a/core/util/src/main/java/com/twix/util/di/UtilModule.kt b/core/util/src/main/java/com/twix/util/di/UtilModule.kt new file mode 100644 index 00000000..0ad75b92 --- /dev/null +++ b/core/util/src/main/java/com/twix/util/di/UtilModule.kt @@ -0,0 +1,9 @@ +package com.twix.util.di + +import com.twix.util.bus.GoalRefreshBus +import org.koin.dsl.module + +val utilModule = + module { + single { GoalRefreshBus() } + } From 6c133f68dcb541ad4e62009875ebe0e86cda907f Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:34:42 +0900 Subject: [PATCH 18/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20GoalRefreshBus=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/twix/util/bus/GoalRefreshBus.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 core/util/src/main/java/com/twix/util/bus/GoalRefreshBus.kt diff --git a/core/util/src/main/java/com/twix/util/bus/GoalRefreshBus.kt b/core/util/src/main/java/com/twix/util/bus/GoalRefreshBus.kt new file mode 100644 index 00000000..c2fd72a6 --- /dev/null +++ b/core/util/src/main/java/com/twix/util/bus/GoalRefreshBus.kt @@ -0,0 +1,15 @@ +package com.twix.util.bus + +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.SharedFlow + +class GoalRefreshBus { + private val _events = + MutableSharedFlow( + replay = 0, + extraBufferCapacity = 1, + ) + val events: SharedFlow = _events + + fun notifyChanged() = _events.tryEmit(Unit) +} From 131448fd6147b7833c42a9352db40f354db95347 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:35:08 +0900 Subject: [PATCH 19/25] =?UTF-8?q?=F0=9F=94=A5=20Remove:=20RefreshIntent=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/main/src/main/java/com/twix/home/HomeIntent.kt | 2 -- feature/main/src/main/java/com/twix/home/HomeScreen.kt | 5 ----- 2 files changed, 7 deletions(-) diff --git a/feature/main/src/main/java/com/twix/home/HomeIntent.kt b/feature/main/src/main/java/com/twix/home/HomeIntent.kt index 07204904..d41c316a 100644 --- a/feature/main/src/main/java/com/twix/home/HomeIntent.kt +++ b/feature/main/src/main/java/com/twix/home/HomeIntent.kt @@ -17,6 +17,4 @@ sealed interface HomeIntent : Intent { data class UpdateVisibleDate( val date: LocalDate, ) : HomeIntent - - data object RefreshGoals : HomeIntent } diff --git a/feature/main/src/main/java/com/twix/home/HomeScreen.kt b/feature/main/src/main/java/com/twix/home/HomeScreen.kt index 37bb4a2c..9f02efd8 100644 --- a/feature/main/src/main/java/com/twix/home/HomeScreen.kt +++ b/feature/main/src/main/java/com/twix/home/HomeScreen.kt @@ -18,7 +18,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -54,10 +53,6 @@ fun HomeRoute( ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() - LaunchedEffect(Unit) { - viewModel.dispatch(HomeIntent.RefreshGoals) - } - HomeScreen( uiState = uiState, onSelectDate = { viewModel.dispatch(HomeIntent.SelectDate(it)) }, From 3cf16d6c7abf787b611dce7995cd8a16a6faf0ab Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:35:28 +0900 Subject: [PATCH 20/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20Koin=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/util/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/util/build.gradle.kts b/core/util/build.gradle.kts index 03c85182..53267b6b 100644 --- a/core/util/build.gradle.kts +++ b/core/util/build.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(libs.plugins.twix.android.library) + alias(libs.plugins.twix.koin) } android { From 9bf2f1f447a86dfce76c234c836cc9398806f6dc Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:35:52 +0900 Subject: [PATCH 21/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20:core:util=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/twix/convention/FeatureConventionPlugin.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/build-logic/convention/src/main/kotlin/com/twix/convention/FeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/com/twix/convention/FeatureConventionPlugin.kt index 8597f405..9d9f2715 100644 --- a/build-logic/convention/src/main/kotlin/com/twix/convention/FeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/com/twix/convention/FeatureConventionPlugin.kt @@ -15,6 +15,7 @@ class FeatureConventionPlugin : BuildLogicConventionPlugin({ implementation(project(":core:design-system")) implementation(project(":core:navigation")) implementation(project(":core:ui")) + implementation(project(":core:util")) implementation(project(":core:result")) implementation(project(":domain")) } From 81ec5102d6c1d68ae792b5eb1c46e4d37fc3f051 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:36:37 +0900 Subject: [PATCH 22/25] =?UTF-8?q?=F0=9F=94=A5=20Remove:=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/src/main/java/com/twix/home/model/HomeUiState.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt b/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt index bf948ad9..a411ad27 100644 --- a/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt +++ b/feature/main/src/main/java/com/twix/home/model/HomeUiState.kt @@ -1,12 +1,7 @@ package com.twix.home.model import androidx.compose.runtime.Immutable -import com.twix.domain.model.enums.GoalIconType -import com.twix.domain.model.enums.GoalReactionType -import com.twix.domain.model.enums.RepeatCycle -import com.twix.domain.model.goal.Goal import com.twix.domain.model.goal.GoalList -import com.twix.domain.model.goal.GoalVerification import com.twix.ui.base.State import java.time.LocalDate import java.time.YearMonth From 84715e32f20ee795eea6b3a16f474a691974f705 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:37:05 +0900 Subject: [PATCH 23/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20GoalRefreshBus=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=88=98=EC=A7=91=20=EB=B0=8F=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EC=B2=98=EB=A6=AC=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/twix/home/HomeViewModel.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt index 36760e29..db68185d 100644 --- a/feature/main/src/main/java/com/twix/home/HomeViewModel.kt +++ b/feature/main/src/main/java/com/twix/home/HomeViewModel.kt @@ -8,18 +8,31 @@ import com.twix.domain.repository.GoalRepository import com.twix.home.model.CalendarState import com.twix.home.model.HomeUiState import com.twix.ui.base.BaseViewModel +import com.twix.util.bus.GoalRefreshBus import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.launch import java.time.LocalDate class HomeViewModel( private val goalRepository: GoalRepository, + private val goalRefreshBus: GoalRefreshBus, ) : BaseViewModel( HomeUiState(), ) { + init { + fetchGoalList() + + viewModelScope.launch { + goalRefreshBus.events.collect { + fetchGoalList() + } + } + } + val calendarState: StateFlow = uiState .map { state -> @@ -47,7 +60,6 @@ class HomeViewModel( HomeIntent.PreviousWeek -> shiftWeek(WeekNavigation.PREVIOUS) HomeIntent.MoveToToday -> shiftWeek(WeekNavigation.TODAY) is HomeIntent.UpdateVisibleDate -> updateVisibleDate(intent.date) - HomeIntent.RefreshGoals -> fetchGoalList() } } From 56be48f46b0f38ac7099842e7be9e9d23b02f028 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:37:45 +0900 Subject: [PATCH 24/25] =?UTF-8?q?=E2=9C=A8=20Feat:=20GoalRefreshBus=20emit?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/twix/goal_editor/GoalEditorViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt index 3a23cb31..75df69d0 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorViewModel.kt @@ -9,11 +9,13 @@ import com.twix.domain.model.goal.CreateGoalParam import com.twix.domain.repository.GoalRepository import com.twix.goal_editor.model.GoalEditorUiState import com.twix.ui.base.BaseViewModel +import com.twix.util.bus.GoalRefreshBus import kotlinx.coroutines.launch import java.time.LocalDate class GoalEditorViewModel( private val goalRepository: GoalRepository, + private val goalRefreshBus: GoalRefreshBus, ) : BaseViewModel( GoalEditorUiState(), ) { @@ -41,7 +43,7 @@ class GoalEditorViewModel( } private fun setRepeatType(repeatCycle: RepeatCycle) { - reduce { copy(selectedRepeatCycle = repeatCycle) } + reduce { copy(selectedRepeatCycle = repeatCycle, repeatCount = 1) } } private fun setRepeatCount(repeatCount: Int) { @@ -74,7 +76,10 @@ class GoalEditorViewModel( launchResult( block = { goalRepository.createGoal(currentState.toCreateParam()) }, - onSuccess = { tryEmitSideEffect(GoalEditorSideEffect.NavigateToHome) }, + onSuccess = { + goalRefreshBus.notifyChanged() + tryEmitSideEffect(GoalEditorSideEffect.NavigateToHome) + }, onError = { emitSideEffect(GoalEditorSideEffect.ShowToast(R.string.toast_create_goal_failed, ToastType.ERROR)) }, ) } From 3a537283912363b0fcba6155a622e3557f1720d5 Mon Sep 17 00:00:00 2001 From: dogmania Date: Mon, 9 Feb 2026 17:38:13 +0900 Subject: [PATCH 25/25] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20repeatCo?= =?UTF-8?q?unt=20=EA=B8=B0=EB=B3=B8=EA=B0=92=201=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/twix/goal_editor/GoalEditorScreen.kt | 4 ++-- .../main/java/com/twix/goal_editor/model/GoalEditorUiState.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt index fa799e8b..6c0eb452 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/GoalEditorScreen.kt @@ -318,7 +318,7 @@ private fun RepeatCountBottomSheetContent( .padding(horizontal = 12.dp, vertical = 5.5.dp) .noRippleClickable(onClick = { internalSelectedRepeatType = RepeatCycle.WEEKLY - internalRepeatCount = 0 + internalRepeatCount = 1 }), ) @@ -334,7 +334,7 @@ private fun RepeatCountBottomSheetContent( .padding(horizontal = 12.dp, vertical = 5.5.dp) .noRippleClickable(onClick = { internalSelectedRepeatType = RepeatCycle.MONTHLY - internalRepeatCount = 0 + internalRepeatCount = 1 }), ) } diff --git a/feature/goal-editor/src/main/java/com/twix/goal_editor/model/GoalEditorUiState.kt b/feature/goal-editor/src/main/java/com/twix/goal_editor/model/GoalEditorUiState.kt index 7cc8ca7b..8add180f 100644 --- a/feature/goal-editor/src/main/java/com/twix/goal_editor/model/GoalEditorUiState.kt +++ b/feature/goal-editor/src/main/java/com/twix/goal_editor/model/GoalEditorUiState.kt @@ -11,11 +11,11 @@ data class GoalEditorUiState( val selectedIcon: GoalIconType = GoalIconType.DEFAULT, val goalTitle: String = "", val selectedRepeatCycle: RepeatCycle = RepeatCycle.DAILY, - val repeatCount: Int = 0, + val repeatCount: Int = 1, val startDate: LocalDate = LocalDate.now(), val endDateEnabled: Boolean = false, val endDate: LocalDate = LocalDate.now(), ) : State { val isEnabled: Boolean - get() = goalTitle.isNotBlank() && repeatCount > 0 + get() = goalTitle.isNotBlank() && (selectedRepeatCycle == RepeatCycle.DAILY || repeatCount > 0) }