application-services icon indicating copy to clipboard operation
application-services copied to clipboard

Bookmarks - support getting an arbitrary number of nested children information

Open Mugurell opened this issue 4 years ago • 2 comments

Saw in a recent PR for Fenix - https://github.com/mozilla-mobile/fenix/pull/21212 the need to know how many children are in current node's childrens. Based on this we would know whether to offer a menu option to open all bookmarks from a child folder in new tabs or don't show such an option when a child folder does is empty.

bookmarks_get_tree allows getting info about all nested children but for our usecase this is a bit wasteful.

Tried adding a method which takes a byte argument allowing to query up to 127 levels of nested children (Byte.MAX_VALUE) but then saw that that number gets mapped to a boolean in lib.rs so there isn't a straightforward way of getting the needed info.

┆Issue is synchronized with this Jira Task

Mugurell avatar Nov 01 '21 14:11 Mugurell

To make sure I understand, you'd like that param to actually be treated as an integer "depth" value rather than a boolean, right? (FWIW, it's not a boolean due to some strange JNI issue that forces us to use ints in place of a bool). If so, I think that will be quite easy - the implementation already supports that - so I think we'd just change the param to be a real int, and ensure the existing callers all pass 0 or 1 instead of False/True, and then you could specify 2, which I think would allow that Fenix issue to be implemented. Does that sound correct?

mhammond avatar Nov 09 '21 23:11 mhammond

Yes, that's exactly what I think we need.

Mugurell avatar Nov 10 '21 07:11 Mugurell

Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1865194

Change performed by the Move to Bugzilla add-on.

mhammond avatar Nov 16 '23 19:11 mhammond