aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java
diff options
context:
space:
mode:
authorAdithya Abraham Philip <adithyaphilip@gmail.com>2015-07-08 06:31:34 +0530
committerAdithya Abraham Philip <adithyaphilip@gmail.com>2015-07-08 07:47:24 +0530
commitbe6b7ff89993de4eff1eb2499f7537ab74a6d8c8 (patch)
tree77e5586edd76d3442d372e9f1ddec0e68e8f2aea /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/orbot/OrbotHelper.java
parent6cbc0ceeaed90fdeba1d6cdd94db274e53a10235 (diff)
downloadopen-keychain-be6b7ff89993de4eff1eb2499f7537ab74a6d8c8.tar.gz
open-keychain-be6b7ff89993de4eff1eb2499f7537ab74a6d8c8.tar.bz2
open-keychain-be6b7ff89993de4eff1eb2499f7537ab74a6d8c8.zip
shifted proxy checking 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.java30
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);
+ }
}