Open Thaodan opened 4 years ago
It was this way a long time ago, but changed to buttons to better handle the error cases (rate limit, connection issues). With this change, you lose your text when an error occurs.
Hm maybe a pulley menu then? Piepmatz uses a pulley menu and avoids this issue. Can't you go back a page once the error occurs?
I don't think a pulley menu is any better than a normal button.
You can reopen the page when an error occurs, but you need to keep the text outside of the SendLinkPage, as it gets destroyed as that page is removed from the pagestack, and reopen that page from wherever the user is at that moment, which can be anywhere in the app.. As you can see this is a can of worms, and not an easy fix.
Hm a pulley-menu at least can depend on the condition to push the pagestack only when the api call was successful.
I have the same situation in my Sailfin application, where I needed to implement a login flow. What I do is when the user submits their login details, I push a new page to the stack with just a loading indicator instead of popping the current page. When the link is successfully submitted, I pop the two pages of the stack, but if an error occurs, I only pop the page with the spinner icon.
Use a Dialog and DialogHeader instead of a button to make the creation of posts easier and more native. Fixes a common pitfall as described in the sailfishos documentation: https://sailfishos.org/develop/docs/silica/sailfish-application-pitfalls.html/#Using%20buttons%20instead%20of%20platform-style%20gestures