Make it clear when socket is disconnected during a game#3167
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
LagIndicatorto render an “three-dots” loader whenlagRating == 0and adjust signal-bar coloring to support a 0–4 rating. - Refactor
GameScreenAppBar title handling into a single_GameTitlewidget 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, | ||
| ], |
| @override | ||
| Widget build(BuildContext context, WidgetRef ref) { | ||
| if (monitorSocket && ref.watch(socketPingProvider(socketUri)).rating == 0) { | ||
| return AppBarTitleText('${context.l10n.reconnecting}...'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Closes #3163