Skip to content

Commit

Permalink
✨ 유효하지 않은 규칙을 생성 시 스낵바로 알림
Browse files Browse the repository at this point in the history
  • Loading branch information
soopeach committed Dec 17, 2022
1 parent 675a5b0 commit 9438d26
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ internal class CreateGroupFragment :
}
}
}
is Event.InvalidRule -> {
binding.root.makeSnackBar(getString(R.string.text_invalid_rule)).show()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
1 change: 1 addition & 0 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@
<string name="text_minute">분</string>
<string name="text_confirm">확인</string>
<string name="text_rule_picker_title">요일 및 시간을 골라주세요!!</string>
<string name="text_invalid_rule">유효하지 않은 규칙입니다.</string>

</resources>

0 comments on commit 9438d26

Please sign in to comment.