icefields / Power-Ampache-2

second version of my popular ampache Android app
GNU General Public License v3.0
48 stars 2 forks source link

Crashes when logging in using auth token. #23

Closed icefields closed 5 months ago

icefields commented 5 months ago

When logging in using a token (instead of a username/password combination), no username is retrieved from the server, this is causing a crash on playlists, since I use the username to determine which playlists the user is allowed to edit.

"kotlin.UninitializedPropertyAccessException: lateinit property currentUsername has not been initialized\n\tat luci.sixsixsix.powerampache2.presentation.screens.playlists.PlaylistsViewModel.isCurrentUserOwner(PlaylistsViewModel.kt:51)\n\tat luci.sixsixsix.powerampache2.presentation.screens.playlists.PlaylistsScreenKt$PlaylistsScreen$2$1$2$1$invoke$$inlined$itemsIndexed$default$3.invoke(LazyDsl.kt:434)\n\tat luci.sixsixsix.powerampache2.presentation.screens.playlists.PlaylistsScreenKt$PlaylistsScreen$2$1$2$1$invoke$$inlined$itemsIndexed$default$3.invoke(LazyDsl.kt:180)\n\tat

lachlan-00 commented 5 months ago

Screenshot_20240131_170840_Power Ampache 2.jpg

That affects the username too. When I open with api token that says error instead of username

icefields commented 5 months ago

yes, "ERROR" is my debug error string to make it clear to me that the data is unavailable. You're not getting the username, that's why you see ERROR as your username. I removed token login option for now, I will close this issue and open a new feature ticket "Enable token login". Users logging in with a token won't be able to edit playlists and all the other features that depend on the username will be disabled.