From 3b97f903c666fe4b609739b5b9864c8ca76cba5e Mon Sep 17 00:00:00 2001 From: Hafiz Date: Thu, 28 Apr 2022 02:39:28 -0400 Subject: [PATCH] Update account delete to type 'DELETE' vs pw, updated description --- Habitica/res/values/strings.xml | 3 ++- .../preferences/HabiticaAccountDialog.kt | 21 +++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index 441e5ad2b..6f5505cf5 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -590,8 +590,9 @@ Are you sure you want to reset? Confirm reset You will lose all your levels, Gold, and Experience. All your tasks and their historical data will be deleted (Challenge tasks will stay). You will lose all equipment, including limited edition or subscriber equipment, but you will be able to buy it back (you will need to be the correct class to re-buy class-specific gear). You will keep your current class and your Pets and Mounts. To confirm reset, type RESET below. + DELETE Delete Account - This will delete your account forever and it can never be restored! Banked or spent Gems will not be refunded. If you’re absolutely certain, type your password into the text box below. + This will delete your account forever and it can never be restored! Banked or spent Gems will not be refunded. If you’re absolutely certain, type DELETE into the text box below. Deleted accounts are permanent and cannot be restored. Gems cannot be refunded. If you still want to delete, type DELETE below. Reset my Account Delete my Account diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/preferences/HabiticaAccountDialog.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/preferences/HabiticaAccountDialog.kt index b6eff656d..200536602 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/preferences/HabiticaAccountDialog.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/preferences/HabiticaAccountDialog.kt @@ -88,14 +88,12 @@ class HabiticaAccountDialog(private var thisContext: Context, private val accoun } override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { - if (confirmationText?.length() != null) { - if (confirmationText?.length()!! > 7) { - confirmationAction?.setTextColor(ContextCompat.getColor(thisContext, R.color.red_100)) - confirmationAction?.alpha = 1.0f - } else { - confirmationAction?.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10)) - confirmationAction?.alpha = .4f - } + if (confirmationText?.text.toString() == context?.getString(R.string.delete_caps)) { + confirmationAction?.setTextColor(ContextCompat.getColor(thisContext, R.color.red_100)) + confirmationAction?.alpha = 1.0f + } else { + confirmationAction?.setTextColor(ContextCompat.getColor(thisContext, R.color.gray_10)) + confirmationAction?.alpha = .4f } } @@ -103,10 +101,8 @@ class HabiticaAccountDialog(private var thisContext: Context, private val accoun } }) confirmationAction?.setOnClickListener { - if (confirmationText?.length() != null) { - if (confirmationText?.length()!! > 7) { - accountUpdateConfirmed.deletionConfirmClicked(confirmationText?.text.toString()) - } + if (confirmationText?.text.toString() == context?.getString(R.string.delete_caps)) { + accountUpdateConfirmed.resetConfirmedClicked() } } } @@ -127,7 +123,6 @@ class HabiticaAccountDialog(private var thisContext: Context, private val accoun interface AccountUpdateConfirmed { - //API currently does not take password to reset account fun resetConfirmedClicked() fun deletionConfirmClicked(confirmationString: String) }