enabled proxy in CertifyKeyFragment

This commit is contained in:
Adithya Abraham Philip 2015-06-11 02:17:54 +05:30
parent 0499b1f056
commit d95798dda2
2 changed files with 26 additions and 2 deletions

View File

@ -397,10 +397,12 @@ public class HkpKeyserver extends Keyserver {
.post(body) .post(body)
.build(); .build();
Response response = new OkHttpClient().setProxy(proxy).newCall(request).execute(); Response response = getClient(url, proxy).newCall(request).execute();
Log.d(Constants.TAG, "response code: " + response.code()); Log.d(Constants.TAG, "response code: " + response.code());
Log.d(Constants.TAG, "answer: " + response.body().string()); Log.d(Constants.TAG, "answer: " + response.body().string());
tempIpTest(proxy);
} catch (IOException e) { } catch (IOException e) {
Log.e(Constants.TAG, "IOException", e); Log.e(Constants.TAG, "IOException", e);
throw new AddKeyException(); throw new AddKeyException();

View File

@ -61,6 +61,7 @@ import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner; import org.sufficientlysecure.keychain.ui.widget.CertifyKeySpinner;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.util.orbot.OrbotHelper;
import java.util.ArrayList; import java.util.ArrayList;
@ -90,11 +91,14 @@ public class CertifyKeyFragment
private static final int INDEX_IS_REVOKED = 4; private static final int INDEX_IS_REVOKED = 4;
private MultiUserIdsAdapter mUserIdsAdapter; private MultiUserIdsAdapter mUserIdsAdapter;
private Preferences.ProxyPrefs mProxyPrefs;
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
mProxyPrefs = Preferences.getPreferences(getActivity()).getProxyPrefs();
mPubMasterKeyIds = getActivity().getIntent().getLongArrayExtra(CertifyKeyActivity.EXTRA_KEY_IDS); mPubMasterKeyIds = getActivity().getIntent().getLongArrayExtra(CertifyKeyActivity.EXTRA_KEY_IDS);
if (mPubMasterKeyIds == null) { if (mPubMasterKeyIds == null) {
Log.e(Constants.TAG, "List of key ids to certify missing!"); Log.e(Constants.TAG, "List of key ids to certify missing!");
@ -171,8 +175,26 @@ public class CertifyKeyFragment
Notify.create(getActivity(), getString(R.string.select_key_to_certify), Notify.create(getActivity(), getString(R.string.select_key_to_certify),
Notify.Style.ERROR).show(); Notify.Style.ERROR).show();
} else { } else {
if (mUploadKeyCheckbox.isChecked() && mProxyPrefs.torEnabled) {
Handler ignoreTorHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
mProxyPrefs = new Preferences.ProxyPrefs(false, false, null, -1, null);
cryptoOperation(); cryptoOperation();
} }
};
if (!OrbotHelper.isOrbotInstalled(getActivity())) {
OrbotHelper.getInstallDialogFragmentWithThirdButton(new Messenger(ignoreTorHandler),
R.string.orbot_install_dialog_ignore_tor).show(getActivity().getSupportFragmentManager(), "installOrbot");
} else if (!OrbotHelper.isOrbotRunning()) {
OrbotHelper.getOrbotStartDialogFragment(new Messenger(ignoreTorHandler),
R.string.orbot_install_dialog_ignore_tor).show(getActivity().getSupportFragmentManager(), "startOrbot");
} else {
cryptoOperation();
}
}
}
} }
}); });