Skip to content

Widgets stop functioning after changing book #607

@czan

Description

@czan

Steps to reproduce the behaviour

  1. Create two books.
  2. With Book 1 active, create a widget looking at any account in Book 1
  3. Open Book 2 (making it active), then restart your device
  4. Observe that the widget created in step 2 no longer displays the selected account

Expected behaviour

The widget continues to display the account it was created with.

Actual behaviour

The widget displays "Account name" and one button which does nothing (there are two buttons if this is done on the develop branch). Clicking on the widget also does nothing.

If you re-open Book 1 and restart your device the widget will return to displaying the correct account.

My Thoughts

I've taken a look at the code, and the configuration saving/restoring needs to be rewritten. It's currently stored in the SharedPreferences for the account's book, but then if/when the widget is updated it tries to read the active book's SharedPreferences. We can solve this by either

  1. having one big "widget" SharedPreferences object, and storing the book as another option for each widget, or
  2. we can have a separate SharedPreferences object for each widget

I have a slight preference for the second option, but the first is more similar to the current implementation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions