mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Initialize AppDependencies if needed in AvatarProvider.
This commit is contained in:
committed by
Cody Henthorne
parent
9261c34213
commit
6112ee9bd3
@@ -12,9 +12,9 @@ import androidx.annotation.WorkerThread
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.signal.core.util.PendingIntentFlags
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.service.GenericForegroundService
|
||||
import org.thoughtcrime.securesms.service.NotificationController
|
||||
import org.thoughtcrime.securesms.util.AppForegroundObserver
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -137,7 +137,7 @@ object ForegroundServiceUtil {
|
||||
private fun blockUntilCapable(context: Context, timeout: Long = DEFAULT_TIMEOUT): Boolean {
|
||||
val alarmManager = ServiceUtil.getAlarmManager(context)
|
||||
|
||||
if (Build.VERSION.SDK_INT < 31 || AppDependencies.appForegroundObserver.isForegrounded) {
|
||||
if (Build.VERSION.SDK_INT < 31 || AppForegroundObserver.isForegrounded()) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class MessageFetchJob extends BaseJob {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
AppDependencies.getAppForegroundObserver().removeListener(this);
|
||||
AppForegroundObserver.removeListener(this);
|
||||
closeNotificationController();
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public final class MessageFetchJob extends BaseJob {
|
||||
|
||||
static ForegroundServiceController create(@NonNull Context context) {
|
||||
ForegroundServiceController instance = new ForegroundServiceController(context);
|
||||
AppDependencies.getAppForegroundObserver().addListener(instance);
|
||||
AppForegroundObserver.addListener(instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||
import org.thoughtcrime.securesms.util.AppForegroundObserver;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||
@@ -196,7 +197,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
|
||||
private void generateFullContactUpdate()
|
||||
throws IOException, UntrustedIdentityException, NetworkException
|
||||
{
|
||||
boolean isAppVisible = AppDependencies.getAppForegroundObserver().isForegrounded();
|
||||
boolean isAppVisible = AppForegroundObserver.isForegrounded();
|
||||
long timeSinceLastSync = System.currentTimeMillis() - TextSecurePreferences.getLastFullContactSyncTime(context);
|
||||
|
||||
Log.d(TAG, "Requesting a full contact sync. forced = " + forceSync + ", appVisible = " + isAppVisible + ", timeSinceLastSync = " + timeSinceLastSync + " ms");
|
||||
|
||||
Reference in New Issue
Block a user