From 0b737e46b4d603bcc822048dde2903f5e1a982ad Mon Sep 17 00:00:00 2001 From: Yifei Ding Date: Tue, 9 Nov 2021 12:43:59 -0800 Subject: [PATCH] script: use whiptail for kiauh_update_dialogue --- scripts/ui/general_ui.sh | 12 ------------ scripts/ui/main_menu.sh | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/scripts/ui/general_ui.sh b/scripts/ui/general_ui.sh index 459b29f..aaffa84 100755 --- a/scripts/ui/general_ui.sh +++ b/scripts/ui/general_ui.sh @@ -41,18 +41,6 @@ print_header(){ bottom_border } -kiauh_update_msg(){ - top_border - echo -e "|${green} New KIAUH update available! ${default}| " - hr - echo -e "|${green} View Changelog: https://git.io/JnmlX ${default}| " - blank_line - echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${default}| " - echo -e "|${yellow} usually contain bugfixes, important changes or new ${default}| " - echo -e "|${yellow} features. Please consider updating! ${default}| " - bottom_border -} - ################################################################################ #******************************************************************************# ################################################################################ diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index 48569b8..2fe0ef0 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -25,18 +25,22 @@ print_kiauh_version(){ } kiauh_update_dialog(){ - kiauh_update_msg - read -p "${cyan}Do you want to update now? (Y/n):${default} " yn - while true; do - case "$yn" in - Y|y|Yes|yes|"") - do_action "update_kiauh" - break;; - N|n|No|no) break;; - *) - deny_action "kiauh_update_dialog";; - esac - done + whiptail --title "New KIAUH update available!"\ + --yesno \ +"View Changelog: https://git.io/JnmlX + +It is recommended to keep KIAUH up to date. Updates usually contain bugfixes, \ +important changes or new features. Please consider updating! + +Do you want to update now?" \ + $KIAUH_WHIPTAIL_NORMAL_HEIGHT $KIAUH_WHIPTAIL_NORMAL_WIDTH + + RET=$? + if [ $RET -eq 0 ]; then + do_action "update_kiauh" + else + deny_action "kiauh_update_dialog" + fi } main_menu(){