Rework outgoing message state.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 2c46220ebf
commit 66d1a37859

@ -191,11 +191,6 @@ NS_ASSUME_NONNULL_BEGIN
return NO; return NO;
} }
- (BOOL)isOutgoingAndDelivered
{
return NO;
}
- (NSUInteger)messageHash - (NSUInteger)messageHash
{ {
return self.hash; return self.hash;

@ -1,5 +1,6 @@
// Created by Michael Kirk on 9/26/16. //
// Copyright © 2016 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSMessageEditing.h" #import "OWSMessageEditing.h"
#import <JSQMessagesViewController/JSQMessageData.h> #import <JSQMessagesViewController/JSQMessageData.h>
@ -21,7 +22,6 @@ typedef NS_ENUM(NSInteger, TSMessageAdapterType) {
@property (nonatomic, readonly) TSMessageAdapterType messageType; @property (nonatomic, readonly) TSMessageAdapterType messageType;
@property (nonatomic, readonly) TSInteraction *interaction; @property (nonatomic, readonly) TSInteraction *interaction;
@property (nonatomic, readonly) BOOL isExpiringMessage; @property (nonatomic, readonly) BOOL isExpiringMessage;
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
@property (nonatomic, readonly) BOOL shouldStartExpireTimer; @property (nonatomic, readonly) BOOL shouldStartExpireTimer;
@property (nonatomic, readonly) uint64_t expiresAtSeconds; @property (nonatomic, readonly) uint64_t expiresAtSeconds;
@property (nonatomic, readonly) uint32_t expiresInSeconds; @property (nonatomic, readonly) uint32_t expiresInSeconds;

@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) TSInfoMessageType infoMessageType; @property (readonly) TSInfoMessageType infoMessageType;
@property (nonatomic, readonly) CGFloat mediaViewAlpha; @property (nonatomic, readonly) CGFloat mediaViewAlpha;
@property (nonatomic, readonly) BOOL isMediaBeingSent; @property (nonatomic, readonly) BOOL isMediaBeingSent;
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
@end @end

@ -383,17 +383,6 @@ NS_ASSUME_NONNULL_BEGIN
return NO; return NO;
} }
- (BOOL)isOutgoingAndDelivered
{
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.interaction;
if (outgoingMessage.messageState == TSOutgoingMessageStateDelivered) {
return YES;
}
}
return NO;
}
#pragma mark - Logging #pragma mark - Logging
+ (NSString *)tag + (NSString *)tag

@ -1183,7 +1183,11 @@ typedef enum : NSUInteger {
return self.outgoingMessageFailedImageData; return self.outgoingMessageFailedImageData;
case TSOutgoingMessageStateAttemptingOut: case TSOutgoingMessageStateAttemptingOut:
return self.currentlyOutgoingBubbleImageData; return self.currentlyOutgoingBubbleImageData;
default: case TSOutgoingMessageStateSent_OBSOLETE:
case TSOutgoingMessageStateDelivered_OBSOLETE:
OWSAssert(0);
return self.outgoingBubbleImageData;
case TSOutgoingMessageStateSentToService:
return self.outgoingBubbleImageData; return self.outgoingBubbleImageData;
} }
} }
@ -1490,13 +1494,10 @@ typedef enum : NSUInteger {
if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) { if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"MESSAGE_STATUS_FAILED", return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"MESSAGE_STATUS_FAILED",
@"message footer for failed messages")]; @"message footer for failed messages")];
} else if (outgoingMessage.messageState == TSOutgoingMessageStateSent || } else if (outgoingMessage.messageState == TSOutgoingMessageStateSentToService) {
outgoingMessage.messageState == TSOutgoingMessageStateDelivered) { NSString *text = (outgoingMessage.wasDelivered
NSString *text = (outgoingMessage.messageState == TSOutgoingMessageStateSent ? NSLocalizedString(@"MESSAGE_STATUS_DELIVERED", @"message footer for delivered messages")
? NSLocalizedString(@"MESSAGE_STATUS_SENT", : NSLocalizedString(@"MESSAGE_STATUS_SENT", @"message footer for sent messages"));
@"message footer for sent messages")
: NSLocalizedString(@"MESSAGE_STATUS_DELIVERED",
@"message footer for delivered messages"));
NSAttributedString *result = [[NSAttributedString alloc] initWithString:text]; NSAttributedString *result = [[NSAttributedString alloc] initWithString:text];
// Show when it's the last message in the thread // Show when it's the last message in the thread
@ -1507,9 +1508,7 @@ typedef enum : NSUInteger {
// Or when the next message is *not* an outgoing sent/delivered message. // Or when the next message is *not* an outgoing sent/delivered message.
TSOutgoingMessage *nextMessage = [self nextOutgoingMessage:indexPath]; TSOutgoingMessage *nextMessage = [self nextOutgoingMessage:indexPath];
if (nextMessage && if (nextMessage && nextMessage.messageState != TSOutgoingMessageStateSentToService) {
nextMessage.messageState != TSOutgoingMessageStateSent &&
nextMessage.messageState != TSOutgoingMessageStateDelivered) {
[self updateLastDeliveredMessage:message]; [self updateLastDeliveredMessage:message];
return result; return result;
} }
@ -2706,7 +2705,7 @@ typedef enum : NSUInteger {
messageBody:@"" messageBody:@""
attachmentIds:[NSMutableArray new]]; attachmentIds:[NSMutableArray new]];
message.groupMetaMessage = TSGroupMessageUpdate; message.groupMetaMessage = TSGroupMessageUpdate;
message.customMessage = updateGroupInfo; [message updateWithCustomMessage:updateGroupInfo];
}]; }];
if (newGroupModel.groupImage) { if (newGroupModel.groupImage) {

Loading…
Cancel
Save