mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-28 04:06:57 +02:00
MESSENGER-2762 Initial Merge
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Copyright 2014 OpenMarket Ltd
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
Copyright 2018 New Vector Ltd
|
||||
Copyright (c) 2021 BWI GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -75,6 +76,8 @@
|
||||
|
||||
#import "EventFormatter.h"
|
||||
|
||||
#import "RoomViewController+ContentScanner.h"
|
||||
|
||||
#import "SettingsViewController.h"
|
||||
#import "SecurityViewController.h"
|
||||
|
||||
@@ -332,8 +335,24 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
// Register first customized cell view classes used to render bubbles
|
||||
[[RoomTimelineConfiguration shared].currentStyle.cellProvider registerCellsForTableView:self.bubblesTableView];
|
||||
|
||||
[self.bubblesTableView registerClass:PollBubbleCell.class forCellReuseIdentifier:PollBubbleCell.defaultReuseIdentifier];
|
||||
[self.bubblesTableView registerClass:PollWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:PollWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
|
||||
[self.bubblesTableView registerClass:PollWithPaginationTitleBubbleCell.class forCellReuseIdentifier:PollWithPaginationTitleBubbleCell.defaultReuseIdentifier];
|
||||
|
||||
#ifdef LOCATION
|
||||
[self.bubblesTableView registerClass:LocationBubbleCell.class forCellReuseIdentifier:LocationBubbleCell.defaultReuseIdentifier];
|
||||
[self.bubblesTableView registerClass:LocationWithoutSenderInfoBubbleCell.class forCellReuseIdentifier:LocationWithoutSenderInfoBubbleCell.defaultReuseIdentifier];
|
||||
[self.bubblesTableView registerClass:LocationWithPaginationTitleBubbleCell.class forCellReuseIdentifier:LocationWithPaginationTitleBubbleCell.defaultReuseIdentifier];
|
||||
#endif
|
||||
|
||||
[self vc_removeBackTitle];
|
||||
|
||||
if (BuildSettings.enableAntivirusScan)
|
||||
{
|
||||
// Register antivirus scan cells
|
||||
[self registerContentScannerCells];
|
||||
}
|
||||
|
||||
// Display leftBarButtonItems or leftBarButtonItem to the right of the Back button
|
||||
self.navigationItem.leftItemsSupplementBackButton = YES;
|
||||
|
||||
@@ -1124,7 +1143,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
[super setRoomInputToolbarViewClass:roomInputToolbarViewClass];
|
||||
|
||||
// The voice message toolbar cannot be set on DisabledInputToolbarView.
|
||||
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class])
|
||||
if ([self.inputToolbarView isKindOfClass:RoomInputToolbarView.class] && BuildSettings.bwiEnableVoiceMessages)
|
||||
{
|
||||
[(RoomInputToolbarView *)self.inputToolbarView setVoiceMessageToolbarView:self.voiceMessageController.voiceMessageToolbarView];
|
||||
}
|
||||
@@ -1254,27 +1273,43 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
|
||||
- (void)sendTextMessage:(NSString*)msgTxt
|
||||
{
|
||||
PerformanceProfile *sendTextMessageProfile = [[PerformanceProfile alloc] initWithThreshold:BuildSettings.bwiSendMessageThreshold];
|
||||
[sendTextMessageProfile startMeasurement];
|
||||
|
||||
if (self.inputToolBarSendMode == RoomInputToolbarViewSendModeReply && customizedRoomDataSource.selectedEventId)
|
||||
{
|
||||
[self.roomDataSource sendReplyToEventWithId:customizedRoomDataSource.selectedEventId withTextMessage:msgTxt success:nil failure:^(NSError *error) {
|
||||
[self.roomDataSource sendReplyToEventWithId:customizedRoomDataSource.selectedEventId withTextMessage:msgTxt success:^(NSString *string)
|
||||
{
|
||||
[self finishTextMessageProfil:sendTextMessageProfile];
|
||||
} failure:^(NSError *error) {
|
||||
// Just log the error. The message will be displayed in red in the room history
|
||||
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
|
||||
[sendTextMessageProfile abortMeasurement];
|
||||
}];
|
||||
}
|
||||
else if (self.inputToolBarSendMode == RoomInputToolbarViewSendModeEdit && customizedRoomDataSource.selectedEventId)
|
||||
{
|
||||
[self.roomDataSource replaceTextMessageForEventWithId:customizedRoomDataSource.selectedEventId withTextMessage:msgTxt success:nil failure:^(NSError *error) {
|
||||
[self.roomDataSource replaceTextMessageForEventWithId:customizedRoomDataSource.selectedEventId withTextMessage:msgTxt success:^(NSString *string)
|
||||
{
|
||||
[self finishTextMessageProfil:sendTextMessageProfile];
|
||||
} failure:^(NSError *error) {
|
||||
// Just log the error. The message will be displayed in red
|
||||
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
|
||||
[sendTextMessageProfile abortMeasurement];
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let the datasource send it and manage the local echo
|
||||
[self.roomDataSource sendTextMessage:msgTxt success:nil failure:^(NSError *error)
|
||||
[self.roomDataSource sendTextMessage:msgTxt success:^(NSString *string)
|
||||
{
|
||||
[self finishTextMessageProfil:sendTextMessageProfile];
|
||||
}
|
||||
failure:^(NSError *error)
|
||||
{
|
||||
// Just log the error. The message will be displayed in red in the room history
|
||||
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
|
||||
[sendTextMessageProfile abortMeasurement];
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -2248,7 +2283,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
|
||||
- (ScreenPresentationParameters*)buildUniversalLinkPresentationParameters
|
||||
{
|
||||
return [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil];
|
||||
return [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BwiBuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil];
|
||||
}
|
||||
|
||||
- (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL
|
||||
@@ -2640,7 +2675,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
}
|
||||
|
||||
BOOL showEncryptionBadge = NO;
|
||||
RoomTimelineCellIdentifier cellIdentifier;
|
||||
RoomTimelineCellIdentifier cellIdentifier = RoomTimelineCellIdentifierEmpty;
|
||||
|
||||
id<MXKRoomBubbleCellDataStoring> bubbleData = (id<MXKRoomBubbleCellDataStoring>)cellData;
|
||||
|
||||
@@ -2653,6 +2688,16 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
}
|
||||
|
||||
// Select the suitable table view cell class, by considering first the empty bubble cell.
|
||||
if (BuildSettings.enableAntivirusScan && bubbleData.showAntivirusScanStatus)
|
||||
{
|
||||
// FRANK181
|
||||
cellIdentifier = [self contentScannerClassForBubbleCellData:roomBubbleCellData];
|
||||
}
|
||||
|
||||
if (cellIdentifier == ContentScannerIdentiferStatus || cellIdentifier == ContentScannerIdentifierThumbnail) {
|
||||
return cellIdentifier;
|
||||
}
|
||||
|
||||
if (bubbleData.hasNoDisplay)
|
||||
{
|
||||
cellIdentifier = RoomTimelineCellIdentifierEmpty;
|
||||
@@ -2780,6 +2825,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef LOCATION
|
||||
else if (bubbleData.tag == RoomBubbleCellDataTagLocation)
|
||||
{
|
||||
if (bubbleData.isIncoming)
|
||||
@@ -2813,6 +2859,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (roomBubbleCellData.getFirstBubbleComponentWithDisplay.event.isEmote)
|
||||
{
|
||||
if (bubbleData.isIncoming)
|
||||
@@ -3929,7 +3976,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
}]];
|
||||
}
|
||||
|
||||
if (!isJitsiCallEvent && self.roomDataSource.room.summary.isEncrypted)
|
||||
if (!isJitsiCallEvent && self.roomDataSource.room.summary.isEncrypted && RiotSettings.shared.roomContextualMenuShowEncryptionOption)
|
||||
{
|
||||
[self.eventMenuBuilder addItemWithType:EventMenuItemTypeViewEncryption
|
||||
action:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionViewEncryption]
|
||||
@@ -6479,6 +6526,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
MXKRoomBubbleTableViewCell *roomBubbleTableViewCell = (MXKRoomBubbleTableViewCell *)cell;
|
||||
MXKAttachment *attachment = roomBubbleTableViewCell.bubbleData.attachment;
|
||||
|
||||
|
||||
BOOL result = (event.eventType != MXEventTypePollStart && (!attachment || attachment.type != MXKAttachmentTypeSticker));
|
||||
|
||||
if (attachment && !BuildSettings.messageDetailsAllowCopyMedia)
|
||||
@@ -6771,6 +6819,8 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
{
|
||||
MXWeakify(self);
|
||||
|
||||
[self bwiAddedEmoji:reaction];
|
||||
|
||||
[self hideContextualMenuAnimated:YES completion:^{
|
||||
|
||||
[self.roomDataSource addReaction:reaction forEventId:eventId success:^{
|
||||
@@ -6904,6 +6954,8 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
{
|
||||
MXWeakify(self);
|
||||
|
||||
[self bwiAddedEmoji:emoji];
|
||||
|
||||
[coordinatorBridgePresenter dismissWithAnimated:YES completion:^{
|
||||
[self.roomDataSource addReaction:emoji forEventId:eventId success:^{
|
||||
|
||||
@@ -7139,6 +7191,31 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
||||
[[LegacyAppDelegate theDelegate] openSpaceWithId:spaceId];
|
||||
}
|
||||
|
||||
#pragma mark - Bwi Measurements
|
||||
|
||||
- (void) finishTextMessageProfil:(PerformanceProfile*)profile {
|
||||
[profile stopMeasurement];
|
||||
if( [profile isLogable] ) {
|
||||
[self.roomDataSource.room members:^(MXRoomMembers *roomMembers) {
|
||||
NSUInteger noOfUsers = roomMembers.joinedMembers.count;
|
||||
NSUInteger noOfDevices = 0;
|
||||
for (MXRoomMember* member in roomMembers.joinedMembers) {
|
||||
noOfDevices += [self.mainSession.crypto devicesForUser:member.userId].count;
|
||||
}
|
||||
[profile log2AnalyticsWithUsers:noOfUsers devices:noOfDevices];
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - BWI Emoji History
|
||||
|
||||
- (void) bwiAddedEmoji:(NSString*)emoji {
|
||||
RecentReactionHistoryDefaultService* service = [[RecentReactionHistoryDefaultService alloc] init];
|
||||
[service addReactionWithReaction:emoji];
|
||||
}
|
||||
|
||||
#pragma mark - UserSuggestionCoordinatorBridgeDelegate
|
||||
|
||||
- (void)userSuggestionCoordinatorBridge:(UserSuggestionCoordinatorBridge *)coordinator
|
||||
|
||||
Reference in New Issue
Block a user