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
|
@end
|
||||||
|
|
||||||
@interface OutgoingMessageTableCell : RoomMessageTableCell
|
@interface OutgoingMessageTableCell : RoomMessageTableCell
|
||||||
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
|
|
||||||
|
-(void)startAnimating;
|
||||||
|
-(void)stopAnimating;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#import "RoomMessageTableCell.h"
|
#import "RoomMessageTableCell.h"
|
||||||
#import "MediaManager.h"
|
#import "MediaManager.h"
|
||||||
|
#import "PieChartView.h"
|
||||||
|
|
||||||
|
|
||||||
@implementation RoomMessageTableCell
|
@implementation RoomMessageTableCell
|
||||||
@end
|
@end
|
||||||
|
@ -24,8 +26,23 @@
|
||||||
@implementation IncomingMessageTableCell
|
@implementation IncomingMessageTableCell
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface OutgoingMessageTableCell () {
|
||||||
|
PieChartView* pieChartView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation OutgoingMessageTableCell
|
@implementation OutgoingMessageTableCell
|
||||||
|
|
||||||
|
-(void)startAnimating {
|
||||||
|
[self.activityIndicator startAnimating];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)stopAnimating {
|
||||||
|
[self.activityIndicator stopAnimating];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)layoutSubviews {
|
- (void)layoutSubviews {
|
||||||
[super layoutSubviews];
|
[super layoutSubviews];
|
||||||
|
|
||||||
|
|
|
@ -1018,6 +1018,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
||||||
[self sendMessage:videoContent withLocalEvent:localEvent];
|
[self sendMessage:videoContent withLocalEvent:localEvent];
|
||||||
} failure:^(NSError *error) {
|
} failure:^(NSError *error) {
|
||||||
[self handleError:error forLocalEvent:localEvent];
|
[self handleError:error forLocalEvent:localEvent];
|
||||||
|
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||||
|
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
NSLog(@"Video is too large");
|
NSLog(@"Video is too large");
|
||||||
|
@ -1038,6 +1040,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
||||||
} failure:^(NSError *error) {
|
} failure:^(NSError *error) {
|
||||||
NSLog(@"Video thumbnail upload failed");
|
NSLog(@"Video thumbnail upload failed");
|
||||||
[self handleError:error forLocalEvent:localEvent];
|
[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];
|
cell = [tableView dequeueReusableCellWithIdentifier:@"OutgoingMessageCell" forIndexPath:indexPath];
|
||||||
OutgoingMessageTableCell* outgoingMsgCell = (OutgoingMessageTableCell*)cell;
|
OutgoingMessageTableCell* outgoingMsgCell = (OutgoingMessageTableCell*)cell;
|
||||||
// Hide potential loading wheel
|
// Hide potential loading wheel
|
||||||
[outgoingMsgCell.activityIndicator stopAnimating];
|
[outgoingMsgCell stopAnimating];
|
||||||
} else {
|
} else {
|
||||||
cell = [tableView dequeueReusableCellWithIdentifier:@"IncomingMessageCell" forIndexPath:indexPath];
|
cell = [tableView dequeueReusableCellWithIdentifier:@"IncomingMessageCell" forIndexPath:indexPath];
|
||||||
isIncomingMsg = YES;
|
isIncomingMsg = YES;
|
||||||
|
@ -1337,7 +1341,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
||||||
// Fade attachments during upload
|
// Fade attachments during upload
|
||||||
if (message.isUploadInProgress) {
|
if (message.isUploadInProgress) {
|
||||||
cell.attachmentView.alpha = 0.5;
|
cell.attachmentView.alpha = 0.5;
|
||||||
[((OutgoingMessageTableCell*)cell).activityIndicator startAnimating];
|
[((OutgoingMessageTableCell*)cell) startAnimating];
|
||||||
cell.attachmentView.hideActivityIndicator = YES;
|
cell.attachmentView.hideActivityIndicator = YES;
|
||||||
} else {
|
} else {
|
||||||
cell.attachmentView.alpha = 1;
|
cell.attachmentView.alpha = 1;
|
||||||
|
@ -2189,6 +2193,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
||||||
[self sendMessage:imageMessage withLocalEvent:localEvent];
|
[self sendMessage:imageMessage withLocalEvent:localEvent];
|
||||||
} failure:^(NSError *error) {
|
} failure:^(NSError *error) {
|
||||||
[self handleError:error forLocalEvent:localEvent];
|
[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;
|
_userPicture.enabled = YES;
|
||||||
isAvatarUploading = NO;
|
isAvatarUploading = NO;
|
||||||
[self handleErrorDuringPictureSaving:error];
|
[self handleErrorDuringPictureSaving:error];
|
||||||
|
} uploadProgress:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
|
||||||
|
// need to display the progress ?
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
[mxHandler.mxSession.myUser setAvatarUrl:uploadedPictureURL
|
[mxHandler.mxSession.myUser setAvatarUrl:uploadedPictureURL
|
||||||
|
|
Loading…
Reference in a new issue