ui: optionally encrypt received SMP files (#3095)
This commit is contained in:
parent
b7c562fb10
commit
cb10f8b080
@ -84,7 +84,7 @@ struct CIFileView: View {
|
||||
Task {
|
||||
logger.debug("CIFileView fileAction - in .rcvInvitation, in Task")
|
||||
if let user = ChatModel.shared.currentUser {
|
||||
let encrypted = file.fileProtocol == .xftp && privacyEncryptLocalFilesGroupDefault.get()
|
||||
let encrypted = privacyEncryptLocalFilesGroupDefault.get()
|
||||
await receiveFile(user: user, fileId: file.fileId, encrypted: encrypted)
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ func apiSetFileToReceive(fileId: Int64, encrypted: Bool) {
|
||||
func autoReceiveFile(_ file: CIFile, encrypted: Bool) -> ChatItem? {
|
||||
switch file.fileProtocol {
|
||||
case .smp:
|
||||
return apiReceiveFile(fileId: file.fileId, encrypted: false)?.chatItem
|
||||
return apiReceiveFile(fileId: file.fileId, encrypted: encrypted)?.chatItem
|
||||
case .xftp:
|
||||
apiSetFileToReceive(fileId: file.fileId, encrypted: encrypted)
|
||||
return nil
|
||||
|
@ -2144,7 +2144,6 @@ public struct ChatItem: Identifiable, Decodable {
|
||||
}
|
||||
|
||||
public var encryptLocalFile: Bool {
|
||||
file?.fileProtocol == .xftp &&
|
||||
content.msgContent?.isVideo == false &&
|
||||
privacyEncryptLocalFilesGroupDefault.get()
|
||||
}
|
||||
|
@ -1416,8 +1416,7 @@ data class ChatItem (
|
||||
val encryptedFile: Boolean? = if (file?.fileSource == null) null else file.fileSource.cryptoArgs != null
|
||||
|
||||
val encryptLocalFile: Boolean
|
||||
get() = file?.fileProtocol == FileProtocol.XFTP &&
|
||||
content.msgContent !is MsgContent.MCVideo &&
|
||||
get() = content.msgContent !is MsgContent.MCVideo &&
|
||||
chatController.appPrefs.privacyEncryptLocalFiles.get()
|
||||
|
||||
val memberDisplayName: String? get() =
|
||||
|
@ -71,7 +71,7 @@ fun CIFileView(
|
||||
when (file.fileStatus) {
|
||||
is CIFileStatus.RcvInvitation -> {
|
||||
if (fileSizeValid()) {
|
||||
val encrypted = file.fileProtocol == FileProtocol.XFTP && chatController.appPrefs.privacyEncryptLocalFiles.get()
|
||||
val encrypted = chatController.appPrefs.privacyEncryptLocalFiles.get()
|
||||
receiveFile(file.fileId, encrypted)
|
||||
} else {
|
||||
AlertManager.shared.showAlertMsg(
|
||||
|
Loading…
Reference in New Issue
Block a user