Skip to content
Open
3 changes: 0 additions & 3 deletions Config/CommonConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ class CommonConfiguration: NSObject, Configurable {
// Disable key backup on common
sdkOptions.enableKeyBackupWhenStartingMXCrypto = false

// Pass threading option to the SDK
sdkOptions.enableThreads = RiotSettings.shared.enableThreads

sdkOptions.clientPermalinkBaseUrl = BuildSettings.clientPermalinkBaseUrl

sdkOptions.authEnableRefreshTokens = BuildSettings.authEnableRefreshTokens
Expand Down
1 change: 0 additions & 1 deletion Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ Tap the + to start adding people.";
"settings_labs_message_reaction" = "React to messages with emoji";
"settings_labs_enable_ringing_for_group_calls" = "Ring for group calls";
"settings_labs_enabled_polls" = "Polls";
"settings_labs_enable_threads" = "Threaded messaging";
"settings_labs_use_only_latest_user_avatar_and_name" = "Show latest avatar and name for users in message history";

"settings_version" = "Version %@";
Expand Down
4 changes: 0 additions & 4 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6671,10 +6671,6 @@ public class VectorL10n: NSObject {
public static var settingsLabsEnableRingingForGroupCalls: String {
return VectorL10n.tr("Vector", "settings_labs_enable_ringing_for_group_calls")
}
/// Threaded messaging
public static var settingsLabsEnableThreads: String {
return VectorL10n.tr("Vector", "settings_labs_enable_threads")
}
/// Polls
public static var settingsLabsEnabledPolls: String {
return VectorL10n.tr("Vector", "settings_labs_enabled_polls")
Expand Down
2 changes: 1 addition & 1 deletion Riot/Managers/PushNotification/PushNotificationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ - (void)handleNotificationInlineReplyForRoomId:(NSString*)roomId
// initialize data source for a thread or a room
__block MXKRoomDataSource *dataSource;
dispatch_group_t dispatchGroupDataSource = dispatch_group_create();
if (RiotSettings.shared.enableThreads && threadId)
if (threadId)
{
dispatch_group_enter(dispatchGroupDataSource);
[ThreadDataSource loadRoomDataSourceWithRoomId:roomId
Expand Down
4 changes: 0 additions & 4 deletions Riot/Managers/Settings/RiotSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ final class RiotSettings: NSObject {
@UserDefault(key: "enableRingingForGroupCalls", defaultValue: false, storage: defaults)
var enableRingingForGroupCalls

/// Indicates if threads enabled in the timeline.
@UserDefault(key: "enableThreads", defaultValue: false, storage: defaults)
var enableThreads

// MARK: Calls

/// Indicate if `allowStunServerFallback` settings has been set once.
Expand Down
21 changes: 9 additions & 12 deletions Riot/Modules/Application/LegacyAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1415,18 +1415,15 @@ - (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)universalLin
}

ThreadParameters *threadParameters = nil;
if (RiotSettings.shared.enableThreads)
if (event.threadId)
{
if (event.threadId)
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([account.mxSession.threadingService threadWithId:eventId])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:eventId
stackRoomScreen:NO];
}
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if ([account.mxSession.threadingService threadWithId:eventId])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:eventId
stackRoomScreen:NO];
}

RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId
Expand Down Expand Up @@ -3011,7 +3008,7 @@ - (void)showRoom:(NSString*)roomId threadId:(NSString*)threadId andEventId:(NSSt
ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES];

ThreadParameters *threadParameters = nil;
if (RiotSettings.shared.enableThreads && threadId)
if (threadId)
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:threadId stackRoomScreen:NO];
}
Expand Down
19 changes: 8 additions & 11 deletions Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,15 @@ - (void)showRoomWithId:(NSString*)roomId
inMatrixSession:(MXSession*)session
{
ThreadParameters *threadParameters = nil;
if (RiotSettings.shared.enableThreads)
if (event.threadId)
{
if (event.threadId)
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
}
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
}

ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,27 @@ - (void)convertHomeserverResultsIntoCells:(MXSearchRoomEventResults *)roomEventR
dispatch_group_leave(group);
};

if (RiotSettings.shared.enableThreads)
if (result.result.isInThread)
{
if (result.result.isInThread)
{
continueBlock();
}
else if (result.result.unsignedData.relations.thread)
{
continueBlock();
}
else if (room)
{
[room liveTimeline:^(id<MXEventTimeline> liveTimeline) {
[liveTimeline paginate:NSUIntegerMax
direction:MXTimelineDirectionBackwards
onlyFromStore:YES
complete:^{
[liveTimeline resetPagination];
continueBlock();
} failure:^(NSError * _Nonnull error) {
continueBlock();
}];
continueBlock();
}
else if (result.result.unsignedData.relations.thread)
{
continueBlock();
}
else if (room)
{
[room liveTimeline:^(id<MXEventTimeline> liveTimeline) {
[liveTimeline paginate:NSUIntegerMax
direction:MXTimelineDirectionBackwards
onlyFromStore:YES
complete:^{
[liveTimeline resetPagination];
continueBlock();
} failure:^(NSError * _Nonnull error) {
continueBlock();
}];
}
else
{
continueBlock();
}
}];
}
else
{
Expand Down Expand Up @@ -159,63 +152,60 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
// Display date for each message
[bubbleCell addDateLabel];

if (RiotSettings.shared.enableThreads)
{
RoomBubbleCellData *cellData = (RoomBubbleCellData*)[self cellDataAtIndex:indexPath.row];
MXEvent *event = cellData.events.firstObject;
RoomBubbleCellData *cellData = (RoomBubbleCellData*)[self cellDataAtIndex:indexPath.row];
MXEvent *event = cellData.events.firstObject;

if (event)
if (event)
{
if (cellData.hasThreadRoot)
{
if (cellData.hasThreadRoot)
{
id<MXThreadProtocol> thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread
session:self.mxSession];
[bubbleCell.tmpSubviews addObject:threadSummaryView];

threadSummaryView.translatesAutoresizingMaskIntoConstraints = NO;
[bubbleCell.contentView addSubview:threadSummaryView];

CGFloat leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin;
CGFloat height = [ThreadSummaryView contentViewHeightForThread:thread fitting:cellData.maxTextViewWidth];

CGRect bubbleComponentFrame = [bubbleCell componentFrameInContentViewForIndex:0];
CGFloat bottomPositionY = bubbleComponentFrame.origin.y + bubbleComponentFrame.size.height;

// Set constraints for the summary view
[NSLayoutConstraint activateConstraints: @[
[threadSummaryView.leadingAnchor constraintEqualToAnchor:threadSummaryView.superview.leadingAnchor
constant:leftMargin],
[threadSummaryView.topAnchor constraintEqualToAnchor:threadSummaryView.superview.topAnchor
constant:bottomPositionY + PlainRoomCellLayoutConstants.threadSummaryViewTopMargin],
[threadSummaryView.heightAnchor constraintEqualToConstant:height],
[threadSummaryView.trailingAnchor constraintLessThanOrEqualToAnchor:threadSummaryView.superview.trailingAnchor constant:-PlainRoomCellLayoutConstants.reactionsViewRightMargin]
]];
}
else if (event.isInThread)
{
FromAThreadView *fromAThreadView = [FromAThreadView instantiate];
[bubbleCell.tmpSubviews addObject:fromAThreadView];

fromAThreadView.translatesAutoresizingMaskIntoConstraints = NO;
[bubbleCell.contentView addSubview:fromAThreadView];

CGFloat leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin;
CGFloat height = [FromAThreadView contentViewHeightForEvent:event fitting:cellData.maxTextViewWidth];

CGRect bubbleComponentFrame = [bubbleCell componentFrameInContentViewForIndex:0];
CGFloat bottomPositionY = bubbleComponentFrame.origin.y + bubbleComponentFrame.size.height;

// Set constraints for the summary view
[NSLayoutConstraint activateConstraints: @[
[fromAThreadView.leadingAnchor constraintEqualToAnchor:fromAThreadView.superview.leadingAnchor
constant:leftMargin],
[fromAThreadView.topAnchor constraintEqualToAnchor:fromAThreadView.superview.topAnchor
constant:bottomPositionY + PlainRoomCellLayoutConstants.fromAThreadViewTopMargin],
[fromAThreadView.heightAnchor constraintEqualToConstant:height],
[fromAThreadView.trailingAnchor constraintLessThanOrEqualToAnchor:fromAThreadView.superview.trailingAnchor constant:-PlainRoomCellLayoutConstants.reactionsViewRightMargin]
]];
}
id<MXThreadProtocol> thread = cellData.bubbleComponents.firstObject.thread;
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread
session:self.mxSession];
[bubbleCell.tmpSubviews addObject:threadSummaryView];

threadSummaryView.translatesAutoresizingMaskIntoConstraints = NO;
[bubbleCell.contentView addSubview:threadSummaryView];

CGFloat leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin;
CGFloat height = [ThreadSummaryView contentViewHeightForThread:thread fitting:cellData.maxTextViewWidth];

CGRect bubbleComponentFrame = [bubbleCell componentFrameInContentViewForIndex:0];
CGFloat bottomPositionY = bubbleComponentFrame.origin.y + bubbleComponentFrame.size.height;

// Set constraints for the summary view
[NSLayoutConstraint activateConstraints: @[
[threadSummaryView.leadingAnchor constraintEqualToAnchor:threadSummaryView.superview.leadingAnchor
constant:leftMargin],
[threadSummaryView.topAnchor constraintEqualToAnchor:threadSummaryView.superview.topAnchor
constant:bottomPositionY + PlainRoomCellLayoutConstants.threadSummaryViewTopMargin],
[threadSummaryView.heightAnchor constraintEqualToConstant:height],
[threadSummaryView.trailingAnchor constraintLessThanOrEqualToAnchor:threadSummaryView.superview.trailingAnchor constant:-PlainRoomCellLayoutConstants.reactionsViewRightMargin]
]];
}
else if (event.isInThread)
{
FromAThreadView *fromAThreadView = [FromAThreadView instantiate];
[bubbleCell.tmpSubviews addObject:fromAThreadView];

fromAThreadView.translatesAutoresizingMaskIntoConstraints = NO;
[bubbleCell.contentView addSubview:fromAThreadView];

CGFloat leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin;
CGFloat height = [FromAThreadView contentViewHeightForEvent:event fitting:cellData.maxTextViewWidth];

CGRect bubbleComponentFrame = [bubbleCell componentFrameInContentViewForIndex:0];
CGFloat bottomPositionY = bubbleComponentFrame.origin.y + bubbleComponentFrame.size.height;

// Set constraints for the summary view
[NSLayoutConstraint activateConstraints: @[
[fromAThreadView.leadingAnchor constraintEqualToAnchor:fromAThreadView.superview.leadingAnchor
constant:leftMargin],
[fromAThreadView.topAnchor constraintEqualToAnchor:fromAThreadView.superview.topAnchor
constant:bottomPositionY + PlainRoomCellLayoutConstants.fromAThreadViewTopMargin],
[fromAThreadView.heightAnchor constraintEqualToConstant:height],
[fromAThreadView.trailingAnchor constraintLessThanOrEqualToAnchor:fromAThreadView.superview.trailingAnchor constant:-PlainRoomCellLayoutConstants.reactionsViewRightMargin]
]];
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,15 @@ - (void)showRoomWithId:(NSString*)roomId
inMatrixSession:(MXSession*)session
{
ThreadParameters *threadParameters = nil;
if (RiotSettings.shared.enableThreads)
if (event.threadId)
{
if (event.threadId)
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
}
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.threadId
stackRoomScreen:NO];
}
else if (event.unsignedData.relations.thread || [self.mainSession.threadingService isEventThreadRoot:event])
{
threadParameters = [[ThreadParameters alloc] initWithThreadId:event.eventId
stackRoomScreen:NO];
}

ScreenPresentationParameters *screenParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO];
Expand Down
Loading