Allow reporting a problem from the onboarding screen

This commit is contained in:
Stefan Ceriu
2024-01-20 17:10:12 +02:00
parent 261258dd0a
commit 0fe52fe54b
16 changed files with 71 additions and 23 deletions
@@ -24,11 +24,12 @@ protocol AuthenticationCoordinatorDelegate: AnyObject {
class AuthenticationCoordinator: CoordinatorProtocol {
private let authenticationService: AuthenticationServiceProxyProtocol
private let appLockService: AppLockServiceProtocol
private let bugReportService: BugReportServiceProtocol
private let navigationStackCoordinator: NavigationStackCoordinator
private let appSettings: AppSettings
private let analytics: AnalyticsService
private let userIndicatorController: UserIndicatorControllerProtocol
private let appLockService: AppLockServiceProtocol
private var cancellables = Set<AnyCancellable>()
@@ -39,17 +40,19 @@ class AuthenticationCoordinator: CoordinatorProtocol {
weak var delegate: AuthenticationCoordinatorDelegate?
init(authenticationService: AuthenticationServiceProxyProtocol,
appLockService: AppLockServiceProtocol,
bugReportService: BugReportServiceProtocol,
navigationStackCoordinator: NavigationStackCoordinator,
appSettings: AppSettings,
analytics: AnalyticsService,
userIndicatorController: UserIndicatorControllerProtocol,
appLockService: AppLockServiceProtocol) {
userIndicatorController: UserIndicatorControllerProtocol) {
self.authenticationService = authenticationService
self.appLockService = appLockService
self.bugReportService = bugReportService
self.navigationStackCoordinator = navigationStackCoordinator
self.appSettings = appSettings
self.analytics = analytics
self.userIndicatorController = userIndicatorController
self.appLockService = appLockService
}
func start() {
@@ -81,6 +84,8 @@ class AuthenticationCoordinator: CoordinatorProtocol {
switch action {
case .login:
Task { await self.startAuthentication() }
case .reportProblem:
showReportProblemScreen()
}
}
.store(in: &cancellables)
@@ -88,6 +93,27 @@ class AuthenticationCoordinator: CoordinatorProtocol {
navigationStackCoordinator.setRootCoordinator(coordinator)
}
private func showReportProblemScreen() {
let feedbackNavigationStackCoordinator = NavigationStackCoordinator()
let parameters = BugReportScreenCoordinatorParameters(bugReportService: bugReportService,
userID: nil,
deviceID: nil,
userIndicatorController: ServiceLocator.shared.userIndicatorController,
screenshot: nil,
isModallyPresented: true)
let coordinator = BugReportScreenCoordinator(parameters: parameters)
coordinator.completion = { [weak self] _ in
self?.navigationStackCoordinator.setSheetCoordinator(nil)
}
feedbackNavigationStackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(feedbackNavigationStackCoordinator, animated: true)
}
private func startAuthentication() async {
startLoading()