Renamed & improved text for making media files public + disable when auto download is enabled as it doesn't work yet
This commit is contained in:
parent
6e60627ce4
commit
fbe68d5bb8
5 changed files with 19 additions and 12 deletions
|
@ -81,7 +81,7 @@ class ChatMessageViewModel(
|
|||
// It will even cause the app to crash if updateContentsList is not call right after
|
||||
updateContentsList()
|
||||
|
||||
if (!message.isEphemeral && corePreferences.makePublicDownloadedImages) {
|
||||
if (!message.isEphemeral && corePreferences.makePublicMediaFilesDownloaded) {
|
||||
if (Version.sdkAboveOrEqual(Version.API29_ANDROID_10) || PermissionHelper.get().hasWriteExternalStorage()) {
|
||||
for (content in message.contents) {
|
||||
if (content.isFile && content.filePath != null && content.userData == null) {
|
||||
|
|
|
@ -42,6 +42,11 @@ 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>()
|
||||
|
@ -58,12 +63,12 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
|
|||
}
|
||||
val autoDownloadMaxSize = MutableLiveData<Int>()
|
||||
|
||||
val downloadedImagesPublicListener = object : SettingListenerStub() {
|
||||
val downloadedMediaPublicListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
prefs.makePublicDownloadedImages = newValue
|
||||
downloadedMediaPublic.value = newValue
|
||||
}
|
||||
}
|
||||
val downloadedImagesPublic = MutableLiveData<Boolean>()
|
||||
val downloadedMediaPublic = MutableLiveData<Boolean>()
|
||||
|
||||
val launcherShortcutsListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
|
@ -96,7 +101,7 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
|
|||
val goToAndroidNotificationSettingsEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
init {
|
||||
downloadedImagesPublic.value = prefs.makePublicDownloadedImages
|
||||
downloadedMediaPublic.value = prefs.makePublicMediaFilesDownloaded
|
||||
initAutoDownloadList()
|
||||
launcherShortcuts.value = prefs.chatRoomShortcuts
|
||||
hideEmptyRooms.value = prefs.hideEmptyRooms
|
||||
|
|
|
@ -88,7 +88,8 @@ class CorePreferences constructor(private val context: Context) {
|
|||
|
||||
/* Chat */
|
||||
|
||||
var makePublicDownloadedImages: Boolean
|
||||
var makePublicMediaFilesDownloaded: Boolean
|
||||
// Keep old name for backward compatibility
|
||||
get() = config.getBool("app", "make_downloaded_images_public_in_gallery", true)
|
||||
set(value) {
|
||||
config.setBool("app", "make_downloaded_images_public_in_gallery", value)
|
||||
|
|
|
@ -93,10 +93,11 @@
|
|||
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
linphone:title="@{@string/chat_settings_downloaded_images_public_title}"
|
||||
linphone:subtitle="@{@string/chat_settings_downloaded_images_public_summary}"
|
||||
linphone:listener="@{viewModel.downloadedImagesPublicListener}"
|
||||
linphone:checked="@={viewModel.downloadedImagesPublic}"/>
|
||||
linphone:title="@{@string/chat_settings_downloaded_media_public_title}"
|
||||
linphone:enabled="@{viewModel.autoDownloadIndex == 0}"
|
||||
linphone:subtitle="@{@string/chat_settings_downloaded_media_public_summary}"
|
||||
linphone:listener="@{viewModel.downloadedMediaPublicListener}"
|
||||
linphone:checked="@={viewModel.downloadedMediaPublic}"/>
|
||||
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
|
|
|
@ -404,8 +404,8 @@
|
|||
<string name="chat_settings_auto_download_under_size">If lighter than given maximum size</string>
|
||||
<string name="chat_settings_auto_download_max_size_title">Max size</string>
|
||||
<string name="chat_settings_auto_download_max_size_summary">in bytes</string>
|
||||
<string name="chat_settings_downloaded_images_public_title">Make downloaded images visible in native gallery</string>
|
||||
<string name="chat_settings_downloaded_images_public_summary">Images in ephemeral messages won\'t be</string>
|
||||
<string name="chat_settings_downloaded_media_public_title">Make downloaded media public</string>
|
||||
<string name="chat_settings_downloaded_media_public_summary">Files in ephemeral messages won\'t be, doesn\'t work with auto download feature</string>
|
||||
<string name="chat_settings_launcher_shortcuts_title">Create shortcuts to chat rooms in launcher</string>
|
||||
<string name="chat_settings_launcher_shortcuts_summary">Will be replaced by contacts shortcuts if enabled</string>
|
||||
<string name="chat_settings_hide_empty_rooms_title">Hide empty chat rooms</string>
|
||||
|
|
Loading…
Reference in a new issue