IceCubesApp icon indicating copy to clipboard operation
IceCubesApp copied to clipboard

feat: Supports quickly switching accounts with a swipe-up gesture on …

Open dploeger opened this issue 2 years ago • 13 comments

…the tab bar on iOS

Like I said on Mastodon, this is my first dabble in SwiftUI and Swift, so here be dragons (probably).

It implements switching the current account by simply swiping up on the tab bar. I'm open to suggestions.

dploeger avatar Jan 05 '24 07:01 dploeger

It's working! Now I wonder why not a long tab to bring the account selector too?

Dimillian avatar Jan 05 '24 07:01 Dimillian

It's working! Now I wonder why not a long tab to bring the account selector too?

I've removed the long tap. Should I re-add it?

dploeger avatar Jan 05 '24 07:01 dploeger

I'm wondering if the swipe should swap the account or present the account selector sheet. I think maybe present the account selector sheet?

Dimillian avatar Jan 05 '24 08:01 Dimillian

Maybe we could do both. The swipe is (or "feels") like a quick gesture, used for doing stuff swiftly, while the long press is for something more slower.

So maybe: long press for account selector sheet and swipe for switching the account?

dploeger avatar Jan 05 '24 08:01 dploeger

Sound good to test

Dimillian avatar Jan 05 '24 10:01 Dimillian

Could you please point me to the new code where you open the compose sheet in a tab? I'm not really sure how to trigger opening a sheet in SwiftUi.

dploeger avatar Jan 05 '24 10:01 dploeger

Hmm it won't be easy as the app account selector is not globally available. I would need to refactor a few stuff. For now it's in AppAccountsSelectorView and there is no way to trigger it easily. It's bundled with the rounded avatar button basically.

Dimillian avatar Jan 05 '24 10:01 Dimillian

Ah okay. Let me see, if I can manage the refactoring...

dploeger avatar Jan 05 '24 10:01 dploeger

Done. I've also rebased and saw how you implemented the sheet of the New button. Maybe the accountsSelectorView can be implemented the same way, but please just take a look.

dploeger avatar Jan 05 '24 12:01 dploeger

I'm testing it a bit, and I find that a tad confusing. Not sure this is the right direction :/

Dimillian avatar Jan 05 '24 17:01 Dimillian

Yeah, I'm with you on that. The code needs to look more beautiful.

dploeger avatar Jan 05 '24 17:01 dploeger

Yeah, I'm with you on that. The code needs to look more beautiful.

I was thinking about the UX, too. It's hard to discover. The TabView from SwiftUI is not really super extensible.

Dimillian avatar Jan 05 '24 19:01 Dimillian

That's true, but I think the flick gesture to switch accounts is a nice UX, thought it has to be documented because, yes, it's not obvious. But in day-to-day usage it's pretty nice. I could live without the long-press gesture tbh.

dploeger avatar Jan 05 '24 19:01 dploeger