mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-02-05 12:42:34 -05:00
[app] Don't update repos twice on fresh start
DbHelper#prePopulateDb() is already kicking off an index update, so MainActivity doesn't need to anymore.
This commit is contained in:
@@ -363,6 +363,7 @@ public class FDroidApp extends Application implements androidx.work.Configuratio
|
||||
// force setting network state to ensure it is set before UpdateService checks it
|
||||
networkState = ConnectivityMonitorService.getNetworkState(this);
|
||||
ConnectivityMonitorService.registerAndStart(this);
|
||||
Utils.debugLog(TAG, "RepoUpdateWorker.scheduleOrCancel()");
|
||||
RepoUpdateWorker.scheduleOrCancel(getApplicationContext());
|
||||
|
||||
FDroidApp.initWifiSettings();
|
||||
|
||||
@@ -57,7 +57,6 @@ import org.fdroid.fdroid.nearby.TreeUriScannerIntentService;
|
||||
import org.fdroid.fdroid.nearby.WifiStateChangeService;
|
||||
import org.fdroid.fdroid.views.AppDetailsActivity;
|
||||
import org.fdroid.fdroid.views.apps.AppListActivity;
|
||||
import org.fdroid.fdroid.work.RepoUpdateWorker;
|
||||
|
||||
/**
|
||||
* Main view shown to users upon starting F-Droid.
|
||||
@@ -141,8 +140,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
updatesBadge = bottomNavigation.getOrCreateBadge(R.id.updates);
|
||||
updatesBadge.setVisible(false);
|
||||
|
||||
initialRepoUpdateIfRequired();
|
||||
|
||||
AppUpdateStatusManager.getInstance(this).getNumUpdatableApps().observe(this, this::refreshUpdatesBadge);
|
||||
|
||||
Intent intent = getIntent();
|
||||
@@ -181,14 +178,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void initialRepoUpdateIfRequired() {
|
||||
if (Preferences.get().isIndexNeverUpdated() &&
|
||||
!FDroidApp.getRepoUpdateManager(this).isUpdating().getValue()) {
|
||||
Utils.debugLog(TAG, "We haven't done an update yet. Forcing repo update.");
|
||||
RepoUpdateWorker.updateNow(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -407,4 +396,4 @@ public class MainActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ class RepoUpdateWorker(
|
||||
val doUpdateChecks = prefs.updateInterval != UPDATE_INTERVAL_DISABLED &&
|
||||
!(prefs.overData == OVER_NETWORK_NEVER && prefs.overWifi == OVER_NETWORK_NEVER)
|
||||
if (doUpdateChecks) {
|
||||
Log.i(TAG, "scheduleOrCancel: enqueueUniquePeriodicWork")
|
||||
val networkType = if (prefs.overData == OVER_NETWORK_ALWAYS &&
|
||||
prefs.overWifi == OVER_NETWORK_ALWAYS
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user