Add Support for User Created Actions and Contexts
Recently, we’ve gotten a Java Code feature that allows users to interact directly with Android APIs. This gives us the freedom to create custom solutions however we like.
However, to use the code, we still have to call the task where our code resides using Perform Task, which has limitations when used as an “interface.”
Unlike built-in Tasker actions, Perform Task only allows users to set two variables. While we can technically pass any variables, we still have to make sure their names match, which isn’t ideal.
Since Tasker doesn’t currently have a way to read a task’s description or comments, it becomes even harder to get a clear understanding of what our task is doing.
Hence, I propose adding a new ability for users to create custom actions and contexts to their own liking, with the same interface and usability as built-in ones.
Ideally, the workflow could be made similar to Widget v2, where the structure is defined using JSON, and optionally includes a built-in visual builder for convenience.
User Action
The input contains task information and input variables.
-
Title, Description, and Icon
-
Input and Output Variables, each with:
-
Title
-
Variable Name
-
Description
-
Default Value
-
Type (String, Array, File, Array, Images etc. similar to input dialog.)
-
This is the structure of JSON I imagine would look like for the task information and input variables.
This is for the output variables.
{
"outputs": [
{
"title": "Result Message",
"variable": "%result",
"description": "Returns the result or error message.",
"type": "string"
},
{
"title": "Output file",
"variable": "%file_path",
"description": "Full file path of edited file.",
"type": "file"
}
]
}
User context
As for the custom context, it would work mostly the same, with a title, description, icon, and output variables.
These user-defined contexts should also serve conditions interface, similar to events like Clipboard Changed or HTTP Request Received, allowing users to add conditions directly from the event/state context edit page.
{
"type": [
"event",
"state" // It can be both
],
"title": "Connecte",
"description": "Triggers when the clipboard content changes.",
"icon": "@drawable/ic_clipboard",
"category": "Custom",
"outputs": [
{
"title": "Clipboard Text",
"variable": "%cliptext",
"description": "The new clipboard text content.",
"type": "string"
}
],
"state": [ // a must for state context
{
"title": "Text Contains",
"value": "%match",
"active": true
},
{
"title": "Text Contains",
"value": "%match",
"active": false
}
]
}