From fdaa2ad1065c2ffd696f6b09b3b5da1356ce9853 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 27 May 2014 18:39:44 -0400 Subject: [PATCH] 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. --- src/org/fdroid/fdroid/FDroidApp.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index 1190f02be..2fc8b9506 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -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)