A new profile now comes with Lumi, Habits and Practice installed and
pinned in that order on every device; Lists, Diary and Leaderboard wait
in More apps. Existing profiles keep their apps.
A choice nobody made, such as a new profile's apps, is stored at time 1
and never uploaded, so a newly signed-in device takes the account's apps
instead of removing them. The owner's install and remove choices keep
syncing per app in private.inbe.v1.app-preferences.
The pinned apps and their order sync as one record, app_order, in a new
collection private.inbe.v1.app-order that older versions skip. It is sent
only when the owner pins, moves or unpins an app; the newest order wins,
a pending local order wins a tie, and a record this version can't read
changes nothing without stopping the sync. An arriving order sets
app_order_received and the pins take it once, also after a restart. An
app removed on another device is unpinned here too.
Tests: storage sync round trips for app choices and order (defaults
never sent, stale and same-time records, unreadable records), the order
SQL, restore SQL, launcher policy encoding, and updated onboarding,
launcher, startup and Leaderboard UI expectations for the new defaults.
The Data screenshot scene installs Lists, which it opens from. The
Telegram flow fake gains HttpTransferPollLength, which sync_async has
called since c4babc97.
53 lines
1.8 KiB
Ziran
53 lines
1.8 KiB
Ziran
// Stable IDs and mask bits are shared by account preferences and packages.
|
|
#import, file "inbe_types.zi";
|
|
|
|
PackageCount :: 7
|
|
PackageMaximumBytes :: 67108864
|
|
|
|
PackageName :: (index: s32) -> string {
|
|
names: [PackageCount]string = .["inbe", "lists", "habits", "practices", "diary", "lumi", "leaderboard"]
|
|
if index < 0 || index >= PackageCount {
|
|
return ""
|
|
}
|
|
return names[index]
|
|
}
|
|
|
|
PackageID :: (index: s32) -> string {
|
|
ids: [PackageCount]string = .["inbe", "inbe.lists", "inbe.habits", "inbe.practices", "inbe.diary", "inbe.lumi", "inbe.leaderboard"]
|
|
if index < 0 || index >= PackageCount {
|
|
return ""
|
|
}
|
|
return ids[index]
|
|
}
|
|
|
|
PackageBit :: (index: s32) -> s32 {
|
|
if index < 1 || index >= PackageCount {
|
|
return 0
|
|
}
|
|
return cast(s32)1 << (index - 1)
|
|
}
|
|
|
|
PackagePreferenceKey :: (index: s32) -> string {
|
|
keys: [PackageCount]string = .["", "app_used_lists", "app_used_habits", "app_used_practices", "app_used_diary", "app_used_lumi", "app_used_leaderboard"]
|
|
if index < 1 || index >= PackageCount {
|
|
return ""
|
|
}
|
|
return keys[index]
|
|
}
|
|
|
|
// The pinned apps' order syncs as one record of package names, in its own
|
|
// collection: a version that doesn't know it skips it.
|
|
AppOrderKey :: "app_order"
|
|
AppOrderCollection :: "private.inbe.v1.app-order"
|
|
// Set when another device's order arrives, until the pins take it.
|
|
AppOrderReceivedKey :: "app_order_received"
|
|
// A default is stored at this time, older than any choice, so a choice from
|
|
// the account replaces it. Defaults are never uploaded.
|
|
AppDefaultTime :: 1
|
|
|
|
AppPreferenceValid :: (key: string) -> bool {
|
|
return key == "app_used_lists" || key == "app_used_habits" ||
|
|
key == "app_used_practices" || key == "app_used_diary" || key == "app_used_lumi" ||
|
|
key == "app_used_leaderboard"
|
|
}
|