From c58c62d4bcdc3ff87713b0c33c4f79e4a4a47317 Mon Sep 17 00:00:00 2001 From: Dominik Dzienia Date: Wed, 25 Mar 2020 14:47:28 +0100 Subject: [PATCH] Tost shown when password is set now show when password is not set at end (cancel) or unset --- .../nightscout/androidaps/utils/protection/PasswordCheck.kt | 5 ++++- app/src/main/res/values/protection.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt b/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt index 02afbea43e..65f1e76e44 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt @@ -95,16 +95,19 @@ class PasswordCheck @Inject constructor(val sp: SP) { val enteredPassword = userInput.text.toString() if (enteredPassword.isNotEmpty()) { sp.putString(preference, CryptoUtil.hashPassword(enteredPassword)) + ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set)) ok?.invoke(enteredPassword) } else { if (sp.contains(preference)) { sp.remove(preference) + ToastUtils.showToastInUiThread(context, context.getString(R.string.password_cleared)) clear?.invoke() } else { + ToastUtils.showToastInUiThread(context, context.getString(R.string.password_not_changed)) cancel?.invoke() } } - ToastUtils.showToastInUiThread(context, context.getString(R.string.password_set)) + } .setNegativeButton(context.getString(R.string.cancel) ) { dialog, _ -> diff --git a/app/src/main/res/values/protection.xml b/app/src/main/res/values/protection.xml index 8b025f68cb..b044b9628e 100644 --- a/app/src/main/res/values/protection.xml +++ b/app/src/main/res/values/protection.xml @@ -18,6 +18,7 @@ Password set! Password not set Password not changed + Password cleared! Enter password here master_password