zulip-flutter icon indicating copy to clipboard operation
zulip-flutter copied to clipboard

profile: Display user's local time

Open sirpengi opened this issue 2 years ago • 3 comments

In the profile screen (#195 ) we should show the current time in the user's configured timezone. This will involve integrating timezone data.

We've identified https://pub.dev/packages/timezone as a good candidate (chat thread) and an initial attempt was already made to integrate it, but the initialization of the database was measured to take ~100ms during bootup. It would make sense to delay the initialization of the database until we need to display the profile screen.

A followup issue will be:

  • #293

sirpengi avatar Aug 31 '23 11:08 sirpengi

Adding for future note: switching to the 10y db (that is 25% the size of the normal db) cut the initialization time to ~50ms. However, since all we are doing is showing the current time, I wonder how much we can cut this database down by as we won't need historic information at all. Will we ever need to render historic datetimes to some arbitrary local time?

sirpengi avatar Aug 31 '23 12:08 sirpengi

Added some thoughts in chat. In short: that 10y database is a good find and we should totally use it; but probably cutting the database down further wouldn't get us below like 30-40ms, so not enough gain to be worth modifying the package.

gnprice avatar Aug 31 '23 18:08 gnprice

Also it'd be good to repeat the measurement of the initialization time (a) in release mode or profile mode rather than debug mode, (b) on phone hardware rather than desktop hardware.

I expect it won't be so radically faster as to change the conclusion that we should defer the initialization away from app startup, but it might affect how we feel about different kinds of mitigations at the time when the user opens the profile screen.

gnprice avatar Aug 31 '23 19:08 gnprice

Hello, I'm an new contributor. I implemented this in my branch by using FutureBuilder. I'll make docs, tests and PR later.

Komyyy avatar Feb 03 '25 12:02 Komyyy

This is my draft PR: #F1318

Komyyy avatar Feb 03 '25 12:02 Komyyy

To test this feature in #1318, I made the PR #1363, which adds testable version of DateTime.now.

Komyyy avatar Feb 17 '25 11:02 Komyyy