mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
fix opening public playlists
This commit is contained in:
parent
e481756b68
commit
f57262da6a
@ -53,7 +53,7 @@ object PlaylistsHelper {
|
||||
|
||||
suspend fun getPlaylist(playlistId: String): Playlist {
|
||||
// load locally stored playlists with the auth api
|
||||
return when (getPlaylistType()) {
|
||||
return when (getPrivatePlaylistType(playlistId)) {
|
||||
PlaylistType.PRIVATE -> RetrofitInstance.authApi.getPlaylist(playlistId)
|
||||
PlaylistType.PUBLIC -> RetrofitInstance.api.getPlaylist(playlistId)
|
||||
PlaylistType.LOCAL -> {
|
||||
@ -227,11 +227,11 @@ object PlaylistsHelper {
|
||||
return importLists
|
||||
}
|
||||
|
||||
fun getPlaylistType(): PlaylistType {
|
||||
fun getPrivatePlaylistType(): PlaylistType {
|
||||
return if (loggedIn()) PlaylistType.PRIVATE else PlaylistType.LOCAL
|
||||
}
|
||||
|
||||
fun getPlaylistType(playlistId: String): PlaylistType {
|
||||
fun getPrivatePlaylistType(playlistId: String): PlaylistType {
|
||||
if (playlistId.all { it.isDigit() }) return PlaylistType.LOCAL
|
||||
if (playlistId.matches(pipedPlaylistRegex)) return PlaylistType.PRIVATE
|
||||
return PlaylistType.PUBLIC
|
||||
|
@ -108,7 +108,7 @@ class HomeFragment : BaseFragment() {
|
||||
runOnUiThread {
|
||||
makeVisible(binding.playlistsRV, binding.playlistsTV)
|
||||
binding.playlistsRV.layoutManager = LinearLayoutManager(context)
|
||||
binding.playlistsRV.adapter = PlaylistsAdapter(playlists.toMutableList(), PlaylistsHelper.getPlaylistType())
|
||||
binding.playlistsRV.adapter = PlaylistsAdapter(playlists.toMutableList(), PlaylistsHelper.getPrivatePlaylistType())
|
||||
binding.playlistsRV.adapter?.registerAdapterDataObserver(object :
|
||||
RecyclerView.AdapterDataObserver() {
|
||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||
|
@ -123,7 +123,7 @@ class LibraryFragment : BaseFragment() {
|
||||
|
||||
val playlistsAdapter = PlaylistsAdapter(
|
||||
playlists.toMutableList(),
|
||||
PlaylistsHelper.getPlaylistType()
|
||||
PlaylistsHelper.getPrivatePlaylistType()
|
||||
)
|
||||
|
||||
// listen for playlists to become deleted
|
||||
|
@ -110,7 +110,7 @@ object PlayingQueue {
|
||||
fun insertPlaylist(playlistId: String, newCurrentStream: StreamItem) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
try {
|
||||
val playlistType = PlaylistsHelper.getPlaylistType(playlistId)
|
||||
val playlistType = PlaylistsHelper.getPrivatePlaylistType(playlistId)
|
||||
val playlist = PlaylistsHelper.getPlaylist(playlistId)
|
||||
add(
|
||||
*playlist.relatedStreams
|
||||
|
Loading…
Reference in New Issue
Block a user