rename ProviderHelper -> DatabaseInteractor
This commit is contained in:
@@ -66,7 +66,7 @@ import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAccounts;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.remote.OpenPgpServiceKeyIdExtractor.KeyIdResult;
|
||||
import org.sufficientlysecure.keychain.service.BackupKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
@@ -88,7 +88,7 @@ public class OpenPgpService extends Service {
|
||||
Collections.unmodifiableList(Arrays.asList(3, 4, 5, 6, 7, 8, 9, 10, 11));
|
||||
|
||||
private ApiPermissionHelper mApiPermissionHelper;
|
||||
private ProviderHelper mProviderHelper;
|
||||
private DatabaseInteractor mDatabaseInteractor;
|
||||
private ApiDataAccessObject mApiDao;
|
||||
private OpenPgpServiceKeyIdExtractor mKeyIdExtractor;
|
||||
private ApiPendingIntentFactory mApiPendingIntentFactory;
|
||||
@@ -97,7 +97,7 @@ public class OpenPgpService extends Service {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mApiPermissionHelper = new ApiPermissionHelper(this, new ApiDataAccessObject(this));
|
||||
mProviderHelper = new ProviderHelper(this);
|
||||
mDatabaseInteractor = new DatabaseInteractor(this);
|
||||
mApiDao = new ApiDataAccessObject(this);
|
||||
|
||||
mApiPendingIntentFactory = new ApiPendingIntentFactory(getBaseContext());
|
||||
@@ -135,7 +135,7 @@ public class OpenPgpService extends Service {
|
||||
|
||||
// get first usable subkey capable of signing
|
||||
try {
|
||||
long signSubKeyId = mProviderHelper.getCachedPublicKeyRing(
|
||||
long signSubKeyId = mDatabaseInteractor.getCachedPublicKeyRing(
|
||||
pgpData.getSignatureMasterKeyId()).getSecretSignId();
|
||||
pgpData.setSignatureSubKeyId(signSubKeyId);
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
@@ -167,7 +167,7 @@ public class OpenPgpService extends Service {
|
||||
}
|
||||
|
||||
// execute PGP operation!
|
||||
PgpSignEncryptOperation pse = new PgpSignEncryptOperation(this, new ProviderHelper(this), null);
|
||||
PgpSignEncryptOperation pse = new PgpSignEncryptOperation(this, new DatabaseInteractor(this), null);
|
||||
PgpSignEncryptResult pgpResult = pse.execute(pseInput, inputParcel, inputData, outputStream);
|
||||
|
||||
if (pgpResult.isPending()) {
|
||||
@@ -254,7 +254,7 @@ public class OpenPgpService extends Service {
|
||||
|
||||
// get first usable subkey capable of signing
|
||||
try {
|
||||
long signSubKeyId = mProviderHelper.getCachedPublicKeyRing(
|
||||
long signSubKeyId = mDatabaseInteractor.getCachedPublicKeyRing(
|
||||
pgpData.getSignatureMasterKeyId()).getSecretSignId();
|
||||
pgpData.setSignatureSubKeyId(signSubKeyId);
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
@@ -294,7 +294,7 @@ public class OpenPgpService extends Service {
|
||||
new Passphrase(data.getCharArrayExtra(OpenPgpApi.EXTRA_PASSPHRASE));
|
||||
}
|
||||
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(this, mProviderHelper, null);
|
||||
PgpSignEncryptOperation op = new PgpSignEncryptOperation(this, mDatabaseInteractor, null);
|
||||
|
||||
// execute PGP operation!
|
||||
PgpSignEncryptResult pgpResult = op.execute(pseInput, inputParcel, inputData, outputStream);
|
||||
@@ -356,7 +356,7 @@ public class OpenPgpService extends Service {
|
||||
byte[] detachedSignature = data.getByteArrayExtra(OpenPgpApi.EXTRA_DETACHED_SIGNATURE);
|
||||
String senderAddress = data.getStringExtra(OpenPgpApi.EXTRA_SENDER_ADDRESS);
|
||||
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(this, mProviderHelper, progressable);
|
||||
PgpDecryptVerifyOperation op = new PgpDecryptVerifyOperation(this, mDatabaseInteractor, progressable);
|
||||
|
||||
long inputLength = data.getLongExtra(OpenPgpApi.EXTRA_DATA_LENGTH, InputData.UNKNOWN_FILESIZE);
|
||||
InputData inputData = new InputData(inputStream, inputLength);
|
||||
@@ -526,7 +526,7 @@ public class OpenPgpService extends Service {
|
||||
try {
|
||||
// try to find key, throws NotFoundException if not in db!
|
||||
CanonicalizedPublicKeyRing keyRing =
|
||||
mProviderHelper.getCanonicalizedPublicKeyRing(
|
||||
mDatabaseInteractor.getCanonicalizedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(masterKeyId));
|
||||
|
||||
Intent result = new Intent();
|
||||
@@ -555,7 +555,7 @@ public class OpenPgpService extends Service {
|
||||
mApiPendingIntentFactory.createShowKeyPendingIntent(data, masterKeyId));
|
||||
|
||||
return result;
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
// If keys are not in db we return an additional PendingIntent
|
||||
// to retrieve the missing key
|
||||
Intent result = new Intent();
|
||||
@@ -630,7 +630,7 @@ public class OpenPgpService extends Service {
|
||||
// the backup code is cached in CryptoInputParcelCacheService, now we can proceed
|
||||
|
||||
BackupKeyringParcel input = new BackupKeyringParcel(masterKeyIds, backupSecret, true, enableAsciiArmorOutput, null);
|
||||
BackupOperation op = new BackupOperation(this, mProviderHelper, null);
|
||||
BackupOperation op = new BackupOperation(this, mDatabaseInteractor, null);
|
||||
ExportResult pgpResult = op.execute(input, inputParcel, outputStream);
|
||||
|
||||
if (pgpResult.success()) {
|
||||
|
||||
@@ -16,8 +16,8 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.ApiDataAccessObject;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper;
|
||||
import org.sufficientlysecure.keychain.remote.ApiPermissionHelper.WrongPackageCertificateException;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -33,26 +33,26 @@ class RequestKeyPermissionPresenter {
|
||||
|
||||
private String packageName;
|
||||
private long masterKeyId;
|
||||
private ProviderHelper providerHelper;
|
||||
private DatabaseInteractor databaseInteractor;
|
||||
|
||||
|
||||
static RequestKeyPermissionPresenter createRequestKeyPermissionPresenter(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
ApiDataAccessObject apiDataAccessObject = new ApiDataAccessObject(context);
|
||||
ApiPermissionHelper apiPermissionHelper = new ApiPermissionHelper(context, apiDataAccessObject);
|
||||
ProviderHelper providerHelper = new ProviderHelper(context);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(context);
|
||||
|
||||
return new RequestKeyPermissionPresenter(context, apiDataAccessObject, apiPermissionHelper, packageManager,
|
||||
providerHelper);
|
||||
databaseInteractor);
|
||||
}
|
||||
|
||||
private RequestKeyPermissionPresenter(Context context, ApiDataAccessObject apiDataAccessObject,
|
||||
ApiPermissionHelper apiPermissionHelper, PackageManager packageManager, ProviderHelper providerHelper) {
|
||||
ApiPermissionHelper apiPermissionHelper, PackageManager packageManager, DatabaseInteractor databaseInteractor) {
|
||||
this.context = context;
|
||||
this.apiDataAccessObject = apiDataAccessObject;
|
||||
this.apiPermissionHelper = apiPermissionHelper;
|
||||
this.packageManager = packageManager;
|
||||
this.providerHelper = providerHelper;
|
||||
this.databaseInteractor = databaseInteractor;
|
||||
}
|
||||
|
||||
void setView(RequestKeyPermissionMvpView view) {
|
||||
@@ -101,7 +101,7 @@ class RequestKeyPermissionPresenter {
|
||||
CachedPublicKeyRing publicFallbackRing = null;
|
||||
for (long candidateSubKeyId : subKeyIds) {
|
||||
try {
|
||||
CachedPublicKeyRing cachedPublicKeyRing = providerHelper.getCachedPublicKeyRing(
|
||||
CachedPublicKeyRing cachedPublicKeyRing = databaseInteractor.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(candidateSubKeyId)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user