Merge branch 'charlesmchen/outgoingMessageState'

pull/1/head
Matthew Chen 7 years ago
commit f0727b541e

@ -138,7 +138,7 @@ CHECKOUT OPTIONS:
:commit: 7054e4b13ee5bcd6d524adb6dc9a726e8c466308
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
SignalServiceKit:
:commit: 91aeddf383ec50e70425103e80c1eb734b25fa53
:commit: bb24ffc917ddf41fa307d866a79f8ea76cb9ae05
:git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket:
:commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf

@ -191,11 +191,6 @@ NS_ASSUME_NONNULL_BEGIN
return NO;
}
- (BOOL)isOutgoingAndDelivered
{
return NO;
}
- (NSUInteger)messageHash
{
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 <JSQMessagesViewController/JSQMessageData.h>
@ -21,7 +22,6 @@ typedef NS_ENUM(NSInteger, TSMessageAdapterType) {
@property (nonatomic, readonly) TSMessageAdapterType messageType;
@property (nonatomic, readonly) TSInteraction *interaction;
@property (nonatomic, readonly) BOOL isExpiringMessage;
@property (nonatomic, readonly) BOOL isOutgoingAndDelivered;
@property (nonatomic, readonly) BOOL shouldStartExpireTimer;
@property (nonatomic, readonly) uint64_t expiresAtSeconds;
@property (nonatomic, readonly) uint32_t expiresInSeconds;

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

@ -383,17 +383,6 @@ NS_ASSUME_NONNULL_BEGIN
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
+ (NSString *)tag

@ -1183,7 +1183,11 @@ typedef enum : NSUInteger {
return self.outgoingMessageFailedImageData;
case TSOutgoingMessageStateAttemptingOut:
return self.currentlyOutgoingBubbleImageData;
default:
case TSOutgoingMessageStateSent_OBSOLETE:
case TSOutgoingMessageStateDelivered_OBSOLETE:
OWSAssert(0);
return self.outgoingBubbleImageData;
case TSOutgoingMessageStateSentToService:
return self.outgoingBubbleImageData;
}
}
@ -1490,13 +1494,10 @@ typedef enum : NSUInteger {
if (outgoingMessage.messageState == TSOutgoingMessageStateUnsent) {
return [[NSAttributedString alloc] initWithString:NSLocalizedString(@"MESSAGE_STATUS_FAILED",
@"message footer for failed messages")];
} else if (outgoingMessage.messageState == TSOutgoingMessageStateSent ||
outgoingMessage.messageState == TSOutgoingMessageStateDelivered) {
NSString *text = (outgoingMessage.messageState == TSOutgoingMessageStateSent
? NSLocalizedString(@"MESSAGE_STATUS_SENT",
@"message footer for sent messages")
: NSLocalizedString(@"MESSAGE_STATUS_DELIVERED",
@"message footer for delivered messages"));
} else if (outgoingMessage.messageState == TSOutgoingMessageStateSentToService) {
NSString *text = (outgoingMessage.wasDelivered
? NSLocalizedString(@"MESSAGE_STATUS_DELIVERED", @"message footer for delivered messages")
: NSLocalizedString(@"MESSAGE_STATUS_SENT", @"message footer for sent messages"));
NSAttributedString *result = [[NSAttributedString alloc] initWithString:text];
// 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.
TSOutgoingMessage *nextMessage = [self nextOutgoingMessage:indexPath];
if (nextMessage &&
nextMessage.messageState != TSOutgoingMessageStateSent &&
nextMessage.messageState != TSOutgoingMessageStateDelivered) {
if (nextMessage && nextMessage.messageState != TSOutgoingMessageStateSentToService) {
[self updateLastDeliveredMessage:message];
return result;
}
@ -2320,22 +2319,6 @@ typedef enum : NSUInteger {
(unsigned long)attachment.data.length,
[attachment mimeType]);
[ThreadUtil sendMessageWithAttachment:attachment inThread:self.thread messageSender:self.messageSender];
TSOutgoingMessage *message;
OWSDisappearingMessagesConfiguration *configuration =
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:self.thread.uniqueId];
if (configuration.isEnabled) {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:self.thread
messageBody:nil
attachmentIds:[NSMutableArray new]
expiresInSeconds:configuration.durationSeconds];
} else {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:self.thread
messageBody:nil
attachmentIds:[NSMutableArray new]];
}
}
- (NSURL *)videoTempFolder {
@ -2703,10 +2686,8 @@ typedef enum : NSUInteger {
[groupThread saveWithTransaction:transaction];
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:groupThread
messageBody:@""
attachmentIds:[NSMutableArray new]];
message.groupMetaMessage = TSGroupMessageUpdate;
message.customMessage = updateGroupInfo;
groupMetaMessage:TSGroupMessageUpdate];
[message updateWithCustomMessage:updateGroupInfo transaction:transaction];
}];
if (newGroupModel.groupImage) {

@ -309,11 +309,10 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
TSOutgoingMessage *message =
[[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:self.thread
messageBody:@""
attachmentIds:[NSMutableArray new]];
groupMetaMessage:TSGroupMessageNew];
message.groupMetaMessage = TSGroupMessageNew;
message.customMessage = NSLocalizedString(@"GROUP_CREATED", nil);
// This will save the message.
[message updateWithCustomMessage:NSLocalizedString(@"GROUP_CREATED", nil)];
if (model.groupImage) {
[self.messageSender sendAttachmentData:UIImagePNGRepresentation(model.groupImage)
contentType:OWSMimeTypeImagePng

@ -398,8 +398,7 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
TSGroupThread *gThread = (TSGroupThread *)self.thread;
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:gThread
messageBody:@""];
message.groupMetaMessage = TSGroupMessageQuit;
groupMetaMessage:TSGroupMessageQuit];
[self.messageSender sendMessage:message
success:^{
DDLogInfo(@"%@ Successfully left group.", self.tag);

@ -460,9 +460,7 @@ NSString *const SignalsViewControllerSegueShowIncomingCall = @"ShowIncomingCallS
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:@""
attachmentIds:[NSMutableArray new]];
message.groupMetaMessage = TSGroupMessageQuit;
groupMetaMessage:TSGroupMessageQuit];
[self.messageSender sendMessage:message
success:^{
[self dismissViewControllerAnimated:YES

@ -25,21 +25,14 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(thread);
OWSAssert(messageSender);
TSOutgoingMessage *message;
OWSDisappearingMessagesConfiguration *configuration =
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId];
if (configuration.isEnabled) {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:text
attachmentIds:[NSMutableArray new]
expiresInSeconds:configuration.durationSeconds];
} else {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:text];
}
TSOutgoingMessage *message =
[[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:text
attachmentIds:[NSMutableArray new]
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)];
[messageSender sendMessage:message
success:^{
DDLogInfo(@"%@ Successfully sent message.", self.tag);
@ -61,22 +54,14 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(thread);
OWSAssert(messageSender);
TSOutgoingMessage *message;
OWSDisappearingMessagesConfiguration *configuration =
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId];
if (configuration.isEnabled) {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:nil
attachmentIds:[NSMutableArray new]
expiresInSeconds:configuration.durationSeconds];
} else {
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:nil
attachmentIds:[NSMutableArray new]];
}
TSOutgoingMessage *message =
[[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:nil
attachmentIds:[NSMutableArray new]
expiresInSeconds:(configuration.isEnabled ? configuration.durationSeconds : 0)];
[messageSender sendAttachmentData:attachment.data
contentType:attachment.mimeType
filename:attachment.filename

@ -343,6 +343,9 @@
/* Generic error used whenver Signal can't contact the server */
"ERROR_DESCRIPTION_NO_INTERNET" = "Signal was unable to connect to the internet. Please try from another WiFi network or use mobile data.";
/* Error indicating that an outgoing message had no valid recipients. */
"ERROR_DESCRIPTION_NO_VALID_RECIPIENTS" = "Message send failed due to a lack of valid recipients.";
/* Error message when attempting to send message */
"ERROR_DESCRIPTION_SENDING_UNAUTHORIZED" = "Your device is no longer registered for your phone number. You must remove and reinstall Signal.";

Loading…
Cancel
Save