mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #1398 from deltachat/tweak-io
call maybeNetwork() when app comes to foreground to catch up the state
This commit is contained in:
@@ -13,7 +13,7 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
|
||||
private int refs = 0;
|
||||
private static ForegroundDetector Instance = null;
|
||||
ApplicationContext application;
|
||||
private ApplicationContext application;
|
||||
|
||||
public static ForegroundDetector getInstance() {
|
||||
return Instance;
|
||||
@@ -35,9 +35,14 @@ public class ForegroundDetector implements Application.ActivityLifecycleCallback
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
if (refs == 0) {
|
||||
application.dcContext.maybeStartIo();
|
||||
if (application.dcContext.isNetworkConnected()) {
|
||||
new Thread(() -> application.dcContext.maybeNetwork()).start();
|
||||
}
|
||||
}
|
||||
|
||||
refs++;
|
||||
|
||||
application.dcContext.maybeStartIo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user