fix publish release time and crash bug on publish form
This commit is contained in:
parent
3283b3a607
commit
ddeb209d51
3 changed files with 18 additions and 1 deletions
|
@ -44,7 +44,7 @@ public class InlineChannelSpinnerAdapter extends ArrayAdapter<Claim> {
|
||||||
public int getItemPosition(Claim item) {
|
public int getItemPosition(Claim item) {
|
||||||
for (int i = 0; i < channels.size(); i++) {
|
for (int i = 0; i < channels.size(); i++) {
|
||||||
Claim channel = channels.get(i);
|
Claim channel = channels.get(i);
|
||||||
if (item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
if (item.getClaimId() != null && item.getClaimId().equalsIgnoreCase(channel.getClaimId())) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,14 @@ public class PublishClaimTask extends AsyncTask<Void, Void, Claim> {
|
||||||
options.put("license_url", metadata.getLicenseUrl());
|
options.put("license_url", metadata.getLicenseUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (metadata.getReleaseTime() > 0) {
|
||||||
|
options.put("release_time", metadata.getReleaseTime());
|
||||||
|
} else if (claim.getTimestamp() > 0) {
|
||||||
|
options.put("release_time", claim.getTimestamp());
|
||||||
|
} else {
|
||||||
|
options.put("release_time", Double.valueOf(Math.floor(System.currentTimeMillis() / 1000.0)).intValue());
|
||||||
|
}
|
||||||
|
|
||||||
Claim claimResult = null;
|
Claim claimResult = null;
|
||||||
try {
|
try {
|
||||||
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PUBLISH, options);
|
JSONObject result = (JSONObject) Lbry.genericApiCall(Lbry.METHOD_PUBLISH, options);
|
||||||
|
|
|
@ -1038,6 +1038,15 @@ public class PublishFormFragment extends BaseFragment implements
|
||||||
metadata.setLicenseUrl(selectedLicense.getUrl());
|
metadata.setLicenseUrl(selectedLicense.getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set release time from current claim (on edit)
|
||||||
|
if (currentClaim != null) {
|
||||||
|
Claim.StreamMetadata currentMetadata = (Claim.StreamMetadata) currentClaim.getValue();
|
||||||
|
metadata.setReleaseTime(currentMetadata.getReleaseTime());
|
||||||
|
if (metadata.getReleaseTime() == 0) {
|
||||||
|
metadata.setReleaseTime(currentClaim.getTimestamp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
claim.setValueType(Claim.TYPE_STREAM);
|
claim.setValueType(Claim.TYPE_STREAM);
|
||||||
claim.setValue(metadata);
|
claim.setValue(metadata);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue