Skip to content

Commit

Permalink
Afficher un message d'alerte avant envoi d'une pièce jointe trop lourde
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Buquet committed Apr 18, 2024
1 parent 6af4fe2 commit c617548
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1015.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Afficher un message d'alerte avant envoi d'une pièce jointe trop lourde.

0 comments on commit c617548

Please sign in to comment.