Send/Import Flows Widgets - Select All
Moderator: Martin
Re: Send/Import Flows Widgets - Select All
While I can see the benefit of the checkbox to replace when importing, I also see the restriction is to protect users from misreplacing flows.
If the end users need to be updated with newer flows, you can create another flow to update it, using action Import Flows/Widgets, and tick Replace Existing. This is also useful for your devices which act as servers. You can push new modules to it using HTTP request and import it automagically and enable it afterward.
If the end users need to be updated with newer flows, you can create another flow to update it, using action Import Flows/Widgets, and tick Replace Existing. This is also useful for your devices which act as servers. You can push new modules to it using HTTP request and import it automagically and enable it afterward.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Send/Import Flows Widgets - Select All
I'd have to look further into that, but it doesn't sound like it would work well in my situation. I'm texting the flows to another person and having them open them in the text and open with Automagic, then importing them. Maybe I'm wrong, but it doesn't seem the import flow action would work in such a situation. If it would, then I guess if I end up having need to do this very often I can look into that. If it wouldn't, then the issue still stands that an overwrite ability would be useful, in which case perhaps it could save the pre-existing flow in another category which it could name something like "Flow Backups" before doing the import/overwrite.
Re: Send/Import Flows Widgets - Select All
It won't work directly as open the xml, import and replace directly. But you can create a flow with Trigger Single Intent Received. After the person receive the xml, share the xml file to Send/Share intent Received (Automagic Icon), then the flow will receive the path of the xml in {stream_uri} and import-replace that xml with Import flows/widgets.
Renaming old flow before overwriting is a good idea. Now, I fully support to add this replace feature upon manual importing flow.
Renaming old flow before overwriting is a good idea. Now, I fully support to add this replace feature upon manual importing flow.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Send/Import Flows Widgets - Select All
Cool, thanks for the suggestion! I don't anticipate needing to do this much, but I'll definitely look into it, as it sounds like an interesting thing to play with and it'll be nice to have if I need it later.
I use batch files to back up and restore settings for various programs, so I use that concept when doing that. I check if a backup already exists and, if it does, rename it with a .bak extension before doing another backup so as to not accidentally overwrite it. Of course, this method has its limitations, since running it twice would cause the .bak to be overwritten the second time, but it's just a basic batch script meant for very basic use, so good enough. If such an implementation were used in Automagic, it would probably just behave like any OS/file manager, and if a version already exists, it would create the new backup with a number appended to it, so you'd end up with a "Flow Backups" group with "Flow Name," "Flow Name-001," "Flow Name-002," etc (or "Flow Name 001" or "Flow Name (001)" or whatever). Even better would be to simply append the current date and time, so whenever a flow is backed up before an import, it would end up being named "Flow Name yyyymmdd-hhmmss" or something like that.
I use batch files to back up and restore settings for various programs, so I use that concept when doing that. I check if a backup already exists and, if it does, rename it with a .bak extension before doing another backup so as to not accidentally overwrite it. Of course, this method has its limitations, since running it twice would cause the .bak to be overwritten the second time, but it's just a basic batch script meant for very basic use, so good enough. If such an implementation were used in Automagic, it would probably just behave like any OS/file manager, and if a version already exists, it would create the new backup with a number appended to it, so you'd end up with a "Flow Backups" group with "Flow Name," "Flow Name-001," "Flow Name-002," etc (or "Flow Name 001" or "Flow Name (001)" or whatever). Even better would be to simply append the current date and time, so whenever a flow is backed up before an import, it would end up being named "Flow Name yyyymmdd-hhmmss" or something like that.
Re: Send/Import Flows Widgets - Select All
I tried setting up a flow with the send/share intent received trigger but it didn't work. I may be doing it wrong, but I think the problem is that, based on the trigger's description, it's executed when the send/share menu is used in an app and the data is shared with Automagic." I'm not sharing the flow I'm trying to import, I'm opening it from a text message. So is it not possible to do it?
Also, there are flow actions for importing, exporting, deleting, executing, and stopping, but not renaming, which would be useful for creating backups as described earlier.
Also, there are flow actions for importing, exporting, deleting, executing, and stopping, but not renaming, which would be useful for creating backups as described earlier.
Re: Send/Import Flows Widgets - Select All
Yes, you have to share the xml file. So usually you just tap open the xml file and open it using Automagic. Now, it become tap and long press, choose share (it may differ depends on your file manager), then at the share, choose Automagic send/share intent received. You have the additional share step in this case.
I agree too with the rename flows action, along with your backup concept too. I prefer append datetime to the old flow, as it will be a timestamp and never duplicate.
I agree too with the rename flows action, along with your backup concept too. I prefer append datetime to the old flow, as it will be a timestamp and never duplicate.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Send/Import Flows Widgets - Select All
So that creates a problem because the situation I'm working with is sending a flow via text to someone and having them add it to AutoMagic, replacing the older version if it exists. And, at least for Signal, the text messaging app I use, there is no share option. It would require first saving the file, then going into a file manager and sharing it, which seems to be along the lines of what you were thinking. That's a lot of extra steps, especially for someone not tech savvy. I actually think it's easier to just have them delete the old version first. Anyways, the bottom line is that it could really use an overwrite option while importing, as discussed. And if that's too difficult for some reason, even just the addition of a trigger for opening, versus sharing, a file with AutoMagic or for importing a flow and an action for renaming a flow, which would allow me to make my own flow to trigger when a flow is opened with or imported to AutoMagic which would look for an existing flow with that name, rename it if it exists, then import the new flow.
Re: Send/Import Flows Widgets - Select All
The feature addition is good, it is just we don't know when it will be implemented. So we need to find alternative workaround while waiting for it.
I found out that you can use Trigger UI Event, with
Event Type : Window opened
Package name : ch.gridvision.ppam.androidautomagic
contains text : Flow already exists
You can the use Control UI after the UI event trigger, use getTextInActiveWindow(), find the flow name using regex pattern and rename that flow.
use the {flowname} to rename or delete existing flow. pop a toast message to tell them to reopen the xml again (to import it again). So the hassle is only to open the xml file twice, once to trigger the error and rename the file. The second time is to import it correctly. Should be more user-friendly than asking them to save - open - share.
I found out that you can use Trigger UI Event, with
Event Type : Window opened
Package name : ch.gridvision.ppam.androidautomagic
contains text : Flow already exists
You can the use Control UI after the UI event trigger, use getTextInActiveWindow(), find the flow name using regex pattern and rename that flow.
Code: Select all
text = getTextInActiveWindow();
find = findAll(text, 'The flow named \'(.*)\' already exists. Please rename this flow to import the flow.', true);
flowname = find[0][1];
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Send/Import Flows Widgets - Select All
Genius! I'll look into that.
Re: Send/Import Flows Widgets - Select All
Not sure if I'm missing something, but I can't get this to work. The UI event trigger only has a spot for text, not title, which would be the "Flow already exists" you mentioned*. The text is "The flow named 'Flow Name' already exists. Please rename this flow to import the flow." I tried using part of that, but it wouldn't trigger. And if I try to import a duplicate flow in order to get the message to show, then go to the UI event trigger and select "Recent events" the event for the pertinent message box simply has "Text: Flow" which not only isn't enough to distinguish that particular message from possible other ones, but when I tried using just the word flow, it triggered constantly, running the flow over and over non-stop. For some reason, the text fields for all the events are mostly one word and at most two words.
*Based on the fact the text field shown when viewing recent events is "Flow," which isn't even in the message text, I'm guessing that, despite the field being named "text" instead of "title," it's actually referring to the title, which is misleading and inconsistent with other areas of AutoMagic. And either way, it doesn't work (I tried "Flow already exists" as you suggested, which also fails to trigger).
*Based on the fact the text field shown when viewing recent events is "Flow," which isn't even in the message text, I'm guessing that, despite the field being named "text" instead of "title," it's actually referring to the title, which is misleading and inconsistent with other areas of AutoMagic. And either way, it doesn't work (I tried "Flow already exists" as you suggested, which also fails to trigger).