Update: Make Lock a data class

This commit is contained in:
machiav3lli 2022-02-01 01:12:51 +01:00
parent b57ff6e85e
commit c3468c466d
2 changed files with 6 additions and 13 deletions

View File

@ -30,20 +30,13 @@ object ProductPreferences {
db.lockDao.insert(*preferences.all.keys
.mapNotNull { pName ->
this@ProductPreferences[pName].databaseVersionCode?.let {
Lock().apply {
package_name = pName
version_code = it
}
Lock(pName, it)
}
}
.toTypedArray()
)
subject.collect { (packageName, versionCode) ->
if (versionCode != null) db.lockDao.insert(Lock().apply {
package_name = packageName
version_code = versionCode
}
)
if (versionCode != null) db.lockDao.insert(Lock(packageName, versionCode))
else db.lockDao.delete(packageName)
}
}

View File

@ -4,8 +4,8 @@ import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "memory_lock")
class Lock {
data class Lock(
@PrimaryKey
var package_name = ""
var version_code = 0L
}
var package_name: String = "",
var version_code: Long = 0L
)