这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@benmoran
Copy link
Contributor

This allows termux-notification actions to use Direct Reply, available since Android N.

If you include the special $REPLY pseudo-variable in the button actions, then on tapping the button in the notification you get a reply prompt. The action script is called back with that in double quotes.

termux-notification --button1 'REPLY' --button1-action 'termux-toast $REPLY' -c 'Direct reply'

If the user presses REPLY and enters "some text" then this will call:

termux-toast "some text"

(I guess this will need documentation in termux-api-packages - I'm happy to do that if people want to include the feature.)

@xalexalex xalexalex self-assigned this Jan 10, 2020
@xalexalex
Copy link
Contributor

Great job!

I like how you handled ongoing notifications, but I feel that for non-ongoing notifications creating a new notification to inform the user that the reply action was handled correctly is a bit too much from a UX point of view (requiring the user to swipe the notification away) while perhaps a toast would do.

I know that then this toast would clash with a possible toast triggered by the button action, but still, I feel that button actions with a $REPLY most likely will not be used to trigger a toast, and this risk would be minimal while a notification every time would be a more constant hindrance.

What do you think?

@benmoran
Copy link
Contributor Author

... I feel that for non-ongoing notifications creating a new notification to inform the user that the reply action was handled correctly is a bit too much from a UX point of view (requiring the user to swipe the notification away) while perhaps a toast would do...
What do you think?

Yes, I think you're right. I've pushed a new branch which just removes the notification on receiving a non-ongoing reply. The user can decide themselves what they want to do in the button action. Do you think that's better?

@xalexalex xalexalex merged commit 51e6a4b into termux:master Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants