Prevent repeatedly clicking create account button

This commit is contained in:
Aidan 2024-12-13 10:56:49 -08:00
parent 178d874ba0
commit f8f446933c

View File

@ -66,6 +66,7 @@ class PolycentricCreateProfileActivity : AppCompatActivity() {
val username = _profileName.text.toString(); val username = _profileName.text.toString();
if (username.length < 3) { if (username.length < 3) {
UIDialogs.toast(this@PolycentricCreateProfileActivity, getString(R.string.must_be_at_least_3_characters_long)); UIDialogs.toast(this@PolycentricCreateProfileActivity, getString(R.string.must_be_at_least_3_characters_long));
_creating = false;
return@setOnClickListener; return@setOnClickListener;
} }
@ -93,8 +94,6 @@ class PolycentricCreateProfileActivity : AppCompatActivity() {
} catch (e: Throwable) { } catch (e: Throwable) {
Logger.e(TAG, getString(R.string.failed_to_create_profile), e); Logger.e(TAG, getString(R.string.failed_to_create_profile), e);
return@launch; return@launch;
} finally {
_creating = false;
} }
try { try {
@ -111,6 +110,7 @@ class PolycentricCreateProfileActivity : AppCompatActivity() {
_buttonCreate.visibility = View.VISIBLE; _buttonCreate.visibility = View.VISIBLE;
_loader.stop(); _loader.stop();
_loader.visibility = View.GONE; _loader.visibility = View.GONE;
_creating = false;
} }
} }
@ -119,7 +119,7 @@ class PolycentricCreateProfileActivity : AppCompatActivity() {
finish(); finish();
} }
} }
} finally { } catch (e: Exception) {
_creating = false; _creating = false;
} }
}; };