Rename PushNotificationReceiveJob -> MessageFetchJob.
This commit is contained in:
parent
0facdc0497
commit
a7019b2e60
6 changed files with 17 additions and 15 deletions
|
@ -19,7 +19,6 @@ import org.thoughtcrime.securesms.components.settings.app.changenumber.ChangeNum
|
|||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.devicetransfer.olddevice.OldDeviceTransferActivity;
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.lock.v2.CreateSvrPinActivity;
|
||||
import org.thoughtcrime.securesms.migrations.ApplicationMigrationActivity;
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.signal.core.util.logging.Log
|
|||
import org.thoughtcrime.securesms.MainActivity
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob
|
||||
import org.thoughtcrime.securesms.jobs.MessageFetchJob
|
||||
import org.thoughtcrime.securesms.messages.WebSocketDrainer
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels
|
||||
import org.thoughtcrime.securesms.notifications.NotificationIds
|
||||
|
@ -150,7 +150,7 @@ object FcmFetchManager {
|
|||
FcmJobService.schedule(context)
|
||||
} else {
|
||||
Log.w(TAG, "[API ${Build.VERSION.SDK_INT}] Failed to retrieve messages. Scheduling on JobManager (API " + Build.VERSION.SDK_INT + ").")
|
||||
ApplicationDependencies.getJobManager().add(PushNotificationReceiveJob())
|
||||
ApplicationDependencies.getJobManager().add(MessageFetchJob())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public final class JobManagerFactories {
|
|||
put(PushDistributionListSendJob.KEY, new PushDistributionListSendJob.Factory());
|
||||
put(PushGroupSendJob.KEY, new PushGroupSendJob.Factory());
|
||||
put(PushGroupSilentUpdateSendJob.KEY, new PushGroupSilentUpdateSendJob.Factory());
|
||||
put(PushNotificationReceiveJob.KEY, new PushNotificationReceiveJob.Factory());
|
||||
put(MessageFetchJob.KEY, new MessageFetchJob.Factory());
|
||||
put(PushProcessEarlyMessagesJob.KEY, new PushProcessEarlyMessagesJob.Factory());
|
||||
put(PushProcessMessageJob.KEY, new PushProcessMessageJob.Factory());
|
||||
put(PushProcessMessageJobV2.KEY, new PushProcessMessageJobV2.Factory());
|
||||
|
|
|
@ -18,13 +18,16 @@ import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class PushNotificationReceiveJob extends BaseJob {
|
||||
/**
|
||||
* Fetches messages from the service, posting a foreground service if possible.
|
||||
*/
|
||||
public final class MessageFetchJob extends BaseJob {
|
||||
|
||||
public static final String KEY = "PushNotificationReceiveJob";
|
||||
|
||||
private static final String TAG = Log.tag(PushNotificationReceiveJob.class);
|
||||
private static final String TAG = Log.tag(MessageFetchJob.class);
|
||||
|
||||
public PushNotificationReceiveJob() {
|
||||
public MessageFetchJob() {
|
||||
this(new Job.Parameters.Builder()
|
||||
.addConstraint(NetworkConstraint.KEY)
|
||||
.setQueue("__notification_received")
|
||||
|
@ -33,7 +36,7 @@ public final class PushNotificationReceiveJob extends BaseJob {
|
|||
.build());
|
||||
}
|
||||
|
||||
private PushNotificationReceiveJob(Job.Parameters parameters) {
|
||||
private MessageFetchJob(Job.Parameters parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
|
@ -83,10 +86,10 @@ public final class PushNotificationReceiveJob extends BaseJob {
|
|||
public void onFailure() {
|
||||
}
|
||||
|
||||
public static final class Factory implements Job.Factory<PushNotificationReceiveJob> {
|
||||
public static final class Factory implements Job.Factory<MessageFetchJob> {
|
||||
@Override
|
||||
public @NonNull PushNotificationReceiveJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) {
|
||||
return new PushNotificationReceiveJob(parameters);
|
||||
public @NonNull MessageFetchJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) {
|
||||
return new MessageFetchJob(parameters);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ import org.signal.core.util.concurrent.SignalExecutors;
|
|||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobTracker;
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||
import org.thoughtcrime.securesms.jobs.MessageFetchJob;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -61,7 +61,7 @@ public final class RoutineMessageFetchReceiver extends BroadcastReceiver {
|
|||
Log.i(TAG, "Running PushNotificationReceiveJob");
|
||||
|
||||
Optional<JobTracker.JobState> jobState = ApplicationDependencies.getJobManager()
|
||||
.runSynchronously(new PushNotificationReceiveJob(), jobTimeout);
|
||||
.runSynchronously(new MessageFetchJob(), jobTimeout);
|
||||
|
||||
Log.i(TAG, "PushNotificationReceiveJob ended: " + (jobState.isPresent() ? jobState.get().toString() : "Job did not complete"));
|
||||
});
|
||||
|
|
|
@ -5,12 +5,12 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||
import org.thoughtcrime.securesms.jobs.MessageFetchJob;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
ApplicationDependencies.getJobManager().add(new PushNotificationReceiveJob());
|
||||
ApplicationDependencies.getJobManager().add(new MessageFetchJob());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue