From 4c7a652fd9f03556554772b544b1e2155ccd1808 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 1 Jul 2019 12:42:42 +0200 Subject: [PATCH] EventFormatter: add showEditionMention setting --- .../EditHistory/EditHistoryCoordinatorBridgePresenter.swift | 4 ++-- Riot/Utils/EventFormatter.h | 6 ++++++ Riot/Utils/EventFormatter.m | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift b/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift index 818773e2b..a566c959b 100644 --- a/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift +++ b/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift @@ -102,8 +102,8 @@ final class EditHistoryCoordinatorBridgePresenter: NSObject { formatter.treatMatrixGroupIdAsLink = true formatter.eventTypesFilterForMessages = MXKAppSettings.standard()?.eventsFilterForMessages - // But do not display "...(edited)" - // TODO + // But do not display "...(Edited)" + formatter.showEditionMention = false return formatter } diff --git a/Riot/Utils/EventFormatter.h b/Riot/Utils/EventFormatter.h index 67abcd419..172175079 100644 --- a/Riot/Utils/EventFormatter.h +++ b/Riot/Utils/EventFormatter.h @@ -36,6 +36,12 @@ FOUNDATION_EXPORT NSString *const EventFormatterEditedEventLinkAction; */ @interface EventFormatter : MXKEventFormatter +/** + Add a "(Edited)" mention to edited message. + Default is YES. + */ +@property (nonatomic) BOOL showEditionMention; + /** Text color used to display message edited mention. Default is `textSecondaryColor`. diff --git a/Riot/Utils/EventFormatter.m b/Riot/Utils/EventFormatter.m index 8b8eeba27..3ba09e318 100644 --- a/Riot/Utils/EventFormatter.m +++ b/Riot/Utils/EventFormatter.m @@ -182,7 +182,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; attributedString = attributedStringWithRerequestMessage; } } - else if (event.contentHasBeenEdited) + else if (self.showEditionMention && event.contentHasBeenEdited) { NSMutableAttributedString *attributedStringWithEditMention = [attributedString mutableCopy]; @@ -255,6 +255,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm"; self.encryptingTextColor = ThemeService.shared.theme.tintColor; self.sendingTextColor = ThemeService.shared.theme.textSecondaryColor; self.errorTextColor = ThemeService.shared.theme.warningColor; + self.showEditionMention = YES; self.editionMentionTextColor = ThemeService.shared.theme.textSecondaryColor; self.defaultTextFont = [UIFont systemFontOfSize:15];