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

Fix widgets getting stuck or disappearing #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rondao
Copy link

@rondao rondao commented Dec 27, 2024

What is it?

  • Bugfix

Description of the changes in your PR

A Widget gridItem is created with widgetId -1.
When a Widget was binded for the first time, a widgetId is generated by appWidgetHost.
However, this widgetId was not saved at DB.

During an onResume(), refreshLaunchers() would be called, and then call fetchGridItems().
This would reset the widgetId to -1 and disconnect it from the widgetId generated by appWidgetHost, causing weird behaviors.

Another problem is that a new widgetId was being generated everytime we replaced the Widget at a restart process.

  • Changed so bindWidget() is only called when binding the Widget for the first time, and then we save the widgetId at the DB.

  • Later on, when recreating the screen, we retrieve the widgetId from DB and call placeAppWidget() to replace the Widget where it was.

Fixes the following issue(s)

There are many Widget related issues.

Acknowledgement

A Widget gridItem is created with widgetId -1.
When a Widget was binded for the first time, a
widgetId is generated by appWidgetHost.
However, this widgetId was not saved at DB.

During an onResume(), refreshLaunchers() would be
called, and then call fetchGridItems().
This would reset the widgetId to -1 and disconnect
it from the widgetId generated by appWidgetHost,
causing weird behaviors.

Another problem is that a new widgetId was being
generated everytime we replaced the Widget at a
restart process.

Changed so bindWidget() is only called when
binding the Widget for the first time, and then
we save the widgetId at the DB.

Later on, when recreating the screen, we retrieve
the widgetId from DB and call placeAppWidget() to
replace the Widget were it was.

Signed-off-by: Rafael Rondão <[email protected]>
@Aga-C
Copy link
Member

Aga-C commented Dec 27, 2024

I don't know how #74 was reproduced before with the broken Widgets, but I couldn't reproduce it with this PR.

Your PR has fixed it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants