Search in sources :

Example 1 with PushDecryptMessageJob

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

the class LegacyMigrationJob method scheduleMessagesInPushDatabase.

private static void scheduleMessagesInPushDatabase(@NonNull Context context) {
    PushDatabase pushDatabase = SignalDatabase.push();
    JobManager jobManager = ApplicationDependencies.getJobManager();
    try (PushDatabase.Reader pushReader = pushDatabase.readerFor(pushDatabase.getPending())) {
        SignalServiceEnvelope envelope;
        while ((envelope = pushReader.getNext()) != null) {
            jobManager.add(new PushDecryptMessageJob(context, envelope));
        }
    }
}
Also used : PushDatabase(org.thoughtcrime.securesms.database.PushDatabase) PushDecryptMessageJob(org.thoughtcrime.securesms.jobs.PushDecryptMessageJob) SignalServiceEnvelope(org.whispersystems.signalservice.api.messages.SignalServiceEnvelope) JobManager(org.thoughtcrime.securesms.jobmanager.JobManager)

Example 2 with PushDecryptMessageJob

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

the class LegacyMigrationJob method scheduleMessagesInPushDatabase.

private static void scheduleMessagesInPushDatabase(@NonNull Context context) {
    PushDatabase pushDatabase = SignalDatabase.push();
    JobManager jobManager = ApplicationDependencies.getJobManager();
    try (PushDatabase.Reader pushReader = pushDatabase.readerFor(pushDatabase.getPending())) {
        SignalServiceEnvelope envelope;
        while ((envelope = pushReader.getNext()) != null) {
            jobManager.add(new PushDecryptMessageJob(context, envelope));
        }
    }
}
Also used : PushDatabase(org.thoughtcrime.securesms.database.PushDatabase) PushDecryptMessageJob(org.thoughtcrime.securesms.jobs.PushDecryptMessageJob) SignalServiceEnvelope(org.whispersystems.signalservice.api.messages.SignalServiceEnvelope) JobManager(org.thoughtcrime.securesms.jobmanager.JobManager)

Aggregations

PushDatabase (org.thoughtcrime.securesms.database.PushDatabase)2 JobManager (org.thoughtcrime.securesms.jobmanager.JobManager)2 PushDecryptMessageJob (org.thoughtcrime.securesms.jobs.PushDecryptMessageJob)2 SignalServiceEnvelope (org.whispersystems.signalservice.api.messages.SignalServiceEnvelope)2