mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	fix #43
This commit is contained in:
		
							parent
							
								
									f86d9881ae
								
							
						
					
					
						commit
						5ad5b5ea36
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		|  | @ -229,9 +229,13 @@ object APIHolder { | |||
|     fun Context.filterProviderByPreferredMedia(hasHomePageIsRequired: Boolean = true): List<MainAPI> { | ||||
|         val default = enumValues<TvType>().sorted().filter { it != TvType.NSFW }.map { it.ordinal } | ||||
|         val defaultSet = default.map { it.toString() }.toSet() | ||||
|         val currentPrefMedia = PreferenceManager.getDefaultSharedPreferences(this) | ||||
|         val currentPrefMedia = try { | ||||
|             PreferenceManager.getDefaultSharedPreferences(this) | ||||
|             .getStringSet(this.getString(R.string.prefer_media_type_key), defaultSet) | ||||
|             ?.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null }?: default | ||||
|             ?.mapNotNull { it.toIntOrNull() ?: return@mapNotNull null } | ||||
|         } catch (e: Throwable) { | ||||
|             null | ||||
|         } ?: default | ||||
|         val langs = this.getApiProviderLangSettings() | ||||
|         val allApis = apis.filter { langs.contains(it.lang) } | ||||
|             .filter { api -> api.hasMainPage || !hasHomePageIsRequired } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue