-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
163 - Improve connection errors UX (Webview) #165
Conversation
1b1f390
to
aa7091d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! A couple of comments inline, but this is an awesome improvement.
A couple of additional questions:
- Why add the double back to exit feature? Is it just to block the default behaviour of the back button? I think it'd be cleaner to let a single back press behave normally unless migrating.
- I'm concerned that you found a way to lose data and that this is just a patch for a larger issue. For example, does it also happen if I shut down my phone mid-migration, or switch to another app in some other way?
new Handler().postDelayed(new Runnable() { | ||
@Override public void run() { | ||
// After WAIT_MILLIS clean the back pressed history | ||
backToExitPressedOnce = false; | ||
} | ||
}, WAIT_MILLIS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of clearing it, why not just store the last date that the back was pressed? Then when it's called again you can check if the date < 2 seconds ago, and if not just update the date to now. This is a bit easier to read and avoids callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, your implementation seems simpler, I just made in this way because I copy & pasted the solution from Stackoverflow 😁
Why add the double back to exit feature? Is it just to block the default behaviour of the back button? I think it'd be cleaner to let a single back press behave normally unless migrating.
I've seen this behavior in Android when the app is in the middle of a process, because the user may react pressing back when an error is shown, but without a real intent to exit the app.
In the case of the login page, the user can enter the app again without losing any state or data, so going to remove the double press behavior for the login, and keep the rejection of leaving the app when the connection error happens while migrating.
e77c18f
to
c75ba44
Compare
Co-authored-by: Marc Abbyad <[email protected]>
30e78dc
to
d538da3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thanks for the quick turnaround.
Just waiting on a green build and then it's ready for AT.
Activity + Layout to catch connection errors and give the user the ability to retry after fix the connection, and the ability to leave the application only if it doesn't cause the user to lost data (when user is migrating the app).
Issue: #163
Implementation
A new activity and layout were implemented to catch connection errors and avoid the not so friendly Chrome view error screen. The implementation only covers Webview (and therefore the migration from XWalk to Webview). I tried to use the same implementation in XWalk (though I needed to make some adaptations of how XWalk catch errors) and it worked, but for some weird error it cause the app to fail after restart if the user leaves the app with the error activity, so taking into account that is not a priority and we are going to drop XWalk soon, I left Xwalk error management as it is now.
Improvements
Testing
Login page
Here is a recording with the user trying to load the app and sign-in for the first time. It shows different scenarios: user entering without connection, then retry again without connection. User press back living the app. Then enter again into the app, the app allows to sign-in without force closing the app when the connection is recovered.
Migration process
In the recording below the app was installed on top of the Xwalk version. It shows how the migration popup is shown and immediately the lack of connection is displayed by the connection error activity. The user then reconnects the WiFi and the process continue without problems.
Below the user tries to leave the app pressing back but the exit is prevented and a "toast" message is displayed asking the user to wait the migration process to finish:
Finally, here is the button "More info" showing the error code:
Notes