use of org.thoughtcrime.securesms.jobmanager.JobManager in project Signal-Android by signalapp.
the class MediaUploadRepository method cancelUploadInternal.
private void cancelUploadInternal(@NonNull Media media) {
JobManager jobManager = ApplicationDependencies.getJobManager();
PreUploadResult result = uploadResults.get(media);
if (result != null) {
Stream.of(result.getJobIds()).forEach(jobManager::cancel);
uploadResults.remove(media);
}
}
use of org.thoughtcrime.securesms.jobmanager.JobManager in project Signal-Android by signalapp.
the class StickerManagementRepository method fetchUnretrievedReferencePacks.
void fetchUnretrievedReferencePacks() {
SignalExecutors.SERIAL.execute(() -> {
JobManager jobManager = ApplicationDependencies.getJobManager();
try (Cursor cursor = attachmentDatabase.getUnavailableStickerPacks()) {
while (cursor != null && cursor.moveToNext()) {
String packId = cursor.getString(cursor.getColumnIndexOrThrow(AttachmentDatabase.STICKER_PACK_ID));
String packKey = cursor.getString(cursor.getColumnIndexOrThrow(AttachmentDatabase.STICKER_PACK_KEY));
jobManager.add(StickerPackDownloadJob.forReference(packId, packKey));
}
}
});
}
use of org.thoughtcrime.securesms.jobmanager.JobManager in project Signal-Android by signalapp.
the class StickerManagementRepository method installStickerPack.
void installStickerPack(@NonNull String packId, @NonNull String packKey, boolean notify) {
SignalExecutors.SERIAL.execute(() -> {
JobManager jobManager = ApplicationDependencies.getJobManager();
if (stickerDatabase.isPackAvailableAsReference(packId)) {
stickerDatabase.markPackAsInstalled(packId, notify);
}
jobManager.add(StickerPackDownloadJob.forInstall(packId, packKey, notify));
if (TextSecurePreferences.isMultiDevice(context)) {
jobManager.add(new MultiDeviceStickerPackOperationJob(packId, packKey, MultiDeviceStickerPackOperationJob.Type.INSTALL));
}
});
}
use of org.thoughtcrime.securesms.jobmanager.JobManager in project Signal-Android by signalapp.
the class MessageSender method sendMms.
private static void sendMms(Context context, long messageId) {
JobManager jobManager = ApplicationDependencies.getJobManager();
MmsSendJob.enqueue(context, jobManager, messageId);
}
use of org.thoughtcrime.securesms.jobmanager.JobManager in project Signal-Android by signalapp.
the class StickerLaunchMigrationJob method installPack.
private static void installPack(@NonNull Context context, @NonNull BlessedPacks.Pack pack) {
JobManager jobManager = ApplicationDependencies.getJobManager();
StickerDatabase stickerDatabase = SignalDatabase.stickers();
if (stickerDatabase.isPackAvailableAsReference(pack.getPackId())) {
stickerDatabase.markPackAsInstalled(pack.getPackId(), false);
}
jobManager.add(StickerPackDownloadJob.forInstall(pack.getPackId(), pack.getPackKey(), false));
if (TextSecurePreferences.isMultiDevice(context)) {
jobManager.add(new MultiDeviceStickerPackOperationJob(pack.getPackId(), pack.getPackKey(), MultiDeviceStickerPackOperationJob.Type.INSTALL));
}
}
Aggregations