comboctl-main: Rename variables such that currentQuantity is not shadowed
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
parent
bd9c149b80
commit
ede5ad1cda
1 changed files with 14 additions and 14 deletions
|
@ -723,15 +723,15 @@ suspend fun adjustQuantityOnScreen(
|
||||||
rtNavigationContext,
|
rtNavigationContext,
|
||||||
if (needToIncrement) incrementButton else decrementButton
|
if (needToIncrement) incrementButton else decrementButton
|
||||||
) { parsedScreen ->
|
) { parsedScreen ->
|
||||||
val currentQuantity = getQuantity(parsedScreen)
|
val currentQuantityOnScreen = getQuantity(parsedScreen)
|
||||||
logger(LogLevel.VERBOSE) { "Current quantity in first phase: $currentQuantity; need to increment: $needToIncrement" }
|
logger(LogLevel.VERBOSE) { "Current quantity in first phase: $currentQuantityOnScreen; need to increment: $needToIncrement" }
|
||||||
if (currentQuantity == null) {
|
if (currentQuantityOnScreen == null) {
|
||||||
LongPressRTButtonsCommand.ContinuePressingButton
|
LongPressRTButtonsCommand.ContinuePressingButton
|
||||||
} else {
|
} else {
|
||||||
if (currentQuantity != targetQuantity) {
|
if (currentQuantityOnScreen != targetQuantity) {
|
||||||
if (checkIfQuantityUnexpectedlyNotChanging(currentQuantity)) {
|
if (checkIfQuantityUnexpectedlyNotChanging(currentQuantityOnScreen)) {
|
||||||
logger(LogLevel.ERROR) { "Quantity unexpectedly not changing" }
|
logger(LogLevel.ERROR) { "Quantity unexpectedly not changing" }
|
||||||
throw QuantityNotChangingException(targetQuantity = targetQuantity, hitLimitAt = currentQuantity)
|
throw QuantityNotChangingException(targetQuantity = targetQuantity, hitLimitAt = currentQuantityOnScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,12 +749,12 @@ suspend fun adjustQuantityOnScreen(
|
||||||
// will be set to false, indicating that the long RT
|
// will be set to false, indicating that the long RT
|
||||||
// button press needs to stop.
|
// button press needs to stop.
|
||||||
val keepPressing =
|
val keepPressing =
|
||||||
if (currentQuantity == targetQuantity)
|
if (currentQuantityOnScreen == targetQuantity)
|
||||||
false
|
false
|
||||||
else if (needToIncrement)
|
else if (needToIncrement)
|
||||||
checkIfNeedsToIncrement(currentQuantity)
|
checkIfNeedsToIncrement(currentQuantityOnScreen)
|
||||||
else
|
else
|
||||||
!checkIfNeedsToIncrement(currentQuantity)
|
!checkIfNeedsToIncrement(currentQuantityOnScreen)
|
||||||
|
|
||||||
if (keepPressing)
|
if (keepPressing)
|
||||||
LongPressRTButtonsCommand.ContinuePressingButton
|
LongPressRTButtonsCommand.ContinuePressingButton
|
||||||
|
@ -789,20 +789,20 @@ suspend fun adjustQuantityOnScreen(
|
||||||
// is pretty much what we are waiting for.
|
// is pretty much what we are waiting for.
|
||||||
val parsedDisplayFrame = rtNavigationContext.getParsedDisplayFrame(filterDuplicates = false) ?: continue
|
val parsedDisplayFrame = rtNavigationContext.getParsedDisplayFrame(filterDuplicates = false) ?: continue
|
||||||
val parsedScreen = parsedDisplayFrame.parsedScreen
|
val parsedScreen = parsedDisplayFrame.parsedScreen
|
||||||
val currentQuantity = getQuantity(parsedScreen)
|
val currentQuantityOnScreen = getQuantity(parsedScreen)
|
||||||
|
|
||||||
logger(LogLevel.DEBUG) {
|
logger(LogLevel.DEBUG) {
|
||||||
"Observed quantity after long-pressing RT button: " +
|
"Observed quantity after long-pressing RT button: " +
|
||||||
"last / current quantity: $lastQuantity / $currentQuantity"
|
"last / current quantity: $lastQuantity / $currentQuantityOnScreen"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentQuantity != null) {
|
if (currentQuantityOnScreen != null) {
|
||||||
if (currentQuantity == lastQuantity) {
|
if (currentQuantityOnScreen == lastQuantity) {
|
||||||
sameQuantityObservedCount++
|
sameQuantityObservedCount++
|
||||||
if (sameQuantityObservedCount >= 3)
|
if (sameQuantityObservedCount >= 3)
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
lastQuantity = currentQuantity
|
lastQuantity = currentQuantityOnScreen
|
||||||
sameQuantityObservedCount = 0
|
sameQuantityObservedCount = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue