convert viewer and linkedItemLabel to room entities

This commit is contained in:
Satindar Dhillon
2023-01-03 10:49:37 -08:00
parent abb5eade24
commit 4bf48e5e5e
4 changed files with 19 additions and 7 deletions

View File

@ -10,10 +10,10 @@ suspend fun Networker.viewer(): Viewer? {
return if (me != null) {
Viewer(
id = me.id,
userID = me.id,
name = me.name,
username = me.profile.username,
pictureUrl = me.profile.pictureUrl
profileImageURL = me.profile.pictureUrl
)
} else {
null

View File

@ -1,9 +1,17 @@
package app.omnivore.omnivore.persistence.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity
data class LinkedItemLabel(
val id: String,
@PrimaryKey val id: String,
val name: String,
val color: String,
val createdAt: Any?,
val createdAt: String?,
val labelDescription: String?,
val serverSyncStatus: Int = 0
)
// has many highlights
// has many linkedItems

View File

@ -1,9 +1,13 @@
package app.omnivore.omnivore.persistence.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity
data class Viewer(
val id: String,
@PrimaryKey val userID: String,
val name: String,
val username: String,
val pictureUrl: String?,
val profileImageURL: String?,
)

View File

@ -100,7 +100,7 @@ class LoginViewModel @Inject constructor(
viewModelScope.launch {
val viewer = networker.viewer()
viewer?.let {
eventTracker.registerUser(viewer.id)
eventTracker.registerUser(viewer.userID)
}
}
}