damus-io / damus

iOS nostr client
GNU General Public License v3.0
2k stars 289 forks source link

Swipe navigation: swipe left to side-menu from posts view #1408

Open alltheseas opened 1 year ago

alltheseas commented 1 year ago

user story

As a pleb Damus user who utilizes multiples timelines, I would like to be able to swipe left from posts view to the side menu view and vice versa, so that I can easily and more quickly swap between different views.

acceptance criteria

  1. when on posts view, when swiping to the left user transitions to side-menu view 1b. When on side menu view, when swiping right user transitions to posts view
  2. when on posts & replies view, when swiping to the left user transitions to posts view 2a. when on universe view, when swiping to the left user transitions to posts & replies view

related & complementary to

https://github.com/damus-io/damus/issues/1182

origin: tanel https://damus.io/note16umtl7ff085x6v2gf2f04q3fg73pkdqqm4mdfd6umcrqmhyj64hs8tdye4

danieldaquino commented 1 year ago

Started experimenting the drag to open side menu to get an idea of how to best implement this.

danieldaquino commented 1 year ago

I spent some time on this, and I found that implementing the dragging gesture to open the side menu is not very difficult, but there is a big problem.

There is a dragging conflict when trying to drag the side menu on the home tab. It seems that SwiftUI allows my custom drag gesture to happen only for a brief moment and then the gesture gets canceled in favour of doing the drag gesture for the tab view itself.

I have searched and tried several strategies to give the side menu drag gesture priority over swiping between pages on the home view when at the leftmost page, but none of them seem to work. It seems that we currently have 4 options for this ticket. I can either:

  1. Remove the ability to swipe between "Posts" and "Post and replies", as well as other swipeable sub-tabs in other tabs. Easy but users won't be able to swipe those
  2. Add an invisible view at the edge of the screen that can detect the drag gesture without conflict — but then we can only open the side menu if we drag from the very edge. Medium difficulty, nice behaviour, but maybe does not fully meet acceptance criteria
  3. Create a custom TabView replacement that allows swiping between pages but no swipe bouncing to the left when on the leftmost page. We can get the expected behaviour, but it is the hardest/longest/most-complex
  4. Continue researching alternative ways to make this work

@jb55, @alltheseas, which option do you prefer?

alltheseas commented 1 year ago

Does the complex solution 3. eat up a disproportionate amount of your time?

If yes, I would prioritize rest of sprint and https://github.com/damus-io/damus/issues/67 per todays conversations.

alltheseas commented 1 year ago

To add, if we learn something through the course of a ticket that changes the balance of the sprint plan (for instance increased complexity), that's OK. With this info we can plan subsequent sprints, and we do not have to stick to such a ticket.