diff --git a/projects/gameboard-ui/src/app/api/game.service.ts b/projects/gameboard-ui/src/app/api/game.service.ts index 4f8f30aa..53731cfd 100644 --- a/projects/gameboard-ui/src/app/api/game.service.ts +++ b/projects/gameboard-ui/src/app/api/game.service.ts @@ -71,8 +71,8 @@ export class GameService { ); } - public getGamePlayState(gameId: string, teamId: string): Observable { - return this.http.get(`${this.url}/game/${gameId}/play-state/${teamId}`); + public getGamePlayState(gameId: string): Observable { + return this.http.get(`${this.url}/game/${gameId}/play-state}`); } public getSyncStartState(gameId: string): Observable { diff --git a/projects/gameboard-ui/src/app/game/components/continue-to-gameboard-button/continue-to-gameboard-button.component.ts b/projects/gameboard-ui/src/app/game/components/continue-to-gameboard-button/continue-to-gameboard-button.component.ts index 91466bc2..5703a4c3 100644 --- a/projects/gameboard-ui/src/app/game/components/continue-to-gameboard-button/continue-to-gameboard-button.component.ts +++ b/projects/gameboard-ui/src/app/game/components/continue-to-gameboard-button/continue-to-gameboard-button.component.ts @@ -27,14 +27,6 @@ export class ContinueToGameboardButtonComponent implements OnChanges { private routerService: RouterService) { } async ngOnChanges(changes: SimpleChanges): Promise { - // then we need to manually check if they've already started and redirect if so - // const gameStartPhase = await firstValueFrom(this.apiGame.getStartPhase(ctx.game.id, ctx.player.teamId)); - // this.logService.logInfo(`Game ${ctx.game.id} (player ${ctx.player.id}) is at start phase "${gameStartPhase}".`); - - // if (gameStartPhase == GameStartPhase.Started || gameStartPhase == GameStartPhase.Starting) { - // this.redirectToExternalGameLoadingPage(ctx); - // } - if (changes.context && !!this.context) { switch (this.context.gameMode) { case "vm": @@ -69,7 +61,7 @@ export class ContinueToGameboardButtonComponent implements OnChanges { .toString(); // this is only enabled if the game is started or starting - const playState = await firstValueFrom(this.gameService.getGamePlayState(context.gameId, context.player.teamId)); + const playState = await firstValueFrom(this.gameService.getGamePlayState(context.gameId)); this.isEnabled = playState == GamePlayState.Started || playState == GamePlayState.Starting; } } diff --git a/projects/gameboard-ui/src/app/game/components/external-game-link-banner/external-game-link-banner.component.ts b/projects/gameboard-ui/src/app/game/components/external-game-link-banner/external-game-link-banner.component.ts index 50337076..181bcf4e 100644 --- a/projects/gameboard-ui/src/app/game/components/external-game-link-banner/external-game-link-banner.component.ts +++ b/projects/gameboard-ui/src/app/game/components/external-game-link-banner/external-game-link-banner.component.ts @@ -32,7 +32,7 @@ export class ExternalGameLinkBannerComponent implements OnInit { this.isExternalGameReady$ = combineLatest([ this.gameService.retrieve(this.gameId), - this.gameService.getGamePlayState(this.gameId, this.teamId) + this.gameService.getGamePlayState(this.gameId) ]).pipe( map(([game, playState]) => ({ mode: game.mode, playState })), map(modeAndPlayState => modeAndPlayState.mode == GameEngineMode.External && modeAndPlayState.playState == GamePlayState.Started) diff --git a/projects/gameboard-ui/src/app/game/pages/external-game-loading-page/external-game-loading-page.component.ts b/projects/gameboard-ui/src/app/game/pages/external-game-loading-page/external-game-loading-page.component.ts index f0eac71e..c0e23e6c 100644 --- a/projects/gameboard-ui/src/app/game/pages/external-game-loading-page/external-game-loading-page.component.ts +++ b/projects/gameboard-ui/src/app/game/pages/external-game-loading-page/external-game-loading-page.component.ts @@ -95,7 +95,7 @@ export class ExternalGameLoadingPageComponent implements OnInit { this.log.logInfo("Launching game with context", ctx); // if the player already has a session for the game and it's happening right now, move them along - const playState = await firstValueFrom(this.gameApi.getGamePlayState(ctx.game.id, ctx.player.teamId)); + const playState = await firstValueFrom(this.gameApi.getGamePlayState(ctx.game.id)); if (playState == GamePlayState.Started) { this.log.logInfo("The game is already started - move them to the game page", ctx.player); this.handleGameReady(ctx); diff --git a/projects/gameboard-ui/src/app/guards/external-sync-game.guard.ts b/projects/gameboard-ui/src/app/guards/external-sync-game.guard.ts index b9ff1018..f04309e8 100644 --- a/projects/gameboard-ui/src/app/guards/external-sync-game.guard.ts +++ b/projects/gameboard-ui/src/app/guards/external-sync-game.guard.ts @@ -46,7 +46,7 @@ export class ExternalSyncGameGuard implements CanActivate, CanActivateChild { return false; } - const playState = await firstValueFrom(this.gameService.getGamePlayState(gameId, teamId)); + const playState = await firstValueFrom(this.gameService.getGamePlayState(gameId)); return playState == GamePlayState.Started; } } diff --git a/projects/gameboard-ui/src/app/guards/game-is-started.guard.ts b/projects/gameboard-ui/src/app/guards/game-is-started.guard.ts index e5877f77..9aec47ed 100644 --- a/projects/gameboard-ui/src/app/guards/game-is-started.guard.ts +++ b/projects/gameboard-ui/src/app/guards/game-is-started.guard.ts @@ -49,6 +49,6 @@ export class GameIsStarted implements CanActivate, CanActivateChild { } this.log.logInfo("Resolved gameId for GameIsStartedGuard", gameId); - return await firstValueFrom(this.gameService.getGamePlayState(resolvedGameId, player.teamId).pipe(map(phase => phase == GamePlayState.Started))); + return await firstValueFrom(this.gameService.getGamePlayState(resolvedGameId).pipe(map(phase => phase == GamePlayState.Started))); } }