# TNG eWallet 全流程自动化：注册/登录 → 点区号 → 国家列表
# 依赖：adb、设备已 Root + LSPosed + notiMessage xposed-module 已勾选 TNG
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $PSScriptRoot
Set-Location $Root

Write-Host "== build xposed-module ==" -ForegroundColor Cyan
& .\gradlew :xposed-module:assembleDebug
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

Write-Host "== install ==" -ForegroundColor Cyan
adb install -r xposed-module\build\outputs\apk\debug\xposed-module-debug.apk
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

adb shell am force-stop my.com.tngdigital.ewallet
Start-Sleep -Seconds 3

Write-Host "== full flow test ==" -ForegroundColor Cyan
python reverse/scripts/test_tng_full_flow.py
exit $LASTEXITCODE
