[Refactor] remove unused code

No significant code changes, just consolidating helper methods
and removing unused code.
This commit is contained in:
Daniel Haight 2021-12-14 22:38:30 +00:00
parent cd3c98cce4
commit c37e9a2ade
2 changed files with 1 additions and 54 deletions

View File

@ -78,17 +78,6 @@ extension HomeStore {
typealias HomeViewStore = ViewStore<HomeState, HomeAction>
extension HomeViewStore {
func historyToggleString() -> String {
let hideShowString = isHistoryActive ? "HIDE" : "SHOW"
let selectedString = selectedTranactionID.map { "selected id: \($0)" } ?? "NONE selected"
let parts = [hideShowString, "History", selectedString]
return parts.joined(separator: " ")
}
func toggleShowingHistory() {
send(.updateRoute(isHistoryActive ? nil : .history))
}
func toggleSelectedTransaction() {
let isAlreadySelected = (self.selectedTranactionID != nil)
let transcation = self.transactionHistoryState.transactions[5]
@ -96,10 +85,6 @@ extension HomeViewStore {
send(.transactionHistory(.setRoute(newRoute)))
}
var isHistoryActive: Bool {
self.route == .history
}
var selectedTranactionID: Int? {
self.transactionHistoryState
.route
@ -115,42 +100,6 @@ extension HomeViewStore {
}
)
}
var showHistoryBinding: Binding<Bool> {
self.binding(
get: { $0.route == .history },
send: { isActive in
return .updateRoute(isActive ? .history : nil)
}
)
}
var showPhraseDisplayBinding: Binding<Bool> {
self.binding(
get: { $0.route == .recoveryPhraseDisplay },
send: { isActive in
return .updateRoute(isActive ? .send : nil)
}
)
}
var showSendBinding: Binding<Bool> {
self.binding(
get: { $0.route == .send },
send: { isActive in
return .updateRoute(isActive ? .send : nil)
}
)
}
var showProfileBinding: Binding<Bool> {
self.binding(
get: { $0.route == .profile },
send: { isActive in
return .updateRoute(isActive ? .profile : nil)
}
)
}
}
// MARK: PlaceHolders

View File

@ -78,7 +78,7 @@ struct HomeView: View {
}
}
.fullScreenCover(
isPresented: viewStore.showHistoryBinding,
isPresented: viewStore.bindingForRoute(.history),
content: {
NavigationView {
TransactionHistoryView(store: store.historyStore())
@ -116,8 +116,6 @@ extension HomeStore {
}
}
// MARK: - Previews
struct HomeView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {