allow unknown file types for importing subscriptions

This commit is contained in:
Bnyro 2022-11-17 19:04:43 +01:00
parent 78bd4c4992
commit 0b157b560c

View File

@ -44,7 +44,7 @@ class ImportHelper(
).show() ).show()
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG(), e.toString()) Log.e(TAG(), e.toString())
Toast.makeText(activity, R.string.server_error, Toast.LENGTH_SHORT).show() Toast.makeText(activity, e.localizedMessage, Toast.LENGTH_SHORT).show()
} }
} }
@ -53,7 +53,7 @@ class ImportHelper(
*/ */
private fun getChannelsFromUri(uri: Uri): List<String> { private fun getChannelsFromUri(uri: Uri): List<String> {
return when (val fileType = activity.contentResolver.getType(uri)) { return when (val fileType = activity.contentResolver.getType(uri)) {
"application/json" -> { "application/json", "application/octet-stream" -> {
// NewPipe subscriptions format // NewPipe subscriptions format
val mapper = ObjectMapper() val mapper = ObjectMapper()
val json = activity.contentResolver.openInputStream(uri)?.use { val json = activity.contentResolver.openInputStream(uri)?.use {