Auto dismiss bug report when completed (#83)

* #76 Show success indicator on settings coordinator when bug report completed

* #76 Add changelog

* #76 remove unused method

* #76 Rename `errorIndicator`s to `statusIndicator`s
This commit is contained in:
ismailgulek
2022-06-20 13:06:29 +03:00
committed by GitHub
parent 4738f3016d
commit 40e51fb157
6 changed files with 14 additions and 17 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ class AppCoordinator: AuthenticationCoordinatorDelegate, Coordinator {
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var loadingIndicator: UserIndicator?
private var errorIndicator: UserIndicator?
private var statusIndicator: UserIndicator?
var childCoordinators: [Coordinator] = []
@@ -281,11 +281,11 @@ class AppCoordinator: AuthenticationCoordinatorDelegate, Coordinator {
}
private func showLoginErrorToast() {
errorIndicator = indicatorPresenter.present(.error(label: "Failed logging in"))
statusIndicator = indicatorPresenter.present(.error(label: "Failed logging in"))
}
private func showLogoutErrorToast() {
errorIndicator = indicatorPresenter.present(.success(label: "Failed logging out"))
statusIndicator = indicatorPresenter.present(.error(label: "Failed logging out"))
}
private func showCrashPopup() {
@@ -33,7 +33,7 @@ final class BugReportCoordinator: Coordinator, Presentable {
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var loadingIndicator: UserIndicator?
private var errorIndicator: UserIndicator?
private var statusIndicator: UserIndicator?
// MARK: Public
@@ -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?()
}
}
}
@@ -97,13 +95,8 @@ 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))
statusIndicator = indicatorPresenter.present(.error(label: label))
}
}
@@ -25,7 +25,6 @@ enum BugReportViewModelAction {
case submitStarted
case submitFinished
case submitFailed(error: Error)
case cancel
}
// MARK: View
@@ -42,7 +41,6 @@ struct BugReportViewStateBindings {
enum BugReportViewAction {
case submit
case cancel
case toggleSendLogs
case removeScreenshot
}
@@ -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:
@@ -33,6 +33,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
private var loadingIndicator: UserIndicator?
private var statusIndicator: UserIndicator?
// MARK: Public
@@ -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)
@@ -106,4 +108,9 @@ final class SettingsCoordinator: Coordinator, Presentable {
self.remove(childCoordinator: coordinator)
}
}
/// Show success indicator
private func showSuccess(label: String) {
statusIndicator = indicatorPresenter.present(.success(label: label))
}
}
+1
View File
@@ -0,0 +1 @@
Settings: Auto dismiss bug report screen and show a success indicator when bug report completed.