Convert WebSocketStrategy.java -> WebSocketDrainer.kt

This commit is contained in:
Greyson Parrelli
2023-08-14 13:41:34 -04:00
committed by Cody Henthorne
parent b07d675bb4
commit 5fa9a27ee0
5 changed files with 174 additions and 179 deletions

View File

@@ -14,7 +14,7 @@ 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.messages.WebSocketStrategy
import org.thoughtcrime.securesms.messages.WebSocketDrainer
import org.thoughtcrime.securesms.notifications.NotificationChannels
import org.thoughtcrime.securesms.notifications.NotificationIds
import org.thoughtcrime.securesms.util.FeatureFlags
@@ -140,7 +140,7 @@ object FcmFetchManager {
@JvmStatic
fun retrieveMessages(context: Context): Boolean {
val success = WebSocketStrategy.execute(WEBSOCKET_DRAIN_TIMEOUT)
val success = WebSocketDrainer.blockUntilDrainedAndProcessed(WEBSOCKET_DRAIN_TIMEOUT)
if (success) {
Log.i(TAG, "Successfully retrieved messages.")

View File

@@ -12,10 +12,8 @@ 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.keyvalue.SignalStore;
import org.thoughtcrime.securesms.messages.WebSocketStrategy;
import org.thoughtcrime.securesms.messages.WebSocketDrainer;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
/**
* Pulls down messages. Used when we fail to pull down messages in {@link FcmReceiveService}.
@@ -47,7 +45,7 @@ public class FcmJobService extends JobService {
}
SignalExecutors.UNBOUNDED.execute(() -> {
boolean success = WebSocketStrategy.execute();
boolean success = WebSocketDrainer.blockUntilDrainedAndProcessed();
if (success) {
Log.i(TAG, "Successfully retrieved messages.");