From 33a7c27c0bfc08e2225bb90e398eca6a85ac8407 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 5 Aug 2022 15:09:56 +0100 Subject: [PATCH] Remove flairs and related groups. --- Config/BuildSettings.swift | 1 - Riot/Managers/Settings/RiotSettings.swift | 3 - Riot/Modules/Application/LegacyAppDelegate.m | 7 - .../Modules/MatrixKit/Models/MXKAppSettings.m | 1 - .../Models/Room/MXKRoomBubbleCellData.m | 71 +--- .../Room/MXKRoomBubbleCellDataStoring.h | 10 - .../MatrixKit/Models/Room/MXKRoomDataSource.h | 16 - .../MatrixKit/Models/Room/MXKRoomDataSource.m | 127 ------- .../Utils/EventFormatter/MXKEventFormatter.h | 1 - .../Utils/EventFormatter/MXKEventFormatter.m | 21 -- Riot/Modules/MatrixKit/Utils/MXKTools.h | 1 - Riot/Modules/MatrixKit/Utils/MXKTools.m | 8 - .../Modules/Room/DataSources/RoomDataSource.m | 1 - ...ditHistoryCoordinatorBridgePresenter.swift | 1 - Riot/Modules/Room/RoomViewController.m | 10 - .../Settings/RoomSettingsViewController.m | 335 ------------------ .../Common/MXKRoomBubbleTableViewCell.h | 5 - .../Common/MXKRoomBubbleTableViewCell.m | 97 +---- .../Sticker/RoomSelectedStickerBubbleCell.m | 10 +- changelog.d/6523.api | 1 + changelog.d/6523.change | 1 + 21 files changed, 5 insertions(+), 723 deletions(-) create mode 100644 changelog.d/6523.api create mode 100644 changelog.d/6523.change diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index 8e09edb10c..02f47cf227 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -347,7 +347,6 @@ final class BuildSettings: NSObject { static let roomSettingsScreenAllowChangingAccessSettings: Bool = true static let roomSettingsScreenAllowChangingHistorySettings: Bool = true static let roomSettingsScreenShowAddressSettings: Bool = true - static let roomSettingsScreenShowFlairSettings: Bool = true static let roomSettingsScreenShowAdvancedSettings: Bool = true static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption: Bool = true diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index a0c53efe5d..f1cc69ddbd 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -339,9 +339,6 @@ final class RiotSettings: NSObject { @UserDefault(key: "roomSettingsScreenShowAddressSettings", defaultValue: BuildSettings.roomSettingsScreenShowAddressSettings, storage: defaults) var roomSettingsScreenShowAddressSettings - @UserDefault(key: "roomSettingsScreenShowFlairSettings", defaultValue: BuildSettings.roomSettingsScreenShowFlairSettings, storage: defaults) - var roomSettingsScreenShowFlairSettings - @UserDefault(key: "roomSettingsScreenShowAdvancedSettings", defaultValue: BuildSettings.roomSettingsScreenShowAdvancedSettings, storage: defaults) var roomSettingsScreenShowAdvancedSettings diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 16abba4570..94cdd96c6e 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -620,13 +620,6 @@ - (void)applicationWillEnterForeground:(UIApplication *)application [MXSDKOptions.sharedInstance.profiler resume]; - // Force each session to refresh here their publicised groups by user dictionary. - // When these publicised groups are retrieved for a user, they are cached and reused until the app is backgrounded and enters in the foreground again - for (MXSession *session in mxSessionArray) - { - [session markOutdatedPublicisedGroupsByUserData]; - } - _isAppForeground = YES; } diff --git a/Riot/Modules/MatrixKit/Models/MXKAppSettings.m b/Riot/Modules/MatrixKit/Models/MXKAppSettings.m index 8d8e44b12f..40cf2ebd31 100644 --- a/Riot/Modules/MatrixKit/Models/MXKAppSettings.m +++ b/Riot/Modules/MatrixKit/Models/MXKAppSettings.m @@ -169,7 +169,6 @@ -(instancetype)init kMXEventTypeStringRoomMessageFeedback, kMXEventTypeStringRoomRedaction, kMXEventTypeStringRoomThirdPartyInvite, - kMXEventTypeStringRoomRelatedGroups, kMXEventTypeStringReaction, kMXEventTypeStringCallInvite, kMXEventTypeStringCallAnswer, diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellData.m b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellData.m index b1e904b604..e42b9e6d29 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellData.m +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellData.m @@ -29,7 +29,7 @@ #import "GeneratedInterface-Swift.h" @implementation MXKRoomBubbleCellData -@synthesize senderId, targetId, roomId, senderDisplayName, senderAvatarUrl, senderAvatarPlaceholder, targetDisplayName, targetAvatarUrl, targetAvatarPlaceholder, isEncryptedRoom, isPaginationFirstBubble, shouldHideSenderInformation, date, isIncoming, isAttachmentWithThumbnail, isAttachmentWithIcon, attachment, senderFlair; +@synthesize senderId, targetId, roomId, senderDisplayName, senderAvatarUrl, senderAvatarPlaceholder, targetDisplayName, targetAvatarUrl, targetAvatarPlaceholder, isEncryptedRoom, isPaginationFirstBubble, shouldHideSenderInformation, date, isIncoming, isAttachmentWithThumbnail, isAttachmentWithIcon, attachment; @synthesize textMessage, attributedTextMessage, attributedTextMessageWithoutPositioningSpace; @synthesize shouldHideSenderName, isTyping, showBubbleDateTime, showBubbleReceipts, useCustomDateTimeLabel, useCustomReceipts, useCustomUnsentButton, hasNoDisplay; @synthesize tag; @@ -122,9 +122,6 @@ - (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomS - (void)dealloc { - // Reset any observer on publicised groups by user. - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; - roomDataSource = nil; bubbleComponents = nil; } @@ -450,58 +447,6 @@ - (void)highlightPatternInTextMessage:(NSString*)pattern - (void)setShouldHideSenderInformation:(BOOL)inShouldHideSenderInformation { shouldHideSenderInformation = inShouldHideSenderInformation; - - if (!shouldHideSenderInformation) - { - // Refresh the flair - [self refreshSenderFlair]; - } -} - -- (void)refreshSenderFlair -{ - // Reset by default any observer on publicised groups by user. - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; - - // Check first whether the room enabled the flair for some groups - NSArray *roomRelatedGroups = roomDataSource.roomState.relatedGroups; - if (roomRelatedGroups.count && senderId) - { - NSArray *senderPublicisedGroups; - - senderPublicisedGroups = [self.mxSession publicisedGroupsForUser:senderId]; - - if (senderPublicisedGroups.count) - { - // Cross the 2 arrays to keep only the common group ids - NSMutableArray *flair = [NSMutableArray arrayWithCapacity:roomRelatedGroups.count]; - - for (NSString *groupId in roomRelatedGroups) - { - if ([senderPublicisedGroups indexOfObject:groupId] != NSNotFound) - { - MXGroup *group = [roomDataSource groupWithGroupId:groupId]; - [flair addObject:group]; - } - } - - if (flair.count) - { - self.senderFlair = flair; - } - else - { - self.senderFlair = nil; - } - } - else - { - self.senderFlair = nil; - } - - // Observe any change on publicised groups for the message sender - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionUpdatePublicisedGroupsForUsers:) name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; - } } - (BOOL)hasThreadRoot @@ -1042,18 +987,4 @@ - (void)highlightPattern } } -- (void)didMXSessionUpdatePublicisedGroupsForUsers:(NSNotification *)notif -{ - // Retrieved the list of the concerned users - NSArray *userIds = notif.userInfo[kMXSessionNotificationUserIdsArrayKey]; - if (userIds.count && self.senderId) - { - // Check whether the current sender is concerned. - if ([userIds indexOfObject:self.senderId] != NSNotFound) - { - [self refreshSenderFlair]; - } - } -} - @end diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellDataStoring.h b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellDataStoring.h index c9a3fb98f8..ad845ec4ec 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellDataStoring.h +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleCellDataStoring.h @@ -91,11 +91,6 @@ */ @property (nonatomic) UIImage *targetAvatarPlaceholder; -/** - The current sender flair (list of the publicised groups in the sender profile which matches the room flair settings) - */ -@property (nonatomic) NSArray *senderFlair; - /** Tell whether the room is encrypted. */ @@ -304,11 +299,6 @@ Update the event because its sent state changed or it is has been redacted. foregroundColor:(UIColor*)foregroundColor andFont:(UIFont*)patternFont; -/** - Refresh the sender flair information - */ -- (void)refreshSenderFlair; - /** Indicate that the current text message layout is no longer valid and should be recomputed before presentation in a bubble cell. This could be due to the content changing, or the diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.h b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.h index 1caf1315c7..a5c5428805 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.h +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.h @@ -100,11 +100,6 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey; The queue of events that need to be processed in order to compute their display. */ NSMutableArray *eventsToProcess; - - /** - The dictionary of the related groups that the current user did not join. - */ - NSMutableDictionary *externalRelatedGroups; } /** @@ -777,17 +772,6 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey; */ - (void)collapseRoomBubble:(id)bubbleData collapsed:(BOOL)collapsed; -#pragma mark - Groups - -/** - Get a MXGroup instance for a group. - This method is used by the bubble to retrieve a related groups of the room. - - @param groupId The identifier to the group. - @return the MXGroup instance. - */ -- (MXGroup *)groupWithGroupId:(NSString*)groupId; - #pragma mark - Reactions /** diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m index dca87ded58..5872eee2d3 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomDataSource.m @@ -87,11 +87,6 @@ Current pagination request (if any) The listener to receipts events in the room. */ id receiptsListener; - - /** - The listener to the related groups state events in the room. - */ - id relatedGroupsListener; /** The listener to reactions changed in the room. @@ -318,8 +313,6 @@ - (instancetype)initWithRoomId:(NSString *)roomId andMatrixSession:(MXSession *) eventsToProcess = [NSMutableArray array]; eventIdToBubbleMap = [NSMutableDictionary dictionary]; - externalRelatedGroups = [NSMutableDictionary dictionary]; - _filterMessagesWithURL = NO; emoteMessageSlashCommandPrefix = [NSString stringWithFormat:@"%@ ", kMXKSlashCmdEmote]; @@ -471,8 +464,6 @@ - (void)reset - (void)resetNotifying:(BOOL)notify { - [externalRelatedGroups removeAllObjects]; - if (roomDidFlushDataNotificationObserver) { [[NSNotificationCenter defaultCenter] removeObserver:roomDidFlushDataNotificationObserver]; @@ -515,9 +506,6 @@ - (void)resetNotifying:(BOOL)notify [_timeline removeListener:receiptsListener]; receiptsListener = nil; - - [_timeline removeListener:relatedGroupsListener]; - relatedGroupsListener = nil; } if (_secondaryRoom && secondaryLiveEventsListener) @@ -601,8 +589,6 @@ - (void)destroy [self unregisterScanManagerNotifications]; [self unregisterReactionsChangeListener]; [self unregisterEventEditsListener]; - - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXEventDidChangeSentStateNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXEventDidDecryptNotification object:nil]; @@ -638,8 +624,6 @@ - (void)destroy [_timeline destroy]; [_secondaryTimeline destroy]; - externalRelatedGroups = nil; - [super destroy]; } @@ -824,52 +808,6 @@ - (void)initializeTimelineForRoom [self setState:MXKDataSourceStateFailed]; } } - - if (_room && MXSessionStateRunning == self.mxSession.state) - { - // Flair handling: observe the update in the publicised groups by users when the flair is enabled in the room. - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; - [self.room state:^(MXRoomState *roomState) { - if (roomState.relatedGroups.count) - { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionUpdatePublicisedGroupsForUsers:) name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession]; - - // Get a fresh profile for all the related groups. Trigger a table refresh when all requests are done. - __block NSUInteger count = roomState.relatedGroups.count; - for (NSString *groupId in roomState.relatedGroups) - { - MXGroup *group = [self.mxSession groupWithGroupId:groupId]; - if (!group) - { - // Create a group instance for the groups that the current user did not join. - group = [[MXGroup alloc] initWithGroupId:groupId]; - [self->externalRelatedGroups setObject:group forKey:groupId]; - } - - // Refresh the group profile from server. - [self.mxSession updateGroupProfile:group success:^{ - - if (self.delegate && !(--count)) - { - // All the requests have been done. - [self.delegate dataSource:self didCellChange:nil]; - } - - } failure:^(NSError *error) { - - MXLogDebug(@"[MXKRoomDataSource][%p] group profile update failed %@", self, groupId); - - if (self.delegate && !(--count)) - { - // All the requests have been done. - [self.delegate dataSource:self didCellChange:nil]; - } - - }]; - } - } - }]; - } } - (void)initializeTimelineForThread @@ -1008,7 +946,6 @@ - (void)refreshEventListeners:(NSArray *)liveEventTypesFilterForMessages [_timeline removeListener:liveEventsListener]; [_timeline removeListener:redactionListener]; [_timeline removeListener:receiptsListener]; - [_timeline removeListener:relatedGroupsListener]; } // Listen to live events only for live timeline @@ -1071,16 +1008,6 @@ - (void)refreshEventListeners:(NSArray *)liveEventTypesFilterForMessages [self didReceiveReceiptEvent:event roomState:roomState]; } }]; - - // Flair handling: register a listener for the related groups state event in this room. - relatedGroupsListener = [_timeline listenToEventsOfTypes:@[kMXEventTypeStringRoomRelatedGroups] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) { - - if (MXTimelineDirectionForwards == direction) - { - // The flair settings have been updated: flush the current bubble data and rebuild them. - [self reload]; - } - }]; } // Register a listener to handle redaction which can affect live and past timelines @@ -2693,32 +2620,6 @@ - (void)didMXRoomInitialSynced:(NSNotification *)notif } } -- (void)didMXSessionUpdatePublicisedGroupsForUsers:(NSNotification *)notif -{ - // Retrieved the list of the concerned users - NSArray *userIds = notif.userInfo[kMXSessionNotificationUserIdsArrayKey]; - if (userIds.count) - { - // Check whether at least one listed user is a room member. - for (NSString* userId in userIds) - { - MXRoomMember * roomMember = [self.roomState.members memberWithUserId:userId]; - if (roomMember) - { - // Inform the delegate to refresh the bubble display - // We dispatch here this action in order to let each bubble data update their sender flair. - if (self.delegate) - { - dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate dataSource:self didCellChange:nil]; - }); - } - break; - } - } - } -} - - (void)eventDidChangeSentState:(NSNotification *)notif { MXEvent *event = notif.object; @@ -3993,34 +3894,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } -#pragma mark - Groups - -- (MXGroup *)groupWithGroupId:(NSString*)groupId -{ - MXGroup *group = [self.mxSession groupWithGroupId:groupId]; - if (!group) - { - // Check whether an instance has been already created. - group = [externalRelatedGroups objectForKey:groupId]; - } - - if (!group) - { - // Create a new group instance. - group = [[MXGroup alloc] initWithGroupId:groupId]; - [externalRelatedGroups setObject:group forKey:groupId]; - - // Retrieve at least the group profile - [self.mxSession updateGroupProfile:group success:nil failure:^(NSError *error) { - - MXLogDebug(@"[MXKRoomDataSource][%p] groupWithGroupId: group profile update failed %@", self, groupId); - - }]; - } - - return group; -} - #pragma mark - MXScanManager notifications - (void)registerScanManagerNotifications diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.h b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.h index 35c1508ef4..776b799278 100644 --- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.h +++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.h @@ -99,7 +99,6 @@ typedef enum : NSUInteger { @property (nonatomic) BOOL treatMatrixRoomIdAsLink; @property (nonatomic) BOOL treatMatrixRoomAliasAsLink; @property (nonatomic) BOOL treatMatrixEventIdAsLink; -@property (nonatomic) BOOL treatMatrixGroupIdAsLink; /** Initialise the event formatter. diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index a4b7a8f3be..fa6495fd5c 100644 --- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -1022,21 +1022,6 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent*)event } break; } - case MXEventTypeRoomRelatedGroups: - { - NSArray *groups; - MXJSONModelSetArray(groups, event.content[@"groups"]); - if (groups) - { - displayText = [VectorL10n noticeRoomRelatedGroups:[groups componentsJoinedByString:@", "]]; - // Append redacted info if any - if (redactedInfo) - { - displayText = [NSString stringWithFormat:@"%@\n %@", displayText, redactedInfo]; - } - } - break; - } case MXEventTypeRoomEncrypted: { // Is redacted? @@ -2081,12 +2066,6 @@ - (void)postRenderAttributedString:(NSMutableAttributedString*)mutableAttributed { enabledMatrixIdsBitMask |= MXKTOOLS_EVENT_IDENTIFIER_BITWISE; } - - // If enabled, make group id clickable - if (_treatMatrixGroupIdAsLink) - { - enabledMatrixIdsBitMask |= MXKTOOLS_GROUP_IDENTIFIER_BITWISE; - } [MXKTools createLinksInMutableAttributedString:mutableAttributedString forEnabledMatrixIds:enabledMatrixIdsBitMask]; } diff --git a/Riot/Modules/MatrixKit/Utils/MXKTools.h b/Riot/Modules/MatrixKit/Utils/MXKTools.h index a94d390d77..f5326d405e 100644 --- a/Riot/Modules/MatrixKit/Utils/MXKTools.h +++ b/Riot/Modules/MatrixKit/Utils/MXKTools.h @@ -25,7 +25,6 @@ #define MXKTOOLS_ROOM_IDENTIFIER_BITWISE 0x02 #define MXKTOOLS_ROOM_ALIAS_BITWISE 0x04 #define MXKTOOLS_EVENT_IDENTIFIER_BITWISE 0x08 -#define MXKTOOLS_GROUP_IDENTIFIER_BITWISE 0x10 // Attribute in an NSAttributeString that marks a blockquote block that was in the original HTML string. extern NSString *const kMXKToolsBlockquoteMarkAttribute; diff --git a/Riot/Modules/MatrixKit/Utils/MXKTools.m b/Riot/Modules/MatrixKit/Utils/MXKTools.m index 9f611867f4..10cf491a66 100644 --- a/Riot/Modules/MatrixKit/Utils/MXKTools.m +++ b/Riot/Modules/MatrixKit/Utils/MXKTools.m @@ -42,7 +42,6 @@ static NSRegularExpression *roomIdRegex; static NSRegularExpression *roomAliasRegex; static NSRegularExpression *eventIdRegex; -static NSRegularExpression *groupIdRegex; // A regex to find http URLs. static NSRegularExpression *httpLinksRegex; // A regex to find all HTML tags @@ -59,7 +58,6 @@ + (void)initialize roomIdRegex = [NSRegularExpression regularExpressionWithPattern:kMXToolsRegexStringForMatrixRoomIdentifier options:NSRegularExpressionCaseInsensitive error:nil]; roomAliasRegex = [NSRegularExpression regularExpressionWithPattern:kMXToolsRegexStringForMatrixRoomAlias options:NSRegularExpressionCaseInsensitive error:nil]; eventIdRegex = [NSRegularExpression regularExpressionWithPattern:kMXToolsRegexStringForMatrixEventIdentifier options:NSRegularExpressionCaseInsensitive error:nil]; - groupIdRegex = [NSRegularExpression regularExpressionWithPattern:kMXToolsRegexStringForMatrixGroupIdentifier options:NSRegularExpressionCaseInsensitive error:nil]; httpLinksRegex = [NSRegularExpression regularExpressionWithPattern:@"(?i)\\b(https?://\\S*)\\b" options:NSRegularExpressionCaseInsensitive error:nil]; htmlTagsRegex = [NSRegularExpression regularExpressionWithPattern:@"<(\\w+)[^>]*>" options:NSRegularExpressionCaseInsensitive error:nil]; @@ -1039,12 +1037,6 @@ + (void)createLinksInMutableAttributedString:(NSMutableAttributedString*)mutable { [MXKTools createLinksInMutableAttributedString:mutableAttributedString matchingRegex:eventIdRegex]; } - - // If enabled, make group id clickable - if (enabledMatrixIdsBitMask & MXKTOOLS_GROUP_IDENTIFIER_BITWISE) - { - [MXKTools createLinksInMutableAttributedString:mutableAttributedString matchingRegex:groupIdRegex]; - } } + (void)createLinksInMutableAttributedString:(NSMutableAttributedString*)mutableAttributedString matchingRegex:(NSRegularExpression*)regex diff --git a/Riot/Modules/Room/DataSources/RoomDataSource.m b/Riot/Modules/Room/DataSources/RoomDataSource.m index a9b809cc14..958403accf 100644 --- a/Riot/Modules/Room/DataSources/RoomDataSource.m +++ b/Riot/Modules/Room/DataSources/RoomDataSource.m @@ -162,7 +162,6 @@ - (void)updateEventFormatter self.eventFormatter.treatMatrixUserIdAsLink = YES; self.eventFormatter.treatMatrixRoomIdAsLink = YES; self.eventFormatter.treatMatrixRoomAliasAsLink = YES; - self.eventFormatter.treatMatrixGroupIdAsLink = YES; // Apply the event types filter to display only the wanted event types. self.eventFormatter.eventTypesFilterForMessages = [MXKAppSettings standardAppSettings].eventsFilterForMessages; diff --git a/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift b/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift index b908e5cb0b..341357304a 100644 --- a/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift +++ b/Riot/Modules/Room/EditHistory/EditHistoryCoordinatorBridgePresenter.swift @@ -98,7 +98,6 @@ final class EditHistoryCoordinatorBridgePresenter: NSObject { formatter.treatMatrixUserIdAsLink = true formatter.treatMatrixRoomIdAsLink = true formatter.treatMatrixRoomAliasAsLink = true - formatter.treatMatrixGroupIdAsLink = true formatter.eventTypesFilterForMessages = MXKAppSettings.standard()?.eventsFilterForMessages // But do not display "...(Edited)" diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index abfe72807b..99eff65aa6 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -4285,16 +4285,6 @@ - (BOOL)dataSource:(MXKDataSource *)dataSource shouldDoAction:(NSString *)action [self handleUniversalLinkURL:permalinkURL]; } - // Preview the clicked group - else if ([MXTools isMatrixGroupIdentifier:absoluteURLString]) - { - shouldDoAction = NO; - - // Open the group or preview it - NSString *fragment = [NSString stringWithFormat:@"/group/%@", [MXTools encodeURIComponent:absoluteURLString]]; - - [self handleUniversalLinkFragment:fragment fromURL:url]; - } else if ([absoluteURLString hasPrefix:EventFormatterOnReRequestKeysLinkAction]) { NSArray *arguments = [absoluteURLString componentsSeparatedByString:EventFormatterLinkActionSeparator]; diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index d0c08b5880..e25f706e3f 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -41,7 +41,6 @@ SECTION_TAG_PROMOTION, SECTION_TAG_HISTORY, SECTION_TAG_ADDRESSES, - SECTION_TAG_FLAIR, SECTION_TAG_BANNED_USERS, SECTION_TAG_BANNED_ADVANCED }; @@ -77,12 +76,6 @@ ROOM_SETTINGS_HISTORY_VISIBILITY_SECTION_ROW_MEMBERS_ONLY_SINCE_JOINED }; -enum -{ - ROOM_SETTINGS_RELATED_GROUPS_NEW_GROUP, - ROOM_SETTINGS_RELATED_GROUPS_OFFSET = 1000 -}; - enum { ROOM_SETTINGS_ADVANCED_ROOM_ID, @@ -115,8 +108,6 @@ NSString *const kRoomSettingsNewAliasesKey = @"kRoomSettingsNewAliasesKey"; NSString *const kRoomSettingsRemovedAliasesKey = @"kRoomSettingsRemovedAliasesKey"; NSString *const kRoomSettingsCanonicalAliasKey = @"kRoomSettingsCanonicalAliasKey"; -NSString *const kRoomSettingsNewRelatedGroupKey = @"kRoomSettingsNewRelatedGroupKey"; -NSString *const kRoomSettingsRemovedRelatedGroupKey = @"kRoomSettingsRemovedRelatedGroupKey"; NSString *const kRoomSettingsEncryptionKey = @"kRoomSettingsEncryptionKey"; NSString *const kRoomSettingsEncryptionBlacklistUnverifiedDevicesKey = @"kRoomSettingsEncryptionBlacklistUnverifiedDevicesKey"; @@ -124,7 +115,6 @@ NSString *const kRoomSettingsTopicCellViewIdentifier = @"kRoomSettingsTopicCellViewIdentifier"; NSString *const kRoomSettingsWarningCellViewIdentifier = @"kRoomSettingsWarningCellViewIdentifier"; NSString *const kRoomSettingsNewAddressCellViewIdentifier = @"kRoomSettingsNewAddressCellViewIdentifier"; -NSString *const kRoomSettingsNewCommunityCellViewIdentifier = @"kRoomSettingsNewCommunityCellViewIdentifier"; NSString *const kRoomSettingsAddressCellViewIdentifier = @"kRoomSettingsAddressCellViewIdentifier"; NSString *const kRoomSettingsAdvancedCellViewIdentifier = @"kRoomSettingsAdvancedCellViewIdentifier"; NSString *const kRoomSettingsAdvancedEnableE2eCellViewIdentifier = @"kRoomSettingsAdvancedEnableE2eCellViewIdentifier"; @@ -156,10 +146,6 @@ @interface RoomSettingsViewController () *relatedGroups; - UITextField* addGroupTextField; - // The potential image loader MXMediaLoader *uploader; @@ -248,7 +234,6 @@ - (void)viewDidLoad historyVisibilityTickCells = [[NSMutableDictionary alloc] initWithCapacity:4]; roomAddresses = [NSMutableArray array]; - relatedGroups = [NSMutableArray array]; [self.tableView registerClass:MXKTableViewCellWithLabelAndSwitch.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndSwitch defaultReuseIdentifier]]; [self.tableView registerClass:MXKTableViewCellWithLabelAndMXKImageView.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndMXKImageView defaultReuseIdentifier]]; @@ -258,7 +243,6 @@ - (void)viewDidLoad [self.tableView registerClass:MXKTableViewCellWithLabelAndTextField.class forCellReuseIdentifier:kRoomSettingsNameCellViewIdentifier]; [self.tableView registerClass:TableViewCellWithLabelAndLargeTextView.class forCellReuseIdentifier:kRoomSettingsTopicCellViewIdentifier]; [self.tableView registerClass:MXKTableViewCellWithLabelAndTextField.class forCellReuseIdentifier:kRoomSettingsNewAddressCellViewIdentifier]; - [self.tableView registerClass:MXKTableViewCellWithLabelAndTextField.class forCellReuseIdentifier:kRoomSettingsNewCommunityCellViewIdentifier]; [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:kRoomSettingsAddressCellViewIdentifier]; [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:kRoomSettingsWarningCellViewIdentifier]; @@ -421,7 +405,6 @@ - (void)destroy historyVisibilityTickCells = nil; roomAddresses = nil; - relatedGroups = nil; if (extraEventsListener) { @@ -516,8 +499,6 @@ - (void)updateSections localAddressesCount++; } - [self refreshRelatedGroups]; - // create sections NSMutableArray *tmpSections = [NSMutableArray arrayWithCapacity:SECTION_TAG_BANNED_ADVANCED + 1]; @@ -606,34 +587,6 @@ - (void)updateSections [tmpSections addObject:sectionAddresses]; } - if (RiotSettings.shared.roomSettingsScreenShowFlairSettings) - { - Section *sectionFlair = [Section sectionWithTag:SECTION_TAG_FLAIR]; - - for (NSInteger counter = 0; counter < relatedGroups.count; counter++) - { - [sectionFlair addRowWithTag:counter + ROOM_SETTINGS_RELATED_GROUPS_OFFSET]; - } - - if (self.mainSession) - { - // Check user's power level to know whether the user is allowed to add communities to this room - MXRoomPowerLevels *powerLevels = [mxRoomState powerLevels]; - NSInteger oneSelfPowerLevel = [powerLevels powerLevelOfUserWithUserID:self.mainSession.myUser.userId]; - - if (oneSelfPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomRelatedGroups]) - { - [sectionFlair addRowWithTag:ROOM_SETTINGS_RELATED_GROUPS_NEW_GROUP]; - } - } - - sectionFlair.headerTitle = [VectorL10n roomDetailsFlairSection]; - if ([sectionFlair hasAnyRows]) - { - [tmpSections addObject:sectionFlair]; - } - } - if (bannedMembers.count) { Section *sectionBannedUsers = [Section sectionWithTag:SECTION_TAG_BANNED_USERS]; @@ -1156,36 +1109,6 @@ - (void)retrieveActualDirectoryVisibility }]; } -- (void)refreshRelatedGroups -{ - // Refresh here the related communities list. - [relatedGroups removeAllObjects]; - [relatedGroups addObjectsFromArray:mxRoomState.relatedGroups]; - NSArray *removedCommunities = updatedItemsDict[kRoomSettingsRemovedRelatedGroupKey]; - if (removedCommunities.count) - { - for (NSUInteger index = 0; index < relatedGroups.count;) - { - NSString *groupId = relatedGroups[index]; - - // Check whether the user did not remove it - if ([removedCommunities indexOfObject:groupId] != NSNotFound) - { - [relatedGroups removeObjectAtIndex:index]; - } - else - { - index++; - } - } - } - NSArray *communities = updatedItemsDict[kRoomSettingsNewRelatedGroupKey]; - if (communities) - { - [relatedGroups addObjectsFromArray:communities]; - } -} - #pragma mark - UITextViewDelegate - (void)textViewDidBeginEditing:(UITextView *)textView; @@ -1347,18 +1270,6 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField addAddressTextField.text = nil; } } - else if (textField == addGroupTextField) - { - // Dismiss the keyboard - [addGroupTextField resignFirstResponder]; - - NSString *groupId = addGroupTextField.text; - if (!groupId.length || [self addCommunity:groupId]) - { - // Reset the input field - addGroupTextField.text = nil; - } - } return YES; } @@ -1920,52 +1831,6 @@ - (IBAction)onSave:(id)sender return; } - - // Related groups - if (updatedItemsDict[kRoomSettingsNewRelatedGroupKey] || updatedItemsDict[kRoomSettingsRemovedRelatedGroupKey]) - { - [self refreshRelatedGroups]; - - pendingOperation = [mxRoom setRelatedGroups:relatedGroups success:^{ - - if (weakSelf) - { - typeof(self) self = weakSelf; - - self->pendingOperation = nil; - - [self->updatedItemsDict removeObjectForKey:kRoomSettingsNewRelatedGroupKey]; - [self->updatedItemsDict removeObjectForKey:kRoomSettingsRemovedRelatedGroupKey]; - - [self onSave:nil]; - } - - } failure:^(NSError *error) { - - MXLogDebug(@"[RoomSettingsViewController] Update room communities failed"); - - if (weakSelf) - { - typeof(self) self = weakSelf; - - self->pendingOperation = nil; - - dispatch_async(dispatch_get_main_queue(), ^{ - - NSString* message = error.localizedDescription; - if (!message.length) - { - message = [VectorL10n roomDetailsFailToUpdateRoomCommunities]; - } - [self onSaveFailed:message withKeys:@[kRoomSettingsNewRelatedGroupKey,kRoomSettingsRemovedRelatedGroupKey]]; - - }); - } - - }]; - - return; - } } // Update here other room settings @@ -2793,64 +2658,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = addressCell; } } - else if (section == SECTION_TAG_FLAIR) - { - if (row == ROOM_SETTINGS_RELATED_GROUPS_NEW_GROUP) - { - MXKTableViewCellWithLabelAndTextField *addCommunityCell = [tableView dequeueReusableCellWithIdentifier:kRoomSettingsNewCommunityCellViewIdentifier forIndexPath:indexPath]; - - // Retrieve the current edited value if any - NSString *currentValue = (addGroupTextField ? addGroupTextField.text : nil); - - addCommunityCell.mxkLabelLeadingConstraint.constant = 0; - addCommunityCell.mxkTextFieldLeadingConstraint.constant = tableView.vc_separatorInset.left; - addCommunityCell.mxkTextFieldTrailingConstraint.constant = 15; - - addCommunityCell.mxkLabel.text = nil; - - addCommunityCell.accessoryType = UITableViewCellAccessoryNone; - addCommunityCell.accessoryView = [[UIImageView alloc] initWithImage:[AssetImages.plusIcon.image vc_tintedImageUsingColor:ThemeService.shared.theme.textPrimaryColor]]; - - addGroupTextField = addCommunityCell.mxkTextField; - addGroupTextField.placeholder = [VectorL10n roomDetailsNewFlairPlaceholder:self.mainSession.matrixRestClient.homeserverSuffix]; - addGroupTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:addGroupTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - addGroupTextField.userInteractionEnabled = YES; - addGroupTextField.text = currentValue; - addGroupTextField.textColor = ThemeService.shared.theme.textSecondaryColor; - - addGroupTextField.tintColor = ThemeService.shared.theme.tintColor; - addGroupTextField.font = [UIFont systemFontOfSize:17]; - addGroupTextField.borderStyle = UITextBorderStyleNone; - addGroupTextField.textAlignment = NSTextAlignmentLeft; - - addGroupTextField.autocorrectionType = UITextAutocorrectionTypeNo; - addGroupTextField.spellCheckingType = UITextSpellCheckingTypeNo; - addGroupTextField.delegate = self; - - cell = addCommunityCell; - } - else if (row >= ROOM_SETTINGS_RELATED_GROUPS_OFFSET) - { - UITableViewCell *communityCell = [tableView dequeueReusableCellWithIdentifier:kRoomSettingsAddressCellViewIdentifier forIndexPath:indexPath]; - - communityCell.textLabel.font = [UIFont systemFontOfSize:16]; - communityCell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor; - communityCell.textLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; - communityCell.accessoryView = nil; - communityCell.accessoryType = UITableViewCellAccessoryNone; - communityCell.selectionStyle = UITableViewCellSelectionStyleNone; - - NSInteger index = row - ROOM_SETTINGS_RELATED_GROUPS_OFFSET; - - if (index < relatedGroups.count) - { - communityCell.textLabel.text = relatedGroups[index]; - } - cell = communityCell; - } - } else if (section == SECTION_TAG_BANNED_USERS) { UITableViewCell *addressCell = [tableView dequeueReusableCellWithIdentifier:kRoomSettingsAddressCellViewIdentifier forIndexPath:indexPath]; @@ -3171,18 +2978,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath }); } } - else if (section == SECTION_TAG_FLAIR) - { - if (row == ROOM_SETTINGS_RELATED_GROUPS_NEW_GROUP) - { - NSString *groupId = addGroupTextField.text; - if (!groupId.length || [self addCommunity:groupId]) - { - // Reset the input field - addGroupTextField.text = nil; - } - } - } else if (section == SECTION_TAG_BANNED_USERS) { // Show the RoomMemberDetailsViewController on this member so that @@ -3240,27 +3035,6 @@ - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwip swipeActionConfiguration.performsFirstActionWithFullSwipe = NO; return swipeActionConfiguration; } - else if (section == SECTION_TAG_FLAIR && row >= ROOM_SETTINGS_RELATED_GROUPS_OFFSET) - { - UIContextualAction *removeAddressAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive - title:@" " - handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { - [self removeCommunityAtIndexPath:indexPath]; - completionHandler(YES); - }]; - removeAddressAction.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; - removeAddressAction.image = [AssetImages.removeIcon.image vc_notRenderedImage]; - - // Create swipe action configuration - - NSArray *actions = @[ - removeAddressAction - ]; - - UISwipeActionsConfiguration *swipeActionConfiguration = [UISwipeActionsConfiguration configurationWithActions:actions]; - swipeActionConfiguration.performsFirstActionWithFullSwipe = NO; - return swipeActionConfiguration; - } return nil; } @@ -3693,20 +3467,6 @@ - (void)removeAddressAtIndexPath:(NSIndexPath *)indexPath } } -- (void)removeCommunityAtIndexPath:(NSIndexPath *)indexPath -{ - indexPath = [_tableViewSections tagsIndexPathFromTableViewIndexPath:indexPath]; - NSInteger row = indexPath.row; - - NSInteger index = row - ROOM_SETTINGS_RELATED_GROUPS_OFFSET; - - if (index < relatedGroups.count) - { - NSString *groupId = relatedGroups[index]; - [self removeCommunity:groupId]; - } -} - - (void)removeRoomAlias:(NSString*)roomAlias { NSString *canonicalAlias; @@ -3762,36 +3522,6 @@ - (void)removeRoomAlias:(NSString*)roomAlias } } -- (void)removeCommunity:(NSString*)groupId -{ - // Check whether the alias has just been added - NSMutableArray *addedGroup = updatedItemsDict[kRoomSettingsNewRelatedGroupKey]; - if (addedGroup && [addedGroup indexOfObject:groupId] != NSNotFound) - { - [addedGroup removeObject:groupId]; - - if (!addedGroup.count) - { - [updatedItemsDict removeObjectForKey:kRoomSettingsNewRelatedGroupKey]; - } - } - else - { - NSMutableArray *removedGroup = updatedItemsDict[kRoomSettingsRemovedRelatedGroupKey]; - if (!removedGroup) - { - removedGroup = [NSMutableArray array]; - updatedItemsDict[kRoomSettingsRemovedRelatedGroupKey] = removedGroup; - } - - [removedGroup addObject:groupId]; - } - - [self updateSections]; - - [self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0); -} - - (BOOL)addRoomAlias:(NSString*)roomAlias { // Check whether the provided alias is valid @@ -3873,71 +3603,6 @@ - (BOOL)addRoomAlias:(NSString*)roomAlias return NO; } -- (BOOL)addCommunity:(NSString*)groupId -{ - // Check whether the provided id is valid - if ([MXTools isMatrixGroupIdentifier:groupId]) - { - // Check whether this group has just been deleted - NSMutableArray *removedGroups = updatedItemsDict[kRoomSettingsRemovedRelatedGroupKey]; - if (removedGroups && [removedGroups indexOfObject:groupId] != NSNotFound) - { - [removedGroups removeObject:groupId]; - - if (!removedGroups.count) - { - [updatedItemsDict removeObjectForKey:kRoomSettingsRemovedRelatedGroupKey]; - } - } - // Check whether this alias is not already defined for this room - else if ([relatedGroups indexOfObject:groupId] == NSNotFound) - { - NSMutableArray *addedGroup = updatedItemsDict[kRoomSettingsNewRelatedGroupKey]; - if (!addedGroup) - { - addedGroup = [NSMutableArray array]; - updatedItemsDict[kRoomSettingsNewRelatedGroupKey] = addedGroup; - } - - [addedGroup addObject:groupId]; - } - - [self updateSections]; - - [self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0); - - return YES; - } - - // Prompt here user for invalid id - __weak typeof(self) weakSelf = self; - - [currentAlert dismissViewControllerAnimated:NO completion:nil]; - - NSString *alertMsg = [VectorL10n roomDetailsFlairInvalidIdPromptMsg:groupId]; - - currentAlert = [UIAlertController alertControllerWithTitle:[VectorL10n roomDetailsFlairInvalidIdPromptTitle] - message:alertMsg - preferredStyle:UIAlertControllerStyleAlert]; - - [currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - - if (weakSelf) - { - typeof(self) self = weakSelf; - self->currentAlert = nil; - } - - }]]; - - [currentAlert mxk_setAccessibilityIdentifier:@"RoomSettingsVCAddCommunityAlert"]; - [self presentViewController:currentAlert animated:YES completion:nil]; - - return NO; -} - #pragma mark - TableViewCellWithCheckBoxesDelegate - (void)tableViewCellWithCheckBoxes:(TableViewCellWithCheckBoxes *)tableViewCellWithCheckBoxes didTapOnCheckBoxAtIndex:(NSUInteger)index diff --git a/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.h b/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.h index 15e18f89be..fca4f31aa3 100644 --- a/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.h +++ b/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.h @@ -304,11 +304,6 @@ extern NSString *const kMXKRoomBubbleCellUrlItemInteraction; */ - (void)prepareRender:(MXKCellData*)cellData; -/** - Refresh the flair information added to the sender display name. - */ -- (void)renderSenderFlair; - /** Highlight text message related to a specific event in the displayed message. diff --git a/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.m b/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.m index fe4a3558db..13eac3bcc7 100644 --- a/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.m +++ b/Riot/Modules/Room/TimelineCells/Common/MXKRoomBubbleTableViewCell.m @@ -497,16 +497,7 @@ - (void)render:(MXKCellData *)cellData // Display sender's name except if the name appears in the displayed text (see emote and membership events) if (bubbleData.shouldHideSenderName == NO) { - if (bubbleData.senderFlair) - { - [self renderSenderFlair]; - } - else - { - self.userNameLabel.text = bubbleData.senderDisplayName; - } - - + self.userNameLabel.text = bubbleData.senderDisplayName; self.userNameLabel.hidden = NO; self.userNameTapGestureMaskView.userInteractionEnabled = YES; } @@ -800,75 +791,6 @@ - (void)prepareRender:(MXKCellData *)cellData mxkCellData = cellData; } -- (void)renderSenderFlair -{ - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ ", bubbleData.senderDisplayName]]; - - NSUInteger index = 0; - - for (MXGroup *group in bubbleData.senderFlair) - { - NSString *mxcAvatarURI = group.profile.avatarUrl; - NSString *cacheFilePath = [MXMediaManager thumbnailCachePathForMatrixContentURI:mxcAvatarURI andType:@"image/jpeg" inFolder:kMXMediaManagerDefaultCacheFolder toFitViewSize:CGSizeMake(12, 12) withMethod:MXThumbnailingMethodCrop]; - - // Check whether the avatar url is valid - if (cacheFilePath) - { - UIImage *image = [MXMediaManager loadThroughCacheWithFilePath:cacheFilePath]; - if (image) - { - NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; - textAttachment.image = [MXKTools resizeImageWithRoundedCorners:image toSize:CGSizeMake(12, 12)]; - NSAttributedString *attrStringWithImage = [NSAttributedString attributedStringWithAttachment:textAttachment]; - [attributedString appendAttributedString:attrStringWithImage]; - [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]]; - } - else - { - NSString *downloadId = [MXMediaManager thumbnailDownloadIdForMatrixContentURI:mxcAvatarURI - inFolder:kMXMediaManagerDefaultCacheFolder - toFitViewSize:CGSizeMake(12, 12) - withMethod:MXThumbnailingMethodCrop]; - // Check whether the download is in progress. - MXMediaLoader* loader = [MXMediaManager existingDownloaderWithIdentifier:downloadId]; - if (loader) - { - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXMediaLoaderStateDidChangeNotification object:loader]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFlairDownloadStateChange:) name:kMXMediaLoaderStateDidChangeNotification object:loader]; - } - else - { - MXWeakify(self); - [bubbleData.mxSession.mediaManager downloadThumbnailFromMatrixContentURI:mxcAvatarURI - withType:@"image/jpeg" - inFolder:kMXMediaManagerDefaultCacheFolder - toFitViewSize:CGSizeMake(12, 12) - withMethod:MXThumbnailingMethodCrop - success:^(NSString *outputFilePath) { - // Refresh sender flair - MXStrongifyAndReturnIfNil(self); - [self renderSenderFlair]; - } - failure:nil]; - } - } - - index++; - if (index == 3) - { - if (bubbleData.senderFlair.count > 3) - { - NSAttributedString *more = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"+%tu", (bubbleData.senderFlair.count - 3)] attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:11.0], NSBaselineOffsetAttributeName:@(+2)}]; - [attributedString appendAttributedString:more]; - } - break; - } - } - } - - self.userNameLabel.attributedText = attributedString; -} - - (void)renderGif { if (self.attachmentView && bubbleData.attachment) @@ -1292,23 +1214,6 @@ - (void)onAttachmentLoaderStateChange:(NSNotification *)notif } } -- (void)onFlairDownloadStateChange:(NSNotification *)notif -{ - MXMediaLoader *loader = (MXMediaLoader*)notif.object; - switch (loader.state) { - case MXMediaLoaderStateDownloadCompleted: - [self renderSenderFlair]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXMediaLoaderStateDidChangeNotification object:loader]; - break; - case MXMediaLoaderStateDownloadFailed: - case MXMediaLoaderStateCancelled: - [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXMediaLoaderStateDidChangeNotification object:loader]; - break; - default: - break; - } -} - - (void)startProgressUI { self.progressView.hidden = YES; diff --git a/Riot/Modules/Room/TimelineCells/Styles/Plain/Cells/Sticker/RoomSelectedStickerBubbleCell.m b/Riot/Modules/Room/TimelineCells/Styles/Plain/Cells/Sticker/RoomSelectedStickerBubbleCell.m index cc0506fd23..110515638e 100644 --- a/Riot/Modules/Room/TimelineCells/Styles/Plain/Cells/Sticker/RoomSelectedStickerBubbleCell.m +++ b/Riot/Modules/Room/TimelineCells/Styles/Plain/Cells/Sticker/RoomSelectedStickerBubbleCell.m @@ -102,15 +102,7 @@ - (void)render:(MXKCellData *)cellData // Display sender's name except if the name appears in the displayed text (see emote and membership events) if (bubbleData.shouldHideSenderName == NO) { - if (bubbleData.senderFlair) - { - [self renderSenderFlair]; - } - else - { - self.userNameLabel.text = bubbleData.senderDisplayName; - } - + self.userNameLabel.text = bubbleData.senderDisplayName; self.userNameLabel.hidden = NO; self.userNameTapGestureMaskView.userInteractionEnabled = YES; } diff --git a/changelog.d/6523.api b/changelog.d/6523.api new file mode 100644 index 0000000000..b916a4263a --- /dev/null +++ b/changelog.d/6523.api @@ -0,0 +1 @@ +Communities: GroupsViewController etc have all been removed now that Spaces are available in the app. diff --git a/changelog.d/6523.change b/changelog.d/6523.change new file mode 100644 index 0000000000..e31ca639b3 --- /dev/null +++ b/changelog.d/6523.change @@ -0,0 +1 @@ +Groups: Support for groups has been removed now that Spaces are fully available.