[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 01/12: AmountRowV
From: |
gnunet |
Subject: |
[taler-taler-ios] 01/12: AmountRowV |
Date: |
Tue, 31 Oct 2023 08:52:58 +0100 |
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 5d0072f0095dae9b5b8b76aefe2f04d1dac5fc60
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Oct 29 12:17:00 2023 +0100
AmountRowV
---
TalerWallet.xcodeproj/project.pbxproj | 6 ++
TalerWallet1/Views/HelperViews/AmountRowV.swift | 82 +++++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git a/TalerWallet.xcodeproj/project.pbxproj
b/TalerWallet.xcodeproj/project.pbxproj
index 16114b3..0259c6c 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -10,6 +10,8 @@
4E16E12329F3BB99008B9C86 /* CurrencySpecification.swift in
Sources */ = {isa = PBXBuildFile; fileRef = 4E16E12229F3BB99008B9C86 /*
CurrencySpecification.swift */; };
4E2254972A822B8100E41D29 /* payment_received.m4a in Resources
*/ = {isa = PBXBuildFile; fileRef = 4E2254952A822B8100E41D29 /*
payment_received.m4a */; };
4E2254982A822B8100E41D29 /* payment_sent.m4a in Resources */ =
{isa = PBXBuildFile; fileRef = 4E2254962A822B8100E41D29 /* payment_sent.m4a */;
};
+ 4E2E5F7F2AEE30DA0027FA8A /* AmountRowV.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4E2E5F7E2AEE30DA0027FA8A /* AmountRowV.swift */;
};
+ 4E2E5F802AEE30DA0027FA8A /* AmountRowV.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4E2E5F7E2AEE30DA0027FA8A /* AmountRowV.swift */;
};
4E3327BA2AD1635100BF5AD6 /* AsyncSemaphore.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4E3327B92AD1635100BF5AD6 /*
AsyncSemaphore.swift */; };
4E3327BB2AD1635100BF5AD6 /* AsyncSemaphore.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4E3327B92AD1635100BF5AD6 /*
AsyncSemaphore.swift */; };
4E363CBC2A237E0900D7E98C /* URL+id+iban.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4E363CBB2A237E0900D7E98C /* URL+id+iban.swift
*/; };
@@ -296,6 +298,7 @@
4E16E12229F3BB99008B9C86 /* CurrencySpecification.swift */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.swift; path = CurrencySpecification.swift; sourceTree = "<group>"; };
4E2254952A822B8100E41D29 /* payment_received.m4a */ = {isa =
PBXFileReference; lastKnownFileType = file; path = payment_received.m4a;
sourceTree = "<group>"; };
4E2254962A822B8100E41D29 /* payment_sent.m4a */ = {isa =
PBXFileReference; lastKnownFileType = file; path = payment_sent.m4a; sourceTree
= "<group>"; };
+ 4E2E5F7E2AEE30DA0027FA8A /* AmountRowV.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
AmountRowV.swift; sourceTree = "<group>"; };
4E3327B92AD1635100BF5AD6 /* AsyncSemaphore.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= AsyncSemaphore.swift; sourceTree = "<group>"; };
4E363CBB2A237E0900D7E98C /* URL+id+iban.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= "URL+id+iban.swift"; sourceTree = "<group>"; };
4E363CBD2A23CB2100D7E98C /* AnyTransition+backslide.swift */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.swift; path = "AnyTransition+backslide.swift"; sourceTree =
"<group>"; };
@@ -734,6 +737,7 @@
isa = PBXGroup;
children = (
4E97968F2A3765ED006F73BC /* AgePicker.swift */,
+ 4E2E5F7E2AEE30DA0027FA8A /* AmountRowV.swift */,
4E605DB92AB05FB6002FB9A7 /* BarGraph.swift */,
4EB095472989CBFE0043A8A1 /* Buttons.swift */,
4EF840A62A0B85F400EE0D47 /* CopyShare.swift */,
@@ -1108,6 +1112,7 @@
4E3EAE592A990778009F1BE8 /*
Model+Settings.swift in Sources */,
4EC4008C2AE5664100DF72C7 /*
CharacterSet+contains.swift in Sources */,
4E3EAE5A2A990778009F1BE8 /* ErrorView.swift in
Sources */,
+ 4E2E5F7F2AEE30DA0027FA8A /* AmountRowV.swift in
Sources */,
4E3EAE5B2A990778009F1BE8 /*
View+Notification.swift in Sources */,
4E3EAE5C2A990778009F1BE8 /* Model+Pending.swift
in Sources */,
4E3EAE5D2A990778009F1BE8 /*
ExchangeListView.swift in Sources */,
@@ -1216,6 +1221,7 @@
4EB095152989CBB00043A8A1 /*
Model+Settings.swift in Sources */,
4EC4008D2AE5664100DF72C7 /*
CharacterSet+contains.swift in Sources */,
4EB095692989CBFE0043A8A1 /* ErrorView.swift in
Sources */,
+ 4E2E5F802AEE30DA0027FA8A /* AmountRowV.swift in
Sources */,
4E3B4BC72A429F2A00CC88B8 /*
View+Notification.swift in Sources */,
4EB0956E2989CBFE0043A8A1 /* Model+Pending.swift
in Sources */,
4EB095522989CBFE0043A8A1 /*
ExchangeListView.swift in Sources */,
diff --git a/TalerWallet1/Views/HelperViews/AmountRowV.swift
b/TalerWallet1/Views/HelperViews/AmountRowV.swift
new file mode 100644
index 0000000..36ae4e0
--- /dev/null
+++ b/TalerWallet1/Views/HelperViews/AmountRowV.swift
@@ -0,0 +1,82 @@
+/*
+ * This file is part of GNU Taler, ©2022-23 Taler Systems S.A.
+ * See LICENSE.md
+ */
+import SwiftUI
+import taler_swift
+
+// calculate the width of the amountStr (with Font)
+// calculate the width of 'content' in compact form
+// if it fits side by side, then render HStack(content(compact), Spacer(),
amountStr)
+// else render VStack(content(wide), HStack(Spacer(), amountStr))
+
+struct AmountRowV<Content: View>: View {
+ let amountStr: String
+ let largeAmountFont: Bool
+ let fitsHorizontal: Bool
+
+ var content: () -> Content
+
+ var body: some View {
+ if fitsHorizontal {
+ HStack(alignment: .lastTextBaseline, spacing: 0) {
+ content()
+ Spacer(minLength: 0)
+ Text(amountStr)
+ .accessibilityFont(largeAmountFont ? .title : .title2)
+ .monospacedDigit()
+ }
+ } else {
+ VStack(alignment: .leading, spacing: 0) {
+ content()
+ HStack {
+ Spacer(minLength: 0)
+ Text(amountStr)
+ .accessibilityFont(largeAmountFont ? .title : .title2)
+ .monospacedDigit()
+ }
+ }
+ }
+ }
+}
+// MARK: -
+#if DEBUG
+
+struct SectionWithAmountRow: View {
+ @Environment(\.sizeCategory) var sizeCategory
+ var body: some View {
+ let testInfo = PreviewCurrencyInfo(TESTCURRENCY, digits: 0)
+ let demoInfo = PreviewCurrencyInfo(DEMOCURRENCY, digits: 2)
+ let test = try! Amount(fromString: TESTCURRENCY + ":1.23")
+ let demo = try! Amount(fromString: DEMOCURRENCY + ":1234.12")
+ let testStr = testInfo.string(for: test.valueAsTuple)
+ let demoStr = demoInfo.string(for: demo.valueAsTuple)
+ List {
+ Section {
+ AmountRowV(amountStr: demoStr, largeAmountFont: true,
fitsHorizontal: true) {
+ Text("Balance")
+ .accessibilityFont(.title2)
+ }
+ AmountRowV(amountStr: demoStr, largeAmountFont: true,
fitsHorizontal: false) {
+ Text("Balance")
+ .accessibilityFont(.title2)
+ }
+ }
+ Section {
+ AmountRowV(amountStr: testStr, largeAmountFont: false,
fitsHorizontal: true) {
+ Text("Balance")
+ .accessibilityFont(.title2)
+ }
+ AmountRowV(amountStr: testStr, largeAmountFont: false,
fitsHorizontal: false) {
+ Text("Balance")
+ .accessibilityFont(.title2)
+ }
+ }
+ }
+ }
+}
+
+#Preview {
+ SectionWithAmountRow()
+}
+#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (9f7de5c -> 101ccb8), gnunet, 2023/10/31
- [taler-taler-ios] 03/12: string(_ currencyInfo: CurrencyInfo?), gnunet, 2023/10/31
- [taler-taler-ios] 04/12: Self._logChanges(), gnunet, 2023/10/31
- [taler-taler-ios] 01/12: AmountRowV,
gnunet <=
- [taler-taler-ios] 02/12: Use AmountRowV, gnunet, 2023/10/31
- [taler-taler-ios] 06/12: Pending color, sizes, alignment, gnunet, 2023/10/31
- [taler-taler-ios] 09/12: Pending: circle -> diamond, gnunet, 2023/10/31
- [taler-taler-ios] 11/12: use sizeCategory, gnunet, 2023/10/31
- [taler-taler-ios] 10/12: cleanup, debugging, gnunet, 2023/10/31
- [taler-taler-ios] 07/12: Use AmountRowV for transactions, gnunet, 2023/10/31
- [taler-taler-ios] 12/12: Bump version to 0.9.3 (23), gnunet, 2023/10/31
- [taler-taler-ios] 05/12: Minimalistic, gnunet, 2023/10/31
- [taler-taler-ios] 08/12: Layout: View+fitsSideBySide, gnunet, 2023/10/31