-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Add initial authentication storage #644
Conversation
This PR became quite massive and I'm a bit lost in what still needs to happen etc. so I did some final cleaning and marking it ready or review. I think there's still some small bugs which I'd say are easier to fix in future PR's instead of this one, but let me know what you think about that @thornbill. |
This is crashing on launch for me on a Fire Stick:
|
Discovery crash should be fixed now. Used this source (which explains flows and coroutines quite well). Basically I did an illegal operation by using |
Bug found:
|
I've found a couple things so far:
|
app/src/main/java/org/jellyfin/androidtv/auth/AuthenticationRepository.kt
Show resolved
Hide resolved
The tests are failing due to a reference to some old code
|
5a7a46b
to
3e9e110
Compare
I realized that I accidently pushed some changes I was working on for the CardPresenter to optimize it. But since those changes were ready for review I'll leave them in. edit: I did actually find an issue with it, the fallback tiles were missing their colors. So I removed my changes. |
3e9e110
to
6733c99
Compare
Just tested this again in an emulator and noticed the following issues:
|
I just realized it only works for users not saved. I'll fix that.
Did you restart the app? There is a bug where new servers only show up after restart. The fix for that one will be in another PR because I expect it to be quite large. |
We now remember if a user has a password (using a boolean) in the offline data set. If a user fails to authenticate because a password was added it will prompt for a password. If it's the other way around the user can just proceed in the password-prompt with an empty password and the boolean will be updated for future logins.
copied from commit message We now remember if a user has a password (using a boolean) in the offline data set. If a user fails to authenticate because a password was added it will prompt for a password. If it's the other way around the user can just proceed in the password-prompt with an empty password and the boolean will be updated for future logins. |
I still seem to be randomly prompted for a password when logging in and out with a passwordless user. This can probably be addressed later though. Let's get this in once the conflicts are resolved. 👍 |
# Conflicts: # app/src/main/java/org/jellyfin/androidtv/JellyfinApplication.kt # app/src/main/java/org/jellyfin/androidtv/TvApp.java # app/src/main/java/org/jellyfin/androidtv/di/AppModule.kt # app/src/main/java/org/jellyfin/androidtv/ui/home/HomeFragment.java # app/src/main/java/org/jellyfin/androidtv/ui/preference/category/authentication.kt
Changes
Future pull requests
TODO
Issues
Part of #612
Dev notes
The AlertFragment uses callbacks passed via the constructor. This is not a good idea for 2 reasons
We should aim for fragments that are not dependent on other fragments/activies. All UI should only interact via viewmodels with repositories/services/etc. and data should be passed via Bundles.
Other
I decided to use UUID everywhere since this is what the new apiclient does too. In order to make things work I added a few helper methods to convert string -> uuid that support the "simple" format (which doesn't use hyphens). Because those UUID's differ from the strings in the old credentials I needed to convert strings -> uuid -> string a bunch of times. This will all be solved when we remove the legacy credential support and upgrade to the new apiclient.
I've also decided to use Kotlin's flow internally and convert it to Android's LiveData at the end of the pipeline because a flow is much easier to work with and provides a more rich API. I added a helper method for flows too to collect them to a
LiveData<List<T>>
.