v2.0 #1

Merged
partisan merged 19 commits from work into main 2025-05-27 16:59:43 +00:00
2 changed files with 16 additions and 6 deletions
Showing only changes of commit b2b839cf72 - Show all commits

View file

@ -66,12 +66,19 @@ class DonateFragment : Fragment() {
Toast.makeText(context, getString(R.string.donate_token_copied), Toast.LENGTH_SHORT).show() Toast.makeText(context, getString(R.string.donate_token_copied), Toast.LENGTH_SHORT).show()
} }
// Show token entry section // If already donated, update UI to show activation message and hide token entry controls
binding.openTokenSection.setOnClickListener { if (prefs.isDonationActivated) {
binding.tokenSection.visibility = View.VISIBLE binding.postDonatePrompt.text = getString(R.string.donate_token_activated)
binding.openTokenSection.visibility = View.GONE binding.openTokenSection.visibility = View.GONE
binding.tokenSection.visibility = View.GONE
} else {
// Show token entry section button if not activated
binding.openTokenSection.setOnClickListener {
binding.tokenSection.visibility = View.VISIBLE
binding.openTokenSection.visibility = View.GONE
}
} }
binding.verifyButton.setOnClickListener { binding.verifyButton.setOnClickListener {
var token = binding.tokenInput.text.toString().trim() var token = binding.tokenInput.text.toString().trim()
@ -173,8 +180,10 @@ class DonateFragment : Fragment() {
if (activateResult == "success") { if (activateResult == "success") {
prefs.isDonationActivated = true prefs.isDonationActivated = true
activity?.runOnUiThread { activity?.runOnUiThread {
val remaining = (result?.toIntOrNull() ?: 1) - 1
binding.resultText.text = binding.resultText.text =
getString(R.string.donate_token_activated, result) getString(R.string.donate_token_activated) + "\n" +
getString(R.string.donate_token_left, remaining.toString())
} }
} else { } else {
activity?.runOnUiThread { activity?.runOnUiThread {

View file

@ -64,7 +64,8 @@
<string name="donate_token_check_failed">❌ Could not check token</string> <string name="donate_token_check_failed">❌ Could not check token</string>
<string name="donate_token_invalid">❌ Invalid or expired token</string> <string name="donate_token_invalid">❌ Invalid or expired token</string>
<string name="donate_activation_failed">❌ Activation failed</string> <string name="donate_activation_failed">❌ Activation failed</string>
<string name="donate_token_activated">✅ Token activated! You had %1$s activations left.</string> <string name="donate_token_activated">✅ Token activated!</string>
<string name="donate_token_left">You have %1$s activations left.</string>
<string name="donate_token_already_activated">✅ Already activated</string> <string name="donate_token_already_activated">✅ Already activated</string>
<string name="donate_toast_reminder">Make sure to include your token in the donation message to get rewarded 😊</string> <string name="donate_toast_reminder">Make sure to include your token in the donation message to get rewarded 😊</string>
</resources> </resources>