Merge pull request #402 from ismailnurudeen/fix/storage_location_update

fix: savePhotosFolder value not updating.
This commit is contained in:
Tibor Kaputa 2023-02-07 18:54:58 +01:00 committed by GitHub
commit 7af58b59ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class MediaOutputHelper(
private const val VIDEO_MIME_TYPE = "video/mp4"
}
private val mediaStorageDir = activity.config.savePhotosFolder
private var config = activity.config
private val contentResolver = activity.contentResolver
fun getImageMediaOutput(): MediaOutput.ImageCaptureOutput {
@ -121,7 +121,7 @@ class MediaOutputHelper(
private fun getOutputStreamMediaOutput(): MediaOutput.OutputStreamMediaOutput? {
var mediaOutput: MediaOutput.OutputStreamMediaOutput? = null
val canWrite = canWriteToFilePath(mediaStorageDir)
val canWrite = canWriteToFilePath(config.savePhotosFolder)
if (canWrite) {
val path = activity.getOutputMediaFilePath(true)
val uri = getUriForFilePath(path)
@ -144,9 +144,9 @@ class MediaOutputHelper(
private fun getFileDescriptorMediaOutput(): MediaOutput.FileDescriptorMediaOutput? {
var mediaOutput: MediaOutput.FileDescriptorMediaOutput? = null
val canWrite = canWriteToFilePath(mediaStorageDir)
val canWrite = canWriteToFilePath(config.savePhotosFolder)
if (canWrite) {
val parentUri = getUriForFilePath(mediaStorageDir) ?: return null
val parentUri = getUriForFilePath(config.savePhotosFolder) ?: return null
val videoFileName = activity.getOutputMediaFileName(false)
val documentUri = DocumentsContract.createDocument(
contentResolver,
@ -162,7 +162,7 @@ class MediaOutputHelper(
private fun getFileMediaOutput(): MediaOutput.FileMediaOutput? {
var mediaOutput: MediaOutput.FileMediaOutput? = null
val canWrite = canWriteToFilePath(mediaStorageDir)
val canWrite = canWriteToFilePath(config.savePhotosFolder)
if (canWrite) {
val path = activity.getOutputMediaFilePath(false)
val uri = getUriForFilePath(path)