Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto dismiss bug report when completed #83

Merged
merged 4 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ final class BugReportCoordinator: Coordinator, Presentable {
self.startLoading()
case .submitFinished:
self.stopLoading()
self.showSuccess(label: ElementL10n.done)
self.completion?()
case .submitFailed(let error):
self.stopLoading()
self.showError(label: error.localizedDescription)
case .cancel:
self.completion?()
}
}
}
Expand All @@ -97,11 +95,6 @@ final class BugReportCoordinator: Coordinator, Presentable {
loadingIndicator = nil
}

/// Show success indicator
private func showSuccess(label: String) {
errorIndicator = indicatorPresenter.present(.success(label: label))
}

/// Show error indicator
private func showError(label: String) {
errorIndicator = indicatorPresenter.present(.error(label: label))
Expand Down
2 changes: 0 additions & 2 deletions ElementX/Sources/Screens/BugReport/BugReportModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum BugReportViewModelAction {
case submitStarted
case submitFinished
case submitFailed(error: Error)
case cancel
}

// MARK: View
Expand All @@ -42,7 +41,6 @@ struct BugReportViewStateBindings {

enum BugReportViewAction {
case submit
case cancel
case toggleSendLogs
case removeScreenshot
}
2 changes: 0 additions & 2 deletions ElementX/Sources/Screens/BugReport/BugReportViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
switch viewAction {
case .submit:
await submitBugReport()
case .cancel:
callback?(.cancel)
case .toggleSendLogs:
context.sendingLogsEnabled.toggle()
case .removeScreenshot:
Expand Down
7 changes: 7 additions & 0 deletions ElementX/Sources/Screens/Settings/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class SettingsCoordinator: Coordinator, Presentable {

private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var loadingIndicator: UserIndicator?
private var errorIndicator: UserIndicator?

// MARK: Public

Expand Down Expand Up @@ -96,6 +97,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
guard let self = self, let coordinator = coordinator else { return }
self.parameters.navigationRouter.popModule(animated: true)
self.remove(childCoordinator: coordinator)
self.showSuccess(label: ElementL10n.done)
}

add(childCoordinator: coordinator)
Expand All @@ -106,4 +108,9 @@ final class SettingsCoordinator: Coordinator, Presentable {
self.remove(childCoordinator: coordinator)
}
}

/// Show success indicator
private func showSuccess(label: String) {
errorIndicator = indicatorPresenter.present(.success(label: label))
ismailgulek marked this conversation as resolved.
Show resolved Hide resolved
}
}
1 change: 1 addition & 0 deletions changelog.d/76.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Settings: Auto dismiss bug report screen and show a success indicator when bug report completed.