diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-08 11:41:46 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-07-08 11:41:46 +0200 |
commit | 7b35f9b07aef6b36e7cb7bdedf178d2c5a4588ad (patch) | |
tree | b7275511e3014002f6cfc9072d0af08e45b3814a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java | |
parent | 9eee9acba28cea2e97d0de653e5f6c07e01b12b6 (diff) | |
parent | be6b7ff89993de4eff1eb2499f7537ab74a6d8c8 (diff) | |
download | open-keychain-7b35f9b07aef6b36e7cb7bdedf178d2c5a4588ad.tar.gz open-keychain-7b35f9b07aef6b36e7cb7bdedf178d2c5a4588ad.tar.bz2 open-keychain-7b35f9b07aef6b36e7cb7bdedf178d2c5a4588ad.zip |
Merge pull request #1424 from open-keychain/import-proxy
Shifted proxy logic to ImportKeysListCloudLoader
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java index 9d97ba305..9eb92f92f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java @@ -130,6 +130,13 @@ public class OrbotHelper { return intent; } + /** + * checks preferences to see if Orbot is required, and if yes, if it is installed and running + * + * @param context used to retrieve preferences + * @return false if Tor is selected proxy and Orbot is not installed or running, true + * otherwise + */ public static boolean isOrbotInRequiredState(Context context) { Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(context).getProxyPrefs(); if (!proxyPrefs.torEnabled) { @@ -219,4 +226,27 @@ public class OrbotHelper { return putOrbotInRequiredState(middleButton, middleButtonRunnable, emptyRunnable, proxyPrefs, fragmentActivity); } + + /** + * generates a standard Orbot install/enable dialog if necessary, based on proxy settings in + * preferences + * + * @param ignoreTorRunnable run when the "Ignore Tor" button is pressed + * @param fragmentActivity used to start the activ + * @return + */ + public static boolean putOrbotInRequiredState(Runnable ignoreTorRunnable, + FragmentActivity fragmentActivity) { + return putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTorRunnable, + Preferences.getPreferences(fragmentActivity).getProxyPrefs(), fragmentActivity); + } + + public static boolean putOrbotInRequiredState(Runnable ignoreTorRunnable, + Runnable dismissDialogRunnable, + FragmentActivity fragmentActivity) { + return putOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTorRunnable, + dismissDialogRunnable, + Preferences.getPreferences(fragmentActivity).getProxyPrefs(), + fragmentActivity); + } } |