Skip to content

Commit 1d5742f

Browse files
fix(parser): Allow multiple instances for all commands except TakeScreenshot
Refined the single-instance command logic in CommandParser.kt's `processTextInternal` method. Previously, several command types (e.g., home, back, model changes) were treated as single-instance per parsing pass. This change modifies the logic so that only `CommandTypeEnum.TAKE_SCREENSHOT` is subject to this single-instance filtering. All other command types can now be parsed multiple times if they appear sequentially in the input string, allowing for sequences like "scroll down scroll down" or "home home" to be correctly processed into multiple distinct commands.
1 parent c1d15dc commit 1d5742f

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/util/CommandParser.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,7 @@ object CommandParser {
254254
var canAdd = true
255255
// Use commandTypeFromMatch directly here
256256
val isSingleInstanceType = when (commandTypeFromMatch) {
257-
CommandTypeEnum.TAKE_SCREENSHOT,
258-
CommandTypeEnum.PRESS_HOME,
259-
CommandTypeEnum.PRESS_BACK,
260-
CommandTypeEnum.SHOW_RECENT_APPS,
261-
CommandTypeEnum.USE_HIGH_REASONING_MODEL,
262-
CommandTypeEnum.USE_LOW_REASONING_MODEL,
263-
CommandTypeEnum.PRESS_ENTER_KEY -> true
257+
CommandTypeEnum.TAKE_SCREENSHOT -> true // Only TakeScreenshot is single-instance
264258
else -> false
265259
}
266260
if (isSingleInstanceType) {

0 commit comments

Comments
 (0)