mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
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:
@@ -29,7 +29,7 @@ class AppCoordinator: AuthenticationCoordinatorDelegate, Coordinator {
|
|||||||
|
|
||||||
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
||||||
private var loadingIndicator: UserIndicator?
|
private var loadingIndicator: UserIndicator?
|
||||||
private var errorIndicator: UserIndicator?
|
private var statusIndicator: UserIndicator?
|
||||||
|
|
||||||
var childCoordinators: [Coordinator] = []
|
var childCoordinators: [Coordinator] = []
|
||||||
|
|
||||||
@@ -281,11 +281,11 @@ class AppCoordinator: AuthenticationCoordinatorDelegate, Coordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func showLoginErrorToast() {
|
private func showLoginErrorToast() {
|
||||||
errorIndicator = indicatorPresenter.present(.error(label: "Failed logging in"))
|
statusIndicator = indicatorPresenter.present(.error(label: "Failed logging in"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func showLogoutErrorToast() {
|
private func showLogoutErrorToast() {
|
||||||
errorIndicator = indicatorPresenter.present(.success(label: "Failed logging out"))
|
statusIndicator = indicatorPresenter.present(.error(label: "Failed logging out"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func showCrashPopup() {
|
private func showCrashPopup() {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ final class BugReportCoordinator: Coordinator, Presentable {
|
|||||||
|
|
||||||
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
||||||
private var loadingIndicator: UserIndicator?
|
private var loadingIndicator: UserIndicator?
|
||||||
private var errorIndicator: UserIndicator?
|
private var statusIndicator: UserIndicator?
|
||||||
|
|
||||||
// MARK: Public
|
// MARK: Public
|
||||||
|
|
||||||
@@ -67,12 +67,10 @@ final class BugReportCoordinator: Coordinator, Presentable {
|
|||||||
self.startLoading()
|
self.startLoading()
|
||||||
case .submitFinished:
|
case .submitFinished:
|
||||||
self.stopLoading()
|
self.stopLoading()
|
||||||
self.showSuccess(label: ElementL10n.done)
|
self.completion?()
|
||||||
case .submitFailed(let error):
|
case .submitFailed(let error):
|
||||||
self.stopLoading()
|
self.stopLoading()
|
||||||
self.showError(label: error.localizedDescription)
|
self.showError(label: error.localizedDescription)
|
||||||
case .cancel:
|
|
||||||
self.completion?()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,13 +95,8 @@ final class BugReportCoordinator: Coordinator, Presentable {
|
|||||||
loadingIndicator = nil
|
loadingIndicator = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Show success indicator
|
|
||||||
private func showSuccess(label: String) {
|
|
||||||
errorIndicator = indicatorPresenter.present(.success(label: label))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Show error indicator
|
/// Show error indicator
|
||||||
private func showError(label: String) {
|
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 submitStarted
|
||||||
case submitFinished
|
case submitFinished
|
||||||
case submitFailed(error: Error)
|
case submitFailed(error: Error)
|
||||||
case cancel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: View
|
// MARK: View
|
||||||
@@ -42,7 +41,6 @@ struct BugReportViewStateBindings {
|
|||||||
|
|
||||||
enum BugReportViewAction {
|
enum BugReportViewAction {
|
||||||
case submit
|
case submit
|
||||||
case cancel
|
|
||||||
case toggleSendLogs
|
case toggleSendLogs
|
||||||
case removeScreenshot
|
case removeScreenshot
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
|
|||||||
switch viewAction {
|
switch viewAction {
|
||||||
case .submit:
|
case .submit:
|
||||||
await submitBugReport()
|
await submitBugReport()
|
||||||
case .cancel:
|
|
||||||
callback?(.cancel)
|
|
||||||
case .toggleSendLogs:
|
case .toggleSendLogs:
|
||||||
context.sendingLogsEnabled.toggle()
|
context.sendingLogsEnabled.toggle()
|
||||||
case .removeScreenshot:
|
case .removeScreenshot:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
|
|
||||||
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
private var indicatorPresenter: UserIndicatorTypePresenterProtocol
|
||||||
private var loadingIndicator: UserIndicator?
|
private var loadingIndicator: UserIndicator?
|
||||||
|
private var statusIndicator: UserIndicator?
|
||||||
|
|
||||||
// MARK: Public
|
// MARK: Public
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
guard let self = self, let coordinator = coordinator else { return }
|
guard let self = self, let coordinator = coordinator else { return }
|
||||||
self.parameters.navigationRouter.popModule(animated: true)
|
self.parameters.navigationRouter.popModule(animated: true)
|
||||||
self.remove(childCoordinator: coordinator)
|
self.remove(childCoordinator: coordinator)
|
||||||
|
self.showSuccess(label: ElementL10n.done)
|
||||||
}
|
}
|
||||||
|
|
||||||
add(childCoordinator: coordinator)
|
add(childCoordinator: coordinator)
|
||||||
@@ -106,4 +108,9 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
self.remove(childCoordinator: coordinator)
|
self.remove(childCoordinator: coordinator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Show success indicator
|
||||||
|
private func showSuccess(label: String) {
|
||||||
|
statusIndicator = indicatorPresenter.present(.success(label: label))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Settings: Auto dismiss bug report screen and show a success indicator when bug report completed.
|
||||||
Reference in New Issue
Block a user