Long tap on pie chart let the user cancels the media download.

This commit is contained in:
ylecollen
2015-01-08 15:40:05 +01:00
parent 9d99e256d9
commit ef98e684eb
4 changed files with 79 additions and 8 deletions
@@ -329,6 +329,34 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
return YES;
}
- (IBAction)onProgressLongTap:(UILongPressGestureRecognizer*)sender {
if (sender.state == UIGestureRecognizerStateBegan) {
// find out the linked uitableviewcell
UIView* view = sender.view;
while(view && ![view isKindOfClass:[UITableViewCell class]]) {
view = view.superview;
}
// if it is a RoomMessageTableCell
if ([view isKindOfClass:[RoomMessageTableCell class]]) {
__weak typeof(self) weakSelf = self;
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];
}
}
}
#pragma mark - Internal methods
- (void)configureView {