Skip to content

Commit

Permalink
Merge branch 'feature/TF-1164_EmptyTokensScreenChanges' into release/…
Browse files Browse the repository at this point in the history
…v4.2.0
  • Loading branch information
adocyn committed Apr 12, 2023
2 parents 237dda3 + a2ec244 commit af3649f
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum AppEvent {
case widgetEnabled
case widgetDisabled
case onboardingStart
case onboardingGA
case onboardingBackupFile
case missingIcon(String)
case missingIssuer(String)
Expand Down Expand Up @@ -87,7 +86,6 @@ private extension AppEvent {
case .widgetEnabled: return "widget_add_service"
case .widgetDisabled: return "widget_remove_service"
case .onboardingStart: return "onboarding_start"
case .onboardingGA: return "onboarding_GA"
case .onboardingBackupFile: return "onboarding_backup_file"
case .missingIcon: return "missing_icon"
case .missingIssuer: return "no_image_for_issuer_on_ios"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"images" : [
{
"filename" : "gaImport1.pdf",
"filename" : "ImportArrowLigth.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "ImportArrowDark.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Frame.pdf",
"filename" : "IntroductionEmptyHeaderLight.pdf",
"idiom" : "universal"
},
{
Expand All @@ -11,7 +11,7 @@
"value" : "dark"
}
],
"filename" : "Frame-1.pdf",
"filename" : "IntroductionEmptyHeaderDark.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions TwoFAS/TwoFAS/Root/Modules/Main/Flow/MainFlowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,8 @@ extension MainFlowController: MainSplitFlowControllerParent {
func navigationSwitchedToSettings() {
viewController.presenter.handleSwitchedToSettings()
}

func navigationSwitchedToSettingsExternalImport() {
viewController.presenter.handleSwitchToExternalImport()
}
}
4 changes: 4 additions & 0 deletions TwoFAS/TwoFAS/Root/Modules/Main/Presenter/MainPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ final class MainPresenter {
view?.navigateToViewPath(.settings(option: .browserExtension))
}

func handleSwitchToExternalImport() {
view?.navigateToViewPath(.settings(option: .externalImport))
}

func handleSwitchedToSettings() {
view?.settingsTabActive()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import UIKit
protocol MainSplitFlowControllerParent: AnyObject {
func navigationSwitchedToTokens()
func navigationSwitchedToSettings()
func navigationSwitchedToSettingsExternalImport()
}

protocol MainSplitFlowControlling: AnyObject {
Expand Down Expand Up @@ -162,6 +163,10 @@ extension MainSplitFlowController: TokensPlainFlowControllerParent {
func tokensSwitchToTokensTab() {
parent?.navigationSwitchedToTokens()
}

func tokensSwitchToSettingsExternalImport() {
parent?.navigationSwitchedToSettingsExternalImport()
}
}

extension MainSplitFlowController: SettingsFlowControllerParent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Common

protocol TokensPlainFlowControllerParent: AnyObject {
func tokensSwitchToTokensTab()
func tokensSwitchToSettingsExternalImport()
}

protocol TokensPlainFlowControlling: AnyObject {
Expand All @@ -38,7 +39,6 @@ protocol TokensPlainFlowControlling: AnyObject {
func toCameraNotAvailable()
// MARK: Initial screen
func toFileImport()
func toImportGA()
func toShowGallery()
func toHelp()
// MARK: Link actions
Expand Down Expand Up @@ -209,13 +209,7 @@ extension TokensPlainFlowController: TokensPlainFlowControlling {
// MARK: - Initial screen

func toFileImport() {
guard let mainSplitViewController, mainSplitViewController.presentedViewController == nil else { return }
ImporterOpenFileFlowController.present(on: mainSplitViewController, parent: self, url: nil)
}

func toImportGA() {
guard let mainSplitViewController, mainSplitViewController.presentedViewController == nil else { return }
GridViewGAImportNavigationFlowController.present(on: mainSplitViewController, parent: self)
parent?.tokensSwitchToSettingsExternalImport()
}

func toShowGallery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,11 @@ extension TokensPresenter {
}
}

func handleImport2FAS() {
Log("TokensPresenter - handleImport2FAS")
func handleImportExternalFile() {
Log("TokensPresenter - handleImportExternalFile")
flowController.toFileImport()
}

func handleImportGA() {
Log("TokensPresenter - handleImportGA")
flowController.toImportGA()
}

func handleShowHelp() {
Log("TokensPresenter - handleShowHelp")
flowController.toHelp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import UIKit

final class GridViewEmptyListScreen: UIView {
var pairNewService: Callback?
var import2FAS: Callback?
var importGA: Callback?
var importFromExternalService: Callback?
var help: Callback?

private let iconImage: UIImageView = {
Expand Down Expand Up @@ -50,17 +49,10 @@ final class GridViewEmptyListScreen: UIView {
return button
}()

private let import2FASButton: LoadingContentButton = {
private let importButton: LoadingContentButton = {
let button = LoadingContentButton()
button.apply(MainContainerButtonStyling.borderOnly.value)
button.update(title: T.Introduction.import2fasTitle)
return button
}()

private let importGAButton: LoadingContentButton = {
let button = LoadingContentButton()
button.apply(MainContainerButtonStyling.borderOnly.value)
button.update(title: T.Introduction.importGoogleAuthenticator)
button.apply(MainContainerButtonStyling.textOnly.value)
button.update(title: T.Introduction.importExternalApp)
return button
}()

Expand Down Expand Up @@ -124,7 +116,7 @@ final class GridViewEmptyListScreen: UIView {

mainStackView.addArrangedSubviews([headerStackView, buttonsStackView])
headerStackView.addArrangedSubviews([iconImage, headerLabel])
buttonsStackView.addArrangedSubviews([pairNewServiceButton, import2FASButton, importGAButton])
buttonsStackView.addArrangedSubviews([pairNewServiceButton, importButton])

addSubview(helpButton, with: [
helpButton.topAnchor.constraint(
Expand All @@ -140,8 +132,7 @@ final class GridViewEmptyListScreen: UIView {
])

pairNewServiceButton.action = { [weak self] in self?.pairNewService?() }
import2FASButton.action = { [weak self] in self?.import2FAS?() }
importGAButton.action = { [weak self] in self?.importGA?() }
importButton.action = { [weak self] in self?.importFromExternalService?() }
helpButton.action = { [weak self] in self?.help?() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,10 @@ private extension TokensViewController {
}

func setupEmptyScreensEvents() {
emptyListScreenView.pairNewService = { [weak self] in self?.presenter.handleShowCamera() }
emptyListScreenView.import2FAS = { [weak self] in
emptyListScreenView.pairNewService = { [weak self] in self?.presenter.handleAddService() }
emptyListScreenView.importFromExternalService = { [weak self] in
AppEventLog(.onboardingBackupFile)
self?.presenter.handleImport2FAS()
}
emptyListScreenView.importGA = { [weak self] in
AppEventLog(.onboardingGA)
self?.presenter.handleImportGA()
self?.presenter.handleImportExternalFile()
}
emptyListScreenView.help = { [weak self] in self?.presenter.handleShowHelp() }
}
Expand Down

0 comments on commit af3649f

Please sign in to comment.