feat(fantalk): 쓰기 입력 제한을 적용한다
This commit is contained in:
@@ -29,7 +29,15 @@ final class CreatorChannelFanTalkWriteViewModel: ObservableObject {
|
||||
|
||||
let maxContentCount = 500
|
||||
|
||||
var isContentOverLimit: Bool {
|
||||
content.count > maxContentCount
|
||||
}
|
||||
|
||||
var canSend: Bool {
|
||||
hasContent && isContentOverLimit == false
|
||||
}
|
||||
|
||||
private var hasContent: Bool {
|
||||
content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false
|
||||
}
|
||||
|
||||
@@ -40,7 +48,7 @@ final class CreatorChannelFanTalkWriteViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
func handleCancel() -> Bool {
|
||||
guard canSend else { return true }
|
||||
guard hasContent else { return true }
|
||||
|
||||
shouldShowExitModal = true
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user