2019-04-28 22:43:52 +02:00
|
|
|
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
|
2019-04-28 22:43:52 +02:00
|
|
|
|
|
|
|
data class StreamHistoryEntry(
|
2020-05-01 20:13:21 +02:00
|
|
|
@Embedded
|
|
|
|
val streamEntity: StreamEntity,
|
2019-04-28 22:43:52 +02:00
|
|
|
|
2020-05-01 20:13:21 +02:00
|
|
|
@ColumnInfo(name = StreamHistoryEntity.JOIN_STREAM_ID)
|
|
|
|
val streamId: Long,
|
2019-04-28 22:43:52 +02:00
|
|
|
|
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,
|
2019-04-28 22:43:52 +02:00
|
|
|
|
2020-05-01 20:13:21 +02:00
|
|
|
@ColumnInfo(name = StreamHistoryEntity.STREAM_REPEAT_COUNT)
|
|
|
|
val repeatCount: Long
|
2019-04-28 22:43:52 +02:00
|
|
|
) {
|
|
|
|
|
|
|
|
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)
|
2019-04-28 22:43:52 +02:00
|
|
|
}
|
|
|
|
}
|