extract select by signer from KeychainProvider

This commit is contained in:
Vincent Breitmoser
2018-06-22 19:58:17 +02:00
parent 6cd065a3bd
commit d57a409fac
13 changed files with 87 additions and 128 deletions

View File

@@ -196,7 +196,8 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
try {
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
long masterKeyId = KeyRepository.create(getContext()).getCachedPublicKeyRing(
KeyRepository keyRepository = KeyRepository.create(requireContext());
long masterKeyId = keyRepository.getCachedPublicKeyRing(
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId)
).getMasterKeyId();
viewKeyIntent.setData(KeyRings.buildGenericKeyRingUri(masterKeyId));

View File

@@ -86,7 +86,8 @@ 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.create(this).getUnifiedData(
KeyRepository keyRepository = KeyRepository.create(this);
HashMap<String, Object> data = keyRepository.getUnifiedData(
mMasterKeyIds[0], new String[]{
KeychainContract.KeyRings.NAME,
KeychainContract.KeyRings.IS_REVOKED

View File

@@ -58,11 +58,11 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
import org.sufficientlysecure.keychain.keysync.KeyserverSyncManager;
import org.sufficientlysecure.keychain.livedata.KeyRingDao;
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
import org.sufficientlysecure.keychain.operations.results.BenchmarkResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.pgp.PgpHelper;
import org.sufficientlysecure.keychain.provider.KeyRepository;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.service.BenchmarkInputParcel;
@@ -256,18 +256,18 @@ public class KeyListFragment extends RecyclerFragment<FlexibleAdapter<FlexibleKe
}
public static class KeyListLiveData extends AsyncTaskLiveData<List<FlexibleKeyItem>> {
private final KeyRingDao keyRingDao;
private final KeyRepository keyRepository;
private FlexibleKeyItemFactory flexibleKeyItemFactory;
KeyListLiveData(@NonNull Context context) {
super(context, KeyRings.CONTENT_URI);
keyRingDao = KeyRingDao.getInstance(context.getApplicationContext());
keyRepository = KeyRepository.create(context.getApplicationContext());
flexibleKeyItemFactory = new FlexibleKeyItemFactory(context.getResources());
}
@Override
protected List<FlexibleKeyItem> asyncLoadData() {
List<UnifiedKeyInfo> unifiedKeyInfo = keyRingDao.getUnifiedKeyInfo();
List<UnifiedKeyInfo> unifiedKeyInfo = keyRepository.getUnifiedKeyInfo();
return flexibleKeyItemFactory.mapUnifiedKeyInfoToFlexibleKeyItems(unifiedKeyInfo);
}
}