Compare commits
No commits in common. 'master_clone' and 'master' have entirely different histories.
master_clo
...
master
File diff suppressed because it is too large
Load Diff
@ -1,225 +0,0 @@
|
||||
package com.example.hmg_qline.hmg_qline
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import java.util.Calendar
|
||||
|
||||
/**
|
||||
* Utility class for scheduling app restart alarms.
|
||||
* Handles Android version-specific alarm scheduling with proper backward compatibility.
|
||||
*
|
||||
* Android Version Compatibility:
|
||||
* - Android 14+ (API 34): Uses USE_EXACT_ALARM or SCHEDULE_EXACT_ALARM with permission check
|
||||
* - Android 12-13 (API 31-33): Uses SCHEDULE_EXACT_ALARM with permission check
|
||||
* - Android 6-11 (API 23-30): Uses setExactAndAllowWhileIdle
|
||||
* - Android < 6 (API < 23): Uses setExact
|
||||
*/
|
||||
object AlarmScheduler {
|
||||
|
||||
private const val TAG = "AlarmScheduler"
|
||||
private const val RESTART_ALARM_REQUEST_CODE = 1001
|
||||
|
||||
/**
|
||||
* Schedule a daily restart alarm at the specified time.
|
||||
*
|
||||
* @param context Application context
|
||||
* @param hour Hour of day (0-23), default is 0 (midnight)
|
||||
* @param minute Minute (0-59), default is 15
|
||||
*/
|
||||
fun scheduleRestartAlarm(context: Context, hour: Int = 0, minute: Int = 15) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
|
||||
val intent = Intent(context, RestartAlarmReceiver::class.java).apply {
|
||||
action = RestartAlarmReceiver.ACTION_SCHEDULED_RESTART
|
||||
}
|
||||
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
RESTART_ALARM_REQUEST_CODE,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
// Calculate next alarm time
|
||||
val calendar = Calendar.getInstance().apply {
|
||||
set(Calendar.HOUR_OF_DAY, hour)
|
||||
set(Calendar.MINUTE, minute)
|
||||
set(Calendar.SECOND, 0)
|
||||
set(Calendar.MILLISECOND, 0)
|
||||
|
||||
// If the time has already passed today, schedule for tomorrow
|
||||
if (timeInMillis <= System.currentTimeMillis()) {
|
||||
add(Calendar.DAY_OF_YEAR, 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel any existing alarm first
|
||||
alarmManager.cancel(pendingIntent)
|
||||
|
||||
Log.d(TAG, "Scheduling restart alarm for: ${calendar.time}")
|
||||
Log.d(TAG, "Android SDK Version: ${Build.VERSION.SDK_INT}")
|
||||
|
||||
// Schedule based on Android version
|
||||
when {
|
||||
// Android 14+ (API 34+)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> {
|
||||
scheduleForAndroid14Plus(context, alarmManager, pendingIntent, calendar.timeInMillis)
|
||||
}
|
||||
// Android 12-13 (API 31-33)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||
scheduleForAndroid12To13(context, alarmManager, pendingIntent, calendar.timeInMillis)
|
||||
}
|
||||
// Android 6-11 (API 23-30)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
|
||||
alarmManager.setExactAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
calendar.timeInMillis,
|
||||
pendingIntent
|
||||
)
|
||||
Log.d(TAG, "Alarm scheduled using setExactAndAllowWhileIdle (API 23-30)")
|
||||
}
|
||||
// Android < 6 (API < 23)
|
||||
else -> {
|
||||
alarmManager.setExact(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
calendar.timeInMillis,
|
||||
pendingIntent
|
||||
)
|
||||
Log.d(TAG, "Alarm scheduled using setExact (API < 23)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule alarm for Android 14+ (API 34+)
|
||||
* Android 14 requires special handling for exact alarms.
|
||||
*/
|
||||
private fun scheduleForAndroid14Plus(
|
||||
context: Context,
|
||||
alarmManager: AlarmManager,
|
||||
pendingIntent: PendingIntent,
|
||||
triggerTime: Long
|
||||
) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
if (alarmManager.canScheduleExactAlarms()) {
|
||||
alarmManager.setExactAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
Log.d(TAG, "Alarm scheduled using setExactAndAllowWhileIdle (API 34+)")
|
||||
} else {
|
||||
// Fallback to inexact alarm if permission not granted
|
||||
alarmManager.setAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
Log.w(TAG, "Exact alarm permission not granted, using setAndAllowWhileIdle (API 34+)")
|
||||
}
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "SecurityException scheduling alarm: ${e.message}")
|
||||
// Fallback to inexact alarm
|
||||
alarmManager.setAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule alarm for Android 12-13 (API 31-33)
|
||||
*/
|
||||
private fun scheduleForAndroid12To13(
|
||||
context: Context,
|
||||
alarmManager: AlarmManager,
|
||||
pendingIntent: PendingIntent,
|
||||
triggerTime: Long
|
||||
) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
if (alarmManager.canScheduleExactAlarms()) {
|
||||
alarmManager.setExactAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
Log.d(TAG, "Alarm scheduled using setExactAndAllowWhileIdle (API 31-33)")
|
||||
} else {
|
||||
alarmManager.setAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
Log.w(TAG, "Exact alarm permission not granted, using setAndAllowWhileIdle (API 31-33)")
|
||||
}
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.e(TAG, "SecurityException scheduling alarm: ${e.message}")
|
||||
alarmManager.setAndAllowWhileIdle(
|
||||
AlarmManager.RTC_WAKEUP,
|
||||
triggerTime,
|
||||
pendingIntent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the scheduled restart alarm.
|
||||
*/
|
||||
fun cancelRestartAlarm(context: Context) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
|
||||
val intent = Intent(context, RestartAlarmReceiver::class.java).apply {
|
||||
action = RestartAlarmReceiver.ACTION_SCHEDULED_RESTART
|
||||
}
|
||||
|
||||
val pendingIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
RESTART_ALARM_REQUEST_CODE,
|
||||
intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
alarmManager.cancel(pendingIntent)
|
||||
Log.d(TAG, "Restart alarm cancelled")
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the app can schedule exact alarms.
|
||||
* Returns true for Android < 12 (always allowed) or if permission is granted on Android 12+.
|
||||
*/
|
||||
fun canScheduleExactAlarms(context: Context): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
alarmManager.canScheduleExactAlarms()
|
||||
} else {
|
||||
true // Always allowed on older versions
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open system settings to request exact alarm permission (Android 12+).
|
||||
*/
|
||||
fun requestExactAlarmPermission(context: Context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
try {
|
||||
val intent = Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
context.startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error opening exact alarm settings: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
package com.example.hmg_qline.hmg_qline
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
|
||||
/**
|
||||
* BroadcastReceiver for handling scheduled app restart alarms.
|
||||
* This is triggered by AlarmManager at the scheduled time (e.g., 12:15 AM).
|
||||
* Compatible with Android 14+ (API 34+) and older versions.
|
||||
*/
|
||||
class RestartAlarmReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RestartAlarmReceiver"
|
||||
const val ACTION_SCHEDULED_RESTART = "com.example.hmg_qline.SCHEDULED_RESTART"
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Log.d(TAG, "Received intent: ${intent.action}")
|
||||
|
||||
when (intent.action) {
|
||||
ACTION_SCHEDULED_RESTART -> {
|
||||
Log.d(TAG, "Scheduled restart triggered")
|
||||
launchApp(context)
|
||||
|
||||
// Re-schedule the alarm for the next day
|
||||
rescheduleAlarm(context)
|
||||
}
|
||||
Intent.ACTION_BOOT_COMPLETED,
|
||||
"android.intent.action.QUICKBOOT_POWERON",
|
||||
"com.htc.intent.action.QUICKBOOT_POWERON" -> {
|
||||
Log.d(TAG, "Boot completed - re-scheduling daily restart alarm")
|
||||
rescheduleAlarm(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchApp(context: Context) {
|
||||
try {
|
||||
Log.d(TAG, "Launching app via foreground service")
|
||||
|
||||
val serviceIntent = Intent(context, BootForegroundService::class.java).apply {
|
||||
putExtra("source", "scheduled_restart")
|
||||
}
|
||||
|
||||
// Use foreground service for Android 8.0+ (API 26+)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.startForegroundService(serviceIntent)
|
||||
} else {
|
||||
context.startService(serviceIntent)
|
||||
}
|
||||
|
||||
Log.d(TAG, "App launch initiated successfully")
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error launching app: ${e.message}")
|
||||
|
||||
// Fallback: try direct activity launch
|
||||
try {
|
||||
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
}
|
||||
context.startActivity(launchIntent)
|
||||
} catch (fallbackError: Exception) {
|
||||
Log.e(TAG, "Fallback launch also failed: ${fallbackError.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun rescheduleAlarm(context: Context) {
|
||||
try {
|
||||
// Re-schedule for the next day at 00:15
|
||||
AlarmScheduler.scheduleRestartAlarm(context, 0, 15)
|
||||
Log.d(TAG, "Alarm rescheduled for next day at 00:15")
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Error rescheduling alarm: ${e.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
target 'RunnerTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,29 +0,0 @@
|
||||
#!/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 <device_ip:port>"
|
||||
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"
|
||||
@ -1,86 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh clear_logs_all.sh -ipfile <device_ips.txt>"
|
||||
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."
|
||||
@ -1,111 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh connect_devices.sh -ipfile <device_ips.txt>"
|
||||
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
|
||||
@ -1,206 +0,0 @@
|
||||
#!/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 <device_ips.txt> -version <app_version>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh deploy_qline.sh -ipfile <device_ips.txt> -version <app_version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$APP_VERSION" ]]; then
|
||||
echo "Usage: sh deploy_qline.sh -ipfile <device_ips.txt> -version <app_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
|
||||
@ -1,59 +0,0 @@
|
||||
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
|
||||
@ -1,2 +0,0 @@
|
||||
10.20.10.29
|
||||
|
||||
@ -1 +0,0 @@
|
||||
10.90.82.236
|
||||
@ -1,33 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
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
|
||||
10.70.6.123
|
||||
10.70.6.132
|
||||
10.70.6.198
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh extract_all_logs.sh -ipfile <device_ips.txt>"
|
||||
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."
|
||||
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
|
||||
#!/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 <device_ip:port>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$DEVICE_IP" ]]; then
|
||||
echo "Usage: sh extract_logs.sh -ip <device_ip:port>"
|
||||
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
|
||||
@ -1,111 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh kill_qline.sh -ipfile <device_ips.txt>"
|
||||
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
|
||||
@ -1 +0,0 @@
|
||||
10.80.35.212
|
||||
@ -1,71 +0,0 @@
|
||||
|
||||
*********************** 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
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh restart_qline.sh -ipfile <device_ips.txt>"
|
||||
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"
|
||||
@ -1,98 +0,0 @@
|
||||
#!/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 <device_ips.txt>"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$IP_FILE" ]]; then
|
||||
echo "Usage: sh uninstall_qline.sh -ipfile <device_ips.txt>"
|
||||
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."
|
||||
Loading…
Reference in New Issue