Settings last saved before 1.8.5 hold the picked theme without a theme source, and the upgrade defaulted the source to System, which replaced the user's theme. A theme picked there now stays the app theme. Profile week stats declared mktime and difftime with a 64-bit time_t, which is 32-bit on 32-bit Android, so every day fell outside the week and active days and sessions read 0. Day offsets now use civil day arithmetic. Verified by upgrading real Inbe 1.8.0 data to this build on an armeabi-v7a Moto: theme, language, habits, counts, sessions and settings carry over, and the week shows 6 active days and 1 session.
79 lines
3.0 KiB
Ziran
79 lines
3.0 KiB
Ziran
#import, file "../src/app/settings_cache.zi";
|
|
#import, file "../src/app/settings_key.zi";
|
|
#import, file "../src/app/settings_upgrade.zi";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
if !SettingsCacheAdd("speed", " -23extra") ||
|
|
!SettingsCacheAdd("speed", "99") ||
|
|
!SettingsCacheAdd("empty", "") ||
|
|
!SettingsCacheAdd("bad", "words") ||
|
|
!SettingsCacheAdd("maximum", "99999999999999999999") ||
|
|
!SettingsCacheAdd("minimum", "-99999999999999999999") ||
|
|
!SettingsCacheAdd("signed", "+12 tail") ||
|
|
!SettingsCacheAdd("label", "morning") {
|
|
return 1
|
|
}
|
|
if SettingsCacheAdd("", "unused") { return 2 }
|
|
if !SettingsCacheContains("speed") ||
|
|
SettingsCacheContains("missing") ||
|
|
SettingsCacheInt("speed", 7) != -23 ||
|
|
SettingsCacheInt("empty", 7) != 7 ||
|
|
SettingsCacheInt("missing", 7) != 7 ||
|
|
SettingsCacheInt("bad", 7) != 0 ||
|
|
SettingsCacheInt("signed", 7) != 12 ||
|
|
SettingsCacheInt("maximum", 7) != 2147483647 ||
|
|
SettingsCacheInt("minimum", 7) != -2147483648 {
|
|
return 3
|
|
}
|
|
text: [5]u8
|
|
if !SettingsCacheCopyText("label", text[:]) ||
|
|
text[0] != 109 || text[1] != 111 || text[2] != 114 ||
|
|
text[3] != 110 || text[4] != 0 {
|
|
return 4
|
|
}
|
|
if SettingsCacheCopyText("missing", text[:]) || text[0] != 0 {
|
|
return 5
|
|
}
|
|
label_key: SettingsKey = SettingsKeyText("label")
|
|
if !SettingsCacheCopyTextBytes(label_key.bytes[0:label_key.count], text[:]) ||
|
|
text[0] != 109 || text[4] != 0 {
|
|
return 9
|
|
}
|
|
reminder: SettingsKey = SettingsKeyReminder(15, "last_day")
|
|
daily: SettingsKey = SettingsKeyBreak(2, "enabled")
|
|
music: SettingsKey = SettingsKeyMusicTrack(2)
|
|
if !reminder.valid || reminder.count != 20 ||
|
|
reminder.bytes[20] != 0 ||
|
|
!daily.valid || daily.count != 19 ||
|
|
!music.valid || music.count != 35 ||
|
|
SettingsKeyIndexed("", -1, "").valid ||
|
|
SettingsKeyText("123456789012345678901234567890123456789012345678").valid {
|
|
return 6
|
|
}
|
|
if !SettingsCacheAdd("reminder_15_last_day", "20260925") ||
|
|
!SettingsCacheAdd("break_daily_enabled", "1") ||
|
|
!SettingsCacheAdd("practice_music_track_sun_salutation", "2") ||
|
|
SettingsCacheIntBytes(reminder.bytes[0:reminder.count], 0) != 20260925 ||
|
|
SettingsCacheIntBytes(daily.bytes[0:daily.count], 0) != 1 ||
|
|
SettingsCacheIntBytes(music.bytes[0:music.count], 0) != 2 {
|
|
return 7
|
|
}
|
|
SettingsCacheFree()
|
|
if SettingsCacheContains("speed") { return 8 }
|
|
// Settings saved by 1.8.0 hold the picked theme without a source.
|
|
if SettingsThemePickedBeforeSources() ||
|
|
!SettingsCacheAdd("theme", "3") ||
|
|
!SettingsThemePickedBeforeSources() ||
|
|
!SettingsCacheAdd("theme_source", "1") ||
|
|
SettingsThemePickedBeforeSources() {
|
|
return 10
|
|
}
|
|
SettingsCacheFree()
|
|
if !SettingsCacheAdd("theme", "0") || SettingsThemePickedBeforeSources() {
|
|
return 11
|
|
}
|
|
SettingsCacheFree()
|
|
return 42
|
|
}
|