mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add in-chat payment activation requests.
Co-authored-by: Varsha <varsha@mobilecoin.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobs.PaymentLedgerUpdateJob;
|
||||
import org.thoughtcrime.securesms.jobs.ProfileUploadJob;
|
||||
import org.thoughtcrime.securesms.jobs.SendPaymentsActivatedJob;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.util.AsynchronousCallback;
|
||||
import org.thoughtcrime.securesms.util.ProfileUtil;
|
||||
@@ -25,7 +26,10 @@ public class PaymentsHomeRepository {
|
||||
SignalStore.paymentsValues().setMobileCoinPaymentsEnabled(true);
|
||||
try {
|
||||
ProfileUtil.uploadProfile(ApplicationDependencies.getApplication());
|
||||
ApplicationDependencies.getJobManager().add(PaymentLedgerUpdateJob.updateLedger());
|
||||
ApplicationDependencies.getJobManager()
|
||||
.startChain(PaymentLedgerUpdateJob.updateLedger())
|
||||
.then(new SendPaymentsActivatedJob())
|
||||
.enqueue();
|
||||
callback.onComplete(null);
|
||||
} catch (PaymentsRegionException e) {
|
||||
SignalStore.paymentsValues().setMobileCoinPaymentsEnabled(false);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.thoughtcrime.securesms.payments.preferences;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
/**
|
||||
@@ -19,16 +20,17 @@ public final class RecipientHasNotEnabledPaymentsDialog {
|
||||
public static void show(@NonNull Context context) {
|
||||
show(context, null);
|
||||
}
|
||||
|
||||
public static void show(@NonNull Context context, @Nullable Runnable onDismissed) {
|
||||
new AlertDialog.Builder(context).setTitle(R.string.ConfirmPaymentFragment__invalid_recipient)
|
||||
.setMessage(R.string.ConfirmPaymentFragment__this_person_has_not_activated_payments)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
if (onDismissed != null) {
|
||||
onDismissed.run();
|
||||
}
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
new MaterialAlertDialogBuilder(context).setTitle(R.string.ConfirmPaymentFragment__invalid_recipient)
|
||||
.setMessage(R.string.ConfirmPaymentFragment__this_person_has_not_activated_payments)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
if (onDismissed != null) {
|
||||
onDismissed.run();
|
||||
}
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user