Search in sources :

Example 1 with PushTextSendJob

use of org.thoughtcrime.securesms.jobs.PushTextSendJob 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()));
}
Also used : JobManager(org.whispersystems.jobqueue.JobManager) PushTextSendJob(org.thoughtcrime.securesms.jobs.PushTextSendJob)

Example 2 with PushTextSendJob

use of org.thoughtcrime.securesms.jobs.PushTextSendJob in project Signal-Android by signalapp.

the class MessageSender method sendTextPush.

private static void sendTextPush(Context context, Recipient recipient, long messageId) {
    JobManager jobManager = ApplicationContext.getInstance(context).getJobManager();
    jobManager.add(new PushTextSendJob(context, messageId, recipient.getAddress()));
}
Also used : JobManager(org.whispersystems.jobqueue.JobManager) PushTextSendJob(org.thoughtcrime.securesms.jobs.PushTextSendJob)

Example 3 with PushTextSendJob

use of org.thoughtcrime.securesms.jobs.PushTextSendJob in project Signal-Android by WhisperSystems.

the class RecipientIdJobMigrationTest method migrate_pushTextSendJob.

@Test
public void migrate_pushTextSendJob() throws Exception {
    JobData testData = new JobData("PushTextSendJob", "+16101234567", new Data.Builder().putLong("message_id", 1).build());
    mockRecipientResolve("+16101234567", 1);
    RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
    JobData converted = subject.migrate(testData);
    assertEquals("PushTextSendJob", converted.getFactoryKey());
    assertEquals(RecipientId.from(1).toQueueKey(), converted.getQueueKey());
    assertEquals(1, converted.getData().getLong("message_id"));
    new PushTextSendJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Also used : JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Data(org.thoughtcrime.securesms.jobmanager.Data) JobData(org.thoughtcrime.securesms.jobmanager.JobMigration.JobData) Application(android.app.Application) PushTextSendJob(org.thoughtcrime.securesms.jobs.PushTextSendJob) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

PushTextSendJob (org.thoughtcrime.securesms.jobs.PushTextSendJob)3 JobManager (org.whispersystems.jobqueue.JobManager)2 Application (android.app.Application)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Data (org.thoughtcrime.securesms.jobmanager.Data)1 JobData (org.thoughtcrime.securesms.jobmanager.JobMigration.JobData)1