Browse Source

提交人:江天明
提交内容:优化

江天明 11 months ago
parent
commit
2d7e51efbc

+ 29 - 15
BusinessAuth/src/main/java/com/develop/auth/ui/MemberProfileFragment.kt

@@ -25,6 +25,7 @@ import com.develop.food.base.ui.ViewBindingFragment
 import com.develop.food.base.utils.MmkvUtils
 import com.develop.food.base.utils.dimenRes
 import com.develop.food.base.utils.setVisible
+import com.develop.food.base.widgets.CancelConfirmDialog
 import org.greenrobot.eventbus.EventBus
 
 class MemberProfileFragment : ViewBindingFragment<FragmentMemberProfileBinding>() {
@@ -103,22 +104,35 @@ class MemberProfileFragment : ViewBindingFragment<FragmentMemberProfileBinding>(
             }
 
         }
-        binding.tvDestroyAccount.setOnClickListener {
-            viewModel.cancelAccount().observe(viewLifecycleOwner) {
-                EventBus.getDefault().post(FinishAtyEvent())
-                FoodDataProvider.getUserDatabase().userInfoDao()
-                    .deleteUserInfoByUserId(CURRENT_USER_ID)
-                val saveToken: String? = null
-                MmkvUtils.save(API_TOKEN, saveToken)
-                MmkvUtils.save(LOGIN_TAG, false)
-                MmkvUtils.save(CURRENT_USER_ID_TAG, 0)
-                MmkvUtils.save(RECORD_ACCOUNT, "")
-                MmkvUtils.save(RECORD_PASSWORD, "")
-                FoodDataProvider.getUserDatabase().userInfoDao().deleteAllUserInfo()
-                parentFragmentManager.beginTransaction()
-                    .replace(R.id.fl_container, MemberLoginFragment()).commitAllowingStateLoss()
-            }
 
+        val commonDialog = CancelConfirmDialog()
+        commonDialog.title = getString(R.string.delete_account_ask)
+        commonDialog.onDialogClickListener =
+            object : CancelConfirmDialog.OnDialogClickListener {
+                override fun onConfirm() {
+                    viewModel.cancelAccount().observe(viewLifecycleOwner) {
+                        EventBus.getDefault().post(FinishAtyEvent())
+                        FoodDataProvider.getUserDatabase().userInfoDao()
+                            .deleteUserInfoByUserId(CURRENT_USER_ID)
+                        val saveToken: String? = null
+                        MmkvUtils.save(API_TOKEN, saveToken)
+                        MmkvUtils.save(LOGIN_TAG, false)
+                        MmkvUtils.save(CURRENT_USER_ID_TAG, 0)
+                        MmkvUtils.save(RECORD_ACCOUNT, "")
+                        MmkvUtils.save(RECORD_PASSWORD, "")
+                        FoodDataProvider.getUserDatabase().userInfoDao().deleteAllUserInfo()
+                        parentFragmentManager.beginTransaction()
+                            .replace(R.id.fl_container, MemberLoginFragment()).commitAllowingStateLoss()
+                    }
+
+                }
+
+                override fun onCancel() {
+
+                }
+            }
+        binding.tvDestroyAccount.setOnClickListener {
+                commonDialog.showDialog(childFragmentManager,"deleteCommonDialog")
         }
         userInfoLiveData.observe(viewLifecycleOwner) {
             it?.apply {

+ 1 - 0
libBase/src/main/res/values-bg/strings.xml

@@ -247,4 +247,5 @@
     <string name="captcha_can_not_be_empty">Въведете код</string>
     <string name="please_fill_in_the_password">Въведете парола</string>
     <string name="reset_password_success">Парола беше сменена</string>
+    <string name="delete_account_ask">Сигурни ли сте, че искате да изтриете регистрацията?</string>
 </resources>

+ 1 - 0
libBase/src/main/res/values-de/strings.xml

@@ -249,5 +249,6 @@
     <string name="please_fill_in_the_password">Sie müssen das Passwort eingeben</string>
     <string name="reset_password_success">Dein Passwort wurde geändert</string>
     <string name="apk_version_latest">Die App-Version ist bereits auf dem neuesten Stand.</string>
+    <string name="delete_account_ask">Soll der Account wirklich gelöscht werden?</string>
 </resources>
 

+ 1 - 0
libBase/src/main/res/values-es/strings.xml

@@ -248,5 +248,6 @@
     <string name="captcha_can_not_be_empty">Introduzca el código</string>
     <string name="please_fill_in_the_password">Debe introducir la contraseña</string>
     <string name="reset_password_success">La contraseña se ha cambiado</string>
+    <string name="delete_account_ask">¿Seguro que quieres eliminar la cuenta?</string>
 </resources>
 

+ 1 - 0
libBase/src/main/res/values-hu/strings.xml

@@ -247,4 +247,5 @@
     <string name="captcha_can_not_be_empty">Adja meg a kódot</string>
     <string name="please_fill_in_the_password">Meg kell adnia a jelszót</string>
     <string name="reset_password_success">A jelszava módosult</string>
+    <string name="delete_account_ask">Biztos benne, hogy törölni szeretné a(z)fiókot?</string>
 </resources>

+ 1 - 0
libBase/src/main/res/values-kz/strings.xml

@@ -248,5 +248,6 @@
     <string name="captcha_can_not_be_empty">Кодты енгізіңіз</string>
     <string name="please_fill_in_the_password">Құпиясөз қажет</string>
     <string name="reset_password_success">Құпиясөзіңіз өзгертілді</string>
+    <string name="delete_account_ask">Тіркелгіден бас тартқыңыз келетініне сенімдісіз бе?</string>
 </resources>
 

+ 1 - 0
libBase/src/main/res/values-pl/strings.xml

@@ -248,4 +248,5 @@
     <string name="captcha_can_not_be_empty">Wprowadź kod</string>
     <string name="please_fill_in_the_password">Należy wprowadzić hasło</string>
     <string name="reset_password_success">Hasło zostało zmienione</string>
+    <string name="delete_account_ask">Czy na pewno chcesz usunąć konto?</string>
 </resources>

+ 1 - 0
libBase/src/main/res/values-ro/strings.xml

@@ -248,5 +248,6 @@
     <string name="captcha_can_not_be_empty">Introduceți codul</string>
     <string name="please_fill_in_the_password">Trebuie să introduceți parola</string>
     <string name="reset_password_success">Parola dvs. a fost schimbată</string>
+    <string name="delete_account_ask">Sigur doriți să ștergeți contul?</string>
 </resources>
 

+ 1 - 0
libBase/src/main/res/values-ru/strings.xml

@@ -247,4 +247,5 @@
     <string name="captcha_can_not_be_empty">Введите код</string>
     <string name="please_fill_in_the_password">Необходимо ввести пароль</string>
     <string name="reset_password_success">Пароль был изменен</string>
+    <string name="delete_account_ask">Вы действительно хотите удалить профиль?</string>
 </resources>

+ 1 - 0
libBase/src/main/res/values-sk/strings.xml

@@ -248,6 +248,7 @@
     <string name="captcha_can_not_be_empty">Zadajte kód</string>
     <string name="please_fill_in_the_password">Musíte zadať heslo</string>
     <string name="reset_password_success">Vaše heslo bolo zmenené</string>
+    <string name="delete_account_ask">Naozaj chcete vymazať účet?</string>
 </resources>
 
 

+ 1 - 0
libBase/src/main/res/values-uk/strings.xml

@@ -248,5 +248,6 @@
     <string name="captcha_can_not_be_empty">Введіть код</string>
     <string name="please_fill_in_the_password">Потрібно ввести пароль</string>
     <string name="reset_password_success">Ваш пароль змінено</string>
+    <string name="delete_account_ask">Справді видалити обліковий запис?</string>
 </resources>
 

+ 2 - 0
libBase/src/main/res/values/strings.xml

@@ -255,4 +255,6 @@ Nanfang plus client is an online information platform developed and operated by
     <string name="tuya">TUYA</string>
     <string name="cancel_tuya_bind">Cancel Bind</string>
     <string name="apk_version_latest">The app version is already up to date.</string>
+
+    <string name="delete_account_ask">Are you sure you want to delete the account?</string>
 </resources>