mirai icon indicating copy to clipboard operation
mirai copied to clipboard

feat: Add support to `each` action

Open RodolfoSilva opened this issue 1 year ago • 2 comments

Description

The idea of this action is to allow the user to perform sequential actions when necessary. For example, when the user clicks on a button, this action should show a toast and send a request to the server. Or copy something to the clipboard and show a dialog.

So we can declare this like that:

{
  "type": "textButton",
  "child": {
    "type": "text",
    "data": "BUTTON"
  },
  "onPressed": {
    "actionType": "each",
    "actions": [
      {
        "actionType": "copyToClipBoard",
        "value": "Some value"
      },
      {
        "actionType": "showToast",
        "value": "Value copied to clipboard"
      },
      {
        "actionType": "vibrate",
        "pattern": [0, 1, 1, 0, 1, 0, 1, 1, 1]
      }
    ]
  }
}

Related Issues

Type of Change

  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Code refactor
  • [ ] Build configuration change
  • [ ] Documentation
  • [ ] Chore

RodolfoSilva avatar Aug 04 '23 00:08 RodolfoSilva

This is just a proposal @i-asimkhan, @divyanshub024?

Do you have any suggestions?

RodolfoSilva avatar Aug 04 '23 00:08 RodolfoSilva

This is just a proposal @i-asimkhan, @divyanshub024?

Do you have any suggestions?

@RodolfoSilva This is a great idea, we really were looking for this. Let's discuss the naming and other stuff.

i-asimkhan avatar Aug 04 '23 06:08 i-asimkhan