View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012344 | Taler | wallet (iOS App) | public | 2026-11-27 08:14 | 2026-11-27 08:14 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | minor | ||
| Status | new | ||||
| Summary | 0012344: Payment Services: every balance change replaces the service's section by a new one -- "Get more demo cash" is enabled again at once (meant: after 5 s), listExchanges is asked again each time, and the rows below jump for a moment (patch attached) | ||||
| Description | On Settings > Payment Services every change of a balance throws away the section of that payment service and builds a new one. Three things follow; the first is easy to see: 1. "Get more demo cash" is enabled again at once. The button disables itself for five seconds ("don't run twice", ExchangeSectionView.swift:124-131). The withdrawal it starts changes the balance within a third of a second, the section is replaced, and the new one starts with `withDrawStarted = false`. Picture attached (payment-services-section-before-after.jpg): left, the button shortly after the tap -- blue, and it can be tapped again (the screen recording of that run has no frame in which it is grey); right, with the patch below -- grey. 2. The new section starts with an empty list of services and asks wallet-core for it again. One tap, from the app's log (times after the tap): +0.26 s .onNotification(.BalanceChange) ==> reload balances +0.27 s getBalances +0.31 s listExchanges <- the section, built anew +0.36 s getBalances +0.47 s listExchanges <- and again ... 3 listExchanges and 6 getBalances in all 3. Until that answer is in, the service's own rows (name and status, Terms of Service: 164 points) are missing and the rows below stand that much higher. In a random walk's accessibility samples (one every 60-170 ms) this shows as one sample 0.7 s after the tap and one 2.1 s after it: at rest Get more demo cash y=551..628 Delete payment service y=712..853 that sample Get more demo cash y=386..463 Delete payment service y=547..688 so for that moment "Delete payment service" is where "Get more demo cash" stands at rest (Demo Hints off, as in the picture; with the hints on, the hint block comes first -- by the layout, not measured). In the same sample the button is already enabled again (it was disabled 0.2 s earlier). I could NOT catch this in a screen recording -- the simulator's recorder showed no frame with the rows displaced -- so I cannot say for how many display frames it is drawn, and I have not tested where a touch in that moment goes. It is what VoiceOver and UI automation are given. Such samples are in 9 walks of my campaign, on both the regular and the nightly build. How to see it (GNU Taler 1.6.19; a build of master 16f6f629 plus the patches proposed in earlier reports -- ExchangeListView.swift, ExchangeSectionView.swift, ForEachWithIndex.swift and Model+Balances.swift are identical to master in it; iPhone 17 simulator, iOS 27.2) ---------------------------------------------------------------------- New wallet, "Get demo cash". Settings > Payment Services. Tap "Get more demo cash" and keep looking at the button. Cause ----- TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift:153-162 ForEachWithIndex(array: controller.balances) { index, balance in ExchangeSectionView(stack: stack.push(), balance: balance, ... TalerCommon/HelperViews/ForEachWithIndex.swift:32 identifies an element by its whole value: ForEach(Array(zip(array.indices, array)), id: \.1) { index, element in and a Balance's `==` and `hash(into:)` include `available`, `pendingIncoming`, `pendingOutgoing` and `flags` (TalerWallet1/Model/Model+Balances.swift:43-60). So the same balance with another amount is another element: SwiftUI discards the section's view with all its @State (ExchangeSectionView.swift:28-36: `exchanges`, `withDrawStarted`, `disabled`, `showAlert`, ...) and runs `.task { await viewDidLoad() }` (:191) for the new one. Balance is Identifiable, and its `id` is what a section should be known by: the payment service's URL (plus master key for a legacy scope), or the currency (Model+Balances.swift:22-32). By the same code `disabled` -- "don't try this more than once", set while "Delete payment service" is at work (:59) -- is forgotten by a balance change too. I have not produced that case. Proposed fix (payment-services-section-keeps-its-identity-v16f6f629.diff, against master 16f6f629, one hunk) ---------------------------------------------------------------------- The list identifies its sections by `\.1.id`: ForEach(Array(zip(controller.balances.indices, controller.balances)), id: \.1.id) { index, balance in Built and run with the same steps: after the tap the log has 6 getBalances as before and NO listExchanges, and in the recording the button turns grey at the tap and blue again some seconds later, once. Not changed: ForEachWithIndex itself. It identifies by the whole value in all nine places it is used (BalancesListView.swift:56 and OIMbalances.swift:252 also over `controller.balances`); I changed only the list where I could show what the lost state does. Found by the "a control changed under the finger" check of an automated UI walk; cause read from the samples and the log, then repeated with fixed steps on the unpatched and the patched build. | ||||
| Tags | No tags attached. | ||||
| Attached Files | payment-services-section-keeps-its-identity-v16f6f629.diff (977 bytes)
--- a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
@@ -150,7 +150,11 @@
}
#endif
let balanceList = List {
- ForEachWithIndex(array: controller.balances) { index, balance in
+ // A section is identified by its balance's `id` (the payment service, or the currency),
+ // not by the whole balance. With the amounts in the identity every change of the
+ // balance replaced the section by a new one: its rows were gone until listExchanges
+ // had answered again, and its state ("don't run twice") was forgotten.
+ ForEach(Array(zip(controller.balances.indices, controller.balances)), id: \.1.id) { index, balance in
ExchangeSectionView(stack: stack.push(),
balance: balance,
thousand: index * MAXEXCHANGES, // unique ID
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-27 08:14 | bot-cg | New Issue | |
| 2026-11-27 08:14 | bot-cg | Implementer | => MarcS |
| 2026-11-27 08:14 | bot-cg | Reviewer | => vlada.svirsh |
| 2026-11-27 08:14 | bot-cg | Release signed by | => MarcS |
| 2026-11-27 08:14 | bot-cg | Deployed by | => MarcS |
| 2026-11-27 08:14 | bot-cg | Verifier | => Bohdan |
| 2026-11-27 08:14 | bot-cg | Communicator | => CM_7 |
| 2026-11-27 08:14 | bot-cg | File Added: payment-services-section-before-after.jpg | |
| 2026-11-27 08:14 | bot-cg | File Added: payment-services-section-keeps-its-identity-v16f6f629.diff |