[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 11/11: Minimalistic
From: |
gnunet |
Subject: |
[taler-taler-ios] 11/11: Minimalistic |
Date: |
Sat, 21 Oct 2023 21:10:09 +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 a0c6bdbb99b4f84ed0acd0bb99dd3821325abd22
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 21 21:09:19 2023 +0200
Minimalistic
---
TalerWallet1/Views/Settings/SettingsItem.swift | 24 ++++++---
TalerWallet1/Views/Settings/SettingsView.swift | 70 ++++++++++++++------------
2 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift
b/TalerWallet1/Views/Settings/SettingsItem.swift
index ae61cf2..76220e0 100644
--- a/TalerWallet1/Views/Settings/SettingsItem.swift
+++ b/TalerWallet1/Views/Settings/SettingsItem.swift
@@ -6,11 +6,13 @@ import SwiftUI
struct SettingsItem<Content: View>: View {
var name: String
+ var id1: String? = nil
var description: String?
var content: () -> Content
- init(name: String, description: String? = nil, @ViewBuilder content:
@escaping () -> Content) {
+ init(name: String, id1: String, description: String? = nil, @ViewBuilder
content: @escaping () -> Content) {
self.name = name
+ self.id1 = id1
self.description = description
self.content = content
}
@@ -19,30 +21,35 @@ struct SettingsItem<Content: View>: View {
HStack {
VStack {
Text(name)
+ .id(id1)
.frame(maxWidth: .infinity, alignment: .leading)
.accessibilityFont(.title2)
.padding([.bottom], 0.01)
if let desc = description {
Text(desc)
+ .id(id1 == nil ? nil : id1! + "_T")
.frame(maxWidth: .infinity, alignment: .leading)
.accessibilityFont(.caption)
}
- }
+ }.id(id1 == nil ? nil : id1! + "_V")
content()
.accessibilityFont(.body)
- }.padding([.bottom], 4)
+ }.id(id1 == nil ? nil : id1! + "_H")
+ .padding([.bottom], 4)
}
}
// MARK: -
struct SettingsToggle: View {
var name: String
@Binding var value: Bool
+ var id1: String? = nil
var description: String?
var action: () -> Void = {}
var body: some View {
VStack {
Toggle(name, isOn: $value.animation())
+ .id(id1)
.accessibilityFont(.title2)
.onChange(of: value) { value in
action()
@@ -50,10 +57,13 @@ struct SettingsToggle: View {
if let desc = description {
Text(desc)
+ .id(id1 == nil ? nil : id1! + "_T")
.frame(maxWidth: .infinity, alignment: .leading)
.accessibilityFont(.caption)
}
- }.padding([.bottom], 4)
+ }
+ .padding([.bottom], 4)
+ .id(id1 == nil ? nil : id1! + "_V")
}
}
// MARK: -
@@ -157,7 +167,7 @@ struct SettingsItemPreview : View {
var body: some View {
VStack {
- SettingsToggle(name: "Developer Mode", value: $developerMode,
+ SettingsToggle(name: "Developer Mode", value: $developerMode, id1:
"dev1",
description: "More information intended for debugging")
SettingsSpeaker(name: String(localized: "Play Payment Sounds"),
value: $playSounds,
description: String(localized: "After a transaction
finished"))
@@ -169,9 +179,9 @@ struct SettingsItemPreview : View {
struct SettingsItem_Previews: PreviewProvider {
static var previews: some View {
List {
- SettingsItem (name: "Exchanges", description: "Manage list of
exchanges known to this wallet") {}
+ SettingsItem (name: "Exchanges", id1: "list", description: "Manage
list of exchanges known to this wallet") {}
SettingsItemPreview()
- SettingsItem(name: "Save Logfile", description: "Help debugging
wallet-core") {
+ SettingsItem(name: "Save Logfile", id1: "save", description: "Help
debugging wallet-core") {
Button("Save") {
}
.buttonStyle(.bordered)
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift
b/TalerWallet1/Views/Settings/SettingsView.swift
index 01b1801..af94378 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -50,6 +50,7 @@ struct SettingsView: View {
@State private var diagnosticModeEnabled =
UserDefaults.standard.bool(forKey: "diagnostic_mode_enabled")
#endif
@State private var showDevelopItems = false
+ @State private var hideDescriptions = false
@State private var showResetAlert: Bool = false
@State private var didReset: Bool = false
@@ -97,38 +98,40 @@ struct SettingsView: View {
NavigationLink { // whole row like in a tableView
LazyView { AboutView(stack: stack.push(), navTitle:
aboutStr) }
} label: {
- SettingsItem(name: aboutStr,
- description: String(localized: "More info about this
app...")) {}
+ SettingsItem(name: aboutStr, id1: "about",
+ description: hideDescriptions ? nil :
String(localized: "More info about this app...")) {}
}
if controller.hapticCapability.supportsHaptics {
- SettingsToggle(name: String(localized: "Haptics"), value:
$useHaptics,
- description: String(localized: "Vibration
Feedback"))
+ SettingsToggle(name: String(localized: "Haptics"), value:
$useHaptics, id1: "haptics",
+ description: hideDescriptions ? nil :
String(localized: "Vibration Feedback"))
}
SettingsSpeaker(name: String(localized: "Play Payment
Sounds"), value: $playSounds,
- description: String(localized: "When a
transaction finished"))
+ description: hideDescriptions ? nil :
String(localized: "When a transaction finished"))
+ .id("playSounds")
SettingsFont(title: String(localized: "Font:"), value:
talerFont, action: redraw)
SettingsStyle(title: String(localized: "Liststyle:"),
myListStyle: $myListStyle)
- SettingsToggle(name: String(localized: "Minimalistic"), value:
$iconOnly,
- description: String(localized: "Omit text where
possible"))
+ SettingsToggle(name: String(localized: "Minimalistic"), value:
$iconOnly, id1: "minimal",
+ description: hideDescriptions ? nil :
String(localized: "Omit text where possible")) {
+ hideDescriptions = iconOnly //withAnimation {
hideDescriptions = iconOnly }
+ }
if diagnosticModeEnabled {
- SettingsToggle(name: String(localized: "Developer Mode"),
value: $developerMode,
- description: String(localized: "More information
intended for debugging")) {
- DebugViewC.shared.setViewID(VIEW_SETTINGS, stack:
stack.push())
+ SettingsToggle(name: String(localized: "Developer Mode"),
value: $developerMode, id1: "devMode",
+ description: hideDescriptions ? nil :
String(localized: "More information intended for debugging")) {
withAnimation { showDevelopItems = developerMode }
}
if showDevelopItems { // show or hide the following items
NavigationLink { // whole row like in a
tableView
LazyView { PendingOpsListView(stack: stack.push())
}
} label: {
- SettingsItem(name: String(localized: "Pending
Operations"),
- description: String(localized: "Exchange not
yet ready...")) {}
- }
+ SettingsItem(name: String(localized: "Pending
Operations"), id1: "pending",
+ description: hideDescriptions ? nil :
String(localized: "Exchange not yet ready...")) {}
+ }.id("pending_L")
SettingsToggle(name: String(localized: "Set 2 seconds
delay"),
value: $developDelay.onChange({ delay in
- walletCore.developDelay = delay}),
- description: String(localized: "After each
wallet-core action"))
- SettingsItem(name: String(localized: "Withdraw
\(DEMOCURRENCY)"),
- description: String(localized: "Get money for
testing")) {
+ walletCore.developDelay = delay}),
id1: "delay",
+ description: hideDescriptions ? nil :
String(localized: "After each wallet-core action"))
+ SettingsItem(name: String(localized: "Withdraw
\(DEMOCURRENCY)"), id1: "demo1with",
+ description: hideDescriptions ? nil :
String(localized: "Get money for testing")) {
Button("Withdraw") {
withDrawDisabled = true // don't run twice
Task { // runs on MainActor
@@ -142,9 +145,9 @@ struct SettingsView: View {
}
.buttonStyle(.bordered)
.disabled(withDrawDisabled)
- }
- SettingsItem(name: String(localized: "Withdraw
\(TESTCURRENCY)"),
- description: String(localized: "Get money for
testing")) {
+ }.id("demoWithdraw")
+ SettingsItem(name: String(localized: "Withdraw
\(TESTCURRENCY)"), id1: "test1with",
+ description: hideDescriptions ? nil :
String(localized: "Get money for testing")) {
Button("Withdraw") {
withDrawDisabled = true // don't run twice
Task { // runs on MainActor
@@ -158,9 +161,9 @@ struct SettingsView: View {
}
.buttonStyle(.bordered)
.disabled(withDrawDisabled)
- }
- SettingsItem(name: String(localized: "Run Integration
Test"),
- description: String(localized: "Perform basic
test transactions")) {
+ }.id("testWithdraw")
+ SettingsItem(name: String(localized: "Run Integration
Test"), id1: "demo1test",
+ description: hideDescriptions ? nil :
String(localized: "Perform basic test transactions")) {
Button("Demo 1") {
checkDisabled = true // don't run twice
Task { // runs on MainActor
@@ -175,8 +178,8 @@ struct SettingsView: View {
.buttonStyle(.bordered)
.disabled(checkDisabled)
}
- SettingsItem(name: String(localized: "Run Integration
Test"),
- description: String(localized: "Perform basic
test transactions")) {
+ SettingsItem(name: String(localized: "Run Integration
Test"), id1: "test1test",
+ description: hideDescriptions ? nil :
String(localized: "Perform basic test transactions")) {
Button("Test 1") {
checkDisabled = true // don't run twice
Task { // runs on MainActor
@@ -191,8 +194,8 @@ struct SettingsView: View {
.buttonStyle(.bordered)
.disabled(checkDisabled)
}
- SettingsItem(name: String(localized: "Run Integration
Test V2"),
- description: String(localized: "Perform more
test transactions")) {
+ SettingsItem(name: String(localized: "Run Integration
Test V2"), id1: "demo2test",
+ description: hideDescriptions ? nil :
String(localized: "Perform more test transactions")) {
Button("Demo 2") {
checkDisabled = true // don't run twice
Task { // runs on MainActor
@@ -207,8 +210,8 @@ struct SettingsView: View {
.buttonStyle(.bordered)
.disabled(checkDisabled)
}
- SettingsItem(name: String(localized: "Run Integration
Test V2"),
- description: String(localized: "Perform more
test transactions")) {
+ SettingsItem(name: String(localized: "Run Integration
Test V2"), id1: "test2test",
+ description: hideDescriptions ? nil :
String(localized: "Perform more test transactions")) {
Button("Test 2") {
checkDisabled = true // don't run twice
Task { // runs on MainActor
@@ -223,8 +226,8 @@ struct SettingsView: View {
.buttonStyle(.bordered)
.disabled(checkDisabled)
}
- SettingsItem(name: String(localized: "Save Logfile"),
- description: String(localized: "Help debugging
wallet-core")) {
+ SettingsItem(name: String(localized: "Save Logfile"),
id1: "save",
+ description: hideDescriptions ? nil :
String(localized: "Help debugging wallet-core")) {
Button("Save") {
symLog.log("Saving Log")
// FIXME: Save Logfile
@@ -232,8 +235,8 @@ struct SettingsView: View {
.buttonStyle(.bordered)
.disabled(true)
}
- SettingsItem(name: String(localized: "Reset Wallet"),
- description: String(localized: "Throw away all
your money")) {
+ SettingsItem(name: String(localized: "Reset Wallet"),
id1: "reset",
+ description: hideDescriptions ? nil :
String(localized: "Throw away all your money")) {
Button("Reset") {
showResetAlert = true
}
@@ -250,6 +253,7 @@ struct SettingsView: View {
.navigationBarItems(leading: hamburger)
.onAppear() {
showDevelopItems = developerMode
+ hideDescriptions = iconOnly
DebugViewC.shared.setViewID(VIEW_SETTINGS, stack: stack.push())
}
.onDisappear() {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (adfc919 -> a0c6bdb), gnunet, 2023/10/21
- [taler-taler-ios] 10/11: Use CurrencyFormatter for Balance, gnunet, 2023/10/21
- [taler-taler-ios] 11/11: Minimalistic,
gnunet <=
- [taler-taler-ios] 06/11: listExchangesForScopedCurrency, gnunet, 2023/10/21
- [taler-taler-ios] 04/11: cleanup, gnunet, 2023/10/21
- [taler-taler-ios] 01/11: CurrencySpecification, gnunet, 2023/10/21
- [taler-taler-ios] 03/11: ExchangeListItem, gnunet, 2023/10/21
- [taler-taler-ios] 05/11: getCurrencyInfo(scope), gnunet, 2023/10/21
- [taler-taler-ios] 02/11: HTTPError, gnunet, 2023/10/21
- [taler-taler-ios] 09/11: Call AboutView, gnunet, 2023/10/21
- [taler-taler-ios] 08/11: AboutView, gnunet, 2023/10/21
- [taler-taler-ios] 07/11: cache currency infos, gnunet, 2023/10/21