From 9438d26fffe35acbe6d109bd86aff5bedb1cef62 Mon Sep 17 00:00:00 2001 From: soopeach Date: Sat, 17 Dec 2022 23:24:02 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=EC=9C=A0=ED=9A=A8=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EA=B7=9C=EC=B9=99=EC=9D=84=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EC=8A=A4=EB=82=B5=EB=B0=94?= =?UTF-8?q?=EB=A1=9C=20=EC=95=8C=EB=A6=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community/group/create/CreateGroupFragment.kt | 3 +++ .../community/group/create/CreateGroupViewModel.kt | 9 +++++---- .../presentation/community/group/create/Event.kt | 1 + presentation/src/main/res/values/strings.xml | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupFragment.kt b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupFragment.kt index dd25dc26..cd6e374b 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupFragment.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupFragment.kt @@ -110,6 +110,9 @@ internal class CreateGroupFragment : } } } + is Event.InvalidRule -> { + binding.root.makeSnackBar(getString(R.string.text_invalid_rule)).show() + } } } diff --git a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupViewModel.kt b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupViewModel.kt index 460fbc05..2cd2201e 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupViewModel.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/CreateGroupViewModel.kt @@ -41,6 +41,8 @@ class CreateGroupViewModel @Inject constructor( fun onDialogConfirm(date: String, hour: String, minute: String) { if (date.isNotEmpty() && hour.isNotEmpty() && minute.isNotEmpty()) { rules.value = rules.value + listOf("$date-$hour-$minute") + } else { + emitEvent(Event.InvalidRule) } _showDialog.value = false @@ -110,10 +112,9 @@ class CreateGroupViewModel @Inject constructor( _eventFlow.emit(event) } } - is Event.WarningButtonClick -> { - _eventFlow.emit(event) - } - is Event.AddRuleButtonClick -> { + is Event.WarningButtonClick, + is Event.AddRuleButtonClick, + is Event.InvalidRule -> { _eventFlow.emit(event) } } diff --git a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/Event.kt b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/Event.kt index a5fdf432..f4ec7f1c 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/community/group/create/Event.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/community/group/create/Event.kt @@ -4,5 +4,6 @@ sealed class Event { data class CreateGroupButtonClick(val isSuccess: Boolean = true) : Event() object WarningButtonClick : Event() object AddRuleButtonClick : Event() + object InvalidRule : Event() data class DuplicateCheckButtonClick(val isDuplicatedGroupName: Boolean = false) : Event() } diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 049957d8..63fc7873 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -190,5 +190,6 @@ 확인 요일 및 시간을 골라주세요!! + 유효하지 않은 규칙입니다. \ No newline at end of file