diff --git a/src/Messages/OWSMessageSender.m b/src/Messages/OWSMessageSender.m index 41275219f..9c90e9fff 100644 --- a/src/Messages/OWSMessageSender.m +++ b/src/Messages/OWSMessageSender.m @@ -682,26 +682,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; [completionFuture catchDo:^(id failure) { // failure from toc_thenAll yeilds an array of failed Futures, rather than the future's failure. if ([failure isKindOfClass:[NSArray class]]) { - NSArray *errors = (NSArray *)failure; - for (TOCFuture *failedFuture in errors) { - if (!failedFuture.hasFailed) { - // If at least one send succeeded, don't show message as failed. - // Else user will tap-to-resend to all recipients, including those that already received the - // message. - return successHandler(); - } - } - - // At this point, all recipients must have failed. - // But we have all this verbose type checking because TOCFuture doesn't expose type information. - id lastError = errors.lastObject; - if ([lastError isKindOfClass:[TOCFuture class]]) { - TOCFuture *failedFuture = (TOCFuture *)lastError; - if (failedFuture.hasFailed) { - id failureResult = failedFuture.forceGetFailure; + NSArray *groupSendFutures = (NSArray *)failure; + for (TOCFuture *groupSendFuture in groupSendFutures) { + if (groupSendFuture.hasFailed) { + id failureResult = groupSendFuture.forceGetFailure; if ([failureResult isKindOfClass:[NSError class]]) { - // Generally we assume that failures are retryable - return failureHandler((NSError *)failureResult, YES); + return failureHandler(failureResult, YES); } } }