use of org.whispersystems.jobqueue.JobManager in project Signal-Android by WhisperSystems.
the class PushReceivedJob method handleMessage.
private void handleMessage(SignalServiceEnvelope envelope, boolean sendExplicitReceipt) {
Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false);
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
if (!recipients.isBlocked()) {
long messageId = DatabaseFactory.getPushDatabase(context).insert(envelope);
jobManager.add(new PushDecryptJob(context, messageId, envelope.getSource()));
} else {
Log.w(TAG, "*** Received blocked push message, ignoring...");
}
if (sendExplicitReceipt) {
jobManager.add(new DeliveryReceiptJob(context, envelope.getSource(), envelope.getTimestamp(), envelope.getRelay()));
}
}
use of org.whispersystems.jobqueue.JobManager in project Signal-Android by WhisperSystems.
the class MessageSender method sendMediaPush.
private static void sendMediaPush(Context context, Recipients recipients, long messageId) {
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
jobManager.add(new PushMediaSendJob(context, messageId, recipients.getPrimaryRecipient().getNumber()));
}
use of org.whispersystems.jobqueue.JobManager in project Signal-Android by WhisperSystems.
the class MessageSender method sendTextPush.
private static void sendTextPush(Context context, Recipients recipients, long messageId) {
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
jobManager.add(new PushTextSendJob(context, messageId, recipients.getPrimaryRecipient().getNumber()));
}
use of org.whispersystems.jobqueue.JobManager in project Signal-Android by WhisperSystems.
the class SmsDeliveryListener method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
long messageId = intent.getLongExtra("message_id", -1);
switch(intent.getAction()) {
case SENT_SMS_ACTION:
int result = getResultCode();
jobManager.add(new SmsSentJob(context, messageId, SENT_SMS_ACTION, result));
break;
case DELIVERED_SMS_ACTION:
byte[] pdu = intent.getByteArrayExtra("pdu");
if (pdu == null) {
Log.w(TAG, "No PDU in delivery receipt!");
break;
}
SmsMessage message = SmsMessage.createFromPdu(pdu);
if (message == null) {
Log.w(TAG, "Delivery receipt failed to parse!");
break;
}
jobManager.add(new SmsSentJob(context, messageId, DELIVERED_SMS_ACTION, message.getStatus()));
break;
default:
Log.w(TAG, "Unknown action: " + intent.getAction());
}
}
use of org.whispersystems.jobqueue.JobManager in project Signal-Android by WhisperSystems.
the class MessageSender method sendGroupPush.
private static void sendGroupPush(Context context, Recipients recipients, long messageId, long filterRecipientId) {
JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
jobManager.add(new PushGroupSendJob(context, messageId, recipients.getPrimaryRecipient().getNumber(), filterRecipientId));
}
Aggregations