File tree Expand file tree Collapse file tree 8 files changed +33
-10
lines changed
Subviews/ChatMedia/Container
Services/FilesNetworkManager/Models
CommonKit/Sources/CommonKit/Assets/Localization Expand file tree Collapse file tree 8 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,5 @@ enum ChatAction {
2424 case cancelUploading( messageId: String )
2525 case autoDownloadContentIfNeeded( messageId: String , files: [ ChatFile ] )
2626 case forceDownloadAllFiles( messageId: String , files: [ ChatFile ] )
27+ case showDialog( title: String )
2728}
Original file line number Diff line number Diff line change @@ -223,6 +223,8 @@ extension ChatDataSourceManager {
223223 )
224224 case let . forceDownloadAllFiles( messageId, files) :
225225 viewModel. forceDownloadAllFiles ( messageId: messageId, files: files)
226+ case let . showDialog( title) :
227+ viewModel. dialog. send ( . alert( title) )
226228 }
227229 }
228230}
Original file line number Diff line number Diff line change @@ -154,6 +154,11 @@ final class ChatMediaContainerView: UIView {
154154 actionHandler ( . openFile( messageId: model. id, file: file) )
155155 return
156156 }
157+
158+ if model. status == . unableToDownload {
159+ actionHandler ( . showDialog( title: FileManagerError . unableToDownloadCorrupted. localizedDescription) )
160+ return
161+ }
157162
158163 guard case . needToDownload = model. status else {
159164 return
Original file line number Diff line number Diff line change @@ -18,22 +18,25 @@ enum FileManagerError: Error {
1818 case cantUploadFile
1919 case cantEncryptFile
2020 case cantDecryptFile
21+ case unableToDownloadCorrupted
2122 case apiError( error: ApiServiceError )
2223}
2324
2425extension FileManagerError : LocalizedError {
2526 var errorDescription : String ? {
2627 switch self {
27- case . cantDownloadFile:
28- return . localized( " FileManagerError.CantDownloadFile " )
29- case . cantUploadFile:
30- return . localized( " FileManagerError.CantUploadFile " )
31- case . cantEncryptFile:
32- return . localized( " FileManagerError.CantEncryptFile " )
33- case . cantDecryptFile:
34- return . localized( " FileManagerError.CantDecryptFile " )
35- case let . apiError( error: error) :
36- return error. localizedDescription
28+ case . cantDownloadFile:
29+ return . localized( " FileManagerError.CantDownloadFile " )
30+ case . cantUploadFile:
31+ return . localized( " FileManagerError.CantUploadFile " )
32+ case . cantEncryptFile:
33+ return . localized( " FileManagerError.CantEncryptFile " )
34+ case . cantDecryptFile:
35+ return . localized( " FileManagerError.CantDecryptFile " )
36+ case . unableToDownloadCorrupted:
37+ return . localized( " FileManagerError.UnableToDownloadCorrupted " )
38+ case let . apiError( error: error) :
39+ return error. localizedDescription
3740 }
3841 }
3942}
Original file line number Diff line number Diff line change 13541354/* FileManager error 'Can't decrypt file' */
13551355"FileManagerError.CantDecryptFile" = "Datei kann nicht entschlüsselt werden";
13561356
1357+ /* FileManager error 'Unable to download corrupted file' */
1358+ "FileManagerError.UnableToDownloadCorrupted" = "Download nicht möglich.\nDatei(en) könnten beschädigt sein.";
1359+
13571360/* File validation error 'Too many files' */
13581361"FileValidationError.TooManyFiles" = "Zu viele Dateien. Höchstens erlaubt: %lld";
13591362
Original file line number Diff line number Diff line change 13301330/* FileManager error 'Can't decrypt file' */
13311331"FileManagerError.CantDecryptFile" = "Can't decrypt file";
13321332
1333+ /* FileManager error 'Unable to download corrupted file' */
1334+ "FileManagerError.UnableToDownloadCorrupted" = "Unable to download.\nFile(s) could be corrupted.";
1335+
13331336/* File validation error 'Too many files' */
13341337"FileValidationError.TooManyFiles" = "Too many files. Maximum allowed: %lld";
13351338
Original file line number Diff line number Diff line change 13341334/* FileManager error 'Can't decrypt file' */
13351335"FileManagerError.CantDecryptFile" = "Не удалось расшифровать файл";
13361336
1337+ /* FileManager error 'Unable to download corrupted file' */
1338+ "FileManagerError.UnableToDownloadCorrupted" = "Невозможно загрузить.\nФайл(ы) могут быть повреждены.";
1339+
13371340/* File validation error 'Too many files' */
13381341"FileValidationError.TooManyFiles" = "Превышено максимально допустимое количество файлов (%lld)";
13391342
Original file line number Diff line number Diff line change 13251325/* FileManager error 'Can't decrypt file' */
13261326"FileManagerError.CantDecryptFile" = "无法解密文件";
13271327
1328+ /* FileManager error 'Unable to download corrupted file' */
1329+ "FileManagerError.UnableToDownloadCorrupted" = "无法下载。\n文件可能已损坏。";
1330+
13281331/* File validation error 'Too many files' */
13291332"FileValidationError.TooManyFiles" = "文件太多。 最大允许:%lld";
13301333
You can’t perform that action at this time.
0 commit comments