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:
2026-06-06 17:38:56 +02:00
parent 499aee8988
commit 68b4390282
262 changed files with 4860 additions and 15162 deletions

View File

@@ -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."