maltaisn/another-notes-app

[Bug] Launcher shortcut "Reminders" not working

Closed this issue · 1 comments

Not much to say here. At least for me it just opens to the main "Notes" screen and doesn't actually show the reminders section.

The problem seems to be that checkedId in the NavigationViewModel isn't set, after the currentHomeDestination gets changed from within the Intent Handler in the MainActivity.

As a result of this checkedId and _currentHomeDestination are reset to their default values within the restoreSelection function in the NavigationViewModel (line 183-187).

// There's no checked destination. Only way this can happen is a checked label was
// removed. Go back to active notes.
checkedId = ITEM_ID_ACTIVE
list[1] = (list[1] as NavigationDestinationItem).copy(checked = true)
_currentHomeDestination.value = HomeDestination.Status(NoteStatus.ACTIVE)

A quick (and dirty) fix would be to make checkedId a public member of the companion object, so that its value can be changed directly from the Intent Handler. I'm not fully comfortable with this solution, as it violates some of the design patterns, but it would probably be the easiest solution.