parent
5acc87c405
commit
1758c2c9f1
@ -404,22 +404,23 @@ public class UpdateService extends JobIntentService {
|
|||||||
if (isLocalRepoAddress(address)) {
|
if (isLocalRepoAddress(address)) {
|
||||||
Utils.debugLog(TAG, "skipping internet check, this is local: " + address);
|
Utils.debugLog(TAG, "skipping internet check, this is local: " + address);
|
||||||
} else if (netState == ConnectivityMonitorService.FLAG_NET_UNAVAILABLE) {
|
} else if (netState == ConnectivityMonitorService.FLAG_NET_UNAVAILABLE) {
|
||||||
boolean foundLocalRepo = false;
|
// keep track of repos that have a local copy in case internet is not available
|
||||||
|
ArrayList<Repo> localRepos = new ArrayList<>();
|
||||||
for (Repo repo : repos) {
|
for (Repo repo : repos) {
|
||||||
if (isLocalRepoAddress(repo.address)) {
|
if (isLocalRepoAddress(repo.address)) {
|
||||||
foundLocalRepo = true;
|
localRepos.add(repo);
|
||||||
} else {
|
} else {
|
||||||
for (String mirrorAddress : repo.getMirrorList()) {
|
for (String mirrorAddress : repo.getMirrorList()) {
|
||||||
if (isLocalRepoAddress(mirrorAddress)) {
|
if (isLocalRepoAddress(mirrorAddress)) {
|
||||||
foundLocalRepo = true;
|
localRepos.add(repo);
|
||||||
//localRepos.add(repo);
|
|
||||||
//FDroidApp.setLastWorkingMirror(repo.getId(), mirrorAddress);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!foundLocalRepo) {
|
if (localRepos.size() > 0) {
|
||||||
|
repos = localRepos;
|
||||||
|
} else {
|
||||||
Utils.debugLog(TAG, "No internet, cannot update");
|
Utils.debugLog(TAG, "No internet, cannot update");
|
||||||
if (manualUpdate) {
|
if (manualUpdate) {
|
||||||
Utils.showToastFromService(this, getString(R.string.warning_no_internet), Toast.LENGTH_SHORT);
|
Utils.showToastFromService(this, getString(R.string.warning_no_internet), Toast.LENGTH_SHORT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user