From de23efcadeb62aa769a2394ce2f675c4757540ab Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:01:29 -0800 Subject: [PATCH 1/8] Test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index eb1e1db90..b63c750b7 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) @@ -133,8 +133,8 @@ private class dydxMarketInfoViewPresenter: HostedViewPresenter Date: Mon, 6 Nov 2023 19:06:07 -0800 Subject: [PATCH 2/8] test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index b63c750b7..3a19267c4 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) From 10afa2fd9948a70735d478469f542aed874142e3 Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:10:14 -0800 Subject: [PATCH 3/8] test From e870cdc494e9b69f7caaf989dc8a6bcae085b66c Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:10:38 -0800 Subject: [PATCH 4/8] test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index 3a19267c4..a062f6c42 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) From d6c6b60c5c8f136e96d598f4658f7b76518d8504 Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:10:48 -0800 Subject: [PATCH 5/8] test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index a062f6c42..3a19267c4 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) From 44e452d10d698f985f14c7d55ece0411b09c9d62 Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:11:08 -0800 Subject: [PATCH 6/8] test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index 3a19267c4..a062f6c42 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) From f5973b9fa6aa3184efe0f6c34fd7d67393086638 Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:11:34 -0800 Subject: [PATCH 7/8] test --- .../_v4/MarketInfo/dydxMarketInfoViewBuilder.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index a062f6c42..32e7e880e 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -16,7 +16,7 @@ import dydxStateManager import Abacus public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { - public func build() -> T? { + public func build() -> T? { let presenter = dydxMarketInfoViewPresenter() let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() let viewController = dydxMarketInfoViewController(presenter: presenter, view: view, configuration: .nav) @@ -27,7 +27,7 @@ public class dydxMarketInfoViewBuilder: NSObject, ObjectBuilderProtocol { private class dydxMarketInfoViewController: HostingViewController { override public func arrive(to request: RoutingRequest?, animated: Bool) -> Bool { - if (request?.path == "/trade" || request?.path == "/market"), let presenter = presenter as? dydxMarketInfoViewPresenter { + if (request?.path == "/trade" || request?.path == "/market"), let presenter = presenter as? dydxMarketInfoViewPresenter { presenter.marketId = request?.params?["market"] as? String ?? "ETH-USD" DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { if request?.path == "/trade" { From 5bb573a9c79df0aad00264f5ce6e57ebf790ca9d Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 19:19:27 -0800 Subject: [PATCH 8/8] Add Swiftlint to bit pre-commit --- scripts/bootstrap.sh | 2 ++ scripts/pre-commit | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 scripts/pre-commit diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 32f0df7cf..0a338452c 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -2,6 +2,8 @@ ROOT_DIR=$(pwd)/../../ +cp pre-commit ../.git/hooks + # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100755 index 000000000..39536d0a4 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,17 @@ +#!/bin/sh + +# Redirect output to stderr. +exec 1>&2 + +# Stash any unstaged changes +git stash -q --keep-index + +# Run SwiftLint only on staged files +git diff --cached --name-only --diff-filter=ACM | grep "\.swift$" | while read file; do + swiftlint --fix --format "$file" 2>/dev/null +done + +# Stash the unstaged changes that were stashed previously +git stash pop -q + +exit 0