taler-ios

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

commit 9d1f30c6f37f5df50052e3676d6a2198ee51199f
parent b9d642b272dc82677a0445bbb53f9789966c58b9
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 12 Sep 2026 17:59:37 +0200

fix discounts presentation

Diffstat:
MTalerWallet1/Views/Balances/DiscountPasses.swift | 93++++++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 50 insertions(+), 43 deletions(-)

diff --git a/TalerWallet1/Views/Balances/DiscountPasses.swift b/TalerWallet1/Views/Balances/DiscountPasses.swift @@ -66,60 +66,67 @@ struct DiscountsPassesItem: View { .foregroundColor(primary2) Section { - let swipe = Button { - symLog.log("delete \(token.id)") - deleteAction(token.id) - } label: { - Label("Delete", systemImage: "trash") - }.tint(WalletColors().negative) - let row = HStack(alignment: .top) { - name - Spacer() - if let available = token.tokensAvailable { - // Discount - Text("x\(available)") - .foregroundColor(primaryAccent) - } else { - // Pass - if isValid { - Text("active") + VStack(alignment: .leading, spacing: 2) { + let row = HStack(alignment: .top) { + name + Spacer() + if let available = token.tokensAvailable { + // Discount + Text("x\(available)") .foregroundColor(primaryAccent) + } else { + // Pass + if isValid { + Text("active") + .foregroundColor(primaryAccent) + } } } - } - if isValid { - row - } else { - row.swipeActions(edge: .trailing) { swipe } - } - - let merchant = token.merchantInfo?.name ?? "Unknown" - if isExpired { - Text(isPass ? "Provided by: \(merchant)" - : isValid ? "Was redeemable at: \(merchant)" - : "Redeemed at: \(merchant)") - .talerFont(.footnote) - .foregroundColor(secondary) - - } else { - Text(isPass ? "Provided by: \(merchant)" - : "Redeemable at: \(merchant)") - .talerFont(.footnote) + .padding(.horizontal) + .padding(.top, 6) + if isValid { + row + } else { + let swipe = Button { + symLog.log("delete \(token.id)") + deleteAction(token.id) + } label: { + Label("Delete", systemImage: "trash") + }.tint(WalletColors().negative) + row.swipeActions(edge: .trailing) { swipe } + } + Divider() + desc + .padding(.horizontal) + .padding(.vertical, 4) + Divider() + let merchant = token.merchantInfo?.name ?? "Unknown" + Text(isPass ? "Provided by: \(merchant)" + : !isExpired ? "Redeemable at: \(merchant)" + : isValid ? "Was redeemable at: \(merchant)" + : "Redeemed at: \(merchant)") + .talerFont(.body) .foregroundColor(secondary) + .padding(.horizontal) + .padding(.vertical, 4) } - let dateStrings = validDate(isValid, isExpired: isExpired) - VStack { - Text(dateStrings.0) - .accessibilityLabel(dateStrings.1) - .talerFont(.body) - }.frame(maxWidth: .infinity) - .background(primaryAccent.opacity(isValid ? 0.1 : 0)) + + ContainerRelativeShape() + .fill(isValid ? primaryAccent.opacity(0.1) : .clear) + .overlay { + let dateStrings = validDate(isValid, isExpired: isExpired) + Text(dateStrings.0) + .accessibilityLabel(dateStrings.1) + .talerFont(.body) + } .onTapGesture { if !isExpired { dateToggled.toggle() } } } + .listRowSeparator(.hidden) + .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0)) } } // MARK: -