mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Improve payment withdrawals.
This commit is contained in:
committed by
Alex Hart
parent
eae6a971e6
commit
427e73f7fd
@@ -30,7 +30,6 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
|
||||
companion object {
|
||||
private val TAG = Log.tag(AccountValues::class.java)
|
||||
private const val KEY_SERVICE_PASSWORD = "account.service_password"
|
||||
private const val KEY_IS_REGISTERED = "account.is_registered"
|
||||
private const val KEY_REGISTRATION_ID = "account.registration_id"
|
||||
private const val KEY_FCM_ENABLED = "account.fcm_enabled"
|
||||
private const val KEY_FCM_TOKEN = "account.fcm_token"
|
||||
@@ -61,6 +60,8 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
|
||||
const val KEY_ACI = "account.aci"
|
||||
@VisibleForTesting
|
||||
const val KEY_PNI = "account.pni"
|
||||
@VisibleForTesting
|
||||
const val KEY_IS_REGISTERED = "account.is_registered"
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms.keyvalue
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
@@ -36,7 +37,6 @@ internal class PaymentsValues internal constructor(store: KeyValueStore) : Signa
|
||||
private val TAG = Log.tag(PaymentsValues::class.java)
|
||||
|
||||
private const val PAYMENTS_ENTROPY = "payments_entropy"
|
||||
private const val MOB_PAYMENTS_ENABLED = "mob_payments_enabled"
|
||||
private const val MOB_LEDGER = "mob_ledger"
|
||||
private const val PAYMENTS_CURRENT_CURRENCY = "payments_current_currency"
|
||||
private const val DEFAULT_CURRENCY_CODE = "GBP"
|
||||
@@ -48,6 +48,9 @@ internal class PaymentsValues internal constructor(store: KeyValueStore) : Signa
|
||||
private const val SHOW_UPDATE_PIN_INFO_CARD = "mob_payments_show_update_pin_info_card"
|
||||
|
||||
private val LARGE_BALANCE_THRESHOLD = Money.mobileCoin(BigDecimal.valueOf(500))
|
||||
|
||||
@VisibleForTesting
|
||||
const val MOB_PAYMENTS_ENABLED = "mob_payments_enabled"
|
||||
}
|
||||
|
||||
private val liveCurrentCurrency: MutableLiveData<Currency> by lazy { MutableLiveData(currentCurrency()) }
|
||||
@@ -92,16 +95,20 @@ internal class PaymentsValues internal constructor(store: KeyValueStore) : Signa
|
||||
*/
|
||||
val paymentsAvailability: PaymentsAvailability
|
||||
get() {
|
||||
if (!SignalStore.account().isRegistered ||
|
||||
!GeographicalRestrictions.e164Allowed(Recipient.self().requireE164())
|
||||
) {
|
||||
if (!SignalStore.account().isRegistered) {
|
||||
return PaymentsAvailability.NOT_IN_REGION
|
||||
}
|
||||
return if (FeatureFlags.payments()) {
|
||||
if (mobileCoinPaymentsEnabled()) {
|
||||
PaymentsAvailability.WITHDRAW_AND_SEND
|
||||
} else {
|
||||
if (GeographicalRestrictions.e164Allowed(SignalStore.account().e164)) {
|
||||
PaymentsAvailability.WITHDRAW_AND_SEND
|
||||
} else {
|
||||
return PaymentsAvailability.WITHDRAW_ONLY
|
||||
}
|
||||
} else if (GeographicalRestrictions.e164Allowed(SignalStore.account().e164)) {
|
||||
PaymentsAvailability.REGISTRATION_AVAILABLE
|
||||
} else {
|
||||
PaymentsAvailability.NOT_IN_REGION
|
||||
}
|
||||
} else {
|
||||
if (mobileCoinPaymentsEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user