From 4399b81ec87d323c30a8acbeda028357f7d048e2 Mon Sep 17 00:00:00 2001 From: fmodf Date: Sun, 8 Sep 2024 18:27:08 +0200 Subject: [PATCH] wip --- .../AppData/Services/AESGSMEngine.swift | 10 ---------- .../Helpers/String+Extensions.swift | 18 +++++------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/ConversationsClassic/AppData/Services/AESGSMEngine.swift b/ConversationsClassic/AppData/Services/AESGSMEngine.swift index 7bba045..2c0689c 100644 --- a/ConversationsClassic/AppData/Services/AESGSMEngine.swift +++ b/ConversationsClassic/AppData/Services/AESGSMEngine.swift @@ -39,16 +39,6 @@ final class AESGSMEngine: AES_GCM_Engine { } let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey) - // var payload = encoded - // - // var tag = tag - // if tag == nil { - // tag = payload.subdata(in: (payload.count - 16) ..< payload.count) - // encoded = payload.subdata(in: 0 ..< (payload.count - 16)) - // } - // let sealedBox = try AES.GCM.SealedBox(nonce: AES.GCM.Nonce(data: iv), ciphertext: encoded, tag: tag) - // let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey) - // if let output = output { output.pointee = decryptedData } diff --git a/ConversationsClassic/Helpers/String+Extensions.swift b/ConversationsClassic/Helpers/String+Extensions.swift index 5701e61..addae44 100644 --- a/ConversationsClassic/Helpers/String+Extensions.swift +++ b/ConversationsClassic/Helpers/String+Extensions.swift @@ -39,21 +39,13 @@ extension String { extension String { var attachmentType: AttachmentType { let ext = (self as NSString).pathExtension.lowercased() - - switch ext { - case "mov", "mp4", "avi": - return .video - - case "jpg", "png", "gif": + if ext.contains("jpeg") || ext.contains("jpg") || ext.contains("png") || ext.contains("gif") { return .image - - case "mp3", "wav", "m4a": + } else if ext.contains("mov") || ext.contains("mp4") || ext.contains("avi") { + return .video + } else if ext.contains("mp3") || ext.contains("wav") || ext.contains("m4a") { return .audio - - case "txt", "doc", "pdf": - return .file - - default: + } else { return .file } }