Download all icons if cache/icons/ is missing
This way, after wiping cache one can redownload all the icons by just updating the repos (even if they don't need updates, this will work)
This commit is contained in:
parent
f1f1abf095
commit
49dddf42a4
@ -511,12 +511,9 @@ public class DB {
|
||||
|
||||
public static File getIconsPath(Context ctx) {
|
||||
File dp = getDataPath(ctx);
|
||||
if(dp == null)
|
||||
if (dp == null)
|
||||
return null;
|
||||
File ip = new File(dp, "icons");
|
||||
if(!ip.exists())
|
||||
ip.mkdirs();
|
||||
return ip;
|
||||
return new File(dp, "icons");
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
@ -186,6 +186,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
}
|
||||
}
|
||||
|
||||
List<DB.App> acceptedapps = new ArrayList<DB.App>();
|
||||
if (!changes && success) {
|
||||
Log.d("FDroid",
|
||||
"Not checking app details or compatibility, because all repos were up to date.");
|
||||
@ -193,9 +194,7 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
|
||||
sendStatus(STATUS_INFO,
|
||||
getString(R.string.status_checking_compatibility));
|
||||
List<DB.App> acceptedapps = new ArrayList<DB.App>();
|
||||
List<DB.App> prevapps = ((FDroidApp) getApplication())
|
||||
.getApps();
|
||||
List<DB.App> prevapps = ((FDroidApp) getApplication()).getApps();
|
||||
|
||||
DB db = DB.getDB();
|
||||
try {
|
||||
@ -252,16 +251,24 @@ public class UpdateService extends IntentService implements ProgressListener {
|
||||
} finally {
|
||||
DB.releaseDB();
|
||||
}
|
||||
if (success) {
|
||||
sendStatus(STATUS_INFO,
|
||||
getString(R.string.status_downloading_icons));
|
||||
for (DB.App app : acceptedapps)
|
||||
getIcon(app, repos);
|
||||
((FDroidApp) getApplication()).invalidateAllApps();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (success) {
|
||||
File d = DB.getIconsPath(this);
|
||||
List<DB.App> toDownloadIcons = acceptedapps;
|
||||
if (!d.exists()) {
|
||||
Log.d("FDroid", "Icons were wiped. Re-downloading all of them.");
|
||||
d.mkdirs();
|
||||
toDownloadIcons = ((FDroidApp) getApplication()).getApps();
|
||||
}
|
||||
sendStatus(STATUS_INFO,
|
||||
getString(R.string.status_downloading_icons));
|
||||
for (DB.App app : toDownloadIcons)
|
||||
getIcon(app, repos);
|
||||
((FDroidApp) getApplication()).invalidateAllApps();
|
||||
}
|
||||
|
||||
if (success && changes && notify && (newUpdates > prevUpdates)) {
|
||||
Log.d("FDroid", "Notifying updates. Apps before:" + prevUpdates
|
||||
+ ", apps after: " + newUpdates);
|
||||
|
Loading…
x
Reference in New Issue
Block a user