Skip to content

Commit

Permalink
Fixed get related track conflicting
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrave-dev committed Sep 2, 2023
1 parent f77fdbb commit d5c8915
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ object Queue {
return queue
}
fun clear() {
queue = ArrayList()
queue.clear()
}
fun setNowPlaying(song: Track) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand Down Expand Up @@ -67,15 +68,18 @@ class FetchQueue: Service() {
}
}
}
stopSelf()
}
}
}
return START_NOT_STICKY
}

override fun onDestroy() {
job.cancel()
super.onDestroy()
job.cancel()
scope.cancel()
Log.d("FetchQueue", "onDestroy: ")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,9 @@ class NowPlayingFragment : Fragment() {
}
}
Log.d("Queue", "getRelated: ${listWithoutDuplicateElements.size}")
Queue.clear()
Queue.addAll(listWithoutDuplicateElements)
Log.d("Queue", "getRelated: ${Queue.getQueue().size}")
if (!requireContext().isMyServiceRunning(FetchQueue::class.java)) {
requireActivity().startService(
Intent(
Expand Down

0 comments on commit d5c8915

Please sign in to comment.