warmshowers / wsandroid

Unofficial WarmShowers app for Android
Apache License 2.0
42 stars 22 forks source link

Unconfirmed user #354

Closed mariha closed 4 years ago

mariha commented 4 years ago

When user creates an account the e-mail address they provided needs to be verified. Util they confirm, they can log in but they don't have access to most resources so the server returns 403 errors. I changed the code so that they get a message with some hints what is going on. This solves https://github.com/warmshowers/wsandroid/issues/327.

This could happen when loading users on the Map, Searching for specific users or checking Messages. I updated all these places. We might also consider sending a request to check permissions when user logs in for the first time on the device (seems for me more intuitive).

I added filtering to exception handling. It is based on http error codes, so that:

Also:

I was thinking of changing error handling, moving towards having one place where different exception types and http error codes are translated to messages and displayed, so that it is more uniform across that app and we could easily hook some more robust logging/analytics. So far I started to placed it in HttpErrorHelper. And I changed Errors to HttpExceptions where applicable so we could differentiate exception handling behavior based on ex type and error code.

I tried (quite hard) to write tests for my changes, gave up with threads though. I still hope to come back to it later.

mariha commented 4 years ago

Hey @saemy, it should be good for the review. I thought I rebased my branch on warmshowrs/develop, looks like I didn't though... so I had to merge at the end. If it was an issue let me know and I'll create fresh branch with clean history.

mariha commented 4 years ago

Please disregard this PR, I created #355 instead.