Merge branch 'dev' of github.com:loki-project/loki-messenger-ios into bug-fix

pull/49/head
Niels Andriesse 6 years ago
commit d780c95683

@ -56,6 +56,11 @@ public final class LokiGroupChatPoller : NSObject {
let x2 = SSKProtoDataMessage.builder() let x2 = SSKProtoDataMessage.builder()
x2.setTimestamp(message.timestamp) x2.setTimestamp(message.timestamp)
x2.setGroup(try! x1.build()) x2.setGroup(try! x1.build())
if let quote = message.quote {
let x5 = SSKProtoDataMessageQuote.builder(id: quote.quotedMessageTimestamp, author: quote.quoteeHexEncodedPublicKey)
x5.setText(quote.quotedMessageBody)
x2.setQuote(try! x5.build())
}
x2.setBody(message.body) x2.setBody(message.body)
if let messageServerID = message.serverID { if let messageServerID = message.serverID {
let publicChatInfo = SSKProtoPublicChatInfo.builder() let publicChatInfo = SSKProtoPublicChatInfo.builder()
@ -68,7 +73,6 @@ public final class LokiGroupChatPoller : NSObject {
x4.setSource(senderHexEncodedPublicKey) x4.setSource(senderHexEncodedPublicKey)
x4.setSourceDevice(OWSDevicePrimaryDeviceId) x4.setSourceDevice(OWSDevicePrimaryDeviceId)
x4.setContent(try! x3.build().serializedData()) x4.setContent(try! x3.build().serializedData())
let storage = OWSPrimaryStorage.shared() let storage = OWSPrimaryStorage.shared()
storage.dbReadWriteConnection.readWrite { transaction in storage.dbReadWriteConnection.readWrite { transaction in
transaction.setObject(senderDisplayName, forKey: senderHexEncodedPublicKey, inCollection: group.id) transaction.setObject(senderDisplayName, forKey: senderHexEncodedPublicKey, inCollection: group.id)
@ -87,8 +91,14 @@ public final class LokiGroupChatPoller : NSObject {
guard !isDuplicate else { return } guard !isDuplicate else { return }
guard let groupID = group.id.data(using: .utf8) else { return } guard let groupID = group.id.data(using: .utf8) else { return }
let thread = TSGroupThread.getOrCreateThread(withGroupId: groupID) let thread = TSGroupThread.getOrCreateThread(withGroupId: groupID)
let signalQuote: TSQuotedMessage?
if let quote = message.quote {
signalQuote = TSQuotedMessage(timestamp: quote.quotedMessageTimestamp, authorId: quote.quoteeHexEncodedPublicKey, body: quote.quotedMessageBody, quotedAttachmentsForSending: [])
} else {
signalQuote = nil
}
let message = TSOutgoingMessage(outgoingMessageWithTimestamp: message.timestamp, in: thread, messageBody: message.body, attachmentIds: [], expiresInSeconds: 0, let message = TSOutgoingMessage(outgoingMessageWithTimestamp: message.timestamp, in: thread, messageBody: message.body, attachmentIds: [], expiresInSeconds: 0,
expireStartedAt: 0, isVoiceMessage: false, groupMetaMessage: .deliver, quotedMessage: nil, contactShare: nil, linkPreview: nil) expireStartedAt: 0, isVoiceMessage: false, groupMetaMessage: .deliver, quotedMessage: signalQuote, contactShare: nil, linkPreview: nil)
storage.dbReadWriteConnection.readWrite { transaction in storage.dbReadWriteConnection.readWrite { transaction in
message.update(withSentRecipient: group.server, wasSentByUD: false, transaction: transaction) message.update(withSentRecipient: group.server, wasSentByUD: false, transaction: transaction)
message.saveGroupChatMessageID(messageServerID, in: transaction) message.saveGroupChatMessageID(messageServerID, in: transaction)

@ -74,9 +74,10 @@ class ConversationViewItemActions: NSObject {
class func textActions(conversationViewItem: ConversationViewItem, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MenuAction] { class func textActions(conversationViewItem: ConversationViewItem, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MenuAction] {
var actions: [MenuAction] = [] var actions: [MenuAction] = []
let isGroup = conversationViewItem.isGroupThread let isGroup = conversationViewItem.isGroupThread;
let isRSSFeed = conversationViewItem.isRSSFeed;
if shouldAllowReply && !isGroup { if shouldAllowReply && !isRSSFeed {
let replyAction = MessageActionBuilder.reply(conversationViewItem: conversationViewItem, delegate: delegate) let replyAction = MessageActionBuilder.reply(conversationViewItem: conversationViewItem, delegate: delegate)
actions.append(replyAction) actions.append(replyAction)
} }

@ -306,6 +306,7 @@ class ColorPickerView: UIView, ColorViewDelegate {
@objc @objc
private class MockConversationViewItem: NSObject, ConversationViewItem { private class MockConversationViewItem: NSObject, ConversationViewItem {
var userCanDeleteGroupMessage: Bool = false var userCanDeleteGroupMessage: Bool = false
var isRSSFeed: Bool = false
var interaction: TSInteraction = TSMessage() var interaction: TSInteraction = TSMessage()
var interactionType: OWSInteractionType = OWSInteractionType.unknown var interactionType: OWSInteractionType = OWSInteractionType.unknown
var quotedReply: OWSQuotedReplyModel? var quotedReply: OWSQuotedReplyModel?

@ -361,7 +361,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
OWSAssertDebug(CGSizeEqualToSize( OWSAssertDebug(CGSizeEqualToSize(
CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength), glyphImage.size)); CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength), glyphImage.size));
UIImageView *glyphView = [[UIImageView alloc] initWithImage:glyphImage]; UIImageView *glyphView = [[UIImageView alloc] initWithImage:glyphImage];
glyphView.tintColor = Theme.secondaryColor; glyphView.tintColor = UIColor.whiteColor;
[glyphView [glyphView
autoSetDimensionsToSize:CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength)]; autoSetDimensionsToSize:CGSizeMake(kRemotelySourcedContentGlyphLength, kRemotelySourcedContentGlyphLength)];
@ -549,7 +549,16 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
} }
} else { } else {
OWSContactsManager *contactsManager = Environment.shared.contactsManager; OWSContactsManager *contactsManager = Environment.shared.contactsManager;
NSString *quotedAuthor = [contactsManager contactOrProfileNameForPhoneIdentifier:self.quotedMessage.authorId]; __block NSString *quotedAuthor = [contactsManager contactOrProfileNameForPhoneIdentifier:self.quotedMessage.authorId];
if (quotedAuthor == self.quotedMessage.authorId) {
[OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
NSString *collection = [NSString stringWithFormat:@"%@.%@", LKGroupChatAPI.publicChatServer, @(LKGroupChatAPI.publicChatServerID)];
NSString *displayName = [transaction stringForKey:self.quotedMessage.authorId inCollection:collection];
if (displayName != nil) { quotedAuthor = displayName; }
}];
}
quotedAuthorText = [NSString quotedAuthorText = [NSString
stringWithFormat: stringWithFormat:
NSLocalizedString(@"QUOTED_REPLY_AUTHOR_INDICATOR_FORMAT", NSLocalizedString(@"QUOTED_REPLY_AUTHOR_INDICATOR_FORMAT",

@ -513,7 +513,7 @@ typedef enum : NSUInteger {
_conversationStyle = [[ConversationStyle alloc] initWithThread:thread]; _conversationStyle = [[ConversationStyle alloc] initWithThread:thread];
_conversationViewModel = _conversationViewModel =
[[ConversationViewModel alloc] initWithThread:thread focusMessageIdOnOpen:focusMessageId delegate:self]; [[ConversationViewModel alloc] initWithThread:thread focusMessageIdOnOpen:focusMessageId isRSSFeed:self.isRSSFeed delegate:self];
_searchController = [[ConversationSearchController alloc] initWithThread:thread]; _searchController = [[ConversationSearchController alloc] initWithThread:thread];
_searchController.delegate = self; _searchController.delegate = self;

@ -67,6 +67,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@property (nonatomic, readonly, nullable) OWSQuotedReplyModel *quotedReply; @property (nonatomic, readonly, nullable) OWSQuotedReplyModel *quotedReply;
@property (nonatomic, readonly) BOOL isGroupThread; @property (nonatomic, readonly) BOOL isGroupThread;
@property (nonatomic, readonly) BOOL isRSSFeed;
@property (nonatomic, readonly) BOOL userCanDeleteGroupMessage; @property (nonatomic, readonly) BOOL userCanDeleteGroupMessage;
@property (nonatomic, readonly) BOOL hasBodyText; @property (nonatomic, readonly) BOOL hasBodyText;
@ -162,6 +163,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithInteraction:(TSInteraction *)interaction - (instancetype)initWithInteraction:(TSInteraction *)interaction
isGroupThread:(BOOL)isGroupThread isGroupThread:(BOOL)isGroupThread
isRSSFeed:(BOOL)isRSSFeed
transaction:(YapDatabaseReadTransaction *)transaction transaction:(YapDatabaseReadTransaction *)transaction
conversationStyle:(ConversationStyle *)conversationStyle; conversationStyle:(ConversationStyle *)conversationStyle;

@ -119,6 +119,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
@synthesize interaction = _interaction; @synthesize interaction = _interaction;
@synthesize isFirstInCluster = _isFirstInCluster; @synthesize isFirstInCluster = _isFirstInCluster;
@synthesize isGroupThread = _isGroupThread; @synthesize isGroupThread = _isGroupThread;
@synthesize isRSSFeed = _isRSSFeed;
@synthesize isLastInCluster = _isLastInCluster; @synthesize isLastInCluster = _isLastInCluster;
@synthesize lastAudioMessageView = _lastAudioMessageView; @synthesize lastAudioMessageView = _lastAudioMessageView;
@synthesize senderName = _senderName; @synthesize senderName = _senderName;
@ -126,6 +127,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
- (instancetype)initWithInteraction:(TSInteraction *)interaction - (instancetype)initWithInteraction:(TSInteraction *)interaction
isGroupThread:(BOOL)isGroupThread isGroupThread:(BOOL)isGroupThread
isRSSFeed:(BOOL)isRSSFeed
transaction:(YapDatabaseReadTransaction *)transaction transaction:(YapDatabaseReadTransaction *)transaction
conversationStyle:(ConversationStyle *)conversationStyle conversationStyle:(ConversationStyle *)conversationStyle
{ {
@ -141,6 +143,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
_interaction = interaction; _interaction = interaction;
_isGroupThread = isGroupThread; _isGroupThread = isGroupThread;
_isRSSFeed = isRSSFeed;
_conversationStyle = conversationStyle; _conversationStyle = conversationStyle;
[self updateAuthorConversationColorNameWithTransaction:transaction]; [self updateAuthorConversationColorNameWithTransaction:transaction];

@ -98,10 +98,12 @@ typedef NS_ENUM(NSUInteger, ConversationUpdateItemType) {
@property (nonatomic, readonly) ConversationViewState *viewState; @property (nonatomic, readonly) ConversationViewState *viewState;
@property (nonatomic, nullable) NSString *focusMessageIdOnOpen; @property (nonatomic, nullable) NSString *focusMessageIdOnOpen;
@property (nonatomic, readonly, nullable) ThreadDynamicInteractions *dynamicInteractions; @property (nonatomic, readonly, nullable) ThreadDynamicInteractions *dynamicInteractions;
@property (nonatomic, readonly) BOOL isRSSFeed;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithThread:(TSThread *)thread - (instancetype)initWithThread:(TSThread *)thread
focusMessageIdOnOpen:(nullable NSString *)focusMessageIdOnOpen focusMessageIdOnOpen:(nullable NSString *)focusMessageIdOnOpen
isRSSFeed:(BOOL)isRSSFeed
delegate:(id<ConversationViewModelDelegate>)delegate NS_DESIGNATED_INITIALIZER; delegate:(id<ConversationViewModelDelegate>)delegate NS_DESIGNATED_INITIALIZER;
- (void)ensureDynamicInteractionsAndUpdateIfNecessary:(BOOL)updateIfNecessary; - (void)ensureDynamicInteractionsAndUpdateIfNecessary:(BOOL)updateIfNecessary;

@ -218,6 +218,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
- (instancetype)initWithThread:(TSThread *)thread - (instancetype)initWithThread:(TSThread *)thread
focusMessageIdOnOpen:(nullable NSString *)focusMessageIdOnOpen focusMessageIdOnOpen:(nullable NSString *)focusMessageIdOnOpen
isRSSFeed:(BOOL)isRSSFeed
delegate:(id<ConversationViewModelDelegate>)delegate delegate:(id<ConversationViewModelDelegate>)delegate
{ {
self = [super init]; self = [super init];
@ -233,6 +234,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
_persistedViewItems = @[]; _persistedViewItems = @[];
_unsavedOutgoingMessages = @[]; _unsavedOutgoingMessages = @[];
self.focusMessageIdOnOpen = focusMessageIdOnOpen; self.focusMessageIdOnOpen = focusMessageIdOnOpen;
_isRSSFeed = isRSSFeed;
_viewState = [[ConversationViewState alloc] initWithViewItems:@[]]; _viewState = [[ConversationViewState alloc] initWithViewItems:@[]];
[self configure]; [self configure];
@ -1205,6 +1207,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
NSArray<NSString *> *loadedUniqueIds = [self.messageMapping loadedUniqueIds]; NSArray<NSString *> *loadedUniqueIds = [self.messageMapping loadedUniqueIds];
BOOL isGroupThread = self.thread.isGroupThread; BOOL isGroupThread = self.thread.isGroupThread;
BOOL isRSSFeed = self.isRSSFeed;
ConversationStyle *conversationStyle = self.delegate.conversationStyle; ConversationStyle *conversationStyle = self.delegate.conversationStyle;
[self ensureConversationProfileState]; [self ensureConversationProfileState];
@ -1218,6 +1221,7 @@ static const int kYapDatabaseRangeMaxLength = 25000;
if (!viewItem) { if (!viewItem) {
viewItem = [[ConversationInteractionViewItem alloc] initWithInteraction:interaction viewItem = [[ConversationInteractionViewItem alloc] initWithInteraction:interaction
isGroupThread:isGroupThread isGroupThread:isGroupThread
isRSSFeed:isRSSFeed
transaction:transaction transaction:transaction
conversationStyle:conversationStyle]; conversationStyle:conversationStyle];
} }

@ -2012,6 +2012,7 @@ NS_ASSUME_NONNULL_BEGIN
id<ConversationViewItem> viewItem = id<ConversationViewItem> viewItem =
[[ConversationInteractionViewItem alloc] initWithInteraction:messageToQuote [[ConversationInteractionViewItem alloc] initWithInteraction:messageToQuote
isGroupThread:thread.isGroupThread isGroupThread:thread.isGroupThread
isRSSFeed:NO
transaction:transaction transaction:transaction
conversationStyle:conversationStyle]; conversationStyle:conversationStyle];
quotedMessage = [ quotedMessage = [
@ -2033,6 +2034,7 @@ NS_ASSUME_NONNULL_BEGIN
id<ConversationViewItem> viewItem = id<ConversationViewItem> viewItem =
[[ConversationInteractionViewItem alloc] initWithInteraction:messageToQuote [[ConversationInteractionViewItem alloc] initWithInteraction:messageToQuote
isGroupThread:thread.isGroupThread isGroupThread:thread.isGroupThread
isRSSFeed:NO
transaction:transaction transaction:transaction
conversationStyle:conversationStyle]; conversationStyle:conversationStyle];
quotedMessage = [ quotedMessage = [

@ -579,6 +579,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
let conversationStyle = ConversationStyle(thread: thread) let conversationStyle = ConversationStyle(thread: thread)
fetchedItem = ConversationInteractionViewItem(interaction: message, fetchedItem = ConversationInteractionViewItem(interaction: message,
isGroupThread: thread.isGroupThread(), isGroupThread: thread.isGroupThread(),
isRSSFeed: false,
transaction: transaction, transaction: transaction,
conversationStyle: conversationStyle) conversationStyle: conversationStyle)
} }

@ -139,6 +139,8 @@ public final class LokiGroupChatAPI : NSObject {
throw Error.parsingFailed throw Error.parsingFailed
} }
return rawMessages.flatMap { message in return rawMessages.flatMap { message in
let isDeleted = (message["is_deleted"] as? Int == 1)
guard !isDeleted else { return nil }
guard let annotations = message["annotations"] as? [JSON], let annotation = annotations.first, let value = annotation["value"] as? JSON, guard let annotations = message["annotations"] as? [JSON], let annotation = annotations.first, let value = annotation["value"] as? JSON,
let serverID = message["id"] as? UInt64, let body = message["text"] as? String, let hexEncodedPublicKey = value["source"] as? String, let displayName = value["from"] as? String, let serverID = message["id"] as? UInt64, let body = message["text"] as? String, let hexEncodedPublicKey = value["source"] as? String, let displayName = value["from"] as? String,
let timestamp = value["timestamp"] as? UInt64 else { let timestamp = value["timestamp"] as? UInt64 else {
@ -147,7 +149,13 @@ public final class LokiGroupChatAPI : NSObject {
} }
let lastMessageServerID = getLastMessageServerID(for: group, on: server) let lastMessageServerID = getLastMessageServerID(for: group, on: server)
if serverID > (lastMessageServerID ?? 0) { setLastMessageServerID(for: group, on: server, to: serverID) } if serverID > (lastMessageServerID ?? 0) { setLastMessageServerID(for: group, on: server, to: serverID) }
return LokiGroupMessage(serverID: serverID, hexEncodedPublicKey: hexEncodedPublicKey, displayName: displayName, body: body, type: publicChatMessageType, timestamp: timestamp) let quote: LokiGroupMessage.Quote?
if let quoteAsJSON = value["quote"] as? JSON, let quotedMessageTimestamp = quoteAsJSON["id"] as? UInt64, let quoteeHexEncodedPublicKey = quoteAsJSON["author"] as? String, let quotedMessageBody = quoteAsJSON["text"] as? String {
quote = LokiGroupMessage.Quote(quotedMessageTimestamp: quotedMessageTimestamp, quoteeHexEncodedPublicKey: quoteeHexEncodedPublicKey, quotedMessageBody: quotedMessageBody)
} else {
quote = nil
}
return LokiGroupMessage(serverID: serverID, hexEncodedPublicKey: hexEncodedPublicKey, displayName: displayName, body: body, type: publicChatMessageType, timestamp: timestamp, quote: quote)
} }
} }
} }
@ -170,7 +178,7 @@ public final class LokiGroupChatAPI : NSObject {
throw Error.parsingFailed throw Error.parsingFailed
} }
let timestamp = UInt64(date.timeIntervalSince1970) * 1000 let timestamp = UInt64(date.timeIntervalSince1970) * 1000
return LokiGroupMessage(serverID: serverID, hexEncodedPublicKey: userHexEncodedPublicKey, displayName: displayName, body: body, type: publicChatMessageType, timestamp: timestamp) return LokiGroupMessage(serverID: serverID, hexEncodedPublicKey: userHexEncodedPublicKey, displayName: displayName, body: body, type: publicChatMessageType, timestamp: timestamp, quote: message.quote)
} }
}.recover { error -> Promise<LokiGroupMessage> in }.recover { error -> Promise<LokiGroupMessage> in
if let error = error as? NetworkManagerError, error.statusCode == 401 { if let error = error as? NetworkManagerError, error.statusCode == 401 {

@ -9,26 +9,43 @@ public final class LokiGroupMessage : NSObject {
/// - Note: Expressed as milliseconds since 00:00:00 UTC on 1 January 1970. /// - Note: Expressed as milliseconds since 00:00:00 UTC on 1 January 1970.
public let timestamp: UInt64 public let timestamp: UInt64
public let type: String public let type: String
public let quote: Quote?
@objc(serverID) @objc(serverID)
public var objc_serverID: UInt64 { return serverID ?? 0 } public var objc_serverID: UInt64 { return serverID ?? 0 }
public init(serverID: UInt64?, hexEncodedPublicKey: String, displayName: String, body: String, type: String, timestamp: UInt64) { public struct Quote {
public let quotedMessageTimestamp: UInt64
public let quoteeHexEncodedPublicKey: String
public let quotedMessageBody: String
}
public init(serverID: UInt64?, hexEncodedPublicKey: String, displayName: String, body: String, type: String, timestamp: UInt64, quote: Quote?) {
self.serverID = serverID self.serverID = serverID
self.hexEncodedPublicKey = hexEncodedPublicKey self.hexEncodedPublicKey = hexEncodedPublicKey
self.displayName = displayName self.displayName = displayName
self.body = body self.body = body
self.type = type self.type = type
self.timestamp = timestamp self.timestamp = timestamp
self.quote = quote
super.init() super.init()
} }
@objc public convenience init(hexEncodedPublicKey: String, displayName: String, body: String, type: String, timestamp: UInt64) { @objc public convenience init(hexEncodedPublicKey: String, displayName: String, body: String, type: String, timestamp: UInt64, quotedMessageTimestamp: UInt64, quoteeHexEncodedPublicKey: String?, quotedMessageBody: String?) {
self.init(serverID: nil, hexEncodedPublicKey: hexEncodedPublicKey, displayName: displayName, body: body, type: type, timestamp: timestamp) let quote: Quote?
if quotedMessageTimestamp != 0, let quoteeHexEncodedPublicKey = quoteeHexEncodedPublicKey, let quotedMessageBody = quotedMessageBody {
quote = Quote(quotedMessageTimestamp: quotedMessageTimestamp, quoteeHexEncodedPublicKey: quoteeHexEncodedPublicKey, quotedMessageBody: quotedMessageBody)
} else {
quote = nil
}
self.init(serverID: nil, hexEncodedPublicKey: hexEncodedPublicKey, displayName: displayName, body: body, type: type, timestamp: timestamp, quote: quote)
} }
internal func toJSON() -> JSON { internal func toJSON() -> JSON {
let value: JSON = [ "timestamp" : timestamp, "from" : displayName, "source" : hexEncodedPublicKey ] var value: JSON = [ "timestamp" : timestamp, "from" : displayName, "source" : hexEncodedPublicKey ]
if let quote = quote {
value["quote"] = [ "id" : quote.quotedMessageTimestamp, "author" : quote.quoteeHexEncodedPublicKey, "text" : quote.quotedMessageBody ]
}
return [ "text" : body, "annotations": [ [ "type" : type, "value" : value ] ] ] return [ "text" : body, "annotations": [ [ "type" : type, "value" : value ] ] ]
} }
} }

@ -157,7 +157,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
OWSAssertDebug(bodySource != TSQuotedMessageContentSourceUnknown); // OWSAssertDebug(bodySource != TSQuotedMessageContentSourceUnknown);
NSMutableArray<OWSAttachmentInfo *> *attachmentInfos = [NSMutableArray new]; NSMutableArray<OWSAttachmentInfo *> *attachmentInfos = [NSMutableArray new];
for (SSKProtoDataMessageQuoteQuotedAttachment *quotedAttachment in quoteProto.attachments) { for (SSKProtoDataMessageQuoteQuotedAttachment *quotedAttachment in quoteProto.attachments) {

@ -1113,7 +1113,9 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSString *userHexEncodedPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey; NSString *userHexEncodedPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
NSString *displayName = SSKEnvironment.shared.profileManager.localProfileName; NSString *displayName = SSKEnvironment.shared.profileManager.localProfileName;
if (displayName == nil) { displayName = @"Anonymous"; } if (displayName == nil) { displayName = @"Anonymous"; }
LKGroupMessage *groupMessage = [[LKGroupMessage alloc] initWithHexEncodedPublicKey:userHexEncodedPublicKey displayName:displayName body:message.body type:LKGroupChatAPI.publicChatMessageType timestamp:message.timestamp]; TSQuotedMessage *quote = message.quotedMessage;
LKGroupMessage *groupMessage = [[LKGroupMessage alloc] initWithHexEncodedPublicKey:userHexEncodedPublicKey displayName:displayName body:message.body type:LKGroupChatAPI.publicChatMessageType
timestamp:message.timestamp quotedMessageTimestamp:quote.timestamp quoteeHexEncodedPublicKey:quote.authorId quotedMessageBody:quote.body];
[[LKGroupChatAPI sendMessage:groupMessage toGroup:LKGroupChatAPI.publicChatServerID onServer:LKGroupChatAPI.publicChatServer] [[LKGroupChatAPI sendMessage:groupMessage toGroup:LKGroupChatAPI.publicChatServerID onServer:LKGroupChatAPI.publicChatServer]
.thenOn(OWSDispatch.sendingQueue, ^(LKGroupMessage *groupMessage) { .thenOn(OWSDispatch.sendingQueue, ^(LKGroupMessage *groupMessage) {
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {

Loading…
Cancel
Save