Skip to content

Commit ad226fe

Browse files
committed
chore: simplify android fill fallback flow
1 parent 22705ea commit ad226fe

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/platforms/android/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -537,22 +537,19 @@ export async function fillAndroid(
537537
text: string,
538538
): Promise<void> {
539539
const textCodePointLength = Array.from(text).length;
540-
const usesClipboardForText = shouldUseClipboardTextInjection(text);
540+
const requiresClipboardInjection = shouldUseClipboardTextInjection(text);
541541
const attempts: Array<{
542542
strategy: 'input_text' | 'clipboard_paste' | 'chunked_input';
543543
clearPadding: number;
544544
minClear: number;
545545
maxClear: number;
546-
}> = [
547-
{ strategy: 'input_text', clearPadding: 12, minClear: 8, maxClear: 48 },
548-
{ strategy: 'clipboard_paste', clearPadding: 12, minClear: 8, maxClear: 48 },
549-
];
550-
if (!usesClipboardForText) {
546+
}> = [{ strategy: 'input_text', clearPadding: 12, minClear: 8, maxClear: 48 }];
547+
if (!requiresClipboardInjection) {
548+
attempts.push({ strategy: 'clipboard_paste', clearPadding: 12, minClear: 8, maxClear: 48 });
551549
attempts.push({ strategy: 'chunked_input', clearPadding: 24, minClear: 16, maxClear: 96 });
552550
}
553551

554552
let lastActual: string | null = null;
555-
const attemptedStrategies: string[] = [];
556553

557554
for (const attempt of attempts) {
558555
await focusAndroid(device, x, y);
@@ -562,7 +559,6 @@ export async function fillAndroid(
562559
attempt.maxClear,
563560
);
564561
await clearFocusedText(device, clearCount);
565-
attemptedStrategies.push(attempt.strategy);
566562
if (attempt.strategy === 'input_text') {
567563
await typeAndroid(device, text);
568564
} else if (attempt.strategy === 'clipboard_paste') {
@@ -580,7 +576,6 @@ export async function fillAndroid(
580576
throw new AppError('COMMAND_FAILED', 'Android fill verification failed', {
581577
expected: text,
582578
actual: lastActual ?? null,
583-
strategies: attemptedStrategies,
584579
});
585580
}
586581

0 commit comments

Comments
 (0)