diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 000000000..26cebe96b
Binary files /dev/null and b/.DS_Store differ
diff --git a/matrixConsole/Base.lproj/Main.storyboard b/matrixConsole/Base.lproj/Main.storyboard
index 8df195c43..a78573aa2 100644
--- a/matrixConsole/Base.lproj/Main.storyboard
+++ b/matrixConsole/Base.lproj/Main.storyboard
@@ -124,9 +124,6 @@
-
-
-
@@ -231,9 +228,6 @@
-
-
-
@@ -519,16 +513,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/matrixConsole/View/.DS_Store b/matrixConsole/View/.DS_Store
new file mode 100644
index 000000000..5008ddfcf
Binary files /dev/null and b/matrixConsole/View/.DS_Store differ
diff --git a/matrixConsole/View/RoomMessageTableCell.m b/matrixConsole/View/RoomMessageTableCell.m
index d3c30ed7c..7f2aba8b7 100644
--- a/matrixConsole/View/RoomMessageTableCell.m
+++ b/matrixConsole/View/RoomMessageTableCell.m
@@ -27,7 +27,6 @@
}
- (void)updateProgressUI:(NSDictionary*)downloadStatsDict {
-
self.progressView.hidden = NO;
NSString* downloadRate = [downloadStatsDict valueForKey:kMediaLoaderProgressDownloadRateKey];
@@ -40,14 +39,12 @@
[text appendString:progressString];
}
- if (remaingTime) {
- [text appendFormat:@" (%@)", remaingTime];
+ if (downloadRate) {
+ [text appendFormat:@"\n%@", downloadRate];
}
- [text appendString:@"\n "];
-
- if (downloadRate) {
- [text appendFormat:@"%@", downloadRate];
+ if (remaingTime) {
+ [text appendFormat:@"\n%@", remaingTime];
}
self.statsLabel.text = text;
@@ -171,6 +168,7 @@
}
}
+
-(void)stopAnimating {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMediaUploadProgressNotification object:nil];
[self.activityIndicator stopAnimating];
@@ -182,7 +180,7 @@
NSString* url = notif.object;
if ([url isEqualToString:self.message.thumbnailURL] || [url isEqualToString:self.message.attachmentURL]) {
-
+ self.activityIndicator.hidden = YES;
[self updateProgressUI:notif.userInfo];
// the upload is ended
diff --git a/matrixConsole/ViewController/RoomViewController.m b/matrixConsole/ViewController/RoomViewController.m
index 7cb743044..bc5889e0d 100644
--- a/matrixConsole/ViewController/RoomViewController.m
+++ b/matrixConsole/ViewController/RoomViewController.m
@@ -343,17 +343,28 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
if ([view isKindOfClass:[RoomMessageTableCell class]]) {
__weak typeof(self) weakSelf = self;
+ NSString* url = ((RoomMessageTableCell*)view).message.attachmentURL;
+ MediaLoader *loader = [MediaManager mediaLoaderForURL:url];
- self.actionMenu = [[CustomAlert alloc] initWithTitle:nil message:@"Cancel the download ?" style:CustomAlertStyleAlert];
- self.actionMenu.cancelButtonIndex = [self.actionMenu addActionWithTitle:@"Cancel" style:CustomAlertActionStyleDefault handler:^(CustomAlert *alert) {
- weakSelf.actionMenu = nil;
- }];
- self.actionMenu.cancelButtonIndex = [self.actionMenu addActionWithTitle:@"OK" style:CustomAlertActionStyleDefault handler:^(CustomAlert *alert) {
- [(RoomMessageTableCell*)view cancelDownload];
- weakSelf.actionMenu = nil;
- }];
-
- [self.actionMenu showInViewController:self];
+ // offer to cancel a download only if there is a pending one
+ if (loader) {
+ self.actionMenu = [[CustomAlert alloc] initWithTitle:nil message:@"Cancel the download ?" style:CustomAlertStyleAlert];
+ self.actionMenu.cancelButtonIndex = [self.actionMenu addActionWithTitle:@"Cancel" style:CustomAlertActionStyleDefault handler:^(CustomAlert *alert) {
+ weakSelf.actionMenu = nil;
+ }];
+ self.actionMenu.cancelButtonIndex = [self.actionMenu addActionWithTitle:@"OK" style:CustomAlertActionStyleDefault handler:^(CustomAlert *alert) {
+
+ // get again the loader, the cell could have been reused.
+ MediaLoader *loader = [MediaManager mediaLoaderForURL:url];
+ if (loader) {
+ [loader cancel];
+ }
+
+ weakSelf.actionMenu = nil;
+ }];
+
+ [self.actionMenu showInViewController:self];
+ }
}
}
}
@@ -1429,6 +1440,17 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
cell.messageTextView.attributedText = message.attributedTextMessage;
}
+ // add a long tap gesture on the progressView
+ // manage it in the storyboard does not work properly
+ // -> The gesture view is always the same i.e. the latest composed one.
+ while (cell.progressView.gestureRecognizers.count) {
+ [cell.progressView removeGestureRecognizer:cell.progressView.gestureRecognizers[0]];
+ }
+
+ // only the download can be cancelled
+ UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onProgressLongTap:)];
+ [cell.progressView addGestureRecognizer:longPress];
+
// Handle timestamp display
if (dateFormatter) {
// Add datetime label for each component