mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Support deleting all episodes in a series
This commit is contained in:
		
							parent
							
								
									14d16590a1
								
							
						
					
					
						commit
						7f50f0ca14
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -241,7 +241,20 @@ class DownloadViewModel : ViewModel() {
 | 
			
		|||
    fun handleMultiDelete(context: Context) = viewModelScope.launchSafe {
 | 
			
		||||
        val selectedItemsList = selectedItems.value ?: mutableListOf()
 | 
			
		||||
 | 
			
		||||
        val ids = selectedItemsList.map { it.data.id }
 | 
			
		||||
        val ids = selectedItemsList.flatMap { item ->
 | 
			
		||||
            when (item) {
 | 
			
		||||
                is VisualDownloadCached.Header -> {
 | 
			
		||||
                    if (item.data.type.isEpisodeBased()) {
 | 
			
		||||
                        context.getKeys(DOWNLOAD_EPISODE_CACHE)
 | 
			
		||||
                            .mapNotNull { context.getKey<VideoDownloadHelper.DownloadEpisodeCached>(it) }
 | 
			
		||||
                            .filter { it.parentId == item.data.id }
 | 
			
		||||
                            .map { it.id }
 | 
			
		||||
                    } else listOf(item.data.id)
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                is VisualDownloadCached.Child -> listOf(item.data.id)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        val (seriesNames, names) = selectedItemsList.map { item ->
 | 
			
		||||
            when (item) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue