Skip to content

Commit a827ace

Browse files
authored
Fix WearOS screenshot loop deep link launching (#16)
1 parent 01b86fc commit a827ace

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/wearos-emulator-screenshots.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,18 @@ jobs:
465465
return 1
466466
}
467467
468+
open_deep_link() {
469+
local url="$1"
470+
471+
adb -s "$emulator_serial" shell am force-stop "$BUNDLE_ID" >/dev/null 2>&1 || true
472+
473+
if adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "$url" "$BUNDLE_ID" >/dev/null 2>&1 </dev/null; then
474+
return 0
475+
fi
476+
477+
adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null
478+
}
479+
468480
shots_dir="$GITHUB_WORKSPACE/artifacts/screenshots"
469481
mkdir -p "$shots_dir"
470482
printf "index,url,file\n" > "$shots_dir/manifest.csv"
@@ -510,7 +522,7 @@ jobs:
510522
fi
511523
filename="$(printf '%02d' "$index")-$slug.png"
512524
513-
if adb -s "$emulator_serial" shell am start -W -a android.intent.action.VIEW -d "$url" -n "$BUNDLE_ID/$MAIN_ACTIVITY" >/dev/null 2>&1 </dev/null; then
525+
if open_deep_link "$url"; then
514526
if ! wait_for_app_foreground "$BUNDLE_ID"; then
515527
echo "::warning::Deep link opened but app is not foregrounded: $url"
516528
index=$((index + 1))

0 commit comments

Comments
 (0)