Skip to content

Commit cf12db7

Browse files
authored
Fix missing shopping cart updates (#199)
1 parent b4f13b4 commit cf12db7

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
77
### Removed
88
### Fixed
99

10+
## [0.75.0]
11+
### Added
12+
* ui: add function `updateCart()` to update the cart manually for the `ShoppingCartScreen`
13+
1014
## [0.75.0]
1115
### Changed
1216
* ui: update fiserv 3D's flow. The user now has to enter additional information to add a credit card.

ui/src/main/java/io/snabble/sdk/ui/cart/shoppingcart/ShoppingCartScreen.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package io.snabble.sdk.ui.cart.shoppingcart
22

33
import androidx.compose.foundation.ExperimentalFoundationApi
4-
import androidx.compose.foundation.background
54
import androidx.compose.foundation.layout.fillMaxWidth
65
import androidx.compose.foundation.lazy.LazyColumn
76
import androidx.compose.foundation.lazy.items
87
import androidx.compose.material3.HorizontalDivider
9-
import androidx.compose.material3.MaterialTheme
108
import androidx.compose.runtime.Composable
119
import androidx.compose.ui.Modifier
1210
import androidx.compose.ui.input.nestedscroll.nestedScroll
@@ -138,7 +136,9 @@ private fun CardWithUserWeightedItems() {
138136
items = listOf(
139137
ProductItem(
140138
ShoppingCart.Item(ShoppingCart(), LineItem(name = "Cold brew Coffee"))
141-
.apply { product = Product.Builder().setType(Product.Type.UserWeighed).build() },
139+
.apply {
140+
product = Product.Builder().setType(Product.Type.UserWeighed).build()
141+
},
142142
name = "Apple",
143143
quantity = 1,
144144
editable = true,

ui/src/main/java/io/snabble/sdk/ui/cart/shoppingcart/ShoppingCartViewModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class ShoppingCartViewModel : ViewModel() {
3030
}
3131
}
3232

33+
fun updateCart() {
34+
updateUiState(cachedCart)
35+
}
36+
3337
init {
3438
val project = Snabble.checkedInProject.value
3539
val cart = Snabble.checkedInProject.value?.shoppingCart

0 commit comments

Comments
 (0)