lovetodream / capacitor-plugin-siri-shortcuts

Capacitor Plugin for Siri Shortcuts
MIT License
17 stars 6 forks source link

Donating shortcuts in for-loop #4

Closed JPsychotic closed 2 years ago

JPsychotic commented 2 years ago

Hello,

I tried donating shortcuts to siri in a for-loop but it is not working. If you create more than two shortcuts in one loop it does not show every shortcut in the iOS Shortcuts app.

You can reproduce the issue if you add another button to your Ionic/Angular sample project which executes the following function:

async forAction() {
  for (let i = 0; i < 4; i++) {
    await SiriShortcuts.donate({
      persistentIdentifier: `test${i}`,
      title: `Test ${i}`
    });
  }
}
lovetodream commented 2 years ago

Hello, Unfortunately I can't reproduce your problem. Did you click on Add Action -> Apps -> Your App in the Shortcuts App?

JPsychotic commented 2 years ago

Yes, I already tried it the way you described and I tried searching for the actions. I am deleting all actions before I'm clicking the button which executes the function I provided. Sadly I cannot see all donated actions in the Shortcuts App although the XCode console shows a donation entry for all actions with different IDs. When donated separately all actions show up in the app but when I'm donating in a for loop there are always some actions missing ☹

I am using an iPhone 8 with iOS 15.0.1 and my XCode version is 13.1.

lovetodream commented 2 years ago

Did you try to delay each donation a little bit? Or what happens if you donate the donations a second time (without deleting the first once), do all the actions show up in the shortcuts app then?

I am guessing that it might be some "spam protection" by Siri to prevent fraud.

Is your iPhone is a physical device? If yes, did you try it in a simulator, what happens there?

JPsychotic commented 2 years ago

sorry for the late reply - I was delayed by other work.

I already tried delaying the donation and donating multiple times but both changes do not work for me. If I have some spare time I will try it on the simulator as my iPhone is a physical device.

I refactored my code so that the user has to edit each shortcut on an extra page so the donations are not anymore in a loop and therefore work for me now.