don't check for proxy if offline import

This commit is contained in:
Adithya Abraham Philip 2015-06-20 06:37:00 +05:30
parent 35ee21bfab
commit 83fc9d796f

View File

@ -641,21 +641,28 @@ public class ImportExportOperation extends BaseOperation<ImportKeyringParcel> {
public ImportKeyResult execute(ImportKeyringParcel input, CryptoInputParcel cryptoInput) { public ImportKeyResult execute(ImportKeyringParcel input, CryptoInputParcel cryptoInput) {
Proxy proxy = null; Proxy proxy = null;
if (cryptoInput.getParcelableProxy() == null) { if (!isOfflineImport(input)) {
// if a proxy is not specified, we retrieve from preferences if (cryptoInput.getParcelableProxy() == null) {
Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(mContext).getProxyPrefs(); // if a proxy is not specified, we retrieve from preferences
Preferences.ProxyPrefs proxyPrefs = Preferences.getPreferences(mContext).getProxyPrefs();
if (proxyPrefs.torEnabled && !OrbotHelper.isOrbotInstalledAndRunning(mContext)) { if (proxyPrefs.torEnabled && !OrbotHelper.isOrbotInstalledAndRunning(mContext)) {
// is it okay to pass null for log? // is it okay to pass null for log?
return new ImportKeyResult(null, RequiredInputParcel.createRequiredOrbotEnable()); return new ImportKeyResult(null, RequiredInputParcel.createRequiredOrbotEnable());
}
} else {
proxy = cryptoInput.getParcelableProxy().getProxy();
} }
} else {
proxy = cryptoInput.getParcelableProxy().getProxy();
} }
return importKeys(input.mKeyList, input.mKeyserver, proxy); return importKeys(input.mKeyList, input.mKeyserver, proxy);
} }
// TODO: Verify if this is sufficient to determine offline import
private boolean isOfflineImport(ImportKeyringParcel importParcel) {
return importParcel.mKeyList == null;
}
public ImportKeyResult importKeys(ArrayList<ParcelableKeyRing> keyList, String keyServer, Proxy proxy) { public ImportKeyResult importKeys(ArrayList<ParcelableKeyRing> keyList, String keyServer, Proxy proxy) {
ImportKeyResult result = null; ImportKeyResult result = null;