Fallback to legacy network detection.

fork-5.53.8
Greyson Parrelli 2022-03-15 11:28:31 -04:00
rodzic cf857e109a
commit c7016aa462
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.ConstraintObserver;
import java.util.HashSet;
@ -164,7 +165,12 @@ public class NetworkConstraintObserver implements ConstraintObserver {
@Override
public void onLost(@NonNull Network network) {
Log.w(TAG, logPrefix() + "Network unavailable. " + network.hashCode());
hasInternet = false;
if (isActiveNetworkConnected(ApplicationDependencies.getApplication())) {
Log.w(TAG, logPrefix() + "We got the onLost() event, but isActiveNetworkConnected() returns true. Assuming we have internet.");
hasInternet = true;
} else {
hasInternet = false;
}
notifyListeners();
}
}