Repository navigation
feat(search): avatar and a language-aware date on each hit - #12
Merged
Merged
Conversation
A result row was text and a raw "MMM d HH:mm", which reads foreign in a Czech UI and gives no anchor to the conversation. It now leads with the peer's avatar, like the chat list, and the date line is the chat list label: Today, Yesterday, then the weekday, then the date. That label was a private method on the chat list item, so it moved to `chatDateLabel` and both call sites use it. It also had one real bug behind it: nothing initialized the intl date data, so every DateFormat ran in English whatever the app language was, and any explicit locale (`devices_page` passes one) would throw. Date patterns and month names are now loaded for en and cs at startup, and `Intl.defaultLocale` follows the selected language, so rows, bubbles, day headers and the device list all speak the same language as the rest of the UI.
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.
Search results now lead with the peer's avatar (same letter avatar as the chat list) and the date line uses the chat list label instead of a raw
MMM d HH:mm.Underneath that, dates were never language-aware: intl's date data was never initialized, so every
DateFormatran in English regardless of the app language, and any explicit locale (as indevices_page) would have thrown.enandcsat startup.Intl.defaultLocalefollows the selected language, so chat rows, bubbles, sticky day headers, the search results and the device list all match the UI language.lib/utils/chat_date.dartand is shared by the chat list and the search results; the pure helper takes the localized "Today"/"Yesterday" labels and a testablenow.chat_date_testcovers the five branches.Verification:
flutter analyze --no-fatal-infosclean (5 pre-existing infos elsewhere),flutter test140/140. Not verified on a device.