From 538542906dfc4751e7ce168a34576a636425f0cd Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Tue, 2 Jan 2024 15:09:29 +0900 Subject: [PATCH 01/23] =?UTF-8?q?[FEATURE]=20#70=20:=20=EB=B9=84=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EC=84=A4=EC=A0=95=20=ED=99=94=EB=A9=B4=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=95=88=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/profile/ProfileScreen.kt | 5 +++++ .../profile/profilesetting/ProfileSettingScreen.kt | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt index 33a60a53..5a863eee 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt @@ -68,6 +68,11 @@ internal fun ProfileScreen( .align(Alignment.CenterStart) .padding(start = 25.dp), ) + + if (role == Role.GUEST) { + return@Box + } + Image( painter = painterResource(id = drawable.ic_subtract), diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt index 367fa0e5..199cb7f9 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt @@ -34,9 +34,9 @@ internal fun ProfileSettingRoute( internal fun ProfileSettingScreen( navigateToProfile: () -> Unit, onClickedAlarmSetting: () -> Unit = {}, - onClickedSignout: () -> Unit = {}, + onClickedSignOut: () -> Unit = {}, onClickedWithdrawal: () -> Unit = {}, - onClickedInquriy: () -> Unit = {}, + onClickedInquiry: () -> Unit = {}, onClickedFAQ: () -> Unit = {}, onClickedTermsAndPolicies: () -> Unit = {}, onClickedPrivacyPolicy: () -> Unit = {}, @@ -83,7 +83,7 @@ internal fun ProfileSettingScreen( WappRowBar( title = stringResource(id = com.wap.wapp.feature.profile.R.string.sign_out), - onClicked = onClickedSignout, + onClicked = onClickedSignOut, ) Divider( @@ -118,7 +118,7 @@ internal fun ProfileSettingScreen( WappRowBar( title = stringResource(id = com.wap.wapp.feature.profile.R.string.inquiry), - onClicked = onClickedInquriy, + onClicked = onClickedInquiry, ) Divider( From c8a2a42578ddbbe9b5951c3962d03dcedd81a8f4 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Tue, 2 Jan 2024 15:20:38 +0900 Subject: [PATCH 02/23] =?UTF-8?q?[FEATURE]=20#70=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EB=8D=94=20=EB=B3=B4=EA=B8=B0=20=EB=A9=94=EB=89=B4?= =?UTF-8?q?=204=EA=B0=9C=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EA=B0=81=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=EC=97=90=20=EB=A7=9E=EB=8A=94=20=EB=85=B8?= =?UTF-8?q?=EC=85=98=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/profile/ProfileScreen.kt | 2 +- .../profilesetting/ProfileSettingScreen.kt | 58 +++++++++++++++---- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt index 5a863eee..d03eaab5 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt @@ -44,7 +44,7 @@ internal fun ProfileRoute( @Composable internal fun ProfileScreen( - role: Role = Role.GUEST, + role: Role = Role.MANAGER, userName: String = "", eventsState: ProfileViewModel.EventsState, navigateToProfileSetting: () -> Unit, diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt index 199cb7f9..563534ab 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt @@ -1,5 +1,7 @@ package com.wap.wapp.feature.profile.profilesetting +import android.content.Context +import android.content.Intent import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -11,10 +13,12 @@ import androidx.compose.material.Divider import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.core.content.ContextCompat.startActivity +import androidx.core.net.toUri import androidx.hilt.navigation.compose.hiltViewModel import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappRowBar @@ -27,19 +31,55 @@ internal fun ProfileSettingRoute( navigateToProfile: () -> Unit, viewModel: ProfileSettingViewModel = hiltViewModel(), ) { - ProfileSettingScreen(navigateToProfile) + val context = LocalContext.current + + ProfileSettingScreen( + navigateToProfile = navigateToProfile, + onClickedPrivacyPolicy = { + navigateToUri( + context, + "https://www.notion.so/46beb7c4f3c2417bbec20eafd610d580?pvs=11", + ) + }, + onClickedFAQ = { + navigateToUri( + context, + "https://www.notion.so/FAQ-5832683da65048549e6a976b54d62875", + ) + }, + onClickedInquiry = { + navigateToUri( + context, + "https://www.notion.so/4fcb60f346c041248fd0d97d202a8a9a", + ) + }, + onClickedTermsAndPolicies = { + navigateToUri( + context, + "https://www.notion.so/042dc914a6a34093a51658693e009411", + ) + }, + ) } +private fun navigateToUri(context: Context, url: String) = startActivity( + context, + generateUriIntent(url), + null, +) + +private fun generateUriIntent(url: String) = Intent(Intent.ACTION_VIEW, url.toUri()) + @Composable internal fun ProfileSettingScreen( navigateToProfile: () -> Unit, onClickedAlarmSetting: () -> Unit = {}, onClickedSignOut: () -> Unit = {}, onClickedWithdrawal: () -> Unit = {}, - onClickedInquiry: () -> Unit = {}, - onClickedFAQ: () -> Unit = {}, - onClickedTermsAndPolicies: () -> Unit = {}, - onClickedPrivacyPolicy: () -> Unit = {}, + onClickedInquiry: () -> Unit, + onClickedFAQ: () -> Unit, + onClickedTermsAndPolicies: () -> Unit, + onClickedPrivacyPolicy: () -> Unit, ) { val dividerThickness = 1.dp val dividerColor = WappTheme.colors.black42 @@ -157,9 +197,3 @@ internal fun ProfileSettingScreen( ) } } - -@Preview -@Composable -fun PreviewProfileMoreScreen() { - ProfileSettingScreen(navigateToProfile = {}) -} From 6a04d9d69b4ee4ed8cf7452b2deeadc418be3feb Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Tue, 2 Jan 2024 17:06:50 +0900 Subject: [PATCH 03/23] =?UTF-8?q?[FEATURE]=20#70=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=EC=84=B8=ED=8C=85=20=ED=99=94=EB=A9=B4=20=EB=B0=94?= =?UTF-8?q?=ED=85=80=20=EB=84=A4=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=95=88=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=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 --- app/src/main/java/com/wap/wapp/MainActivity.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/wap/wapp/MainActivity.kt b/app/src/main/java/com/wap/wapp/MainActivity.kt index 838a7d56..3b851eb1 100644 --- a/app/src/main/java/com/wap/wapp/MainActivity.kt +++ b/app/src/main/java/com/wap/wapp/MainActivity.kt @@ -24,6 +24,7 @@ import com.wap.wapp.feature.auth.signin.navigation.signInNavigationRoute import com.wap.wapp.feature.auth.signup.navigation.signUpNavigationRoute import com.wap.wapp.feature.management.registration.event.navigation.eventRegistrationNavigationRoute import com.wap.wapp.feature.management.registration.survey.navigation.surveyRegistrationNavigationRoute +import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingNavigationRoute import com.wap.wapp.feature.splash.navigation.splashNavigationRoute import com.wap.wapp.navigation.TopLevelDestination import com.wap.wapp.navigation.WappNavHost @@ -91,6 +92,7 @@ private fun handleBottomBarState( signInNavigationRoute -> setBottomBarState(false) signUpNavigationRoute -> setBottomBarState(false) splashNavigationRoute -> setBottomBarState(false) + profileSettingNavigationRoute -> setBottomBarState(false) surveyRegistrationNavigationRoute -> setBottomBarState(false) eventRegistrationNavigationRoute -> setBottomBarState(false) else -> setBottomBarState(true) From d917581cd405ea26b5dac4db2df05b1e5753e787 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:18:51 +0900 Subject: [PATCH 04/23] =?UTF-8?q?[ADD]=20#78=20:=20edit=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/edit/event/navigation/EventEditNavigation.kt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt new file mode 100644 index 00000000..543cb35c --- /dev/null +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt @@ -0,0 +1,3 @@ +package com.wap.wapp.feature.management.edit.event.navigation + +class EventEditNavigation From 94abea9eea7b71193fea6f7fd9e22defe8bf24e5 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:20:28 +0900 Subject: [PATCH 05/23] [ADD] #78 : EventEditScreen --- .../feature/management/edit/event/EventEditScreen.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt new file mode 100644 index 00000000..4efc60d3 --- /dev/null +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -0,0 +1,11 @@ +package com.wap.wapp.feature.management.edit.event + +import androidx.compose.runtime.Composable + +@Composable +internal fun EventEditRoute(eventId: String, navigateToManagement: () -> Unit) { +} + +@Composable +internal fun EventEditScreen() { +} From 86f3da20fc3c0f976c5e29578512573e874b420c Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:21:11 +0900 Subject: [PATCH 06/23] [FEATURE] #78 :EventEditNavigation --- .../event/navigation/EventEditNavigation.kt | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt index 543cb35c..b0ce2e61 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt @@ -1,3 +1,38 @@ package com.wap.wapp.feature.management.edit.event.navigation -class EventEditNavigation +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.NavType +import androidx.navigation.compose.composable +import androidx.navigation.navArgument +import androidx.navigation.navOptions +import com.wap.wapp.feature.management.edit.event.EventEditRoute + +const val eventEditNavigationRoute = "event/edit/{eventId}" + +fun NavController.navigateToEventEdit( + eventId: String, + navOptions: NavOptions? = navOptions {}, +) { + this.navigate("event/edit/$eventId", navOptions) +} + +fun NavGraphBuilder.eventEditScreen( + navigateToManagement: () -> Unit, +) { + composable( + route = eventEditNavigationRoute, + arguments = listOf( + navArgument("eventId") { + type = NavType.StringType + }, + ), + ) { navBackStackEntry -> + val eventId = navBackStackEntry.arguments?.getString("eventId") ?: "" + EventEditRoute( + eventId = eventId, + navigateToManagement = navigateToManagement, + ) + } +} From f4e2ff6bfe0addea1a626229421efce7c4ba2a73 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:22:30 +0900 Subject: [PATCH 07/23] =?UTF-8?q?[FEATURE]=20#78=20:EventEditNavigation=20?= =?UTF-8?q?NavHost=EC=97=90=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/wap/wapp/navigation/WappNavHost.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt index 76896fe3..650b707a 100644 --- a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt +++ b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt @@ -14,6 +14,7 @@ import com.wap.wapp.feature.auth.signup.navigation.navigateToSignUp import com.wap.wapp.feature.auth.signup.navigation.signUpScreen import com.wap.wapp.feature.management.check.navigation.navigateToSurveyCheck import com.wap.wapp.feature.management.check.navigation.surveyCheckScreen +import com.wap.wapp.feature.management.edit.event.navigation.eventEditScreen import com.wap.wapp.feature.management.navigation.managementScreen import com.wap.wapp.feature.management.navigation.navigateToManagement import com.wap.wapp.feature.management.registration.event.navigation.eventRegistrationScreen @@ -78,6 +79,9 @@ fun WappNavHost( eventRegistrationScreen( navigateToManagement = navController::navigateToManagement, ) + eventEditScreen( + navigateToManagement = navController::navigateToManagement, + ) profileScreen( navigateToProfileSetting = navController::navigateToProfileSetting, navigateToSignInScreen = { From 44d0c947ac4985ba2ffbcc494e88bc971bb922f1 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:26:13 +0900 Subject: [PATCH 08/23] [FEATURE] #78 : GetEventUseCase --- .../wapp/core/domain/usecase/event/GetEventUseCase.kt | 11 +++++++++++ .../management/edit/event/EventEditViewModel.kt | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt create mode 100644 feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt new file mode 100644 index 00000000..4076537e --- /dev/null +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt @@ -0,0 +1,11 @@ +package com.wap.wapp.core.domain.usecase.event + +import com.wap.wapp.core.data.repository.event.EventRepository +import javax.inject.Inject + +class GetEventUseCase @Inject constructor( + private val eventRepository: EventRepository, +) { + suspend operator fun invoke(eventId: String) { + } +} diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt new file mode 100644 index 00000000..58544ee1 --- /dev/null +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -0,0 +1,11 @@ +package com.wap.wapp.feature.management.edit.event + +import androidx.lifecycle.ViewModel +import com.wap.wapp.core.domain.usecase.event.GetEventUseCase +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class EventEditViewModel @Inject constructor( + private val getEventUseCase: GetEventUseCase, +) : ViewModel() From 6b0dfb22869cee48df4d30360d9f34a456f67112 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:34:21 +0900 Subject: [PATCH 09/23] [FEATURE] #78 : getEvent --- .../core/data/repository/event/EventRepository.kt | 2 ++ .../data/repository/event/EventRepositoryImpl.kt | 5 +++++ .../main/java/com/wap/wapp/core/model/event/Event.kt | 2 +- .../wapp/core/network/model/event/EventResponse.kt | 2 +- .../core/network/source/event/EventDataSource.kt | 1 + .../core/network/source/event/EventDataSourceImpl.kt | 12 ++++++++++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt index 9f54bb6e..28fe5180 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt @@ -6,6 +6,8 @@ import java.time.LocalDate interface EventRepository { suspend fun getMonthEvents(date: LocalDate): Result> + suspend fun getEvent(date: LocalDate, eventId: String): Result + suspend fun postEvent( date: LocalDate, eventTitle: String, diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt index 4d33bb3e..594878fb 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt @@ -16,6 +16,11 @@ class EventRepositoryImpl @Inject constructor( } } + override suspend fun getEvent(date: LocalDate, eventId: String): Result = + eventDataSource.getEvent(date, eventId).mapCatching { eventResponse -> + eventResponse.toDomain() + } + override suspend fun postEvent( date: LocalDate, eventTitle: String, diff --git a/core/model/src/main/java/com/wap/wapp/core/model/event/Event.kt b/core/model/src/main/java/com/wap/wapp/core/model/event/Event.kt index 52b3366d..3d0eb0c1 100644 --- a/core/model/src/main/java/com/wap/wapp/core/model/event/Event.kt +++ b/core/model/src/main/java/com/wap/wapp/core/model/event/Event.kt @@ -4,7 +4,7 @@ import java.time.LocalDate data class Event( val content: String, - val eventId: Int, + val eventId: String, val location: String, val period: LocalDate, val title: String, diff --git a/core/network/src/main/java/com/wap/wapp/core/network/model/event/EventResponse.kt b/core/network/src/main/java/com/wap/wapp/core/network/model/event/EventResponse.kt index 3669d6fe..d53e0c61 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/model/event/EventResponse.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/model/event/EventResponse.kt @@ -6,7 +6,7 @@ import java.time.format.DateTimeFormatter data class EventResponse( val content: String = "", - val eventId: Int = 0, + val eventId: String = "", val location: String = "", val period: String = "", val title: String = "", diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt index cd26ea87..2c7218e0 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt @@ -6,5 +6,6 @@ import java.time.LocalDate interface EventDataSource { suspend fun getMonthEvents(date: LocalDate): Result> + suspend fun getEvent(date: LocalDate, eventId: String): Result suspend fun postEvent(date: LocalDate, eventRequest: EventRequest): Result } diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt index c0d57e0b..e7a11722 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt @@ -32,6 +32,18 @@ class EventDataSourceImpl @Inject constructor( result } + override suspend fun getEvent(date: LocalDate, eventId: String): Result = + runCatching { + val document = firebaseFirestore.collection(EVENT_COLLECTION) + .document(getMonth(date)) + .collection(EVENT_COLLECTION) + .document(eventId) + .get() + .await() + + checkNotNull(document.toObject()) + } + override suspend fun postEvent(date: LocalDate, eventRequest: EventRequest): Result = runCatching { firebaseFirestore.collection(EVENT_COLLECTION) From 570d0b0e3e2326fd496a9d3f3a27c5792b5bf993 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:52:01 +0900 Subject: [PATCH 10/23] [FEATURE] #78 : EventEditScreen --- .../management/edit/event/EventEditScreen.kt | 226 +++++++++++++++++- .../edit/event/EventEditViewModel.kt | 132 +++++++++- 2 files changed, 356 insertions(+), 2 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt index be9a450f..f5f521b5 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -1,15 +1,239 @@ package com.wap.wapp.feature.management.edit.event +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.LinearProgressIndicator +import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.Text +import androidx.compose.material3.rememberTimePickerState import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.wap.designsystem.WappTheme +import com.wap.designsystem.component.WappTopBar +import com.wap.wapp.core.commmon.extensions.toSupportingText +import com.wap.wapp.feature.management.R +import com.wap.wapp.feature.management.registration.event.EventRegistrationContent +import com.wap.wapp.feature.management.registration.event.EventRegistrationEvent +import com.wap.wapp.feature.management.registration.event.EventRegistrationState +import kotlinx.coroutines.flow.collectLatest +import java.time.LocalDate +import java.time.LocalTime @Composable internal fun EventEditRoute( date: String, eventId: String, navigateToManagement: () -> Unit, + viewModel: EventEditViewModel = hiltViewModel(), ) { + val snackBarHostState = remember { SnackbarHostState() } + val currentRegistrationState + by viewModel.currentRegistrationState.collectAsStateWithLifecycle() + val title by viewModel.eventTitle.collectAsStateWithLifecycle() + val content by viewModel.eventContent.collectAsStateWithLifecycle() + val location by viewModel.eventLocation.collectAsStateWithLifecycle() + val startDate by viewModel.eventStartDate.collectAsStateWithLifecycle() + val startTime by viewModel.eventStartTime.collectAsStateWithLifecycle() + val endDate by viewModel.eventEndDate.collectAsStateWithLifecycle() + val endTime by viewModel.eventEndTime.collectAsStateWithLifecycle() + val onTitleChanged = viewModel::setEventTitle + val onContentChanged = viewModel::setEventContent + val onLocationChanged = viewModel::setEventLocation + val onStartDateChanged = viewModel::setEventStartDate + val onStartTimeChanged = viewModel::setEventStartTime + val onEndDateChanged = viewModel::setEventEndDate + val onEndTimeChanged = viewModel::setEventEndTime + val onNextButtonClicked = + viewModel::setEventRegistrationState + val onRegisterButtonClicked = viewModel::registerEvent + + LaunchedEffect(true) { + viewModel.eventRegistrationEvent.collectLatest { + when (it) { + is EventRegistrationEvent.Failure -> { + snackBarHostState.showSnackbar(it.error.toSupportingText()) + } + + is EventRegistrationEvent.ValidationError -> { + snackBarHostState.showSnackbar(it.message) + } + + is EventRegistrationEvent.Success -> { + navigateToManagement() + } + } + } + } + + EventEditScreen( + currentEditState = currentRegistrationState, + title = title, + content = content, + location = location, + startDate = startDate, + startTime = startTime, + endDate = endDate, + endTime = endTime, + snackBarHostState = snackBarHostState, + onTitleChanged = onTitleChanged, + onContentChanged = onContentChanged, + onLocationChanged = onLocationChanged, + onStartDateChanged = onStartDateChanged, + onStartTimeChanged = onStartTimeChanged, + onEndDateChanged = onEndDateChanged, + onEndTimeChanged = onEndTimeChanged, + onNextButtonClicked = onNextButtonClicked, + onEditButtonClicked = onRegisterButtonClicked, + onBackButtonClicked = navigateToManagement, + ) +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +internal fun EventEditScreen( + currentEditState: EventRegistrationState, + title: String, + content: String, + location: String, + startDate: LocalDate, + startTime: LocalTime, + endDate: LocalDate, + endTime: LocalTime, + snackBarHostState: SnackbarHostState, + onTitleChanged: (String) -> Unit, + onContentChanged: (String) -> Unit, + onLocationChanged: (String) -> Unit, + onStartDateChanged: (LocalDate) -> Unit, + onStartTimeChanged: (LocalTime) -> Unit, + onEndDateChanged: (LocalDate) -> Unit, + onEndTimeChanged: (LocalTime) -> Unit, + onNextButtonClicked: () -> Unit, + onEditButtonClicked: () -> Unit, + onBackButtonClicked: () -> Unit, +) { + var showStartDatePicker by remember { mutableStateOf(false) } + var showStartTimePicker by remember { mutableStateOf(false) } + var showEndDatePicker by remember { mutableStateOf(false) } + var showEndTimePicker by remember { mutableStateOf(false) } + val timePickerState = rememberTimePickerState() + + Scaffold( + snackbarHost = { SnackbarHost(snackBarHostState) }, + containerColor = WappTheme.colors.backgroundBlack, + modifier = Modifier.fillMaxSize(), + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) // paddingValue padding + .padding(16.dp), // dp value padding + ) { + WappTopBar( + titleRes = R.string.event_registration, + showLeftButton = true, + onClickLeftButton = onBackButtonClicked, + ) + + EventEditStateIndicator( + eventRegistrationState = currentEditState, + modifier = Modifier.padding(top = 16.dp), + ) + + EventRegistrationContent( + eventRegistrationState = currentEditState, + modifier = Modifier.padding(top = 50.dp), + eventTitle = title, + eventContent = content, + location = location, + startDate = startDate, + startTime = startTime, + endDate = endDate, + endTime = endTime, + showStartDatePicker = showStartDatePicker, + showStartTimePicker = showStartTimePicker, + showEndDatePicker = showEndDatePicker, + showEndTimePicker = showEndTimePicker, + onTitleChanged = onTitleChanged, + onContentChanged = onContentChanged, + onLocationChanged = onLocationChanged, + timePickerState = timePickerState, + onStartDateChanged = onStartDateChanged, + onStartTimeChanged = onStartTimeChanged, + onEndDateChanged = onEndDateChanged, + onEndTimeChanged = onEndTimeChanged, + onStartDatePickerStateChanged = { state -> showStartDatePicker = state }, + onStartTimePickerStateChanged = { state -> showStartTimePicker = state }, + onEndDatePickerStateChanged = { state -> showEndDatePicker = state }, + onEndTimePickerStateChanged = { state -> showEndTimePicker = state }, + onNextButtonClicked = onNextButtonClicked, + onRegisterButtonClicked = onEditButtonClicked, + ) + } + } +} + +@Composable +private fun EventEditStateIndicator( + eventRegistrationState: EventRegistrationState, + modifier: Modifier = Modifier, +) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = modifier, + ) { + EventEditStateProgressBar(eventRegistrationState.progress) + EventEditStateText(eventRegistrationState.page) + } } @Composable -internal fun EventEditScreen() { +private fun EventEditStateText( + currentRegistrationPage: String, +) { + Row { + Text( + text = currentRegistrationPage, + style = WappTheme.typography.contentMedium, + color = WappTheme.colors.yellow34, + ) + Text( + text = stringResource(R.string.event_registration_total_page), + style = WappTheme.typography.contentMedium, + color = WappTheme.colors.white, + ) + } +} + +@Composable +private fun EventEditStateProgressBar( + currentRegistrationProgress: Float, +) { + LinearProgressIndicator( + modifier = Modifier + .fillMaxWidth() + .height(10.dp), + color = WappTheme.colors.yellow34, + progress = currentRegistrationProgress, + strokeCap = StrokeCap.Round, + ) } diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index 58544ee1..87b5519c 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -1,11 +1,141 @@ package com.wap.wapp.feature.management.edit.event import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.wap.wapp.core.commmon.util.DateUtil import com.wap.wapp.core.domain.usecase.event.GetEventUseCase +import com.wap.wapp.core.domain.usecase.event.RegisterEventUseCase +import com.wap.wapp.feature.management.registration.event.EventRegistrationEvent +import com.wap.wapp.feature.management.registration.event.EventRegistrationState import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch +import java.time.LocalDate +import java.time.LocalTime import javax.inject.Inject @HiltViewModel class EventEditViewModel @Inject constructor( private val getEventUseCase: GetEventUseCase, -) : ViewModel() + private val registerEventUseCase: RegisterEventUseCase, +) : ViewModel() { + private val _currentRegistrationState: MutableStateFlow = + MutableStateFlow(EventRegistrationState.EVENT_DETAILS) + val currentRegistrationState = _currentRegistrationState.asStateFlow() + + private val _eventRegistrationEvent: MutableSharedFlow = + MutableSharedFlow() + val eventRegistrationEvent = _eventRegistrationEvent.asSharedFlow() + + private val _eventTitle: MutableStateFlow = MutableStateFlow("") + val eventTitle = _eventTitle.asStateFlow() + + private val _eventContent: MutableStateFlow = MutableStateFlow("") + val eventContent = _eventContent.asStateFlow() + + private val _eventLocation: MutableStateFlow = MutableStateFlow("") + val eventLocation = _eventLocation.asStateFlow() + + private val _eventStartDate: MutableStateFlow = + MutableStateFlow(DateUtil.generateNowDate()) + val eventStartDate = _eventStartDate.asStateFlow() + + private val _eventStartTime: MutableStateFlow = + MutableStateFlow(DateUtil.generateNowTime()) + val eventStartTime = _eventStartTime.asStateFlow() + + private val _eventEndDate: MutableStateFlow = + MutableStateFlow(DateUtil.generateNowDate()) + val eventEndDate = _eventEndDate.asStateFlow() + + private val _eventEndTime: MutableStateFlow = + MutableStateFlow(DateUtil.generateNowTime().plusHours(1)) + val eventEndTime = _eventEndTime.asStateFlow() + + fun setEventTitle(eventTitle: String) { + _eventTitle.value = eventTitle + } + + fun setEventContent(eventContent: String) { + _eventContent.value = eventContent + } + + fun setEventLocation(eventLocation: String) { + _eventLocation.value = eventLocation + } + + fun setEventStartDate(eventDate: LocalDate) { + if (eventDate <= DateUtil.generateNowDate()) { + emitValidationErrorMessage("최소 하루 이상 일정 날짜를 지정하세요.") + return + } + _eventStartDate.value = eventDate + } + + fun setEventStartTime(eventTime: LocalTime) { + _eventStartTime.value = eventTime + } + + fun setEventEndDate(eventDate: LocalDate) { + if (eventDate < _eventStartDate.value) { + emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") + return + } + _eventEndDate.value = eventDate + } + + fun setEventEndTime(eventTime: LocalTime) { + if (_eventEndDate.value == _eventStartDate.value && eventTime <= _eventStartTime.value) { + emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") + return + } + _eventEndTime.value = eventTime + } + + fun setEventRegistrationState() { + if (_currentRegistrationState.value == EventRegistrationState.EVENT_DETAILS) { + if (_eventTitle.value.isEmpty()) { + emitValidationErrorMessage("행사 이름을 입력하세요.") + return + } + if (_eventContent.value.isEmpty()) { + emitValidationErrorMessage("행사 내용을 입력하세요.") + return + } + _currentRegistrationState.value = EventRegistrationState.EVENT_SCHEDULE + } + } + + fun registerEvent() { + if (_eventLocation.value.isEmpty()) { + emitValidationErrorMessage("장소를 입력하세요.") + return + } + viewModelScope.launch { + registerEventUseCase( + eventTitle = _eventTitle.value, + eventContent = _eventContent.value, + eventLocation = _eventLocation.value, + eventStartDate = _eventStartDate.value, + eventStartTime = _eventStartTime.value, + eventEndDate = _eventEndDate.value, + eventEndTime = _eventEndTime.value, + ).onSuccess { + _eventRegistrationEvent.emit(EventRegistrationEvent.Success) + }.onFailure { throwable -> + _eventRegistrationEvent.emit(EventRegistrationEvent.Failure(throwable)) + } + } + } + + private fun emitValidationErrorMessage(message: String) { + viewModelScope.launch { + _eventRegistrationEvent.emit( + EventRegistrationEvent.ValidationError(message), + ) + } + } +} From 82d43ef7ecdcb5135a3eaec5f1b55ccfb71d3d63 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 17:59:53 +0900 Subject: [PATCH 11/23] [FEATURE] #78 : LocalDate -> LocalDateTime --- .../wap/wapp/core/data/repository/event/EventRepository.kt | 2 +- .../wapp/core/data/repository/event/EventRepositoryImpl.kt | 2 +- .../wap/wapp/core/domain/usecase/event/GetEventUseCase.kt | 5 +++-- .../wap/wapp/core/network/source/event/EventDataSource.kt | 3 ++- .../wapp/core/network/source/event/EventDataSourceImpl.kt | 5 +++-- .../feature/management/edit/event/EventEditViewModel.kt | 7 +++++++ 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt index 5648c558..06306ab5 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt @@ -7,7 +7,7 @@ import java.time.LocalDateTime interface EventRepository { suspend fun getMonthEvents(date: LocalDate): Result> - suspend fun getEvent(date: LocalDate, eventId: String): Result + suspend fun getEvent(date: LocalDateTime, eventId: String): Result suspend fun postEvent( eventTitle: String, diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt index 8f22f106..6814ca3d 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt @@ -17,7 +17,7 @@ class EventRepositoryImpl @Inject constructor( } } - override suspend fun getEvent(date: LocalDate, eventId: String): Result = + override suspend fun getEvent(date: LocalDateTime, eventId: String): Result = eventDataSource.getEvent(date, eventId).mapCatching { eventResponse -> eventResponse.toDomain() } diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt index 4076537e..1c6c93b5 100644 --- a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/GetEventUseCase.kt @@ -1,11 +1,12 @@ package com.wap.wapp.core.domain.usecase.event import com.wap.wapp.core.data.repository.event.EventRepository +import java.time.LocalDateTime import javax.inject.Inject class GetEventUseCase @Inject constructor( private val eventRepository: EventRepository, ) { - suspend operator fun invoke(eventId: String) { - } + suspend operator fun invoke(date: LocalDateTime, eventId: String) = + eventRepository.getEvent(date = date, eventId = eventId) } diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt index 566cefe5..f92e54c9 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt @@ -2,11 +2,12 @@ package com.wap.wapp.core.network.source.event import com.wap.wapp.core.network.model.event.EventResponse import java.time.LocalDate +import java.time.LocalDateTime interface EventDataSource { suspend fun getMonthEvents(date: LocalDate): Result> - suspend fun getEvent(date: LocalDate, eventId: String): Result + suspend fun getEvent(date: LocalDateTime, eventId: String): Result suspend fun postEvent( title: String, diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt index b8711638..27ab0fd9 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt @@ -9,6 +9,7 @@ import com.wap.wapp.core.network.model.event.EventResponse import com.wap.wapp.core.network.utils.await import com.wap.wapp.core.network.utils.toISOLocalDateTime import java.time.LocalDate +import java.time.LocalDateTime import java.time.format.DateTimeFormatter import javax.inject.Inject @@ -34,10 +35,10 @@ class EventDataSourceImpl @Inject constructor( result } - override suspend fun getEvent(date: LocalDate, eventId: String): Result = + override suspend fun getEvent(date: LocalDateTime, eventId: String): Result = runCatching { val document = firebaseFirestore.collection(EVENT_COLLECTION) - .document(getMonth(date)) + .document(getMonth(date.toLocalDate())) .collection(EVENT_COLLECTION) .document(eventId) .get() diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index 87b5519c..f01f512c 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -14,7 +14,9 @@ import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch import java.time.LocalDate +import java.time.LocalDateTime import java.time.LocalTime +import java.time.format.DateTimeFormatter import javax.inject.Inject @HiltViewModel @@ -131,6 +133,11 @@ class EventEditViewModel @Inject constructor( } } + fun getEvent(date: String, eventId: String) = viewModelScope.launch { + val date = LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + getEventUseCase(date, eventId) + } + private fun emitValidationErrorMessage(message: String) { viewModelScope.launch { _eventRegistrationEvent.emit( From d4a94dd3374d326a0d1aeb695ffcb938622469f4 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:07:07 +0900 Subject: [PATCH 12/23] [FEATURE] #78 : getEvent --- .../management/edit/event/EventEditScreen.kt | 8 +++-- .../edit/event/EventEditViewModel.kt | 34 +++++++++++++------ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt index f5f521b5..58cdd6a8 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -47,7 +47,7 @@ internal fun EventEditRoute( ) { val snackBarHostState = remember { SnackbarHostState() } val currentRegistrationState - by viewModel.currentRegistrationState.collectAsStateWithLifecycle() + by viewModel.currentEditState.collectAsStateWithLifecycle() val title by viewModel.eventTitle.collectAsStateWithLifecycle() val content by viewModel.eventContent.collectAsStateWithLifecycle() val location by viewModel.eventLocation.collectAsStateWithLifecycle() @@ -64,10 +64,10 @@ internal fun EventEditRoute( val onEndTimeChanged = viewModel::setEventEndTime val onNextButtonClicked = viewModel::setEventRegistrationState - val onRegisterButtonClicked = viewModel::registerEvent + val onRegisterButtonClicked = viewModel::updateEvent LaunchedEffect(true) { - viewModel.eventRegistrationEvent.collectLatest { + viewModel.eventEditEvent.collectLatest { when (it) { is EventRegistrationEvent.Failure -> { snackBarHostState.showSnackbar(it.error.toSupportingText()) @@ -84,6 +84,8 @@ internal fun EventEditRoute( } } + viewModel.getEvent(date = date, eventId = eventId) + EventEditScreen( currentEditState = currentRegistrationState, title = title, diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index f01f512c..f6471356 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -24,13 +24,13 @@ class EventEditViewModel @Inject constructor( private val getEventUseCase: GetEventUseCase, private val registerEventUseCase: RegisterEventUseCase, ) : ViewModel() { - private val _currentRegistrationState: MutableStateFlow = + private val _currentEditState: MutableStateFlow = MutableStateFlow(EventRegistrationState.EVENT_DETAILS) - val currentRegistrationState = _currentRegistrationState.asStateFlow() + val currentEditState = _currentEditState.asStateFlow() - private val _eventRegistrationEvent: MutableSharedFlow = + private val _eventEditEvent: MutableSharedFlow = MutableSharedFlow() - val eventRegistrationEvent = _eventRegistrationEvent.asSharedFlow() + val eventEditEvent = _eventEditEvent.asSharedFlow() private val _eventTitle: MutableStateFlow = MutableStateFlow("") val eventTitle = _eventTitle.asStateFlow() @@ -57,6 +57,8 @@ class EventEditViewModel @Inject constructor( MutableStateFlow(DateUtil.generateNowTime().plusHours(1)) val eventEndTime = _eventEndTime.asStateFlow() + private val _eventId: MutableStateFlow = MutableStateFlow("") + fun setEventTitle(eventTitle: String) { _eventTitle.value = eventTitle } @@ -98,7 +100,7 @@ class EventEditViewModel @Inject constructor( } fun setEventRegistrationState() { - if (_currentRegistrationState.value == EventRegistrationState.EVENT_DETAILS) { + if (_currentEditState.value == EventRegistrationState.EVENT_DETAILS) { if (_eventTitle.value.isEmpty()) { emitValidationErrorMessage("행사 이름을 입력하세요.") return @@ -107,11 +109,11 @@ class EventEditViewModel @Inject constructor( emitValidationErrorMessage("행사 내용을 입력하세요.") return } - _currentRegistrationState.value = EventRegistrationState.EVENT_SCHEDULE + _currentEditState.value = EventRegistrationState.EVENT_SCHEDULE } } - fun registerEvent() { + fun updateEvent() { if (_eventLocation.value.isEmpty()) { emitValidationErrorMessage("장소를 입력하세요.") return @@ -126,21 +128,31 @@ class EventEditViewModel @Inject constructor( eventEndDate = _eventEndDate.value, eventEndTime = _eventEndTime.value, ).onSuccess { - _eventRegistrationEvent.emit(EventRegistrationEvent.Success) + _eventEditEvent.emit(EventRegistrationEvent.Success) }.onFailure { throwable -> - _eventRegistrationEvent.emit(EventRegistrationEvent.Failure(throwable)) + _eventEditEvent.emit(EventRegistrationEvent.Failure(throwable)) } } } fun getEvent(date: String, eventId: String) = viewModelScope.launch { val date = LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - getEventUseCase(date, eventId) + getEventUseCase(date, eventId).onSuccess { + _eventContent.value = it.content + _eventTitle.value = it.title + _eventStartDate.value = it.startDateTime.toLocalDate() + _eventStartTime.value = it.startDateTime.toLocalTime() + _eventEndDate.value = it.endDateTime.toLocalDate() + _eventEndTime.value = it.endDateTime.toLocalTime() + _eventLocation.value = it.location + _eventId.value = it.eventId + } + .onFailure { emitValidationErrorMessage("이벤트를 불러오는 데 실패하였습니다.") } } private fun emitValidationErrorMessage(message: String) { viewModelScope.launch { - _eventRegistrationEvent.emit( + _eventEditEvent.emit( EventRegistrationEvent.ValidationError(message), ) } From bbf60e2f444c21b809ada1c1af2508b2e7d4f9b5 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:15:49 +0900 Subject: [PATCH 13/23] [FEATURE] #78 : updateEvent --- .../data/repository/event/EventRepository.kt | 9 ++++++ .../repository/event/EventRepositoryImpl.kt | 17 ++++++++++ .../usecase/event/UpdateEventUseCase.kt | 31 +++++++++++++++++++ .../RegisterSurveyUseCase.kt | 2 +- .../network/source/event/EventDataSource.kt | 9 ++++++ .../source/event/EventDataSourceImpl.kt | 26 ++++++++++++++++ .../survey/SurveyRegistrationViewModel.kt | 2 +- 7 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt rename core/domain/src/main/java/com/wap/wapp/core/domain/usecase/{management => survey}/RegisterSurveyUseCase.kt (95%) diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt index 06306ab5..6ae96650 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt @@ -16,4 +16,13 @@ interface EventRepository { eventStartDateTime: LocalDateTime, eventEndDateTime: LocalDateTime, ): Result + + suspend fun updateEvent( + eventId: String, + eventTitle: String, + eventContent: String, + eventLocation: String, + eventStartDateTime: LocalDateTime, + eventEndDateTime: LocalDateTime, + ): Result } diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt index 6814ca3d..20dc2692 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt @@ -36,4 +36,21 @@ class EventRepositoryImpl @Inject constructor( startDateTime = eventStartDateTime.toISOLocalDateTimeString(), endDateTime = eventEndDateTime.toISOLocalDateTimeString(), ) + + override suspend fun updateEvent( + eventId: String, + eventTitle: String, + eventContent: String, + eventLocation: String, + eventStartDateTime: LocalDateTime, + eventEndDateTime: LocalDateTime, + ): Result = + eventDataSource.updateEvent( + eventId = eventId, + title = eventTitle, + content = eventContent, + location = eventLocation, + startDateTime = eventStartDateTime.toISOLocalDateTimeString(), + endDateTime = eventEndDateTime.toISOLocalDateTimeString(), + ) } diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt new file mode 100644 index 00000000..60d808d8 --- /dev/null +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt @@ -0,0 +1,31 @@ +package com.wap.wapp.core.domain.usecase.event + +import com.wap.wapp.core.data.repository.event.EventRepository +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import javax.inject.Inject + +class UpdateEventUseCase @Inject constructor( + private val eventRepository: EventRepository, +) { + suspend operator fun invoke( + eventId: String, + eventTitle: String, + eventContent: String, + eventLocation: String, + eventStartDate: LocalDate, + eventStartTime: LocalTime, + eventEndDate: LocalDate, + eventEndTime: LocalTime, + ): Result = runCatching { + eventRepository.updateEvent( + eventId = eventId, + eventTitle = eventTitle, + eventContent = eventContent, + eventLocation = eventLocation, + eventStartDateTime = LocalDateTime.of(eventStartDate, eventStartTime), + eventEndDateTime = LocalDateTime.of(eventEndDate, eventEndTime), + ) + } +} diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/management/RegisterSurveyUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/RegisterSurveyUseCase.kt similarity index 95% rename from core/domain/src/main/java/com/wap/wapp/core/domain/usecase/management/RegisterSurveyUseCase.kt rename to core/domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/RegisterSurveyUseCase.kt index 3ad997fb..c403f5fb 100644 --- a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/management/RegisterSurveyUseCase.kt +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/survey/RegisterSurveyUseCase.kt @@ -1,4 +1,4 @@ -package com.wap.wapp.core.domain.usecase.management +package com.wap.wapp.core.domain.usecase.survey import com.wap.wapp.core.data.repository.survey.SurveyFormRepository import com.wap.wapp.core.model.event.Event diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt index f92e54c9..7f87485e 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSource.kt @@ -16,4 +16,13 @@ interface EventDataSource { startDateTime: String, endDateTime: String, ): Result + + suspend fun updateEvent( + eventId: String, + title: String, + content: String, + location: String, + startDateTime: String, + endDateTime: String, + ): Result } diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt index 27ab0fd9..ca3da7e1 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt @@ -75,6 +75,32 @@ class EventDataSourceImpl @Inject constructor( .await() } + override suspend fun updateEvent( + eventId: String, + title: String, + content: String, + location: String, + startDateTime: String, + endDateTime: String, + ): Result = runCatching { + val startDate = startDateTime.toISOLocalDateTime().toLocalDate() + + firebaseFirestore.collection(EVENT_COLLECTION) + .document(getMonth(startDate)) + .collection(EVENT_COLLECTION) + .document(eventId) + .update( + mapOf( + "title" to title, + "content" to content, + "location" to location, + "startDateTime" to startDateTime, + "endDateTime" to endDateTime, + ), + ) + .await() + } + private fun getMonth(date: LocalDate): String { val formatter = DateTimeFormatter.ofPattern("yyyy-MM") diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/survey/SurveyRegistrationViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/survey/SurveyRegistrationViewModel.kt index 5c3a07a7..875e5181 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/survey/SurveyRegistrationViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/survey/SurveyRegistrationViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.wap.wapp.core.commmon.util.DateUtil import com.wap.wapp.core.domain.usecase.event.GetEventListUseCase -import com.wap.wapp.core.domain.usecase.management.RegisterSurveyUseCase +import com.wap.wapp.core.domain.usecase.survey.RegisterSurveyUseCase import com.wap.wapp.core.model.event.Event import com.wap.wapp.core.model.survey.QuestionType import com.wap.wapp.core.model.survey.SurveyQuestion From 178104c4337a20ada089b1387f7f5038610960f0 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:17:09 +0900 Subject: [PATCH 14/23] =?UTF-8?q?[FEATURE]=20#78=20:=20ViewModel=20UpdateE?= =?UTF-8?q?vent=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 --- .../feature/management/edit/event/EventEditViewModel.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index f6471356..8586d9d9 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.wap.wapp.core.commmon.util.DateUtil import com.wap.wapp.core.domain.usecase.event.GetEventUseCase -import com.wap.wapp.core.domain.usecase.event.RegisterEventUseCase +import com.wap.wapp.core.domain.usecase.event.UpdateEventUseCase import com.wap.wapp.feature.management.registration.event.EventRegistrationEvent import com.wap.wapp.feature.management.registration.event.EventRegistrationState import dagger.hilt.android.lifecycle.HiltViewModel @@ -22,7 +22,7 @@ import javax.inject.Inject @HiltViewModel class EventEditViewModel @Inject constructor( private val getEventUseCase: GetEventUseCase, - private val registerEventUseCase: RegisterEventUseCase, + private val updateEventUseCase: UpdateEventUseCase, ) : ViewModel() { private val _currentEditState: MutableStateFlow = MutableStateFlow(EventRegistrationState.EVENT_DETAILS) @@ -119,7 +119,7 @@ class EventEditViewModel @Inject constructor( return } viewModelScope.launch { - registerEventUseCase( + updateEventUseCase( eventTitle = _eventTitle.value, eventContent = _eventContent.value, eventLocation = _eventLocation.value, @@ -127,6 +127,7 @@ class EventEditViewModel @Inject constructor( eventStartTime = _eventStartTime.value, eventEndDate = _eventEndDate.value, eventEndTime = _eventEndTime.value, + eventId = _eventId.value, ).onSuccess { _eventEditEvent.emit(EventRegistrationEvent.Success) }.onFailure { throwable -> @@ -147,7 +148,7 @@ class EventEditViewModel @Inject constructor( _eventLocation.value = it.location _eventId.value = it.eventId } - .onFailure { emitValidationErrorMessage("이벤트를 불러오는 데 실패하였습니다.") } + .onFailure { emitValidationErrorMessage("이벤트를 불러오는데 실패하였습니다.") } } private fun emitValidationErrorMessage(message: String) { From 271666813c0dc72837a1180a0244f6e4111fde80 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:26:23 +0900 Subject: [PATCH 15/23] =?UTF-8?q?[FEATURE]=20#78=20:=20navigateToEventEdit?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/wap/wapp/navigation/WappNavHost.kt | 2 ++ .../feature/management/ManagementEventContent.kt | 12 +++++------- .../wap/wapp/feature/management/ManagementScreen.kt | 11 +++++++---- .../feature/management/edit/event/EventEditScreen.kt | 4 ++-- .../management/navigation/ManagementNavigation.kt | 2 ++ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt index 650b707a..22f7ef35 100644 --- a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt +++ b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt @@ -15,6 +15,7 @@ import com.wap.wapp.feature.auth.signup.navigation.signUpScreen import com.wap.wapp.feature.management.check.navigation.navigateToSurveyCheck import com.wap.wapp.feature.management.check.navigation.surveyCheckScreen import com.wap.wapp.feature.management.edit.event.navigation.eventEditScreen +import com.wap.wapp.feature.management.edit.event.navigation.navigateToEventEdit import com.wap.wapp.feature.management.navigation.managementScreen import com.wap.wapp.feature.management.navigation.navigateToManagement import com.wap.wapp.feature.management.registration.event.navigation.eventRegistrationScreen @@ -104,6 +105,7 @@ fun WappNavHost( managementScreen( navigateToSurveyRegistration = navController::navigateToSurveyRegistration, navigateToEventRegistration = navController::navigateToEventRegistration, + navigateToEventEdit = navController::navigateToEventEdit, navigateToSurveyCheck = navController::navigateToSurveyCheck, ) } diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventContent.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventContent.kt index e0bbf3b8..5078f9c0 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventContent.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventContent.kt @@ -31,7 +31,7 @@ import com.wap.wapp.core.model.event.Event @Composable internal fun ManagementEventContent( eventsState: ManagementViewModel.EventsState, - onCardClicked: (String) -> Unit, + onCardClicked: (String, String) -> Unit, onAddEventButtonClicked: () -> Unit, modifier: Modifier = Modifier, ) { @@ -70,7 +70,7 @@ internal fun ManagementEventContent( ManagementEventItem( item = event, cardColor = ManagementCardColor(currentIndex = currentIndex), - onCardClicked = { eventId -> onCardClicked(eventId) }, + onCardClicked = onCardClicked, ) } } @@ -91,13 +91,13 @@ internal fun ManagementEventContent( private fun ManagementEventItem( item: Event, cardColor: Color, - onCardClicked: (String) -> Unit, + onCardClicked: (String, String) -> Unit, ) { Card( shape = RoundedCornerShape(10.dp), modifier = Modifier .fillMaxSize() - .clickable { onCardClicked(item.eventId) }, + .clickable { onCardClicked(item.startDateTime.toString(), item.eventId) }, colors = CardDefaults.cardColors(containerColor = cardColor), ) { Row( @@ -131,9 +131,7 @@ private fun ManagementEventItem( painter = painterResource(com.wap.wapp.core.designresource.R.drawable.ic_forward), contentDescription = stringResource(R.string.detail_icon_description), tint = WappTheme.colors.yellow34, - modifier = Modifier - .clickable { onCardClicked(item.eventId) } - .size(20.dp), + modifier = Modifier.size(20.dp), ) } } diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt index 4068b399..9cd12c24 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt @@ -33,20 +33,22 @@ import kotlinx.coroutines.flow.collectLatest @Composable internal fun ManagementRoute( - viewModel: ManagementViewModel = hiltViewModel(), + navigateToEventEdit: (String, String) -> Unit, navigateToEventRegistration: () -> Unit, navigateToSurveyRegistration: () -> Unit, navigateToSurveyCheck: (String) -> Unit, + viewModel: ManagementViewModel = hiltViewModel(), ) { var isShowDialog by rememberSaveable { mutableStateOf(false) } val context = LocalContext.current ManagementScreen( - showManageCodeDialog = { isShowDialog = true }, viewModel = viewModel, + showManageCodeDialog = { isShowDialog = true }, navigateToEventRegistration = navigateToEventRegistration, navigateToSurveyRegistration = navigateToSurveyRegistration, navigateToSurveyCheck = navigateToSurveyCheck, + navigateToEventEdit = navigateToEventEdit, ) if (isShowDialog) { @@ -62,8 +64,9 @@ internal fun ManagementRoute( @OptIn(ExperimentalMaterial3Api::class) @Composable internal fun ManagementScreen( - showManageCodeDialog: () -> Unit, viewModel: ManagementViewModel, + showManageCodeDialog: () -> Unit, + navigateToEventEdit: (String, String) -> Unit, navigateToEventRegistration: () -> Unit, navigateToSurveyRegistration: () -> Unit, navigateToSurveyCheck: (String) -> Unit, @@ -114,7 +117,7 @@ internal fun ManagementScreen( ) { ManagementEventContent( eventsState = eventsState, - onCardClicked = {}, + onCardClicked = navigateToEventEdit, onAddEventButtonClicked = navigateToEventRegistration, ) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt index 58cdd6a8..739e3d47 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -146,8 +146,8 @@ internal fun EventEditScreen( Column( modifier = Modifier .fillMaxSize() - .padding(paddingValues) // paddingValue padding - .padding(16.dp), // dp value padding + .padding(paddingValues) + .padding(16.dp), ) { WappTopBar( titleRes = R.string.event_registration, diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/navigation/ManagementNavigation.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/navigation/ManagementNavigation.kt index 2d1065ca..8ec0eda4 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/navigation/ManagementNavigation.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/navigation/ManagementNavigation.kt @@ -14,12 +14,14 @@ fun NavController.navigateToManagement(navOptions: NavOptions? = navOptions {}) } fun NavGraphBuilder.managementScreen( + navigateToEventEdit: (String, String) -> Unit, navigateToEventRegistration: () -> Unit, navigateToSurveyRegistration: () -> Unit, navigateToSurveyCheck: (String) -> Unit, ) { composable(route = managementNavigationRoute) { ManagementRoute( + navigateToEventEdit = navigateToEventEdit, navigateToEventRegistration = navigateToEventRegistration, navigateToSurveyRegistration = navigateToSurveyRegistration, navigateToSurveyCheck = navigateToSurveyCheck, From 7eea3dab321d310ef487b13ddb3763d398e15ed6 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:29:12 +0900 Subject: [PATCH 16/23] =?UTF-8?q?[FIX]=20#78=20:=20navigateToEventEdit=20r?= =?UTF-8?q?oute=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/edit/event/navigation/EventEditNavigation.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt index 95443828..7acec11e 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/navigation/EventEditNavigation.kt @@ -9,7 +9,7 @@ import androidx.navigation.navArgument import androidx.navigation.navOptions import com.wap.wapp.feature.management.edit.event.EventEditRoute -const val eventEditNavigationRoute = "event/edit/{eventId}" +const val eventEditNavigationRoute = "event/edit/{date}/{eventId}" fun NavController.navigateToEventEdit( date: String, From bb731f078022c0832979fbf787fe0c73af0ab464 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:32:09 +0900 Subject: [PATCH 17/23] =?UTF-8?q?[FIX]=20#78=20:=20eventEdit=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/management/edit/event/EventEditScreen.kt | 4 ++-- .../wapp/feature/management/edit/event/EventEditViewModel.kt | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt index 739e3d47..8839f31b 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -67,6 +67,8 @@ internal fun EventEditRoute( val onRegisterButtonClicked = viewModel::updateEvent LaunchedEffect(true) { + viewModel.getEvent(date = date, eventId = eventId) + viewModel.eventEditEvent.collectLatest { when (it) { is EventRegistrationEvent.Failure -> { @@ -84,8 +86,6 @@ internal fun EventEditRoute( } } - viewModel.getEvent(date = date, eventId = eventId) - EventEditScreen( currentEditState = currentRegistrationState, title = title, diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index 8586d9d9..9cf80b15 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -72,10 +72,6 @@ class EventEditViewModel @Inject constructor( } fun setEventStartDate(eventDate: LocalDate) { - if (eventDate <= DateUtil.generateNowDate()) { - emitValidationErrorMessage("최소 하루 이상 일정 날짜를 지정하세요.") - return - } _eventStartDate.value = eventDate } From c9f09f347cc2e08ea02cac317ec5cefd70a7cc9a Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 18:34:16 +0900 Subject: [PATCH 18/23] =?UTF-8?q?[FEATURE]=20#78=20:=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20text=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/management/edit/event/EventEditScreen.kt | 2 +- .../management/registration/event/EventRegistrationContent.kt | 2 +- feature/management/src/main/res/values/strings.xml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt index 8839f31b..d388f515 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditScreen.kt @@ -150,7 +150,7 @@ internal fun EventEditScreen( .padding(16.dp), ) { WappTopBar( - titleRes = R.string.event_registration, + titleRes = R.string.event_edit, showLeftButton = true, onClickLeftButton = onBackButtonClicked, ) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationContent.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationContent.kt index 4aa396b1..898f195e 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationContent.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationContent.kt @@ -294,7 +294,7 @@ private fun EventScheduleContent( WappButton( onClick = onRegisterButtonClicked, - textRes = R.string.register_event, + textRes = R.string.edit_complete, modifier = Modifier.padding(bottom = 20.dp), ) } diff --git a/feature/management/src/main/res/values/strings.xml b/feature/management/src/main/res/values/strings.xml index 3e9c5b56..92a4783d 100644 --- a/feature/management/src/main/res/values/strings.xml +++ b/feature/management/src/main/res/values/strings.xml @@ -10,6 +10,7 @@ 설문 일정 일정 추가 + 일정 수정 / 2 행사 내용 작성 부원들이 알아보기 쉽도록 자세하게 작성해주세요. @@ -26,6 +27,7 @@ 언제 진행되는 일정인가요? 몇시부터 몇시까지 진행되는 일정인가요? 일정 등록 + 수정 완료 설문 등록 / 4 문항 추가 From 5896bf4751fd1065c76ef35dc42eda9689a2dfa8 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 19:22:29 +0900 Subject: [PATCH 19/23] =?UTF-8?q?[CHORE]=20#74=20:=20URL=20=EC=83=81?= =?UTF-8?q?=EC=88=98=ED=95=AD=EC=9C=BC=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wap/wapp/feature/profile/profilesetting/Const.kt | 7 +++++++ .../profile/profilesetting/ProfileSettingScreen.kt | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/Const.kt diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/Const.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/Const.kt new file mode 100644 index 00000000..5d3082bd --- /dev/null +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/Const.kt @@ -0,0 +1,7 @@ +package com.wap.wapp.feature.profile.profilesetting + +internal const val PRIVACY_POLICY_URL = + "https://www.notion.so/46beb7c4f3c2417bbec20eafd610d580?pvs=11" +internal const val FAQ_URL = "https://www.notion.so/46beb7c4f3c2417bbec20eafd610d580?pvs=11" +internal const val INQUIRY_URL = "https://www.notion.so/4fcb60f346c041248fd0d97d202a8a9a" +internal const val TERMS_AND_POLICIES_URL = "https://www.notion.so/042dc914a6a34093a51658693e009411" diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt index 563534ab..91194f01 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/ProfileSettingScreen.kt @@ -38,25 +38,25 @@ internal fun ProfileSettingRoute( onClickedPrivacyPolicy = { navigateToUri( context, - "https://www.notion.so/46beb7c4f3c2417bbec20eafd610d580?pvs=11", + PRIVACY_POLICY_URL, ) }, onClickedFAQ = { navigateToUri( context, - "https://www.notion.so/FAQ-5832683da65048549e6a976b54d62875", + FAQ_URL, ) }, onClickedInquiry = { navigateToUri( context, - "https://www.notion.so/4fcb60f346c041248fd0d97d202a8a9a", + INQUIRY_URL, ) }, onClickedTermsAndPolicies = { navigateToUri( context, - "https://www.notion.so/042dc914a6a34093a51658693e009411", + TERMS_AND_POLICIES_URL, ) }, ) From a40e82ab805a3c8b7d38d22b3c572dccf79a564d Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 19:46:05 +0900 Subject: [PATCH 20/23] =?UTF-8?q?[CHORE]=20#78=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/repository/event/EventRepository.kt | 20 +++++----- .../repository/event/EventRepositoryImpl.kt | 40 +++++++++---------- .../usecase/event/RegisterEventUseCase.kt | 10 ++--- .../usecase/event/UpdateEventUseCase.kt | 10 ++--- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt index 6ae96650..d374838f 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepository.kt @@ -10,19 +10,19 @@ interface EventRepository { suspend fun getEvent(date: LocalDateTime, eventId: String): Result suspend fun postEvent( - eventTitle: String, - eventContent: String, - eventLocation: String, - eventStartDateTime: LocalDateTime, - eventEndDateTime: LocalDateTime, + title: String, + content: String, + location: String, + startDateTime: LocalDateTime, + endDateTime: LocalDateTime, ): Result suspend fun updateEvent( eventId: String, - eventTitle: String, - eventContent: String, - eventLocation: String, - eventStartDateTime: LocalDateTime, - eventEndDateTime: LocalDateTime, + title: String, + content: String, + location: String, + startDateTime: LocalDateTime, + endDateTime: LocalDateTime, ): Result } diff --git a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt index 20dc2692..3bc9c704 100644 --- a/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt +++ b/core/data/src/main/java/com/wap/wapp/core/data/repository/event/EventRepositoryImpl.kt @@ -23,34 +23,34 @@ class EventRepositoryImpl @Inject constructor( } override suspend fun postEvent( - eventTitle: String, - eventContent: String, - eventLocation: String, - eventStartDateTime: LocalDateTime, - eventEndDateTime: LocalDateTime, + title: String, + content: String, + location: String, + startDateTime: LocalDateTime, + endDateTime: LocalDateTime, ): Result = eventDataSource.postEvent( - title = eventTitle, - content = eventContent, - location = eventLocation, - startDateTime = eventStartDateTime.toISOLocalDateTimeString(), - endDateTime = eventEndDateTime.toISOLocalDateTimeString(), + title = title, + content = content, + location = location, + startDateTime = startDateTime.toISOLocalDateTimeString(), + endDateTime = endDateTime.toISOLocalDateTimeString(), ) override suspend fun updateEvent( eventId: String, - eventTitle: String, - eventContent: String, - eventLocation: String, - eventStartDateTime: LocalDateTime, - eventEndDateTime: LocalDateTime, + title: String, + content: String, + location: String, + startDateTime: LocalDateTime, + endDateTime: LocalDateTime, ): Result = eventDataSource.updateEvent( eventId = eventId, - title = eventTitle, - content = eventContent, - location = eventLocation, - startDateTime = eventStartDateTime.toISOLocalDateTimeString(), - endDateTime = eventEndDateTime.toISOLocalDateTimeString(), + title = title, + content = content, + location = location, + startDateTime = startDateTime.toISOLocalDateTimeString(), + endDateTime = endDateTime.toISOLocalDateTimeString(), ) } diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/RegisterEventUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/RegisterEventUseCase.kt index 6950ad1b..90561ede 100644 --- a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/RegisterEventUseCase.kt +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/RegisterEventUseCase.kt @@ -19,11 +19,11 @@ class RegisterEventUseCase @Inject constructor( eventEndTime: LocalTime, ): Result = runCatching { eventRepository.postEvent( - eventTitle = eventTitle, - eventContent = eventContent, - eventLocation = eventLocation, - eventStartDateTime = LocalDateTime.of(eventStartDate, eventStartTime), - eventEndDateTime = LocalDateTime.of(eventEndDate, eventEndTime), + title = eventTitle, + content = eventContent, + location = eventLocation, + startDateTime = LocalDateTime.of(eventStartDate, eventStartTime), + endDateTime = LocalDateTime.of(eventEndDate, eventEndTime), ) } } diff --git a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt index 60d808d8..9c209253 100644 --- a/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt +++ b/core/domain/src/main/java/com/wap/wapp/core/domain/usecase/event/UpdateEventUseCase.kt @@ -21,11 +21,11 @@ class UpdateEventUseCase @Inject constructor( ): Result = runCatching { eventRepository.updateEvent( eventId = eventId, - eventTitle = eventTitle, - eventContent = eventContent, - eventLocation = eventLocation, - eventStartDateTime = LocalDateTime.of(eventStartDate, eventStartTime), - eventEndDateTime = LocalDateTime.of(eventEndDate, eventEndTime), + title = eventTitle, + content = eventContent, + location = eventLocation, + startDateTime = LocalDateTime.of(eventStartDate, eventStartTime), + endDateTime = LocalDateTime.of(eventEndDate, eventEndTime), ) } } From f73a3d9b0b61667d4c1c4def1ae47620ff07b506 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 19:47:34 +0900 Subject: [PATCH 21/23] =?UTF-8?q?[CHORE]=20#78=20:=20update=20=EB=A9=94?= =?UTF-8?q?=EC=86=8C=EB=93=9C=20=EB=B3=80=EC=88=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../network/source/event/EventDataSourceImpl.kt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt index ca3da7e1..364188e4 100644 --- a/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt +++ b/core/network/src/main/java/com/wap/wapp/core/network/source/event/EventDataSourceImpl.kt @@ -84,20 +84,19 @@ class EventDataSourceImpl @Inject constructor( endDateTime: String, ): Result = runCatching { val startDate = startDateTime.toISOLocalDateTime().toLocalDate() + val updateData = mapOf( + "title" to title, + "content" to content, + "location" to location, + "startDateTime" to startDateTime, + "endDateTime" to endDateTime, + ) firebaseFirestore.collection(EVENT_COLLECTION) .document(getMonth(startDate)) .collection(EVENT_COLLECTION) .document(eventId) - .update( - mapOf( - "title" to title, - "content" to content, - "location" to location, - "startDateTime" to startDateTime, - "endDateTime" to endDateTime, - ), - ) + .update(updateData) .await() } From 778b54f45297d835d07a237fd767e40b9700b6d5 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 19:54:57 +0900 Subject: [PATCH 22/23] =?UTF-8?q?[CHORE]=20#78=20:=20Validate=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit/event/EventEditViewModel.kt | 22 ++++++++++++---- .../event/EventRegistrationViewModel.kt | 25 ++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt index 9cf80b15..7bd82198 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/edit/event/EventEditViewModel.kt @@ -80,7 +80,7 @@ class EventEditViewModel @Inject constructor( } fun setEventEndDate(eventDate: LocalDate) { - if (eventDate < _eventStartDate.value) { + if (!isValidEndDate(eventDate)) { emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") return } @@ -88,7 +88,7 @@ class EventEditViewModel @Inject constructor( } fun setEventEndTime(eventTime: LocalTime) { - if (_eventEndDate.value == _eventStartDate.value && eventTime <= _eventStartTime.value) { + if (!isValidEndTime(eventTime)) { emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") return } @@ -97,11 +97,11 @@ class EventEditViewModel @Inject constructor( fun setEventRegistrationState() { if (_currentEditState.value == EventRegistrationState.EVENT_DETAILS) { - if (_eventTitle.value.isEmpty()) { + if (!isValidTitle()) { emitValidationErrorMessage("행사 이름을 입력하세요.") return } - if (_eventContent.value.isEmpty()) { + if (!isValidContent()) { emitValidationErrorMessage("행사 내용을 입력하세요.") return } @@ -110,10 +110,11 @@ class EventEditViewModel @Inject constructor( } fun updateEvent() { - if (_eventLocation.value.isEmpty()) { + if (!isValidLocation()) { emitValidationErrorMessage("장소를 입력하세요.") return } + viewModelScope.launch { updateEventUseCase( eventTitle = _eventTitle.value, @@ -132,6 +133,17 @@ class EventEditViewModel @Inject constructor( } } + private fun isValidEndTime(eventTime: LocalTime): Boolean = + _eventEndDate.value == _eventStartDate.value && eventTime > _eventStartTime.value + + private fun isValidEndDate(eventDate: LocalDate): Boolean = eventDate >= _eventStartDate.value + + private fun isValidContent(): Boolean = _eventContent.value.isNotEmpty() + + private fun isValidTitle(): Boolean = _eventTitle.value.isNotEmpty() + + private fun isValidLocation(): Boolean = _eventLocation.value.isNotEmpty() + fun getEvent(date: String, eventId: String) = viewModelScope.launch { val date = LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME) getEventUseCase(date, eventId).onSuccess { diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationViewModel.kt index 23634690..830461bc 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/registration/event/EventRegistrationViewModel.kt @@ -67,7 +67,7 @@ class EventRegistrationViewModel @Inject constructor( } fun setEventStartDate(eventDate: LocalDate) { - if (eventDate <= generateNowDate()) { + if (!isValidStartDate(eventDate)) { emitValidationErrorMessage("최소 하루 이상 일정 날짜를 지정하세요.") return } @@ -79,7 +79,7 @@ class EventRegistrationViewModel @Inject constructor( } fun setEventEndDate(eventDate: LocalDate) { - if (eventDate < _eventStartDate.value) { + if (!isValidEndDate(eventDate)) { emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") return } @@ -87,7 +87,7 @@ class EventRegistrationViewModel @Inject constructor( } fun setEventEndTime(eventTime: LocalTime) { - if (_eventEndDate.value == _eventStartDate.value && eventTime <= _eventStartTime.value) { + if (!isValidEndTime(eventTime)) { emitValidationErrorMessage("종료 날짜는 시작 날짜와 같거나 더 늦어야 합니다.") return } @@ -96,11 +96,11 @@ class EventRegistrationViewModel @Inject constructor( fun setEventRegistrationState() { if (_currentRegistrationState.value == EVENT_DETAILS) { - if (_eventTitle.value.isEmpty()) { + if (!isValidTitle()) { emitValidationErrorMessage("행사 이름을 입력하세요.") return } - if (_eventContent.value.isEmpty()) { + if (!isValidContent()) { emitValidationErrorMessage("행사 내용을 입력하세요.") return } @@ -109,7 +109,7 @@ class EventRegistrationViewModel @Inject constructor( } fun registerEvent() { - if (_eventLocation.value.isEmpty()) { + if (!isValidLocation()) { emitValidationErrorMessage("장소를 입력하세요.") return } @@ -130,6 +130,19 @@ class EventRegistrationViewModel @Inject constructor( } } + private fun isValidEndTime(eventTime: LocalTime): Boolean = + _eventEndDate.value == _eventStartDate.value && eventTime > _eventStartTime.value + + private fun isValidEndDate(eventDate: LocalDate): Boolean = eventDate >= _eventStartDate.value + + private fun isValidStartDate(eventDate: LocalDate): Boolean = eventDate > generateNowDate() + + private fun isValidContent(): Boolean = _eventContent.value.isNotEmpty() + + private fun isValidTitle(): Boolean = _eventTitle.value.isNotEmpty() + + private fun isValidLocation(): Boolean = _eventLocation.value.isNotEmpty() + private fun emitValidationErrorMessage(message: String) { viewModelScope.launch { _eventRegistrationEvent.emit( From 0dc72b8e899dab8116afb6b24ab5879845c7be29 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 3 Jan 2024 20:01:26 +0900 Subject: [PATCH 23/23] =?UTF-8?q?[CHORE]=20#78=20:=20Guest=EA=B0=80=20?= =?UTF-8?q?=EC=95=84=EB=8B=90=20=EA=B2=BD=EC=9A=B0=EC=97=90=EB=A7=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A3=BC=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/profile/ProfileScreen.kt | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt index d03eaab5..66a9bac0 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt @@ -69,19 +69,17 @@ internal fun ProfileScreen( .padding(start = 25.dp), ) - if (role == Role.GUEST) { - return@Box + if (role != Role.GUEST) { + Image( + painter = + painterResource(id = drawable.ic_subtract), + contentDescription = stringResource(id = R.string.profile_setting_description), + modifier = Modifier + .align(Alignment.CenterEnd) + .padding(end = 20.dp) + .clickable { navigateToProfileSetting() }, + ) } - - Image( - painter = - painterResource(id = drawable.ic_subtract), - contentDescription = stringResource(id = R.string.profile_setting_description), - modifier = Modifier - .align(Alignment.CenterEnd) - .padding(end = 20.dp) - .clickable { navigateToProfileSetting() }, - ) } when (role) {