Add more polish to Badges.

* Better network error handling
* Marking user cancellations so we don't annoy them
* Manage Profile screen treatment.
This commit is contained in:
Alex Hart
2021-10-29 14:05:22 -03:00
committed by Greyson Parrelli
parent 17517cfc88
commit 1af15842cc
19 changed files with 207 additions and 70 deletions

View File

@@ -29,6 +29,7 @@ internal class DonationsValues internal constructor(store: KeyValueStore) : Sign
private const val KEY_LAST_KEEP_ALIVE_LAUNCH = "donation.last.successful.ping"
private const val KEY_LAST_END_OF_PERIOD = "donation.last.end.of.period"
private const val EXPIRED_BADGE = "donation.expired.badge"
private const val USER_MANUALLY_CANCELLED = "donation.user.manually.cancelled"
}
override fun onFirstEverAppLaunch() = Unit
@@ -188,6 +189,18 @@ internal class DonationsValues internal constructor(store: KeyValueStore) : Sign
putLong(KEY_LAST_END_OF_PERIOD, timestamp)
}
fun isUserManuallyCancelled(): Boolean {
return getBoolean(USER_MANUALLY_CANCELLED, false)
}
fun markUserManuallyCancelled() {
putBoolean(USER_MANUALLY_CANCELLED, true)
}
fun clearUserManuallyCancelled() {
remove(USER_MANUALLY_CANCELLED)
}
private fun dispatchLevelOperation() {
levelUpdateOperationPublisher.onNext(Optional.fromNullable(getLevelOperation()))
}