From 0a42aa191328e8ff3e2c5f29efbf96239514ddfa Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:19:56 +0100 Subject: [PATCH 1/3] Add logout to exit menu --- src/components/apphost.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/apphost.js b/src/components/apphost.js index 053b8463746..6afe6dc8f37 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -308,12 +308,17 @@ function askForExit() { exitPromise = actionsheet.show({ title: globalize.translate('MessageConfirmAppExit'), items: [ + { id: 'logout', name: globalize.translate('ButtonSignOut') }, { id: 'yes', name: globalize.translate('Yes') }, { id: 'no', name: globalize.translate('No') } ] }).then(function (value) { if (value === 'yes') { doExit(); + } else if (value === 'logout') { + import('../scripts/clientUtils').then((clientUtils) => { + Dashboard.logout(); + }); } }).finally(function () { exitPromise = null; From 4388e5e29a00775e8ef6b53ff706b425bc53e005 Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Sat, 9 Mar 2024 16:48:17 +0100 Subject: [PATCH 2/3] Only show logout option if user is logged in --- src/components/apphost.js | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 6afe6dc8f37..7fe6c356655 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -304,24 +304,26 @@ function askForExit() { return; } - import('../components/actionSheet/actionSheet').then((actionsheet) => { - exitPromise = actionsheet.show({ - title: globalize.translate('MessageConfirmAppExit'), - items: [ - { id: 'logout', name: globalize.translate('ButtonSignOut') }, - { id: 'yes', name: globalize.translate('Yes') }, - { id: 'no', name: globalize.translate('No') } - ] - }).then(function (value) { - if (value === 'yes') { - doExit(); - } else if (value === 'logout') { - import('../scripts/clientUtils').then((clientUtils) => { + import('../scripts/clientUtils').then(() => { + import('../components/actionSheet/actionSheet').then((actionsheet) => { + const userId = Dashboard.getCurrentUserId(); + const logoutEntry = userId ? [{ id: 'logout', name: globalize.translate('ButtonSignOut') }] : []; + exitPromise = actionsheet.show({ + title: globalize.translate('MessageConfirmAppExit'), + items: [ + ...logoutEntry, + { id: 'yes', name: globalize.translate('Yes') }, + { id: 'no', name: globalize.translate('No') } + ] + }).then(function (value) { + if (value === 'yes') { + doExit(); + } else if (value === 'logout') { Dashboard.logout(); - }); - } - }).finally(function () { - exitPromise = null; + } + }).finally(function () { + exitPromise = null; + }); }); }); } From 5f137b174df52c8542c6f493d642a8b22b98c75c Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Mon, 11 Mar 2024 13:48:54 +0100 Subject: [PATCH 3/3] Fix dashboard import --- src/components/apphost.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/apphost.js b/src/components/apphost.js index 7fe6c356655..5695f5cd7cf 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -304,7 +304,7 @@ function askForExit() { return; } - import('../scripts/clientUtils').then(() => { + import('../utils/dashboard').then(() => { import('../components/actionSheet/actionSheet').then((actionsheet) => { const userId = Dashboard.getCurrentUserId(); const logoutEntry = userId ? [{ id: 'logout', name: globalize.translate('ButtonSignOut') }] : [];