use Enum for verification status of certificates
This commit is contained in:
@@ -43,6 +43,7 @@ import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
||||
import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
import org.sufficientlysecure.keychain.model.UserPacket.UserId;
|
||||
import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing.VerificationStatus;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.ViewKeyAdvActivity.ViewKeyAdvViewModel;
|
||||
@@ -155,7 +156,7 @@ public class ViewKeyAdvUserIdsFragment extends Fragment {
|
||||
private void showUserIdInfo(final int position) {
|
||||
|
||||
final boolean isRevoked = mUserIdsAdapter.getIsRevoked(position);
|
||||
final boolean isVerified = mUserIdsAdapter.getIsVerified(position) == Certs.VERIFIED_SECRET;
|
||||
final boolean isVerified = mUserIdsAdapter.getVerificationStatus(position) == VerificationStatus.VERIFIED_SECRET;
|
||||
|
||||
DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(() -> {
|
||||
UserIdInfoDialogFragment dialogFragment =
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.sufficientlysecure.keychain.keyimport.processing.ImportKeysResultList
|
||||
import org.sufficientlysecure.keychain.operations.ImportOperation;
|
||||
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing.VerificationStatus;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||
@@ -94,7 +95,8 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
keyRing = mKeyRepository.getCachedPublicKeyRing(keyId);
|
||||
}
|
||||
keyState.mAlreadyPresent = true;
|
||||
keyState.mVerified = keyRing.getVerified() > 0;
|
||||
VerificationStatus verified = keyRing.getVerified();
|
||||
keyState.mVerified = verified != null && verified != VerificationStatus.UNVERIFIED;
|
||||
} catch (KeyRepository.NotFoundException | PgpKeyNotFoundException ignored) {
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import android.widget.ViewAnimator;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.model.UserPacket.UserId;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing.VerificationStatus;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State;
|
||||
@@ -163,12 +163,12 @@ public class UserIdsAdapter extends BaseAdapter {
|
||||
vAddress.setTypeface(null, Typeface.NORMAL);
|
||||
}
|
||||
|
||||
int isVerified = getIsVerified(position);
|
||||
VerificationStatus isVerified = getVerificationStatus(position);
|
||||
switch (isVerified) {
|
||||
case Certs.VERIFIED_SECRET:
|
||||
case VERIFIED_SECRET:
|
||||
KeyFormattingUtils.setStatusImage(context, vVerified, null, State.VERIFIED, KeyFormattingUtils.DEFAULT_COLOR);
|
||||
break;
|
||||
case Certs.VERIFIED_SELF:
|
||||
case VERIFIED_SELF:
|
||||
KeyFormattingUtils.setStatusImage(context, vVerified, null, State.UNVERIFIED, KeyFormattingUtils.DEFAULT_COLOR);
|
||||
break;
|
||||
default:
|
||||
@@ -216,7 +216,7 @@ public class UserIdsAdapter extends BaseAdapter {
|
||||
return data.get(position).is_revoked();
|
||||
}
|
||||
|
||||
public int getIsVerified(int position) {
|
||||
public VerificationStatus getVerificationStatus(int position) {
|
||||
return data.get(position).verified();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user