From 63790f65e9f581b615bc4a24fcd0c459dda8a7f6 Mon Sep 17 00:00:00 2001
From: Howard Wu <HowardWu20@outlook.com>
Date: Mon, 4 Mar 2024 14:52:55 +0800
Subject: [PATCH] function YesNoBox allow default no

---
 scripts/run.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/run.sh b/scripts/run.sh
index f4fd385..8b70858 100755
--- a/scripts/run.sh
+++ b/scripts/run.sh
@@ -18,8 +18,6 @@
 # Copyright (C) 2024 LSPosed Contributors
 #
 
-# DEBUG=--debug
-# CUSTOM_MAGISK=--magisk-custom
 if [ ! "$BASH_VERSION" ]; then
     echo "Please do not use sh to run this script, just execute it directly" 1>&2
     exit 1
@@ -41,8 +39,12 @@ function Radiolist {
 
 function YesNoBox {
     declare -A o="$1"
+    local default
+    [ "$2" ] && {
+        [ "$2" = "no" ] && default="--defaultno"
+    }
     shift
-    $DIALOG --title "${o[title]}" --yesno "${o[text]}" 0 0
+    $DIALOG --title "${o[title]}" --yesno "${o[text]}" "$default" 0 0
 }
 
 function DialogBox {
@@ -102,10 +104,8 @@ if (YesNoBox '([title]="Install GApps" [text]="Do you want to install GApps?")')
     COMMAND_LINE+=(--install-gapps)
 fi
 
-# if (YesNoBox '([title]="Remove Amazon Appstore" [text]="Do you want to keep Amazon Appstore?")'); then
-#     REMOVE_AMAZON=""
-# else
-#     REMOVE_AMAZON="--remove-amazon"
+# if (YesNoBox '([title]="Remove Amazon Appstore" [text]="Do you want to remove Amazon Appstore?")' no); then
+#     COMMAND_LINE+=(--remove-amazon)
 # fi
 
 if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the output?")'); then