feat(UI): add updated at badge

This commit is contained in:
mi6e4ka 2025-11-09 15:00:33 +03:00
parent fc7cc103dd
commit ec38b428c0
No known key found for this signature in database
4 changed files with 23 additions and 3 deletions

View file

@ -72,6 +72,7 @@ dependencies {
implementation(libs.androidx.animation)
implementation(libs.androidx.paging.compose)
implementation(libs.material)
implementation(libs.kotlinx.datetime)
debugImplementation(libs.androidx.ui.tooling.preview)
debugImplementation(libs.okhttp3.logging.interceptor)
testImplementation(libs.junit)

View file

@ -20,6 +20,7 @@ data class ItemDetails(
@SerializedName("roundedDownloadsText") val roundedDownloadsText: String,
@SerializedName("ageLegal") val ageLegal: String,
@SerializedName("whatsNew") val whatsNew: String,
@SerializedName("appVerUpdatedAt") val appVerUpdatedAt: String,
)
data class Files(

View file

@ -28,15 +28,14 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.ArrowForward
import androidx.compose.material.icons.filled.ArrowCircleUp
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.FileCopy
import androidx.compose.material.icons.filled.OpenInBrowser
import androidx.compose.material.icons.filled.SupervisedUserCircle
import androidx.compose.material.icons.filled.UploadFile
import androidx.compose.material.icons.rounded.Adb
import androidx.compose.material.icons.rounded.Android
import androidx.compose.material.icons.rounded.Download
import androidx.compose.material.icons.rounded.FileCopy
import androidx.compose.material.icons.rounded.Security
import androidx.compose.material.icons.rounded.Update
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.material3.AssistChip
import androidx.compose.material3.Button
@ -84,8 +83,18 @@ import dev.mi6e4ka.openstore.internal.installer.ApkInstaller
import dev.mi6e4ka.openstore.ui.components.AppIcon
import dev.mi6e4ka.openstore.ui.components.GalleryWithPager
import kotlinx.coroutines.launch
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.format
import kotlinx.datetime.format.FormatStringsInDatetimeFormats
import kotlinx.datetime.format.byUnicodePattern
import kotlinx.datetime.toLocalDateTime
import kotlin.time.ExperimentalTime
import kotlin.time.Instant
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class)
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class,
FormatStringsInDatetimeFormats::class, ExperimentalTime::class
)
@Composable
fun DetailsScreen(
itemId: String,
@ -361,6 +370,13 @@ fun DetailsScreen(
label = {Text(if ((state.appFiles?.size ?: 1) > 1) "${state.appFiles?.size} Split APKs" else "APK")},
leadingIcon = {Icon(imageVector = Icons.Rounded.Adb, contentDescription = null)}
)
AssistChip(
onClick = {},
label = {
val parsedDate = Instant.parse(item.appVerUpdatedAt).toLocalDateTime(TimeZone.currentSystemDefault())
Text(parsedDate.format(LocalDateTime.Format {byUnicodePattern("dd.MM.yyyy")}))},
leadingIcon = {Icon(imageVector = Icons.Rounded.Update, contentDescription = null)}
)
AssistChip(
onClick = {},
label = {Text(item.roundedDownloadsText)},

View file

@ -21,6 +21,7 @@ runtimeLivedata = "1.9.0"
material3 = "1.3.2"
animation = "1.9.0"
material = "1.14.0-alpha04"
kotlinxDatetime = "0.7.0"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@ -52,6 +53,7 @@ material3 = { group = "androidx.compose.material3", name = "material3", version
androidx-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "animation" }
androidx-paging-compose = { group = "androidx.paging", name = "paging-compose", version = "3.3.6" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }