From 7f596504709dddbcffd4711f8ce63abda35d269b Mon Sep 17 00:00:00 2001 From: Dosenpfand Date: Sun, 27 Apr 2025 12:44:44 +0200 Subject: [PATCH] Ask for confirmation before leaving a game --- components/home.js | 10 +++++++++- public/locales/de/common.json | 3 ++- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 3 ++- public/locales/fr/common.json | 3 ++- public/locales/ru/common.json | 3 ++- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/components/home.js b/components/home.js index 399404aa..96edff72 100644 --- a/components/home.js +++ b/components/home.js @@ -1667,6 +1667,15 @@ setShowCountryButtons(false) function backBtnPressed(queueNextGame = false, nextGameType) { + const isInGame = screen === "singleplayer" || multiplayerState?.inGame; + + if (isInGame) { + const confirmLeave = window.confirm(text("confirmLeaveGame")); + if (!confirmLeave) { + return; + } + } + setStreetViewShown(false) setOnboardingCompleted(true) @@ -2504,4 +2513,3 @@ if(window.inCrazyGames) { ) } - diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 1cb94c88..39d84f75 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -240,5 +240,6 @@ "recentChange": "Sie haben kürzlich Ihren Namen geändert. Es kann bis zu 24 Stunden dauern, bis die Änderung vollständig aktualisiert ist.", "nameChangeInProgress": "Ihre Namensänderung zu {{name}} ist in Bearbeitung. Es kann bis zu 24 Stunden dauern, bis sie vollständig aktualisiert ist.", "nameChangeCooldown": "Sie können Ihren Namen in {{days}} Tagen erneut ändern", - "disableTimer": "Timer deaktivieren" + "disableTimer": "Timer deaktivieren", + "confirmLeaveGame": "Bist du sicher, dass du das Spiel verlassen möchtest?" } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index c78b1c63..4bba458e 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -242,5 +242,6 @@ "recentChange": "You have a recent name change. It can take up to 24 hours for it to fully update.", "nameChangeInProgress": "Your name change to {{name}} is in progress, it can take up to 24 hours to fully update.", "nameChangeCooldown": "You can change your name again in {{days}} days", - "disableTimer": "Disable Timer" + "disableTimer": "Disable Timer", + "confirmLeaveGame": "Are you sure you want to leave the game?" } diff --git a/public/locales/es/common.json b/public/locales/es/common.json index f378b8da..3336c17a 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -239,5 +239,6 @@ "recentChange": "Ha realizado un cambio de nombre reciente. Puede tardar hasta 24 horas en actualizarse completamente.", "nameChangeInProgress": "Su cambio de nombre a {{name}} está en proceso, puede tardar hasta 24 horas en actualizarse completamente.", "nameChangeCooldown": "Puede cambiar su nombre nuevamente en {{days}} días", - "disableTimer": "Deshabilitar temporizador" + "disableTimer": "Deshabilitar temporizador", + "confirmLeaveGame": "¿Estás seguro de que quieres salir del juego?" } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 23fe59c1..2ce9787a 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -238,5 +238,6 @@ "recentChange": "Vous avez récemment changé de nom. Cela peut prendre jusqu'à 24 heures pour être complètement mis à jour.", "nameChangeInProgress": "Votre changement de nom en {{name}} est en cours, cela peut prendre jusqu'à 24 heures pour être complètement mis à jour.", "nameChangeCooldown": "Vous pourrez changer votre nom à nouveau dans {{days}} jours", - "disableTimer": "Désactiver le chronomètre" + "disableTimer": "Désactiver le chronomètre", + "confirmLeaveGame": "Êtes-vous sûr de vouloir quitter le jeu ?" } diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index ece2b591..d71a6dd6 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -238,5 +238,6 @@ "recentChange": "Вы недавно изменили имя. Обновление может занять до 24 часов.", "nameChangeInProgress": "Ваше имя изменяется на {{name}}, это может занять до 24 часов.", "nameChangeCooldown": "Вы сможете изменить имя снова через {{days}} дней", - "disableTimer": "Отключить таймер" + "disableTimer": "Отключить таймер", + "confirmLeaveGame": "Вы уверены, что хотите покинуть игру?" }