mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'mkirk/tap-to-retry'
This commit is contained in:
commit
5907cd2a0d
1 changed files with 11 additions and 37 deletions
|
@ -1764,43 +1764,17 @@ typedef enum : NSUInteger {
|
||||||
- (void)handleFailedDownloadTapForMessage:(TSMessage *)message
|
- (void)handleFailedDownloadTapForMessage:(TSMessage *)message
|
||||||
attachmentPointer:(TSAttachmentPointer *)attachmentPointer
|
attachmentPointer:(TSAttachmentPointer *)attachmentPointer
|
||||||
{
|
{
|
||||||
UIAlertController *actionSheetController = [UIAlertController
|
OWSAttachmentsProcessor *processor =
|
||||||
alertControllerWithTitle:NSLocalizedString(@"MESSAGES_VIEW_FAILED_DOWNLOAD_ACTIONSHEET_TITLE", comment
|
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer
|
||||||
: "Action sheet title after tapping on failed download.")
|
networkManager:self.networkManager];
|
||||||
message:nil
|
[processor fetchAttachmentsForMessage:message
|
||||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
primaryStorage:self.primaryStorage
|
||||||
|
success:^(TSAttachmentStream *attachmentStream) {
|
||||||
[actionSheetController addAction:[OWSAlerts cancelAction]];
|
DDLogInfo(@"%@ Successfully redownloaded attachment in thread: %@", self.logTag, message.thread);
|
||||||
|
}
|
||||||
UIAlertAction *deleteMessageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", @"")
|
failure:^(NSError *error) {
|
||||||
style:UIAlertActionStyleDestructive
|
DDLogWarn(@"%@ Failed to redownload message with error: %@", self.logTag, error);
|
||||||
handler:^(UIAlertAction *action) {
|
}];
|
||||||
[message remove];
|
|
||||||
}];
|
|
||||||
[actionSheetController addAction:deleteMessageAction];
|
|
||||||
|
|
||||||
UIAlertAction *retryAction = [UIAlertAction
|
|
||||||
actionWithTitle:NSLocalizedString(@"MESSAGES_VIEW_FAILED_DOWNLOAD_RETRY_ACTION", @"Action sheet button text")
|
|
||||||
style:UIAlertActionStyleDefault
|
|
||||||
handler:^(UIAlertAction *action) {
|
|
||||||
OWSAttachmentsProcessor *processor =
|
|
||||||
[[OWSAttachmentsProcessor alloc] initWithAttachmentPointer:attachmentPointer
|
|
||||||
networkManager:self.networkManager];
|
|
||||||
[processor fetchAttachmentsForMessage:message
|
|
||||||
primaryStorage:self.primaryStorage
|
|
||||||
success:^(TSAttachmentStream *attachmentStream) {
|
|
||||||
DDLogInfo(
|
|
||||||
@"%@ Successfully redownloaded attachment in thread: %@", self.logTag, message.thread);
|
|
||||||
}
|
|
||||||
failure:^(NSError *error) {
|
|
||||||
DDLogWarn(@"%@ Failed to redownload message with error: %@", self.logTag, error);
|
|
||||||
}];
|
|
||||||
}];
|
|
||||||
|
|
||||||
[actionSheetController addAction:retryAction];
|
|
||||||
|
|
||||||
[self dismissKeyBoard];
|
|
||||||
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleUnsentMessageTap:(TSOutgoingMessage *)message
|
- (void)handleUnsentMessageTap:(TSOutgoingMessage *)message
|
||||||
|
|
Loading…
Reference in a new issue