Skip to content

Commit

Permalink
Communication: Fix Upload Image screen stuck on Done (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
anian03 authored Dec 2, 2024
1 parent a81bff8 commit 3d87d0e
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ private struct UploadImageView: View {
.animation(.smooth(duration: 0.2), value: viewModel.uploadState)
}
.interactiveDismissDisabled()
.onChange(of: viewModel.uploadState) {
if viewModel.uploadState == .done {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
dismiss()
}
}
if viewModel.error != nil {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
dismiss()
}
}
}
}

@ViewBuilder var statusIcon: some View {
Expand All @@ -89,10 +77,20 @@ private struct UploadImageView: View {
if viewModel.uploadState == .done {
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(.green)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
dismiss()
}
}
}
if viewModel.error != nil {
Image(systemName: "xmark.circle.fill")
.foregroundStyle(.red)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
dismiss()
}
}
}
}
.font(.largeTitle)
Expand Down

0 comments on commit 3d87d0e

Please sign in to comment.