Set conference chat room without any participant as read-only + replaced deprecated function

This commit is contained in:
Sylvain Berfini 2022-06-14 10:38:50 +02:00
parent a437c1f5ef
commit df396f5abd
7 changed files with 11 additions and 11 deletions

View file

@ -233,7 +233,7 @@ class ChatMessageContentData(
if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) { if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) {
val path = if (isFileEncrypted) { val path = if (isFileEncrypted) {
Log.i("[Content] Content is encrypted, requesting plain file path") Log.i("[Content] Content is encrypted, requesting plain file path")
content.plainFilePath content.exportPlainFile()
} else { } else {
content.filePath ?: "" content.filePath ?: ""
} }

View file

@ -1107,7 +1107,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
dialog.dismiss() dialog.dismiss()
lifecycleScope.launch { lifecycleScope.launch {
Log.w("[Chat Room] Content is encrypted, requesting plain file path") Log.w("[Chat Room] Content is encrypted, requesting plain file path")
val plainFilePath = content.plainFilePath val plainFilePath = content.exportPlainFile()
Log.i("[Cht Room] Making a copy of [$plainFilePath] to the cache directory before exporting it") Log.i("[Cht Room] Making a copy of [$plainFilePath] to the cache directory before exporting it")
val cacheCopyPath = FileUtils.copyFileToCache(plainFilePath) val cacheCopyPath = FileUtils.copyFileToCache(plainFilePath)
if (cacheCopyPath != null) { if (cacheCopyPath != null) {

View file

@ -128,7 +128,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
attachFileEnabled.value = true attachFileEnabled.value = true
sendMessageEnabled.value = false sendMessageEnabled.value = false
isReadOnly.value = chatRoom.isReadOnly isReadOnly.value = chatRoom.isReadOnly || (chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) && chatRoom.participants.isEmpty())
val recorderParams = coreContext.core.createRecorderParams() val recorderParams = coreContext.core.createRecorderParams()
if (corePreferences.voiceMessagesFormatMkv) { if (corePreferences.voiceMessagesFormatMkv) {

View file

@ -137,7 +137,7 @@ class TopBarFragment : GenericFragment<FileViewerTopBarFragmentBinding>() {
if (mediaStoreFilePath.isEmpty()) { if (mediaStoreFilePath.isEmpty()) {
Log.w("[File Viewer] Media store file path is empty, media store export failed?") Log.w("[File Viewer] Media store file path is empty, media store export failed?")
val filePath = content.plainFilePath.orEmpty() val filePath = content.exportPlainFile().orEmpty()
plainFilePath = filePath.ifEmpty { content.filePath.orEmpty() } plainFilePath = filePath.ifEmpty { content.filePath.orEmpty() }
Log.i("[File Viewer] Plain file path is: $plainFilePath") Log.i("[File Viewer] Plain file path is: $plainFilePath")
if (plainFilePath.isNotEmpty()) { if (plainFilePath.isNotEmpty()) {

View file

@ -34,7 +34,7 @@ open class FileViewerViewModel(val content: Content) : ViewModel() {
init { init {
filePath = if (deleteAfterUse) { filePath = if (deleteAfterUse) {
Log.i("[File Viewer] Content is encrypted, requesting plain file path") Log.i("[File Viewer] Content is encrypted, requesting plain file path")
content.plainFilePath content.exportPlainFile()
} else { } else {
content.filePath.orEmpty() content.filePath.orEmpty()
} }

View file

@ -147,7 +147,7 @@ class Api23Compatibility {
return false return false
} }
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath
@ -185,7 +185,7 @@ class Api23Compatibility {
return false return false
} }
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath
@ -224,7 +224,7 @@ class Api23Compatibility {
return false return false
} }
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath

View file

@ -99,7 +99,7 @@ class Api29Compatibility {
} }
suspend fun addImageToMediaStore(context: Context, content: Content): Boolean { suspend fun addImageToMediaStore(context: Context, content: Content): Boolean {
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath
@ -135,7 +135,7 @@ class Api29Compatibility {
} }
suspend fun addVideoToMediaStore(context: Context, content: Content): Boolean { suspend fun addVideoToMediaStore(context: Context, content: Content): Boolean {
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath
@ -172,7 +172,7 @@ class Api29Compatibility {
} }
suspend fun addAudioToMediaStore(context: Context, content: Content): Boolean { suspend fun addAudioToMediaStore(context: Context, content: Content): Boolean {
val plainFilePath = content.plainFilePath.orEmpty() val plainFilePath = content.exportPlainFile().orEmpty()
val isVfsEncrypted = plainFilePath.isNotEmpty() val isVfsEncrypted = plainFilePath.isNotEmpty()
Log.w("[Media Store] Content is encrypted, requesting plain file path") Log.w("[Media Store] Content is encrypted, requesting plain file path")
val filePath = if (isVfsEncrypted) plainFilePath else content.filePath val filePath = if (isVfsEncrypted) plainFilePath else content.filePath