mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
96 lines
6.6 KiB
Java
96 lines
6.6 KiB
Java
package org.thoughtcrime.securesms.jobs;
|
|
|
|
import android.app.Application;
|
|
import android.support.annotation.NonNull;
|
|
|
|
import org.thoughtcrime.securesms.jobmanager.Constraint;
|
|
import org.thoughtcrime.securesms.jobmanager.ConstraintObserver;
|
|
import org.thoughtcrime.securesms.jobmanager.Job;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.CellServiceConstraint;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.CellServiceConstraintObserver;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraintObserver;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.NetworkOrCellServiceConstraint;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraint;
|
|
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver;
|
|
import org.thoughtcrime.securesms.loki.protocol.ClosedGroupUpdateMessageSendJob;
|
|
import org.thoughtcrime.securesms.loki.protocol.shelved.MultiDeviceOpenGroupUpdateJob;
|
|
import org.thoughtcrime.securesms.loki.protocol.NullMessageSendJob;
|
|
import org.thoughtcrime.securesms.loki.protocol.SessionRequestMessageSendJob;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public final class JobManagerFactories {
|
|
|
|
public static Map<String, Job.Factory> getJobFactories(@NonNull Application application) {
|
|
return new HashMap<String, Job.Factory>() {{
|
|
put(AttachmentDownloadJob.KEY, new AttachmentDownloadJob.Factory());
|
|
put(AttachmentUploadJob.KEY, new AttachmentUploadJob.Factory());
|
|
put(AvatarDownloadJob.KEY, new AvatarDownloadJob.Factory());
|
|
put(CleanPreKeysJob.KEY, new CleanPreKeysJob.Factory());
|
|
put(CreateSignedPreKeyJob.KEY, new CreateSignedPreKeyJob.Factory());
|
|
put(LocalBackupJob.KEY, new LocalBackupJob.Factory());
|
|
put(MmsDownloadJob.KEY, new MmsDownloadJob.Factory());
|
|
put(MmsReceiveJob.KEY, new MmsReceiveJob.Factory());
|
|
put(MmsSendJob.KEY, new MmsSendJob.Factory());
|
|
put(MultiDeviceBlockedUpdateJob.KEY, new MultiDeviceBlockedUpdateJob.Factory());
|
|
put(MultiDeviceConfigurationUpdateJob.KEY, new MultiDeviceConfigurationUpdateJob.Factory());
|
|
put(MultiDeviceContactUpdateJob.KEY, new MultiDeviceContactUpdateJob.Factory());
|
|
put(MultiDeviceGroupUpdateJob.KEY, new MultiDeviceGroupUpdateJob.Factory());
|
|
put(MultiDeviceProfileKeyUpdateJob.KEY, new MultiDeviceProfileKeyUpdateJob.Factory());
|
|
put(MultiDeviceReadUpdateJob.KEY, new MultiDeviceReadUpdateJob.Factory());
|
|
put(MultiDeviceStickerPackOperationJob.KEY, new MultiDeviceStickerPackOperationJob.Factory());
|
|
put(MultiDeviceStickerPackSyncJob.KEY, new MultiDeviceStickerPackSyncJob.Factory());
|
|
put(MultiDeviceVerifiedUpdateJob.KEY, new MultiDeviceVerifiedUpdateJob.Factory());
|
|
put(PushContentReceiveJob.KEY, new PushContentReceiveJob.Factory());
|
|
put(PushDecryptJob.KEY, new PushDecryptJob.Factory());
|
|
put(PushGroupSendJob.KEY, new PushGroupSendJob.Factory());
|
|
put(PushGroupUpdateJob.KEY, new PushGroupUpdateJob.Factory());
|
|
put(PushMediaSendJob.KEY, new PushMediaSendJob.Factory());
|
|
put(PushNotificationReceiveJob.KEY, new PushNotificationReceiveJob.Factory());
|
|
put(PushTextSendJob.KEY, new PushTextSendJob.Factory());
|
|
put(NullMessageSendJob.KEY, new NullMessageSendJob.Factory());
|
|
put(ClosedGroupUpdateMessageSendJob.KEY, new ClosedGroupUpdateMessageSendJob.Factory());
|
|
put(RefreshAttributesJob.KEY, new RefreshAttributesJob.Factory());
|
|
put(RefreshPreKeysJob.KEY, new RefreshPreKeysJob.Factory());
|
|
put(RefreshUnidentifiedDeliveryAbilityJob.KEY, new RefreshUnidentifiedDeliveryAbilityJob.Factory());
|
|
put(RequestGroupInfoJob.KEY, new RequestGroupInfoJob.Factory());
|
|
put(RetrieveProfileAvatarJob.KEY, new RetrieveProfileAvatarJob.Factory(application));
|
|
put(RetrieveProfileJob.KEY, new RetrieveProfileJob.Factory(application));
|
|
put(RotateCertificateJob.KEY, new RotateCertificateJob.Factory());
|
|
put(RotateProfileKeyJob.KEY, new RotateProfileKeyJob.Factory());
|
|
put(RotateSignedPreKeyJob.KEY, new RotateSignedPreKeyJob.Factory());
|
|
put(SendDeliveryReceiptJob.KEY, new SendDeliveryReceiptJob.Factory());
|
|
put(SendReadReceiptJob.KEY, new SendReadReceiptJob.Factory());
|
|
put(ServiceOutageDetectionJob.KEY, new ServiceOutageDetectionJob.Factory());
|
|
put(SmsReceiveJob.KEY, new SmsReceiveJob.Factory());
|
|
put(SmsSendJob.KEY, new SmsSendJob.Factory());
|
|
put(SmsSentJob.KEY, new SmsSentJob.Factory());
|
|
put(StickerDownloadJob.KEY, new StickerDownloadJob.Factory());
|
|
put(StickerPackDownloadJob.KEY, new StickerPackDownloadJob.Factory());
|
|
put(TrimThreadJob.KEY, new TrimThreadJob.Factory());
|
|
put(TypingSendJob.KEY, new TypingSendJob.Factory());
|
|
put(UpdateApkJob.KEY, new UpdateApkJob.Factory());
|
|
put(SessionRequestMessageSendJob.KEY, new SessionRequestMessageSendJob.Factory());
|
|
put(MultiDeviceOpenGroupUpdateJob.KEY, new MultiDeviceOpenGroupUpdateJob.Factory());
|
|
}};
|
|
}
|
|
|
|
public static Map<String, Constraint.Factory> getConstraintFactories(@NonNull Application application) {
|
|
return new HashMap<String, Constraint.Factory>() {{
|
|
put(CellServiceConstraint.KEY, new CellServiceConstraint.Factory(application));
|
|
put(NetworkConstraint.KEY, new NetworkConstraint.Factory(application));
|
|
put(NetworkOrCellServiceConstraint.KEY, new NetworkOrCellServiceConstraint.Factory(application));
|
|
put(SqlCipherMigrationConstraint.KEY, new SqlCipherMigrationConstraint.Factory(application));
|
|
}};
|
|
}
|
|
|
|
public static List<ConstraintObserver> getConstraintObservers(@NonNull Application application) {
|
|
return Arrays.asList(new CellServiceConstraintObserver(application),
|
|
new NetworkConstraintObserver(application),
|
|
new SqlCipherMigrationConstraintObserver());
|
|
}
|
|
}
|