"unverified" repo state for repos w/ fingerprints but not yet pubkeys
If a repo was configured with a fingerprint, but it has not yet updated and gotten the pubkey from the index.jar, then it will be in an "unverified" state, i.e. the signing key fingerprint is stored, but it has not yet been used to check against the pubkey in the index.jar
This commit is contained in:
parent
a0970d0720
commit
cce393de09
@ -2,4 +2,5 @@
|
||||
<resources>
|
||||
<color name="signed">#ffcccccc</color>
|
||||
<color name="unsigned">#ffCC0000</color>
|
||||
<color name="unverified">#ff999999</color>
|
||||
</resources>
|
@ -176,6 +176,7 @@
|
||||
<string name="compactlayout_off">Show icons at regular size</string>
|
||||
<string name="theme">Theme</string>
|
||||
<string name="unsigned">Unsigned</string>
|
||||
<string name="unverified">Unverified</string>
|
||||
<string name="repo_url">URL</string>
|
||||
<string name="repo_num_apps">Number of apps</string>
|
||||
<string name="repo_fingerprint">Fingerprint of Repo Signing Key (SHA-256)</string>
|
||||
|
@ -2,6 +2,7 @@ package org.fdroid.fdroid.data;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
|
||||
@ -78,7 +79,13 @@ public class Repo extends ValueObject {
|
||||
}
|
||||
|
||||
public boolean isSigned() {
|
||||
return this.pubkey != null && this.pubkey.length() > 0;
|
||||
return !TextUtils.isEmpty(this.pubkey);
|
||||
}
|
||||
|
||||
// this happens when a repo is configed with a fingerprint, but the client
|
||||
// has not connected to it yet to download its pubkey
|
||||
public boolean isSignedButUnverified() {
|
||||
return TextUtils.isEmpty(this.pubkey) && !TextUtils.isEmpty(this.fingerprint);
|
||||
}
|
||||
|
||||
public boolean hasBeenUpdated() {
|
||||
|
@ -97,10 +97,16 @@ public class RepoAdapter extends CursorAdapter {
|
||||
|
||||
// If we set the signed view to GONE instead of INVISIBLE, then the
|
||||
// height of each list item varies.
|
||||
View signedView = view.findViewById(R.id.repo_unsigned);
|
||||
TextView signedView = (TextView) view.findViewById(R.id.repo_unsigned);
|
||||
if (repo.isSigned()) {
|
||||
signedView.setVisibility(View.INVISIBLE);
|
||||
} else if (repo.isSignedButUnverified()) {
|
||||
signedView.setText(R.string.unverified);
|
||||
signedView.setTextColor(view.getResources().getColor(R.color.unverified));
|
||||
signedView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
signedView.setText(R.string.unsigned);
|
||||
signedView.setTextColor(view.getResources().getColor(R.color.unsigned));
|
||||
signedView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user