Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sample] Tabbar redesign #1230

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Example/DApp/Modules/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ final class MainViewController: UITabBarController {
}

private func setupTabs() {
tabBar.unselectedItemTintColor = .white

let viewControllers = presenter.viewControllers

for (index, viewController) in viewControllers.enumerated() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import UIKit
struct AppearanceConfigurator: Configurator {

func configure() {

}
}
Original file line number Diff line number Diff line change
@@ -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"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "connections_tab.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "inbox_tab.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "settings_tab.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ final class MainPresenter {
return [
router.walletViewController(importAccount: importAccount),
router.notificationsViewController(importAccount: importAccount),
router.browserViewController(),
router.settingsViewController()
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")!
}
}

Expand All @@ -37,6 +32,6 @@ enum TabPage: CaseIterable {
}

static var enabledTabs: [TabPage] {
return [.wallet, .notifications, .browser, .settings]
return [.wallet, .notifications, .settings]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down