taler-ios

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

commit d62d3f01d3d4712f8536a3fe1c80553b9d383c54
parent f309f9c86d7dd928ebe485bd879be5c9204d2ecd
Author: Marc Stibane <marc@taler.net>
Date:   Tue, 27 Jun 2023 22:34:39 +0200

sizeCategory, task

Diffstat:
MTalerWallet1/Views/Balances/BalanceRowView.swift | 34+++++++++++++++++++++++++---------
MTalerWallet1/Views/Main/MainView.swift | 5+++++
2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift @@ -13,17 +13,34 @@ struct BalanceRowView: View { let sendAction: () -> Void let recvAction: () -> Void let rowAction: () -> Void + @Environment(\.sizeCategory) var sizeCategory + var body: some View { let currency = amount.currencyStr HStack { - Button("Request\nPayment", action: recvAction) - .lineLimit(2) - .disabled(false) - .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .leading)) - Button("Send\n\(currency)", action: sendAction) - .lineLimit(2) - .disabled(amount.isZero) - .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .leading)) + if sizeCategory > ContentSizeCategory.large { + VStack { + Button("Request\nPayment", action: recvAction) + .disabled(false) + .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .leading)) + Button("Send\n\(currency)", action: sendAction) + .disabled(amount.isZero) + .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .leading)) + } + .fixedSize(horizontal: true, vertical: false) // make the buttons equal width + } else { + HStack { + Button("Request\nPayment", action: recvAction) + .lineLimit(2) + .disabled(false) + .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .leading)) + Button("Send\n\(currency)", action: sendAction) + .lineLimit(2) + .disabled(amount.isZero) + .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .leading)) + } + .fixedSize(horizontal: true, vertical: true) // should make all buttons equal height - but doesn't + } Button(action: rowAction) { VStack(alignment: .trailing, spacing: 0) { HStack(alignment: .firstTextBaseline, spacing: 0) { @@ -41,7 +58,6 @@ struct BalanceRowView: View { .buttonStyle(TalerButtonStyle(type: .plain, aligned: .trailing)) // .background(Color.yellow) } - .fixedSize(horizontal: false, vertical: true) // should make all buttons equal height - but doesn't .accessibilityElement(children: .combine) } } diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift @@ -51,6 +51,11 @@ struct MainView: View { ErrorView(errortext: nil) // TODO: show Error View } else { LaunchAnimationView() + .task { + let deviceW = UIScreen.main.bounds.width + let deviceH = UIScreen.main.bounds.height + print(deviceW, deviceH) + } } } .animation(.easeOut(duration: LAUNCHDURATION), value: controller.backendState)