From 0f43d1c4bf8359b214fbc3d2dc52ffe539eb0d86 Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Tue, 16 Jun 2015 15:00:24 +0530 Subject: [PATCH] added proxy support to YubiKey search --- .../ui/CreateKeyYubiKeyImportFragment.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java index eaabb3e65..2d88f4d6e 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyYubiKeyImportFragment.java @@ -143,7 +143,18 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe view.findViewById(R.id.button_search).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - refreshSearch(); + final Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(getActivity()).getProxyPrefs(); + Runnable ignoreTor = new Runnable() { + @Override + public void run() { + refreshSearch(new ParcelableProxy(null, -1, null)); + } + }; + + if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs, + getActivity())) { + refreshSearch(proxyPrefs.parcelableProxy); + } } }); @@ -182,10 +193,10 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe } } - public void refreshSearch() { + public void refreshSearch(ParcelableProxy parcelableProxy) { // TODO: PHILIP implement proxy in YubiKey parts mListFragment.loadNew(new ImportKeysListFragment.CloudLoaderState("0x" + mNfcFingerprint, - Preferences.getPreferences(getActivity()).getCloudSearchPrefs()), null); + Preferences.getPreferences(getActivity()).getCloudSearchPrefs()), parcelableProxy); } public void importKey(ParcelableProxy parcelableProxy) { @@ -278,7 +289,19 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(fp); setData(); - refreshSearch(); + + Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(getActivity()).getProxyPrefs(); + Runnable ignoreTor = new Runnable() { + @Override + public void run() { + refreshSearch(new ParcelableProxy(null, -1, null)); + } + }; + + if (OrbotHelper.isOrbotInRequiredState(R.string.orbot_ignore_tor, ignoreTor, proxyPrefs, + getActivity())) { + refreshSearch(proxyPrefs.parcelableProxy); + } } }