From c617548e544326c42e2dbcb2fce4424fbc0f65ed Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 17 Apr 2024 19:38:34 +0200 Subject: [PATCH] =?UTF-8?q?Afficher=20un=20message=20d'alerte=20avant=20en?= =?UTF-8?q?voi=20d'une=20pi=C3=A8ce=20jointe=20trop=20lourde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Riot/Modules/Room/RoomViewController.m | 9 +++++++++ Tchap/Assets/Localizations/fr.lproj/Tchap.strings | 5 +++++ changelog.d/1015.change | 1 + 3 files changed, 15 insertions(+) create mode 100644 changelog.d/1015.change diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 653d5899b..b93c1e4ac 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -7770,6 +7770,15 @@ - (void)documentPickerPresenter:(MXKDocumentPickerPresenter *)presenter didPickD { self.documentPickerPresenter = nil; + // Tchap: check maxUploadSize accepted by the home server before trying to upload. + NSUInteger maxUploadFileSize = self.roomDataSource.mxSession.maxUploadSize; + NSDictionary *fileAttributes = [NSFileManager.defaultManager attributesOfItemAtPath:url.path error:nil]; + if (fileAttributes && fileAttributes.fileSize > maxUploadFileSize) { + [self showAlertWithTitle:TchapL10n.roomSendFileTooBigTitle + message:[TchapL10n roomSendFileTooBigMessage:maxUploadFileSize/(1024*1024) :fileAttributes.fileSize/(1024*1024)]]; + return; + } + MXKUTI *fileUTI = [[MXKUTI alloc] initWithLocalFileURL:url]; NSString *mimeType = fileUTI.mimeType; diff --git a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings index 5b952e4bc..14ca73675 100644 --- a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings +++ b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings @@ -330,6 +330,11 @@ "security_cross_signing_reset_message" = "Faites cette opération seulement si vous avez perdu tous vos autres appareils vérifiés."; "security_cross_signing_reset_action_title" = "Réinitialiser"; +//////////////////////////////////////////////////////////////////////////////// +// MARK: Room send file +"room_send_file_too_big_title" = "Erreur d'envoi"; +"room_send_file_too_big_message" = "Le fichier est trop lourd pour être envoyé. La taille limite est de %ldMo, mais la taille de votre fichier est de %ldMo."; + //////////////////////////////////////////////////////////////////////////////// // MARK: VoIP "event_formatter_report_incident" = "Signaler un problème"; diff --git a/changelog.d/1015.change b/changelog.d/1015.change new file mode 100644 index 000000000..9dd68d1fa --- /dev/null +++ b/changelog.d/1015.change @@ -0,0 +1 @@ +Afficher un message d'alerte avant envoi d'une pièce jointe trop lourde. \ No newline at end of file