mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Allow transfered files through chat to be automatically exported to native gallery
This commit is contained in:
parent
8e156c0b33
commit
5ff7ea66e2
3 changed files with 3 additions and 6 deletions
|
|
@ -50,11 +50,6 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
|
|||
core.maxSizeForAutoDownloadIncomingFiles = maxSize
|
||||
autoDownloadMaxSize.value = maxSize
|
||||
updateAutoDownloadIndexFromMaxSize(maxSize)
|
||||
|
||||
// Auto download isn't compatible with making downloaded images public
|
||||
if (position > 0 && downloadedMediaPublic.value == true) {
|
||||
downloadedMediaPublic.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
val autoDownloadIndex = MutableLiveData<Int>()
|
||||
|
|
|
|||
|
|
@ -838,6 +838,7 @@ class CoreContext(
|
|||
/* Coroutine related */
|
||||
|
||||
private fun exportFileInMessage(message: ChatMessage) {
|
||||
// Only do it if auto download feature isn't disabled, otherwise it's done in the user-initiated download process
|
||||
if (core.maxSizeForAutoDownloadIncomingFiles != -1) {
|
||||
var hasFile = false
|
||||
for (content in message.contents) {
|
||||
|
|
@ -869,6 +870,7 @@ class CoreContext(
|
|||
if (PermissionHelper.get().hasWriteExternalStoragePermission()) {
|
||||
for (content in message.contents) {
|
||||
if (content.isFile && content.filePath != null && content.userData == null) {
|
||||
Log.i("[Context] Trying to export file [${content.name}] to MediaStore")
|
||||
addContentToMediaStore(content)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
linphone:title="@{@string/chat_settings_downloaded_media_public_title}"
|
||||
linphone:enabled="@{!viewModel.vfs && viewModel.autoDownloadIndex != 1}"
|
||||
linphone:enabled="@{!viewModel.vfs}"
|
||||
linphone:subtitle="@{@string/chat_settings_downloaded_media_public_summary}"
|
||||
linphone:listener="@{viewModel.downloadedMediaPublicListener}"
|
||||
linphone:checked="@={viewModel.downloadedMediaPublic}"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue