mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Merge branch 'develop' into voip_design_updates
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
|
||||
#import "MXRoomSummary+Riot.h"
|
||||
|
||||
#import "TypingUserInfo.h"
|
||||
|
||||
@protocol RoomDataSourceDelegate;
|
||||
|
||||
/**
|
||||
@@ -48,6 +50,11 @@
|
||||
*/
|
||||
@property(nonatomic, readonly) RoomEncryptionTrustLevel encryptionTrustLevel;
|
||||
|
||||
/**
|
||||
List of members who are typing in the room.
|
||||
*/
|
||||
@property(nonatomic, nullable) NSArray<TypingUserInfo *> *currentTypingUsers;
|
||||
|
||||
/**
|
||||
Check if there is an active jitsi widget in the room and return it.
|
||||
|
||||
@@ -93,6 +100,8 @@
|
||||
success:(void(^)(void))success
|
||||
failure:(void(^)(NSError*))failure;
|
||||
|
||||
- (void)resetTypingNotification;
|
||||
|
||||
@end
|
||||
|
||||
@protocol RoomDataSourceDelegate <MXKDataSourceDelegate>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#import "MXRoom+Riot.h"
|
||||
|
||||
const CGFloat kTypingCellHeight = 24;
|
||||
|
||||
@interface RoomDataSource() <BubbleReactionsViewModelDelegate>
|
||||
{
|
||||
@@ -53,6 +54,8 @@
|
||||
|
||||
@property (nonatomic) BOOL showRoomCreationCell;
|
||||
|
||||
@property (nonatomic) NSInteger typingCellIndex;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomDataSource
|
||||
@@ -185,6 +188,16 @@
|
||||
[self setNeedsUpdateAdditionalContentHeightForCellData:cellData];
|
||||
}
|
||||
|
||||
- (CGFloat)cellHeightAtIndex:(NSInteger)index withMaximumWidth:(CGFloat)maxWidth
|
||||
{
|
||||
if (index == self.typingCellIndex)
|
||||
{
|
||||
return kTypingCellHeight;
|
||||
}
|
||||
|
||||
return [super cellHeightAtIndex:index withMaximumWidth:maxWidth];
|
||||
}
|
||||
|
||||
- (void)setNeedsUpdateAdditionalContentHeightForCellData:(id<MXKRoomBubbleCellDataStoring>)cellData
|
||||
{
|
||||
RoomBubbleCellData *roomBubbleCellData;
|
||||
@@ -261,16 +274,40 @@
|
||||
[self updateStatusInfo];
|
||||
}
|
||||
|
||||
// we may have changed the number of bubbles in this block, consider that change
|
||||
return bubbles.count;
|
||||
if (!self.currentTypingUsers)
|
||||
{
|
||||
self.typingCellIndex = -1;
|
||||
|
||||
// we may have changed the number of bubbles in this block, consider that change
|
||||
return bubbles.count;
|
||||
}
|
||||
|
||||
self.typingCellIndex = bubbles.count;
|
||||
return bubbles.count + 1;
|
||||
}
|
||||
|
||||
// leave it as is, if coming as 0 from super
|
||||
return count;
|
||||
if (!self.currentTypingUsers)
|
||||
{
|
||||
self.typingCellIndex = -1;
|
||||
|
||||
// leave it as is, if coming as 0 from super
|
||||
return count;
|
||||
}
|
||||
|
||||
self.typingCellIndex = count;
|
||||
return count + 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.row == self.typingCellIndex)
|
||||
{
|
||||
RoomTypingBubbleCell *cell = [tableView dequeueReusableCellWithIdentifier:RoomTypingBubbleCell.defaultReuseIdentifier forIndexPath:indexPath];
|
||||
[cell updateWithTheme:ThemeService.shared.theme];
|
||||
[cell updateTypingUsers:_currentTypingUsers mediaManager:self.mxSession.mediaManager];
|
||||
return cell;
|
||||
}
|
||||
|
||||
// Do cell data customization that needs to be done before [MXKRoomBubbleTableViewCell render]
|
||||
RoomBubbleCellData *roomBubbleCellData = [self cellDataAtIndex:indexPath.row];
|
||||
|
||||
@@ -917,6 +954,10 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)resetTypingNotification {
|
||||
self.currentTypingUsers = nil;
|
||||
}
|
||||
|
||||
#pragma - Accessibility
|
||||
|
||||
- (void)setupAccessibilityForCell:(MXKRoomBubbleTableViewCell *)cell withCellData:(RoomBubbleCellData*)cellData
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MatrixSDK/MatrixSDK.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TypingUserInfo : NSObject
|
||||
|
||||
@property (nonatomic, strong) NSString *userId;
|
||||
@property (nonatomic, strong, nullable) NSString *displayName;
|
||||
@property (nonatomic, strong, nullable) NSString *avatarUrl;
|
||||
|
||||
- (instancetype) initWithMember:(MXRoomMember*)member;
|
||||
|
||||
- (instancetype) initWithUserId:(NSString*)userId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "TypingUserInfo.h"
|
||||
|
||||
@implementation TypingUserInfo
|
||||
|
||||
- (instancetype) initWithMember:(MXRoomMember*)member
|
||||
{
|
||||
self = [self initWithUserId:member.userId];
|
||||
|
||||
if (self)
|
||||
{
|
||||
self.displayName = member.displayname;
|
||||
self.avatarUrl = member.avatarUrl;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithUserId:(NSString*)userId
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
self.userId = userId;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user