Added setting to open files in our own viewer even if VFS isn't enabled

This commit is contained in:
Sylvain Berfini 2021-04-08 11:30:34 +02:00
parent fedb9f079e
commit 91590ca521
4 changed files with 24 additions and 1 deletions

View file

@ -88,6 +88,14 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
} }
val hideNotificationContent = MutableLiveData<Boolean>() val hideNotificationContent = MutableLiveData<Boolean>()
val useInAppFileViewerListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) {
prefs.useInAppFileViewerForNonEncryptedFiles = newValue
useInAppFileViewer.value = newValue
}
}
val useInAppFileViewer = MutableLiveData<Boolean>()
val launcherShortcutsListener = object : SettingListenerStub() { val launcherShortcutsListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
prefs.chatRoomShortcuts = newValue prefs.chatRoomShortcuts = newValue
@ -122,7 +130,8 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
init { init {
markAsReadNotifDismissal.value = prefs.markAsReadUponChatMessageNotificationDismissal markAsReadNotifDismissal.value = prefs.markAsReadUponChatMessageNotificationDismissal
downloadedMediaPublic.value = prefs.makePublicMediaFilesDownloaded downloadedMediaPublic.value = prefs.makePublicMediaFilesDownloaded && !prefs.vfsEnabled
useInAppFileViewer.value = prefs.useInAppFileViewerForNonEncryptedFiles || prefs.vfsEnabled
hideNotificationContent.value = prefs.hideChatMessageContentInNotification hideNotificationContent.value = prefs.hideChatMessageContentInNotification
initAutoDownloadList() initAutoDownloadList()
launcherShortcuts.value = prefs.chatRoomShortcuts launcherShortcuts.value = prefs.chatRoomShortcuts

View file

@ -98,6 +98,14 @@
linphone:listener="@{viewModel.downloadedMediaPublicListener}" linphone:listener="@{viewModel.downloadedMediaPublicListener}"
linphone:checked="@={viewModel.downloadedMediaPublic}"/> linphone:checked="@={viewModel.downloadedMediaPublic}"/>
<include
layout="@layout/settings_widget_switch"
linphone:title="@{@string/chat_settings_use_in_app_file_viewer_title}"
linphone:subtitle="@{@string/chat_settings_use_in_app_file_viewer_summary}"
linphone:enabled="@{!viewModel.vfs}"
linphone:listener="@{viewModel.useInAppFileViewerListener}"
linphone:checked="@={viewModel.useInAppFileViewer}"/>
<include <include
layout="@layout/settings_widget_switch" layout="@layout/settings_widget_switch"
linphone:title="@{@string/chat_settings_hide_notification_content_title}" linphone:title="@{@string/chat_settings_hide_notification_content_title}"

View file

@ -569,4 +569,8 @@
<string name="content_description_export">Ouvrir le fichier dans une application tierce</string> <string name="content_description_export">Ouvrir le fichier dans une application tierce</string>
<string name="chat_message_no_app_found_to_handle_file_mime_type">Aucune application n\'est disponible pour ouvrir ce type de fichier</string> <string name="chat_message_no_app_found_to_handle_file_mime_type">Aucune application n\'est disponible pour ouvrir ce type de fichier</string>
<string name="chat_bubble_cant_open_enrypted_file">Impossible d\'ouvrir un fichier chiffré dans la bulle de conversation</string> <string name="chat_bubble_cant_open_enrypted_file">Impossible d\'ouvrir un fichier chiffré dans la bulle de conversation</string>
<string name="advanced_settings_vfs_title">Chiffrer tous les fichiers</string>
<string name="advanced_settings_vfs_summary">Attention, ne pourra pas être désactivé !</string>
<string name="chat_settings_use_in_app_file_viewer_title">Ouvrir les fichiers dans l\'application</string>
<string name="chat_settings_use_in_app_file_viewer_summary">Vous pourrez toujours les exporter dans une appli tierce</string>
</resources> </resources>

View file

@ -434,6 +434,8 @@
<string name="chat_settings_hide_rooms_removed_proxies_title">Hide chat rooms from removed proxy configs</string> <string name="chat_settings_hide_rooms_removed_proxies_title">Hide chat rooms from removed proxy configs</string>
<string name="chat_settings_hide_rooms_removed_proxies_summary">If you are missing chat rooms, try to uncheck this setting</string> <string name="chat_settings_hide_rooms_removed_proxies_summary">If you are missing chat rooms, try to uncheck this setting</string>
<string name="chat_settings_go_to_android_notification_settings">Android notification settings</string> <string name="chat_settings_go_to_android_notification_settings">Android notification settings</string>
<string name="chat_settings_use_in_app_file_viewer_title">Always open files inside this app</string>
<string name="chat_settings_use_in_app_file_viewer_summary">You\'ll still be able to export them in third-party apps</string>
<!-- Network settings --> <!-- Network settings -->
<string name="network_settings_wifi_only_title">Use WiFi only</string> <string name="network_settings_wifi_only_title">Use WiFi only</string>