diff --git a/TwoFAS/TwoFAS.xcodeproj/project.pbxproj b/TwoFAS/TwoFAS.xcodeproj/project.pbxproj index 2c8903da..fc8bbeb6 100644 --- a/TwoFAS/TwoFAS.xcodeproj/project.pbxproj +++ b/TwoFAS/TwoFAS.xcodeproj/project.pbxproj @@ -173,6 +173,7 @@ C233870627810C2E00F8DBC3 /* TrashViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C233870527810C2E00F8DBC3 /* TrashViewController.swift */; }; C233870827810D1A00F8DBC3 /* TrashModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = C233870727810D1A00F8DBC3 /* TrashModels.swift */; }; C233870A2781113800F8DBC3 /* TrashViewController+TableCellHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C23387092781113800F8DBC3 /* TrashViewController+TableCellHandling.swift */; }; + C233DCAD2B04285E008E41D8 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C233DCAC2B04285E008E41D8 /* LoginViewController.swift */; }; C2340CB227BC4C6500746676 /* ComposeServiceViewController+TableCellHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2340CB127BC4C6500746676 /* ComposeServiceViewController+TableCellHandling.swift */; }; C234433A2A8C021100005F33 /* AddingServiceErrorTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C23443392A8C021100005F33 /* AddingServiceErrorTextView.swift */; }; C234433C2A8C087600005F33 /* AddingServiceRequriedTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C234433B2A8C087600005F33 /* AddingServiceRequriedTitleView.swift */; }; @@ -1512,6 +1513,7 @@ C233BD242801D6F900A9CFF2 /* WebExtensionDeviceNameInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebExtensionDeviceNameInteractor.swift; sourceTree = ""; }; C233BD262801D97F00A9CFF2 /* RegisterDeviceInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterDeviceInteractor.swift; sourceTree = ""; }; C233BD282801E5A200A9CFF2 /* PushNotificationRegistrationInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotificationRegistrationInteractor.swift; sourceTree = ""; }; + C233DCAC2B04285E008E41D8 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; C2340CB127BC4C6500746676 /* ComposeServiceViewController+TableCellHandling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ComposeServiceViewController+TableCellHandling.swift"; sourceTree = ""; }; C23443392A8C021100005F33 /* AddingServiceErrorTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddingServiceErrorTextView.swift; sourceTree = ""; }; C234433B2A8C087600005F33 /* AddingServiceRequriedTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddingServiceRequriedTitleView.swift; sourceTree = ""; }; @@ -2553,6 +2555,7 @@ isa = PBXGroup; children = ( C2147CCE205D7B510001D011 /* LoginView.swift */, + C233DCAC2B04285E008E41D8 /* LoginViewController.swift */, ); path = View; sourceTree = ""; @@ -7870,6 +7873,7 @@ C2B1209129D76FA60020281E /* AppearanceModuleInteractor.swift in Sources */, C2E7C3482ADB021500478D89 /* CameraPreview.swift in Sources */, C2D44E68275C10850043F5D6 /* SettingsMenuTableView.swift in Sources */, + C233DCAD2B04285E008E41D8 /* LoginViewController.swift in Sources */, C2A74FE62610D510007E5AB3 /* ColorGridSelector.swift in Sources */, C25C661428BADAB0008EC66A /* AboutFlowController.swift in Sources */, C20E60FB2818971300AB002E /* PushNotificationPermissionPresenter.swift in Sources */, diff --git a/TwoFAS/TwoFAS/Root/Modules/Login/Flow/LoginFlowController.swift b/TwoFAS/TwoFAS/Root/Modules/Login/Flow/LoginFlowController.swift index 936253b2..392446aa 100644 --- a/TwoFAS/TwoFAS/Root/Modules/Login/Flow/LoginFlowController.swift +++ b/TwoFAS/TwoFAS/Root/Modules/Login/Flow/LoginFlowController.swift @@ -68,20 +68,19 @@ final class LoginFlowController: FlowController { on viewController: UIViewController, parent: LoginFlowControllerParent ) { -// let view = LoginViewController() -// let flowController = LoginFlowController(viewController: view) -// flowController.parent = parent -// let interactor = ModuleInteractorFactory.shared.loginModuleInteractor() -// let presenter = LoginPresenter( -// loginType: .verify, -// flowController: flowController, -// interactor: interactor -// ) -// presenter.view = view -// view.presenter = presenter -// view.configureAsModal() -// -// viewController.present(view, animated: true, completion: nil) + let view = LoginViewController() + let flowController = LoginFlowController(viewController: view) + flowController.parent = parent + let interactor = ModuleInteractorFactory.shared.loginModuleInteractor() + let presenter = LoginPresenter( + loginType: .verify, + flowController: flowController, + interactor: interactor + ) + view.presenter = presenter + view.configureAsModal() + + viewController.present(view, animated: true, completion: nil) } } diff --git a/TwoFAS/TwoFAS/Root/Modules/Login/View/LoginViewController.swift b/TwoFAS/TwoFAS/Root/Modules/Login/View/LoginViewController.swift new file mode 100644 index 00000000..50984c58 --- /dev/null +++ b/TwoFAS/TwoFAS/Root/Modules/Login/View/LoginViewController.swift @@ -0,0 +1,46 @@ +// +// This file is part of the 2FAS iOS app (https://github.com/twofas/2fas-ios) +// Copyright © 2023 Two Factor Authentication Service, Inc. +// Contributed by Zbigniew Cisiński. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see +// + +import UIKit + +final class LoginViewController: UIViewController { + var presenter: LoginPresenter! { + didSet { + presenter.view = loginView + loginView?.presenter = presenter + } + } + private var loginView: LoginView? { + view as? LoginView + } + + override func loadView() { + view = LoginView() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + presenter.viewWillAppear() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + presenter.viewDidAppear() + } +}