Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset intent extension configurations in WidgetKit

I have an application where a user can login. If a user is logged in, then I display a placeholder for my widget and it's configurable through an intent extension.

The configuration has two options:

  • the first option depends on the username of the user currently logged in.
  • the second option depends on the value of the first option.

This works fine for 1 user, however, if the user logs out, then logs in with a different account, the old selected options are still selected when they try to configure the widget, which are wrong options since it's now a different user. Also, the old data is still shown in the widget.

How do I reset the configuration of a widget in WidgetKit? Meaning, when the user tries to configure it all the previous configurations would be unselected and empty.

I tried

WidgetCenter.shared.reloadAllTimelines()

But that only reloads the timeline methods but does not reset configurations.

I've looked at Apple's documentations and could not find anything about it either.

Thanks a lot,

like image 542
K.A.Q Avatar asked Sep 06 '20 12:09

K.A.Q


1 Answers

You cant. the only option you have is to ignore the configuration option on the widget side and show some kind of error message to the user that their config needs to be updated. INExtension does not provide a way to handle this (yet)

like image 77
cup_of Avatar answered Oct 05 '22 01:10

cup_of