Update: Replace item with toItem to include installed info

This commit is contained in:
machiav3lli 2022-04-06 03:40:20 +02:00
parent 865664cad2
commit f49e3cdeab
4 changed files with 10 additions and 10 deletions

View File

@ -47,18 +47,18 @@ open class Product {
val versionCode: Long
get() = selectedReleases.firstOrNull()?.versionCode ?: 0L
val item: ProductItem
get() = ProductItem(
repository_id,
package_name,
fun toItem(installed: Installed? = null): ProductItem =
ProductItem(
repositoryId,
packageName,
name,
summary,
icon,
metadataIcon,
version,
"",
compatible != 0,
false,
compatible,
canUpdate(installed),
0
)
}

View File

@ -399,7 +399,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
searchQuery = "",
section = Section.All,
order = Order.NAME
).map { it.item }
).map { it.toItem() }
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@ -35,7 +35,7 @@ fun ProductsVerticalRecycler(
onInstallClick: (ProductItem) -> Unit = {}
) {
VerticalItemList(list = productsList) {
it.item.let { item ->
it.toItem().let { item ->
ProductsListItem(
item,
repositories[item.repositoryId],
@ -58,7 +58,7 @@ fun ProductsHorizontalRecycler(
horizontalArrangement = spacedBy(2.dp)
) {
items(productsList ?: emptyList()) { product ->
product.item.let { item ->
product.toItem().let { item ->
ProductCard(item, repositories[item.repositoryId], onUserClick)
}
}

View File

@ -108,7 +108,7 @@ class InstalledFragment : MainNavFragmentX() {
}
binding.buttonUpdateAll.setOnClickListener {
viewModel.secondaryProducts.value?.let {
mainActivityX.syncConnection.binder?.updateApps(it.map(Product::item))
mainActivityX.syncConnection.binder?.updateApps(it.map(Product::toItem))
}
}
mainActivityX.menuSetup.observe(viewLifecycleOwner) {