From ba3e831c3f8226a9019d9a40cb118d075b636a92 Mon Sep 17 00:00:00 2001 From: Ryo Takeuchi Date: Tue, 5 Dec 2023 21:51:33 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=8F=82=E5=8A=A0=E8=A1=A8?= =?UTF-8?q?=E6=98=8E=E5=87=A6=E7=90=86=E3=81=AE=E5=AE=9F=E8=A3=85=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Schedule/ComposeScheduleDetailScreen.swift | 1 + .../participation/model/NetworkParticipantDeclaration.kt | 8 ++++---- .../feature/schedule/detail/ScheduleDetailStateMachine.kt | 6 +++++- .../nito/feature/schedule/di/ScheduleFeatureModule.kt | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift b/app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift index fffe0ef3..6c2d843e 100644 --- a/app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift +++ b/app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift @@ -17,6 +17,7 @@ public struct ComposeScheduleDetailScreen: UIViewControllerRepresentable { id: scheduleId, fetchParticipantScheduleById: Container.shared.get( type: FetchParticipantScheduleByIdUseCase.self), + participate: Container.shared.get(type: ParticipateUseCase.self), userMessageStateHolder: Container.shared.get(type: UserMessageStateHolder.self), dateTimeFormatter: Container.shared.get(type: CommonNitoDateFormatter.self) ) diff --git a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantDeclaration.kt b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantDeclaration.kt index 44f6b285..84dbd379 100644 --- a/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantDeclaration.kt +++ b/core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipantDeclaration.kt @@ -5,14 +5,14 @@ import kotlinx.serialization.Serializable @Serializable internal data class NetworkParticipantDeclaration( - val scheduleId: Long, - val memberId: Long, + val scheduleId: String, + val userId: String, val comment: String, ) internal fun ParticipantDeclaration.toNetworkModel(): NetworkParticipantDeclaration = NetworkParticipantDeclaration( - scheduleId = scheduleId.toLong(), - memberId = memberId.toLong(), + scheduleId = scheduleId, + userId = memberId, comment = comment, ) diff --git a/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt b/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt index baf30b7d..2bcb6c31 100644 --- a/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt +++ b/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt @@ -2,6 +2,7 @@ package club.nito.feature.schedule.detail import club.nito.core.common.NitoDateFormatter import club.nito.core.domain.FetchParticipantScheduleByIdUseCase +import club.nito.core.domain.ParticipateUseCase import club.nito.core.domain.model.ParticipantSchedule import club.nito.core.model.FetchSingleContentResult import club.nito.core.model.schedule.ScheduleId @@ -18,6 +19,7 @@ import moe.tlaster.precompose.viewmodel.viewModelScope public class ScheduleDetailStateMachine( id: ScheduleId, fetchParticipantScheduleById: FetchParticipantScheduleByIdUseCase, + private val participate: ParticipateUseCase, public val userMessageStateHolder: UserMessageStateHolder, private val dateTimeFormatter: NitoDateFormatter, ) : StateMachine(), @@ -52,7 +54,9 @@ public class ScheduleDetailStateMachine( viewModelScope.launch { when (intent) { is ScheduleDetailIntent.ClickParticipate -> { - showConfirmParticipateSchedule.emit(intent.schedule) + participate(intent.schedule.id, "") + val scheduledAt = dateTimeFormatter.formatDateTime(intent.schedule.scheduledAt) + userMessageStateHolder.showMessage("$scheduledAt に参加登録しました 🎉") } is ScheduleDetailIntent.ClickParticipateSchedule -> { diff --git a/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt b/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt index 1c480d68..9caaf50c 100644 --- a/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt +++ b/feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt @@ -18,6 +18,7 @@ public val scheduleFeatureModule: Module = module { ScheduleDetailStateMachine( id = id, fetchParticipantScheduleById = get(), + participate = get(), userMessageStateHolder = get(), dateTimeFormatter = get(), )