mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
MXHTTPClient::requestWithMethod has two new blocks to track the upload/download progress.
This commit is contained in:
parent
7c8b0e4975
commit
4195c301de
4 changed files with 29 additions and 3 deletions
|
@ -39,6 +39,8 @@
|
|||
@end
|
||||
|
||||
@interface OutgoingMessageTableCell : RoomMessageTableCell
|
||||
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
|
||||
|
||||
-(void)startAnimating;
|
||||
-(void)stopAnimating;
|
||||
@end
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#import "RoomMessageTableCell.h"
|
||||
#import "MediaManager.h"
|
||||
#import "PieChartView.h"
|
||||
|
||||
|
||||
@implementation RoomMessageTableCell
|
||||
@end
|
||||
|
@ -24,8 +26,23 @@
|
|||
@implementation IncomingMessageTableCell
|
||||
@end
|
||||
|
||||
@interface OutgoingMessageTableCell () {
|
||||
PieChartView* pieChartView;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
|
||||
@end
|
||||
|
||||
@implementation OutgoingMessageTableCell
|
||||
|
||||
-(void)startAnimating {
|
||||
[self.activityIndicator startAnimating];
|
||||
}
|
||||
|
||||
-(void)stopAnimating {
|
||||
[self.activityIndicator stopAnimating];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
|
||||
|
|
|
@ -1018,6 +1018,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
[self sendMessage:videoContent withLocalEvent:localEvent];
|
||||
} failure:^(NSError *error) {
|
||||
[self handleError:error forLocalEvent:localEvent];
|
||||
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||
|
||||
}];
|
||||
} else {
|
||||
NSLog(@"Video is too large");
|
||||
|
@ -1038,6 +1040,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
} failure:^(NSError *error) {
|
||||
NSLog(@"Video thumbnail upload failed");
|
||||
[self handleError:error forLocalEvent:localEvent];
|
||||
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -1242,7 +1246,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
cell = [tableView dequeueReusableCellWithIdentifier:@"OutgoingMessageCell" forIndexPath:indexPath];
|
||||
OutgoingMessageTableCell* outgoingMsgCell = (OutgoingMessageTableCell*)cell;
|
||||
// Hide potential loading wheel
|
||||
[outgoingMsgCell.activityIndicator stopAnimating];
|
||||
[outgoingMsgCell stopAnimating];
|
||||
} else {
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"IncomingMessageCell" forIndexPath:indexPath];
|
||||
isIncomingMsg = YES;
|
||||
|
@ -1337,7 +1341,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
// Fade attachments during upload
|
||||
if (message.isUploadInProgress) {
|
||||
cell.attachmentView.alpha = 0.5;
|
||||
[((OutgoingMessageTableCell*)cell).activityIndicator startAnimating];
|
||||
[((OutgoingMessageTableCell*)cell) startAnimating];
|
||||
cell.attachmentView.hideActivityIndicator = YES;
|
||||
} else {
|
||||
cell.attachmentView.alpha = 1;
|
||||
|
@ -2189,6 +2193,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
[self sendMessage:imageMessage withLocalEvent:localEvent];
|
||||
} failure:^(NSError *error) {
|
||||
[self handleError:error forLocalEvent:localEvent];
|
||||
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -371,6 +371,8 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
|
|||
_userPicture.enabled = YES;
|
||||
isAvatarUploading = NO;
|
||||
[self handleErrorDuringPictureSaving:error];
|
||||
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||
// need to display the progress ?
|
||||
}];
|
||||
} else {
|
||||
[mxHandler.mxSession.myUser setAvatarUrl:uploadedPictureURL
|
||||
|
|
Loading…
Reference in a new issue