[#559] Remove the circular progress bar from home screen (#572)

- draft of the removal, home screen updated

[#559] Remove the circular progress bar from home screen

- circular area removed
- snapshot tests of the circular area removed
- home screen simplified
This commit is contained in:
Lukas Korba 2023-02-23 17:42:48 +01:00 committed by GitHub
parent 60f19a360d
commit 1988d30540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 199 deletions

View File

@ -397,7 +397,6 @@
9E612C7629880FC900D09B09 /* LogsHandlerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E612C7529880FC900D09B09 /* LogsHandlerTest.swift */; };
9E612C7929913F3600D09B09 /* SensitiveDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E612C7829913F3600D09B09 /* SensitiveDataTests.swift */; };
9E612C7E2991491200D09B09 /* SensitiveData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E612C7C2991476F00D09B09 /* SensitiveData.swift */; };
9E66122A287717A900C75B70 /* HomeCircularProgressSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E661229287717A900C75B70 /* HomeCircularProgressSnapshotTests.swift */; };
9E66122C2877188700C75B70 /* SyncStatusSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E66122B2877188700C75B70 /* SyncStatusSnapshot.swift */; };
9E6612312878337F00C75B70 /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 9E6612302878337F00C75B70 /* Lottie */; };
9E6612332878338C00C75B70 /* LottieAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6612322878338C00C75B70 /* LottieAnimation.swift */; };
@ -712,7 +711,6 @@
9E612C7529880FC900D09B09 /* LogsHandlerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsHandlerTest.swift; sourceTree = "<group>"; };
9E612C7829913F3600D09B09 /* SensitiveDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SensitiveDataTests.swift; sourceTree = "<group>"; };
9E612C7C2991476F00D09B09 /* SensitiveData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SensitiveData.swift; sourceTree = "<group>"; };
9E661229287717A900C75B70 /* HomeCircularProgressSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCircularProgressSnapshotTests.swift; sourceTree = "<group>"; };
9E66122B2877188700C75B70 /* SyncStatusSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncStatusSnapshot.swift; sourceTree = "<group>"; };
9E6612322878338C00C75B70 /* LottieAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LottieAnimation.swift; sourceTree = "<group>"; };
9E6612352878345000C75B70 /* endlessCircleProgress.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = endlessCircleProgress.json; sourceTree = "<group>"; };
@ -1727,7 +1725,6 @@
9E9ECC8B28589E150099D5A2 /* HomeSnapshotTests */ = {
isa = PBXGroup;
children = (
9E661229287717A900C75B70 /* HomeCircularProgressSnapshotTests.swift */,
9E9ECC8C28589E150099D5A2 /* HomeSnapshotTests.swift */,
3448CB3628E485CB006ADEDB /* NotEnoughFeeSpaceSnapshots.swift */,
);
@ -2983,7 +2980,6 @@
9E5BF63F2819542C00BA3F17 /* WalletEventsTests.swift in Sources */,
0D4E7A1B26B364180058B01E /* secantTests.swift in Sources */,
0DFE93E6272CB6F7000FCCA5 /* RecoveryPhraseValidationTests.swift in Sources */,
9E66122A287717A900C75B70 /* HomeCircularProgressSnapshotTests.swift in Sources */,
9EAB4676285B5C7C002904A0 /* DeeplinkTests.swift in Sources */,
9E207C362966EC77003E2C9B /* AddressDetailsSnapshotTests.swift in Sources */,
9E3911392848AD500073DD9A /* HomeTests.swift in Sources */,

View File

@ -13,17 +13,16 @@ struct HomeReducer: ReducerProtocol {
struct State: Equatable {
enum Destination: Equatable {
case balanceBreakdown
case notEnoughFreeDiskSpace
case profile
case request
case transactionHistory
case send
case balanceBreakdown
case transactionHistory
}
var destination: Destination?
var balanceBreakdownState: BalanceBreakdownReducer.State
var destination: Destination?
var profileState: ProfileReducer.State
var requestState: RequestReducer.State
var requiredTransactionConfirmations = 0

View File

@ -7,14 +7,18 @@ struct HomeView: View {
var body: some View {
WithViewStore(store) { viewStore in
VStack {
ZStack {
HStack {
profileButton(viewStore)
circularArea(viewStore)
sendButton(viewStore)
Spacer()
}
balance(viewStore)
Spacer()
sendButton(viewStore)
Button {
viewStore.send(.updateDestination(.transactionHistory))
} label: {
@ -44,89 +48,60 @@ struct HomeView: View {
extension HomeView {
func profileButton(_ viewStore: HomeViewStore) -> some View {
VStack {
HStack {
Spacer()
Image(Asset.Assets.Icons.profile.name)
.resizable()
.frame(width: 60, height: 60)
.padding(.trailing, 15)
.navigationLink(
isActive: viewStore.bindingForDestination(.profile),
destination: {
ProfileView(store: store.profileStore())
}
)
}
Spacer()
}
Image(Asset.Assets.Icons.profile.name)
.resizable()
.frame(width: 60, height: 60)
.padding(.trailing, 15)
.navigationLink(
isActive: viewStore.bindingForDestination(.profile),
destination: {
ProfileView(store: store.profileStore())
}
)
}
func sendButton(_ viewStore: HomeViewStore) -> some View {
VStack {
Spacer()
Text("Send")
.shadow(color: Asset.Colors.Buttons.buttonsTitleShadow.color, radius: 2, x: 0, y: 2)
.frame(
minWidth: 0,
maxWidth: .infinity,
minHeight: 0,
maxHeight: .infinity
)
.foregroundColor(Asset.Colors.Text.activeButtonText.color)
.background(Asset.Colors.Buttons.activeButton.color)
.cornerRadius(12)
.frame(height: 60)
.padding(.horizontal, 50)
.neumorphicButton()
.navigationLink(
isActive: viewStore.bindingForDestination(.send),
destination: {
SendFlowView(store: store.sendStore())
}
)
Spacer()
}
Text("Send")
.shadow(color: Asset.Colors.Buttons.buttonsTitleShadow.color, radius: 2, x: 0, y: 2)
.frame(
minWidth: 0,
maxWidth: .infinity,
minHeight: 0,
maxHeight: .infinity
)
.foregroundColor(Asset.Colors.Text.activeButtonText.color)
.background(Asset.Colors.Buttons.activeButton.color)
.cornerRadius(12)
.frame(height: 60)
.padding(.horizontal, 50)
.neumorphicButton()
.navigationLink(
isActive: viewStore.bindingForDestination(.send),
destination: {
SendFlowView(store: store.sendStore())
}
)
.padding(.bottom, 30)
}
func circularArea(_ viewStore: HomeViewStore) -> some View {
VStack {
ZStack {
CircularProgress(
outerCircleProgress: viewStore.isSyncing ? 0 : viewStore.synchronizerStatusSnapshot.progress,
innerCircleProgress: 1,
maxSegments: viewStore.requiredTransactionConfirmations,
innerCircleHidden: viewStore.isUpToDate
)
.padding(.top, 50)
VStack {
Button {
viewStore.send(.updateDestination(.balanceBreakdown))
} label: {
Text("$\(viewStore.shieldedBalance.data.total.decimalString())")
.font(.custom(FontFamily.Zboto.regular.name, size: 40))
.foregroundColor(Asset.Colors.Text.balanceText.color)
.padding(.top, 80)
}
Text("$\(viewStore.totalCurrencyBalance.decimalString())")
.font(.custom(FontFamily.Rubik.regular.name, size: 13))
.opacity(0.6)
.padding(.bottom, 50)
Text("\(viewStore.synchronizerStatusSnapshot.message)")
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
}
func balance(_ viewStore: HomeViewStore) -> some View {
Group {
Button {
viewStore.send(.updateDestination(.balanceBreakdown))
} label: {
Text("$\(viewStore.shieldedBalance.data.total.decimalString())")
.font(.custom(FontFamily.Zboto.regular.name, size: 40))
.foregroundColor(Asset.Colors.Text.balanceText.color)
}
Spacer()
Text("$\(viewStore.totalCurrencyBalance.decimalString())")
.font(.custom(FontFamily.Rubik.regular.name, size: 13))
.opacity(0.6)
Text("\(viewStore.synchronizerStatusSnapshot.message)")
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
}
}
}

View File

@ -90,8 +90,8 @@ class HomeTests: XCTestCase {
@MainActor func testQuickRescan_ResetToHomeScreen() async throws {
let homeState = HomeReducer.State(
destination: .profile,
balanceBreakdownState: .placeholder,
destination: .profile,
profileState: .placeholder,
requestState: .placeholder,
scanState: .placeholder,
@ -115,8 +115,8 @@ class HomeTests: XCTestCase {
@MainActor func testFullRescan_ResetToHomeScreen() async throws {
let homeState = HomeReducer.State(
destination: .profile,
balanceBreakdownState: .placeholder,
destination: .profile,
profileState: .placeholder,
requestState: .placeholder,
scanState: .placeholder,

View File

@ -1,109 +0,0 @@
//
// HomeCircularProgressSnapshotTests.swift
// secantTests
//
// Created by Lukáš Korba on 07.07.2022.
//
import XCTest
import ComposableArchitecture
@testable import secant_testnet
@testable import ZcashLightClientKit
class HomeCircularProgressSnapshotTests: XCTestCase {
func testCircularProgress_DownloadingInnerCircle() throws {
class SnapshotNoopSDKSynchronizer: NoopSDKSynchronizer {
// heights purposely set so we visually see 55% progress
override func statusSnapshot() -> SyncStatusSnapshot {
let blockProgress = BlockProgress(
startHeight: BlockHeight(0),
targetHeight: BlockHeight(100),
progressHeight: BlockHeight(55)
)
return SyncStatusSnapshot.snapshotFor(state: .syncing(blockProgress))
}
}
let balance = WalletBalance(verified: Zatoshi(15_345_000), total: Zatoshi(15_345_000))
let store = HomeStore(
initialState: .init(
balanceBreakdownState: .placeholder,
profileState: .placeholder,
requestState: .placeholder,
scanState: .placeholder,
sendState: .placeholder,
shieldedBalance: balance.redacted,
synchronizerStatusSnapshot: .default,
walletEventsState: .emptyPlaceHolder
),
reducer: HomeReducer()
.dependency(\.diskSpaceChecker, .mockEmptyDisk)
.dependency(\.sdkSynchronizer, SnapshotNoopSDKSynchronizer())
)
addAttachments(HomeView(store: store))
}
func testCircularProgress_ScanningOuterCircle() throws {
class SnapshotNoopSDKSynchronizer: NoopSDKSynchronizer {
override func statusSnapshot() -> SyncStatusSnapshot {
// heights purposely set so we visually see 72% progress
let blockProgress = BlockProgress(
startHeight: BlockHeight(0),
targetHeight: BlockHeight(100),
progressHeight: BlockHeight(72)
)
return SyncStatusSnapshot.snapshotFor(state: .syncing(blockProgress))
}
}
let balance = WalletBalance(verified: 15_345_000, total: 15_345_000)
let store = HomeStore(
initialState: .init(
balanceBreakdownState: .placeholder,
profileState: .placeholder,
requestState: .placeholder,
scanState: .placeholder,
sendState: .placeholder,
shieldedBalance: balance.redacted,
synchronizerStatusSnapshot: .default,
walletEventsState: .emptyPlaceHolder
),
reducer: HomeReducer()
.dependency(\.diskSpaceChecker, .mockEmptyDisk)
)
addAttachments(HomeView(store: store))
}
func testCircularProgress_UpToDateOnlyOuterCircle() throws {
class SnapshotNoopSDKSynchronizer: NoopSDKSynchronizer {
override func statusSnapshot() -> SyncStatusSnapshot {
SyncStatusSnapshot.snapshotFor(state: .synced)
}
}
let balance = WalletBalance(verified: 15_345_000, total: 15_345_000)
let store = HomeStore(
initialState: .init(
balanceBreakdownState: .placeholder,
profileState: .placeholder,
requestState: .placeholder,
scanState: .placeholder,
sendState: .placeholder,
shieldedBalance: balance.redacted,
synchronizerStatusSnapshot: .default,
walletEventsState: .emptyPlaceHolder
),
reducer: HomeReducer()
.dependency(\.diskSpaceChecker, .mockEmptyDisk)
)
addAttachments(HomeView(store: store))
}
}