HTTP-Shortcuts icon indicating copy to clipboard operation
HTTP-Shortcuts copied to clipboard

What about showing the result in a new notice?

Open RuofengX opened this issue 3 years ago • 2 comments

Show the request result in a system notice. Also when running js script, a waiting circle icon will show up, it is a foreground animation so you can do nothing but wait the result.

RuofengX avatar May 23 '21 16:05 RuofengX

I added a series of js codes to show the latency of one request, and js scripts cause a foreground animation showing up, and I can do nothing but wait. Also I want the result could show up in a notice and user can do further things such as copy it to the clipboard, see the detail or just retry .

RuofengX avatar May 23 '21 16:05 RuofengX

Just to clarify: By "system notice" you mean a notification, i.e., you want the request to be sent in the background and the result to be displayed in a notification, possibly with additional actions?

I like the idea, though it will require quite a bit of refactoring for this to work. The app currently relies on being in the foreground (hence the blocking loading spinner), as the Android OS would otherwise kill the request before it's done.

Waboodoo avatar May 23 '21 19:05 Waboodoo

@Waboodoo I'd love the option to use a notification instead of the foreground spinner too. I often run a shortcut that takes a few seconds, and I have to wait for it to complete each time. I'd love for it to run in the background instead!

I definitely get that this could take some work to implement; totally ok if that makes it low priority. Let me know if you want me to open a new issue to track instead of commenting here.

(And thank you for this app, it's amazing!)

snarfed avatar Apr 01 '23 04:04 snarfed

@snarfed There is actually already a possibility to do this, it's just super hidden and limited right now, and I'm planning to improve this eventually, but for now:

You can make a shortcut run (partially) in the background (i.e., without showing the spinner), if all of the following apply:

  • Your shortcut does not use file parameters or a file body
  • Your shortcut does not use Scripting to handle the response or errors
  • Your shortcut does not display its response in a dialog window or fullscreen window
  • If the response is displayed in a toast popup, the app holds the Notification permission (you can add it through the app settings, outside the app)
  • Your shortcut is not configured to store the response into a file
  • Your shortcut is not configured to wait for an internet connection
  • Your shortcut's variables hold no larger values (less than 8000 characters in total)
  • Battery saver and data saver modes are disabled (or the app is exempt from them)

If all of these conditions apply, then your shortcut should be able to run without the spinner.

Waboodoo avatar Apr 04 '23 17:04 Waboodoo

Awesome! This does indeed work. Thank you!

Before this, I had my shortcuts configured to show a toast on error. I'm definitely looking forward to your eventual work to use a notif instead of a spinner, or whatever your planned improvement is, so I can turn that back on. I'll file a new issue to track it. Thanks again!

snarfed avatar Apr 05 '23 03:04 snarfed