convert viewer and linkedItemLabel to room entities
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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?,
|
||||
)
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ class LoginViewModel @Inject constructor(
|
||||
viewModelScope.launch {
|
||||
val viewer = networker.viewer()
|
||||
viewer?.let {
|
||||
eventTracker.registerUser(viewer.id)
|
||||
eventTracker.registerUser(viewer.userID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user