-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uses the system theme as default theme #3813
Conversation
758a9f4
to
e4b294c
Compare
60b6085
to
e31e725
Compare
Just tried this, and it doesn't work as expected from a fresh install, because the default value, if the preference is missing, is 0, and that's less than the value it's being compared against. So even with a fresh install you still get the dark theme. Unfortunately, the two cases where the preference is missing are:
There needs to be a mechanism to distinguish between those two cases. It might be possible to do that by inspecting the database. I'll investigate tomorrow. |
@SpaceFox Yeah -- simplest approach is probably, in
That'll return a list of accounts. If it's empty then this is a fresh install[1]. If it's not empty then this is an upgrade. So something like (untested) around line 79 of TuskyApplication.kt: val upgrading = db.accountDao().loadAll().isNotEmpty()
if (upgrading) {
val oldVersion = sharedPreferences.getInt(PrefKeys.SCHEMA_VERSION, 0)
if (oldVersion != SCHEMA_VERSION) {
upgradeSharedPreferences(oldVersion, SCHEMA_VERSION)
}
} [1] There's a chance the user has also logged out of all their accounts, and is now logging in from scratch. That's probably sufficiently unlikely that we don't need to worry about it... |
Please don't overengineer this D: |
Ah, yeah, that'll do it :-) |
Hi @SpaceFox , are you able to make the suggested changes? |
e31e725
to
2a077fd
Compare
Hi, I’m back from holidays, I pushed the suggested updates. |
Thank you. Sorry it took longer than I'd like to check this out. Just in case it's needed for future reference, I checked the following scenarios and it all behaves as expected: Upgrade
PASS Upgrade with theme (black)
PASS Upgrade with theme (dark)
PASS Fresh install, system theme is light
PASS Fresh install, system theme is dark
PASS |
A small polish update to set the "System Design" as default theme.
This to avoid unexpected behaviour on first application usage, and to force the user to change settings few seconds only after the first Tusky opening – which is a quite bad first impression.