mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 19:34:25 +02:00
Use thread protocols where possible
This commit is contained in:
@@ -130,6 +130,6 @@
|
||||
@param roomDataSource room data source instance
|
||||
*/
|
||||
- (void)roomDataSource:(RoomDataSource * _Nonnull)roomDataSource
|
||||
didTapThread:(MXThread * _Nonnull)thread;
|
||||
didTapThread:(id<MXThreadProtocol> _Nonnull)thread;
|
||||
|
||||
@end
|
||||
|
||||
@@ -466,7 +466,8 @@ const CGFloat kTypingCellHeight = 24;
|
||||
// display thread summary view if the component has a thread in the room timeline
|
||||
if (RiotSettings.shared.enableThreads && component.thread && !self.threadId)
|
||||
{
|
||||
threadSummaryView = [[ThreadSummaryView alloc] initWithThread:component.thread];
|
||||
threadSummaryView = [[ThreadSummaryView alloc] initWithThread:component.thread
|
||||
session:self.mxSession];
|
||||
threadSummaryView.delegate = self;
|
||||
threadSummaryView.tag = index;
|
||||
|
||||
|
||||
@@ -4283,7 +4283,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
[self updateTitleViewEncryptionDecoration];
|
||||
}
|
||||
|
||||
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(MXThread *)thread
|
||||
- (void)roomDataSource:(RoomDataSource *)roomDataSource didTapThread:(id<MXThreadProtocol>)thread
|
||||
{
|
||||
[self openThreadWithId:thread.id];
|
||||
}
|
||||
|
||||
@@ -143,8 +143,9 @@
|
||||
{
|
||||
if (cellData.hasThreadRoot)
|
||||
{
|
||||
MXThread *thread = cellData.bubbleComponents.firstObject.thread;
|
||||
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread];
|
||||
id<MXThreadProtocol> thread = cellData.bubbleComponents.firstObject.thread;
|
||||
ThreadSummaryView *threadSummaryView = [[ThreadSummaryView alloc] initWithThread:thread
|
||||
session:self.mxSession];
|
||||
[bubbleCell.tmpSubviews addObject:threadSummaryView];
|
||||
|
||||
threadSummaryView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
@@ -38,7 +38,8 @@ class ThreadSummaryView: UIView {
|
||||
@IBOutlet private weak var lastMessageContentLabel: UILabel!
|
||||
|
||||
private var theme: Theme = ThemeService.shared().theme
|
||||
private(set) var thread: MXThread?
|
||||
private(set) var thread: MXThreadProtocol?
|
||||
private weak var session: MXSession?
|
||||
|
||||
private lazy var tapGestureRecognizer: UITapGestureRecognizer = {
|
||||
return UITapGestureRecognizer(target: self, action: #selector(tapped(_:)))
|
||||
@@ -48,8 +49,9 @@ class ThreadSummaryView: UIView {
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(withThread thread: MXThread) {
|
||||
init(withThread thread: MXThreadProtocol, session: MXSession) {
|
||||
self.thread = thread
|
||||
self.session = session
|
||||
super.init(frame: CGRect(origin: .zero,
|
||||
size: CGSize(width: Constants.viewDefaultWidth,
|
||||
height: RoomBubbleCellLayout.threadSummaryViewHeight)))
|
||||
@@ -59,7 +61,7 @@ class ThreadSummaryView: UIView {
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
static func contentViewHeight(forThread thread: MXThread?, fitting maxWidth: CGFloat) -> CGFloat {
|
||||
static func contentViewHeight(forThread thread: MXThreadProtocol?, fitting maxWidth: CGFloat) -> CGFloat {
|
||||
return RoomBubbleCellLayout.threadSummaryViewHeight
|
||||
}
|
||||
|
||||
@@ -93,7 +95,7 @@ class ThreadSummaryView: UIView {
|
||||
|
||||
guard let thread = thread,
|
||||
let lastMessage = thread.lastMessage,
|
||||
let session = thread.session,
|
||||
let session = session,
|
||||
let eventFormatter = session.roomSummaryUpdateDelegate as? MXKEventFormatter,
|
||||
let room = session.room(withRoomId: lastMessage.roomId) else {
|
||||
lastMessageAvatarView.avatarImageView.image = nil
|
||||
|
||||
Reference in New Issue
Block a user