fix(profile): 차단 유저 프로필 진입 실패 시 자동 복귀를 추가한다
This commit is contained in:
@@ -24,6 +24,8 @@ struct UserProfileView: View {
|
||||
@State private var isShowMenuSettings: Bool = false
|
||||
@State private var isShowCreatorDetailDialog: Bool = false
|
||||
@State private var isShowChannelDonationDialog: Bool = false
|
||||
@State private var didTriggerAutoBackOnLoadFailure: Bool = false
|
||||
@State private var isViewVisible: Bool = false
|
||||
|
||||
@State private var maxCommunityPostHeight: CGFloat? = nil
|
||||
|
||||
@@ -392,11 +394,7 @@ struct UserProfileView: View {
|
||||
|
||||
HStack(spacing: 14) {
|
||||
Button {
|
||||
if presentationMode.wrappedValue.isPresented {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
} else {
|
||||
AppState.shared.back()
|
||||
}
|
||||
goBack()
|
||||
} label: {
|
||||
Image("ic_back")
|
||||
.resizable()
|
||||
@@ -635,9 +633,34 @@ struct UserProfileView: View {
|
||||
}
|
||||
)
|
||||
.onAppear {
|
||||
isViewVisible = true
|
||||
didTriggerAutoBackOnLoadFailure = false
|
||||
viewModel.getCreatorProfile(userId: userId)
|
||||
AppState.shared.pushChannelId = 0
|
||||
}
|
||||
.onDisappear {
|
||||
isViewVisible = false
|
||||
}
|
||||
.onChange(of: viewModel.isShowPopup) { isShowing in
|
||||
guard isShowing else { return }
|
||||
guard viewModel.creatorProfile == nil else { return }
|
||||
guard !didTriggerAutoBackOnLoadFailure else { return }
|
||||
|
||||
didTriggerAutoBackOnLoadFailure = true
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
||||
guard isViewVisible else { return }
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func goBack() {
|
||||
if presentationMode.wrappedValue.isPresented {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
} else {
|
||||
AppState.shared.back()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user