[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 04/11: ExchangeRowView
From: |
gnunet |
Subject: |
[taler-taler-ios] 04/11: ExchangeRowView |
Date: |
Tue, 24 Oct 2023 22:45:20 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit f941fe2a945fbed3e8cfb7675bcb229c0d8ba0dc
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Oct 24 16:43:57 2023 +0200
ExchangeRowView
---
TalerWallet.xcodeproj/project.pbxproj | 6 ++
...angeSectionView.swift => ExchangeRowView.swift} | 47 +++------------
.../Views/Exchange/ExchangeSectionView.swift | 69 +---------------------
3 files changed, 17 insertions(+), 105 deletions(-)
diff --git a/TalerWallet.xcodeproj/project.pbxproj
b/TalerWallet.xcodeproj/project.pbxproj
index cbefbd1..341df5d 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -233,6 +233,8 @@
4EBA82AD2A3F580500E5F39A /* QuiteSomeCoins.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EBA82AC2A3F580500E5F39A /*
QuiteSomeCoins.swift */; };
4EC400892AE3E7E800DF72C7 /* AboutView.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EC400882AE3E7E800DF72C7 /* AboutView.swift */;
};
4EC4008A2AE3E7E800DF72C7 /* AboutView.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EC400882AE3E7E800DF72C7 /* AboutView.swift */;
};
+ 4EC4008F2AE8019700DF72C7 /* ExchangeRowView.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EC4008E2AE8019700DF72C7 /*
ExchangeRowView.swift */; };
+ 4EC400902AE8019700DF72C7 /* ExchangeRowView.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EC4008E2AE8019700DF72C7 /*
ExchangeRowView.swift */; };
4EC90C782A1B528B0071DC58 /* ExchangeSectionView.swift in
Sources */ = {isa = PBXBuildFile; fileRef = 4EC90C772A1B528B0071DC58 /*
ExchangeSectionView.swift */; };
4ECB62802A0BA6DF004ABBB7 /* Model+P2P.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */;
};
4ECB62822A0BB01D004ABBB7 /* SelectDays.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */;
};
@@ -402,6 +404,7 @@
4EBA82AA2A3EB2CA00E5F39A /* TransactionButton.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= TransactionButton.swift; sourceTree = "<group>"; };
4EBA82AC2A3F580500E5F39A /* QuiteSomeCoins.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
QuiteSomeCoins.swift; sourceTree = "<group>"; };
4EC400882AE3E7E800DF72C7 /* AboutView.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= AboutView.swift; sourceTree = "<group>"; };
+ 4EC4008E2AE8019700DF72C7 /* ExchangeRowView.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= ExchangeRowView.swift; sourceTree = "<group>"; };
4EC90C772A1B528B0071DC58 /* ExchangeSectionView.swift */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift;
path = ExchangeSectionView.swift; sourceTree = "<group>"; };
4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= "Model+P2P.swift"; sourceTree = "<group>"; };
4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= SelectDays.swift; sourceTree = "<group>"; };
@@ -658,6 +661,7 @@
children = (
4EB095292989CBFE0043A8A1 /*
ExchangeListView.swift */,
4EC90C772A1B528B0071DC58 /*
ExchangeSectionView.swift */,
+ 4EC4008E2AE8019700DF72C7 /*
ExchangeRowView.swift */,
4E50B34F2A1BEE8000F9F01C /*
ManualWithdraw.swift */,
4EBA82AC2A3F580500E5F39A /*
QuiteSomeCoins.swift */,
4EB431662A1E55C700C5690E /*
ManualWithdrawDone.swift */,
@@ -1080,6 +1084,7 @@
4E3EAE492A990778009F1BE8 /*
ManualWithdrawDone.swift in Sources */,
4E3EAE4A2A990778009F1BE8 /*
PaymentPurpose.swift in Sources */,
4E3EAE4B2A990778009F1BE8 /* ShareSheet.swift in
Sources */,
+ 4EC4008F2AE8019700DF72C7 /*
ExchangeRowView.swift in Sources */,
4E3EAE4C2A990778009F1BE8 /* AmountView.swift in
Sources */,
4E605DBA2AB05FB6002FB9A7 /* BarGraph.swift in
Sources */,
4E3EAE4D2A990778009F1BE8 /* P2pAcceptDone.swift
in Sources */,
@@ -1186,6 +1191,7 @@
4EB431672A1E55C700C5690E /*
ManualWithdrawDone.swift in Sources */,
4E9320472A164BC700A87B0E /*
PaymentPurpose.swift in Sources */,
4E753A082A0B6A5F002D9328 /* ShareSheet.swift in
Sources */,
+ 4EC400902AE8019700DF72C7 /*
ExchangeRowView.swift in Sources */,
4EB0956C2989CBFE0043A8A1 /* AmountView.swift in
Sources */,
4E605DBB2AB05FB6002FB9A7 /* BarGraph.swift in
Sources */,
4E3B4BC32A42252300CC88B8 /* P2pAcceptDone.swift
in Sources */,
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
similarity index 70%
copy from TalerWallet1/Views/Exchange/ExchangeSectionView.swift
copy to TalerWallet1/Views/Exchange/ExchangeRowView.swift
index 73e8dbf..fa08d80 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
@@ -17,7 +17,7 @@ struct ExchangeRowView: View {
func selectAndUpdate(_ button: Int) {
buttonSelected = button // will trigger NavigationLink
- // while navigation animation runs, contact Exchange to update Fees
+ // TODO: while navigation animation runs, contact Exchange to update
Fees
// Task { // runs on MainActor
// do {
// try await model.updateExchange(scopeInfo: balance.scopeInfo)
@@ -59,49 +59,19 @@ struct ExchangeRowView: View {
lineLimit: 5, sendDisabled:
true, // TODO: amount.isZero
sendAction: {
selectAndUpdate(1) },
recvAction: {
selectAndUpdate(2) })
- let spacing = CGFloat(10) // space between
the two buttons
- if Self.needVStack(titles, width: width, spacing: spacing) {
+ if Self.needVStack(titles, width: width, spacing: HSPACING +
4, currency: currency) {
VStack { twoRowButtons }
} else {
- HStack(spacing: spacing) { twoRowButtons }
+ HStack(spacing: HSPACING) { twoRowButtons }
}
}
}
}
}
-// MARK: -
-/// This view shows the currency name in an exchange section
-/// currency
-/// [Deposit Coins] [Withdraw Coins]
-struct ExchangeSectionView: View {
- let stack: CallStack
-// let amount: Amount
- let currency: String // TODO: amount.currencyStr
- let exchanges: [Exchange]
- @Binding var centsToTransfer: UInt64
- var body: some View {
-#if DEBUG
- let _ = Self._printChanges()
-// let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
-#endif
- Section {
- ForEach(exchanges) { exchange in
- ExchangeRowView(stack: stack.push(),
- exchange: exchange,
-// amount: amount,
- currency: currency, // TODO:
(balance.available) amount.isZero to disable Deposit-button
- centsToTransfer: $centsToTransfer)
- }
- .accessibilityElement(children: .combine)
- } header: {
- BarGraphHeader(stack: stack.push(), currency: currency)
- }
- }
-}
// MARK: -
#if DEBUG
-struct ExchangeRow_Container : View {
+fileprivate struct ExchangeRow_Container : View {
@State private var centsToTransfer: UInt64 = 100
// let amount = try! Amount(fromString: LONGCURRENCY + ":1234.56")
@@ -120,13 +90,14 @@ struct ExchangeRow_Container : View {
exchangeEntryStatus: .ephemeral,
exchangeUpdateStatus: .ready,
ageRestrictionOptions: [])
- ExchangeSectionView(stack: CallStack("Preview"), currency:
LONGCURRENCY,
- exchanges: [exchange1, exchange2],
- centsToTransfer: $centsToTransfer)
+ ExchangeRowView(stack: CallStack("Preview"),
+ exchange: exchange1,
+ currency: LONGCURRENCY,
+ centsToTransfer: $centsToTransfer)
}
}
-struct ExchangeRow_Previews: PreviewProvider {
+fileprivate struct ExchangeRow_Previews: PreviewProvider {
static var previews: some View {
List {
ExchangeRow_Container()
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index 73e8dbf..e13ebc1 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -5,71 +5,6 @@
import SwiftUI
import taler_swift
-struct ExchangeRowView: View {
- let stack: CallStack
- let exchange: Exchange
-// let amount: Amount
- let currency: String
- @Binding var centsToTransfer: UInt64
-
- @Environment(\.sizeCategory) var sizeCategory
- @State private var buttonSelected: Int? = nil
-
- func selectAndUpdate(_ button: Int) {
- buttonSelected = button // will trigger NavigationLink
- // while navigation animation runs, contact Exchange to update Fees
-// Task { // runs on MainActor
-// do {
-// try await model.updateExchange(scopeInfo: balance.scopeInfo)
-// } catch { // TODO: error handling - couldn't updateExchange
-// // symLog.log("error: \(error)")
-// }
-// }
- }
-
- let depositTitle = String(localized: "Deposit", comment: "Top of button
<Deposit (currency)>")
- let withdrawTitle = String(localized: "Withdraw", comment: "Top of button
<Withdraw (currency)>")
-
- var body: some View {
- let baseURL = exchange.exchangeBaseUrl
-
- HStack(spacing: 0) { // can't use the built in Label because it
adds the accessory arrow
- Text(baseURL.trimURL())
- .accessibilityFont(.body)
-
- NavigationLink(destination: LazyView {
- EmptyView() // TODO: Deposit
- }, tag: 1, selection: $buttonSelected
- ) { EmptyView() }.frame(width: 0).opacity(0)
- NavigationLink(destination: LazyView {
- ManualWithdraw(stack: stack.push(),
- exchange: exchange,
- centsToTransfer: $centsToTransfer)
- }, tag: 2, selection: $buttonSelected
- ) { EmptyView() }.frame(width: 0).opacity(0)
- }.listRowSeparator(.hidden)
-
- SingleAxisGeometryReader { width in
- Group {
- let uiFont = TalerFont.uiFont(.title3)
- let titles = [(depositTitle, uiFont), (withdrawTitle, uiFont),
(currency, uiFont)]
- let sendTitle = depositTitle + "\n" + currency
// TODO: amount.currencyStr
- let recvTitle = withdrawTitle + "\n" + currency
// TODO: amount.currencyStr
- let twoRowButtons = TwoRowButtons(sendTitle: sendTitle,
recvTitle: recvTitle,
- lineLimit: 5, sendDisabled:
true, // TODO: amount.isZero
- sendAction: {
selectAndUpdate(1) },
- recvAction: {
selectAndUpdate(2) })
- let spacing = CGFloat(10) // space between
the two buttons
- if Self.needVStack(titles, width: width, spacing: spacing) {
- VStack { twoRowButtons }
- } else {
- HStack(spacing: spacing) { twoRowButtons }
- }
- }
- }
- }
-}
-// MARK: -
/// This view shows the currency name in an exchange section
/// currency
/// [Deposit Coins] [Withdraw Coins]
@@ -101,7 +36,7 @@ struct ExchangeSectionView: View {
}
// MARK: -
#if DEBUG
-struct ExchangeRow_Container : View {
+fileprivate struct ExchangeRow_Container : View {
@State private var centsToTransfer: UInt64 = 100
// let amount = try! Amount(fromString: LONGCURRENCY + ":1234.56")
@@ -126,7 +61,7 @@ struct ExchangeRow_Container : View {
}
}
-struct ExchangeRow_Previews: PreviewProvider {
+fileprivate struct ExchangeSection_Previews: PreviewProvider {
static var previews: some View {
List {
ExchangeRow_Container()
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (a0c6bdb -> bf7f8e3), gnunet, 2023/10/24
- [taler-taler-ios] 01/11: Assets cleanup, gnunet, 2023/10/24
- [taler-taler-ios] 02/11: Native Logging for wallet-core (QuickJS), gnunet, 2023/10/24
- [taler-taler-ios] 03/11: Logger, gnunet, 2023/10/24
- [taler-taler-ios] 05/11: Only call DetailsForAmount if non-zero, gnunet, 2023/10/24
- [taler-taler-ios] 10/11: CharacterSet+contains, gnunet, 2023/10/24
- [taler-taler-ios] 11/11: Layout for Pending - wip, gnunet, 2023/10/24
- [taler-taler-ios] 04/11: ExchangeRowView,
gnunet <=
- [taler-taler-ios] 08/11: Cleanup, gnunet, 2023/10/24
- [taler-taler-ios] 09/11: DD51 - CurrencySpecification, gnunet, 2023/10/24
- [taler-taler-ios] 07/11: intValue, fracValue, valueAsTuple, gnunet, 2023/10/24
- [taler-taler-ios] 06/11: Fix for NavigationView popping back, gnunet, 2023/10/24