Move Inner Breeze leaderboard into the shared Profile

This commit is contained in:
waozi committed 2026-10-26 23:47:03 -03:00
1 parent bdf5fcee7a
commit bc55cc6241
24 files changed
+266 -123

No files matched your search

+2
View File
@@ -34,6 +34,8 @@ account to sync across devices.
changing your app. Offline commands work without an AI connection.
- **Your apps:** arrange Apps as a list or grid, choose colours and icons,
listen to ambient Radio, and explore Arcade games and achievements.
- **Profile:** compare practice and game rankings with friends in Leaderboard.
Only installed apps, ranked practices and installed games appear there.
## A look inside
+2 -2
View File
@@ -1,5 +1,5 @@
{
"host_api": 38,
"host_api": 39,
"oldest_host_api": 12,
"package_format": "zx",
"module_api": 2,
@@ -9,7 +9,7 @@
"version": "2.1.51",
"sequence": 48,
"bundled": true,
"host_api": 38,
"host_api": 39,
"release": "2.1.51"
},
"habits": {
+5
View File
@@ -7497,3 +7497,8 @@ Načítání obrázků
---
[app_loading_apps]
Otevírání aplikací
---
[leaderboard_refresh_failed]
Žebříček se nepodařilo aktualizovat.
---
+5
View File
@@ -7491,3 +7491,8 @@ Bilder werden geladen
---
[app_loading_apps]
Apps werden geöffnet
---
[leaderboard_refresh_failed]
Die Rangliste konnte nicht aktualisiert werden.
---
+5
View File
@@ -7515,3 +7515,8 @@ Loading pictures
---
[app_loading_apps]
Opening apps
---
[leaderboard_refresh_failed]
Could not refresh the leaderboard.
---
+5
View File
@@ -7491,3 +7491,8 @@ Cargando imágenes
---
[app_loading_apps]
Abriendo aplicaciones
---
[leaderboard_refresh_failed]
No se pudo actualizar la clasificación.
---
+5
View File
@@ -7479,3 +7479,8 @@ Chargement des images
---
[app_loading_apps]
Ouverture des applications
---
[leaderboard_refresh_failed]
Impossible de mettre à jour le classement.
---
+5
View File
@@ -7480,3 +7480,8 @@ Memuat gambar
---
[app_loading_apps]
Membuka aplikasi-aplikasi
---
[leaderboard_refresh_failed]
Papan peringkat tidak dapat diperbarui.
---
+5
View File
@@ -7480,3 +7480,8 @@ Caricamento immagini
---
[app_loading_apps]
Apertura delle app
---
[leaderboard_refresh_failed]
Impossibile aggiornare la classifica.
---
+5
View File
@@ -7476,3 +7476,8 @@ Lumi や日記など、Inner Breeze 内のアプリを waozi.xyz から自動で
---
[app_loading_apps]
アプリを読み込み中
---
[leaderboard_refresh_failed]
ランキングを更新できませんでした。
---
+5
View File
@@ -7486,3 +7486,8 @@ Lumi, 일기 등 Inner Breeze 안의 앱을 waozi.xyz에서 자동으로 업데
---
[app_loading_apps]
앱 불러오는 중
---
[leaderboard_refresh_failed]
순위표를 새로 고칠 수 없습니다.
---
+5
View File
@@ -7489,3 +7489,8 @@ Carregando imagens
---
[app_loading_apps]
Abrindo aplicativos
---
[leaderboard_refresh_failed]
Não foi possível atualizar a classificação.
---
+5
View File
@@ -7485,3 +7485,8 @@ Inner Breeze обновлён до версии %s.
---
[app_loading_apps]
Открытие приложений
---
[leaderboard_refresh_failed]
Не удалось обновить таблицу лидеров.
---
+5
View File
@@ -7491,3 +7491,8 @@ Inner Breeze 已更新至 %s 版本。
---
[app_loading_apps]
正在打开各个应用
---
[leaderboard_refresh_failed]
无法刷新排行榜。
---
+23 -1
View File
@@ -2,6 +2,8 @@
// keys and specialized screens behind its native host services.
Entity :: #import "entity/model";
#import "entity/dew_model"
#import "entity/leaderboard_model"
#import, file "../screens/leaderboard_screen.zi";
Provider :: #import "entity/native_management";
#import "kryon/app_context_host"
Portable :: #import "kryon/app_protocol";
@@ -51,6 +53,7 @@ entity_inner_breeze: bool;
entity_reload_after_route: bool;
entity_account_route: bool;
entity_snapshot: string;
entity_leaderboard_route: bool;
InbeEntityRead :: (app: *InnerBreeze) -> string {
Entity.EntityFree(entity_document)
@@ -138,7 +141,7 @@ EntityHostAllows :: (context: *void, name: string) -> bool {
return name == "ReadStoreHost" || name == "WriteStoreHost" ||
name == "AppLocaleHost" || name == "ClipboardCopyHost" ||
name == "AppServiceHost" || name == "entity.management" || name == "entity.text_height" ||
name == "entity.achievements" || name == "entity.activity" || (name == "entity.dew" && DewAvailable())
name == "entity.achievements" || name == "entity.activity" || name == LEADERBOARD_SERVICE || (name == "entity.dew" && DewAvailable())
}
// The node-confirmed Dew account and Inner Breeze's own summaries for the
@@ -245,6 +248,10 @@ EntityHostText :: (text: string) -> HostValue {
}
EntityHostLocale :: (key: string) -> string {
if key == "leaderboard_title" || key == "leaderboard_refresh_failed" || key == "profile_friends_title" ||
key == "profile_no_leaderboard_data" || key == "profile_updating_status" {
return LocaleText(key)
}
if key == "achievements_title" || (key.count >= 12 && key[:12] == "achievement_") {
return LocaleText(key)
}
@@ -310,6 +317,10 @@ EntityHostCall :: (context: *void, module: *u8, function: *u8,
arguments: *HostValue, count: s32, result: *HostValue) -> s32 {
app := cast(*InnerBreeze)context
name := TextFromCString(function)
if name == "AppServiceHost" && count == 2 && AppArgumentText(arguments[0]) == LEADERBOARD_SERVICE {
result.* = EntityHostText(InbeLeaderboardSnapshot(app, AppArgumentText(arguments[1])))
return 1
}
if AchievementEntityCall(cast(*void)app, name, arguments, count, result) {
return 1
}
@@ -396,6 +407,11 @@ EntityHostFrame :: (app: *InnerBreeze, bounds: Rectangle) -> bool {
unused AppContextRun(*entity_context, Portable.APP_COMMAND)
}
entity_account_route = account_route
if entity_leaderboard_route {
entity_context.command = "leaderboard"
unused AppContextRun(*entity_context, Portable.APP_COMMAND)
entity_leaderboard_route = false
}
entity_context.session = app.ui.session
entity_context.bounds = bounds
entity_context.dark = app.dark_mode != 0
@@ -457,4 +473,10 @@ EntityHostReset :: () {
entity_inner_breeze = false
entity_account_route = false
entity_reload_after_route = true
entity_leaderboard_route = false
}
#program_export
EntityHostOpenLeaderboard :: () {
entity_leaderboard_route = true
}
+4 -4
View File
@@ -7,19 +7,19 @@ using AppNavRoute;
// Storage follows the app catalog; there is no separate favorites quota.
// The bundled apps, then one route for each slot of an app the node offers.
LAUNCHER_APP_COUNT :: 14
LAUNCHER_APP_COUNT :: 13
LauncherRoutes :: () -> [LAUNCHER_APP_COUNT]s32 {
// Leaderboard comes last of the bundled apps, so adding it moved none.
// The leaderboard belongs to the permanent Profile control.
return .{APP_NAV_ROUTE_DIARY, APP_NAV_ROUTE_HABITS,
APP_NAV_ROUTE_ELIST, APP_NAV_ROUTE_LUMI, APP_NAV_ROUTE_PRACTICE,
APP_NAV_ROUTE_LEADERBOARD, AppNavNodeRoute(0), AppNavNodeRoute(1),
AppNavNodeRoute(0), AppNavNodeRoute(1),
AppNavNodeRoute(2), AppNavNodeRoute(3), AppNavNodeRoute(4),
AppNavNodeRoute(5), AppNavNodeRoute(6), AppNavNodeRoute(7)}
}
// A new profile pins Lumi, Habits and Practice in this order. Lists and
// Leaderboard are also preinstalled and appear below the pinned section.
// Diary are also preinstalled and appear below the pinned section.
LauncherDefaults :: (routes: []s32) -> s32 {
defaults: [3]s32 = .{APP_NAV_ROUTE_LUMI,
APP_NAV_ROUTE_HABITS, APP_NAV_ROUTE_PRACTICE}
+1 -1
View File
@@ -1,5 +1,5 @@
// Generated from apps/versions.json. This host runs packages built for host
// interfaces from the oldest to the current one; module interfaces must match.
PackageHostAPI :: 38
PackageHostAPI :: 39
PackageHostAPIOldest :: 12
PackageModuleAPI :: 2
+11
View File
@@ -380,6 +380,17 @@ NodeInstalledVisible :: (entry: *NodeInstalledLeaf) -> bool {
return NodeTreeState(null, NodeTreeAccount(), *entry.identity, *state) && state.installed
}
// A retained game score does not prove its app is still installed.
NodeAppInstalledIdentity :: (root: string, id: string) -> bool {
for entry: node_installed_leaves {
if TextUntilNul(entry.root[:]) == root && TextUntilNul(entry.identity.id[:]) == id &&
NodeInstalledVisible(*entry) {
return true
}
}
return false
}
// Keep independent verified copies for each installed root, and project one
// visible definition per identity. Removing one root never hides another.
NodeInstalledRepresentative :: (at: s64) -> bool {
+16 -1
View File
@@ -59,6 +59,8 @@ using HostValueKind;
// its own instance and never overwrites a live slot or persists its handles.
node_tree_hosts: [NodeAppSlots * 2]AppHost;
node_tree_validating: bool;
node_tree_profile_requested: bool;
node_tree_profile_account: [65]u8;
node_tree_widget_node: *AppNode;
NodeTreeImage :: struct {
path: string
@@ -164,7 +166,7 @@ NodeTreeAllows :: (context: *void, node: *AppNode, name: string) -> bool {
return false
}
if name == "AppServiceHost" || name == "entity.records" || name == "entity.dew" || name == PublicationsService || name == "leaderboard" ||
name == "arcade.navigation" || name == "tile_map.sampling" { return true }
name == "arcade.navigation" || name == "entity.profile" || name == "tile_map.sampling" { return true }
if name == "AppRecordHost" || name == "SaveAppRecordHost" || name == "AppLocaleHost" ||
name == "SmoothFramesHost" || name == "ClipboardCopyHost" || name == "ReadStoreHost" ||
name == "WriteStoreHost" || name == "AppNowHost" || name == "AppLocalOffsetHost" ||
@@ -193,6 +195,12 @@ NodeTreeCall :: (context: *void, node: *AppNode, module: *u8, function: *u8,
}
if name == "AppServiceHost" && count == 2 && HostScalarValid(arguments[0], "string", cast(s32)HostString) &&
HostScalarValid(arguments[1], "string", cast(s32)HostString) {
if AppArgumentText(arguments[0]) == "entity.profile" && AppArgumentText(arguments[1]) == "open" &&
!node_tree_validating && !node_snapshot_scanning {
node_tree_profile_requested = CopyCString(NodeTreeAccount(), node_tree_profile_account[:])
result.* = NodeAppString(ifx node_tree_profile_requested then "queued" else "unavailable")
return 1
}
if AppArgumentText(arguments[0]) == "arcade.navigation" && AppArgumentText(arguments[1]) == "back" &&
!node_tree_validating && !node_snapshot_scanning && runner.nested != null {
// Queue the parent transition until the guest frame returns.
@@ -519,6 +527,13 @@ NodeTreeRuntime :: (slot: s32) -> *AppRuntime {
return AppHostActiveRuntime(node_runners[slot].nested)
}
// Consume only after the guest VM returns; Profile must never re-enter it.
NodeTreeTakeProfile :: () -> bool {
requested := node_tree_profile_requested && TextUntilNul(node_tree_profile_account[:]) == NodeTreeAccount()
node_tree_profile_requested = false
return requested
}
NodeTreeRunMessage :: (slot: s32, message: Legacy.AppMessage) -> Legacy.AppMessage {
message.succeeded = false
host := node_runners[slot].nested
+115 -98
View File
@@ -1,6 +1,9 @@
#import, file "../../apps/leaderboard/leaderboard_achievements.zi";
// Leaderboard ranks you with your friends. Saved and fetched results are
// parsed and ranked once when they change, never on every frame.
#import "entity/leaderboard_model"
EntityProfile :: #import "entity/model";
#import, file "../apps/node_app_snapshot.zi";
#import "keys"
#import "bundle_host"
#import "byte_text_linux"
@@ -566,117 +569,131 @@ LeaderboardUiCall :: (context: *void, module: *u8, function: *u8,
return 0
}
// Opening the app shows saved results at once and fetches fresh ones.
#program_export
leaderboard_screen_enter :: (app: *InnerBreeze) {
if app == null {
return
}
load_friends_cache(app)
LeaderboardListApps(app, LeaderboardInstalledPractices())
unused LeaderboardKeepInstalled(app, LeaderboardInstalledPractices())
LeaderboardLoadCache(app)
app_request_social_refresh(app)
}
// The old route remains a redirect for saved navigation and older packages.
// Profile owns the screen; Inner Breeze supplies its installed boards/data.
leaderboard_projection: string;
EntityHostOpenLeaderboard :: () #foreign c;
#program_export
leaderboard_screen_draw :: (app: *InnerBreeze) {
if app == null {
return
InbeLeaderboardSnapshot :: (app: *InnerBreeze, request: string) -> string {
page: ProfileLeaderboard
account: AccountKeys
if sync_account_load(*account) != 0 {
unused AppCopyText(TextUntilNul(account.public_id[:]), page.owner[:])
}
if page.owner[0] == cast(u8)0 {
unused AppCopyText("local", page.owner[:])
}
installed := LeaderboardInstalledPractices()
LeaderboardListApps(app, installed)
if LeaderboardKeepInstalled(app, installed) {
for index: cast(s32)0..leaderboard_app_count - 1 {
name := TextUntilNul(leaderboard_app_names[index][:])
title := TextUntilNul(leaderboard_app_titles[index][:])
if name == "practices" {
for item: cast(s32)0..installed.practice_count - 1 {
if page.board_count >= LEADERBOARD_BOARDS { break }
practice := installed.practices[item]
board := *page.boards[page.board_count]
unused AppCopyText(name, board.app[:])
unused AppCopyText(title, board.app_title[:])
unused AppCopyText(LeaderboardPracticeId(practice), board.id[:])
key := ifx practice == EXERCISE_MEDITATION then "exercise_meditation" else "exercise_wim_hof"
unused AppCopyText(LocaleText(key), board.title[:])
unused AppCopyText(LocaleText("profile_metric_streak"), board.primary[:])
unused AppCopyText(LocaleText(ifx practice == EXERCISE_MEDITATION then "profile_metric_avg_time" else "profile_metric_avg_hold"), board.average[:])
page.board_count += 1
}
} else {
games: [GAME_SCORES_MAX]s32
count := GameScoresFor(name, games[:])
for item: cast(s32)0..count - 1 {
score := *game_scores[games[item]]
game := TextUntilNul(score.game[:])
if page.board_count >= LEADERBOARD_BOARDS || !NodeAppInstalledIdentity(name, game) { continue }
board := *page.boards[page.board_count]
unused AppCopyText(name, board.app[:])
unused AppCopyText(title, board.app_title[:])
unused AppCopyText(game, board.id[:])
unused AppCopyText(TextUntilNul(score.title[:]), board.title[:])
unused AppCopyText(LocaleText("leaderboard_levels"), board.primary[:])
page.board_count += 1
}
}
}
current := ifx LeaderboardAppName(app) == "practices" then LeaderboardPracticeId(app.leaderboard_practice) else LeaderboardBoardName(app)
page.selected = ProfileBoardFind(*page, current)
if page.selected < 0 && page.board_count > 0 { page.selected = 0 }
owner: [97]u8
board_id: [65]u8
metric := ReadNumber(request, FieldAt(request, 0, "metric"))
if ReadStringText(request, FieldAt(request, 0, "owner"), owner[:]) > 0 &&
TextUntilNul(owner[:]) == TextUntilNul(page.owner[:]) &&
ReadStringText(request, FieldAt(request, 0, "board"), board_id[:]) > 0 &&
metric.valid && (metric.value == 0 || metric.value == 1) {
chosen := ProfileBoardFind(*page, TextUntilNul(board_id[:]))
if chosen >= 0 {
page.selected = chosen
app.leaderboard_metric = ifx page.boards[chosen].average[0] != cast(u8)0 then cast(s32)metric.value else 0
}
}
if page.selected >= 0 {
board := *page.boards[page.selected]
chosen := TextUntilNul(board.id[:])
changed := chosen != current
if board.average[0] == cast(u8)0 {
app.leaderboard_metric = LEADERBOARD_STREAK
}
unused AppCopyText(TextUntilNul(board.app[:]), app.leaderboard_app[:])
if TextUntilNul(board.app[:]) == "practices" {
for item: cast(s32)0..installed.practice_count - 1 {
practice := installed.practices[item]
if LeaderboardPracticeId(practice) == chosen { app.leaderboard_practice = practice }
}
} else {
unused AppCopyText(chosen, app.leaderboard_game[:])
}
// Refresh only the selected, currently installed board.
LeaderboardListApps(app, installed)
if changed || request == "refresh" {
if changed { app.leaderboard_metric = LEADERBOARD_STREAK }
LeaderboardLoadCache(app)
app_request_social_refresh(app)
}
if app.leaderboard_practice < 0 || app.leaderboard_practice >= EXERCISE_COUNT {
app.leaderboard_practice = EXERCISE_WIM_HOF
app.leaderboard_loaded = 0
}
if app.leaderboard_metric != LEADERBOARD_STREAK &&
(app.leaderboard_metric != LEADERBOARD_AVERAGE || !LeaderboardHasAverage(app.leaderboard_practice)) {
app.leaderboard_metric = LEADERBOARD_STREAK
}
if app.leaderboard_loaded == 0 || leaderboard_built_revision != app.leaderboard_revision ||
leaderboard_built_practice != app.leaderboard_practice ||
leaderboard_built_metric != app.leaderboard_metric ||
leaderboard_built_practice != app.leaderboard_practice || leaderboard_built_metric != app.leaderboard_metric ||
TextUntilNul(leaderboard_built_app[:]) != LeaderboardAppName(app) ||
TextUntilNul(leaderboard_built_board[:]) != LeaderboardBoardName(app) {
LeaderboardRebuild(app)
}
leaderboard_ui.session = app.ui.session
leaderboard_ui.width = app.ui.view_width
leaderboard_ui.height = app.ui.view_height
leaderboard_ui.bottom = app_content_bottom_reserved(app)
leaderboard_ui.scale = MetricsScale()
leaderboard_ui.font = AppFontSize()
leaderboard_ui.app_count = leaderboard_app_count
for index: cast(s32)0..leaderboard_app_count - 1 {
if TextUntilNul(leaderboard_app_names[index][:]) == LeaderboardAppName(app) {
leaderboard_ui.app_index = index
}
}
leaderboard_ui.board_count = leaderboard_board_count
leaderboard_ui.board_index = 0
for index: cast(s32)0..leaderboard_board_count - 1 {
if TextUntilNul(game_scores[leaderboard_boards[index]].game[:]) == LeaderboardBoardName(app) {
leaderboard_ui.board_index = index
}
}
state := LeaderboardMessage.{.action = LEADERBOARD_FRAME,
.practice = app.leaderboard_practice, .metric = app.leaderboard_metric,
.row_count = leaderboard_count, .signed_in = leaderboard_signed_in,
.loading = app_social_refresh_loading() != 0,
.has_average = LeaderboardAppName(app) == "practices" && LeaderboardHasAverage(app.leaderboard_practice),
.app = LeaderboardAppName(app), .board = LeaderboardBoardName(app),
.practices_listed = true, .practice_count = installed.practice_count,
.practices = installed.practices}
WidgetHostBegin(app.ui.session, HostedAssetAllowed)
AppsUiBegin(LeaderboardUiCall, cast(*void)app)
state = LeaderboardRun(state)
AppsUiEnd()
WidgetHostEnd()
if !state.succeeded {
return
}
if state.app != LeaderboardAppName(app) {
for index: cast(s32)0..leaderboard_app_count - 1 {
if state.app == TextUntilNul(leaderboard_app_names[index][:]) {
unused AppCopyText(state.app, app.leaderboard_app[:])
app.leaderboard_metric = LEADERBOARD_STREAK
leaderboard_ui.scroll = 0
LeaderboardLoadCache(app)
app_request_social_refresh(app)
return
page.metric = app.leaderboard_metric
page.loading = app_social_refresh_loading() != 0
page.row_count = leaderboard_count
for index: cast(s32)0..leaderboard_count - 1 {
source := *leaderboard_entries[index]
row := *page.rows[index]
unused AppCopyText(TextUntilNul(source.name[:]), row.name[:])
unused AppCopyText(TextUntilNul(source.streak[:]), row.value[:])
unused AppCopyText(TextUntilNul(source.average[:]), row.average[:])
row.own = source.own
if row.own && TextUntilNul(board.app[:]) == "practices" {
AchievementLeaderboardViewed(chosen)
}
}
}
if state.board != LeaderboardBoardName(app) {
for index: cast(s32)0..leaderboard_board_count - 1 {
if state.board == TextUntilNul(game_scores[leaderboard_boards[index]].game[:]) {
unused AppCopyText(state.board, app.leaderboard_game[:])
leaderboard_ui.scroll = 0
LeaderboardLoadCache(app)
app_request_social_refresh(app)
return
}
}
}
if state.practice != app.leaderboard_practice && state.practice >= 0 &&
state.practice < EXERCISE_COUNT {
app.leaderboard_practice = state.practice
app.leaderboard_metric = LEADERBOARD_STREAK
leaderboard_ui.scroll = 0
LeaderboardLoadCache(app)
app_request_social_refresh(app)
return
}
if state.metric == LEADERBOARD_STREAK ||
(state.metric == LEADERBOARD_AVERAGE && LeaderboardHasAverage(app.leaderboard_practice)) {
app.leaderboard_metric = state.metric
}
if state.refresh {
app_request_social_refresh(app)
}
EntityProfile.EntityFree(leaderboard_projection)
leaderboard_projection = ProfileLeaderboardEncode(*page)
return leaderboard_projection
}
#program_export
leaderboard_screen_enter :: (app: *InnerBreeze) {
if app == null { return }
app_open_profile_tab(app, PROFILE_TAB_OVERVIEW)
EntityHostOpenLeaderboard()
}
#program_export
leaderboard_screen_draw :: (app: *InnerBreeze) {
if app == null { return }
app_open_profile_tab(app, PROFILE_TAB_OVERVIEW)
EntityHostOpenLeaderboard()
}
+3
View File
@@ -447,5 +447,8 @@ node_app_screen_draw :: (app: *InnerBreeze) {
}
if clip.opened { unused End(app.ui.session) }
WidgetHostEnd()
if NodeTreeTakeProfile() {
app_open_profile_tab(app, PROFILE_TAB_OVERVIEW)
}
NodeScreenMediaPicker(app)
}
+7 -8
View File
@@ -23,9 +23,9 @@ Answer :: () -> s32 {
}
// Every app round-trips by name; unknown and repeated names drop out.
read: [LAUNCHER_APP_COUNT]s32
if LauncherOrderRoutes("diary,chess,lumi,,diary,leaderboard,lists", read[:]) != 4 ||
if LauncherOrderRoutes("diary,chess,lumi,,diary,leaderboard,lists", read[:]) != 3 ||
read[0] != APP_NAV_ROUTE_DIARY || read[1] != APP_NAV_ROUTE_LUMI ||
read[2] != APP_NAV_ROUTE_LEADERBOARD || read[3] != APP_NAV_ROUTE_ELIST {
read[2] != APP_NAV_ROUTE_ELIST {
return 22
}
if LauncherOrderRoutes("", read[:]) != 0 || LauncherOrderText(read[:], 0, order[:]) != 0 ||
@@ -37,11 +37,11 @@ Answer :: () -> s32 {
PackageSetNodeApp(0, "chess")
every := LauncherRoutes()
length = LauncherOrderText(every[:], cast(s32)every.count, order[:])
if TextView(order[:length]) != "diary,habits,lists,lumi,practices,leaderboard,chess" ||
LauncherOrderRoutes(TextView(order[:length]), read[:]) != 7 {
if TextView(order[:length]) != "diary,habits,lists,lumi,practices,chess" ||
LauncherOrderRoutes(TextView(order[:length]), read[:]) != 6 {
return 24
}
for index: cast(s32)0..6 {
for index: cast(s32)0..5 {
if read[index] != every[index] { return 25 }
}
PackageSetNodeApp(0, "")
@@ -96,9 +96,8 @@ Answer :: () -> s32 {
count = LauncherPlaceFavorite(favorites[:], count, APP_NAV_ROUTE_PRACTICE, count)
if count != LAUNCHER_APP_COUNT || favorites[count - 1] != APP_NAV_ROUTE_PRACTICE ||
favorites[0] != APP_NAV_ROUTE_DIARY { return 14 }
// Leaderboard is listed after the apps that existed before it, and the
// slots of the apps the node offers after the bundled apps.
if LauncherRoutes()[5] != APP_NAV_ROUTE_LEADERBOARD || LauncherRoutes()[6] != AppNavNodeRoute(0) ||
// Leaderboard is reached through Profile; node app slots follow the five bundled apps.
if LauncherRoutes()[5] != AppNavNodeRoute(0) ||
LauncherRoutes()[LAUNCHER_APP_COUNT - 1] != AppNavNodeRoute(7) { return 21 }
count = LauncherToggleFavorite(favorites[:], count, APP_NAV_ROUTE_HABITS)
count = LauncherPlaceFavorite(favorites[:], count, APP_NAV_ROUTE_HABITS, 1)
+2 -1
View File
@@ -782,7 +782,8 @@ with contextlib.ExitStack() as stack:
wait_setting(profile, "package_updates_allowed", 0)
driver.wait_gone(label="Don't allow", role="button")
assert not driver.find(label="More apps"), "The old section heading remains"
for label in ("Lists", "Diary", "Leaderboard"):
assert not any(card["label"] == "Leaderboard" for card in cards()[1]), "Leaderboard still has its own app card"
for label in ("Lists", "Diary"):
card = next(node for node in cards()[1] if node["label"] == label)
assert corner(card, driver.tree())["label"] == "App options", f"{label} is not preinstalled"
# Practice is the third pinned card in the same grid as the rest.
+20 -7
View File
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
"""Leaderboard opens as its own unpinned app, offers every installed practice
and ranks saved friend results."""
"""Profile owns the leaderboard, offers installed ranked boards and preserves friend results."""
import json
import os
from pathlib import Path
@@ -94,6 +93,20 @@ def choose(label):
driver.wait_idle(frames=2, timeout=2)
def open_leaderboard():
driver.press(label="Apps", role="button")
driver.wait(label="Pinned")
driver.press(focus_id=6792, role="button")
driver.wait(label="Change picture", role="button")
for _ in range(12):
if driver.find(label="Leaderboard", role="button", visible=True):
break
driver.pointer(WIDTH // 2, HEIGHT // 2, wheel=-3)
driver.wait_idle(frames=2, timeout=2)
driver.press(label="Leaderboard", role="button")
driver.wait(label="Leaderboard", role="text")
def stop(process):
if process.poll() is None:
process.terminate()
@@ -151,11 +164,9 @@ with tempfile.TemporaryDirectory(prefix="inbe-leaderboard-") as directory:
"apps_setup_done": 1, "app_used_leaderboard": 1, "main_tab": 5, "tutorial_seen": 1,
"habits_guide_seen": 1, "lumi_guides_seen": 127, "launcher_guide_seen": 1, "package_updates_allowed": 0,
"apps_last_update_check": 1900000000,
# Pinned here, so the page has no "back to Apps" bar and
# the controls keep fixed positions.
"launcher_favorite_count": 4, "launcher_favorite_0": 12,
# Profile remains a permanent control; Leaderboard has no app pin.
"launcher_favorite_count": 3, "launcher_favorite_0": 12,
"launcher_favorite_1": 1, "launcher_favorite_2": 2,
"launcher_favorite_3": LEADERBOARD_ROUTE,
# Astral Projection first in the saved Practice order.
"practice_order": 1503124}
for key, value in settings.items():
@@ -196,6 +207,7 @@ with tempfile.TemporaryDirectory(prefix="inbe-leaderboard-") as directory:
shutil.copyfile(root / "build/practice-content/taichi.zx", packages / "practice-taichi.zx")
app, window = launch(profile, "board")
try:
open_leaderboard()
# Only Wim Hof and Meditation are ranked, in Practice's order, side by side on phones.
expected = [["Wim Hof Breathing", "Meditation"]]
grid = practice_grid(expected)
@@ -227,6 +239,7 @@ with tempfile.TemporaryDirectory(prefix="inbe-leaderboard-") as directory:
shutil.copyfile(root / "build/practice-content/sunsalutation.zx", packages / "practice-sunsalutation.zx")
app, window = launch(profile, "with-sun-salutation")
try:
open_leaderboard()
expected = [["Wim Hof Breathing", "Meditation"]]
grid = practice_grid(expected)
assert grid == expected, f"after download: {grid}"
@@ -252,5 +265,5 @@ with tempfile.TemporaryDirectory(prefix="inbe-about-") as directory:
assert about.returncode == 0 and shot.exists(), stdout[-4000:] + stderr[-2000:]
assert "out of bounds" not in stdout + stderr, stdout[-4000:]
driver_directory.cleanup()
print("Leaderboard: preinstalled and unpinned, only Wim Hof and Meditation ranked, saved ranks, average hold, "
print("Leaderboard: shared Profile route, only Wim Hof and Meditation ranked, saved ranks, average hold, "
"meditation time, only ranked apps offered, a downloaded practice staying unranked and About passed")