taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 735c7218dcde6ff4ce175895c84118a262332b91
parent 77922412932255cf2c44b6260dd02f7ca548340c
Author: Marc Stibane <marc@taler.net>
Date:   Sun, 20 Aug 2023 06:44:28 +0200

UI improvements

Diffstat:
MTalerWallet1/Views/Balances/BalanceRowButtons.swift | 11++++++++---
MTalerWallet1/Views/HelperViews/LaunchAnimationView.swift | 32++++++++++++++++++++++----------
MTalerWallet1/Views/Main/MainView.swift | 9++-------
MTalerWallet1/Views/Main/SideBarView.swift | 26+++++---------------------
MTalerWallet1/Views/Peer2peer/SendAmount.swift | 2+-
MTalerWallet1/Views/Peer2peer/SendPurpose.swift | 40++++++++++++++++++++++++++++------------
MTalerWallet1/Views/Transactions/ManualDetails.swift | 2+-
MTalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift | 2+-
8 files changed, 68 insertions(+), 56 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalanceRowButtons.swift b/TalerWallet1/Views/Balances/BalanceRowButtons.swift @@ -19,12 +19,17 @@ struct BalanceRowButtons: View { Button("Request\nPayment", action: recvAction) .lineLimit(lineLimit) .disabled(false) - .buttonStyle(TalerButtonStyle(type: .bordered, narrow: narrow, aligned: .center)) + .buttonStyle(TalerButtonStyle(type: .bordered, + dimmed: false, + narrow: narrow, + aligned: .center)) Button("Send\n\(currency)", action: sendAction) .lineLimit(lineLimit) .disabled(amount.isZero) - .buttonStyle(TalerButtonStyle(type: .bordered, narrow: narrow, aligned: .center)) - + .buttonStyle(TalerButtonStyle(type: .bordered, + dimmed: false, + narrow: narrow, + aligned: .center)) } } } diff --git a/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift b/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift @@ -5,6 +5,18 @@ import SwiftUI struct LaunchAnimationView: View { + @State private var rotationEnabled = true + var body: some View { + ZStack { + Color(.systemGray6).ignoresSafeArea() + RotatingTaler(size: (350 < UIScreen.main.bounds.width) ? 200 : 250, rotationEnabled: $rotationEnabled) + } + } +} + +struct RotatingTaler: View { + let size: CGFloat + @Binding var rotationEnabled: Bool @State private var rotationDirection = false private let animationTimer = Timer @@ -12,17 +24,17 @@ struct LaunchAnimationView: View { .autoconnect() var body: some View { - ZStack { - Color(.systemGray6).ignoresSafeArea() - Image("taler-logo-2023-red") - .resizable() - .scaledToFit() - .frame(width: 250, height: 250) - .rotationEffect(rotationDirection ? Angle(degrees: 0) : Angle(degrees: 900)) - } + Image("taler-logo-2023-red") + .resizable() + .scaledToFit() + .frame(width: size, height: size) + .rotationEffect(rotationDirection ? Angle(degrees: 0) : Angle(degrees: 900)) + .accessibilityHidden(true) // decorative logo .onReceive(animationTimer) { timerValue in - withAnimation(.easeInOut(duration: 1.9)) { - rotationDirection.toggle() + if rotationEnabled { + withAnimation(.easeInOut(duration: 1.9)) { + rotationDirection.toggle() + } } } } diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift @@ -35,21 +35,16 @@ struct MainView: View { // any change to rootViewId triggers popToRootView behaviour .id(viewState.rootViewId) .onAppear() { - controller.playSound(1008) // TODO: Startup chime + controller.playSound(1008) // Startup chime soundPlayed = true } } else if controller.backendState == .error { ErrorView(errortext: nil) // TODO: show Error View } else { LaunchAnimationView() -// .task { -// let deviceW = UIScreen.main.bounds.width -// let deviceH = UIScreen.main.bounds.height -// print("UIScreen: \(deviceW), \(deviceH)") -// } } } - .animation(.easeOut(duration: LAUNCHDURATION), value: controller.backendState) + .animation(.linear(duration: LAUNCHDURATION), value: controller.backendState) .overlay(alignment: .top) { // Show the viewID on top of the app's NavigationView DebugViewV() diff --git a/TalerWallet1/Views/Main/SideBarView.swift b/TalerWallet1/Views/Main/SideBarView.swift @@ -5,7 +5,7 @@ import SwiftUI import SymLog -fileprivate let sidebarWidth = 220.0 +fileprivate let sidebarWidth = 200.0 struct SidebarItem { var name: String @@ -19,11 +19,6 @@ struct SideBarView: View { @Binding var currentView: Int @Binding var sidebarVisible: Bool @State private var rotationEnabled = false - @State private var rotationDirection = false - - private let animationTimer = Timer - .publish(every: 1.6, on: .current, in: .common) - .autoconnect() var body: some View { HStack { // sideView left, clear dismiss target right @@ -33,22 +28,10 @@ struct SideBarView: View { Link(gnuTaler, destination: URL(string:"https://taler.net")!) .font(.largeTitle) //.bold() iOS 16 .padding(.top, 30) - Image("taler-logo-2023-red") - .resizable() - .scaledToFit() - .frame(width: 100, height: 100) - .rotationEffect(rotationDirection ? Angle(degrees: 0) : Angle(degrees: 900)) - .accessibilityHidden(true) // decorative logo + RotatingTaler(size: 100, rotationEnabled: $rotationEnabled) .onTapGesture { rotationEnabled.toggle() } - .onReceive(animationTimer) { timerValue in - if rotationEnabled { - withAnimation(.easeInOut(duration: 1.9)) { - rotationDirection.toggle() - } - } - } ForEach(0..<views.count, id: \.self) { i in Button { symLog.log("sidebar item \"\(views[i].name)\" selected") @@ -63,8 +46,9 @@ struct SideBarView: View { .frame(maxWidth: sidebarWidth) } } - .buttonStyle(.bordered) - .font(.title) + .padding() + .buttonStyle(.borderless) + .font(.title2) .disabled(i == currentView) .accessibilityHidden(i == currentView) // don't suggest the current item } diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift @@ -61,7 +61,7 @@ struct SendAmount: View { summary: $summary, expireDays: $expireDays) }) { - Text("To another wallet") + Text("Next") } .buttonStyle(TalerButtonStyle(type: .prominent)) .disabled(disabled) Spacer() diff --git a/TalerWallet1/Views/Peer2peer/SendPurpose.swift b/TalerWallet1/Views/Peer2peer/SendPurpose.swift @@ -35,19 +35,35 @@ struct SendPurpose: View { VStack(alignment: .leading, spacing: 6) { Text("Purpose:") .padding(.top) - .font(.title3) + .font(.title2) - TextField("Purpose", text: $summary) - .font(.title) - .foregroundColor(WalletColors().fieldForeground) // text color - .background(WalletColors().fieldBackground) - .border(.primary) - .focused($isFocused) - .onAppear { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { - isFocused = true // make first responder - raise keybord + if #available(iOS 16.0, *) { + TextField("Purpose", text: $summary) + .font(.title2) + .lineLimit(2...) + .foregroundColor(WalletColors().fieldForeground) // text color + .background(WalletColors().fieldBackground) + .border(.primary) + .focused($isFocused) + .onAppear { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { + isFocused = true // make first responder - raise keybord + } + } + } else { + TextField("Purpose", text: $summary) + .font(.title) +// .lineLimit(2...5) // lineLimit' is only available in iOS 16.0 or newer + .foregroundColor(WalletColors().fieldForeground) // text color + .background(WalletColors().fieldBackground) + .border(.primary) + .focused($isFocused) + .onAppear { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { + isFocused = true // make first responder - raise keybord + } } - } + } HStack{ Spacer() @@ -80,7 +96,7 @@ struct SendPurpose: View { .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal) } - .navigationTitle("To another Wallet") + .navigationTitle("Purpose") .background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all)) .onAppear { DebugViewC.shared.setViewID(VIEW_SEND_PURPOSE) diff --git a/TalerWallet1/Views/Transactions/ManualDetails.swift b/TalerWallet1/Views/Transactions/ManualDetails.swift @@ -28,7 +28,7 @@ struct ManualDetails: View { .disabled(false) } .padding(.leading) .listRowSeparator(.hidden) - Text("Step 2: If you dont already have it in your banking favourites list, then copy and paste this IBAN into the receiver IBAN field in your banking app or website:") + Text("Step 2: If you don't already have it in your banking favourites list, then copy and paste this IBAN into the receiver IBAN field in your banking app or website:") .multilineTextAlignment(.leading) .listRowSeparator(.hidden) HStack { diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift @@ -56,7 +56,7 @@ struct WithdrawURIView: View { }.buttonStyle(TalerButtonStyle(type: .prominent)) .padding() } else { - Text("You must accept the Terms of Service first before you can withdraw electronic cash to your wallet.") + Text("You must accept the Exchange's Terms of Service first before you can use it to withdraw electronic cash to your wallet.") .multilineTextAlignment(.leading) .padding() NavigationLink(destination: LazyView {