Prompt for unstable updates globally
This commit is contained in:
parent
b44529586b
commit
ab2c1d49b6
@ -6,6 +6,8 @@
|
||||
* Fix crash when trying to install incompatible apps with the privileged
|
||||
installer
|
||||
|
||||
* Add option to prompt for unstable updates globally
|
||||
|
||||
* Add support for free Certificate Authorities: cert.startcom.org and
|
||||
letsencrypt.org
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="cache_downloaded">Cache packages</string>
|
||||
<string name="cache_downloaded_on">Keep downloaded package files on device</string>
|
||||
<string name="updates">Updates</string>
|
||||
<string name="unstable_updates">Unstable updates</string>
|
||||
<string name="unstable_updates_summary">Suggest updates to unstable versions</string>
|
||||
<string name="other">Other</string>
|
||||
<string name="last_update_check">Last repo scan: %s</string>
|
||||
<string name="never">Never</string>
|
||||
|
@ -73,6 +73,12 @@
|
||||
<CheckBoxPreference android:title="@string/expert"
|
||||
android:defaultValue="false"
|
||||
android:key="expert" />
|
||||
<CheckBoxPreference
|
||||
android:key="unstableUpdates"
|
||||
android:title="@string/unstable_updates"
|
||||
android:summary="@string/unstable_updates_summary"
|
||||
android:defaultValue="false"
|
||||
android:dependency="expert" />
|
||||
<CheckBoxPreference android:title="@string/system_installer"
|
||||
android:defaultValue="false"
|
||||
android:key="privilegedInstaller"
|
||||
|
@ -208,6 +208,14 @@ public class FDroidApp extends Application {
|
||||
}
|
||||
});
|
||||
|
||||
final Context context = this;
|
||||
Preferences.get().registerUnstableUpdatesChangeListener(new Preferences.ChangeListener() {
|
||||
@Override
|
||||
public void onPreferenceChange() {
|
||||
AppProvider.Helper.calcDetailsFromIndex(context);
|
||||
}
|
||||
});
|
||||
|
||||
// Clear cached apk files. We used to just remove them after they'd
|
||||
// been installed, but this causes problems for proprietary gapps
|
||||
// users since the introduction of verification (on pre-4.2 Android),
|
||||
|
@ -47,6 +47,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
public static final String PREF_COMPACT_LAYOUT = "compactlayout";
|
||||
public static final String PREF_IGN_TOUCH = "ignoreTouchscreen";
|
||||
public static final String PREF_CACHE_APK = "cacheDownloaded";
|
||||
public static final String PREF_UNSTABLE_UPDATES = "unstableUpdates";
|
||||
public static final String PREF_EXPERT = "expert";
|
||||
public static final String PREF_UPD_LAST = "lastUpdateCheck";
|
||||
public static final String PREF_PRIVILEGED_INSTALLER = "privilegedInstaller";
|
||||
@ -67,6 +68,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
private static final boolean DEFAULT_PRIVILEGED_INSTALLER = false;
|
||||
private static final boolean DEFAULT_LOCAL_REPO_BONJOUR = true;
|
||||
private static final boolean DEFAULT_CACHE_APK = false;
|
||||
private static final boolean DEFAULT_UNSTABLE_UPDATES = false;
|
||||
private static final boolean DEFAULT_LOCAL_REPO_HTTPS = false;
|
||||
private static final boolean DEFAULT_INCOMP_VER = false;
|
||||
private static final boolean DEFAULT_EXPERT = false;
|
||||
@ -88,6 +90,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
private final List<ChangeListener> updateHistoryListeners = new ArrayList<>();
|
||||
private final List<ChangeListener> localRepoNameListeners = new ArrayList<>();
|
||||
private final List<ChangeListener> localRepoHttpsListeners = new ArrayList<>();
|
||||
private final List<ChangeListener> unstableUpdatesListeners = new ArrayList<>();
|
||||
|
||||
private boolean isInitialized(String key) {
|
||||
return initialized.containsKey(key) && initialized.get(key);
|
||||
@ -129,6 +132,10 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
return preferences.getBoolean(PREF_CACHE_APK, DEFAULT_CACHE_APK);
|
||||
}
|
||||
|
||||
public boolean getUnstableUpdates() {
|
||||
return preferences.getBoolean(PREF_UNSTABLE_UPDATES, DEFAULT_UNSTABLE_UPDATES);
|
||||
}
|
||||
|
||||
public boolean showIncompatibleVersions() {
|
||||
return preferences.getBoolean(PREF_INCOMP_VER, DEFAULT_INCOMP_VER);
|
||||
}
|
||||
@ -235,6 +242,14 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
filterAppsRequiringRootListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void registerUnstableUpdatesChangeListener(ChangeListener listener) {
|
||||
unstableUpdatesListeners.add(listener);
|
||||
}
|
||||
|
||||
public void unregisterUnstableUpdatesChangeListener(ChangeListener listener) {
|
||||
unstableUpdatesListeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
Utils.debugLog(TAG, "Invalidating preference '" + key + "'.");
|
||||
@ -265,6 +280,10 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
for (ChangeListener listener : localRepoHttpsListeners) {
|
||||
listener.onPreferenceChange();
|
||||
}
|
||||
case PREF_UNSTABLE_UPDATES:
|
||||
for (ChangeListener listener : unstableUpdatesListeners) {
|
||||
listener.onPreferenceChange();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -868,6 +868,8 @@ public class AppProvider extends FDroidProvider {
|
||||
final String apk = DBHelper.TABLE_APK;
|
||||
final String app = DBHelper.TABLE_APP;
|
||||
|
||||
final boolean unstableUpdates = Preferences.get().getUnstableUpdates();
|
||||
String restrictToStable = unstableUpdates ? "" : ( apk + ".vercode <= " + app + ".upstreamVercode AND " );
|
||||
String updateSql =
|
||||
"UPDATE " + app +
|
||||
" SET suggestedVercode = ( " +
|
||||
@ -875,7 +877,7 @@ public class AppProvider extends FDroidProvider {
|
||||
" FROM " + apk +
|
||||
" WHERE " +
|
||||
app + ".id = " + apk + ".id AND " +
|
||||
apk + ".vercode <= " + app + ".upstreamVercode AND " +
|
||||
restrictToStable +
|
||||
" ( " + app + ".compatible = 0 OR " + apk + ".compatible = 1 ) ) " +
|
||||
" WHERE upstreamVercode > 0 ";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user