diff --git a/NextcloudTalk/NCChatMessage.h b/NextcloudTalk/NCChatMessage.h index bc6719e2c..5a598f0e4 100644 --- a/NextcloudTalk/NCChatMessage.h +++ b/NextcloudTalk/NCChatMessage.h @@ -87,6 +87,7 @@ typedef void (^GetReferenceDataCompletionBlock)(NCChatMessage *message, NSDictio @property (nonatomic, assign) BOOL collapsedIncludesActorSelf; @property (nonatomic, assign) BOOL collapsedIncludesUserSelf; @property (nonatomic, assign) BOOL isCollapsed; +@property (nonatomic, assign) BOOL isMarkdownMessage; + (instancetype)messageWithDictionary:(NSDictionary *)messageDict; + (instancetype)messageWithDictionary:(NSDictionary *)messageDict andAccountId:(NSString *)accountId; diff --git a/NextcloudTalk/NCChatMessage.m b/NextcloudTalk/NCChatMessage.m index 048724ef9..54d80faf3 100644 --- a/NextcloudTalk/NCChatMessage.m +++ b/NextcloudTalk/NCChatMessage.m @@ -80,6 +80,7 @@ + (instancetype)messageWithDictionary:(NSDictionary *)messageDict message.referenceId = [messageDict objectForKey:@"referenceId"]; message.messageType = [messageDict objectForKey:@"messageType"]; message.expirationTimestamp = [[messageDict objectForKey:@"expirationTimestamp"] integerValue]; + message.isMarkdownMessage = [[messageDict objectForKey:@"markdown"] boolValue]; id actorDisplayName = [messageDict objectForKey:@"actorDisplayName"]; if (!actorDisplayName) { @@ -169,6 +170,7 @@ + (void)updateChatMessage:(NCChatMessage *)managedChatMessage withChatMessage:(N managedChatMessage.messageType = chatMessage.messageType; managedChatMessage.reactionsJSONString = chatMessage.reactionsJSONString; managedChatMessage.expirationTimestamp = chatMessage.expirationTimestamp; + managedChatMessage.isMarkdownMessage = chatMessage.isMarkdownMessage; if (!isRoomLastMessage) { managedChatMessage.reactionsSelfJSONString = chatMessage.reactionsSelfJSONString; @@ -215,6 +217,7 @@ - (id)copyWithZone:(NSZone *)zone messageCopy.isDeleting = _isDeleting; messageCopy.isOfflineMessage = _isOfflineMessage; messageCopy.isSilent = _isSilent; + messageCopy.isMarkdownMessage = _isMarkdownMessage; return messageCopy; } @@ -508,6 +511,10 @@ - (NSMutableAttributedString *)parsedMarkdown return nil; } + if (!_isMarkdownMessage) { + return parsedMessage; + } + return [SwiftMarkdownObjCBridge parseMarkdownWithMarkdownString:parsedMessage]; } @@ -524,6 +531,10 @@ - (NSMutableAttributedString *)parsedMarkdownForChat return nil; } + if (!_isMarkdownMessage) { + return parsedMessage; + } + return [SwiftMarkdownObjCBridge parseMarkdownWithMarkdownString:parsedMessage]; } diff --git a/NextcloudTalk/NCDatabaseManager.m b/NextcloudTalk/NCDatabaseManager.m index fb36176b3..c5723198c 100644 --- a/NextcloudTalk/NCDatabaseManager.m +++ b/NextcloudTalk/NCDatabaseManager.m @@ -33,7 +33,7 @@ NSString *const kTalkDatabaseFolder = @"Library/Application Support/Talk"; NSString *const kTalkDatabaseFileName = @"talk.realm"; -uint64_t const kTalkDatabaseSchemaVersion = 53; +uint64_t const kTalkDatabaseSchemaVersion = 54; NSString * const kCapabilitySystemMessages = @"system-messages"; NSString * const kCapabilityNotificationLevels = @"notification-levels";