Remove BackgroundMessageRetriever and clean up old code.

This commit is contained in:
Greyson Parrelli
2023-08-14 12:21:50 -04:00
committed by Cody Henthorne
parent 9f75c37331
commit b07d675bb4
14 changed files with 91 additions and 305 deletions

View File

@@ -140,7 +140,7 @@ object FcmFetchManager {
@JvmStatic
fun retrieveMessages(context: Context): Boolean {
val success = ApplicationDependencies.getBackgroundMessageRetriever().retrieveMessages(context, WebSocketStrategy(WEBSOCKET_DRAIN_TIMEOUT))
val success = WebSocketStrategy.execute(WEBSOCKET_DRAIN_TIMEOUT)
if (success) {
Log.i(TAG, "Successfully retrieved messages.")

View File

@@ -12,7 +12,7 @@ import androidx.annotation.RequiresApi;
import org.signal.core.util.concurrent.SignalExecutors;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.messages.BackgroundMessageRetriever;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.messages.WebSocketStrategy;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@@ -41,15 +41,13 @@ public class FcmJobService extends JobService {
public boolean onStartJob(JobParameters params) {
Log.d(TAG, "onStartJob()");
if (BackgroundMessageRetriever.shouldIgnoreFetch()) {
if (ApplicationDependencies.getAppForegroundObserver().isForegrounded()) {
Log.i(TAG, "App is foregrounded. No need to run.");
return false;
}
SignalExecutors.UNBOUNDED.execute(() -> {
Context context = getApplicationContext();
BackgroundMessageRetriever retriever = ApplicationDependencies.getBackgroundMessageRetriever();
boolean success = retriever.retrieveMessages(context, new WebSocketStrategy());
boolean success = WebSocketStrategy.execute();
if (success) {
Log.i(TAG, "Successfully retrieved messages.");
@@ -66,6 +64,6 @@ public class FcmJobService extends JobService {
@Override
public boolean onStopJob(JobParameters params) {
Log.d(TAG, "onStopJob()");
return TextSecurePreferences.getNeedsMessagePull(getApplicationContext());
return true;
}
}