Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement call list #1307

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MatrixSDK/Data/MXRoomSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ FOUNDATION_EXPORT NSUInteger const MXRoomSummaryPaginationChunkSize;
*/
@property (nonatomic) BOOL isConferenceUserRoom;

/**
Flag indicating if the room is a sip soom with at least one sip participant.
*/
@property (nonatomic) BOOL isSipCallRoom;

/**
Indicate whether this room should be hidden from the user.
*/
Expand Down
8 changes: 7 additions & 1 deletion MatrixSDK/Data/MXRoomSummary.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ - (void)updateWith:(id<MXRoomSummaryProtocol>)summary
_membershipTransitionState = summary.membershipTransitionState;
_membersCount = summary.membersCount;
_isConferenceUserRoom = summary.isConferenceUserRoom;
_isSipCallRoom = summary.isSipCallRoom;
_hiddenFromUser = summary.hiddenFromUser;
_storedHash = summary.storedHash;
_lastMessage = summary.lastMessage;
Expand Down Expand Up @@ -948,6 +949,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder
_membershipTransitionState = [MXRoomSummary membershipTransitionStateForMembership:_membership];
_membersCount = [aDecoder decodeObjectForKey:@"membersCount"];
_isConferenceUserRoom = [(NSNumber*)[aDecoder decodeObjectForKey:@"isConferenceUserRoom"] boolValue];
_isSipCallRoom = [(NSNumber*)[aDecoder decodeObjectForKey:@"isSipCallRoom"] boolValue];

_others = [aDecoder decodeObjectForKey:@"others"];
_isEncrypted = [aDecoder decodeBoolForKey:@"isEncrypted"];
Expand Down Expand Up @@ -995,6 +997,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
[aCoder encodeInteger:(NSInteger)_membership forKey:@"membership"];
[aCoder encodeObject:_membersCount forKey:@"membersCount"];
[aCoder encodeObject:@(_isConferenceUserRoom) forKey:@"isConferenceUserRoom"];
[aCoder encodeObject:@(_isSipCallRoom) forKey:@"isSipCallRoom"];

[aCoder encodeObject:_others forKey:@"others"];
[aCoder encodeBool:_isEncrypted forKey:@"isEncrypted"];
Expand Down Expand Up @@ -1098,7 +1101,10 @@ - (MXRoomSummaryDataTypes)calculateDataTypes
{
result |= MXRoomSummaryDataTypesConferenceUser;
}

if (self.isSipCallRoom)
{
result |= MXRoomSummaryDataTypesSipCall;
}
return result;
}

Expand Down
3 changes: 2 additions & 1 deletion MatrixSDK/Data/MXRoomSummaryDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ typedef NS_OPTIONS(NSInteger, MXRoomSummaryDataTypes)
MXRoomSummaryDataTypesServerNotice = 1 << 4,
MXRoomSummaryDataTypesHidden = 1 << 5,
MXRoomSummaryDataTypesSpace = 1 << 6,
MXRoomSummaryDataTypesConferenceUser = 1 << 7
MXRoomSummaryDataTypesConferenceUser = 1 << 7,
MXRoomSummaryDataTypesSipCall = 1 << 8
};

#endif /* MXRoomSummaryDataTypes_h */
3 changes: 3 additions & 0 deletions MatrixSDK/Data/MXRoomSummaryProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ NS_ASSUME_NONNULL_BEGIN
/// displayed to the end user.
@property (nonatomic, readonly) BOOL isConferenceUserRoom;

/// Flag indicating if the room is a sip soom with at least one sip participant.
@property (nonatomic, readonly) BOOL isSipCallRoom;

/// Indicate whether this room should be hidden from the user.
@property (nonatomic, readonly) BOOL hiddenFromUser;

Expand Down
20 changes: 20 additions & 0 deletions MatrixSDK/Data/MXRoomSummaryUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary
summary.isConferenceUserRoom = roomState.isConferenceUserRoom;
updated = YES;
}

BOOL isSipCallRoom = [self shouldListAsSipCallRoom:roomState];
if (summary.isSipCallRoom != isSipCallRoom)
{
summary.isSipCallRoom = isSipCallRoom;
updated = YES;
}
}

if (summary.membership == MXMembershipInvite)
Expand Down Expand Up @@ -714,6 +721,19 @@ - (BOOL)updateSummaryMemberCount:(MXRoomSummary *)summary session:(MXSession *)s
return otherMembers;
}

- (BOOL)shouldListAsSipCallRoom:(MXRoomState*)roomState
{
for (MXRoomMember *member in roomState.members.members)
{
if ([member.userId hasPrefix:@"@_sip_sip="])
{
return YES;
}
}

return NO;
}

- (BOOL)shouldHideRoomWithRoomTypeString:(NSString*)roomTypeString
{
BOOL hiddenFromUser = NO;
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1396.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for bridged users and rooms with bridged users.