more data in RequiredInputParcel, OperationResult notifications

- pass both masterkeyid and subkeyid though RequiredInputParcel parcel
- fix numeric vales in OperationResult.createNotify()
This commit is contained in:
Vincent Breitmoser
2015-03-21 15:16:32 +01:00
parent 88ca41d555
commit 93c7eb72fb
7 changed files with 110 additions and 36 deletions

View File

@@ -81,7 +81,7 @@ public class CertifyOperation extends BaseOperation {
if (!cryptoInput.hasPassphrase()) {
return new CertifyResult(log, RequiredInputParcel.createRequiredPassphrase(
certificationKey.getKeyId(), null));
certificationKey.getKeyId(), certificationKey.getKeyId(), null));
}
// certification is always with the master key id, so use that one
@@ -105,7 +105,9 @@ public class CertifyOperation extends BaseOperation {
int certifyOk = 0, certifyError = 0, uploadOk = 0, uploadError = 0;
NfcSignOperationsBuilder allRequiredInput = new NfcSignOperationsBuilder(cryptoInput.getSignatureTime());
NfcSignOperationsBuilder allRequiredInput = new NfcSignOperationsBuilder(
cryptoInput.getSignatureTime(), certificationKey.getKeyId(),
certificationKey.getKeyId());
// Work through all requested certifications
for (CertifyAction action : parcel.mCertifyActions) {

View File

@@ -31,13 +31,18 @@ public class EditKeyResult extends OperationResult {
public EditKeyResult(Parcel source) {
super(source);
mMasterKeyId = source.readLong();
mMasterKeyId = source.readInt() != 0 ? source.readLong() : null;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeLong(mMasterKeyId);
if (mMasterKeyId != null) {
dest.writeInt(1);
dest.writeLong(mMasterKeyId);
} else {
dest.writeInt(0);
}
}
public static Creator<EditKeyResult> CREATOR = new Creator<EditKeyResult>() {

View File

@@ -250,12 +250,20 @@ public abstract class OperationResult implements Parcelable {
public Showable createNotify(final Activity activity) {
Log.d(Constants.TAG, "mLog.getLast()"+mLog.getLast());
Log.d(Constants.TAG, "mLog.getLast().mType"+mLog.getLast().mType);
Log.d(Constants.TAG, "mLog.getLast().mType.getMsgId()"+mLog.getLast().mType.getMsgId());
// Take the last message as string
int msgId = mLog.getLast().mType.getMsgId();
String logText;
LogEntryParcel entryParcel = mLog.getLast();
// special case: first parameter may be a quantity
if (entryParcel.mParameters != null && entryParcel.mParameters.length > 0
&& entryParcel.mParameters[0] instanceof Integer) {
logText = activity.getResources().getQuantityString(entryParcel.mType.getMsgId(),
(Integer) entryParcel.mParameters[0],
entryParcel.mParameters);
} else {
logText = activity.getString(entryParcel.mType.getMsgId(),
entryParcel.mParameters);
}
Style style;
@@ -273,10 +281,10 @@ public abstract class OperationResult implements Parcelable {
}
if (getLog() == null || getLog().isEmpty()) {
return Notify.createNotify(activity, msgId, Notify.LENGTH_LONG, style);
return Notify.createNotify(activity, logText, Notify.LENGTH_LONG, style);
}
return Notify.createNotify(activity, msgId, Notify.LENGTH_LONG, style,
return Notify.createNotify(activity, logText, Notify.LENGTH_LONG, style,
new ActionListener() {
@Override
public void onAction() {