Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #169 from GSM-MSG/168-textField-enter-check
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsh153 authored Mar 5, 2023
2 parents ce4c487 + b6a03fe commit ff9fd2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ extension NewClubReactor {
private extension NewClubReactor {
func secondNextButtonDidTap() -> Observable<Mutation> {
var errorMessage = ""
if currentState.name.isEmpty {
if currentState.name.isBlank() {
errorMessage = "동아리 이름을 입력해주세요!"
} else if currentState.content.isEmpty || currentState.content == "동아리 설명을 입력해주세요." {
} else if currentState.content.isBlank() || currentState.content.trimmingCharacters(in: .whitespaces).hasPrefix("\n") || currentState.content == "동아리 설명을 입력해주세요." {
errorMessage = "동아리 설명을 입력해주세요!"
} else if currentState.contact.isEmpty {
} else if currentState.contact.isBlank() {
errorMessage = "연락처를 입력해주세요!"
} else if currentState.notionLink.isEmpty || !currentState.notionLink.hasPrefix("https://") {
} else if currentState.notionLink.isBlank() || !currentState.notionLink.hasPrefix("https://") {
errorMessage = "노션 링크를 정확히 입력해주세요!"
} else {
steps.accept(GCMSStep.thirdNewClubIsRequired(reactor: self))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,16 @@ extension UpdateClubReactor {
private extension UpdateClubReactor {
func secondNextButtonDidTap() -> Observable<Mutation> {
var errorMessage = ""
if currentState.name.isEmpty {
if currentState.name.isBlank() {
errorMessage = "동아리 이름을 입력해주세요!"
}
else if currentState.content.isEmpty || currentState.content == "동아리 설명을 입력해주세요." {
else if currentState.content.isBlank() || currentState.content.trimmingCharacters(in: .whitespaces).hasPrefix("\n") || currentState.content == "동아리 설명을 입력해주세요." {
errorMessage = "동아리 설명을 입력해주세요!"
}
else if currentState.contact.isEmpty {
else if currentState.contact.isBlank() {
errorMessage = "연락처를 입력해주세요!"
}
else if currentState.notionLink.isEmpty || !currentState.notionLink.hasPrefix("https://") {
else if currentState.notionLink.isBlank() || !currentState.notionLink.hasPrefix("https://") {
errorMessage = "노션 링크를 정확히 입력해주세요!"
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ extension String {
return self
}
}
func isBlank() -> Bool {
return self.trimmingCharacters(in: .whitespaces).isEmpty
}
}

0 comments on commit ff9fd2a

Please sign in to comment.