diff options
author | Adithya Abraham Philip <adithyaphilip@gmail.com> | 2015-07-03 07:03:16 +0530 |
---|---|---|
committer | Adithya Abraham Philip <adithyaphilip@gmail.com> | 2015-07-03 20:46:16 +0530 |
commit | 4d81a83baab301fafbf8ac0559ddc00341ac760c (patch) | |
tree | 8d02dc3459a3fc6629a227b682d41d910e2372b9 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java | |
parent | 1856ca385de8172623c50598fba27d7ebf689f0f (diff) | |
download | open-keychain-4d81a83baab301fafbf8ac0559ddc00341ac760c.tar.gz open-keychain-4d81a83baab301fafbf8ac0559ddc00341ac760c.tar.bz2 open-keychain-4d81a83baab301fafbf8ac0559ddc00341ac760c.zip |
added proxy support to OperationHelper
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 | 16 |
1 files changed, 14 insertions, 2 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 2cbf45699..6a78b34f5 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 @@ -59,6 +59,7 @@ import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentActivity; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.service.ConsolidateInputParcel; import org.sufficientlysecure.keychain.ui.dialog.SupportInstallDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.OrbotStartDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.PreferenceInstallDialogFragment; @@ -130,6 +131,16 @@ public class OrbotHelper { return intent; } + public static boolean isOrbotInRequiredState(Context context) { + Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(context).getProxyPrefs(); + if (!proxyPrefs.torEnabled) { + return true; + } else if (!OrbotHelper.isOrbotInstalled(context) || !OrbotHelper.isOrbotRunning()) { + return false; + } + return true; + } + /** * checks if Tor is enabled and if it is, that Orbot is installed and runnign. Generates appropriate dialogs. * @@ -139,8 +150,9 @@ public class OrbotHelper { * @param fragmentActivity * @return true if Tor is not enabled or Tor is enabled and Orbot is installed and running, else false */ - public static boolean isOrbotInRequiredState(int middleButton, final Runnable middleButtonRunnable, - Preferences.ProxyPrefs proxyPrefs, FragmentActivity fragmentActivity) { + public static boolean putOrbotInRequiredState(int middleButton, final Runnable middleButtonRunnable, + Preferences.ProxyPrefs proxyPrefs, + FragmentActivity fragmentActivity) { Handler ignoreTorHandler = new Handler() { @Override public void handleMessage(Message msg) { |