update IP-related settings whenever the HTTPS pref changes

WifiStateChangeService handles updating lots of IP-related things, then
things that depend on it listen to the broadcast from that Service. The
most straightforward way to update HTTPS or HTTP throughout the app is to
trigger this Service.  It runs its stuff in an AsyncTask so it is all low
priority.
This commit is contained in:
Hans-Christoph Steiner 2014-05-27 18:39:44 -04:00
parent c4b059502c
commit fdaa2ad106

View File

@ -41,6 +41,7 @@ import com.nostra13.universalimageloader.utils.StorageUtils;
import de.duenndns.ssl.MemorizingTrustManager;
import org.fdroid.fdroid.Preferences.ChangeListener;
import org.fdroid.fdroid.compat.PRNGFixes;
import org.fdroid.fdroid.data.AppProvider;
import org.fdroid.fdroid.data.InstalledAppCacheUpdater;
@ -213,6 +214,13 @@ public class FDroidApp extends Application {
if (wifiState == WifiManager.WIFI_STATE_ENABLING
|| wifiState == WifiManager.WIFI_STATE_ENABLED)
startService(new Intent(this, WifiStateChangeService.class));
// if the HTTPS pref changes, then update all affected things
Preferences.get().registerLocalRepoHttpsListeners(new ChangeListener() {
@Override
public void onPreferenceChange() {
startService(new Intent(FDroidApp.this, WifiStateChangeService.class));
}
});
}
@TargetApi(18)