taler-ios

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

commit bcf5a191fed3744869906e2253494f8cf9044ab1
parent efd0bc8c9f6ef02537a085d011fd3e928c1ed041
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 27 Jul 2024 18:52:44 +0200

Link icon in About

Diffstat:
MTalerWallet1/Views/Settings/AboutView.swift | 6++++--
MTalerWallet1/Views/Settings/SettingsItem.swift | 23+++++++++++++++++++----
2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/TalerWallet1/Views/Settings/AboutView.swift b/TalerWallet1/Views/Settings/AboutView.swift @@ -39,8 +39,10 @@ struct AboutView: View { // has its own accessibilityLabel .frame(maxWidth: .infinity, alignment: .center) .onTapGesture(count: 1) { rotationEnabled.toggle() } - SettingsItem(name: String(localized: "Visit the taler.net website"), id1: "web", - description: minimalistic ? nil : String(localized: "More info about GNU Taler in general...")) { } + SettingsItem(name: String(localized: "Visit the taler.net website"), + id1: "web", + imageName: "link", + description: minimalistic ? nil : String(localized: "More info about GNU Taler in general...")) { } .accessibilityAddTraits(.isLink) .accessibilityRemoveTraits(.isStaticText) .onTapGesture() { diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift b/TalerWallet1/Views/Settings/SettingsItem.swift @@ -6,25 +6,40 @@ import SwiftUI struct SettingsItem<Content: View>: View { var name: String - var id1: String? = nil + var id1: String? + var imageName: String? var description: String? var content: () -> Content - init(name: String, id1: String, description: String? = nil, @ViewBuilder content: @escaping () -> Content) { + init(name: String, id1: String, imageName: String, description: String? = nil, @ViewBuilder content: @escaping () -> Content) { self.name = name self.id1 = id1 + self.imageName = imageName self.description = description self.content = content } + init(name: String, id1: String, description: String? = nil, @ViewBuilder content: @escaping () -> Content) { + self.name = name + self.id1 = id1 + self.imageName = nil + self.description = description + self.content = content + } + var body: some View { HStack { VStack { let isWeb = id1?.hasPrefix("web") ?? false let foreColor = isWeb ? WalletColors().tint : .primary - Text(name) - .id(id1) + HStack(spacing: 8.0) { + if let imageName { + Image(systemName: imageName) + } + Text(name) + .id(id1) + } .frame(maxWidth: .infinity, alignment: .leading) .foregroundColor(foreColor) .talerFont(.title2)