From ad229460ef940d85c7df43e49fb0a3255e7b5d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Cardinale?= Date: Wed, 4 May 2022 14:22:20 +0200 Subject: [PATCH] Show or not the Powered by image (#2163) * Show or not the Powered by image * Fix prettier issues * Fix prettier issues messages --- back/src/Model/GameRoom.ts | 1 + front/src/Components/Login/LoginScene.svelte | 2 +- front/src/Connexion/Room.ts | 6 ++++++ front/src/Phaser/Components/Loader.ts | 2 +- messages/JsonMessages/MapDetailsData.ts | 1 + pusher/src/Services/LocalAdmin.ts | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index efe7f86a..33d12ae6 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -561,6 +561,7 @@ export class GameRoom { mapUrl, authenticationMandatory: null, group: null, + showPoweredBy: true, }; } diff --git a/front/src/Components/Login/LoginScene.svelte b/front/src/Components/Login/LoginScene.svelte index d3d8a1b0..edc45ce2 100644 --- a/front/src/Components/Login/LoginScene.svelte +++ b/front/src/Components/Login/LoginScene.svelte @@ -63,7 +63,7 @@
- {#if logo !== logoImg} + {#if logo !== logoImg && gameManager.currentStartedRoom.showPoweredBy !== false}
Powered by WorkAdventure
diff --git a/front/src/Connexion/Room.ts b/front/src/Connexion/Room.ts index 4e896572..ef036e09 100644 --- a/front/src/Connexion/Room.ts +++ b/front/src/Connexion/Room.ts @@ -25,6 +25,7 @@ export class Room { private _canReport: boolean = false; private _loadingLogo: string | undefined; private _loginSceneLogo: string | undefined; + private _showPoweredBy: boolean | undefined = true; private constructor(private roomUrl: URL) { this.id = roomUrl.pathname; @@ -120,6 +121,7 @@ export class Room { this._canReport = data.canReport ?? false; this._loadingLogo = data.loadingLogo ?? undefined; this._loginSceneLogo = data.loginSceneLogo ?? undefined; + this._showPoweredBy = data.showPoweredBy ?? true; return new MapDetail(data.mapUrl); } else { console.log(data); @@ -213,4 +215,8 @@ export class Room { get loginSceneLogo(): string | undefined { return this._loginSceneLogo; } + + get showPoweredBy(): boolean | undefined { + return this._showPoweredBy; + } } diff --git a/front/src/Phaser/Components/Loader.ts b/front/src/Phaser/Components/Loader.ts index 9e8751d7..e84349fb 100644 --- a/front/src/Phaser/Components/Loader.ts +++ b/front/src/Phaser/Components/Loader.ts @@ -54,7 +54,7 @@ export class Loader { .catch((e) => console.warn("Could not load logo: ", logoResource, e)); let poweredByLogoPromise: CancelablePromise | undefined; - if (gameManager.currentStartedRoom.loadingLogo) { + if (gameManager.currentStartedRoom.loadingLogo && gameManager.currentStartedRoom.showPoweredBy !== false) { poweredByLogoPromise = this.superLoad.image( "poweredByLogo", "static/images/Powered_By_WorkAdventure_Small.png" diff --git a/messages/JsonMessages/MapDetailsData.ts b/messages/JsonMessages/MapDetailsData.ts index 79407fdf..22a9bb15 100644 --- a/messages/JsonMessages/MapDetailsData.ts +++ b/messages/JsonMessages/MapDetailsData.ts @@ -20,6 +20,7 @@ export const isMapDetailsData = z.object({ loadingLogo: z.optional(z.nullable(z.string())), // The URL of the logo image on "LoginScene" loginSceneLogo: z.optional(z.nullable(z.string())), + showPoweredBy: z.boolean(), }); export type MapDetailsData = z.infer; diff --git a/pusher/src/Services/LocalAdmin.ts b/pusher/src/Services/LocalAdmin.ts index 8470efb9..b20d3f07 100644 --- a/pusher/src/Services/LocalAdmin.ts +++ b/pusher/src/Services/LocalAdmin.ts @@ -49,6 +49,7 @@ class LocalAdmin implements AdminInterface { iframeAuthentication: null, loadingLogo: null, loginSceneLogo: null, + showPoweredBy: true, }); }