Skip to content

Commit

Permalink
debug for lastquantity data
Browse files Browse the repository at this point in the history
  • Loading branch information
burak.ozturk1 committed Jan 7, 2025
1 parent 7d460f9 commit 9af288a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.trendyol.uicomponents.quantitypicker

import android.util.Log
import androidx.compose.animation.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
Expand Down Expand Up @@ -35,7 +36,7 @@ internal fun QuantityAddIcon(
}
var iconTintColor by remember { mutableStateOf(Color.White) }
val animatedBackgroundColor = remember { Animatable(targetBackgroundColor) }
var lastQuantityCount by remember { mutableStateOf(-1) }
var lastQuantityCount = remember { mutableStateOf(-1) }


val setTargetBackgroundColor: (color: Color) -> Unit = remember {
Expand All @@ -53,8 +54,12 @@ internal fun QuantityAddIcon(
}

LaunchedEffect(key1 = quantityData.currentQuantity) {
if (lastQuantityCount != quantityData.currentQuantity && showLoading.not()) {
lastQuantityCount = quantityData.currentQuantity
Log.e(
"XXX",
"quantity = ${quantityData.currentQuantity} lastQ:${lastQuantityCount.value} isLoading:$showLoading"
)
if (lastQuantityCount.value != quantityData.currentQuantity && showLoading.not()) {
lastQuantityCount.value = quantityData.currentQuantity
iconTintColor = quantityData.getAddIconColor(icons, quantityData.currentQuantity)
setTargetBackgroundColor.invoke(quantityData.getBackgroundColor(icons))
}
Expand Down

0 comments on commit 9af288a

Please sign in to comment.