added proxy support to YubiKey search

This commit is contained in:
Adithya Abraham Philip 2015-06-16 15:00:24 +05:30
parent 66350d7be3
commit 0f43d1c4bf

View File

@ -143,7 +143,18 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
view.findViewById(R.id.button_search).setOnClickListener(new OnClickListener() { view.findViewById(R.id.button_search).setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { 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 // TODO: PHILIP implement proxy in YubiKey parts
mListFragment.loadNew(new ImportKeysListFragment.CloudLoaderState("0x" + mNfcFingerprint, mListFragment.loadNew(new ImportKeysListFragment.CloudLoaderState("0x" + mNfcFingerprint,
Preferences.getPreferences(getActivity()).getCloudSearchPrefs()), null); Preferences.getPreferences(getActivity()).getCloudSearchPrefs()), parcelableProxy);
} }
public void importKey(ParcelableProxy parcelableProxy) { public void importKey(ParcelableProxy parcelableProxy) {
@ -278,7 +289,19 @@ public class CreateKeyYubiKeyImportFragment extends Fragment implements NfcListe
mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(fp); mNfcFingerprint = KeyFormattingUtils.convertFingerprintToHex(fp);
setData(); 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);
}
} }
} }