NewPipe/app/src/main/java/org/schabi/newpipe/database/history/model/StreamHistoryEntry.kt

31 lines
914 B
Kotlin
Raw Normal View History

package org.schabi.newpipe.database.history.model
import androidx.room.ColumnInfo
import androidx.room.Embedded
2020-05-01 20:13:21 +02:00
import org.schabi.newpipe.database.stream.model.StreamEntity
2020-10-31 21:55:45 +01:00
import java.time.OffsetDateTime
data class StreamHistoryEntry(
2020-05-01 20:13:21 +02:00
@Embedded
val streamEntity: StreamEntity,
2020-05-01 20:13:21 +02:00
@ColumnInfo(name = StreamHistoryEntity.JOIN_STREAM_ID)
val streamId: Long,
2020-05-01 20:13:21 +02:00
@ColumnInfo(name = StreamHistoryEntity.STREAM_ACCESS_DATE)
2020-10-18 08:16:55 +02:00
val accessDate: OffsetDateTime,
2020-05-01 20:13:21 +02:00
@ColumnInfo(name = StreamHistoryEntity.STREAM_REPEAT_COUNT)
val repeatCount: Long
) {
fun toStreamHistoryEntity(): StreamHistoryEntity {
return StreamHistoryEntity(streamId, accessDate, repeatCount)
}
fun hasEqualValues(other: StreamHistoryEntry): Boolean {
return this.streamEntity.uid == other.streamEntity.uid && streamId == other.streamId &&
2020-10-31 21:55:45 +01:00
accessDate.isEqual(other.accessDate)
}
}