Skip to content

Make it clear when socket is disconnected during a game#3167

Merged
veloce merged 5 commits into
mainfrom
more_visible_disconnection
May 12, 2026
Merged

Make it clear when socket is disconnected during a game#3167
veloce merged 5 commits into
mainfrom
more_visible_disconnection

Conversation

@veloce
Copy link
Copy Markdown
Contributor

@veloce veloce commented May 12, 2026

Show a "three-dots" animating loader over the signal bars, and change the title to "Reconnecting...".

Also make sure the player wifi icon is off when socket is disconnected.

Screenshot_1778585073

Closes #3163

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves in-game connectivity feedback by treating a missing socket ping response as a “disconnected/reconnecting” state and reflecting that state in the AppBar title, ping indicator, and player connection icon.

Changes:

  • Update LagIndicator to render an “three-dots” loader when lagRating == 0 and adjust signal-bar coloring to support a 0–4 rating.
  • Refactor GameScreen AppBar title handling into a single _GameTitle widget that can switch to a “Reconnecting…” title when monitoring socket ping.
  • Ensure the player “connected” (wifi) icon is turned off when the socket ping rating indicates a disconnected state; add widget tests for the new behaviors.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/src/widgets/feedback.dart Adds lag rating level 0 handling and overlays a loader on the signal bars when disconnected.
lib/src/view/game/game_screen.dart Refactors AppBar title widgets and introduces a “Reconnecting…” title when socket ping rating is 0.
lib/src/view/game/game_player.dart Forces the player connection icon off when the active game socket is effectively disconnected.
lib/src/view/game/game_body.dart Passes the game socket URI down to GamePlayer for per-game ping monitoring.
test/widgets/feedback_test.dart Adds coverage for LagIndicator loading overlay and sizing/assertion behavior.
test/view/game/game_screen_test.dart Adds coverage for the “Reconnecting…” AppBar title behavior and registers additional mocktail fallback values.
CLAUDE.md Documents an analyzer pitfall around const usage inside non-const records/expressions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +146 to 150
inactiveColor: inactiveColor,
levels: materialLevels,
),
if (lagRating == 0) threeBounceLoadingIndicator,
],
Comment thread lib/src/view/game/game_screen.dart Outdated
@override
Widget build(BuildContext context, WidgetRef ref) {
if (monitorSocket && ref.watch(socketPingProvider(socketUri)).rating == 0) {
return AppBarTitleText('${context.l10n.reconnecting}...');
@veloce veloce merged commit 4cf47fc into main May 12, 2026
1 check passed
@veloce veloce deleted the more_visible_disconnection branch May 12, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it more obvious than the websocket is disconnected during a game

2 participants