Show file type upon import failure

This commit is contained in:
Bnyro 2022-11-17 15:33:40 +01:00
parent 3036e8bf5f
commit 8315345818

View File

@ -47,7 +47,8 @@ class ImportHelper(
* Get a list of channel IDs from a file [Uri]
*/
private fun getChannelsFromUri(uri: Uri): List<String> {
return when (activity.contentResolver.getType(uri)) {
val fileType = activity.contentResolver.getType(uri)
return when (fileType) {
"application/json" -> {
// NewPipe subscriptions format
val mapper = ObjectMapper()
@ -70,7 +71,7 @@ class ImportHelper(
}
}.orEmpty()
}
else -> throw IllegalArgumentException("Unsupported file type")
else -> throw IllegalArgumentException("Unsupported file type: $fileType")
}
}