Merge pull request #2167 from open-keychain/ditch-consolidate
Ditch "consolidate" mechanism
This commit is contained in:
@@ -214,7 +214,7 @@ public class CertifyFingerprintFragment extends LoaderFragment implements
|
||||
private void certify(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = KeyRepository.createDatabaseInteractor(getContext())
|
||||
keyId = KeyRepository.create(getContext())
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CertifyKeyFragment
|
||||
if (certifyKeyId != Constants.key.none) {
|
||||
try {
|
||||
CachedPublicKeyRing key = (KeyRepository
|
||||
.createDatabaseInteractor(getContext()))
|
||||
.create(getContext()))
|
||||
.getCachedPublicKeyRing(certifyKeyId);
|
||||
if (key.canCertify()) {
|
||||
mCertifyKeySpinner.setPreSelectedKeyId(certifyKeyId);
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.service.ConsolidateInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
|
||||
/**
|
||||
* We can not directly create a dialog on the application context.
|
||||
* This activity encapsulates a DialogFragment to emulate a dialog.
|
||||
*/
|
||||
public class ConsolidateDialogActivity extends FragmentActivity
|
||||
implements CryptoOperationHelper.Callback<ConsolidateInputParcel, ConsolidateResult> {
|
||||
|
||||
public static final String EXTRA_CONSOLIDATE_RECOVERY = "consolidate_recovery";
|
||||
|
||||
private CryptoOperationHelper<ConsolidateInputParcel, ConsolidateResult> mConsolidateOpHelper;
|
||||
private boolean mRecovery;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// this activity itself has no content view (see manifest)
|
||||
|
||||
boolean recovery = getIntent().getBooleanExtra(EXTRA_CONSOLIDATE_RECOVERY, false);
|
||||
|
||||
consolidateRecovery(recovery);
|
||||
}
|
||||
|
||||
private void consolidateRecovery(boolean recovery) {
|
||||
|
||||
mRecovery = recovery;
|
||||
|
||||
mConsolidateOpHelper = new CryptoOperationHelper<>(1, this, this, R.string.progress_importing);
|
||||
mConsolidateOpHelper.cryptoOperation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (mConsolidateOpHelper != null) {
|
||||
mConsolidateOpHelper.handleActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConsolidateInputParcel createOperationInput() {
|
||||
return ConsolidateInputParcel.createConsolidateInputParcel(mRecovery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationSuccess(ConsolidateResult result) {
|
||||
// don't care about result (for now?)
|
||||
ConsolidateDialogActivity.this.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationCancelled() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationError(ConsolidateResult result) {
|
||||
// don't care about result (for now?)
|
||||
ConsolidateDialogActivity.this.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
CreateKeyActivity activity = (CreateKeyActivity) getActivity();
|
||||
|
||||
SaveKeyringParcel.Builder builder;
|
||||
CachedPublicKeyRing key = (KeyRepository.createDatabaseInteractor(getContext()))
|
||||
CachedPublicKeyRing key = (KeyRepository.create(getContext()))
|
||||
.getCachedPublicKeyRing(saveKeyResult.mMasterKeyId);
|
||||
try {
|
||||
builder = SaveKeyringParcel.buildChangeKeyringParcel(key.getMasterKeyId(), key.getFingerprint());
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
|
||||
try {
|
||||
|
||||
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
|
||||
long masterKeyId = KeyRepository.createDatabaseInteractor(getContext()).getCachedPublicKeyRing(
|
||||
long masterKeyId = KeyRepository.create(getContext()).getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId)
|
||||
).getMasterKeyId();
|
||||
viewKeyIntent.setData(KeyRings.buildGenericKeyRingUri(masterKeyId));
|
||||
|
||||
@@ -89,7 +89,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
if (mMasterKeyIds.length == 1 && mHasSecret) {
|
||||
// if mMasterKeyIds.length == 0 we let the DeleteOperation respond
|
||||
try {
|
||||
HashMap<String, Object> data = KeyRepository.createDatabaseInteractor(this).getUnifiedData(
|
||||
HashMap<String, Object> data = KeyRepository.create(this).getUnifiedData(
|
||||
mMasterKeyIds[0], new String[]{
|
||||
KeychainContract.KeyRings.NAME,
|
||||
KeychainContract.KeyRings.IS_REVOKED
|
||||
@@ -272,7 +272,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
long masterKeyId = masterKeyIds[0];
|
||||
|
||||
try {
|
||||
HashMap<String, Object> data = KeyRepository.createDatabaseInteractor(getContext())
|
||||
HashMap<String, Object> data = KeyRepository.create(getContext())
|
||||
.getUnifiedData(
|
||||
masterKeyId, new String[]{
|
||||
KeychainContract.KeyRings.NAME,
|
||||
|
||||
@@ -170,7 +170,7 @@ public class EditIdentitiesFragment extends Fragment
|
||||
try {
|
||||
Uri secretUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
CachedPublicKeyRing keyRing =
|
||||
KeyRepository.createDatabaseInteractor(getContext()).getCachedPublicKeyRing(secretUri);
|
||||
KeyRepository.create(getContext()).getCachedPublicKeyRing(secretUri);
|
||||
long masterKeyId = keyRing.getMasterKeyId();
|
||||
|
||||
// check if this is a master secret key we can work with
|
||||
|
||||
@@ -201,7 +201,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
||||
try {
|
||||
Uri secretUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
CachedPublicKeyRing keyRing =
|
||||
KeyRepository.createDatabaseInteractor(getContext()).getCachedPublicKeyRing(secretUri);
|
||||
KeyRepository.create(getContext()).getCachedPublicKeyRing(secretUri);
|
||||
long masterKeyId = keyRing.getMasterKeyId();
|
||||
|
||||
// check if this is a master secret key we can work with
|
||||
|
||||
@@ -118,7 +118,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mKeyRepository = KeyRepository.createDatabaseInteractor(getContext());
|
||||
mKeyRepository = KeyRepository.create(getContext());
|
||||
|
||||
// preselect keys given, from state or arguments
|
||||
if (savedInstanceState == null) {
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
@@ -47,34 +51,28 @@ import com.futuremind.recyclerviewfastscroll.FastScroller;
|
||||
import com.getbase.floatingactionbutton.FloatingActionButton;
|
||||
import com.getbase.floatingactionbutton.FloatingActionsMenu;
|
||||
import com.tonicartos.superslim.LayoutManager;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
import org.sufficientlysecure.keychain.operations.results.BenchmarkResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ConsolidateResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.service.BenchmarkInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.ConsolidateInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeySectionedListAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
import org.sufficientlysecure.keychain.ui.base.RecyclerFragment;
|
||||
import org.sufficientlysecure.keychain.ui.keyview.ViewKeyActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.ui.base.RecyclerFragment;
|
||||
import org.sufficientlysecure.keychain.util.FabContainer;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
implements SearchView.OnQueryTextListener,
|
||||
LoaderManager.LoaderCallbacks<Cursor>, FabContainer {
|
||||
@@ -97,9 +95,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
private HkpKeyserverAddress mKeyserver;
|
||||
private CryptoOperationHelper<ImportKeyringParcel, ImportKeyResult> mImportOpHelper;
|
||||
|
||||
// for ConsolidateOperation
|
||||
private CryptoOperationHelper<ConsolidateInputParcel, ConsolidateResult> mConsolidateOpHelper;
|
||||
|
||||
// Callbacks related to listview and menu events
|
||||
private final ActionMode.Callback mActionCallback
|
||||
= new ActionMode.Callback() {
|
||||
@@ -334,7 +329,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
inflater.inflate(R.menu.key_list, menu);
|
||||
|
||||
if (Constants.DEBUG) {
|
||||
menu.findItem(R.id.menu_key_list_debug_cons).setVisible(true);
|
||||
menu.findItem(R.id.menu_key_list_debug_bench).setVisible(true);
|
||||
menu.findItem(R.id.menu_key_list_debug_read).setVisible(true);
|
||||
menu.findItem(R.id.menu_key_list_debug_write).setVisible(true);
|
||||
@@ -413,10 +407,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
getActivity().finish();
|
||||
return true;
|
||||
}
|
||||
case R.id.menu_key_list_debug_cons: {
|
||||
consolidate();
|
||||
return true;
|
||||
}
|
||||
case R.id.menu_key_list_debug_bench: {
|
||||
benchmark();
|
||||
return true;
|
||||
@@ -487,7 +477,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
}
|
||||
|
||||
KeyRepository keyRepository =
|
||||
KeyRepository.createDatabaseInteractor(getContext());
|
||||
KeyRepository.create(getContext());
|
||||
Cursor cursor = keyRepository.getContentResolver().query(
|
||||
KeyRings.buildUnifiedKeyRingsUri(), new String[]{
|
||||
KeyRings.FINGERPRINT
|
||||
@@ -547,39 +537,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
mImportOpHelper.cryptoOperation();
|
||||
}
|
||||
|
||||
private void consolidate() {
|
||||
CryptoOperationHelper.Callback<ConsolidateInputParcel, ConsolidateResult> callback
|
||||
= new CryptoOperationHelper.Callback<ConsolidateInputParcel, ConsolidateResult>() {
|
||||
|
||||
@Override
|
||||
public ConsolidateInputParcel createOperationInput() {
|
||||
return ConsolidateInputParcel.createConsolidateInputParcel(false); // we want to perform a full consolidate
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationSuccess(ConsolidateResult result) {
|
||||
result.createNotify(getActivity()).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationCancelled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCryptoOperationError(ConsolidateResult result) {
|
||||
result.createNotify(getActivity()).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCryptoSetProgress(String msg, int progress, int max) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
mConsolidateOpHelper = new CryptoOperationHelper<>(2, this, callback, R.string.progress_importing);
|
||||
mConsolidateOpHelper.cryptoOperation();
|
||||
}
|
||||
|
||||
private void benchmark() {
|
||||
CryptoOperationHelper.Callback<BenchmarkInputParcel, BenchmarkResult> callback
|
||||
= new CryptoOperationHelper.Callback<BenchmarkInputParcel, BenchmarkResult>() {
|
||||
@@ -619,10 +576,6 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
mImportOpHelper.handleActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
if (mConsolidateOpHelper != null) {
|
||||
mConsolidateOpHelper.handleActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
switch (requestCode) {
|
||||
case REQUEST_DELETE: {
|
||||
if (mActionMode != null) {
|
||||
|
||||
@@ -112,7 +112,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
// handle empty passphrases by directly returning an empty crypto input parcel
|
||||
try {
|
||||
CachedPublicKeyRing pubRing =
|
||||
KeyRepository.createDatabaseInteractor(this).getCachedPublicKeyRing(requiredInput.getMasterKeyId());
|
||||
KeyRepository.create(this).getCachedPublicKeyRing(requiredInput.getMasterKeyId());
|
||||
// use empty passphrase for empty passphrase
|
||||
if (pubRing.getSecretKeyType(requiredInput.getSubKeyId()) == SecretKeyType.PASSPHRASE_EMPTY) {
|
||||
// also return passphrase back to activity
|
||||
@@ -234,7 +234,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
long subKeyId = mRequiredInput.getSubKeyId();
|
||||
|
||||
KeyRepository helper =
|
||||
KeyRepository.createDatabaseInteractor(getContext());
|
||||
KeyRepository.create(getContext());
|
||||
CachedPublicKeyRing cachedPublicKeyRing = helper.getCachedPublicKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(subKeyId));
|
||||
// yes the inner try/catch block is necessary, otherwise the final variable
|
||||
@@ -454,7 +454,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
Long subKeyId = mRequiredInput.getSubKeyId();
|
||||
CanonicalizedSecretKeyRing secretKeyRing =
|
||||
KeyRepository.createDatabaseInteractor(getContext()).getCanonicalizedSecretKeyRing(
|
||||
KeyRepository.create(getContext()).getCanonicalizedSecretKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(subKeyId));
|
||||
CanonicalizedSecretKey secretKeyToUnlock =
|
||||
secretKeyRing.getSecretKey(subKeyId);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class QrCodeViewActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
KeyRepository keyRepository = KeyRepository.createDatabaseInteractor(this);
|
||||
KeyRepository keyRepository = KeyRepository.create(this);
|
||||
try {
|
||||
byte[] blob = keyRepository.getCachedPublicKeyRing(dataUri).getFingerprint();
|
||||
if (blob == null) {
|
||||
|
||||
@@ -106,7 +106,7 @@ public class SafeSlingerActivity extends BaseActivity
|
||||
// retrieve public key blob and start SafeSlinger
|
||||
Uri uri = KeychainContract.KeyRingData.buildPublicKeyRingUri(masterKeyId);
|
||||
try {
|
||||
byte[] keyBlob = KeyRepository.createDatabaseInteractor(this).getCachedPublicKeyRing(uri).getEncoded();
|
||||
byte[] keyBlob = KeyRepository.create(this).getCachedPublicKeyRing(uri).getEncoded();
|
||||
|
||||
Intent slingerIntent = new Intent(this, ExchangeActivity.class);
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
}
|
||||
|
||||
KeyRepository keyRepository =
|
||||
KeyRepository.createDatabaseInteractor(this);
|
||||
KeyRepository.create(this);
|
||||
CanonicalizedPublicKeyRing publicKeyRing;
|
||||
try {
|
||||
publicKeyRing = keyRepository.getCanonicalizedPublicKeyRing(
|
||||
@@ -237,7 +237,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
mSecurityTokenHelper.setAdminPin(new Passphrase("12345678"));
|
||||
|
||||
KeyRepository keyRepository =
|
||||
KeyRepository.createDatabaseInteractor(this);
|
||||
KeyRepository.create(this);
|
||||
CanonicalizedSecretKeyRing secretKeyRing;
|
||||
try {
|
||||
secretKeyRing = keyRepository.getCanonicalizedSecretKeyRing(
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SettingsKeyserverFragment extends Fragment implements RecyclerItemC
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
|
||||
savedInstanceState) {
|
||||
databaseReadWriteInteractor = KeyWritableRepository.createDatabaseReadWriteInteractor(getContext());
|
||||
databaseReadWriteInteractor = KeyWritableRepository.create(getContext());
|
||||
|
||||
return inflater.inflate(R.layout.settings_keyserver_fragment, null);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ViewCertActivity extends BaseActivity
|
||||
|
||||
try {
|
||||
KeyRepository keyRepository =
|
||||
KeyRepository.createDatabaseInteractor(ViewCertActivity.this);
|
||||
KeyRepository.create(ViewCertActivity.this);
|
||||
long signerMasterKeyId = keyRepository.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mCertifierKeyId)).getMasterKeyId();
|
||||
viewIntent.setData(KeyRings.buildGenericKeyRingUri(signerMasterKeyId));
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
}
|
||||
});
|
||||
|
||||
mKeyRepository = KeyRepository.createDatabaseInteractor(this);
|
||||
mKeyRepository = KeyRepository.create(this);
|
||||
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tab_layout);
|
||||
|
||||
@@ -181,7 +181,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
private void startSafeSlinger(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = KeyRepository.createDatabaseInteractor(getContext())
|
||||
keyId = KeyRepository.create(getContext())
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
@@ -198,7 +198,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
return;
|
||||
}
|
||||
KeyRepository keyRepository =
|
||||
KeyRepository.createDatabaseInteractor(getContext());
|
||||
KeyRepository.create(getContext());
|
||||
|
||||
try {
|
||||
long masterKeyId = keyRepository.getCachedPublicKeyRing(mDataUri).extractOrGetMasterKeyId();
|
||||
@@ -436,7 +436,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
private void uploadToKeyserver() {
|
||||
long keyId;
|
||||
try {
|
||||
keyId = KeyRepository.createDatabaseInteractor(getContext())
|
||||
keyId = KeyRepository.create(getContext())
|
||||
.getCachedPublicKeyRing(mDataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
mListener = listener;
|
||||
mNonInteractive = nonInteractive;
|
||||
|
||||
mKeyRepository = KeyRepository.createDatabaseInteractor(activity);
|
||||
mKeyRepository = KeyRepository.create(activity);
|
||||
}
|
||||
|
||||
public void setData(List<ImportKeysListEntry> data) {
|
||||
|
||||
@@ -467,7 +467,7 @@ public class LinkedIdViewFragment extends CryptoOperationFragment implements
|
||||
|
||||
byte[] fingerprint;
|
||||
try {
|
||||
fingerprint = KeyRepository.createDatabaseInteractor(activity).getCachedPublicKeyRing(
|
||||
fingerprint = KeyRepository.create(activity).getCachedPublicKeyRing(
|
||||
mMasterKeyId).getFingerprint();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
throw new IllegalStateException("Key to verify linked id for must exist in db!");
|
||||
|
||||
@@ -175,7 +175,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mKeyRepository = KeyRepository.createDatabaseInteractor(this);
|
||||
mKeyRepository = KeyRepository.create(this);
|
||||
mImportOpHelper = new CryptoOperationHelper<>(1, this, this, null);
|
||||
|
||||
setTitle(null);
|
||||
@@ -656,7 +656,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
return;
|
||||
}
|
||||
try {
|
||||
long keyId = KeyRepository.createDatabaseInteractor(this)
|
||||
long keyId = KeyRepository.create(this)
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
long[] encryptionKeyIds = new long[]{keyId};
|
||||
@@ -680,7 +680,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
private void startSafeSlinger(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = KeyRepository.createDatabaseInteractor(this)
|
||||
keyId = KeyRepository.create(this)
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LinkedIdWizard extends BaseActivity {
|
||||
try {
|
||||
Uri uri = getIntent().getData();
|
||||
uri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(uri);
|
||||
CachedPublicKeyRing ring = KeyRepository.createDatabaseInteractor(this).getCachedPublicKeyRing(uri);
|
||||
CachedPublicKeyRing ring = KeyRepository.create(this).getCachedPublicKeyRing(uri);
|
||||
if (!ring.hasAnySecret()) {
|
||||
Log.e(Constants.TAG, "Linked Identities can only be added to secret keys!");
|
||||
finish();
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class PublicKeyRetrievalLoader extends AsyncTaskLoader<KeyRetrie
|
||||
LocalKeyLookupLoader(Context context, List<byte[]> fingerprints) {
|
||||
super(context, fingerprints);
|
||||
|
||||
this.keyRepository = KeyRepository.createDatabaseInteractor(context);
|
||||
this.keyRepository = KeyRepository.create(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TransferPresenter implements KeyTransferCallback, LoaderCallbacks<L
|
||||
this.view = view;
|
||||
this.loaderManager = loaderManager;
|
||||
this.loaderId = loaderId;
|
||||
this.databaseInteractor = KeyRepository.createDatabaseInteractor(context);
|
||||
this.databaseInteractor = KeyRepository.create(context);
|
||||
|
||||
secretKeyAdapter = new TransferKeyAdapter(context, LayoutInflater.from(context), this);
|
||||
view.setSecretKeyAdapter(secretKeyAdapter);
|
||||
|
||||
Reference in New Issue
Block a user