Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Interactive Button Action not sent to App (HomeWidgetBackgroundWorker isSetupComplete always false) #219

Closed
lora-explora opened this issue Feb 2, 2024 · 8 comments

Comments

@lora-explora
Copy link

Hi, I just implemented the interactive functionality, where I increase a value that is displayed in my app(s).
Everything works well in Android, but for some reason the iOS action does not.

I noticed that:

  • I need to run the app on my device and not on the simulator, otherwise the perform() method of the AppIntent will not be called at all. Is this normal behaviour? If so, it could be added to the Readme for others.
  • In the HomeWidgetBackgroundWorker.run() method isSetupCompleted is always false, therefore my events are always appended to the queue.

I am happy for any pointer in the right direction!
Let me know if you need further info.

@Codestian
Copy link

I also experienced the same problem. My current solution is to directly go to the source code for home_widget and set the isSetupComplete variable to true right before the codes in the method. So far no issues, on both simulator and physical device, and after reboots.

@lora-explora
Copy link
Author

Aaah thanks!! This helped me figure it out. I for once dug a bit deeper and realised that I hadn't set the appGroupID in my dart code before registering the interactive callback 🤦 Therefore it really wasn't setup..
And I added "isSetupCompleted = true" to the end of the setupEngine method in the HomeWidgetBackgroundWorker.

@armandsLa
Copy link
Contributor

I created a fork with an option flag ignoreSetup added to the HomeWidgetBackgroundWorker.run method.

Use it like this: await HomeWidgetBackgroundWorker.run(url: _url, appGroup: Common.suiteName, ignoreSetup: true)

Update pubspec.yaml:

  home_widget:
    git:
      url: https://github.com/armandsLa/home_widget.git
      ref: main

@ABausG
Copy link
Owner

ABausG commented Feb 15, 2024

Hey all! Is it really that the setup never completes?
Are you running into these issues all the time? Or only when the App is/isn't opened in the background?

@armandsLa
Copy link
Contributor

armandsLa commented Feb 21, 2024

Yes, the isSetupCompleted flag is always false on iOS.

@armandsLa
Copy link
Contributor

I've noticed that sometimes, when I try to perform an action in a widget, it doesn't go through. This usually happens after a longer period of inactivity. The first action receives no response, but the second works as it should. I suspect this is due to the removal of isSetupCompleted, which checked if the platform channel was initialized and placed the action in a queue if it wasn't. It shouldn't be a gesture issue, as I can see the button changing its state.

@Codestian
Copy link

I've noticed that sometimes, when I try to perform an action in a widget, it doesn't go through. This usually happens after a longer period of inactivity. The first action receives no response, but the second works as it should. I suspect this is due to the removal of isSetupCompleted, which checked if the platform channel was initialized and placed the action in a queue if it wasn't. It shouldn't be a gesture issue, as I can see the button changing its state.

I also encountered this, I had to tap twice for the widget to retrieve data from the app.

@armandsLa
Copy link
Contributor

Here is a PR with a proper fix: #229

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

No branches or pull requests

4 participants