Completa app Android nativa e rimuove il client Flutter.
Il monorepo punta a native/android (login, wizard, diretta RTMP, tabellone WebSocket, pausa/telemetria) con encode 16:9 e orientamento via sensore; eliminati mobile/ e gli script Flutter obsoleti. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# APK release per telefono → API produzione
|
||||
set -euo pipefail
|
||||
export PATH="${HOME}/flutter/bin:${PATH}"
|
||||
|
||||
API_BASE_URL="${API_BASE_URL:-https://www.matchlivetv.it}"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
cd "$ROOT/mobile"
|
||||
flutter pub get
|
||||
flutter build apk --release \
|
||||
--dart-define="API_BASE_URL=${API_BASE_URL}"
|
||||
|
||||
echo "APK: mobile/build/app/outputs/flutter-apk/app-release.apk"
|
||||
echo "API_BASE_URL=${API_BASE_URL}"
|
||||
@@ -11,8 +11,8 @@ echo "Sync $SRC -> $SERVER:$DEST"
|
||||
if ssh "$SERVER" 'command -v rsync >/dev/null 2>&1'; then
|
||||
rsync -avz --delete \
|
||||
--exclude '.git' \
|
||||
--exclude 'mobile/build' \
|
||||
--exclude 'mobile/.dart_tool' \
|
||||
--exclude 'native/android/build' \
|
||||
--exclude 'native/android/.gradle' \
|
||||
--exclude 'backend/log' \
|
||||
--exclude 'backend/tmp' \
|
||||
--exclude 'backend/.bundle' \
|
||||
@@ -22,7 +22,7 @@ if ssh "$SERVER" 'command -v rsync >/dev/null 2>&1'; then
|
||||
else
|
||||
echo "rsync non disponibile sul server, uso tar+scp..."
|
||||
tar -C "$SRC" -czf /tmp/matchlivetv-deploy.tar.gz \
|
||||
--exclude='./mobile/build' --exclude='./mobile/.dart_tool' \
|
||||
--exclude='./native/android/build' --exclude='./native/android/.gradle' \
|
||||
--exclude='./backend/log' --exclude='./backend/tmp' --exclude='./infra/.env' --exclude='./.git' .
|
||||
scp /tmp/matchlivetv-deploy.tar.gz "$SERVER:~/matchlivetv-deploy.tar.gz"
|
||||
ssh "$SERVER" "mkdir -p $DEST && tar -xzf ~/matchlivetv-deploy.tar.gz -C $DEST"
|
||||
|
||||
35
scripts/e2e_native_android_emulator.sh
Executable file
35
scripts/e2e_native_android_emulator.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
ANDROID_DIR="$ROOT/native/android"
|
||||
ADB="${ADB:-adb}"
|
||||
DEVICE="${ANDROID_SERIAL:-emulator-5554}"
|
||||
API_BASE_URL="${API_BASE_URL:-https://www.matchlivetv.it}"
|
||||
|
||||
export ANDROID_SERIAL="$DEVICE"
|
||||
|
||||
echo "==> Device: $DEVICE"
|
||||
"$ADB" -s "$DEVICE" get-state
|
||||
|
||||
cd "$ANDROID_DIR"
|
||||
chmod +x gradlew
|
||||
echo "==> Build debug + androidTest APK (API_BASE_URL=$API_BASE_URL)"
|
||||
./gradlew assembleDebug assembleDebugAndroidTest -PAPI_BASE_URL="$API_BASE_URL"
|
||||
|
||||
echo "==> Reset app state on $DEVICE"
|
||||
"$ADB" -s "$DEVICE" shell am force-stop com.matchlivetv.match_live_tv
|
||||
"$ADB" -s "$DEVICE" shell pm clear com.matchlivetv.match_live_tv
|
||||
"$ADB" -s "$DEVICE" shell pm grant com.matchlivetv.match_live_tv android.permission.CAMERA
|
||||
"$ADB" -s "$DEVICE" shell pm grant com.matchlivetv.match_live_tv android.permission.RECORD_AUDIO
|
||||
"$ADB" -s "$DEVICE" shell pm grant com.matchlivetv.match_live_tv android.permission.POST_NOTIFICATIONS
|
||||
|
||||
echo "==> Install on $DEVICE"
|
||||
"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/debug/app-debug.apk
|
||||
"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
|
||||
|
||||
echo "==> Run E2E tests"
|
||||
./gradlew connectedDebugAndroidTest \
|
||||
-Pandroid.testInstrumentationRunnerArguments.class=com.matchlivetv.match_live_tv.E2EWizardFlowTest \
|
||||
-PAPI_BASE_URL="$API_BASE_URL"
|
||||
|
||||
echo "==> E2E completato"
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Avvio su emulatore Android con port forwarding
|
||||
set -euo pipefail
|
||||
export PATH="$HOME/flutter/bin:$HOME/Android/Sdk/platform-tools:$PATH"
|
||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
||||
export ANDROID_AVD_HOME="${ANDROID_AVD_HOME:-$HOME/.var/app/com.google.AndroidStudio/config/.android/avd}"
|
||||
|
||||
adb reverse tcp:3000 tcp:3000 2>/dev/null || true
|
||||
|
||||
cd "$(dirname "$0")/../mobile"
|
||||
flutter pub get
|
||||
flutter run -d emulator-5554 \
|
||||
--dart-define=API_BASE_URL=http://127.0.0.1:3000 \
|
||||
--dart-define=CABLE_URL=ws://127.0.0.1:3000/cable
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Telefono Android fisico → API produzione
|
||||
set -euo pipefail
|
||||
export PATH="$HOME/flutter/bin:$HOME/Android/Sdk/platform-tools:$PATH"
|
||||
export ANDROID_HOME="$HOME/Android/Sdk"
|
||||
|
||||
DEVICE="${ANDROID_DEVICE:-}"
|
||||
if [[ -z "$DEVICE" ]]; then
|
||||
DEVICE=$(adb devices | awk '/device$/{print $1; exit}' | grep -v emulator || true)
|
||||
fi
|
||||
if [[ -z "$DEVICE" ]]; then
|
||||
echo "Nessun telefono USB collegato. Collega il device e abilita debug USB."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE_URL="${API_BASE_URL:-https://www.matchlivetv.it}"
|
||||
MODE="${BUILD_MODE:-debug}"
|
||||
|
||||
cd "$(dirname "$0")/../mobile"
|
||||
flutter pub get
|
||||
|
||||
ARGS=(run -d "$DEVICE" "--dart-define=API_BASE_URL=$API_BASE_URL")
|
||||
if [[ "$MODE" == "release" ]]; then
|
||||
ARGS=(run --release -d "$DEVICE" "--dart-define=API_BASE_URL=$API_BASE_URL")
|
||||
fi
|
||||
|
||||
echo "Device: $DEVICE | API: $API_BASE_URL | Mode: $MODE"
|
||||
flutter "${ARGS[@]}"
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Avvio leggero su Linux desktop (evita emulatore Android che consuma ~80% CPU)
|
||||
set -euo pipefail
|
||||
export PATH="$HOME/flutter/bin:$PATH"
|
||||
cd "$(dirname "$0")/../mobile"
|
||||
flutter pub get
|
||||
flutter run -d linux --dart-define=API_BASE_URL=http://127.0.0.1:3000
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# E2E streaming: installa APK, login demo, apre camera sessione attiva.
|
||||
# Richiede: USB debug + su MIUI/Xiaomi abilitare "Installazione via USB".
|
||||
set -euo pipefail
|
||||
|
||||
export PATH="$HOME/flutter/bin:$HOME/Android/Sdk/platform-tools:$PATH"
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
DEVICE="${ANDROID_DEVICE:-$(adb devices | awk '/device$/{print $1; exit}')}"
|
||||
SESSION_ID="${SESSION_ID:-fe09a29f-79db-44d5-864f-397942c0a2c5}"
|
||||
EMAIL="${TEST_EMAIL:-coach@matchlivetv.test}"
|
||||
PASSWORD="${TEST_PASSWORD:-password123}"
|
||||
APK="$ROOT/mobile/build/app/outputs/flutter-apk/app-release.apk"
|
||||
PKG="com.matchlivetv.match_live_tv"
|
||||
|
||||
if [[ -z "$DEVICE" ]]; then
|
||||
echo "Nessun telefono USB. Collega il device e abilita debug USB."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== Device: $DEVICE =="
|
||||
|
||||
if [[ ! -f "$APK" ]]; then
|
||||
echo "Build APK release..."
|
||||
(cd "$ROOT/mobile" && flutter build apk --release --dart-define=API_BASE_URL=https://www.matchlivetv.it)
|
||||
fi
|
||||
|
||||
echo "== Install APK (conferma sul telefono se richiesto) =="
|
||||
if ! adb -s "$DEVICE" install -r -g "$APK"; then
|
||||
echo ""
|
||||
echo "Installazione bloccata. Su Xiaomi/MIUI:"
|
||||
echo " Impostazioni → Impostazioni aggiuntive → Opzioni sviluppatore → Installazione via USB → Attiva"
|
||||
echo "Poi rilancia questo script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== Grant permissions =="
|
||||
adb -s "$DEVICE" shell pm grant "$PKG" android.permission.CAMERA 2>/dev/null || true
|
||||
adb -s "$DEVICE" shell pm grant "$PKG" android.permission.RECORD_AUDIO 2>/dev/null || true
|
||||
adb -s "$DEVICE" shell pm grant "$PKG" android.permission.POST_NOTIFICATIONS 2>/dev/null || true
|
||||
|
||||
echo "== Launch app =="
|
||||
adb -s "$DEVICE" shell am force-stop "$PKG"
|
||||
adb -s "$DEVICE" shell am start -n "$PKG/.MainActivity"
|
||||
sleep 4
|
||||
|
||||
tap_text() {
|
||||
local text="$1"
|
||||
adb -s "$DEVICE" shell uiautomator dump /sdcard/ui.xml >/dev/null 2>&1 || true
|
||||
local coords
|
||||
coords=$(adb -s "$DEVICE" shell "grep -o \"text=\\\"$text\\\"[^>]*bounds=\\\"\\[[0-9,]*\\]\\[[0-9,]*\\]\\\"\" /sdcard/ui.xml 2>/dev/null | head -1" || true)
|
||||
if [[ -z "$coords" ]]; then return 1; fi
|
||||
local b
|
||||
b=$(echo "$coords" | sed -n 's/.*bounds=\"\[\([div0-9,]*\)\]\[\([0-9,]*\)\]\".*/\1 \2/p')
|
||||
local x1 y1 x2 y2
|
||||
IFS=',' read -r x1 y1 <<< "${b%% *}"
|
||||
IFS=',' read -r x2 y2 <<< "${b##* }"
|
||||
local cx=$(( (x1 + x2) / 2 ))
|
||||
local cy=$(( (y1 + y2) / 2 ))
|
||||
adb -s "$DEVICE" shell input tap "$cx" "$cy"
|
||||
return 0
|
||||
}
|
||||
|
||||
tap_contains() {
|
||||
local needle="$1"
|
||||
adb -s "$DEVICE" shell uiautomator dump /sdcard/ui.xml >/dev/null 2>&1 || true
|
||||
local line
|
||||
line=$(adb -s "$DEVICE" shell "grep -i '$needle' /sdcard/ui.xml | head -1" || true)
|
||||
[[ -n "$line" ]] || return 1
|
||||
local bounds
|
||||
bounds=$(echo "$line" | sed -n 's/.*bounds=\"\[\([0-9,]*\)\]\[\([0-9,]*\)\]\".*/\1 \2/p')
|
||||
local x1 y1 x2 y2
|
||||
IFS=',' read -r x1 y1 <<< "${bounds%% *}"
|
||||
IFS=',' read -r x2 y2 <<< "${bounds##* }"
|
||||
adb -s "$DEVICE" shell input tap $(( (x1 + x2) / 2 )) $(( (y1 + y2) / 2 ))
|
||||
}
|
||||
|
||||
echo "== Login (demo) =="
|
||||
# Email field
|
||||
adb -s "$DEVICE" shell uiautomator dump /sdcard/ui.xml >/dev/null 2>&1 || true
|
||||
sleep 1
|
||||
# Tap center-left for email field (Flutter fallback coords 720p)
|
||||
adb -s "$DEVICE" shell input tap 540 520
|
||||
adb -s "$DEVICE" shell input keyevent KEYCODE_MOVE_END
|
||||
adb -s "$DEVICE" shell input keyevent --longpress $(printf '%s' "$EMAIL" | od -An -tuC | tr -s ' ' '\n' | while read -r c; do echo "KEYCODE_DEL"; done | head -40) 2>/dev/null || true
|
||||
adb -s "$DEVICE" shell input text "${EMAIL//@/%40}"
|
||||
sleep 1
|
||||
tap_contains "Accedi" || tap_contains "Entra" || adb -s "$DEVICE" shell input tap 540 900
|
||||
sleep 5
|
||||
|
||||
echo "== Open camera for session $SESSION_ID =="
|
||||
# Deep link via am start with route — apri wizard/camera se già loggato
|
||||
adb -s "$DEVICE" shell am start -a android.intent.action.VIEW \
|
||||
-d "https://www.matchlivetv.it/live/$SESSION_ID" "$PKG" 2>/dev/null || true
|
||||
sleep 3
|
||||
tap_contains "Riprendi" || tap_contains "RIPRENDI" || tap_contains "camera" || true
|
||||
sleep 2
|
||||
|
||||
echo "== Session status =="
|
||||
curl -sS "https://www.matchlivetv.it/live/$SESSION_ID/status.json" | python3 -m json.tool | head -20
|
||||
|
||||
echo ""
|
||||
echo "Apri nel browser: https://www.matchlivetv.it/live/$SESSION_ID"
|
||||
echo "Controlla bitrate/fps dispositivo via API sessions."
|
||||
Reference in New Issue
Block a user