diff --git a/qline_scripts b/qline_scripts deleted file mode 160000 index b6fff95..0000000 --- a/qline_scripts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b6fff9571133e5657cbad945a5a0baa3bc69500c diff --git a/qline_scripts/apks/qline_opd_v8.9_prod.apk b/qline_scripts/apks/qline_opd_v8.9_prod.apk new file mode 100644 index 0000000..6e99f3d Binary files /dev/null and b/qline_scripts/apks/qline_opd_v8.9_prod.apk differ diff --git a/qline_scripts/apks/qline_opd_v9.1_prod.apk b/qline_scripts/apks/qline_opd_v9.1_prod.apk new file mode 100644 index 0000000..6f13cc2 Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9.1_prod.apk differ diff --git a/qline_scripts/apks/qline_opd_v9.2_prod.apk b/qline_scripts/apks/qline_opd_v9.2_prod.apk new file mode 100644 index 0000000..d3252e3 Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9.2_prod.apk differ diff --git a/qline_scripts/apks/qline_opd_v9.3_android_14.apk b/qline_scripts/apks/qline_opd_v9.3_android_14.apk new file mode 100644 index 0000000..cb322cd Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9.3_android_14.apk differ diff --git a/qline_scripts/apks/qline_opd_v9.3_prod.apk b/qline_scripts/apks/qline_opd_v9.3_prod.apk new file mode 100644 index 0000000..966dc15 Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9.3_prod.apk differ diff --git a/qline_scripts/apks/qline_opd_v9.4_prod.apk b/qline_scripts/apks/qline_opd_v9.4_prod.apk new file mode 100644 index 0000000..19b490b Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9.4_prod.apk differ diff --git a/qline_scripts/apks/qline_opd_v9_prod.apk b/qline_scripts/apks/qline_opd_v9_prod.apk new file mode 100644 index 0000000..e7f2bd3 Binary files /dev/null and b/qline_scripts/apks/qline_opd_v9_prod.apk differ diff --git a/qline_scripts/clear_logs.sh b/qline_scripts/clear_logs.sh new file mode 100644 index 0000000..7ebb254 --- /dev/null +++ b/qline_scripts/clear_logs.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ip) + DEVICE_IP="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +if [[ -z "$DEVICE_IP" ]]; then + echo "Usage: sh clear_logs.sh -ip " + exit 1 +fi + +LOG_PATH="/storage/emulated/0/Android/data/com.example.hmg_qline.hmg_qline/files/logs" + +# Remove all files in the logs directory on the device +adb -s $DEVICE_IP shell rm -rf "$LOG_PATH/*" + +echo "โœ… Logs cleared on $DEVICE_IP" diff --git a/qline_scripts/clear_logs_all.sh b/qline_scripts/clear_logs_all.sh new file mode 100644 index 0000000..b4884b8 --- /dev/null +++ b/qline_scripts/clear_logs_all.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# ===== Config ===== +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +LOG_PATH="/storage/emulated/0/Android/data/com.example.hmg_qline.hmg_qline/files/logs" + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh clear_logs_all.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh clear_logs_all.sh -ipfile " + exit 1 +fi + +# ===== Wi-Fi Check ===== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect to Devices and Clear Logs ===== +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(adb connect "$cleanIP:5555" 2>&1) + if [[ "$output" == *connected* ]]; then + echo "โœ… Connected to $cleanIP" + else + echo "โŒ Failed to connect to $cleanIP: $output" + continue + fi + + echo "๐Ÿงน Clearing logs on $cleanIP..." + adb -s "$cleanIP:5555" shell rm -rf "$LOG_PATH/*" + if [[ $? -eq 0 ]]; then + echo "โœ… Logs cleared on $cleanIP" + else + echo "โŒ Failed to clear logs on $cleanIP" + fi + +done + +echo "โœ… Done! Logs cleared on all devices." diff --git a/qline_scripts/connect_devices.sh b/qline_scripts/connect_devices.sh new file mode 100644 index 0000000..6af3b56 --- /dev/null +++ b/qline_scripts/connect_devices.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +# ===== Config ===== +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +APP_NAME="com.example.hmg_qline.hmg_qline/.MainActivity" +LOG_DIR="$SCRIPT_DIR/logs" +TIMEOUT_SECONDS=5 + +run_with_timeout() { + perl -e 'alarm $ARGV[0]; exec @ARGV[1..$#ARGV]' "$TIMEOUT_SECONDS" "$@" +} + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh connect_devices.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh connect_devices.sh -ipfile " + exit 1 +fi + + +# ===== Wi-Fi Check ===== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + + + +# Create log dir +mkdir -p "$LOG_DIR" + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect to Devices ===== +success_ips=() +failed_ips=() + +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" # strip port if exists + device="$cleanIP:5555" + + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(run_with_timeout adb connect "$device" 2>&1) + status=$? + + if [[ $status -ne 0 || "$output" != *connected* ]]; then + echo "โŒ Failed to connect to $cleanIP: $output" + failed_ips+=("$cleanIP") + else + echo "โœ… Connected to $cleanIP" + success_ips+=("$cleanIP") + fi +done + +echo "โœ… Connection complete." +echo "\n====== Summary ======" +echo "โœ… Success (${#success_ips[@]}):" +if [[ ${#success_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${success_ips[@]}" +else + echo " - None" +fi + +echo "โŒ Failed (${#failed_ips[@]}):" +if [[ ${#failed_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${failed_ips[@]}" +else + echo " - None" +fi diff --git a/qline_scripts/deploy_qline.sh b/qline_scripts/deploy_qline.sh new file mode 100755 index 0000000..715320e --- /dev/null +++ b/qline_scripts/deploy_qline.sh @@ -0,0 +1,206 @@ +#!/usr/bin/env bash + +# ===== Config ===== +APP_NAME="com.example.hmg_qline.hmg_qline/.MainActivity" +TIMEOUT_SECONDS=5 + +run_with_timeout() { + perl -e 'alarm $ARGV[0]; exec @ARGV[1..$#ARGV]' "$TIMEOUT_SECONDS" "$@" +} + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + -version) + APP_VERSION="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh deploy_qline.sh -ipfile -version " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh deploy_qline.sh -ipfile -version " + exit 1 +fi + +if [[ -z "$APP_VERSION" ]]; then + echo "Usage: sh deploy_qline.sh -ipfile -version " + exit 1 +fi + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +APK_PATH="$SCRIPT_DIR/apks/qline_opd_v${APP_VERSION}_prod.apk" + + +# ===== Wi-Fi Check ===== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + +# ===== Disconnect All Devices ===== +echo "๐Ÿ”Œ Disconnecting all devices..." +adb disconnect + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect and Deploy ===== +success_ips=() +failed_ips=() + +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" # strip port if exists + device="$cleanIP:5555" + + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(run_with_timeout adb connect "$device" 2>&1) + status=$? + if [[ $status -ne 0 || "$output" != *connected* ]]; then + echo "โŒ Failed to connect to $cleanIP: $output" + failed_ips+=("$cleanIP (connect)") + continue + fi + + echo "๐Ÿ“ฑ Processing $device..." + echo "๐Ÿ“ฆ Installing APK..." + if ! adb -s "$device" install -r "$APK_PATH"; then + echo "โŒ Install failed on $cleanIP" + failed_ips+=("$cleanIP (install)") + continue + fi + + echo "๐Ÿš€ Launching app..." + if ! adb -s "$device" shell am start -n "$APP_NAME"; then + echo "โŒ Launch failed on $cleanIP" + failed_ips+=("$cleanIP (launch)") + continue + fi + + success_ips+=("$cleanIP") +done + +echo "โœ… Deployment complete." +echo "\n====== Summary ======" +echo "โœ… Success (${#success_ips[@]}):" +if [[ ${#success_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${success_ips[@]}" +else + echo " - None" +fi + +echo "โŒ Failed (${#failed_ips[@]}):" +if [[ ${#failed_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${failed_ips[@]}" +else + echo " - None" +fi + + + +# Calling ==> ./deploy_qline.sh -ipfile device_ips_all.txt -version 9.2 + +# /Users/zik/Library/Android/sdk/platform-tools + + +# *********************** WOMEN HEALTH (Riyadh) *********************** + +# 1st Floor (OBG) + +# 10.71.50.45 - v9 +# 10.71.50.50 - v9 +# 10.71.50.57 - v9 +# 10.71.50.52 - v9 + + +# 2nd Floor (OBG) + +# 10.71.50.46 - v9 +# 10.71.50.47 - v9 +# 10.71.50.48 - v9 +# 10.71.50.49 - v9 + +# 6th Floor (IVF) + +# 10.71.50.53 - v9.3 qline_opd_v9.3_bg_fix_prod +# 10.71.50.56 - v9 + +# *********************** HMG-KHOBAR *********************** + +# 10.90.82.236 - v8.9 + +# *********************** TAKHASSUSI *********************** + +# (G-FLOOR) ORTHOPEDIC + +# 10.70.194.105 - v9.2 +# 10.70.194.87 - v9.2 + + +# *********************** SUWAIDI *********************** + + +# 10.80.31.37 - v9.3 (SWD Oncology & Family Med WA) +# 10.80.30.220 - v9 (SWD Oncology & Family Med WA) +# 10.80.31.67 - v9 (SWD Internal Med & Other Clinics WA) +# 10.80.31.80 - v9 (SWD Internal Med & Other Clinics WA) +# 10.80.31.100 - v9.3 (SWD PEDIATRIC & Other WA) -> qline_opd_v9.3_android_14.apk +# 10.80.31.103 - v9.3 (SWD PEDIATRIC & Other WA) -> qline_opd_v9.3_android_14.apk +# 10.80.31.104 - v9.3 (SWD OB-GYN & Other Clinics Waiting Area) -> qline_opd_v9.3_android_14.apk +# 10.80.30.234 - v9.3 (SWD OB-GYN & Other Clinics Waiting Area) -> qline_opd_v9.3_android_14.apk + + + + +# Deploy version 9 to all devices +# sh deploy_qline.sh -ipfile device_ips_all.txt -version 9 + + +# Deploy to Khobar location only +# sh deploy_qline.sh -ipfile device_ips_khobar.txt -version 8.9 + + +# Deploy to Takhassusi hospital +# sh deploy_qline.sh -ipfile device_ips_tak.txt -version 8.9 + + +# Deploy to Women's Health center +# sh deploy_qline.sh -ipfile device_ips_tak_women.txt -version 9 \ No newline at end of file diff --git a/qline_scripts/device_ips_all.txt b/qline_scripts/device_ips_all.txt new file mode 100644 index 0000000..1fa6817 --- /dev/null +++ b/qline_scripts/device_ips_all.txt @@ -0,0 +1,59 @@ +10.70.194.105 +10.70.194.87 +10.70.6.139 +10.70.6.141 +10.70.6.142 +10.70.6.114 +10.70.6.143 +10.70.6.49 +10.70.6.56 +10.70.6.144 +10.70.6.158 +10.70.6.119 +10.70.6.156 +10.70.6.109 +10.70.6.102 +10.70.6.107 +10.70.6.137 +10.70.6.93 +10.70.6.147 +10.70.6.148 +10.70.6.98 +10.70.6.112 +10.70.6.96 +10.70.6.145 +10.70.6.91 +10.90.82.236 +10.71.50.45 +10.71.50.46 +10.71.50.47 +10.71.50.48 +10.71.50.49 +10.71.50.50 +10.71.50.52 +10.71.50.53 +10.71.50.56 +10.71.50.57 +10.80.31.37 +10.80.30.220 +10.80.31.67 +10.80.31.80 +10.80.31.103 +10.80.31.100 +10.80.31.104 +10.80.30.234 +10.80.30.227 +10.80.32.31 +10.80.35.165 +10.80.35.212 +10.80.35.218 +10.80.31.28 +10.80.35.211 +10.80.36.111 +10.80.32.16 +10.80.35.219 +10.80.36.114 +10.80.36.135 +10.80.36.138 +10.80.36.132 +10.80.36.139 diff --git a/qline_scripts/device_ips_cs_test.txt b/qline_scripts/device_ips_cs_test.txt new file mode 100644 index 0000000..37ea8c8 --- /dev/null +++ b/qline_scripts/device_ips_cs_test.txt @@ -0,0 +1,2 @@ +10.20.10.29 + diff --git a/qline_scripts/device_ips_khobar.txt b/qline_scripts/device_ips_khobar.txt new file mode 100644 index 0000000..f745bb8 --- /dev/null +++ b/qline_scripts/device_ips_khobar.txt @@ -0,0 +1 @@ +10.90.82.236 diff --git a/qline_scripts/device_ips_swd.txt b/qline_scripts/device_ips_swd.txt new file mode 100644 index 0000000..33041e1 --- /dev/null +++ b/qline_scripts/device_ips_swd.txt @@ -0,0 +1,33 @@ +10.80.31.37 +10.80.30.220 +10.80.31.67 +10.80.31.80 +10.80.31.103 +10.80.31.100 +10.80.31.104 +10.80.30.234 +10.80.30.227 +10.80.32.31 +10.80.35.165 +10.80.35.212 +10.80.35.218 +10.80.31.28 +10.80.35.211 +10.80.36.111 +10.80.32.16 +10.80.35.219 +10.80.36.114 +10.80.36.135 +10.80.36.138 +10.80.36.132 +10.80.36.139 +10.80.26.74 +10.80.26.78 +10.80.35.108 +10.80.36.145 +10.80.20.106 +10.80.20.110 +10.80.31.148 + + + diff --git a/qline_scripts/device_ips_tak.txt b/qline_scripts/device_ips_tak.txt new file mode 100644 index 0000000..4004265 --- /dev/null +++ b/qline_scripts/device_ips_tak.txt @@ -0,0 +1,27 @@ +10.70.6.139 +10.70.6.141 +10.70.6.142 +10.70.6.114 +10.70.6.143 +10.70.6.49 +10.70.6.56 +10.70.6.144 +10.70.6.158 +10.70.6.119 +10.70.6.156 +10.70.6.109 +10.70.6.102 +10.70.6.107 +10.70.6.137 +10.70.6.93 +10.70.6.147 +10.70.6.148 +10.70.6.98 +10.70.6.112 +10.70.6.96 +10.70.6.145 +10.70.6.91 +10.70.6.157 +10.70.6.159 +10.70.6.128 + diff --git a/qline_scripts/device_ips_tak_women.txt b/qline_scripts/device_ips_tak_women.txt new file mode 100644 index 0000000..345e360 --- /dev/null +++ b/qline_scripts/device_ips_tak_women.txt @@ -0,0 +1,11 @@ +10.71.50.45 +10.71.50.46 +10.71.50.47 +10.71.50.48 +10.71.50.49 +10.71.50.50 +10.71.50.52 +10.71.50.53 +10.71.50.56 +10.71.50.57 + diff --git a/qline_scripts/extract_all_logs.sh b/qline_scripts/extract_all_logs.sh new file mode 100644 index 0000000..90bfefc --- /dev/null +++ b/qline_scripts/extract_all_logs.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# ===== Config ===== +LOG_DIR="$(pwd)/logs" +LOG_PATH="/storage/emulated/0/Android/data/com.example.hmg_qline.hmg_qline/files/logs" + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh extract_all_logs.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh extract_all_logs.sh -ipfile " + exit 1 +fi + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Extract Logs from All Devices ===== +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(adb connect "$cleanIP:5555" 2>&1) + if [[ "$output" == *connected* ]]; then + echo "โœ… Connected to $cleanIP" + else + echo "โŒ Failed to connect to $cleanIP: $output" + continue + fi + + echo "๐Ÿ“ฅ Extracting logs from $cleanIP..." + adb -s "$cleanIP:5555" shell ls "$LOG_PATH" + adb -s "$cleanIP:5555" pull "$LOG_PATH" "$LOG_DIR" +done + +echo "โœ… Done! Logs extracted from all devices." + + diff --git a/qline_scripts/extract_logs.sh b/qline_scripts/extract_logs.sh new file mode 100644 index 0000000..a45dff7 --- /dev/null +++ b/qline_scripts/extract_logs.sh @@ -0,0 +1,70 @@ + +#!/usr/bin/env bash + +# ===== Config ===== +LOG_DIR="$(pwd)/logs" +LOG_PATH="/storage/emulated/0/Android/data/com.example.hmg_qline.hmg_qline/files/logs" + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ip) + DEVICE_IP="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh extract_logs.sh -ip " + exit 1 + ;; + esac +done + +if [[ -z "$DEVICE_IP" ]]; then + echo "Usage: sh extract_logs.sh -ip " + exit 1 +fi + +# ===== Create Local Log Directory ===== +mkdir -p "$LOG_DIR" + +# ===== Connect to Device ===== +cleanIP="${DEVICE_IP%%:*}" # strip port if exists +echo "๐Ÿ”Œ Connecting to $cleanIP..." +output=$(adb connect "$cleanIP:5555" 2>&1) +if [[ "$output" == *connected* ]]; then + echo "โœ… Connected to $cleanIP" +else + echo "โŒ Failed to connect to $cleanIP: $output" + exit 1 +fi + +# ===== Check if Device is Available ===== +if ! adb -s "$DEVICE_IP" get-state >/dev/null 2>&1; then + echo "โŒ Device $DEVICE_IP is not available via ADB" + exit 1 +fi + +# ===== Check if Log Directory Exists on Device ===== +echo "๐Ÿ“ Checking if log directory exists on device..." +if ! adb -s "$DEVICE_IP" shell "test -d '$LOG_PATH'" 2>/dev/null; then + echo "โŒ Log directory not found on device: $LOG_PATH" + echo "๐Ÿ’ก Available directories in Android/data/com.example.hmg_qline.hmg_qline/files/:" + adb -s "$DEVICE_IP" shell "ls -la /storage/emulated/0/Android/data/com.example.hmg_qline.hmg_qline/files/" 2>/dev/null || echo "โŒ Could not list files directory" + exit 1 +fi + +# ===== List Log Files ===== +echo "๐Ÿ“‹ Listing log files on device..." +adb -s "$DEVICE_IP" shell "ls -la '$LOG_PATH'" + +# ===== Extract Logs ===== +echo "๐Ÿ“ฅ Extracting logs from $DEVICE_IP..." +if adb -s "$DEVICE_IP" pull "$LOG_PATH" "$LOG_DIR"; then + echo "โœ… Logs extracted successfully from $DEVICE_IP to $LOG_DIR" +else + echo "โŒ Failed to extract logs from $DEVICE_IP" + exit 1 +fi \ No newline at end of file diff --git a/qline_scripts/kill_qline.sh b/qline_scripts/kill_qline.sh new file mode 100755 index 0000000..f71a8c5 --- /dev/null +++ b/qline_scripts/kill_qline.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +# ===== Config ===== +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +APP_PACKAGE="com.example.hmg_qline.hmg_qline" +TIMEOUT_SECONDS=5 + +run_with_timeout() { + perl -e 'alarm $ARGV[0]; exec @ARGV[1..$#ARGV]' "$TIMEOUT_SECONDS" "$@" +} + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh kill_qline.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh kill_qline.sh -ipfile " + exit 1 +fi + +# ===== Wi-Fi Check ===== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect and Kill App ===== +success_ips=() +failed_ips=() + +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" # strip port if exists + device="$cleanIP:5555" + + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(run_with_timeout adb connect "$device" 2>&1) + status=$? + if [[ $status -ne 0 || "$output" != *connected* ]]; then + echo "โŒ Failed to connect to $cleanIP: $output" + failed_ips+=("$cleanIP (connect)") + continue + fi + + echo "๐Ÿ“ฑ Processing $device..." + echo "โŒ Force-stopping app..." + if ! adb -s "$device" shell am force-stop "$APP_PACKAGE"; then + echo "โŒ Force-stop failed on $cleanIP" + failed_ips+=("$cleanIP (kill)") + continue + fi + + success_ips+=("$cleanIP") +done + +echo "โœ… Kill operation complete." +echo "\n====== Summary ======" +echo "โœ… Success (${#success_ips[@]}):" +if [[ ${#success_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${success_ips[@]}" +else + echo " - None" +fi + +echo "โŒ Failed (${#failed_ips[@]}):" +if [[ ${#failed_ips[@]} -gt 0 ]]; then + printf ' - %s\n' "${failed_ips[@]}" +else + echo " - None" +fi diff --git a/qline_scripts/one_device_ip.txt b/qline_scripts/one_device_ip.txt new file mode 100644 index 0000000..43d2163 --- /dev/null +++ b/qline_scripts/one_device_ip.txt @@ -0,0 +1 @@ +10.80.35.212 \ No newline at end of file diff --git a/qline_scripts/qline_installation_records.txt b/qline_scripts/qline_installation_records.txt new file mode 100644 index 0000000..96787c7 --- /dev/null +++ b/qline_scripts/qline_installation_records.txt @@ -0,0 +1,71 @@ + + *********************** WOMEN HEALTH (Riyadh) *********************** + + 1st Floor (OBG) + + 10.71.50.45 - v9 + 10.71.50.50 - v9 + 10.71.50.57 - v9 v9.3 qline_opd_v9.3_bg_fix_prod + 10.71.50.52 - v9 + + + 2nd Floor (OBG) + + 10.71.50.46 - v9 + 10.71.50.47 - v9 + 10.71.50.48 - v9 + 10.71.50.49 - v9 + + 6th Floor (IVF) + + 10.71.50.53 - v9.3 qline_opd_v9.3_bg_fix_prod + 10.71.50.56 - v9 + + *********************** HMG-KHOBAR *********************** + + 10.90.82.236 - v8.9 + + *********************** TAKHASSUSI *********************** + + (G-FLOOR) ORTHOPEDIC + + 10.70.194.105 - v8.9 + 10.70.194.87 - v8.9 + + + *********************** SUWAIDI *********************** + + + + + 10.80.31.37 - v9.3 (SWD Oncology & Family Med WA) -> qline_opd_v9.3_android_14.apk + 10.80.30.220 - v9 (SWD Oncology & Family Med WA) -> qline_opd_v9.3_android_14.apk + 10.80.31.67 - v9 (SWD Internal Med & Other Clinics WA) -> qline_opd_v9.3_android_14.apk + 10.80.31.80 - v9 (SWD Internal Med & Other Clinics WA) -> qline_opd_v9.3_android_14.apk + 10.80.31.103 - v9.3 (SWD PEDIATRIC & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.31.100 - v9.3 (SWD PEDIATRIC & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.31.104 - v9.3 (SWD OB-GYN & Other Clinics Waiting Area) -> qline_opd_v9.3_android_14.apk + 10.80.30.234 - v9.3 (SWD OB-GYN & Other Clinics Waiting Area) -> qline_opd_v9.3_android_14.apk + 10.80.30.227 - v9.3 (SWD CARDIOLOGY & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.32.31 - v9.3 (SWD CARDIOLOGY & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.35.165 - v9.3 (SWD Urology & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.35.212 - v9.3 (SWD Urology & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.35.218 - v9.3 (SWD General Surgery & Other Waiting Area) -> qline_opd_v9.3_android_14.apk + 10.80.31.28 - v9.3 (SWD General Surgery & Other Waiting Area) -> qline_opd_v9.3_android_14.apk + 10.80.35.211 - v9.3 (SWD ENT & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.36.111 - v9.3 (SWD ENT & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.32.16 - v9.3 (SWD PULMONARY and Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.35.219 - v9.3 (SWD Ophthalmology & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.36.114 - v9.3 (SWD Ophthalmology & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.36.135 - v9.3 (SWD Dermatology / Wound Care / Plastic Surgery & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.36.138 - v9.3 (SWD Dermatology / Wound Care / Plastic Surgery & Other WA) -> qline_opd_v9.3_android_14.apk + 10.80.36.132 - v9.3 (SWD Gastroenterology / NEUROLOGY / DIABETIC EDUCATOR / GP Departments WA ) -> qline_opd_v9.3_android_14.apk + 10.80.36.139 - v9.3 (SWD Gastroenterology / NEUROLOGY / DIABETIC EDUCATOR / GP Departments WA ) -> qline_opd_v9.3_android_14.apk + 10.80.26.78 - v9.3 (SWD ORTHOPEDIC / SPINAL SURGERY / NEURO SURGERY/ PAIN CLINIC / Departments) -> qline_opd_v9.3_android_14.apk + 10.80.26.74 - v9.3 (SWD ORTHOPEDIC / SPINAL SURGERY / NEURO SURGERY/ PAIN CLINIC / Departments) -> qline_opd_v9.3_android_14.apk + 10.80.35.108 - v9.3 SWD Ophthalmology & Other WA -> qline_opd_v9.3_android_14.apk + 10.80.36.145 - v9.3 SWD Dental & Other WA -> qline_opd_v9.3_android_14.apk + 10.80.20.110 - v9.3 SWD Physiotherapy Male WA -> qline_opd_v9.3_android_14.apk + 10.80.20.106 - v9.3 SWD Physiotherapy Female WA -> qline_opd_v9.3_android_14.apk + 10.80.31.148 - v9.3 SWD Oncology & Family Med WA -> qline_opd_v9.3_android_14.apk + \ No newline at end of file diff --git a/qline_scripts/restart_qline.sh b/qline_scripts/restart_qline.sh new file mode 100755 index 0000000..b3c8139 --- /dev/null +++ b/qline_scripts/restart_qline.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +# ===== Config ===== +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +APP_NAME="com.example.hmg_qline.hmg_qline/.MainActivity" +LOG_DIR="$SCRIPT_DIR/logs" + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh restart_qline.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh restart_qline.sh -ipfile " + exit 1 +fi + +# ===== Wi-Fi Check ==== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + + + +# Create log dir +mkdir -p "$LOG_DIR" + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect to Devices ===== +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" # strip port if exists + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(adb connect "$cleanIP:5555" 2>&1) + if [[ "$output" == *connected* ]]; then + echo "โœ… Connected to $cleanIP" + else + echo "โŒ Failed to connect to $cleanIP: $output" + fi +done + +# ===== Get Connected Devices ===== +devices=$(adb devices | awk 'NR>1 && $2=="device" {print $1}') + +for device in $devices; do + echo "๐Ÿ“ฑ Processing $device..." + + echo "โŒ Closing app if running..." + adb -s "$device" shell am force-stop "${APP_NAME%%/*}" + + echo "๐Ÿš€ Launching app..." + adb -s "$device" shell am start -n "$APP_NAME" + + log_file="$LOG_DIR/logs_${device//[^a-zA-Z0-9]/_}.txt" + echo "๐Ÿ“ Logging to $log_file" + adb -s "$device" logcat -s flutter > "$log_file" & +done + +echo "โœ… Done! Logs are saved to $LOG_DIR" diff --git a/qline_scripts/uninstall_qline.sh b/qline_scripts/uninstall_qline.sh new file mode 100755 index 0000000..ef6ab22 --- /dev/null +++ b/qline_scripts/uninstall_qline.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# ===== Config ===== +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +APP_PACKAGE="com.example.hmg_qline.hmg_qline" +LOG_DIR="$SCRIPT_DIR/logs" + +# ===== Parse Arguments ===== +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -ipfile) + IP_FILE="$2" + shift # past argument + shift # past value + ;; + *) + echo "Unknown option: $1" + echo "Usage: sh uninstall_qline.sh -ipfile " + exit 1 + ;; + esac +done + +if [[ -z "$IP_FILE" ]]; then + echo "Usage: sh uninstall_qline.sh -ipfile " + exit 1 +fi + +# ===== Wi-Fi Check ==== +wifi_interface=$(networksetup -listallhardwareports | \ + awk '/Wi-Fi|AirPort/{getline; print $2}') +current_ssid=$(networksetup -getairportnetwork "$wifi_interface" 2>/dev/null | \ + awk -F': ' '{print $2}' | tr '[:upper:]' '[:lower:]') + +expected_ssid="cloud solutions" + +if [[ "$current_ssid" != "$expected_ssid" ]]; then + echo "โŒ Not connected to required Wi-Fi network: $expected_ssid" + echo "๐Ÿ”Œ Current network: ${current_ssid:-Not connected}" + exit 1 +fi + +echo "โœ… Connected to correct Wi-Fi: Cloud Solutions" + + + +# Create log dir +mkdir -p "$LOG_DIR" + +# ===== Read IPs ===== +if [[ ! -f "$IP_FILE" ]]; then + echo "โŒ IP file not found at $IP_FILE" + exit 1 +fi + +ipList=() +while IFS= read -r line; do + [[ -n "$line" ]] && ipList+=("$line") +done < "$IP_FILE" + +if [[ ${#ipList[@]} -eq 0 ]]; then + echo "โŒ No IPs found in file" + exit 1 +fi + +echo "โœ… Found ${#ipList[@]} IPs" +printf '%s\n' "${ipList[@]}" + +# ===== Connect to Devices ===== +for ip in "${ipList[@]}"; do + cleanIP="${ip%%:*}" # strip port if exists + echo "๐Ÿ”Œ Connecting to $cleanIP..." + output=$(adb connect "$cleanIP:5555" 2>&1) + if [[ "$output" == *connected* ]]; then + echo "โœ… Connected to $cleanIP" + else + echo "โŒ Failed to connect to $cleanIP: $output" + fi +done + +# ===== Get Connected Devices ===== +devices=$(adb devices | awk 'NR>1 && $2=="device" {print $1}') + +for device in $devices; do + echo "๐Ÿ“ฑ Processing $device..." + + echo "โŒ Uninstalling app..." + adb -s "$device" uninstall "$APP_PACKAGE" + + if [[ $? -eq 0 ]]; then + echo "โœ… Successfully uninstalled $APP_PACKAGE from $device" + else + echo "โŒ Failed to uninstall $APP_PACKAGE from $device" + fi +done + +echo "โœ… Done! Uninstallation process completed." \ No newline at end of file