diff --git a/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailFeature.swift b/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailFeature.swift index a9047819..e51f87ba 100644 --- a/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailFeature.swift +++ b/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailFeature.swift @@ -69,10 +69,12 @@ public struct ContentDetailFeature { case 삭제_버튼_눌렀을때 case 삭제확인_버튼_눌렀을때 case 즐겨찾기_버튼_눌렀을때 + case 키보드_취소_버튼_눌렀을때 + case 키보드_완료_버튼_눌렀울때 + case 경고시트_해제 case 링크_공유_완료되었을때 - case 메모포커스_변경되었을때(Bool) } public enum InnerAction: Equatable { @@ -179,12 +181,12 @@ private extension ContentDetailFeature { case .경고시트_해제: state.showAlert = false return .none - case let .메모포커스_변경되었을때(isFocused): - guard - !isFocused, - state.memo != state.domain.content?.memo - else { return .none } + case .키보드_취소_버튼_눌렀을때: + state.memo = state.domain.content?.memo ?? "" + return .none + case .키보드_완료_버튼_눌렀울때: let memo = state.memo + guard memo != state.domain.content?.memo else { return .none } state.domain.content?.memo = memo return .send(.async(.컨텐츠_수정_API)) } diff --git a/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailView.swift b/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailView.swift index ea08e3ff..e0c4ac31 100644 --- a/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailView.swift +++ b/Projects/Feature/FeatureContentDetail/Sources/ContentDetail/ContentDetailView.swift @@ -56,8 +56,8 @@ public extension ContentDetailView { PokitLinkPopup(type: $store.linkPopup) } } - .dismissKeyboard(focused: $isFocused) - .onChange(of: isFocused) { send(.메모포커스_변경되었을때($0)) } +// .dismissKeyboard(focused: $isFocused) +// .onChange(of: isFocused) { send(.메모포커스_변경되었을때($0)) } .sheet(isPresented: $store.showAlert) { PokitAlert( "링크를 정말 삭제하시겠습니까?", @@ -159,12 +159,29 @@ private extension ContentDetailView { focusState: $isFocused, equals: true ) + .toolbar { keyboardToolBar } .frame(minHeight: isFocused ? 164 : 132) .animation(.pokitDissolve, value: isFocused) } .padding(.bottom, 24) .padding(.horizontal, 20) } + + var keyboardToolBar: some ToolbarContent { + ToolbarItemGroup(placement: .keyboard) { + Button("취소") { + isFocused = false + send(.키보드_취소_버튼_눌렀을때) + } + + Spacer() + + Button("완료") { + isFocused = false + send(.키보드_완료_버튼_눌렀울때) + } + } + } @ViewBuilder func bottomList(favorites: Bool) -> some View {