Skip to content

64 make a seperate screen for joining a lobby using a code #65

Merged

Conversation

raavocat
Copy link
Member

No description provided.

jonasew and others added 30 commits March 16, 2026 13:42
benjamls and others added 28 commits March 24, 2026 17:44
#52, #53)

- Track all Firebase listeners via cleanup runnables in AndroidFirebase
- Add removeAllListeners() to FirebaseAPI interface
- Add stop() to GameNetworkHandler, called from GameScreen hide/dispose
- Fix confirmSetup: propagate errors to onError callback instead of
  silently calling onSuccess on failure paths
- Update SetupFlowController to pass error callback to confirmSetup
- Add CircuitBreaker class in new network package with three states:
  CLOSED (requests pass), OPEN (requests blocked), HALF_OPEN (one probe)
- Trips after 3 consecutive heartbeat failures, 10s cooldown before probe
- Integrate into GameNetworkHandler: gates saveMove and sendHeartbeat
- Connection UI reflects breaker state (Disconnected/Reconnecting/latency)
Route all database calls through state classes instead of calling
DatabaseManager directly from screen helpers.

- LobbyState: add validateLobby, listenForOpponentReady, startGame,
  listenForGameStart wrapper methods
- SetupState: add confirmSetup, unconfirmSetup, listenForBothSetupReady,
  getOpponentBoard, getFirebaseApi wrapper methods
- LobbyValidator: route through LobbyState instead of DatabaseManager
- LobbyFlowController: route through LobbyState
- SetupFlowController: route through SetupState
- GameNetworkHandler: accept FirebaseAPI via constructor injection
- Thread LobbyState through MainMenuScreen→MainMenuUI→JoinGamePanel
- Thread FirebaseAPI through SetupScreen→GameScreen→GameNetworkHandler

Result: zero DatabaseManager references in screens/ package
refactor: enforce GUI→Logic→Database layer separation
fix: add listener lifecycle management and confirmSetup error handling
feat: implement circuit breaker with closed/open/half-open states
The game now allows you to reconnect to a game, but if it takes more than 10 seconds the game is auto forfeited.
Both players latency is now displayed
…lobby-and-setup

Add heartbeat/circuitbreak to lobby and setup
@raavocat raavocat linked an issue Apr 13, 2026 that may be closed by this pull request
@raavocat raavocat merged commit de6bd32 into main Apr 13, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a seperate screen for joining a lobby using a code
3 participants