diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenCoordinator.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenCoordinator.swift index 8e6be716a..443a19ee6 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenCoordinator.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenCoordinator.swift @@ -88,7 +88,7 @@ final class BugReportScreenCoordinator: CoordinatorProtocol { private func startLoading(label: String = L10n.commonLoading, progressPublisher: CurrentValuePublisher) { parameters.userIndicatorController?.submitIndicator( UserIndicator(id: Self.loadingIndicatorIdentifier, - type: .modal(progress: .published(progressPublisher), interactiveDismissDisabled: false, allowsInteraction: false), + type: .modal(progress: .published(progressPublisher), interactiveDismissDisabled: false, allowsInteraction: true), title: label, persistent: true) ) diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift index 78e27ed6e..3d483f9f3 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenModels.swift @@ -28,6 +28,7 @@ struct BugReportScreenViewState: BindableState { var screenshot: UIImage? var bindings: BugReportScreenViewStateBindings let isModallyPresented: Bool + var shouldDisableInteraction = false } struct BugReportScreenViewStateBindings { diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift index 81b8f93cc..a90116437 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift @@ -24,6 +24,7 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie private let userID: String private let deviceID: String? private let actionsSubject: PassthroughSubject = .init() + @CancellableTask private var uploadTask: Task? var actions: AnyPublisher { actionsSubject.eraseToAnyPublisher() @@ -49,9 +50,11 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie override func process(viewAction: BugReportScreenViewAction) { switch viewAction { case .cancel: + uploadTask = nil actionsSubject.send(.cancel) case .submit: - Task { await submitBugReport() } + state.shouldDisableInteraction = true + uploadTask = Task { await submitBugReport() } case .removeScreenshot: state.screenshot = nil case let .attachScreenshot(image): diff --git a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift index 4212ed60f..cd6690f59 100644 --- a/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift +++ b/ElementX/Sources/Screens/BugReportScreen/View/BugReportScreen.swift @@ -32,6 +32,7 @@ struct BugReportScreen: View { sendLogsSection canContactSection } + .disabled(context.viewState.shouldDisableInteraction) .scrollDismissesKeyboard(.immediately) .compoundList() .navigationTitle(L10n.commonReportABug) @@ -131,6 +132,7 @@ struct BugReportScreen: View { context.send(viewAction: .submit) } .disabled(context.reportText.count < 5) + .disabled(context.viewState.shouldDisableInteraction) } } } diff --git a/changelog.d/1198.bugfix b/changelog.d/1198.bugfix new file mode 100644 index 000000000..e69de29bb