#!/bin/bash
# Build and deploy Android APK in one command

set -e

echo "🚀 Build and Deploy Android APK"
echo ""

# Pass all args (build type and/or --clean) through to the build script.
./scripts/build-android.sh "$@"

echo ""

# Deploy APK — forward the build type and the side-by-side flag (which decides
# which package to launch), ignoring build-only flags like --clean and --device.
DEPLOY_ARGS=("debug")
for arg in "$@"; do
    case "$arg" in
        debug|release) DEPLOY_ARGS[0]="$arg" ;;
        --debug|--side-by-side) DEPLOY_ARGS+=("--side-by-side") ;;
    esac
done
./scripts/deploy-android.sh "${DEPLOY_ARGS[@]}"
