From 77287dc92a8cb2661c6f11e3ef446468ea416b8d Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 22 Sep 2021 00:41:13 -0600 Subject: [PATCH] Add setting button to reset/forget/log out of account --- www/assets/js/settings.js | 10 +++++++++- www/routes.js | 21 ++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/www/assets/js/settings.js b/www/assets/js/settings.js index 3e9eab5..8026630 100644 --- a/www/assets/js/settings.js +++ b/www/assets/js/settings.js @@ -31,4 +31,12 @@ $('.item-link[data-setting=mapsource] select').on("change", function () { $('.item-content[data-setting=hideaccountnag] .toggle input').on("change", function () { var checked = $(this).prop('checked'); setStorage("hideaccountnag", checked); -}); \ No newline at end of file +}); + +function resetAccountPrompt() { + app.dialog.confirm("Are you sure you want to log out?", function () { + removeFromStorage("phonenumber"); + removeFromStorage("accountkey"); + restartApplication(); + }); +} \ No newline at end of file diff --git a/www/routes.js b/www/routes.js index 26b3e8b..e5b9a20 100644 --- a/www/routes.js +++ b/www/routes.js @@ -133,13 +133,13 @@ var routes = [ templateUrl: './pages/dropandsend.html', on: { pageBeforeIn: function () { - checkIfAccountGoodWithPaymentMethod(function (ok) { - if (!ok) { - $("#addPaymentMethodNag").css("display", ""); - } - }, function (error) { - $("#addPaymentMethodNag").css("display", ""); - }); + checkIfAccountGoodWithPaymentMethod(function (ok) { + if (!ok) { + $("#addPaymentMethodNag").css("display", ""); + } + }, function (error) { + $("#addPaymentMethodNag").css("display", ""); + }); }, pageAfterOut: function () { dropboxMap = null; @@ -264,6 +264,13 @@ var routes = [ ); settings.push( + { + setting: "resetaccount", + title: "Forget Account", + text: "Log out and disconnect from your Helena Express account.", + onclick: "resetAccountPrompt()", + link: true + }, { setting: "versions", title: "Helena Express app v" + app_version,