use of org.thoughtcrime.securesms.keyvalue.PaymentsValues in project Signal-Android by WhisperSystems.
the class Wallet method getFullLedger.
@WorkerThread
@NonNull
private MobileCoinLedgerWrapper getFullLedger(boolean retryOnAuthFailure) {
PaymentsValues paymentsValues = SignalStore.paymentsValues();
try {
MobileCoinLedgerWrapper ledger = tryGetFullLedger(null);
paymentsValues.setMobileCoinFullLedger(Objects.requireNonNull(ledger));
} catch (IOException e) {
if ((retryOnAuthFailure && e.getCause() instanceof NetworkException) && (((NetworkException) e.getCause()).statusCode == 401)) {
Log.w(TAG, "Failed to get up to date ledger, due to temp auth failure, retrying", e);
return getFullLedger(false);
} else {
Log.w(TAG, "Failed to get up to date ledger", e);
}
}
return getCachedLedger();
}
use of org.thoughtcrime.securesms.keyvalue.PaymentsValues in project Signal-Android by signalapp.
the class Wallet method getFullLedger.
@WorkerThread
@NonNull
private MobileCoinLedgerWrapper getFullLedger(boolean retryOnAuthFailure) {
PaymentsValues paymentsValues = SignalStore.paymentsValues();
try {
MobileCoinLedgerWrapper ledger = tryGetFullLedger(null);
paymentsValues.setMobileCoinFullLedger(Objects.requireNonNull(ledger));
} catch (IOException e) {
if ((retryOnAuthFailure && e.getCause() instanceof NetworkException) && (((NetworkException) e.getCause()).statusCode == 401)) {
Log.w(TAG, "Failed to get up to date ledger, due to temp auth failure, retrying", e);
return getFullLedger(false);
} else {
Log.w(TAG, "Failed to get up to date ledger", e);
}
}
return getCachedLedger();
}
use of org.thoughtcrime.securesms.keyvalue.PaymentsValues in project Signal-Android by signalapp.
the class PaymentsHomeViewModel method getPaymentsState.
private static PaymentsHomeState.PaymentsState getPaymentsState() {
PaymentsValues paymentsValues = SignalStore.paymentsValues();
PaymentsAvailability paymentsAvailability = paymentsValues.getPaymentsAvailability();
if (paymentsAvailability.canRegister()) {
return PaymentsHomeState.PaymentsState.NOT_ACTIVATED;
} else if (paymentsAvailability.isEnabled()) {
return PaymentsHomeState.PaymentsState.ACTIVATED;
} else {
return PaymentsHomeState.PaymentsState.ACTIVATE_NOT_ALLOWED;
}
}
use of org.thoughtcrime.securesms.keyvalue.PaymentsValues in project Signal-Android by WhisperSystems.
the class PaymentsHomeViewModel method getPaymentsState.
private static PaymentsHomeState.PaymentsState getPaymentsState() {
PaymentsValues paymentsValues = SignalStore.paymentsValues();
PaymentsAvailability paymentsAvailability = paymentsValues.getPaymentsAvailability();
if (paymentsAvailability.canRegister()) {
return PaymentsHomeState.PaymentsState.NOT_ACTIVATED;
} else if (paymentsAvailability.isEnabled()) {
return PaymentsHomeState.PaymentsState.ACTIVATED;
} else {
return PaymentsHomeState.PaymentsState.ACTIVATE_NOT_ALLOWED;
}
}
use of org.thoughtcrime.securesms.keyvalue.PaymentsValues in project Signal-Android by WhisperSystems.
the class InfoCard method getInfoCards.
@NonNull
public static List<InfoCard> getInfoCards() {
List<InfoCard> infoCards = new ArrayList<>(Type.values().length);
PaymentsValues paymentsValues = SignalStore.paymentsValues();
if (paymentsValues.showRecoveryPhraseInfoCard()) {
infoCards.add(new InfoCard(R.string.payment_info_card_record_recovery_phrase, R.string.payment_info_card_your_recovery_phrase_gives_you, R.string.payment_info_card_record_your_phrase, R.drawable.ic_payments_info_card_restore_80, Type.RECORD_RECOVERY_PHASE, paymentsValues::dismissRecoveryPhraseInfoCard));
}
if (paymentsValues.showUpdatePinInfoCard()) {
infoCards.add(new InfoCard(R.string.payment_info_card_update_your_pin, R.string.payment_info_card_with_a_high_balance, R.string.payment_info_card_update_pin, R.drawable.ic_payments_info_card_pin_80, Type.UPDATE_YOUR_PIN, paymentsValues::dismissUpdatePinInfoCard));
}
if (paymentsValues.showAboutMobileCoinInfoCard()) {
infoCards.add(new InfoCard(R.string.payment_info_card_about_mobilecoin, R.string.payment_info_card_mobilecoin_is_a_new_privacy_focused_digital_currency, R.string.LearnMoreTextView_learn_more, R.drawable.ic_about_mc_80, Type.ABOUT_MOBILECOIN, paymentsValues::dismissAboutMobileCoinInfoCard));
}
if (paymentsValues.showAddingToYourWalletInfoCard()) {
infoCards.add(new InfoCard(R.string.payment_info_card_adding_funds, R.string.payment_info_card_you_can_add_funds_for_use_in, R.string.LearnMoreTextView_learn_more, R.drawable.ic_add_money_80, Type.ADDING_TO_YOUR_WALLET, paymentsValues::dismissAddingToYourWalletInfoCard));
}
if (paymentsValues.showCashingOutInfoCard()) {
infoCards.add(new InfoCard(R.string.payment_info_card_cashing_out, R.string.payment_info_card_you_can_cash_out_mobilecoin, R.string.LearnMoreTextView_learn_more, R.drawable.ic_cash_out_80, Type.CASHING_OUT, paymentsValues::dismissCashingOutInfoCard));
}
return infoCards;
}
Aggregations