feat: add realtime mobile sync dashboard
This commit is contained in:
@@ -3,7 +3,9 @@ set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DEFAULT_SERIAL="adb-A9TU024628000647-B0UNif._adb-tls-connect._tcp"
|
||||
DEFAULT_SDK_DIR="/opt/homebrew/share/android-commandlinetools"
|
||||
PACKAGE_NAME="site.hyzq.bossandroid"
|
||||
ACTIVITY_NAME=".MainActivity"
|
||||
APK_PATH="$ROOT_DIR/android-app/app/build/outputs/apk/debug/app-debug.apk"
|
||||
TARGET_SERIAL="${BOSS_ANDROID_SERIAL:-$DEFAULT_SERIAL}"
|
||||
|
||||
@@ -18,6 +20,7 @@ Commands:
|
||||
launch Launch the Boss app on the Honor device
|
||||
build-install Build the debug APK and install it on the Honor device
|
||||
screenshot Save a screenshot to /tmp/boss-honor-screen.png
|
||||
ui-dump Dump the current UI hierarchy to /tmp/boss-honor-ui.xml
|
||||
logcat Tail logcat for the Boss app only
|
||||
|
||||
Environment:
|
||||
@@ -47,6 +50,12 @@ ensure_apk() {
|
||||
build_debug_apk() {
|
||||
(
|
||||
cd "$ROOT_DIR/android-app"
|
||||
if [[ -z "${ANDROID_HOME:-}" && -d "$DEFAULT_SDK_DIR" ]]; then
|
||||
export ANDROID_HOME="$DEFAULT_SDK_DIR"
|
||||
fi
|
||||
if [[ -z "${ANDROID_SDK_ROOT:-}" && -d "${ANDROID_HOME:-}" ]]; then
|
||||
export ANDROID_SDK_ROOT="$ANDROID_HOME"
|
||||
fi
|
||||
./gradlew assembleDebug
|
||||
)
|
||||
}
|
||||
@@ -71,13 +80,13 @@ case "$command" in
|
||||
;;
|
||||
launch)
|
||||
ensure_connected
|
||||
adb -s "$TARGET_SERIAL" shell monkey -p "$PACKAGE_NAME" -c android.intent.category.LAUNCHER 1
|
||||
adb -s "$TARGET_SERIAL" shell am start -n "$PACKAGE_NAME/$ACTIVITY_NAME"
|
||||
;;
|
||||
build-install)
|
||||
ensure_connected
|
||||
build_debug_apk
|
||||
adb -s "$TARGET_SERIAL" install -r "$APK_PATH"
|
||||
adb -s "$TARGET_SERIAL" shell monkey -p "$PACKAGE_NAME" -c android.intent.category.LAUNCHER 1
|
||||
adb -s "$TARGET_SERIAL" shell am start -n "$PACKAGE_NAME/$ACTIVITY_NAME"
|
||||
;;
|
||||
screenshot)
|
||||
ensure_connected
|
||||
@@ -86,6 +95,13 @@ case "$command" in
|
||||
adb -s "$TARGET_SERIAL" shell rm -f /sdcard/boss-honor-screen.png >/dev/null
|
||||
echo "/tmp/boss-honor-screen.png"
|
||||
;;
|
||||
ui-dump)
|
||||
ensure_connected
|
||||
adb -s "$TARGET_SERIAL" shell uiautomator dump /sdcard/boss-honor-ui.xml >/dev/null
|
||||
adb -s "$TARGET_SERIAL" pull /sdcard/boss-honor-ui.xml /tmp/boss-honor-ui.xml >/dev/null
|
||||
adb -s "$TARGET_SERIAL" shell rm -f /sdcard/boss-honor-ui.xml >/dev/null
|
||||
echo "/tmp/boss-honor-ui.xml"
|
||||
;;
|
||||
logcat)
|
||||
ensure_connected
|
||||
adb -s "$TARGET_SERIAL" logcat --pid="$(adb -s "$TARGET_SERIAL" shell pidof "$PACKAGE_NAME")"
|
||||
|
||||
Reference in New Issue
Block a user