mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 11:22:12 +00:00
Update: Rename some entities fields
This commit is contained in:
parent
f49e3cdeab
commit
2d7e6a7e90
@ -10,14 +10,14 @@ const val NOTIFICATION_ID_UPDATES = 2
|
||||
const val NOTIFICATION_ID_DOWNLOADING = 3
|
||||
const val NOTIFICATION_ID_INSTALLER = 4
|
||||
|
||||
const val ROW_REPOSITORY_ID = "repository_id"
|
||||
const val ROW_PACKAGE_NAME = "package_name"
|
||||
const val ROW_REPOSITORY_ID = "repositoryId"
|
||||
const val ROW_PACKAGE_NAME = "packageName"
|
||||
const val ROW_NAME = "name"
|
||||
const val ROW_SUMMARY = "summary"
|
||||
const val ROW_DESCRIPTION = "description"
|
||||
const val ROW_ADDED = "added"
|
||||
const val ROW_UPDATED = "updated"
|
||||
const val ROW_VERSION_CODE = "version_code"
|
||||
const val ROW_VERSION_CODE = "versionCode"
|
||||
const val ROW_SIGNATURES = "signatures"
|
||||
const val ROW_COMPATIBLE = "compatible"
|
||||
const val ROW_ICON = "icon"
|
||||
|
@ -62,19 +62,19 @@ interface RepositoryDao : BaseDao<Repository> {
|
||||
|
||||
@Dao
|
||||
interface ProductDao : BaseDao<Product> {
|
||||
@Query("SELECT COUNT(*) FROM product WHERE repository_id = :id")
|
||||
@Query("SELECT COUNT(*) FROM product WHERE repositoryId = :id")
|
||||
fun countForRepository(id: Long): Long
|
||||
|
||||
@Query("SELECT COUNT(*) FROM product WHERE repository_id = :id")
|
||||
@Query("SELECT COUNT(*) FROM product WHERE repositoryId = :id")
|
||||
fun countForRepositoryLive(id: Long): LiveData<Long>
|
||||
|
||||
@Query("SELECT * FROM product WHERE package_name = :packageName")
|
||||
@Query("SELECT * FROM product WHERE packageName = :packageName")
|
||||
fun get(packageName: String): List<Product?>
|
||||
|
||||
@Query("SELECT * FROM product WHERE package_name = :packageName")
|
||||
@Query("SELECT * FROM product WHERE packageName = :packageName")
|
||||
fun getLive(packageName: String): LiveData<List<Product?>>
|
||||
|
||||
@Query("DELETE FROM product WHERE repository_id = :id")
|
||||
@Query("DELETE FROM product WHERE repositoryId = :id")
|
||||
fun deleteById(id: Long): Int
|
||||
|
||||
@RawQuery
|
||||
@ -244,24 +244,24 @@ interface ReleaseDao : BaseDao<Release> {
|
||||
@Dao
|
||||
interface CategoryDao : BaseDao<Category> {
|
||||
@get:Query(
|
||||
"""SELECT DISTINCT category.name
|
||||
"""SELECT DISTINCT category.label
|
||||
FROM category AS category
|
||||
JOIN repository AS repository
|
||||
ON category.repository_id = repository._id
|
||||
ON category.repositoryId = repository._id
|
||||
WHERE repository.enabled != 0"""
|
||||
)
|
||||
val allNames: List<String>
|
||||
|
||||
@get:Query(
|
||||
"""SELECT DISTINCT category.name
|
||||
"""SELECT DISTINCT category.label
|
||||
FROM category AS category
|
||||
JOIN repository AS repository
|
||||
ON category.repository_id = repository._id
|
||||
ON category.repositoryId = repository._id
|
||||
WHERE repository.enabled != 0"""
|
||||
)
|
||||
val allNamesLive: LiveData<List<String>>
|
||||
|
||||
@Query("DELETE FROM category WHERE repository_id = :id")
|
||||
@Query("DELETE FROM category WHERE repositoryId = :id")
|
||||
fun deleteById(id: Long): Int
|
||||
}
|
||||
|
||||
@ -275,13 +275,13 @@ interface InstalledDao : BaseDao<Installed> {
|
||||
@get:Query("SELECT * FROM memory_installed")
|
||||
val allLive: LiveData<List<Installed>>
|
||||
|
||||
@Query("SELECT * FROM memory_installed WHERE package_name = :packageName")
|
||||
@Query("SELECT * FROM memory_installed WHERE packageName = :packageName")
|
||||
fun get(packageName: String): Installed?
|
||||
|
||||
@Query("SELECT * FROM memory_installed WHERE package_name = :packageName")
|
||||
@Query("SELECT * FROM memory_installed WHERE packageName = :packageName")
|
||||
fun getLive(packageName: String): LiveData<Installed?>
|
||||
|
||||
@Query("DELETE FROM memory_installed WHERE package_name = :packageName")
|
||||
@Query("DELETE FROM memory_installed WHERE packageName = :packageName")
|
||||
fun delete(packageName: String)
|
||||
|
||||
@Query("DELETE FROM memory_installed")
|
||||
@ -290,7 +290,7 @@ interface InstalledDao : BaseDao<Installed> {
|
||||
|
||||
@Dao
|
||||
interface LockDao : BaseDao<Lock> {
|
||||
@Query("DELETE FROM memory_lock WHERE package_name = :packageName")
|
||||
@Query("DELETE FROM memory_lock WHERE packageName = :packageName")
|
||||
fun delete(packageName: String)
|
||||
}
|
||||
|
||||
@ -335,9 +335,9 @@ interface ProductTempDao : BaseDao<ProductTemp> {
|
||||
})
|
||||
it.categories.forEach { category ->
|
||||
insertCategory(CategoryTemp().apply {
|
||||
repository_id = it.repositoryId
|
||||
package_name = it.packageName
|
||||
name = category
|
||||
repositoryId = it.repositoryId
|
||||
packageName = it.packageName
|
||||
label = category
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package com.looker.droidify.database.entity
|
||||
|
||||
import androidx.room.Entity
|
||||
|
||||
@Entity(tableName = "category", primaryKeys = ["repository_id", "package_name", "name"])
|
||||
@Entity(tableName = "category", primaryKeys = ["repositoryId", "packageName", "label"])
|
||||
open class Category {
|
||||
var repository_id: Long = 0
|
||||
var package_name = ""
|
||||
var name = ""
|
||||
var repositoryId: Long = 0
|
||||
var packageName = ""
|
||||
var label = ""
|
||||
}
|
||||
|
||||
@Entity(tableName = "temporary_category")
|
||||
|
@ -6,8 +6,8 @@ import androidx.room.PrimaryKey
|
||||
@Entity(tableName = "memory_installed")
|
||||
data class Installed(
|
||||
@PrimaryKey
|
||||
var package_name: String = "",
|
||||
var packageName: String = "",
|
||||
var version: String = "",
|
||||
var version_code: Long = 0L,
|
||||
var versionCode: Long = 0L,
|
||||
var signature: String = ""
|
||||
)
|
@ -6,6 +6,6 @@ import androidx.room.PrimaryKey
|
||||
@Entity(tableName = "memory_lock")
|
||||
data class Lock(
|
||||
@PrimaryKey
|
||||
var package_name: String = "",
|
||||
var version_code: Long = 0L
|
||||
var packageName: String = "",
|
||||
var versionCode: Long = 0L
|
||||
)
|
@ -6,27 +6,27 @@ import com.looker.droidify.entity.Donate
|
||||
import com.looker.droidify.entity.ProductItem
|
||||
import com.looker.droidify.entity.Screenshot
|
||||
|
||||
@Entity(tableName = "product", primaryKeys = ["repository_id", "package_name"])
|
||||
open class Product {
|
||||
var repository_id = 0L
|
||||
var package_name = ""
|
||||
|
||||
var name = ""
|
||||
var summary = ""
|
||||
var description = ""
|
||||
var added = 0L
|
||||
var updated = 0L
|
||||
var version_code = 0L
|
||||
var signatures = ""
|
||||
var compatible = 0
|
||||
var icon = ""
|
||||
var metadataIcon = ""
|
||||
@Entity(tableName = "product", primaryKeys = ["repositoryId", "packageName"])
|
||||
var repositoryId: Long,
|
||||
var packageName: String
|
||||
var releases: List<Release> = emptyList()
|
||||
var categories: List<String> = emptyList()
|
||||
var antiFeatures: List<String> = emptyList()
|
||||
var licenses: List<String> = emptyList()
|
||||
var donates: List<Donate> = emptyList()
|
||||
var screenshots: List<Screenshot> = emptyList()
|
||||
var versionCode: Long = 0L
|
||||
|
||||
// TODO Remove in next iteration
|
||||
@ColumnInfo(typeAffinity = ColumnInfo.BLOB)
|
||||
@ -44,9 +44,6 @@ open class Product {
|
||||
val version: String
|
||||
get() = displayRelease?.version.orEmpty()
|
||||
|
||||
val versionCode: Long
|
||||
get() = selectedReleases.firstOrNull()?.versionCode ?: 0L
|
||||
|
||||
fun toItem(installed: Installed? = null): ProductItem =
|
||||
ProductItem(
|
||||
repositoryId,
|
||||
|
@ -458,8 +458,8 @@ class SyncService : ConnectionService<SyncService.Binder>() {
|
||||
val repository = installedRepository.third!!
|
||||
|
||||
val productRepository = db.productDao.get(packageName)
|
||||
.filter { product -> product?.repository_id == repository.id }
|
||||
.map { product -> Pair(product?.data!!, repository) }
|
||||
.filter { product -> product.repositoryId == repository.id }
|
||||
|
||||
scope.launch {
|
||||
Utils.startUpdate(
|
||||
|
@ -1322,7 +1322,7 @@ class AppDetailAdapter(private val callbacks: Callbacks) :
|
||||
val incompatibility = item.release.incompatibilities.firstOrNull()
|
||||
val singlePlatform =
|
||||
if (item.release.platforms.size == 1) item.release.platforms.first() else null
|
||||
val installed = installed?.version_code == item.release.versionCode &&
|
||||
val installed = installed?.versionCode == item.release.versionCode &&
|
||||
installed?.signature == item.release.signature
|
||||
val suggested =
|
||||
incompatibility == null && item.release.selected && item.selectedRepository
|
||||
|
@ -538,7 +538,7 @@ class AppDetailFragment() : ScreenFragment(), AppDetailAdapter.Callbacks {
|
||||
)
|
||||
).show(childFragmentManager)
|
||||
}
|
||||
installedItem != null && installedItem.version_code > release.versionCode -> {
|
||||
installedItem != null && installedItem.versionCode > release.versionCode -> {
|
||||
MessageDialog(MessageDialog.Message.ReleaseOlder).show(childFragmentManager)
|
||||
}
|
||||
installedItem != null && installedItem.signature != release.signature -> {
|
||||
|
@ -415,7 +415,7 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), AppDetailAdapter.Call
|
||||
)
|
||||
).show(childFragmentManager)
|
||||
}
|
||||
installedItem != null && installedItem.version_code > release.versionCode -> {
|
||||
installedItem != null && installedItem.versionCode > release.versionCode -> {
|
||||
MessageDialog(MessageDialog.Message.ReleaseOlder).show(childFragmentManager)
|
||||
}
|
||||
installedItem != null && installedItem.signature != release.signature -> {
|
||||
|
@ -87,7 +87,7 @@ class ExploreFragment : MainNavFragmentX() {
|
||||
check(
|
||||
children.filterNotNull()
|
||||
.find { child ->
|
||||
child is Chip && selectedSection is Category && child.text == selectedSection.name
|
||||
child is Chip && selectedSection is Category && child.text == selectedSection.label
|
||||
}?.id ?: R.id.SHOW_ALL
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user