Align the message state indicators with the behavior on Android and desktop.
// FREEBIE
This commit is contained in:
parent
029ae00bb2
commit
3dc7f2528f
|
@ -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 isOutgoingAndSent;
|
|
||||||
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
|
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -351,17 +351,6 @@
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isOutgoingAndSent
|
|
||||||
{
|
|
||||||
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
|
|
||||||
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.interaction;
|
|
||||||
if (outgoingMessage.messageState == TSOutgoingMessageStateSent) {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isOutgoingAndDelivered
|
- (BOOL)isOutgoingAndDelivered
|
||||||
{
|
{
|
||||||
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
|
if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
|
||||||
|
|
|
@ -1248,20 +1248,17 @@ typedef enum : NSUInteger {
|
||||||
return !![self collectionView:self.collectionView attributedTextForCellBottomLabelAtIndexPath:indexPath];
|
return !![self collectionView:self.collectionView attributedTextForCellBottomLabelAtIndexPath:indexPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<OWSMessageData>)nextOutgoingMessage:(NSIndexPath *)indexPath
|
- (TSOutgoingMessage *)nextOutgoingMessage:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
id<OWSMessageData> nextMessage =
|
NSInteger rowCount = [self.collectionView numberOfItemsInSection:indexPath.section];
|
||||||
[self messageAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section]];
|
for (NSInteger row = indexPath.row + 1; row < rowCount; row++) {
|
||||||
int i = 1;
|
id<OWSMessageData> nextMessage = [self messageAtIndexPath:[NSIndexPath indexPathForRow:row
|
||||||
|
inSection:indexPath.section]];
|
||||||
while (indexPath.item + i < [self.collectionView numberOfItemsInSection:indexPath.section] - 1
|
if ([nextMessage isKindOfClass:[TSOutgoingMessage class]]) {
|
||||||
&& !nextMessage.isOutgoingAndDelivered) {
|
return (TSOutgoingMessage *)nextMessage;
|
||||||
i++;
|
}
|
||||||
nextMessage =
|
|
||||||
[self messageAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row + i inSection:indexPath.section]];
|
|
||||||
}
|
}
|
||||||
|
return nil;
|
||||||
return nextMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView
|
- (NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView
|
||||||
|
@ -1277,11 +1274,16 @@ typedef enum : NSUInteger {
|
||||||
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message.interaction;
|
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)message.interaction;
|
||||||
if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
|
if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
|
||||||
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"FAILED_SENDING_TEXT", nil)];
|
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"FAILED_SENDING_TEXT", nil)];
|
||||||
} else if (message.isOutgoingAndDelivered ||
|
} else if (outgoingMessage.messageState == TSOutgoingMessageStateSent ||
|
||||||
message.isOutgoingAndSent) {
|
outgoingMessage.messageState == TSOutgoingMessageStateDelivered) {
|
||||||
// Show a checkmark icon.
|
// Show a checkmark icon.
|
||||||
|
//
|
||||||
|
// TODO: It'd be nice to distinguish the "sent" and "delivered" states,
|
||||||
|
// but JSQMessageViewController doesn't give us a great way to do so.
|
||||||
|
// We don't have a great icon for the "delivered" state,
|
||||||
|
// we can't kern checkmarks together in a JSQMessageViewController
|
||||||
|
// "cell bottom label", etc.
|
||||||
NSAttributedString *result =
|
NSAttributedString *result =
|
||||||
// Show an "..." ellisis icon.
|
|
||||||
[[NSAttributedString alloc] initWithString:@"N"
|
[[NSAttributedString alloc] initWithString:@"N"
|
||||||
attributes:@{
|
attributes:@{
|
||||||
NSFontAttributeName: [UIFont ows_elegantIconsFont:10.f],
|
NSFontAttributeName: [UIFont ows_elegantIconsFont:10.f],
|
||||||
|
@ -1293,13 +1295,23 @@ typedef enum : NSUInteger {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Or when the next message is *not* an outgoing delivered message.
|
// Or when the next message is *not* an outgoing sent/delivered message.
|
||||||
TSMessageAdapter *nextMessage = [self nextOutgoingMessage:indexPath];
|
TSOutgoingMessage *nextMessage = [self nextOutgoingMessage:indexPath];
|
||||||
if (!nextMessage.isOutgoingAndDelivered) {
|
if (nextMessage &&
|
||||||
|
nextMessage.messageState != TSOutgoingMessageStateSent &&
|
||||||
|
nextMessage.messageState != TSOutgoingMessageStateDelivered) {
|
||||||
[self updateLastDeliveredMessage:message];
|
[self updateLastDeliveredMessage:message];
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else if (message.isMediaBeingSent) {
|
} else if (message.isMediaBeingSent) {
|
||||||
|
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"UPLOADING_MESSAGE_TEXT",
|
||||||
|
@"message footer while attachment is uploading")];
|
||||||
|
} else {
|
||||||
|
OWSAssert(outgoingMessage.messageState == TSOutgoingMessageStateAttemptingOut);
|
||||||
|
// Show an "..." ellisis icon.
|
||||||
|
//
|
||||||
|
// TODO: It'd be nice to animate this, but JSQMessageViewController doesn't give us a great way to do so.
|
||||||
|
// We already have problems with unstable cell layout; we don't want to exacerbate them.
|
||||||
NSAttributedString *result =
|
NSAttributedString *result =
|
||||||
[[NSAttributedString alloc] initWithString:@"/"
|
[[NSAttributedString alloc] initWithString:@"/"
|
||||||
attributes:@{
|
attributes:@{
|
||||||
|
|
|
@ -979,6 +979,9 @@
|
||||||
/* No comment provided by engineer. */
|
/* No comment provided by engineer. */
|
||||||
"Upgrading Signal ..." = "Upgrading Signal ...";
|
"Upgrading Signal ..." = "Upgrading Signal ...";
|
||||||
|
|
||||||
|
/* message footer while attachment is uploading */
|
||||||
|
"UPLOADING_MESSAGE_TEXT" = "Uploading...";
|
||||||
|
|
||||||
/* button text for back button on verification view */
|
/* button text for back button on verification view */
|
||||||
"VERIFICATION_BACK_BUTTON" = "Back";
|
"VERIFICATION_BACK_BUTTON" = "Back";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue