diff --git a/Package.swift b/Package.swift index e9456bac2932d8b4b9835d47b6a51f007cc9da4e..2162bd759f6d261ecd4b2a85b2329e4add3cbe79 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,6 @@ let package = Package( .library(name: "PushFeature", targets: ["PushFeature"]), .library(name: "CrashService", targets: ["CrashService"]), .library(name: "TermsFeature", targets: ["TermsFeature"]), - .library(name: "XXNavigation", targets: ["XXNavigation"]), .library(name: "Presentation", targets: ["Presentation"]), .library(name: "BackupFeature", targets: ["BackupFeature"]), .library(name: "LaunchFeature", targets: ["LaunchFeature"]), @@ -97,9 +96,6 @@ let package = Package( .package( path: "../xxm-cloud-providers" ), - .package( - path: "../Router-PoC/Navigation" - ), .package( url: "https://git.xx.network/elixxir/client-ios-db.git", .upToNextMajor(from: "1.1.0") @@ -127,6 +123,9 @@ let package = Package( .package( url: "https://git.xx.network/elixxir/xxm-di.git", .upToNextMajor(from: "1.0.0") + ), + .package( + path: "../xxm-navigation" ) ], targets: [ @@ -140,7 +139,6 @@ let package = Package( .target(name: "ChatFeature"), .target(name: "MenuFeature"), .target(name: "PushFeature"), - .target(name: "XXNavigation"), .target(name: "TermsFeature"), .target(name: "CrashService"), .target(name: "BackupFeature"), @@ -156,6 +154,7 @@ let package = Package( .target(name: "ReportingFeature"), .target(name: "OnboardingFeature"), .target(name: "ContactListFeature"), + .product(name: "DependencyInjection", package: "xxm-di"), ] ), .testTarget( @@ -186,19 +185,10 @@ let package = Package( name: "Permissions", dependencies: [ .target(name: "Shared"), - .target(name: "XXNavigation"), + .product(name: "Navigation", package: "xxm-navigation"), .product(name: "DependencyInjection", package: "xxm-di"), ] ), - .target( - name: "XXNavigation", - dependencies: [ - .target(name: "DrawerFeature"), - .product(name: "DependencyInjection", package: "xxm-di"), - .product(name: "Navigation", package: "Navigation"), - .product(name: "XXModels", package: "client-ios-db"), - ] - ), .target( name: "PushFeature", dependencies: [ @@ -239,7 +229,6 @@ let package = Package( name: "Countries", dependencies: [ .target(name: "Shared"), - .target(name: "XXNavigation"), .product(name: "DependencyInjection", package: "xxm-di"), ] ), @@ -299,9 +288,9 @@ let package = Package( dependencies: [ .target(name: "Shared"), .target(name: "Presentation"), - .target(name: "XXNavigation"), - .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "XXDatabase", package: "client-ios-db"), + .product(name: "Navigation", package: "xxm-navigation"), + .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "XXClient", package: "elixxir-dapps-sdk-swift"), .product(name: "CloudFilesDrive", package: "xxm-cloud-providers"), .product(name: "CloudFilesDropbox", package: "xxm-cloud-providers"), @@ -329,7 +318,6 @@ let package = Package( .target(name: "Voxophone"), .target(name: "Permissions"), .target(name: "Presentation"), - .target(name: "XXNavigation"), .target(name: "DrawerFeature"), .target(name: "ChatInputFeature"), .target(name: "ReportingFeature"), @@ -350,9 +338,9 @@ let package = Package( .target(name: "Presentation"), .target(name: "ContactFeature"), .target(name: "NetworkMonitor"), - .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "Retry", package: "Retry"), .product(name: "XXDatabase", package: "client-ios-db"), + .product(name: "DependencyInjection", package: "xxm-di"), ] ), .target( @@ -380,7 +368,7 @@ let package = Package( .target(name: "Shared"), .target(name: "Defaults"), .target(name: "Presentation"), - .target(name: "XXNavigation"), + .product(name: "Navigation", package: "xxm-navigation"), ] ), .target( @@ -405,6 +393,7 @@ let package = Package( .target(name: "Presentation"), .target(name: "DrawerFeature"), .target(name: "BackupFeature"), + .product(name: "Navigation", package: "xxm-navigation"), .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "CombineSchedulers", package: "combine-schedulers"), .product(name: "ScrollViewController", package: "ScrollViewController"), @@ -419,7 +408,6 @@ let package = Package( .target(name: "Defaults"), .target(name: "MenuFeature"), .target(name: "ChatFeature"), - .target(name: "XXNavigation"), .target(name: "ProfileFeature"), .target(name: "SettingsFeature"), .target(name: "ContactListFeature"), @@ -451,9 +439,9 @@ let package = Package( .target(name: "Shared"), .target(name: "Defaults"), .target(name: "Presentation"), - .target(name: "XXNavigation"), .target(name: "DrawerFeature"), .target(name: "ReportingFeature"), + .product(name: "Navigation", package: "xxm-navigation"), .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "XXClient", package: "elixxir-dapps-sdk-swift"), ] @@ -466,6 +454,7 @@ let package = Package( .target(name: "Presentation"), .target(name: "DrawerFeature"), .target(name: "NetworkMonitor"), + .product(name: "Navigation", package: "xxm-navigation"), .product(name: "DependencyInjection", package: "xxm-di"), .product(name: "XXClient", package: "elixxir-dapps-sdk-swift"), .product(name: "CloudFilesSFTP", package: "xxm-cloud-providers"), diff --git a/Sources/App/AppDelegate.swift b/Sources/App/AppDelegate.swift index 2b3b6e9a08abe289d6b089d8c07040f645fee6e6..fd23e19c9ad2a4846e099f0c7023c2c1ab236bbf 100644 --- a/Sources/App/AppDelegate.swift +++ b/Sources/App/AppDelegate.swift @@ -11,7 +11,7 @@ import DI import XXModels import XXLogger import XXClient -import XXNavigation +import Navigation import XXMessengerClient import CloudFiles diff --git a/Sources/App/DependencyRegistrator.swift b/Sources/App/DependencyRegistrator.swift index 787aa3789a4a864e0544f8dfc80ac0ac840d2977..f562bd38e398632c5c5539762316d0ee69dfda58 100644 --- a/Sources/App/DependencyRegistrator.swift +++ b/Sources/App/DependencyRegistrator.swift @@ -43,7 +43,7 @@ import ContactListFeature import Shared import XXClient -import XXNavigation +import Navigation import KeychainAccess import XXMessengerClient diff --git a/Sources/BackupFeature/Controllers/BackupConfigController.swift b/Sources/BackupFeature/Controllers/BackupConfigController.swift index 3a8cdb144ddad6cb568d7204fc028eccb0cf6da7..5c75751ef6bbe2a7c8149d1f36cc65407d83ee57 100644 --- a/Sources/BackupFeature/Controllers/BackupConfigController.swift +++ b/Sources/BackupFeature/Controllers/BackupConfigController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import CloudFiles -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/BackupFeature/ViewModels/BackupConfigViewModel.swift b/Sources/BackupFeature/ViewModels/BackupConfigViewModel.swift index d8e916d46c2cc2d20b664e367d1be0f37e9ebb2f..4ae6414e89a48f752080c7775fb33d4376265519 100644 --- a/Sources/BackupFeature/ViewModels/BackupConfigViewModel.swift +++ b/Sources/BackupFeature/ViewModels/BackupConfigViewModel.swift @@ -8,7 +8,7 @@ import Foundation import DI import CloudFiles -import XXNavigation +import Navigation enum BackupActionState { case backupFinished diff --git a/Sources/ChatFeature/Controllers/GroupChatController.swift b/Sources/ChatFeature/Controllers/GroupChatController.swift index c780effb9726d2bb9b3ce3093da3130f6c698488..97a65ca8cdfb906866a0bd90d8ffff7c3c66bdd4 100644 --- a/Sources/ChatFeature/Controllers/GroupChatController.swift +++ b/Sources/ChatFeature/Controllers/GroupChatController.swift @@ -5,7 +5,7 @@ import Combine import XXModels import Voxophone import ChatLayout -import XXNavigation +import Navigation import DrawerFeature import DifferenceKit import ReportingFeature diff --git a/Sources/ChatFeature/Controllers/SingleChatController.swift b/Sources/ChatFeature/Controllers/SingleChatController.swift index c320ad1d70e95dc0ddeb3af382f9af416ef686c5..c4a890898d8ffe657812c7af427ceaf3708df6a2 100644 --- a/Sources/ChatFeature/Controllers/SingleChatController.swift +++ b/Sources/ChatFeature/Controllers/SingleChatController.swift @@ -1,17 +1,18 @@ +import DI import UIKit import Shared import Combine import XXLogger -import QuickLook import XXModels +import QuickLook import Voxophone +import Navigation import ChatLayout -import XXNavigation +import Navigation import DrawerFeature import DifferenceKit import ChatInputFeature import ReportingFeature -import DI import ScrollViewController extension FlexibleSpace: CollectionCellContent { diff --git a/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift b/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift index 8dde807bab06c3bbd044d1f6d9bde7c0777f6a5e..6f0b3f96767fe92d97cca76bc472ffafb4f665f7 100644 --- a/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift +++ b/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift @@ -1,3 +1,4 @@ +import DI import UIKit import Shared import Combine @@ -5,11 +6,11 @@ import XXLogger import XXModels import XXClient import Defaults +import Navigation import Foundation import Permissions import DifferenceKit import ReportingFeature -import DI import XXMessengerClient import struct XXModels.Message diff --git a/Sources/ChatListFeature/Controller/ChatListController.swift b/Sources/ChatListFeature/Controller/ChatListController.swift index 071e61e21d9909254ac25f219c95bc466ff7e775..dfa484b08116958931d12a93f98a54f53a7db096 100644 --- a/Sources/ChatListFeature/Controller/ChatListController.swift +++ b/Sources/ChatListFeature/Controller/ChatListController.swift @@ -3,7 +3,7 @@ import Shared import Combine import XXModels import MenuFeature -import XXNavigation +import Navigation import DI public final class ChatListController: UIViewController { diff --git a/Sources/ChatListFeature/Controller/ChatListSearchTableController.swift b/Sources/ChatListFeature/Controller/ChatListSearchTableController.swift index 999049ffdc52c0b8121c15dc75d69daed59a7924..d2949c9c73eb457990b5caf69563e809585d8626 100644 --- a/Sources/ChatListFeature/Controller/ChatListSearchTableController.swift +++ b/Sources/ChatListFeature/Controller/ChatListSearchTableController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI class ChatSearchListTableViewDiffableDataSource: UITableViewDiffableDataSource<SearchSection, SearchItem> { diff --git a/Sources/ChatListFeature/Controller/ChatListTableController.swift b/Sources/ChatListFeature/Controller/ChatListTableController.swift index 74e5832406fcb96ab83c2dc09f591f2931386e21..7129b97c4318bfb0f9569e9bc7f0b57f36ac0822 100644 --- a/Sources/ChatListFeature/Controller/ChatListTableController.swift +++ b/Sources/ChatListFeature/Controller/ChatListTableController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import XXModels -import XXNavigation +import Navigation import DifferenceKit import DrawerFeature import DI diff --git a/Sources/ContactFeature/Controllers/ContactController.swift b/Sources/ContactFeature/Controllers/ContactController.swift index 06147dd9840494b59bca963bf93168968169c045..145318147b35a7d79992bfca2e4e93e9c3643eb1 100644 --- a/Sources/ContactFeature/Controllers/ContactController.swift +++ b/Sources/ContactFeature/Controllers/ContactController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import XXModels -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController diff --git a/Sources/ContactListFeature/Controllers/ContactListController.swift b/Sources/ContactListFeature/Controllers/ContactListController.swift index 12fe939a5317fad96951642364f822eb18606db9..2c45e7d914ac37c39257f6cf9c606e92b91f046b 100644 --- a/Sources/ContactListFeature/Controllers/ContactListController.swift +++ b/Sources/ContactListFeature/Controllers/ContactListController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI public final class ContactListController: UIViewController { diff --git a/Sources/ContactListFeature/Controllers/CreateGroupController.swift b/Sources/ContactListFeature/Controllers/CreateGroupController.swift index 2e848091bfe805d4f1de43b5b537efad83687fa7..4397c8cd53a8f58d94df05348ea2149e1be6cd6e 100644 --- a/Sources/ContactListFeature/Controllers/CreateGroupController.swift +++ b/Sources/ContactListFeature/Controllers/CreateGroupController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import XXModels -import XXNavigation +import Navigation import DI public final class CreateGroupController: UIViewController { diff --git a/Sources/Countries/CountryListController.swift b/Sources/Countries/CountryListController.swift index c49f954b65024391d731486d4042dcaceac8583d..5a6181315eb8446afbac9a82beee507244cd9d9a 100644 --- a/Sources/Countries/CountryListController.swift +++ b/Sources/Countries/CountryListController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI public final class CountryListController: UIViewController, UITableViewDelegate { diff --git a/Sources/DrawerFeature/DrawerController.swift b/Sources/DrawerFeature/DrawerController.swift index a51fe87a53aa1f385e85460234dfa7ae92f913c3..c7503f8c68382be1494104ff483abcacb11ca542 100644 --- a/Sources/DrawerFeature/DrawerController.swift +++ b/Sources/DrawerFeature/DrawerController.swift @@ -2,26 +2,26 @@ import UIKit import Combine public final class DrawerController: UIViewController { - private lazy var screenView = DrawerView() - private let content: [DrawerItem] - public var cancellables = Set<AnyCancellable>() + private lazy var screenView = DrawerView() + private let content: [DrawerItem] + public var cancellables = Set<AnyCancellable>() - public init(_ items: [DrawerItem]) { - self.content = items - super.init(nibName: nil, bundle: nil) + public init(_ items: [Any]) { + self.content = items as! [DrawerItem] + super.init(nibName: nil, bundle: nil) - let views = content.map { $0.makeView() } - views.forEach { screenView.stackView.addArrangedSubview($0) } + let views = content.map { $0.makeView() } + views.forEach { screenView.stackView.addArrangedSubview($0) } - content.enumerated().forEach { item in - guard let spacing = item.element.spacingAfter else { return } - screenView.stackView.setCustomSpacing(spacing, after: views[item.offset]) - } + content.enumerated().forEach { item in + guard let spacing = item.element.spacingAfter else { return } + screenView.stackView.setCustomSpacing(spacing, after: views[item.offset]) } + } - required init?(coder: NSCoder) { nil } + required init?(coder: NSCoder) { nil } - public override func loadView() { - view = screenView - } + public override func loadView() { + view = screenView + } } diff --git a/Sources/DrawerFeature/DrawerView.swift b/Sources/DrawerFeature/DrawerView.swift index e03282d5306ef66399d5ee0e96915f38d3e895de..4c157e0df68dd9b5eade8cbb1569d7018499f354 100644 --- a/Sources/DrawerFeature/DrawerView.swift +++ b/Sources/DrawerFeature/DrawerView.swift @@ -2,25 +2,25 @@ import UIKit import Shared final class DrawerView: UIView { - let stackView = UIStackView() + let stackView = UIStackView() - init() { - super.init(frame: .zero) + init() { + super.init(frame: .zero) - layer.cornerRadius = 40 - backgroundColor = Asset.neutralWhite.color - layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] + layer.cornerRadius = 40 + backgroundColor = Asset.neutralWhite.color + layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] - stackView.axis = .vertical - addSubview(stackView) + stackView.axis = .vertical + addSubview(stackView) - stackView.snp.makeConstraints { - $0.top.equalToSuperview().offset(40) - $0.left.equalToSuperview().offset(50) - $0.right.equalToSuperview().offset(-50) - $0.bottom.equalToSuperview().offset(-50) - } + stackView.snp.makeConstraints { + $0.top.equalToSuperview().offset(40) + $0.left.equalToSuperview().offset(50) + $0.right.equalToSuperview().offset(-50) + $0.bottom.equalToSuperview().offset(-50) } + } - required init?(coder: NSCoder) { nil } + required init?(coder: NSCoder) { nil } } diff --git a/Sources/LaunchFeature/LaunchController.swift b/Sources/LaunchFeature/LaunchController.swift index 092facf981fc529bc0fd792081adf2a63b8db6ed..48a8e1fe8b08cb9bad37448dabe77bbe35464e93 100644 --- a/Sources/LaunchFeature/LaunchController.swift +++ b/Sources/LaunchFeature/LaunchController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import PushFeature -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/LaunchFeature/LaunchViewModel+Messenger.swift b/Sources/LaunchFeature/LaunchViewModel+Messenger.swift index cd52d7204156a003bd99b4bca163144ec9058290..9871a24d1b8ffd21b98385b3abc7a896c46b72c3 100644 --- a/Sources/LaunchFeature/LaunchViewModel+Messenger.swift +++ b/Sources/LaunchFeature/LaunchViewModel+Messenger.swift @@ -1,10 +1,10 @@ +import DI import Shared import XXClient import XXModels import XXLogger import Foundation import XXMessengerClient -import DI extension LaunchViewModel { func setupBackupCallback() { @@ -118,7 +118,7 @@ extension LaunchViewModel { // fileTransferId: model.id // )) // - // if let manager: XXClient.FileTransfer = try? DependencyInjection.Container.shared.resolve() { + // if let manager: XXClient.FileTransfer = try? DI.Container.shared.resolve() { // print(">>> registerReceivedProgressCallback") // // try! manager.registerReceivedProgressCallback( @@ -143,7 +143,7 @@ extension LaunchViewModel { // }) // ) // } else { - // //print(DependencyInjection.Container.shared.dependencies) + // //print(DI.Container.shared.dependencies) // } // } } @@ -385,7 +385,7 @@ extension LaunchViewModel { // }) // ) // - // DependencyInjection.Container.shared.register(manager) + // DI.Container.shared.register(manager) } func generateTrafficManager() throws { diff --git a/Sources/MenuFeature/Controllers/MenuController.swift b/Sources/MenuFeature/Controllers/MenuController.swift index 12415b6abae30aeae00521dd11ba66fefdd78a44..6b2cd52cd380421ab923b4fb994fbad1a02c01af 100644 --- a/Sources/MenuFeature/Controllers/MenuController.swift +++ b/Sources/MenuFeature/Controllers/MenuController.swift @@ -1,9 +1,9 @@ +import DI import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature -import DI public final class MenuController: UIViewController { @Dependency var navigator: Navigator @@ -33,7 +33,22 @@ public final class MenuController: UIViewController { username: viewModel.username, image: viewModel.avatar ) - screenView.select(item: currentItem) + + switch currentItem { + case .scan: + screenView.scanButton.set(color: Asset.brandPrimary.color) + case .chats: + screenView.chatsButton.set(color: Asset.brandPrimary.color) + case .contacts: + screenView.contactsButton.set(color: Asset.brandPrimary.color) + case .requests: + screenView.requestsButton.set(color: Asset.brandPrimary.color) + case .settings: + screenView.settingsButton.set(color: Asset.brandPrimary.color) + default: + break + } + screenView.xxdkVersionLabel.text = "XXDK \(viewModel.xxdk)" screenView.buildLabel.text = Localized.Menu.build(viewModel.build) screenView.versionLabel.text = Localized.Menu.version(viewModel.version) diff --git a/Sources/MenuFeature/Views/MenuView.swift b/Sources/MenuFeature/Views/MenuView.swift index e256782eddaa5e686d2bfc7e3ef4af237c3eb51c..8e83eacb17ce598f2a72ad0d97a1db064c6f1904 100644 --- a/Sources/MenuFeature/Views/MenuView.swift +++ b/Sources/MenuFeature/Views/MenuView.swift @@ -2,96 +2,79 @@ import UIKit import Shared final class MenuView: UIView { - let buildLabel = UILabel() - let versionLabel = UILabel() - let stackView = UIStackView() - let xxdkVersionLabel = UILabel() - let infoStackView = UIStackView() - let headerView = MenuHeaderView() - let joinButton = MenuSectionButton() - let scanButton = MenuSectionButton() - let shareButton = MenuSectionButton() - let chatsButton = MenuSectionButton() - let contactsButton = MenuSectionButton() - let requestsButton = MenuSectionButton() - let settingsButton = MenuSectionButton() - let dashboardButton = MenuSectionButton() + let buildLabel = UILabel() + let versionLabel = UILabel() + let stackView = UIStackView() + let xxdkVersionLabel = UILabel() + let infoStackView = UIStackView() + let headerView = MenuHeaderView() + let joinButton = MenuSectionButton() + let scanButton = MenuSectionButton() + let shareButton = MenuSectionButton() + let chatsButton = MenuSectionButton() + let contactsButton = MenuSectionButton() + let requestsButton = MenuSectionButton() + let settingsButton = MenuSectionButton() + let dashboardButton = MenuSectionButton() - init() { - super.init(frame: .zero) - backgroundColor = Asset.neutralDark.color + init() { + super.init(frame: .zero) + backgroundColor = Asset.neutralDark.color - scanButton.set(title: Localized.Menu.scan, image: Asset.menuScan.image) - shareButton.set(title: Localized.Menu.share, image: Asset.menuShare.image) - chatsButton.set(title: Localized.Menu.chats, image: Asset.menuChats.image) - joinButton.set(title: Localized.Menu.join, image: Asset.permissionLogo.image) - requestsButton.set(title: Localized.Menu.requests, image: Asset.menuRequests.image) - contactsButton.set(title: Localized.Menu.contacts, image: Asset.menuContacts.image) - settingsButton.set(title: Localized.Menu.settings, image: Asset.menuSettings.image) - dashboardButton.set(title: Localized.Menu.dashboard, image: Asset.menuDashboard.image) + scanButton.set(title: Localized.Menu.scan, image: Asset.menuScan.image) + shareButton.set(title: Localized.Menu.share, image: Asset.menuShare.image) + chatsButton.set(title: Localized.Menu.chats, image: Asset.menuChats.image) + joinButton.set(title: Localized.Menu.join, image: Asset.permissionLogo.image) + requestsButton.set(title: Localized.Menu.requests, image: Asset.menuRequests.image) + contactsButton.set(title: Localized.Menu.contacts, image: Asset.menuContacts.image) + settingsButton.set(title: Localized.Menu.settings, image: Asset.menuSettings.image) + dashboardButton.set(title: Localized.Menu.dashboard, image: Asset.menuDashboard.image) - stackView.addArrangedSubview(chatsButton) - stackView.addArrangedSubview(contactsButton) - stackView.addArrangedSubview(requestsButton) - stackView.addArrangedSubview(scanButton) - stackView.addArrangedSubview(settingsButton) - stackView.addArrangedSubview(dashboardButton) - stackView.addArrangedSubview(joinButton) - stackView.addArrangedSubview(shareButton) + stackView.addArrangedSubview(chatsButton) + stackView.addArrangedSubview(contactsButton) + stackView.addArrangedSubview(requestsButton) + stackView.addArrangedSubview(scanButton) + stackView.addArrangedSubview(settingsButton) + stackView.addArrangedSubview(dashboardButton) + stackView.addArrangedSubview(joinButton) + stackView.addArrangedSubview(shareButton) - infoStackView.spacing = 10 - infoStackView.axis = .vertical - [buildLabel, versionLabel, xxdkVersionLabel].forEach { - $0.textColor = Asset.neutralWeak.color - $0.font = Fonts.Mulish.regular.font(size: 12.0) - infoStackView.addArrangedSubview($0) - } + infoStackView.spacing = 10 + infoStackView.axis = .vertical + [buildLabel, versionLabel, xxdkVersionLabel].forEach { + $0.textColor = Asset.neutralWeak.color + $0.font = Fonts.Mulish.regular.font(size: 12.0) + infoStackView.addArrangedSubview($0) + } - stackView.spacing = 28 - stackView.axis = .vertical - stackView.distribution = .equalSpacing + stackView.spacing = 28 + stackView.axis = .vertical + stackView.distribution = .equalSpacing - addSubview(headerView) - addSubview(stackView) - addSubview(infoStackView) + addSubview(headerView) + addSubview(stackView) + addSubview(infoStackView) - setupConstraints() - } + setupConstraints() + } - required init?(coder: NSCoder) { nil } + required init?(coder: NSCoder) { nil } - func select(item: MenuItem) { - switch item { - case .scan: - scanButton.set(color: Asset.brandPrimary.color) - case .chats: - chatsButton.set(color: Asset.brandPrimary.color) - case .contacts: - contactsButton.set(color: Asset.brandPrimary.color) - case .requests: - requestsButton.set(color: Asset.brandPrimary.color) - case .settings: - settingsButton.set(color: Asset.brandPrimary.color) - case .share, .join, .profile, .dashboard: - break - } + private func setupConstraints() { + headerView.snp.makeConstraints { + $0.top.equalTo(safeAreaLayoutGuide).offset(20) + $0.left.equalToSuperview().offset(30) + $0.right.equalToSuperview().offset(-24) } - private func setupConstraints() { - headerView.snp.makeConstraints { - $0.top.equalTo(safeAreaLayoutGuide).offset(20) - $0.left.equalToSuperview().offset(30) - $0.right.equalToSuperview().offset(-24) - } - - stackView.snp.makeConstraints { - $0.left.equalToSuperview().offset(26) - $0.top.equalTo(headerView.snp.bottom).offset(75) - } + stackView.snp.makeConstraints { + $0.left.equalToSuperview().offset(26) + $0.top.equalTo(headerView.snp.bottom).offset(75) + } - infoStackView.snp.makeConstraints { - $0.bottom.equalTo(safeAreaLayoutGuide).offset(-20) - $0.left.equalToSuperview().offset(20) - } + infoStackView.snp.makeConstraints { + $0.bottom.equalTo(safeAreaLayoutGuide).offset(-20) + $0.left.equalToSuperview().offset(20) } + } } diff --git a/Sources/OnboardingFeature/Controllers/OnboardingCodeController.swift b/Sources/OnboardingFeature/Controllers/OnboardingCodeController.swift index a2e1e353c8897421b8e34e85b80dfaa120f1a091..c9b91738175c76536e88cf78b2b572ba54bcd837 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingCodeController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingCodeController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController diff --git a/Sources/OnboardingFeature/Controllers/OnboardingEmailController.swift b/Sources/OnboardingFeature/Controllers/OnboardingEmailController.swift index 1804e216906f2022848c82c406bb0a81f3fc3d48..ab9a453eaef6e3e0ce3274fc0108cfdb96b9f5f3 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingEmailController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingEmailController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController diff --git a/Sources/OnboardingFeature/Controllers/OnboardingPhoneController.swift b/Sources/OnboardingFeature/Controllers/OnboardingPhoneController.swift index aa696246287291a17003dbc80559d15ea470a282..c2d4aeba4f30aa7bd74aca903b0093f99790330f 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingPhoneController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingPhoneController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController @@ -95,7 +95,7 @@ public final class OnboardingPhoneController: UIViewController { navigator.perform(PresentCountryList(completion: { [weak self] in guard let self else { return } self.navigator.perform(DismissModal(from: self)) - self.viewModel.didChooseCountry($0) + self.viewModel.didChooseCountry($0 as! Country) })) }.store(in: &cancellables) diff --git a/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift b/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift index f0251cd3a6455476dbaa8e3bf0eb4f181d05fd2c..7cb3faf0f4c1b305f6c203ece1d58cad36be9b0f 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingStartController.swift @@ -1,6 +1,6 @@ import UIKit import Combine -import XXNavigation +import Navigation import DI public final class OnboardingStartController: UIViewController { diff --git a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift index 0959b1d181570748987b93d51be5a1a0e9373693..0f192fbb0228682593621a3935acb3b41abd227b 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController diff --git a/Sources/OnboardingFeature/Controllers/OnboardingWelcomeController.swift b/Sources/OnboardingFeature/Controllers/OnboardingWelcomeController.swift index 72a1347aa2ba98dcb98546ca11fa1fea96e03d12..937524257df145b571957b51972c297b4ab679a1 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingWelcomeController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingWelcomeController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import Defaults -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/Permissions/RequestPermissionController.swift b/Sources/Permissions/RequestPermissionController.swift index 0cdc65b076c1035a4ee38cd5d9c9440e343d0291..24b09405aa22942886d84ffa9b1012fcd2d34a80 100644 --- a/Sources/Permissions/RequestPermissionController.swift +++ b/Sources/Permissions/RequestPermissionController.swift @@ -1,8 +1,8 @@ +import DI import UIKit import Shared import Combine -import XXNavigation -import DI +import Navigation public final class RequestPermissionController: UIViewController { @Dependency var navigator: Navigator diff --git a/Sources/ProfileFeature/Controllers/ProfileCodeController.swift b/Sources/ProfileFeature/Controllers/ProfileCodeController.swift index d55d52f3b275cc4defb7a338753b179af8355832..8f6ff16f9df23b36fee5b4ff316a4044f40abe32 100644 --- a/Sources/ProfileFeature/Controllers/ProfileCodeController.swift +++ b/Sources/ProfileFeature/Controllers/ProfileCodeController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI import ScrollViewController diff --git a/Sources/ProfileFeature/Controllers/ProfileController.swift b/Sources/ProfileFeature/Controllers/ProfileController.swift index ca2abe5a92881271dc5bd0d1335b78eaa650bf3d..d80d7a9c3f48079eaaacc2f7d5a859ff472745f2 100644 --- a/Sources/ProfileFeature/Controllers/ProfileController.swift +++ b/Sources/ProfileFeature/Controllers/ProfileController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/ProfileFeature/Controllers/ProfileEmailController.swift b/Sources/ProfileFeature/Controllers/ProfileEmailController.swift index 0a4599c046d39d09623fc8852afbef89cf9c685f..4fb0b42f4e56f373d28c45dc70fb2315fff4ba51 100644 --- a/Sources/ProfileFeature/Controllers/ProfileEmailController.swift +++ b/Sources/ProfileFeature/Controllers/ProfileEmailController.swift @@ -1,8 +1,8 @@ +import DI import UIKit import Shared import Combine -import XXNavigation -import DI +import Navigation import ScrollViewController public final class ProfileEmailController: UIViewController { diff --git a/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift b/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift index 061521d56d6abeebf0ff30b99e9035069146a7be..a1e4216839cddacd3ce96622c6d8a872462b0cc5 100644 --- a/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift +++ b/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift @@ -1,8 +1,8 @@ +import DI import UIKit import Shared import Combine -import XXNavigation -import DI +import Navigation import ScrollViewController public final class ProfilePhoneController: UIViewController { @@ -62,7 +62,7 @@ public final class ProfilePhoneController: UIViewController { .sink { [unowned self] in navigator.perform(PresentCountryList(completion: { [weak self] in guard let self else { return } - self.viewModel.didChooseCountry($0) + self.viewModel.didChooseCountry($0 as! Country) })) }.store(in: &cancellables) diff --git a/Sources/RequestsFeature/Controllers/RequestsContainerController.swift b/Sources/RequestsFeature/Controllers/RequestsContainerController.swift index 03cf57c1b6224b26c6f50db874c2f7fa0340c54c..3a1c2488cf57eeebbe90eb14706a9069d74aead1 100644 --- a/Sources/RequestsFeature/Controllers/RequestsContainerController.swift +++ b/Sources/RequestsFeature/Controllers/RequestsContainerController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import ContactFeature import DI diff --git a/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift b/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift index 1ab20d49356f5d4d747d60c671cdf82f68e782ed..fe07a5bd8a326a075143154fde4ae58e24d622f2 100644 --- a/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift +++ b/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift @@ -3,7 +3,7 @@ import Shared import Combine import XXModels import Countries -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/RestoreFeature/Controllers/RestoreController.swift b/Sources/RestoreFeature/Controllers/RestoreController.swift index 50d9f0e709d92e099b8ab07eccffac47c832efc4..5e4c555b7cdd389f7d977c02ec64bdcd0c1e4d7f 100644 --- a/Sources/RestoreFeature/Controllers/RestoreController.swift +++ b/Sources/RestoreFeature/Controllers/RestoreController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/RestoreFeature/Controllers/RestoreListController.swift b/Sources/RestoreFeature/Controllers/RestoreListController.swift index 7cf566516e049ed6b141fbfc5be1ec1fa53e140a..4d138ba3944c0c86ac5876cfabff5a65c9ce1a0a 100644 --- a/Sources/RestoreFeature/Controllers/RestoreListController.swift +++ b/Sources/RestoreFeature/Controllers/RestoreListController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/RestoreFeature/Controllers/RestoreSuccessController.swift b/Sources/RestoreFeature/Controllers/RestoreSuccessController.swift index f2c0aa2cc6f7ae1b77d8bb4759bf8d9091673e9d..a1eec1bb1b4974f7a038ea833892304907540e3a 100644 --- a/Sources/RestoreFeature/Controllers/RestoreSuccessController.swift +++ b/Sources/RestoreFeature/Controllers/RestoreSuccessController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI public final class RestoreSuccessController: UIViewController { diff --git a/Sources/ScanFeature/Controllers/ScanContainerController.swift b/Sources/ScanFeature/Controllers/ScanContainerController.swift index b669014ef1e037c5896b2c7c5d3ff3b1beda429d..806d852e4732e95457692d11c7c40f8da9533090 100644 --- a/Sources/ScanFeature/Controllers/ScanContainerController.swift +++ b/Sources/ScanFeature/Controllers/ScanContainerController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/ScanFeature/Controllers/ScanController.swift b/Sources/ScanFeature/Controllers/ScanController.swift index af705b251c940da1d6c7a6da9e4b66704497a458..52369e7514853a6e87348e9afb84ea085225888b 100644 --- a/Sources/ScanFeature/Controllers/ScanController.swift +++ b/Sources/ScanFeature/Controllers/ScanController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import Permissions -import XXNavigation +import Navigation import CombineSchedulers import DI diff --git a/Sources/SearchFeature/Controllers/SearchContainerController.swift b/Sources/SearchFeature/Controllers/SearchContainerController.swift index db43b6201ef174966fe969a13d46562aed8e750b..70f063ba28c834c86f2da92bad93cf978c65fa26 100644 --- a/Sources/SearchFeature/Controllers/SearchContainerController.swift +++ b/Sources/SearchFeature/Controllers/SearchContainerController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import XXModels -import XXNavigation +import Navigation import DrawerFeature import DI diff --git a/Sources/SearchFeature/Controllers/SearchLeftController.swift b/Sources/SearchFeature/Controllers/SearchLeftController.swift index 106c328fd2466b2d4805b39a32c239e77878c857..a1a2b3c8661cff08b69be4c35d45ec5ee6936396 100644 --- a/Sources/SearchFeature/Controllers/SearchLeftController.swift +++ b/Sources/SearchFeature/Controllers/SearchLeftController.swift @@ -4,7 +4,7 @@ import Combine import XXModels import Defaults import Countries -import XXNavigation +import Navigation import DrawerFeature import DI @@ -160,7 +160,7 @@ final class SearchLeftController: UIViewController { .sink { [unowned self] in navigator.perform(PresentCountryList(completion: { [weak self] in guard let self else { return } - self.viewModel.didPick(country: $0) + self.viewModel.didPick(country: $0 as! Country) })) }.store(in: &cancellables) diff --git a/Sources/SearchFeature/Controllers/SearchRightController.swift b/Sources/SearchFeature/Controllers/SearchRightController.swift index fb7283c56bc0b2b670eb6f6e68721d3b841fa7c3..d8cc22ecaceac630d68468329463bd7db94d3995 100644 --- a/Sources/SearchFeature/Controllers/SearchRightController.swift +++ b/Sources/SearchFeature/Controllers/SearchRightController.swift @@ -1,6 +1,6 @@ import UIKit import Combine -import XXNavigation +import Navigation import DI final class SearchRightController: UIViewController { diff --git a/Sources/SettingsFeature/Controllers/AccountDeleteController.swift b/Sources/SettingsFeature/Controllers/AccountDeleteController.swift index b695ec0833bcb149fcaa6d6facc01ff881503529..f3bde0baafec9100e8adbf2a26b1bb208e4639f4 100644 --- a/Sources/SettingsFeature/Controllers/AccountDeleteController.swift +++ b/Sources/SettingsFeature/Controllers/AccountDeleteController.swift @@ -2,7 +2,7 @@ import UIKit import Shared import Combine import Defaults -import XXNavigation +import Navigation import DrawerFeature import ScrollViewController import DI diff --git a/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift b/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift index 5399ca6a94094077d47f96006d96001d72a883f8..0ca63236e03dc3281c4c46297c84c705d0823e3f 100644 --- a/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift +++ b/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DI public final class SettingsAdvancedController: UIViewController { diff --git a/Sources/SettingsFeature/Controllers/SettingsController.swift b/Sources/SettingsFeature/Controllers/SettingsController.swift index 6dd584cf2167cf5b9090b0e9c34400bfaeee381c..c2d74e694d87e82af662ce8c919b204a0a633837 100644 --- a/Sources/SettingsFeature/Controllers/SettingsController.swift +++ b/Sources/SettingsFeature/Controllers/SettingsController.swift @@ -1,7 +1,7 @@ import UIKit import Shared import Combine -import XXNavigation +import Navigation import DrawerFeature import DI import ScrollViewController diff --git a/Sources/Shared/Models/MenuItem.swift b/Sources/Shared/Models/MenuItem.swift deleted file mode 100644 index 072b5033e3332dea3a70fbab4a5275c78c7d1b27..0000000000000000000000000000000000000000 --- a/Sources/Shared/Models/MenuItem.swift +++ /dev/null @@ -1,11 +0,0 @@ -public enum MenuItem { - case join - case scan - case chats - case share - case profile - case contacts - case requests - case settings - case dashboard -} diff --git a/Sources/Shared/Models/PermissionType.swift b/Sources/Shared/Models/PermissionType.swift deleted file mode 100644 index 43d28fbd1c764364136544729d5adab320e5db20..0000000000000000000000000000000000000000 --- a/Sources/Shared/Models/PermissionType.swift +++ /dev/null @@ -1,5 +0,0 @@ -public enum PermissionType { - case camera - case library - case microphone -} diff --git a/Sources/TermsFeature/TermsConditionsController.swift b/Sources/TermsFeature/TermsConditionsController.swift index 95c434329323cf80e2d1f03a4942f4bb45b38ee0..9485704fe85d1fe461dc22ccf6c513049368089d 100644 --- a/Sources/TermsFeature/TermsConditionsController.swift +++ b/Sources/TermsFeature/TermsConditionsController.swift @@ -1,10 +1,10 @@ +import DI import UIKit import WebKit import Shared import Combine import Defaults -import XXNavigation -import DI +import Navigation public final class TermsConditionsController: UIViewController { @Dependency var navigator: Navigator diff --git a/Sources/XXNavigation/Chat/PresentCamera.swift b/Sources/XXNavigation/Chat/PresentCamera.swift deleted file mode 100644 index ad8bd440798aae1044a8a4fc851da5da96b80da4..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentCamera.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Navigation - -public struct PresentCamera: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} diff --git a/Sources/XXNavigation/Chat/PresentChat.swift b/Sources/XXNavigation/Chat/PresentChat.swift deleted file mode 100644 index 06fa031d7f2d2f0d1ff6c96412ea956575e5fdb0..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentChat.swift +++ /dev/null @@ -1,36 +0,0 @@ -import UIKit -import XXModels -import Navigation -import DI - -public struct PresentChat: Navigation.Action { - public var contact: Contact - public var animated: Bool - - public init( - contact: Contact, - animated: Bool = true - ) { - self.contact = contact - self.animated = animated - } -} - -public struct PresentChatNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (Contact) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentChat, completion: @escaping () -> Void) { - let pushAction = Push(screen(action.contact), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping (Contact) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Chat/PresentChatList.swift b/Sources/XXNavigation/Chat/PresentChatList.swift deleted file mode 100644 index 14059d986b5f947099f5404455cd72f6ff2f6f99..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentChatList.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentChatList: Navigation.Action { - public var animated: Bool = true - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentChatListNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentChatList, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Chat/PresentGroupChat.swift b/Sources/XXNavigation/Chat/PresentGroupChat.swift deleted file mode 100644 index a4e74db1edc342a655671662f65a0f111ed9ae9d..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentGroupChat.swift +++ /dev/null @@ -1,36 +0,0 @@ -import UIKit -import XXModels -import Navigation -import DI - -public struct PresentGroupChat: Navigation.Action { - public var model: GroupInfo - public var animated: Bool - - public init( - model: GroupInfo, - animated: Bool = true - ) { - self.model = model - self.animated = animated - } -} - -public struct PresentGroupChatNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (GroupInfo) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentGroupChat, completion: @escaping () -> Void) { - let pushAction = Push(screen(action.model), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping (GroupInfo) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Chat/PresentMemberList.swift b/Sources/XXNavigation/Chat/PresentMemberList.swift deleted file mode 100644 index 628c0613293c385df483a234190fa25814f660c9..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentMemberList.swift +++ /dev/null @@ -1,15 +0,0 @@ -import XXModels -import Navigation - -public struct PresentMemberList: Navigation.Action { - public var members: [Contact] - public var animated: Bool - - public init( - members: [Contact], - animated: Bool = true - ) { - self.members = members - self.animated = animated - } -} diff --git a/Sources/XXNavigation/Chat/PresentNewGroup.swift b/Sources/XXNavigation/Chat/PresentNewGroup.swift deleted file mode 100644 index d827f553fc4513a6e52a8e0f9f241191afd20e1d..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentNewGroup.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentNewGroup: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentNewGroupNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentNewGroup, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Chat/PresentWebsite.swift b/Sources/XXNavigation/Chat/PresentWebsite.swift deleted file mode 100644 index cb46909b6b0181dea8943af3f036c1d0bd6220bb..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Chat/PresentWebsite.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Navigation -import Foundation - -public struct PresentWebsite: Navigation.Action { - public var url: URL - public var animated: Bool - - public init( - url: URL, - animated: Bool = true - ) { - self.url = url - self.animated = animated - } -} diff --git a/Sources/XXNavigation/Contact/PresentContact.swift b/Sources/XXNavigation/Contact/PresentContact.swift deleted file mode 100644 index b662609b8a0a4f7be1863089bc1dc12d9a9a9d13..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Contact/PresentContact.swift +++ /dev/null @@ -1,36 +0,0 @@ -import UIKit -import XXModels -import Navigation -import DI - -public struct PresentContact: Navigation.Action { - public var contact: Contact - public var animated: Bool - - public init( - contact: Contact, - animated: Bool = true - ) { - self.contact = contact - self.animated = animated - } -} - -public struct PresentContactNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (Contact) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentContact, completion: @escaping () -> Void) { - let pushAction = Push(screen(action.contact), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping (Contact) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Contact/PresentContactList.swift b/Sources/XXNavigation/Contact/PresentContactList.swift deleted file mode 100644 index 4758d801dd878be0b8c0e5ebea29adf6fc271983..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Contact/PresentContactList.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentContactList: Navigation.Action { - public var animated: Bool = true - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentContactListNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentContactList, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Contact/PresentNickname.swift b/Sources/XXNavigation/Contact/PresentNickname.swift deleted file mode 100644 index 11d691e28a773d4c46d818440e12e38f1ae6df90..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Contact/PresentNickname.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Navigation - -public struct PresentNickname: Navigation.Action { - public var prefilled: String? - public var completion: (String) -> Void - public var animated: Bool - - public init( - prefilled: String?, - completion: @escaping (String) -> Void, - animated: Bool = true - ) { - self.prefilled = prefilled - self.completion = completion - self.animated = animated - } -} diff --git a/Sources/XXNavigation/CustomActions/OpenLeft.swift b/Sources/XXNavigation/CustomActions/OpenLeft.swift deleted file mode 100644 index 4296f39eba6c5eb0fa04cbc731f689b641d00f3e..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/CustomActions/OpenLeft.swift +++ /dev/null @@ -1,310 +0,0 @@ -import UIKit -import Navigation - -/// Open left view controller on provided parent view controller -public struct OpenLeft: Action { - /// - Parameters: - /// - viewController: View controller to present - /// - parent: Parent view controller from which presentation should happen - /// - animated: Animate the transition - public init( - _ viewController: UIViewController, - from parent: UIViewController, - animated: Bool = true - ) { - self.viewController = viewController - self.parent = parent - self.animated = animated - } - - /// View controller to present - public var viewController: UIViewController - - /// Parent view controller from which presentation should happen - public var parent: UIViewController - - /// Animate the transition - public var animated: Bool -} - -/// Performs `OpenLeft` action -public struct OpenLeftNavigator: TypedNavigator { - let transitioningDelegate = SidePresenter() - - public init() {} - - public func perform(_ action: OpenLeft, completion: @escaping () -> Void) { - action.viewController.transitioningDelegate = transitioningDelegate - action.viewController.modalPresentationStyle = .overFullScreen - - action.parent.present( - action.viewController, - animated: action.animated, - completion: completion - ) - } -} - -final class SidePresenter: NSObject, UIViewControllerTransitioningDelegate { - public init(dismissInteractor: SideMenuDismissInteracting = SideMenuDismissInteractor(), - menuAnimator: SideMenuAnimating = SideMenuAnimator(), - viewAnimator: UIViewAnimating.Type = UIView.self) { - self.dismissInteractor = dismissInteractor - self.menuAnimator = menuAnimator - self.viewAnimator = viewAnimator - super.init() - } - - let dismissInteractor: SideMenuDismissInteracting - let menuAnimator: SideMenuAnimating - let viewAnimator: UIViewAnimating.Type - - // MARK: Presenting - - public func present(_ viewControllers: UIViewController..., from parent: UIViewController) { - guard let screen = viewControllers.first else { - fatalError("Tried to present empty list of view controllers") - } - - screen.modalPresentationStyle = .overFullScreen - screen.transitioningDelegate = self - parent.present(screen, animated: true) - } - - // MARK: UIViewControllerTransitioningDelegate - - public func animationController( - forPresented presented: UIViewController, - presenting: UIViewController, - source: UIViewController - ) -> UIViewControllerAnimatedTransitioning? { - SideMenuPresentTransition(dismissInteractor: dismissInteractor, - menuAnimator: menuAnimator, - viewAnimator: viewAnimator) - } - - public func animationController( - forDismissed dismissed: UIViewController - ) -> UIViewControllerAnimatedTransitioning? { - SideMenuDismissTransition(menuAnimator: menuAnimator, - viewAnimator: viewAnimator) - } - - public func interactionControllerForDismissal( - using animator: UIViewControllerAnimatedTransitioning - ) -> UIViewControllerInteractiveTransitioning? { - dismissInteractor.interactionInProgress ? dismissInteractor : nil - } -} - -public protocol SideMenuAnimating { - func animate(in containerView: UIView, to progress: CGFloat) -} - -public struct SideMenuAnimator: SideMenuAnimating { - public init() {} - - public func animate(in containerView: UIView, to progress: CGFloat) { - guard let fromView = containerView.viewWithTag(SideMenuPresentTransition.fromViewTag) - else { return } - - let cornerRadius = progress * 24 - let shadowOpacity = Float(progress) - let offsetX = containerView.bounds.size.width * 0.5 * progress - let offsetY = containerView.bounds.size.height * 0.08 * progress - let scale = 1 - (0.25 * progress) - - fromView.subviews.first?.layer.cornerRadius = cornerRadius - fromView.layer.shadowOpacity = shadowOpacity - fromView.transform = CGAffineTransform.identity - .translatedBy(x: offsetX, y: offsetY) - .scaledBy(x: scale, y: scale) - } -} - -import UIKit -import Shared - -public protocol SideMenuDismissInteracting: UIViewControllerInteractiveTransitioning { - var interactionInProgress: Bool { get } - - func setup(view: UIView, action: @escaping EmptyClosure) -} - -public final class SideMenuDismissInteractor: UIPercentDrivenInteractiveTransition, SideMenuDismissInteracting { - private var action: EmptyClosure? - private var shouldFinishTransition = false - - // MARK: SideMenuDismissInteracting - - public var interactionInProgress = false - - public func setup(view: UIView, action: @escaping EmptyClosure) { - let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:))) - view.addGestureRecognizer(panRecognizer) - - let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(_:))) - view.addGestureRecognizer(tapRecognizer) - - self.action = action - } - - // MARK: Gesture handling - - @objc - private func handleTapGesture(_ recognizer: UITapGestureRecognizer) { - action?() - } - - @objc - private func handlePanGesture(_ recognizer: UIPanGestureRecognizer) { - guard let view = recognizer.view, - let containerView = view.superview - else { return } - - let viewWidth = containerView.bounds.size.width - guard viewWidth > 0 else { return } - - let translation = recognizer.translation(in: view) - let progress = min(1, max(0, -translation.x / (viewWidth * 0.8))) - - switch recognizer.state { - case .possible, .failed: - interactionInProgress = false - - case .began: - interactionInProgress = true - shouldFinishTransition = false - action?() - - case .changed: - shouldFinishTransition = progress >= 0.5 - update(progress) - - case .cancelled: - interactionInProgress = false - cancel() - - case .ended: - interactionInProgress = false - shouldFinishTransition ? finish() : cancel() - - @unknown default: - interactionInProgress = false - cancel() - } - } -} - -import UIKit - -final class SideMenuDismissTransition: NSObject, UIViewControllerAnimatedTransitioning { - - init(menuAnimator: SideMenuAnimating, - viewAnimator: UIViewAnimating.Type) { - self.menuAnimator = menuAnimator - self.viewAnimator = viewAnimator - super.init() - } - - let menuAnimator: SideMenuAnimating - let viewAnimator: UIViewAnimating.Type - - // MARK: UIViewControllerAnimatedTransitioning - - func transitionDuration(using context: UIViewControllerContextTransitioning?) -> TimeInterval { 0.25 } - - func animateTransition(using context: UIViewControllerContextTransitioning) { - viewAnimator.animate( - withDuration: transitionDuration(using: context), - animations: { - self.menuAnimator.animate(in: context.containerView, to: 0) - }, - completion: { _ in - let isCancelled = context.transitionWasCancelled - context.completeTransition(isCancelled == false) - } - ) - } -} - -import UIKit -import Shared - -final class SideMenuPresentTransition: NSObject, UIViewControllerAnimatedTransitioning { - static let fromViewTag = UUID().hashValue - - init( - dismissInteractor: SideMenuDismissInteracting, - menuAnimator: SideMenuAnimating, - viewAnimator: UIViewAnimating.Type - ) { - self.dismissInteractor = dismissInteractor - self.menuAnimator = menuAnimator - self.viewAnimator = viewAnimator - super.init() - } - - let dismissInteractor: SideMenuDismissInteracting - let menuAnimator: SideMenuAnimating - let viewAnimator: UIViewAnimating.Type - - // MARK: UIViewControllerAnimatedTransitioning - - func transitionDuration(using context: UIViewControllerContextTransitioning?) -> TimeInterval { 0.25 } - - func animateTransition(using context: UIViewControllerContextTransitioning) { - guard let fromVC = context.viewController(forKey: .from), - let fromSnapshot = fromVC.view.snapshotView(afterScreenUpdates: true), - let toVC = context.viewController(forKey: .to) - else { - context.completeTransition(false) - return - } - - context.containerView.addSubview(toVC.view) - toVC.view.frame = context.containerView.bounds - - let fromView = UIView() - fromView.tag = Self.fromViewTag - context.containerView.addSubview(fromView) - fromView.frame = context.containerView.bounds - fromView.layer.shadowColor = UIColor.black.cgColor - fromView.layer.shadowOpacity = 1 - fromView.layer.shadowOffset = .zero - fromView.layer.shadowRadius = 32 - fromView.addSubview(fromSnapshot) - fromSnapshot.frame = fromView.bounds - fromSnapshot.layer.cornerRadius = 0 - fromSnapshot.layer.masksToBounds = true - - dismissInteractor.setup( - view: fromView, - action: { fromVC.dismiss(animated: true) } - ) - - viewAnimator.animate( - withDuration: transitionDuration(using: context), - animations: { - self.menuAnimator.animate(in: context.containerView, to: 1) - }, - completion: { _ in - let isCancelled = context.transitionWasCancelled - context.completeTransition(isCancelled == false) - } - ) - } -} - -import UIKit -import Shared - -public protocol UIViewAnimating { - static func animate( - withDuration duration: TimeInterval, - animations: @escaping EmptyClosure, - completion: ((Bool) -> Void)? - ) -} - -extension UIView: UIViewAnimating {} diff --git a/Sources/XXNavigation/CustomActions/OpenUp.swift b/Sources/XXNavigation/CustomActions/OpenUp.swift deleted file mode 100644 index 6aea3325084a82f7405f6e106087cbb3b8ff7f6c..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/CustomActions/OpenUp.swift +++ /dev/null @@ -1,201 +0,0 @@ -import UIKit -import Navigation - -/// Open up view controller on provided parent view controller -public struct OpenUp: Action { - /// - Parameters: - /// - viewController: View controller to present - /// - parent: Parent view controller from which presentation should happen - /// - animated: Animate the transition - /// - dismissable: Dismissable upon background touch flag - public init( - _ viewController: UIViewController, - from parent: UIViewController, - animated: Bool = true, - dismissable: Bool = true - ) { - self.viewController = viewController - self.parent = parent - self.animated = animated - self.dismissable = dismissable - } - - /// View controller to present - public var viewController: UIViewController - - /// Parent view controller from which presentation should happen - public var parent: UIViewController - - /// Animate the transition - public var animated: Bool - - /// Dismissable upon background touch flag - public var dismissable: Bool -} - -/// Performs `OpenUp` action -public struct OpenUpNavigator: TypedNavigator { - let transitioningDelegate = BottomPresenter() - - public init() {} - - public func perform(_ action: OpenUp, completion: @escaping () -> Void) { - transitioningDelegate.isDismissableOnBackgroundTouch = action.dismissable - action.viewController.transitioningDelegate = transitioningDelegate - action.viewController.modalPresentationStyle = .overFullScreen - - action.parent.present( - action.viewController, - animated: action.animated, - completion: completion - ) - } -} - -final class BottomPresenter: NSObject, UIViewControllerTransitioningDelegate { - var isDismissableOnBackgroundTouch: Bool = true - private var transition: BottomTransition? - - public func animationController( - forPresented presented: UIViewController, - presenting: UIViewController, - source: UIViewController - ) -> UIViewControllerAnimatedTransitioning? { - transition = BottomTransition(isDismissableOnBackgroundTouch) { [weak self] in - self?.transition = nil - } - - return transition - } - - public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { - transition?.direction = .dismiss - return transition - } -} - -import Combine -import SnapKit -final class BottomTransition: NSObject, UIViewControllerAnimatedTransitioning { - enum Direction { - case present - case dismiss - } - - let isDismissableOnBackground: Bool - var direction: Direction = .present - private let onDismissal: (() -> Void)? - private weak var darkOverlayView: UIControl? - private weak var topConstraint: Constraint? - private weak var bottomConstraint: Constraint? - private var cancellables = Set<AnyCancellable>() - - private var presentedConstraints: [NSLayoutConstraint] = [] - private var dismissedConstraints: [NSLayoutConstraint] = [] - - init( - _ isDismissableOnBackground: Bool = true, - onDismissal: (() -> Void)? - ) { - self.onDismissal = onDismissal - self.isDismissableOnBackground = isDismissableOnBackground - super.init() - } - - func transitionDuration(using context: UIViewControllerContextTransitioning?) -> TimeInterval { 0.5 } - - func animateTransition(using context: UIViewControllerContextTransitioning) { - switch direction { - case .present: - present(using: context) - case .dismiss: - dismiss(using: context) - } - } - - private func present(using context: UIViewControllerContextTransitioning) { - guard let presentingController = context.viewController(forKey: .from), - let presentedView = context.view(forKey: .to) else { - context.completeTransition(false) - return - } - - let darkOverlayView = UIControl() - self.darkOverlayView = darkOverlayView - - darkOverlayView.alpha = 0.0 - darkOverlayView.backgroundColor = UIColor.black.withAlphaComponent(0.5) - context.containerView.addSubview(darkOverlayView) - darkOverlayView.frame = context.containerView.bounds - - darkOverlayView - .publisher(for: .touchUpInside) - .sink { [weak presentingController] _ in - guard self.isDismissableOnBackground else { return } - presentingController?.dismiss(animated: true) - }.store(in: &cancellables) - - context.containerView.addSubview(presentedView) - presentedView.translatesAutoresizingMaskIntoConstraints = false - - presentedConstraints = [ - presentedView.leftAnchor.constraint(equalTo: context.containerView.leftAnchor), - presentedView.rightAnchor.constraint(equalTo: context.containerView.rightAnchor), - presentedView.bottomAnchor.constraint(equalTo: context.containerView.bottomAnchor), - presentedView.topAnchor.constraint( - greaterThanOrEqualTo: context.containerView.safeAreaLayoutGuide.topAnchor, - constant: 60 - ) - ] - - dismissedConstraints = [ - presentedView.leftAnchor.constraint(equalTo: context.containerView.leftAnchor), - presentedView.rightAnchor.constraint(equalTo: context.containerView.rightAnchor), - presentedView.topAnchor.constraint(equalTo: context.containerView.bottomAnchor) - ] - - NSLayoutConstraint.activate(dismissedConstraints) - - context.containerView.setNeedsLayout() - context.containerView.layoutIfNeeded() - - NSLayoutConstraint.deactivate(dismissedConstraints) - NSLayoutConstraint.activate(presentedConstraints) - - UIView.animate( - withDuration: transitionDuration(using: context), - delay: 0, - usingSpringWithDamping: 1, - initialSpringVelocity: 0, - options: .curveEaseInOut, - animations: { - darkOverlayView.alpha = 1.0 - context.containerView.setNeedsLayout() - context.containerView.layoutIfNeeded() - }, - completion: { _ in - context.completeTransition(true) - }) - } - - private func dismiss(using context: UIViewControllerContextTransitioning) { - NSLayoutConstraint.deactivate(presentedConstraints) - NSLayoutConstraint.activate(dismissedConstraints) - - UIView.animate( - withDuration: transitionDuration(using: context), - delay: 0, - usingSpringWithDamping: 1, - initialSpringVelocity: 0, - options: .curveEaseInOut, - animations: { [weak darkOverlayView] in - darkOverlayView?.alpha = 0.0 - context.containerView.setNeedsLayout() - context.containerView.layoutIfNeeded() - }, - completion: { [weak self] _ in - context.completeTransition(true) - self?.onDismissal?() - }) - } -} diff --git a/Sources/XXNavigation/Export.swift b/Sources/XXNavigation/Export.swift deleted file mode 100644 index dfaf1c7dee21b7c7c0700eefa1427f605b50b501..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Export.swift +++ /dev/null @@ -1 +0,0 @@ -@_exported import Navigation diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingCode.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingCode.swift deleted file mode 100644 index 1853c774797f55342e59c339e21034f82a45fe56..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingCode.swift +++ /dev/null @@ -1,42 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingCode: Navigation.Action { - public var isEmail: Bool - public var content: String - public var confirmationId: String - public var animated: Bool - - public init( - isEmail: Bool, - content: String, - confirmationId: String, - animated: Bool = true - ) { - self.isEmail = isEmail - self.content = content - self.confirmationId = confirmationId - self.animated = animated - } -} - -public struct PresentOnboardingCodeNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (Bool, String, String) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingCode, completion: @escaping () -> Void) { - let controller = screen(action.isEmail, action.content, action.confirmationId) - let pushAction = Push(controller, on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping (Bool, String, String) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingEmail.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingEmail.swift deleted file mode 100644 index c178659482ce24fd6ae0ab578a9d42383748faf3..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingEmail.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingEmail: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentOnboardingEmailNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingEmail, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingPhone.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingPhone.swift deleted file mode 100644 index 95c6e95819076bc66921f85c304c88aece0d122a..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingPhone.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingPhone: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentOnboardingPhoneNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingPhone, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingStart.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingStart.swift deleted file mode 100644 index 943b31d7974f0a65a2b52b0ccf517fbc9eb48cca..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingStart.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingStart: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentOnboardingStartNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingStart, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingUsername.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingUsername.swift deleted file mode 100644 index 91817a3f04b144a2eed87b0f73d4332d1d0c3f52..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingUsername.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingUsername: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentOnboardingUsernameNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingUsername, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentOnboardingWelcome.swift b/Sources/XXNavigation/Onboarding/PresentOnboardingWelcome.swift deleted file mode 100644 index 64a0fdd7abcc606d2f29bfdbad86bdf2b78fba84..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentOnboardingWelcome.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentOnboardingWelcome: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentOnboardingWelcomeNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentOnboardingWelcome, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Onboarding/PresentTermsAndConditions.swift b/Sources/XXNavigation/Onboarding/PresentTermsAndConditions.swift deleted file mode 100644 index 0ec1ae5c7c18d776df0d1ef7ab3a840c0600e30e..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Onboarding/PresentTermsAndConditions.swift +++ /dev/null @@ -1,40 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentTermsAndConditions: Navigation.Action { - public var popAllowed: Bool - public var animated: Bool - - public init( - popAllowed: Bool = true, - animated: Bool = true - ) { - self.popAllowed = popAllowed - self.animated = animated - } -} - -public struct PresentTermsAndConditionsNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentTermsAndConditions, completion: @escaping () -> Void) { - let navAction: Action - if action.popAllowed { - navAction = Push(screen(), on: navigationController(), animated: action.animated) - } else { - navAction = SetStack([screen()], on: navigationController(), animated: action.animated) - } - navigator.perform(navAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentActivitySheet.swift b/Sources/XXNavigation/PresentActivitySheet.swift deleted file mode 100644 index ae08e5957068177961922fe315826b7575d4848c..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentActivitySheet.swift +++ /dev/null @@ -1,42 +0,0 @@ -import UIKit -import XXModels -import Navigation -import DI - -public struct PresentActivitySheet: Navigation.Action { - public var items: [Any] - public var animated: Bool - - public init( - items: [Any], - animated: Bool = true - ) { - self.items = items - self.animated = animated - } -} - -public struct PresentActivitySheetNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: ([Any]) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentActivitySheet, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let modalAction = PresentModal( - screen(action.items), - from: topViewController, - animated: action.animated - ) - navigator.perform(modalAction, completion: completion) - } - } - - public init( - screen: @escaping ([Any]) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentCountryList.swift b/Sources/XXNavigation/PresentCountryList.swift deleted file mode 100644 index bd16214884660110a001fc40c0b2f2294ef14c81..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentCountryList.swift +++ /dev/null @@ -1,38 +0,0 @@ -import UIKit -import Shared -import Navigation -import DI - -public struct PresentCountryList: Navigation.Action { - public var completion: ((Country) -> Void) - public var animated: Bool - - public init( - completion: @escaping (Country) -> Void, - animated: Bool = true - ) { - self.animated = animated - self.completion = completion - } -} - -public struct PresentCountryListNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (@escaping (Country) -> Void) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentCountryList, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let modalAction = PresentModal(screen(action.completion), from: topViewController) - navigator.perform(modalAction, completion: completion) - } - } - - public init( - screen: @escaping (@escaping (Country) -> Void) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentDrawer.swift b/Sources/XXNavigation/PresentDrawer.swift deleted file mode 100644 index 9d659610108c447da5bb02bd83e486518752c1b7..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentDrawer.swift +++ /dev/null @@ -1,46 +0,0 @@ -import UIKit -import Navigation -import DrawerFeature -import DI - -public struct PresentDrawer: Navigation.Action { - public var items: [DrawerItem] - public var dismissable: Bool - public var animated: Bool - - public init( - items: [DrawerItem], - dismissable: Bool = true, - animated: Bool = true - ) { - self.items = items - self.dismissable = dismissable - self.animated = animated - } -} - -public struct PresentDrawerNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: ([DrawerItem]) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentDrawer, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let openUpAction = OpenUp( - screen(action.items), - from: topViewController, - animated: action.animated, - dismissable: action.dismissable - ) - navigator.perform(openUpAction, completion: completion) - } - } - - public init( - screen: @escaping ([DrawerItem]) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentMenu.swift b/Sources/XXNavigation/PresentMenu.swift deleted file mode 100644 index ab9a82ec503076a9ee82a04378375d23c48800b5..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentMenu.swift +++ /dev/null @@ -1,42 +0,0 @@ -import UIKit -import Shared -import Navigation -import DI - -public struct PresentMenu: Navigation.Action { - public var currentItem: MenuItem - public var animated: Bool - - public init( - currentItem: MenuItem, - animated: Bool = true - ) { - self.currentItem = currentItem - self.animated = animated - } -} - -public struct PresentMenuNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var navigationController: () -> UINavigationController - var screen: (MenuItem) -> UIViewController - - public func perform(_ action: PresentMenu, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let openLeftAction = OpenLeft( - screen(action.currentItem), - from: topViewController, - animated: action.animated - ) - navigator.perform(openLeftAction, completion: completion) - } - } - - public init( - screen: @escaping (MenuItem) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentPermissionRequest.swift b/Sources/XXNavigation/PresentPermissionRequest.swift deleted file mode 100644 index d126d59652850fe455a8841bef574b5941101c7c..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentPermissionRequest.swift +++ /dev/null @@ -1,38 +0,0 @@ -import UIKit -import Shared -import Navigation -import DI - -public struct PresentPermissionRequest: Navigation.Action { - public var type: PermissionType - public var animated: Bool - - public init( - type: PermissionType, - animated: Bool = true - ) { - self.type = type - self.animated = animated - } -} - -public struct PresentPermissionRequestNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (PermissionType) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentPermissionRequest, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let modalAction = PresentModal(screen(action.type), from: topViewController) - navigator.perform(modalAction, completion: completion) - } - } - - public init( - screen: @escaping (PermissionType) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentPhotoLibrary.swift b/Sources/XXNavigation/PresentPhotoLibrary.swift deleted file mode 100644 index 8174fe2128f7d87a3c4ec2dfda49ffbbe4aab411..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentPhotoLibrary.swift +++ /dev/null @@ -1,34 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentPhotoLibrary: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentPhotoLibraryNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIImagePickerController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentPhotoLibrary, completion: @escaping () -> Void) { - if let topViewController = navigationController().topViewController { - let imagePicker = screen() - imagePicker.delegate = topViewController as? UIImagePickerControllerDelegate & UINavigationControllerDelegate - let modalAction = PresentModal(imagePicker, from: topViewController) - navigator.perform(modalAction, completion: completion) - } - } - - public init( - screen: @escaping () -> UIImagePickerController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentScan.swift b/Sources/XXNavigation/PresentScan.swift deleted file mode 100644 index 87cec305f4583f1aa22d572967711a2b77d93099..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentScan.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentScan: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentScanNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentScan, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/PresentSearch.swift b/Sources/XXNavigation/PresentSearch.swift deleted file mode 100644 index 6f5d2aba4de1595c1ceaf7a041788d296f0cd25d..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/PresentSearch.swift +++ /dev/null @@ -1,43 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentSearch: Navigation.Action { - public var searching: String? - public var replacing: Bool - public var animated: Bool - - public init( - searching: String? = nil, - replacing: Bool = true, - animated: Bool = true - ) { - self.searching = searching - self.replacing = replacing - self.animated = animated - } -} - -public struct PresentSearchNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (String?) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentSearch, completion: @escaping () -> Void) { - let navAction: Action - if action.replacing { - navAction = SetStack([screen(action.searching)], on: navigationController(), animated: action.animated) - } else { - navAction = Push(screen(action.searching), on: navigationController(), animated: action.animated) - } - navigator.perform(navAction, completion: completion) - } - - public init( - screen: @escaping (String?) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Profile/PresentProfile.swift b/Sources/XXNavigation/Profile/PresentProfile.swift deleted file mode 100644 index 6dfdd65045fcc00af9b35dfad9517665e322d540..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Profile/PresentProfile.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentProfile: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentProfileNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentProfile, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Profile/PresentProfileCode.swift b/Sources/XXNavigation/Profile/PresentProfileCode.swift deleted file mode 100644 index 3c6a9134ed9afec3f22afeaeedbf719979bd9d82..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Profile/PresentProfileCode.swift +++ /dev/null @@ -1,42 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentProfileCode: Navigation.Action { - public var isEmail: Bool - public var content: String - public var confirmationId: String - public var animated: Bool - - public init( - isEmail: Bool, - content: String, - confirmationId: String, - animated: Bool = true - ) { - self.isEmail = isEmail - self.content = content - self.confirmationId = confirmationId - self.animated = animated - } -} - -public struct PresentProfileCodeNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: (Bool, String, String) -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentProfileCode, completion: @escaping () -> Void) { - let controller = screen(action.isEmail, action.content, action.confirmationId) - let pushAction = Push(controller, on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping (Bool, String, String) -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Profile/PresentProfileEmail.swift b/Sources/XXNavigation/Profile/PresentProfileEmail.swift deleted file mode 100644 index c484403853f79e13e41eae29e9551029ee320fc1..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Profile/PresentProfileEmail.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentProfileEmail: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentProfileEmailNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentProfileEmail, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Profile/PresentProfilePhone.swift b/Sources/XXNavigation/Profile/PresentProfilePhone.swift deleted file mode 100644 index 37235bb9337d15aa2f23ee2d6959f35ad7235e42..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Profile/PresentProfilePhone.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentProfilePhone: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentProfilePhoneNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentProfilePhone, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/RestoreAndBackup/PresentPassphrase.swift b/Sources/XXNavigation/RestoreAndBackup/PresentPassphrase.swift deleted file mode 100644 index b566ea3c0baa6c4d2187fa575b56814aa1ae07b4..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/RestoreAndBackup/PresentPassphrase.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Navigation - -public struct PresentPassphrase: Navigation.Action { - public var onCancel: () -> Void - public var onPasspharse: (String) -> Void - public var animated: Bool - - public init( - onCancel: @escaping () -> Void, - onPassphrase: @escaping (String) -> Void, - animated: Bool = true - ) { - self.onCancel = onCancel - self.onPasspharse = onPassphrase - self.animated = animated - } -} diff --git a/Sources/XXNavigation/RestoreAndBackup/PresentRequests.swift b/Sources/XXNavigation/RestoreAndBackup/PresentRequests.swift deleted file mode 100644 index a72fbe3375531194608083a6347a7b6652dfa871..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/RestoreAndBackup/PresentRequests.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentRequests: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentRequestsNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentRequests, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/RestoreAndBackup/PresentRestoreList.swift b/Sources/XXNavigation/RestoreAndBackup/PresentRestoreList.swift deleted file mode 100644 index e1121be7997e3ebff12affe455340d8b33d5d758..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/RestoreAndBackup/PresentRestoreList.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentRestoreList: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentRestoreListNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentRestoreList, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/RestoreAndBackup/PresentSFTP.swift b/Sources/XXNavigation/RestoreAndBackup/PresentSFTP.swift deleted file mode 100644 index d19e06c5a2ce5213042c426a091b1e1e71aa3c32..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/RestoreAndBackup/PresentSFTP.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Navigation - -public struct PresentSFTP: Navigation.Action { - public var completion: (String, String, String) -> Void - public var animated: Bool - - public init( - completion: @escaping (String, String, String) -> Void, - animated: Bool = true - ) { - self.completion = completion - self.animated = animated - } -} diff --git a/Sources/XXNavigation/Settings/PresentSettings.swift b/Sources/XXNavigation/Settings/PresentSettings.swift deleted file mode 100644 index 387bc7893dd3f88846695fa49a39ac277d2b4f8b..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Settings/PresentSettings.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentSettings: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentSettingsNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentSettings, completion: @escaping () -> Void) { - let setStackAction = SetStack([screen()], on: navigationController(), animated: action.animated) - navigator.perform(setStackAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Settings/PresentSettingsAccountDelete.swift b/Sources/XXNavigation/Settings/PresentSettingsAccountDelete.swift deleted file mode 100644 index 76b73f1e703b7c5e5241fa495e932d2f167e1978..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Settings/PresentSettingsAccountDelete.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentSettingsAccountDelete: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentSettingsAccountDeleteNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentSettingsAccountDelete, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Settings/PresentSettingsAdvanced.swift b/Sources/XXNavigation/Settings/PresentSettingsAdvanced.swift deleted file mode 100644 index 0c0085150832dab151895623adc1bca8ddd00759..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Settings/PresentSettingsAdvanced.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentSettingsAdvanced: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentSettingsAdvancedNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentSettingsAdvanced, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Sources/XXNavigation/Settings/PresentSettingsBackup.swift b/Sources/XXNavigation/Settings/PresentSettingsBackup.swift deleted file mode 100644 index 85856658525b7ebc22c2e7518ce0807fe800f9e5..0000000000000000000000000000000000000000 --- a/Sources/XXNavigation/Settings/PresentSettingsBackup.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Navigation -import DI - -public struct PresentSettingsBackup: Navigation.Action { - public var animated: Bool - - public init(animated: Bool = true) { - self.animated = animated - } -} - -public struct PresentSettingsBackupNavigator: TypedNavigator { - @Dependency var navigator: Navigator - var screen: () -> UIViewController - var navigationController: () -> UINavigationController - - public func perform(_ action: PresentSettingsBackup, completion: @escaping () -> Void) { - let pushAction = Push(screen(), on: navigationController(), animated: action.animated) - navigator.perform(pushAction, completion: completion) - } - - public init( - screen: @escaping () -> UIViewController, - navigationController: @escaping () -> UINavigationController - ) { - self.screen = screen - self.navigationController = navigationController - } -} diff --git a/Tests/DefaultsTests/KeyObjectTests.swift b/Tests/DefaultsTests/KeyObjectTests.swift index 1b3bf38068dff01cf9ed1468d9fca159bd5b1d50..0cbf3b4fae776c082350548bd4fbf3b34232cdf4 100644 --- a/Tests/DefaultsTests/KeyObjectTests.swift +++ b/Tests/DefaultsTests/KeyObjectTests.swift @@ -1,84 +1,84 @@ -import XCTest import DI +import XCTest @testable import Defaults final class KeyObjectSpec: XCTestCase { - func testGetCachedValue() { - var didSetObject: Any? - var didSetObjectForKey: String? + func testGetCachedValue() { + var didSetObject: Any? + var didSetObjectForKey: String? - let sut = KeyObjectStore( - objectForKey: { _ in fatalError() }, - setObjectForKey: { object, key in - didSetObject = object - didSetObjectForKey = key - }, removeObjectForKey: { _ in fatalError() } - ) + let sut = KeyObjectStore( + objectForKey: { _ in fatalError() }, + setObjectForKey: { object, key in + didSetObject = object + didSetObjectForKey = key + }, removeObjectForKey: { _ in fatalError() } + ) - DependencyInjection.Container.shared.register(sut) + DI.Container.shared.register(sut) - @KeyObject(.email, defaultValue: "1234") var email: String + @KeyObject(.email, defaultValue: "1234") var email: String - email = "5678" - assert(didSetObject as! String == "5678") - assert(didSetObjectForKey == Key.email.rawValue) - } + email = "5678" + assert(didSetObject as! String == "5678") + assert(didSetObjectForKey == Key.email.rawValue) + } - func testGetDefaultValue() { - var didGetObjectForKey: String? + func testGetDefaultValue() { + var didGetObjectForKey: String? - let sut = KeyObjectStore( - objectForKey: { didGetObjectForKey = $0 }, - setObjectForKey: { _,_ in fatalError() }, - removeObjectForKey: { _ in fatalError() } - ) + let sut = KeyObjectStore( + objectForKey: { didGetObjectForKey = $0 }, + setObjectForKey: { _,_ in fatalError() }, + removeObjectForKey: { _ in fatalError() } + ) - DependencyInjection.Container.shared.register(sut) + DI.Container.shared.register(sut) - let defaultValue = "1234" - @KeyObject(.email, defaultValue: defaultValue) var email: String + let defaultValue = "1234" + @KeyObject(.email, defaultValue: defaultValue) var email: String - assert(email == defaultValue) - assert(didGetObjectForKey == Key.email.rawValue) - } + assert(email == defaultValue) + assert(didGetObjectForKey == Key.email.rawValue) + } - func testSetValue() { - var didSetObject: Any? - var didSetObjectForKey: String? + func testSetValue() { + var didSetObject: Any? + var didSetObjectForKey: String? - let sut = KeyObjectStore( - objectForKey: { _ in fatalError() }, - setObjectForKey: { object, key in - didSetObject = object - didSetObjectForKey = key - }, removeObjectForKey: { _ in fatalError() } - ) + let sut = KeyObjectStore( + objectForKey: { _ in fatalError() }, + setObjectForKey: { object, key in + didSetObject = object + didSetObjectForKey = key + }, removeObjectForKey: { _ in fatalError() } + ) - DependencyInjection.Container.shared.register(sut) + DI.Container.shared.register(sut) - @KeyObject(.phone, defaultValue: "1234") var phone: String - phone = "5678" + @KeyObject(.phone, defaultValue: "1234") var phone: String + phone = "5678" - assert(didSetObject as! String == "5678") - assert(didSetObjectForKey == Key.phone.rawValue) - } + assert(didSetObject as! String == "5678") + assert(didSetObjectForKey == Key.phone.rawValue) + } - func testRemovingValue() { - var didRemoveObjectForKey: String? + func testRemovingValue() { + var didRemoveObjectForKey: String? - let sut = KeyObjectStore( - objectForKey: { _ in fatalError() }, - setObjectForKey: { _,_ in fatalError() }, - removeObjectForKey: { didRemoveObjectForKey = $0 } - ) + let sut = KeyObjectStore( + objectForKey: { _ in fatalError() }, + setObjectForKey: { _,_ in fatalError() }, + removeObjectForKey: { didRemoveObjectForKey = $0 } + ) - DependencyInjection.Container.shared.register(sut) + DI.Container.shared.register(sut) - @KeyObject(.phone, defaultValue: "1234") var phone: String? - phone = nil + @KeyObject(.phone, defaultValue: "1234") var phone: String? + phone = nil - assert(didRemoveObjectForKey == Key.phone.rawValue) - } + assert(didRemoveObjectForKey == Key.phone.rawValue) + } } diff --git a/Tests/ThemeTests/ThemeTests.swift b/Tests/ThemeTests/ThemeTests.swift index 3cdf37a0702a379dd33f9797d189423b0252df14..1cc6794c92935ea93bf54b5a155075a88f58d0be 100644 --- a/Tests/ThemeTests/ThemeTests.swift +++ b/Tests/ThemeTests/ThemeTests.swift @@ -1,45 +1,45 @@ +import DI import Quick import Nimble import Defaults import Foundation -import DI @testable import Theme final class ThemeTests: QuickSpec { - override func spec() { - context("init") { - var sut: ThemeController! - var dictionary: NSMutableDictionary! - - beforeEach { - dictionary = .init() - - DependencyInjection.Container.shared - .register(KeyObjectStore.mock(dictionary: dictionary)) - - sut = ThemeController() - } - - afterEach { - dictionary = nil - } - - it("should load .system a.k.a 0 from defaults") { - let theme = dictionary.value(forKey: Key.theme.rawValue) as? Int - expect(theme).to(equal(0)) - } - - context("when changing theme") { - beforeEach { - sut.theme.send(.dark) - } - - it("should save .dark") { - let theme = dictionary.value(forKey: Key.theme.rawValue) as? Int - expect(theme).to(equal(1)) - } - } + override func spec() { + context("init") { + var sut: ThemeController! + var dictionary: NSMutableDictionary! + + beforeEach { + dictionary = .init() + + DI.Container.shared + .register(KeyObjectStore.mock(dictionary: dictionary)) + + sut = ThemeController() + } + + afterEach { + dictionary = nil + } + + it("should load .system a.k.a 0 from defaults") { + let theme = dictionary.value(forKey: Key.theme.rawValue) as? Int + expect(theme).to(equal(0)) + } + + context("when changing theme") { + beforeEach { + sut.theme.send(.dark) + } + + it("should save .dark") { + let theme = dictionary.value(forKey: Key.theme.rawValue) as? Int + expect(theme).to(equal(1)) } + } } + } } diff --git a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved index b17678ed3a53e91d5b80e50213076ca1d9c97623..6006a39d34ebab1c7bbe76132c3f428df725ee71 100644 --- a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -386,15 +386,6 @@ "revision" : "16e6409ee82e1b81390bdffbf217b9c08ab32784", "version" : "0.5.0" } - }, - { - "identity" : "xxm-di", - "kind" : "remoteSourceControl", - "location" : "https://git.xx.network/elixxir/xxm-di.git", - "state" : { - "revision" : "43b1e12c32109f1753fcc62e5b0b21e479ee27e3", - "version" : "1.0.0" - } } ], "version" : 2