only generate basic swap index.jar if none exists

Let's keep the index.jar around as a cache of parsed information.

LocalRepoManager.getApps() was totally unused
This commit is contained in:
Hans-Christoph Steiner 2016-05-18 15:00:25 +02:00
parent 897ed989b1
commit 2038b7e1cb
2 changed files with 11 additions and 15 deletions

View File

@ -237,6 +237,13 @@ public final class LocalRepoManager {
}
}
/**
* Get the {@code index.jar} file that represents the local swap repo.
*/
public File getIndexJar() {
return xmlIndexJar;
}
public void deleteRepo() {
deleteContents(repoDir);
}
@ -277,10 +284,6 @@ public final class LocalRepoManager {
apps.put(packageName, app);
}
public List<String> getApps() {
return new ArrayList<>(apps.keySet());
}
public void copyIconsToRepo() {
ApplicationInfo appInfo;
for (final App app : apps.values()) {

View File

@ -376,7 +376,10 @@ public class SwapWorkflowActivity extends AppCompatActivity {
getService().swapWith(null);
if (!getService().isEnabled()) {
prepareInitialRepo();
if (!LocalRepoManager.get(this).getIndexJar().exists()) {
Utils.debugLog(TAG, "Preparing initial repo with only F-Droid, until we have allowed the user to configure their own repo.");
new PrepareInitialSwapRepo().execute();
}
}
inflateInnerView(R.layout.swap_blank);
@ -452,16 +455,6 @@ public class SwapWorkflowActivity extends AppCompatActivity {
}
}
private void prepareInitialRepo() {
// TODO: Make it so that this and updateSwappableAppsTask (the _real_ swap repo task)
// don't stomp on eachothers toes. The other one should wait for this to finish, or cancel
// this, but this should never take precedence over the other.
// TODO: Also don't allow this to run multiple times (e.g. if a user keeps navigating back
// to the main screen.
Utils.debugLog(TAG, "Preparing initial repo with only F-Droid, until we have allowed the user to configure their own repo.");
new PrepareInitialSwapRepo().execute();
}
/**
* Once the UpdateAsyncTask has finished preparing our repository index, we can
* show the next screen to the user. This will be one of two things: