From e80082fe287f1b2ef753458850d03d1556d80740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20Cisin=CC=81ski?= Date: Thu, 13 Apr 2023 22:51:11 +0200 Subject: [PATCH] v4.2.0 Changing arrows for import screens --- TwoFAS/TwoFAS.xcodeproj/project.pbxproj | 8 ++-- .../ExternalImportService.swift} | 3 +- .../ImporterEnterPasswordFlowController.swift | 34 ++++++++++++--- .../ImporterEnterPasswordPresenter.swift | 19 +++++++-- .../Flow/ImporterOpenFileFlowController.swift | 42 +++++++++++++++---- .../Presenter/ImporterOpenFilePresenter.swift | 18 +++++--- ...porterPreimportSummaryFlowController.swift | 6 ++- .../ImporterPreimportSummaryPresenter.swift | 16 ++++++- ...porterPreimportSummaryViewController.swift | 35 +++++++++++++++- ...rnalImportInstructionsFlowController.swift | 2 +- .../ExternalImportInstructionsPresenter.swift | 16 ++++--- .../View/ExternalImportInstructionsView.swift | 15 +++---- 12 files changed, 167 insertions(+), 47 deletions(-) rename TwoFAS/TwoFAS/{Root/Modules/Settings/ExternalImportInstructions/ExternalImportInstructionsService.swift => Common/ExternalImportService.swift} (95%) diff --git a/TwoFAS/TwoFAS.xcodeproj/project.pbxproj b/TwoFAS/TwoFAS.xcodeproj/project.pbxproj index 0bed2b46..4d9da611 100644 --- a/TwoFAS/TwoFAS.xcodeproj/project.pbxproj +++ b/TwoFAS/TwoFAS.xcodeproj/project.pbxproj @@ -779,7 +779,7 @@ C2CC0A4629D098CB00677A7B /* ExternalImportInstructionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4529D098CB00677A7B /* ExternalImportInstructionsView.swift */; }; C2CC0A4829D0C9FC00677A7B /* ExternalImportInstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4729D0C9FC00677A7B /* ExternalImportInstructionsViewController.swift */; }; C2CC0A4A29D0CACC00677A7B /* ExternalImportInstructionsPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4929D0CACC00677A7B /* ExternalImportInstructionsPresenter.swift */; }; - C2CC0A4C29D0D4FC00677A7B /* ExternalImportInstructionsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4B29D0D4FC00677A7B /* ExternalImportInstructionsService.swift */; }; + C2CC0A4C29D0D4FC00677A7B /* ExternalImportService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4B29D0D4FC00677A7B /* ExternalImportService.swift */; }; C2CC0A4E29D0D62600677A7B /* ExternalImportInstructionsFlowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC0A4D29D0D62600677A7B /* ExternalImportInstructionsFlowController.swift */; }; C2CC80D627B99AF700294CF2 /* ComposeServicePresenter+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC80D527B99AF700294CF2 /* ComposeServicePresenter+Menu.swift */; }; C2CC80D827B99B0600294CF2 /* ComposeServicePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CC80D727B99B0600294CF2 /* ComposeServicePresenter.swift */; }; @@ -2019,7 +2019,7 @@ C2CC0A4529D098CB00677A7B /* ExternalImportInstructionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportInstructionsView.swift; sourceTree = ""; }; C2CC0A4729D0C9FC00677A7B /* ExternalImportInstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportInstructionsViewController.swift; sourceTree = ""; }; C2CC0A4929D0CACC00677A7B /* ExternalImportInstructionsPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportInstructionsPresenter.swift; sourceTree = ""; }; - C2CC0A4B29D0D4FC00677A7B /* ExternalImportInstructionsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportInstructionsService.swift; sourceTree = ""; }; + C2CC0A4B29D0D4FC00677A7B /* ExternalImportService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportService.swift; sourceTree = ""; }; C2CC0A4D29D0D62600677A7B /* ExternalImportInstructionsFlowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalImportInstructionsFlowController.swift; sourceTree = ""; }; C2CC80D527B99AF700294CF2 /* ComposeServicePresenter+Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ComposeServicePresenter+Menu.swift"; sourceTree = ""; }; C2CC80D727B99B0600294CF2 /* ComposeServicePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeServicePresenter.swift; sourceTree = ""; }; @@ -5584,6 +5584,7 @@ C2DFE5BC264C851700F828C0 /* CircleView.swift */, C2633EFC265A7D090034B836 /* TokenLabel.swift */, C266542A2725EF7B00DC3A3C /* ExportFileRules.swift */, + C2CC0A4B29D0D4FC00677A7B /* ExternalImportService.swift */, C2698B712986F6E800EBC179 /* UITabBarController+addTab.swift */, ); path = Common; @@ -5894,7 +5895,6 @@ C2CC0A4129D08D7700677A7B /* ExternalImportInstructions */ = { isa = PBXGroup; children = ( - C2CC0A4B29D0D4FC00677A7B /* ExternalImportInstructionsService.swift */, C2CC0A4429D08DAD00677A7B /* Flow */, C2CC0A4329D08DA500677A7B /* Presenter */, C2CC0A4229D08DA000677A7B /* View */, @@ -7461,7 +7461,7 @@ C240485E27654C5F0076376E /* ImporterEnterPasswordFlowController.swift in Sources */, C2A7944D27F795E900E5C641 /* BrowserExtensionPairedService.swift in Sources */, C287D4FB276A92460001B272 /* AppSecurityExtensions.swift in Sources */, - C2CC0A4C29D0D4FC00677A7B /* ExternalImportInstructionsService.swift in Sources */, + C2CC0A4C29D0D4FC00677A7B /* ExternalImportService.swift in Sources */, C244718825F4F6900024B4C5 /* ComposeServiceFormRowTitleLabel.swift in Sources */, C2D587362650549700D9C4BD /* IntroductionPage4View.swift in Sources */, C21A9E8827CBF77100FE4CC4 /* ComposeServiceNumberOfDigitsPresenter+Menu.swift in Sources */, diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/ExternalImportInstructionsService.swift b/TwoFAS/TwoFAS/Common/ExternalImportService.swift similarity index 95% rename from TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/ExternalImportInstructionsService.swift rename to TwoFAS/TwoFAS/Common/ExternalImportService.swift index 142ec75c..f90c3d6d 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/ExternalImportInstructionsService.swift +++ b/TwoFAS/TwoFAS/Common/ExternalImportService.swift @@ -19,9 +19,10 @@ import Foundation -enum ExternalImportInstructionsService { +enum ExternalImportService { case aegis case raivo case lastPass case googleAuth + case twofas } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Flow/ImporterEnterPasswordFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Flow/ImporterEnterPasswordFlowController.swift index a578bcb6..c502f10b 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Flow/ImporterEnterPasswordFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Flow/ImporterEnterPasswordFlowController.swift @@ -22,7 +22,12 @@ import Common protocol ImporterEnterPasswordFlowControllerParent: AnyObject { func hidePasswordImport() - func showPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) + func showPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) func showFileError(error: ImporterOpenFileError) func showFileIsEmpty() func showWrongPassword() @@ -30,7 +35,12 @@ protocol ImporterEnterPasswordFlowControllerParent: AnyObject { protocol ImporterEnterPasswordFlowControlling: AnyObject { func toClose() - func toPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) + func toPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) func toFileError(error: ImporterOpenFileError) func toFileIsEmpty() func toWrongPassword() @@ -42,7 +52,8 @@ final class ImporterEnterPasswordFlowController: FlowController { static func push( in navigationController: UINavigationController, parent: ImporterEnterPasswordFlowControllerParent, - data: ExchangeDataFormat + data: ExchangeDataFormat, + externalImportService: ExternalImportService ) { let view = ImporterEnterPasswordViewController() let flowController = ImporterEnterPasswordFlowController(viewController: view) @@ -52,7 +63,8 @@ final class ImporterEnterPasswordFlowController: FlowController { ) let presenter = ImporterEnterPasswordPresenter( flowController: flowController, - interactor: interactor + interactor: interactor, + externalImportService: externalImportService ) presenter.view = view view.presenter = presenter @@ -66,8 +78,18 @@ extension ImporterEnterPasswordFlowController: ImporterEnterPasswordFlowControll parent?.hidePasswordImport() } - func toPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) { - parent?.showPreimportSummary(count: count, sections: sections, services: services) + func toPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) { + parent?.showPreimportSummary( + count: count, + sections: sections, + services: services, + externalImportService: externalImportService + ) } func toFileError(error: ImporterOpenFileError) { diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Presenter/ImporterEnterPasswordPresenter.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Presenter/ImporterEnterPasswordPresenter.swift index 6e02d56f..8e74cdec 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Presenter/ImporterEnterPasswordPresenter.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterEnterPassword/Presenter/ImporterEnterPasswordPresenter.swift @@ -41,10 +41,16 @@ final class ImporterEnterPasswordPresenter { private let flowController: ImporterEnterPasswordFlowControlling private let interactor: ImporterEnterPasswordModuleInteracting + private let externalImportService: ExternalImportService - init(flowController: ImporterEnterPasswordFlowControlling, interactor: ImporterEnterPasswordModuleInteracting) { + init( + flowController: ImporterEnterPasswordFlowControlling, + interactor: ImporterEnterPasswordModuleInteracting, + externalImportService: ExternalImportService + ) { self.flowController = flowController self.interactor = interactor + self.externalImportService = externalImportService } } @@ -59,7 +65,7 @@ extension ImporterEnterPasswordPresenter { return } switch interactor.openFile(with: password) { - case .success(let data): parseData(data) + case .success(let data): parseData(data, externalImportService: externalImportService) case .cantReadFile: flowController.toFileError(error: .cantReadFile(reason: nil)) case .wrongPassword: flowController.toWrongPassword() } @@ -91,11 +97,16 @@ extension ImporterEnterPasswordPresenter { } private extension ImporterEnterPasswordPresenter { - func parseData(_ data: ExchangeDataServices) { + func parseData(_ data: ExchangeDataServices, externalImportService: ExternalImportService) { let result = interactor.parseFile(with: data) if result.count > 0 { - flowController.toPreimportSummary(count: result.count, sections: result.sections, services: result.services) + flowController.toPreimportSummary( + count: result.count, + sections: result.sections, + services: result.services, + externalImportService: externalImportService + ) } else { flowController.toFileIsEmpty() } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Flow/ImporterOpenFileFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Flow/ImporterOpenFileFlowController.swift index 44961fd5..07f4e181 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Flow/ImporterOpenFileFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Flow/ImporterOpenFileFlowController.swift @@ -26,10 +26,15 @@ protocol ImporterOpenFileFlowControllerParent: AnyObject { protocol ImporterOpenFileFlowControlling: AnyObject { func toClose() - func toPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) + func toPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) func toFileError(error: ImporterOpenFileError) func toFileIsEmpty() - func toEnterPassword(for data: ExchangeDataFormat) + func toEnterPassword(for data: ExchangeDataFormat, externalImportService: ExternalImportService) } final class ImporterOpenFileFlowController: FlowController { @@ -67,13 +72,19 @@ extension ImporterOpenFileFlowController: ImporterOpenFileFlowControlling { parent?.closeImporter() } - func toPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) { + func toPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) { ImporterPreimportSummaryFlowController.push( in: navigationController, parent: self, count: count, sections: sections, - services: services + services: services, + externalImportService: externalImportService ) } @@ -85,8 +96,13 @@ extension ImporterOpenFileFlowController: ImporterOpenFileFlowControlling { ImporterFileErrorFlowController.push(in: navigationController, parent: self, fileError: .noNewServices) } - func toEnterPassword(for data: ExchangeDataFormat) { - ImporterEnterPasswordFlowController.push(in: navigationController, parent: self, data: data) + func toEnterPassword(for data: ExchangeDataFormat, externalImportService: ExternalImportService) { + ImporterEnterPasswordFlowController.push( + in: navigationController, + parent: self, + data: data, + externalImportService: externalImportService + ) } } @@ -95,8 +111,18 @@ extension ImporterOpenFileFlowController: ImporterEnterPasswordFlowControllerPar parent?.closeImporter() } - func showPreimportSummary(count: Int, sections: [CommonSectionData], services: [ServiceData]) { - toPreimportSummary(count: count, sections: sections, services: services) + func showPreimportSummary( + count: Int, + sections: [CommonSectionData], + services: [ServiceData], + externalImportService: ExternalImportService + ) { + toPreimportSummary( + count: count, + sections: sections, + services: services, + externalImportService: externalImportService + ) } func showFileError(error: ImporterOpenFileError) { diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Presenter/ImporterOpenFilePresenter.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Presenter/ImporterOpenFilePresenter.swift index e0b24a83..216f2fda 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Presenter/ImporterOpenFilePresenter.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterOpenFile/Presenter/ImporterOpenFilePresenter.swift @@ -82,7 +82,8 @@ private extension ImporterOpenFilePresenter { flowController.toPreimportSummary( count: parseResult.count, sections: [], - services: parseResult + services: parseResult, + externalImportService: .lastPass ) } } @@ -94,7 +95,8 @@ private extension ImporterOpenFilePresenter { flowController.toPreimportSummary( count: parseResult.count, sections: [], - services: parseResult + services: parseResult, + externalImportService: .raivo ) } case .aegis(let result): @@ -109,7 +111,8 @@ private extension ImporterOpenFilePresenter { flowController.toPreimportSummary( count: parseResult.count, sections: [], - services: parseResult + services: parseResult, + externalImportService: .aegis ) } } @@ -121,7 +124,7 @@ private extension ImporterOpenFilePresenter { func checkTwoFAS(_ data: ExchangeDataFormat) { switch interactor.checkTwoFAS(data) { case .unencrypted: twoFASSummary(for: data) - case .encrypted: flowController.toEnterPassword(for: data) + case .encrypted: flowController.toEnterPassword(for: data, externalImportService: .twofas) case .newerSchema: flowController.toFileError(error: .newerSchema) } } @@ -131,7 +134,12 @@ private extension ImporterOpenFilePresenter { let services = interactor.parseTwoFASServices(with: data.services, sections: sections) let count = interactor.countNewServices(services) if count > 0 { - flowController.toPreimportSummary(count: count, sections: sections, services: services) + flowController.toPreimportSummary( + count: count, + sections: sections, + services: services, + externalImportService: .twofas + ) } else { flowController.toFileIsEmpty() } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Flow/ImporterPreimportSummaryFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Flow/ImporterPreimportSummaryFlowController.swift index e92b22f8..7de46feb 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Flow/ImporterPreimportSummaryFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Flow/ImporterPreimportSummaryFlowController.swift @@ -40,7 +40,8 @@ final class ImporterPreimportSummaryFlowController: FlowController { parent: ImporterPreimportSummaryFlowControllerParent, count: Int, sections: [CommonSectionData], - services: [ServiceData] + services: [ServiceData], + externalImportService: ExternalImportService ) { let view = ImporterPreimportSummaryViewController() let flowController = ImporterPreimportSummaryFlowController(viewController: view) @@ -52,7 +53,8 @@ final class ImporterPreimportSummaryFlowController: FlowController { ) let presenter = ImporterPreimportSummaryPresenter( flowController: flowController, - interactor: interactor + interactor: interactor, + externalImportService: externalImportService ) view.presenter = presenter diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Presenter/ImporterPreimportSummaryPresenter.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Presenter/ImporterPreimportSummaryPresenter.swift index df3762e5..bde4c23a 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Presenter/ImporterPreimportSummaryPresenter.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/Presenter/ImporterPreimportSummaryPresenter.swift @@ -17,24 +17,36 @@ // along with this program. If not, see // -import Foundation +import UIKit final class ImporterPreimportSummaryPresenter { weak var view: ImporterPreimportSummaryViewControlling? private let flowController: ImporterPreimportSummaryFlowControlling private let interactor: ImporterPreimportSummaryModuleInteracting + private let externalImportService: ExternalImportService var count: Int { interactor.count } + var additionalIcon: UIImage? { + switch externalImportService { + case .aegis: return Asset.externalImportAegis.image + case .raivo: return Asset.externalImportRavio.image + case .lastPass: return Asset.externalImportLastPass.image + case .googleAuth, .twofas: return nil + } + } + init( flowController: ImporterPreimportSummaryFlowControlling, - interactor: ImporterPreimportSummaryModuleInteracting + interactor: ImporterPreimportSummaryModuleInteracting, + externalImportService: ExternalImportService ) { self.flowController = flowController self.interactor = interactor + self.externalImportService = externalImportService } } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/View/ImporterPreimportSummaryViewController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/View/ImporterPreimportSummaryViewController.swift index 0e7f7f54..81c9ed15 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/View/ImporterPreimportSummaryViewController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/Backup/Importer/ImporterPreimportSummary/View/ImporterPreimportSummaryViewController.swift @@ -47,7 +47,12 @@ final class ImporterPreimportSummaryViewController: UIViewController { let count = presenter.count let contentMiddle = MainContainerMiddleContentGenerator(placement: .centerHorizontallyLimitWidth, elements: [ - .image(name: "importBackup", size: CGSize(width: 116, height: 94)), + { () -> MainContainerContentGenerator.Element in + if let icon = presenter.additionalIcon { + return .view(view: createImportImage(with: icon)) + } + return .image(name: "importBackup", size: CGSize(width: 116, height: 94)) + }(), .extraSpacing, .text(text: T.Backup.importBackupFile, style: MainContainerTextStyling.title), .extraSpacing, @@ -77,6 +82,34 @@ final class ImporterPreimportSummaryViewController: UIViewController { return vc } + + private func createImportImage(with icon: UIImage) -> UIView { + let views = [ + UIImageView(image: icon), + UIImageView(image: Asset.gaImport1.image), + UIImageView(image: Asset.gaImport2.image) + ] + views.forEach({ + $0.contentMode = .center + }) + let stackView = UIStackView(arrangedSubviews: views) + + stackView.spacing = Theme.Metrics.doubleSpacing + stackView.distribution = .fill + stackView.alignment = .fill + stackView.axis = .horizontal + + let container = UIView() + container.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + container.widthAnchor.constraint(greaterThanOrEqualToConstant: 200), + container.heightAnchor.constraint(equalToConstant: 80) + ]) + container.addSubview(stackView) + stackView.pinToParentCenter() + + return container + } } extension ImporterPreimportSummaryViewController: ImporterPreimportSummaryViewControlling { diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Flow/ExternalImportInstructionsFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Flow/ExternalImportInstructionsFlowController.swift index 5c214545..cf4df532 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Flow/ExternalImportInstructionsFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Flow/ExternalImportInstructionsFlowController.swift @@ -40,7 +40,7 @@ final class ExternalImportInstructionsFlowController: FlowController { static func push( in navigationController: UINavigationController, parent: ExternalImportInstructionsFlowControllerParent, - service: ExternalImportInstructionsService + service: ExternalImportService ) { let view = ExternalImportInstructionsViewController() diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Presenter/ExternalImportInstructionsPresenter.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Presenter/ExternalImportInstructionsPresenter.swift index 8ee5e952..1c36bb77 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Presenter/ExternalImportInstructionsPresenter.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/Presenter/ExternalImportInstructionsPresenter.swift @@ -22,9 +22,9 @@ import SwiftUI final class ExternalImportInstructionsPresenter { private let flowController: ExternalImportInstructionsFlowControlling - private let service: ExternalImportInstructionsService + private let service: ExternalImportService - init(flowController: ExternalImportInstructionsFlowControlling, service: ExternalImportInstructionsService) { + init(flowController: ExternalImportInstructionsFlowControlling, service: ExternalImportService) { self.flowController = flowController self.service = service } @@ -33,7 +33,7 @@ final class ExternalImportInstructionsPresenter { extension ExternalImportInstructionsPresenter { var hasSecondaryAction: Bool { switch service { - case .aegis, .raivo, .lastPass: return false + case .aegis, .raivo, .lastPass, .twofas: return false case .googleAuth: return true } } @@ -44,6 +44,7 @@ extension ExternalImportInstructionsPresenter { case .raivo: return Asset.externalImportRavio.swiftUIImage case .lastPass: return Asset.externalImportLastPass.swiftUIImage case .googleAuth: return Asset.externalImportGoogleAuth.swiftUIImage + case .twofas: return Asset.externalImportGoogleAuth.swiftUIImage // Not used here } } @@ -53,6 +54,7 @@ extension ExternalImportInstructionsPresenter { case .raivo: return T.externalimportRaivo case .lastPass: return T.externalimportLastpass case .googleAuth: return T.externalimportGoogleAuthenticator + case .twofas: return T.Commons._2fasToolbar // Not used here } } @@ -62,6 +64,7 @@ extension ExternalImportInstructionsPresenter { case .raivo: return T.Externalimport.raivoMsg case .lastPass: return T.Externalimport.lastpassMsg case .googleAuth: return T.Introduction.googleAuthenticatorImportProcess + case .twofas: return "" // Not used here } } @@ -69,12 +72,13 @@ extension ExternalImportInstructionsPresenter { switch service { case .aegis, .raivo, .lastPass: return T.Externalimport.chooseJsonCta case .googleAuth: return T.Commons.scanQrCode + case .twofas: return "" // Not used here } } var secondaryActionName: String? { switch service { - case .aegis, .raivo, .lastPass: return nil + case .aegis, .raivo, .lastPass, .twofas: return nil case .googleAuth: return T.Introduction.chooseQrCode } } @@ -83,7 +87,7 @@ extension ExternalImportInstructionsPresenter { func handleAction() { switch service { - case .aegis, .raivo, .lastPass: flowController.toOpenFile() + case .aegis, .raivo, .lastPass, .twofas: flowController.toOpenFile() case .googleAuth: flowController.toCamera() } } @@ -94,7 +98,7 @@ extension ExternalImportInstructionsPresenter { func handleSecondaryAction() { switch service { - case .aegis, .raivo, .lastPass: break + case .aegis, .raivo, .lastPass, .twofas: break case .googleAuth: flowController.toGallery() } } diff --git a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/View/ExternalImportInstructionsView.swift b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/View/ExternalImportInstructionsView.swift index efa37ef5..44e1cf18 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/View/ExternalImportInstructionsView.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Settings/ExternalImportInstructions/View/ExternalImportInstructionsView.swift @@ -37,12 +37,13 @@ struct ExternalImportInstructionsView: View { var body: some View { VStack(alignment: .center, spacing: Theme.Metrics.standardSpacing) { - HStack(spacing: spacing) { - sourceLogo - } - .frame(minHeight: minIconSpaceHeight, maxHeight: .infinity, alignment: .center) - VStack(spacing: spacing) { + HStack(spacing: spacing) { + sourceLogo + Asset.gaImport1.swiftUIImage + Asset.gaImport2.swiftUIImage + } + .frame(minHeight: minIconSpaceHeight, alignment: .center) Text(sourceName.uppercased()) .font(.title) .multilineTextAlignment(.center) @@ -97,7 +98,7 @@ struct ExternalImportInstructionsView_Previews: PreviewProvider { static var previews: some View { Group { ExternalImportInstructionsView( - sourceLogo: Asset.externalmportIconGoogleAuth.swiftUIImage, + sourceLogo: Asset.externalImportRavio.swiftUIImage, sourceName: T.externalimportGoogleAuthenticator, info: T.Introduction.googleAuthenticatorImportProcess, action: {}, @@ -109,7 +110,7 @@ struct ExternalImportInstructionsView_Previews: PreviewProvider { .previewDevice("iPhone SE (1st generation)") ExternalImportInstructionsView( - sourceLogo: Asset.externalmportIconGoogleAuth.swiftUIImage, + sourceLogo: Asset.externalImportGoogleAuth.swiftUIImage, sourceName: T.externalimportGoogleAuthenticator, info: T.Introduction.googleAuthenticatorImportProcess, action: {},