Search in sources :

Example 1 with PayeeParcelable

use of org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable in project Signal-Android by WhisperSystems.

the class PaymentParcelable method writeToParcel.

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(payment.getUuid().toString());
    dest.writeParcelable(new PayeeParcelable(payment.getPayee()), flags);
    dest.writeLong(payment.getBlockIndex());
    dest.writeLong(payment.getBlockTimestamp());
    dest.writeLong(payment.getTimestamp());
    dest.writeLong(payment.getDisplayTimestamp());
    dest.writeInt(payment.getDirection().serialize());
    dest.writeInt(payment.getState().serialize());
    if (payment.getFailureReason() == null) {
        dest.writeInt(-1);
    } else {
        dest.writeInt(payment.getFailureReason().serialize());
    }
    dest.writeString(payment.getNote());
    dest.writeString(payment.getAmount().serialize());
    dest.writeString(payment.getFee().serialize());
    dest.writeByteArray(payment.getPaymentMetaData().toByteArray());
    dest.writeByte(payment.isSeen() ? (byte) 1 : 0);
    dest.writeString(payment.getAmountWithDirection().serialize());
    dest.writeString(payment.getAmountPlusFeeWithDirection().serialize());
    dest.writeByte(payment.isDefrag() ? (byte) 1 : 0);
}
Also used : PayeeParcelable(org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable)

Example 2 with PayeeParcelable

use of org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable in project Signal-Android by WhisperSystems.

the class PaymentsTransferFragment method next.

private boolean next(@NonNull MobileCoinPublicAddress ownAddress) {
    try {
        String base58Address = address.getText().toString();
        MobileCoinPublicAddress publicAddress = MobileCoinPublicAddress.fromBase58(base58Address);
        if (ownAddress.equals(publicAddress)) {
            new AlertDialog.Builder(requireContext()).setTitle(R.string.PaymentsTransferFragment__invalid_address).setMessage(R.string.PaymentsTransferFragment__you_cant_transfer_to_your_own_signal_wallet_address).setPositiveButton(android.R.string.ok, null).show();
            return false;
        }
        NavDirections action = PaymentsTransferFragmentDirections.actionPaymentsTransferToCreatePayment(new PayeeParcelable(publicAddress)).setFinishOnConfirm(PaymentsTransferFragmentArgs.fromBundle(requireArguments()).getFinishOnConfirm());
        SafeNavigation.safeNavigate(Navigation.findNavController(requireView()), action);
        return true;
    } catch (MobileCoinPublicAddress.AddressException e) {
        Log.w(TAG, "Address is not valid", e);
        new AlertDialog.Builder(requireContext()).setTitle(R.string.PaymentsTransferFragment__invalid_address).setMessage(R.string.PaymentsTransferFragment__check_the_wallet_address).setPositiveButton(android.R.string.ok, null).show();
        return false;
    }
}
Also used : AlertDialog(android.app.AlertDialog) PayeeParcelable(org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable) MobileCoinPublicAddress(org.thoughtcrime.securesms.payments.MobileCoinPublicAddress) NavDirections(androidx.navigation.NavDirections)

Example 3 with PayeeParcelable

use of org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable in project Signal-Android by WhisperSystems.

the class AttachmentManager method selectPayment.

public static void selectPayment(@NonNull Fragment fragment, @NonNull RecipientId recipientId) {
    Intent intent = new Intent(fragment.requireContext(), PaymentsActivity.class);
    intent.putExtra(PaymentsActivity.EXTRA_PAYMENTS_STARTING_ACTION, R.id.action_directly_to_createPayment);
    intent.putExtra(PaymentsActivity.EXTRA_STARTING_ARGUMENTS, new CreatePaymentFragmentArgs.Builder(new PayeeParcelable(recipientId)).build().toBundle());
    fragment.startActivity(intent);
}
Also used : CreatePaymentFragmentArgs(org.thoughtcrime.securesms.payments.create.CreatePaymentFragmentArgs) PayeeParcelable(org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable) Intent(android.content.Intent)

Aggregations

PayeeParcelable (org.thoughtcrime.securesms.payments.preferences.model.PayeeParcelable)3 AlertDialog (android.app.AlertDialog)1 Intent (android.content.Intent)1 NavDirections (androidx.navigation.NavDirections)1 MobileCoinPublicAddress (org.thoughtcrime.securesms.payments.MobileCoinPublicAddress)1 CreatePaymentFragmentArgs (org.thoughtcrime.securesms.payments.create.CreatePaymentFragmentArgs)1