Avoid unnecessary changes to the upload date of saved streams
The upload date was being updated regardless if the new one had more precision or not, this caused items on the feed to jump around when the user opened one of them. This changes it to only update when the existent upload date is null or the new one has a higher precision (i.e. is not an approximation).
This commit is contained in:
parent
5653d443d9
commit
c726639484
1 changed files with 6 additions and 1 deletions
|
@ -80,7 +80,12 @@ abstract class StreamDAO : BasicDAO<StreamEntity> {
|
||||||
|
|
||||||
val isNewerStreamLive = newerStream.streamType == AUDIO_LIVE_STREAM || newerStream.streamType == LIVE_STREAM
|
val isNewerStreamLive = newerStream.streamType == AUDIO_LIVE_STREAM || newerStream.streamType == LIVE_STREAM
|
||||||
if (!isNewerStreamLive) {
|
if (!isNewerStreamLive) {
|
||||||
if (existentMinimalStream.uploadDate != null && existentMinimalStream.isUploadDateApproximation != true) {
|
|
||||||
|
// Use the existent upload date if the newer stream does not have a better precision
|
||||||
|
// (i.e. is an approximation). This is done to prevent unnecessary changes.
|
||||||
|
val hasBetterPrecision =
|
||||||
|
newerStream.uploadDate != null && newerStream.isUploadDateApproximation != true
|
||||||
|
if (existentMinimalStream.uploadDate != null && !hasBetterPrecision) {
|
||||||
newerStream.uploadDate = existentMinimalStream.uploadDate
|
newerStream.uploadDate = existentMinimalStream.uploadDate
|
||||||
newerStream.textualUploadDate = existentMinimalStream.textualUploadDate
|
newerStream.textualUploadDate = existentMinimalStream.textualUploadDate
|
||||||
newerStream.isUploadDateApproximation = existentMinimalStream.isUploadDateApproximation
|
newerStream.isUploadDateApproximation = existentMinimalStream.isUploadDateApproximation
|
||||||
|
|
Loading…
Reference in a new issue