From 906afbf0f8c8e79ec276f148562b81be137d7a4b Mon Sep 17 00:00:00 2001 From: Artur Guseinov Date: Tue, 14 Nov 2023 01:42:48 +0800 Subject: [PATCH] Tabbar redesign --- .../Modules/Main/MainViewController.swift | 2 -- .../Configurator/AppearanceConfigurator.swift | 2 +- .../AccentColor.colorset/Contents.json | 27 +++++++++++++++++++ .../connections_tab.imageset/Contents.json | 12 +++++++++ .../connections_tab.svg | 14 ++++++++++ .../inbox_tab.imageset/Contents.json | 12 +++++++++ .../inbox_tab.imageset/inbox_tab.svg | 4 +++ .../settings_tab.imageset/Contents.json | 12 +++++++++ .../settings_tab.imageset/settings_tab.svg | 4 +++ .../Wallet/Main/MainPresenter.swift | 1 - .../Wallet/Main/MainRouter.swift | 5 ---- .../Wallet/Main/Model/TabPage.swift | 17 +++++------- .../Notifications/NotificationsRouter.swift | 5 ++-- .../Wallet/Settings/SettingsPresenter.swift | 4 +++ .../Wallet/Settings/SettingsRouter.swift | 5 ++++ .../Wallet/Settings/SettingsView.swift | 9 +++++++ 16 files changed, 113 insertions(+), 22 deletions(-) create mode 100644 Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/Contents.json create mode 100644 Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/connections_tab.svg create mode 100644 Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/Contents.json create mode 100644 Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/inbox_tab.svg create mode 100644 Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/Contents.json create mode 100644 Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/settings_tab.svg diff --git a/Example/DApp/Modules/Main/MainViewController.swift b/Example/DApp/Modules/Main/MainViewController.swift index 63a10ccb4..539b2a789 100644 --- a/Example/DApp/Modules/Main/MainViewController.swift +++ b/Example/DApp/Modules/Main/MainViewController.swift @@ -21,8 +21,6 @@ final class MainViewController: UITabBarController { } private func setupTabs() { - tabBar.unselectedItemTintColor = .white - let viewControllers = presenter.viewControllers for (index, viewController) in viewControllers.enumerated() { diff --git a/Example/WalletApp/ApplicationLayer/Configurator/AppearanceConfigurator.swift b/Example/WalletApp/ApplicationLayer/Configurator/AppearanceConfigurator.swift index ca41f7f63..15fe7fecb 100644 --- a/Example/WalletApp/ApplicationLayer/Configurator/AppearanceConfigurator.swift +++ b/Example/WalletApp/ApplicationLayer/Configurator/AppearanceConfigurator.swift @@ -3,6 +3,6 @@ import UIKit struct AppearanceConfigurator: Configurator { func configure() { - + } } diff --git a/Example/WalletApp/Other/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/WalletApp/Other/Assets.xcassets/AccentColor.colorset/Contents.json index eb8789700..7e65d72f8 100644 --- a/Example/WalletApp/Other/Assets.xcassets/AccentColor.colorset/Contents.json +++ b/Example/WalletApp/Other/Assets.xcassets/AccentColor.colorset/Contents.json @@ -1,6 +1,33 @@ { "colors" : [ { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.078", + "green" : "0.078", + "red" : "0.078" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, "idiom" : "universal" } ], diff --git a/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/Contents.json b/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/Contents.json new file mode 100644 index 000000000..9f8a19fe6 --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "connections_tab.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/connections_tab.svg b/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/connections_tab.svg new file mode 100644 index 000000000..5e2cc7dd8 --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/connections_tab.imageset/connections_tab.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/Contents.json b/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/Contents.json new file mode 100644 index 000000000..7f65e61dc --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "inbox_tab.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/inbox_tab.svg b/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/inbox_tab.svg new file mode 100644 index 000000000..e944a8f5e --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/inbox_tab.imageset/inbox_tab.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/Contents.json b/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/Contents.json new file mode 100644 index 000000000..2d928d41c --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "settings_tab.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/settings_tab.svg b/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/settings_tab.svg new file mode 100644 index 000000000..b55eba524 --- /dev/null +++ b/Example/WalletApp/Other/Assets.xcassets/settings_tab.imageset/settings_tab.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Example/WalletApp/PresentationLayer/Wallet/Main/MainPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/Main/MainPresenter.swift index 451cce287..762bdf97c 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Main/MainPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Main/MainPresenter.swift @@ -17,7 +17,6 @@ final class MainPresenter { return [ router.walletViewController(importAccount: importAccount), router.notificationsViewController(importAccount: importAccount), - router.browserViewController(), router.settingsViewController() ] } diff --git a/Example/WalletApp/PresentationLayer/Wallet/Main/MainRouter.swift b/Example/WalletApp/PresentationLayer/Wallet/Main/MainRouter.swift index 6e67c078c..211a1fc62 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Main/MainRouter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Main/MainRouter.swift @@ -27,11 +27,6 @@ final class MainRouter { .wrapToNavigationController() } - func browserViewController() -> UIViewController { - return BrowserModule.create(app: app) - .wrapToNavigationController() - } - func present(proposal: Session.Proposal, importAccount: ImportAccount, context: VerifyContext?) { SessionProposalModule.create(app: app, importAccount: importAccount, proposal: proposal, context: context) .presentFullScreen(from: viewController, transparentBackground: true) diff --git a/Example/WalletApp/PresentationLayer/Wallet/Main/Model/TabPage.swift b/Example/WalletApp/PresentationLayer/Wallet/Main/Model/TabPage.swift index d79c5a4e4..e391d283e 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Main/Model/TabPage.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Main/Model/TabPage.swift @@ -3,32 +3,27 @@ import UIKit enum TabPage: CaseIterable { case wallet case notifications - case browser case settings var title: String { switch self { case .wallet: - return "Apps" + return "Connections" case .notifications: - return "Notifications" + return "Inbox" case .settings: return "Settings" - case .browser: - return "Browser" } } var icon: UIImage { switch self { case .wallet: - return UIImage(systemName: "house.fill")! + return UIImage(named: "connections_tab")! case .notifications: - return UIImage(systemName: "bell.fill")! - case .browser: - return UIImage(systemName: "network")! + return UIImage(named: "inbox_tab")! case .settings: - return UIImage(systemName: "gearshape.fill")! + return UIImage(named: "settings_tab")! } } @@ -37,6 +32,6 @@ enum TabPage: CaseIterable { } static var enabledTabs: [TabPage] { - return [.wallet, .notifications, .browser, .settings] + return [.wallet, .notifications, .settings] } } diff --git a/Example/WalletApp/PresentationLayer/Wallet/Notifications/NotificationsRouter.swift b/Example/WalletApp/PresentationLayer/Wallet/Notifications/NotificationsRouter.swift index 843fcc14d..a7bc7b2ac 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Notifications/NotificationsRouter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Notifications/NotificationsRouter.swift @@ -12,7 +12,8 @@ final class NotificationsRouter { } func presentNotifications(subscription: NotifySubscription) { - SubscriptionModule.create(app: app, subscription: subscription) - .push(from: viewController) + let module = SubscriptionModule.create(app: app, subscription: subscription) + module.hidesBottomBarWhenPushed = true + module.push(from: viewController) } } diff --git a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsPresenter.swift index fb827251e..d9c10848d 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsPresenter.swift @@ -38,6 +38,10 @@ final class SettingsPresenter: ObservableObject { return deviceToken } + func browserPressed() { + router.presentBrowser() + } + func logoutPressed() async throws { guard let account = accountStorage.importAccount?.account else { return } try await interactor.notifyUnregister(account: account) diff --git a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsRouter.swift b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsRouter.swift index 7ef69186e..5e78f55b6 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsRouter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsRouter.swift @@ -13,4 +13,9 @@ final class SettingsRouter { @MainActor func presentWelcome() async { WelcomeModule.create(app: app).present() } + + func presentBrowser() { + BrowserModule.create(app: app) + .push(from: viewController) + } } diff --git a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsView.swift b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsView.swift index 137296793..e89b5b33b 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/Settings/SettingsView.swift @@ -19,6 +19,15 @@ struct SettingsView: View { row(title: "Device Token", subtitle: viewModel.deviceToken) } + Section { + Button { + viewModel.browserPressed() + } label: { + Text("Browser") + .frame(maxWidth: .infinity) + } + } + Section { AsyncButton { try await viewModel.logoutPressed()