mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 01:04:31 +01:00
Concurrent Map Exception Fix
This commit is contained in:
parent
eb7c6966d7
commit
98433bb961
@ -174,12 +174,10 @@ internal class SpotiFlyerListStoreProvider(dependencies: SpotiFlyerList.Dependen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<TrackDetails>.updateTracksStatuses(map: HashMap<String, DownloadStatus>): List<TrackDetails> {
|
private fun List<TrackDetails>.updateTracksStatuses(map: Map<String, DownloadStatus>): List<TrackDetails> {
|
||||||
val titleList = this.map { it.title }
|
val updatedList = ArrayList(this)
|
||||||
val updatedList = mutableListOf<TrackDetails>().also { it.addAll(this) }
|
LinkedHashMap(map).forEach { newTrack ->
|
||||||
|
indexOfFirst { it.title == newTrack.key }.let { position ->
|
||||||
for (newTrack in map) {
|
|
||||||
titleList.indexOf(newTrack.key).let { position ->
|
|
||||||
if (position != -1) {
|
if (position != -1) {
|
||||||
updatedList.getOrNull(position)?.copy(
|
updatedList.getOrNull(position)?.copy(
|
||||||
downloaded = newTrack.value,
|
downloaded = newTrack.value,
|
||||||
|
Loading…
Reference in New Issue
Block a user