Skip to content

Commit

Permalink
[Edit] CustomDialog 문제 해결 #178
Browse files Browse the repository at this point in the history
- LoginDialog가 나타날 때, toolbar Button disable 처리
- CustomDialog가 나타날 때, 제스쳐를 이용한 Back 못하게 처리
  • Loading branch information
withseon committed Apr 23, 2024
1 parent 2591b16 commit de9bcea
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions JUDA_iOS/JUDA/Resource/Components/CustomDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ struct CustomDialog: View {
.background(.background)
.cornerRadius(10)
}
.onAppear {
UINavigationController.allowSwipeBack = false
}
.onDisappear {
UINavigationController.allowSwipeBack = true
}
.navigationBarBackButtonHidden()
}

Expand Down
7 changes: 6 additions & 1 deletion JUDA_iOS/JUDA/Resource/UINavigationController +.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import SwiftUI

// MARK: - 스와이프 뒤로가기 제스처
extension UINavigationController: UIGestureRecognizerDelegate {
static var allowSwipeBack = true

override open func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
}
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
return viewControllers.count > 1
if UINavigationController.allowSwipeBack {
return viewControllers.count > 1
}
return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct DrinkDetailView: View {
} label: {
Image(systemName: "chevron.backward")
}
.disabled(authViewModel.isShowLoginDialog)
}
ToolbarItem(placement: .topBarTrailing) {
// 공유하기
Expand All @@ -106,6 +107,7 @@ struct DrinkDetailView: View {
) {
Image(systemName: "square.and.arrow.up")
}
.disabled(authViewModel.isShowLoginDialog)
}
}
.tint(.mainBlack)
Expand Down
1 change: 1 addition & 0 deletions JUDA_iOS/JUDA/View/Posts/NavigationPostsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct NavigationPostsView: View {
} label: {
Image(systemName: "chevron.left")
}
.disabled(authViewModel.isShowLoginDialog)
}
ToolbarItem(placement: .principal) {
Text(titleText)
Expand Down

0 comments on commit de9bcea

Please sign in to comment.