mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-28 20:26:57 +02:00
Voip all
This commit is contained in:
+52
-19
@@ -26,6 +26,7 @@
|
||||
#import "DecryptionFailureTracker.h"
|
||||
|
||||
#import "EventFormatter+DTCoreTextFix.h"
|
||||
#import <MatrixSDK/MatrixSDK.h>
|
||||
|
||||
#pragma mark - Constants definitions
|
||||
|
||||
@@ -168,30 +169,55 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
|
||||
}
|
||||
}
|
||||
|
||||
if (event.eventType == MXEventTypeRoomCreate)
|
||||
switch (event.eventType)
|
||||
{
|
||||
MXRoomCreateContent *createContent = [MXRoomCreateContent modelFromJSON:event.content];
|
||||
|
||||
NSString *roomPredecessorId = createContent.roomPredecessorInfo.roomId;
|
||||
|
||||
if (roomPredecessorId)
|
||||
case MXEventTypeRoomCreate:
|
||||
{
|
||||
return [self roomCreatePredecessorAttributedStringWithPredecessorRoomId:roomPredecessorId];
|
||||
MXRoomCreateContent *createContent = [MXRoomCreateContent modelFromJSON:event.content];
|
||||
|
||||
NSString *roomPredecessorId = createContent.roomPredecessorInfo.roomId;
|
||||
|
||||
if (roomPredecessorId)
|
||||
{
|
||||
return [self roomCreatePredecessorAttributedStringWithPredecessorRoomId:roomPredecessorId];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSAttributedString *string = [super attributedStringFromEvent:event withRoomState:roomState error:error];
|
||||
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithString:@"· "];
|
||||
[result appendAttributedString:string];
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
case MXEventTypeCallCandidates:
|
||||
case MXEventTypeCallAnswer:
|
||||
case MXEventTypeCallSelectAnswer:
|
||||
case MXEventTypeCallHangup:
|
||||
case MXEventTypeCallNegotiate:
|
||||
case MXEventTypeCallReplaces:
|
||||
case MXEventTypeCallRejectReplacement:
|
||||
// Do not show call events except invite and reject in timeline
|
||||
return nil;
|
||||
case MXEventTypeCallInvite:
|
||||
{
|
||||
NSAttributedString *string = [super attributedStringFromEvent:event withRoomState:roomState error:error];
|
||||
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithString:@"· "];
|
||||
[result appendAttributedString:string];
|
||||
return result;
|
||||
MXCallInviteEventContent *content = [MXCallInviteEventContent modelFromJSON:event.content];
|
||||
MXCall *call = [mxSession.callManager callWithCallId:content.callId];
|
||||
if (call && call.isIncoming && call.state == MXCallStateRinging)
|
||||
{
|
||||
// incoming call UI will be handled by CallKit (or incoming call screen if CallKit disabled)
|
||||
// do not show a bubble for this case
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make event types MXEventTypeKeyVerificationCancel and MXEventTypeKeyVerificationDone visible in timeline.
|
||||
// TODO: Find another way to keep them visible and avoid instantiate empty NSMutableAttributedString.
|
||||
if (event.eventType == MXEventTypeKeyVerificationCancel || event.eventType == MXEventTypeKeyVerificationDone)
|
||||
{
|
||||
return [NSMutableAttributedString new];
|
||||
break;
|
||||
case MXEventTypeKeyVerificationCancel:
|
||||
case MXEventTypeKeyVerificationDone:
|
||||
// Make event types MXEventTypeKeyVerificationCancel and MXEventTypeKeyVerificationDone visible in timeline.
|
||||
// TODO: Find another way to keep them visible and avoid instantiate empty NSMutableAttributedString.
|
||||
return [NSMutableAttributedString new];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
NSAttributedString *attributedString = [super attributedStringFromEvent:event withRoomState:roomState error:error];
|
||||
@@ -265,6 +291,8 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
|
||||
{
|
||||
MXEvent *roomCreateEvent = [events filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"type == %@", kMXEventTypeStringRoomCreate]].firstObject;
|
||||
|
||||
MXEvent *callInviteEvent = [events filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"type == %@", kMXEventTypeStringCallInvite]].firstObject;
|
||||
|
||||
if (roomCreateEvent)
|
||||
{
|
||||
MXKEventFormatterError tmpError;
|
||||
@@ -287,6 +315,11 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
|
||||
[result appendAttributedString:linkMore];
|
||||
return result;
|
||||
}
|
||||
else if (callInviteEvent)
|
||||
{
|
||||
// return a non-nil value
|
||||
return [NSMutableAttributedString new];
|
||||
}
|
||||
else if (events[0].eventType == MXEventTypeRoomMember)
|
||||
{
|
||||
// This is a series for cells tagged with RoomBubbleCellDataTagMembership
|
||||
|
||||
Reference in New Issue
Block a user