orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.7k stars 305 forks source link

Default notebook is ignored when adding notes from notification and '+' of widget #1006

Closed jflinchbaugh closed 2 years ago

jflinchbaugh commented 2 years ago

I have default notebook set to my 'GTD' notebook, but every time I open a new note from notification or from widget, it picks randomly between my 'GTD' list and my 'Grocery' list, so new notes often mysteriously end up in the Grocery list. Adding from widgets used to work fine, but has been misbehaving for the past few months at least.

jflinchbaugh commented 2 years ago

Default notebook may be working for quick note from notification, but new note and widget are adding randomly to any notebook for which I have a search and widget.

jflinchbaugh commented 2 years ago

if i add a widget that views a 3rd list "b.Beer" in my case, then I can get that 3rd list in the random rotation of chosen notebooks.

nevenz commented 2 years ago

If the selected query in the widget contains b, that notebook will be selected when widget's + is tapped. If not, the default notebook from the preference should be used.

I can't reproduce this. Does "Default notebook" value match the notebook's name exactly (note that the value of #+TITLE is not matched against) ? Make sure there are no extra spaces or such. ( That preference should really be a notebook selector. )

jflinchbaugh commented 2 years ago

Your description of how it should work sounds very intuitive, and exactly what I'd expect. :smile:

Here's a reproduction that builds up to what I'm seeing:

I have 3 notebooks in place: GTD, Grocery, Beer, basically in that order in the Notebook List.

I usually have 3 widgets:

If I REMOVE all the widgets, I can set the Default Notebook to "GTD" or "Beer", and the "New Note" works fine from the notification shade.

If I leave the Default List as "Beer", and add the Grocery widget, then the notification and the + both show "Grocery" as the list when it opens the "New Note" screen. (Notification is using the widget's "b.Grocery", it seems.)

Once I add a second widget, my "Next" widget from above, then both the notification and the + on either widget start choosing randomly between "Grocery" and "GTD".

If I had to diagnose, I'd guess it's grabbing the first widget it finds, and that list isn't deterministically ordered. I'm sure grabbing the widget that owned the + was the intended behavior. I'm not sure what to do with the notification trying to choose from widgets, though. (Am I a weirdo for having more than 1 widget?)

I've pulled a copy of the code, because I think it would be fun to look, but I haven't really setup Android Studio yet.

Thanks for your time.

nevenz commented 2 years ago

Thanks, that was useful, I managed to reproduce it.

All pending intents for new-note (created for ongoing notification and all widgets) were the same (to Android, as only extra data was different). So notification setup and selecting queries for the widget were overwriting each other's pending intents.

It should work now with the fix (with multiple widgets too).

jflinchbaugh commented 1 year ago

I'm glad to see this fixed, but I don't think it was released.