Fixes
This commit is contained in:
parent
c5750e6b5e
commit
3cd8a005c9
|
|
@ -64,6 +64,7 @@ dependencies {
|
||||||
|
|
||||||
// AndroidX Security
|
// AndroidX Security
|
||||||
implementation(libs.androidx.security.crypto)
|
implementation(libs.androidx.security.crypto)
|
||||||
|
implementation(libs.androidx.room.runtime.android)
|
||||||
|
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.androidx.junit)
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.example.livingai_lg.ui.screens
|
package com.example.livingai_lg.ui.screens
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.compose.foundation.Indication
|
import androidx.compose.foundation.Indication
|
||||||
import androidx.compose.foundation.LocalIndication
|
import androidx.compose.foundation.LocalIndication
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
|
@ -20,6 +21,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.room.util.copy
|
||||||
import com.example.livingai_lg.ui.components.AdSpaceBanner
|
import com.example.livingai_lg.ui.components.AdSpaceBanner
|
||||||
import com.example.livingai_lg.ui.components.AnimalTypeSelector
|
import com.example.livingai_lg.ui.components.AnimalTypeSelector
|
||||||
import com.example.livingai_lg.ui.components.BuyAnimalCard
|
import com.example.livingai_lg.ui.components.BuyAnimalCard
|
||||||
|
|
@ -39,11 +41,14 @@ import com.example.livingai_lg.ui.components.FilterOverlay
|
||||||
import com.example.livingai_lg.ui.components.InfoOverlay
|
import com.example.livingai_lg.ui.components.InfoOverlay
|
||||||
import com.example.livingai_lg.ui.components.NotificationsOverlay
|
import com.example.livingai_lg.ui.components.NotificationsOverlay
|
||||||
import com.example.livingai_lg.ui.components.SortOverlay
|
import com.example.livingai_lg.ui.components.SortOverlay
|
||||||
|
import com.example.livingai_lg.ui.models.FiltersState
|
||||||
|
import com.example.livingai_lg.ui.models.TextFilter
|
||||||
import com.example.livingai_lg.ui.models.sampleNotifications
|
import com.example.livingai_lg.ui.models.sampleNotifications
|
||||||
import com.example.livingai_lg.ui.navigation.AppScreen
|
import com.example.livingai_lg.ui.navigation.AppScreen
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BuyScreen(
|
fun BuyScreen(
|
||||||
|
initialFilters: FiltersState = FiltersState(),
|
||||||
onProductClick: (productId: String) -> Unit = {},
|
onProductClick: (productId: String) -> Unit = {},
|
||||||
onBackClick: () -> Unit = {},
|
onBackClick: () -> Unit = {},
|
||||||
onNavClick: (route: String) -> Unit = {},
|
onNavClick: (route: String) -> Unit = {},
|
||||||
|
|
@ -51,7 +56,9 @@ fun BuyScreen(
|
||||||
onSortClick: () -> Unit = {},
|
onSortClick: () -> Unit = {},
|
||||||
onSellerClick: (sellerId: String) -> Unit = {},
|
onSellerClick: (sellerId: String) -> Unit = {},
|
||||||
) {
|
) {
|
||||||
val selectedAnimalType = remember { mutableStateOf<String?>(null) }
|
var activeFilters by remember {
|
||||||
|
mutableStateOf(initialFilters)
|
||||||
|
}
|
||||||
val isSaved = remember { mutableStateOf(false) }
|
val isSaved = remember { mutableStateOf(false) }
|
||||||
var showAddressSelector by remember { mutableStateOf(false) }
|
var showAddressSelector by remember { mutableStateOf(false) }
|
||||||
var selectedAddressId by remember { mutableStateOf<String?>(userProfile.addresses.find { address -> address.isPrimary }?.id) }
|
var selectedAddressId by remember { mutableStateOf<String?>(userProfile.addresses.find { address -> address.isPrimary }?.id) }
|
||||||
|
|
@ -138,8 +145,18 @@ fun BuyScreen(
|
||||||
// Animal type filter buttons
|
// Animal type filter buttons
|
||||||
AnimalTypeSelector(
|
AnimalTypeSelector(
|
||||||
animalTypes = animalTypes,
|
animalTypes = animalTypes,
|
||||||
selectedAnimalType =
|
selectedAnimalType = activeFilters.animal.value,
|
||||||
) { }
|
onAnimalTypeSelected = { animal->
|
||||||
|
activeFilters = activeFilters.copy(
|
||||||
|
animal = TextFilter(
|
||||||
|
value = animal,
|
||||||
|
filterSet = true
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// Ad space banner
|
// Ad space banner
|
||||||
AdSpaceBanner(
|
AdSpaceBanner(
|
||||||
|
|
@ -212,9 +229,12 @@ fun BuyScreen(
|
||||||
)
|
)
|
||||||
|
|
||||||
FilterOverlay(
|
FilterOverlay(
|
||||||
|
appliedFilters = activeFilters,
|
||||||
visible = showFilterOverlay.value,
|
visible = showFilterOverlay.value,
|
||||||
onDismiss = { showFilterOverlay.value = false },
|
onDismiss = { showFilterOverlay.value = false },
|
||||||
onSubmitClick = {
|
onSubmitClick = { filters ->
|
||||||
|
Log.d("Filters", "$filters")
|
||||||
|
activeFilters = filters
|
||||||
// apply filters
|
// apply filters
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ ktor = "2.3.12"
|
||||||
kotlinxSerialization = "1.6.3"
|
kotlinxSerialization = "1.6.3"
|
||||||
securityCrypto = "1.1.0-alpha06"
|
securityCrypto = "1.1.0-alpha06"
|
||||||
navigationComposeJvmstubs = "2.9.6"
|
navigationComposeJvmstubs = "2.9.6"
|
||||||
|
roomRuntimeAndroid = "2.8.4"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
|
@ -44,6 +45,7 @@ kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-
|
||||||
# AndroidX Security
|
# AndroidX Security
|
||||||
androidx-security-crypto = { group = "androidx.security", name = "security-crypto", version.ref = "securityCrypto" }
|
androidx-security-crypto = { group = "androidx.security", name = "security-crypto", version.ref = "securityCrypto" }
|
||||||
androidx-navigation-compose-jvmstubs = { group = "androidx.navigation", name = "navigation-compose-jvmstubs", version.ref = "navigationComposeJvmstubs" }
|
androidx-navigation-compose-jvmstubs = { group = "androidx.navigation", name = "navigation-compose-jvmstubs", version.ref = "navigationComposeJvmstubs" }
|
||||||
|
androidx-room-runtime-android = { group = "androidx.room", name = "room-runtime-android", version.ref = "roomRuntimeAndroid" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue