这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Epictek
Copy link
Contributor

@Epictek Epictek commented Aug 14, 2018

Currently, the output of the checkbox dialogue is useless when trying to parse with any JSON parser as you can't loop over the array of strings with something such as JQ as it's not valid json. Checkbox dialog now returns a values array with objects containing the index and value of the selected item. The index is useful for keeping track of values.

{ "code": -1,
  "text": "[test1, test2]",
  "values": [
    {
      "index": 0,
      "text": "test1"
    },
    {
      "index": 1,
      "text": "test2"
    }
  ]
}

For other dialogs which only return a single value but you are able to choose from a list I added an index to the result.

{ "code": 0,
  "text": "test2",
  "index": 1
}

Epictek and others added 2 commits August 14, 2018 05:04
Add index of values


Added index for other dialogs
@fornwall fornwall merged commit 82bc794 into termux:master Aug 25, 2018
@fornwall
Copy link
Member

Thanks! This will be available in version 0.27 of the Termux:API app which will be available shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants