Skip to content

Commit 3f68215

Browse files
committed
notification: do not allow empty id with --ongoing
Ongoing notifications can only be removed with termux-notification-remove, which requires the notification id. An ongoing notification without an id requires a reboot to be removed. This commit forbids creating such an "unremovable" notification.
1 parent 0b1845f commit 3f68215

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/termux-notification

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ done
114114

115115
if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
116116

117+
if [ "$OPT_ONGOING" == true ] && [ -z "$OPT_ID" ]; then
118+
echo "Ongoing notifications without an ID are not removable."
119+
echo "Please set an id with --id \"string\"."
120+
exit 1
121+
fi
122+
117123
set --
118124
if [ -n "$OPT_ACTION" ]; then set -- "$@" --es action "$OPT_ACTION"; fi
119125
if [ -n "$OPT_ALERT_ONCE" ]; then set -- "$@" --ez alert-once "$OPT_ALERT_ONCE"; fi

0 commit comments

Comments
 (0)