fix(engine): fix three leaderboard bugs — wrong toast type, stale name label, name not synced to server
Android Release / build-apk (push) Successful in 3m51s

- poll_opt_in_task / poll_opt_out_task: error branches now fire WarningToastEvent instead of InfoToastEvent
- Settings gains leaderboard_opted_in: bool (serde-defaulted to false); set true/false when opt-in/out tasks succeed
- handle_display_name_confirm: when already opted in and a remote provider is active, spawns an opt_in_leaderboard task to push the new name (server endpoint is an upsert)
- LeaderboardPublicNameText marker component added; update_leaderboard_public_name_label system rewrites the label each frame the panel is open, so it reflects SettingsResource immediately after the display-name modal saves

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-17 23:55:22 -07:00
parent 87aec5bdf2
commit 8f86d66ffe
2 changed files with 269 additions and 7 deletions
+7
View File
@@ -238,6 +238,12 @@ pub struct Settings {
/// field existed deserialize cleanly to `None` via `#[serde(default)]`.
#[serde(default)]
pub leaderboard_display_name: Option<String>,
/// `true` once the player has successfully opted in to the leaderboard on
/// the server. Used to decide whether a display-name change should also
/// push an update via `opt_in_leaderboard`. Older `settings.json` files
/// deserialize cleanly to `false` via `#[serde(default)]`.
#[serde(default)]
pub leaderboard_opted_in: bool,
/// When `true`, the player may drag the top card of a foundation pile back
/// onto a compatible tableau column. Enabled by default (standard Klondike
/// rules). Older `settings.json` files without this key deserialize to
@@ -387,6 +393,7 @@ impl Default for Settings {
replay_move_interval_secs: default_replay_move_interval_secs(),
last_difficulty: None,
leaderboard_display_name: None,
leaderboard_opted_in: false,
take_from_foundation: true,
analytics_enabled: false,
matomo_url: None,