Repository navigation
fix(chats): redraw payment previews when rates arrive - #1875
Merged
Merged
Conversation
A Cash preview restates the sent amount at the display currency's rate and the sent currency's rate. The Chats list only re-mapped when the preferred rate changed, so a sent-currency rate arriving after the display rate left the preview in the sent currency until the tab was reopened. Archived chats and Search observed neither flow. Re-map on the rates map as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A payment in the chat list could preview in the currency it was sent in (£5.00) instead of the viewer's (CAD) until the Chats tab was reopened a few times.
The preview converts with the rates held at the moment the row is mapped, and
Fiat.forViewerreturns the amount unconverted when the sent currency's rate is missing.VerifiedProtoManager.saveRatesmerges streamed batches, so the display currency's rate can land before the sent currency's.ChatsViewModelonly re-mapped onobservePreferredRate(), which emits when the display rate changes, so a GBP rate arriving after CAD never redrew the row. Reopening the tab re-mapped with the rates on hand by then, which is why it settled eventually. The chat bubble was already right:ViewerAmountcollects both flows.ChatsViewModel,ArchivedChatsViewModelandSearchViewModelnow also re-map onobserveRates(), paired with the preferred rate to stay within five typed flows. The Archived list observed neither before. The share, group invite and currency send pickers map summaries too but don't show the preview, so they're unchanged.The lists now re-map on any rate update rather than only display-rate updates. The mapping runs on
dispatchers.Default.ChatsViewModelRatesTeststarts with only the CAD rate and a 5 GBP payment, checks the preview reads £5.00, then adds GBP without changing CAD and checks it reads the CAD amount. It fails without the fix.ChatsViewModelArchiveTeststubsobserveRates()so its combine still emits.iOS builds the preview in the row body from its observable cached rates, so it redraws when any rate lands and needs no change.