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