mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed some files not exported to MediaStore
This commit is contained in:
parent
5ff7ea66e2
commit
bb9c6ef68f
2 changed files with 15 additions and 10 deletions
|
|
@ -86,9 +86,11 @@ class TopBarFragment : GenericFragment<FileViewerTopBarFragmentBinding>() {
|
|||
lifecycleScope.launch {
|
||||
var mediaStoreFilePath = ""
|
||||
if (PermissionHelper.get().hasWriteExternalStoragePermission()) {
|
||||
Log.i("[File Viewer] Exporting image through Media Store API")
|
||||
when (content.type) {
|
||||
"image" -> {
|
||||
val filePath = content.filePath.orEmpty()
|
||||
Log.i("[File Viewer] Trying to export file [$filePath] through Media Store API")
|
||||
|
||||
when {
|
||||
FileUtils.isExtensionImage(filePath) -> {
|
||||
val export = lifecycleScope.async {
|
||||
Compatibility.addImageToMediaStore(requireContext(), content)
|
||||
}
|
||||
|
|
@ -99,7 +101,7 @@ class TopBarFragment : GenericFragment<FileViewerTopBarFragmentBinding>() {
|
|||
Log.e("[File Viewer] Something went wrong while copying file to Media Store...")
|
||||
}
|
||||
}
|
||||
"video" -> {
|
||||
FileUtils.isExtensionVideo(filePath) -> {
|
||||
val export = lifecycleScope.async {
|
||||
Compatibility.addVideoToMediaStore(requireContext(), content)
|
||||
}
|
||||
|
|
@ -110,7 +112,7 @@ class TopBarFragment : GenericFragment<FileViewerTopBarFragmentBinding>() {
|
|||
Log.e("[File Viewer] Something went wrong while copying file to Media Store...")
|
||||
}
|
||||
}
|
||||
"audio" -> {
|
||||
FileUtils.isExtensionAudio(filePath) -> {
|
||||
val export = lifecycleScope.async {
|
||||
Compatibility.addAudioToMediaStore(requireContext(), content)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -891,22 +891,25 @@ class CoreContext(
|
|||
|
||||
if (PermissionHelper.get().hasWriteExternalStoragePermission()) {
|
||||
coroutineScope.launch {
|
||||
when (content.type) {
|
||||
"image" -> {
|
||||
val filePath = content.filePath.orEmpty()
|
||||
Log.i("[Context] Trying to export file [$filePath] through Media Store API")
|
||||
|
||||
when {
|
||||
FileUtils.isExtensionImage(filePath) -> {
|
||||
if (Compatibility.addImageToMediaStore(context, content)) {
|
||||
Log.i("[Context] Adding image ${content.name} to Media Store terminated")
|
||||
} else {
|
||||
Log.e("[Context] Something went wrong while copying file to Media Store...")
|
||||
}
|
||||
}
|
||||
"video" -> {
|
||||
FileUtils.isExtensionVideo(filePath) -> {
|
||||
if (Compatibility.addVideoToMediaStore(context, content)) {
|
||||
Log.i("[Context] Adding video ${content.name} to Media Store terminated")
|
||||
} else {
|
||||
Log.e("[Context] Something went wrong while copying file to Media Store...")
|
||||
}
|
||||
}
|
||||
"audio" -> {
|
||||
FileUtils.isExtensionAudio(filePath) -> {
|
||||
if (Compatibility.addAudioToMediaStore(context, content)) {
|
||||
Log.i("[Context] Adding audio ${content.name} to Media Store terminated")
|
||||
} else {
|
||||
|
|
@ -914,7 +917,7 @@ class CoreContext(
|
|||
}
|
||||
}
|
||||
else -> {
|
||||
Log.w("[Context] File ${content.name} isn't either an image, an audio file or a video, can't add it to the Media Store")
|
||||
Log.w("[Context] File [$filePath] isn't either an image, an audio file or a video [${content.type}/${content.subtype}], can't add it to the Media Store")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue