wait until flow(s) finish(es)

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

wait until flow(s) finish(es)

Post by tsolignani » 30 Aug 2019 14:44

Good afternoon again.

Which is the best wsy to let a flow start only when another flow or bunch of finishes?

I have a text into the clipboard and have to decide where to share or save it through an input dialog, multi-choice.

I can choose, say, three items, that means i would like to share that text to 3 different destinations (say whatsapp, facebook, save to disk).

To perform every share/save I call a flow each.

The matter is that the flow cannot run cuncurrently for the use control UI, so the should run one after each other.

Best way to do that, if any?

Thank you.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: wait until flow(s) finish(es)

Post by Desmanto » 30 Aug 2019 18:28

If all of the flow which execute certain CUI task must be perfomed in series (one at a time), then you can use looped execute flows to do it. Tick wait for the called flows to finish. This way, even if you have 10 app with CUI, you can perform them one by one. You have several way to do this actually.
1. You can put each app + CUI in separate flow. From the multiple dialog, loop thru {value} index and execute each flow name one by one. This takes up as many flows as you need for the app, +1 for the clipboard flow.
2. Put all app + CUI in a single flow separated by expression. The expression check for the value that is currently loop. So the execute flow execute the same flow, but with different {command} variable you pass to it. This takes only 2 flows, 1 clipboard flow, and another flow to hold all the separated command app + CUI.
3. Put all app + CUI in the same flow with the clipboard flow. You don't need execute flow, but instead put all the separated expression in the same flow. After each branch of App + CUI, loop back to the same loop control for after the multiple expression. This require only single flow, one to rule them all!

Depends on how many your App + CUI pair, I would recommend the 2nd option, 1 clipboard flow and 1 combined App + CUI flow. This will make your flow much tidy and you can reuse the App + CUI flow from another flow (by using execute flow too).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: wait until flow(s) finish(es)

Post by tsolignani » 03 Sep 2019 07:31

It took me a while to understand and another bit to implement it, but it worked and now I learned something new which will be useful again.

Thank you.

Post Reply