"trigger" variable

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

"trigger" variable

Post by digitalstone » 22 Oct 2017 14:54

When evaluating the "trigger" variable inside a flow by triggering it manually it results in "Manual".
When evaluating the "trigger" variable inside a flow by triggering it by a widget, a screen testing screen-notification shows "widget Click"... yet the expression evaluates it as "Manual".

Not sure if this is a bug because i think i can see how this happens, but i think it is too unpractical.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: "trigger" variable

Post by Desmanto » 22 Oct 2017 16:35

What elements do you use to check it? Probably you assign value "Manual" to the {trigger} by using single equal sign. In Automagic,
trigger = "Manual"
is different with
trigger == "Manual"

Single equal sign (=) is to assign value, while double equal sign (==) is to check the value and return true or false.

I have expression to check for widget click in several flows, and it never fail me to be evaluated as "Manual".
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
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: "trigger" variable

Post by digitalstone » 22 Oct 2017 17:59

Desmanto wrote:What elements do you use to check it? Probably you assign value "Manual" to the {trigger} by using single equal sign. In Automagic,
trigger = "Manual"
is different with
trigger == "Manual"

Single equal sign (=) is to assign value, while double equal sign (==) is to check the value and return true or false.

I have expression to check for widget click in several flows, and it never fail me to be evaluated as "Manual".
I use my expression with double equal sign (==) to ensure to compare the values rather than assign a value.
What i use is simply:
Expression# 1: if (startsWith(trigger, "Manual") {return true} else return false; ....etc
Expression# 2: if (startsWith(trigger, "Widget") {return true) else return false; .....etc

Whether i execute the flow manually or by using the widget, it never reach Expression#2.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

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

Re: "trigger" variable

Post by Desmanto » 23 Oct 2017 01:22

It is too long. You can check the trigger just by the ==.
Expression 1 :

Code: Select all

trigger == "Manual"
in parallel with Expression 2 :

Code: Select all

trigger == "Widget Click"
Both expression will return true or false depends on the result of evaluation.

Try to add condition Debug Dialog to expression 1 to see the value of the trigger.

You can check my index why we should use parallel, search for "Multiple Choice".
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
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: "trigger" variable

Post by digitalstone » 24 Oct 2017 08:54

Thanks Desmanto
I should have linked the expressions parallel instead of serial to look at both values.

I kind of got away from that method because i saw an aweful lot of re-doing actions when parallel linking. I think i know why too now.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Post Reply