extract LastUpdateInteractor from KeyRepository
This commit is contained in:
@@ -37,6 +37,7 @@ import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.provider.LastUpdateInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ContactSyncAdapterService;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
|
||||
@@ -56,10 +57,14 @@ import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
*
|
||||
*/
|
||||
public class EditKeyOperation extends BaseReadWriteOperation<SaveKeyringParcel> {
|
||||
private final LastUpdateInteractor lastUpdateInteractor;
|
||||
|
||||
|
||||
public EditKeyOperation(Context context, KeyWritableRepository databaseInteractor,
|
||||
Progressable progressable, AtomicBoolean cancelled) {
|
||||
super(context, databaseInteractor, progressable, cancelled);
|
||||
|
||||
this.lastUpdateInteractor = LastUpdateInteractor.create(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +172,7 @@ public class EditKeyOperation extends BaseReadWriteOperation<SaveKeyringParcel>
|
||||
log.add(saveResult, 1);
|
||||
|
||||
if (isNewKey) {
|
||||
mKeyWritableRepository.renewKeyLastUpdatedTime(ring.getMasterKeyId(), saveParcel.isShouldUpload());
|
||||
lastUpdateInteractor.renewKeyLastUpdatedTime(ring.getMasterKeyId(), saveParcel.isShouldUpload());
|
||||
}
|
||||
|
||||
// If the save operation didn't succeed, exit here
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.provider.LastUpdateInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ContactSyncAdapterService;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
@@ -88,16 +89,23 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
private static final int MAX_THREADS = 10;
|
||||
|
||||
public static final String CACHE_FILE_NAME = "key_import.pcl";
|
||||
|
||||
private final LastUpdateInteractor lastUpdateInteractor;
|
||||
|
||||
private FacebookKeyserverClient facebookServer;
|
||||
private KeybaseKeyserverClient keybaseServer;
|
||||
|
||||
public ImportOperation(Context context, KeyWritableRepository databaseInteractor, Progressable progressable) {
|
||||
super(context, databaseInteractor, progressable);
|
||||
|
||||
this.lastUpdateInteractor = LastUpdateInteractor.create(context);
|
||||
}
|
||||
|
||||
public ImportOperation(Context context, KeyWritableRepository databaseInteractor,
|
||||
Progressable progressable, AtomicBoolean cancelled) {
|
||||
super(context, databaseInteractor, progressable, cancelled);
|
||||
|
||||
this.lastUpdateInteractor = LastUpdateInteractor.create(context);
|
||||
}
|
||||
|
||||
// Overloaded functions for using progressable supplied in constructor during import
|
||||
@@ -192,7 +200,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
|
||||
byte[] fingerprintHex = entry.getExpectedFingerprint();
|
||||
if (fingerprintHex != null) {
|
||||
mKeyWritableRepository.renewKeyLastUpdatedTime(
|
||||
lastUpdateInteractor.renewKeyLastUpdatedTime(
|
||||
KeyFormattingUtils.getKeyIdFromFingerprint(fingerprintHex), false);
|
||||
}
|
||||
continue;
|
||||
@@ -242,7 +250,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
}
|
||||
|
||||
if (!skipSave) {
|
||||
mKeyWritableRepository.renewKeyLastUpdatedTime(key.getMasterKeyId(), keyWasDownloaded);
|
||||
lastUpdateInteractor.renewKeyLastUpdatedTime(key.getMasterKeyId(), keyWasDownloaded);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user