Skip to content

Commit

Permalink
BF: MXPeekingRoom: the room preview is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Jan 3, 2019
1 parent 8a61f29 commit 90ca7b2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Improvements:

Bug Fix:
* MXCryptoStore: Stop duplicating devices in the store (vector-im/riot-ios/issues/2132).
* MXPeekingRoom: the room preview is broken (vector-im/riot-ios/issues/2126).

Changes in Matrix iOS SDK in 0.12.0 (2018-12-06)
===============================================
Expand Down
3 changes: 2 additions & 1 deletion MatrixSDK/Data/MXEventTimeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ - (MXHTTPOperation *)paginate:(NSUInteger)numItems direction:(MXTimelineDirectio
NSLog(@"[MXEventTimeline] paginate : got %tu messages from the server", paginatedResponse.chunk.count);

// Check if the room has not been left while waiting for the response
if ([self->room.mxSession hasRoomWithRoomId:self->room.roomId])
if ([self->room.mxSession hasRoomWithRoomId:self->room.roomId]
|| [self->room.mxSession isPeekingInRoomWithRoomId:self->room.roomId])
{
[self handlePaginationResponse:paginatedResponse direction:direction];
}
Expand Down
18 changes: 18 additions & 0 deletions MatrixSDK/MXSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,24 @@ typedef void (^MXOnBackgroundSyncFail)(NSError *error);
*/
- (void)stopPeeking:(MXPeekingRoom*)peekingRoom;

/**
Check if there is a peeking in progress in a room.
@param roomId The id of the room.
@return YES if there is.
*/
- (BOOL)isPeekingInRoomWithRoomId:(NSString*)roomId;

/**
Get the `MXPeekingRoom` object to a room if any.
@param roomId The id of the room.
@return the MXPeekingRoom instance.
*/
- (MXPeekingRoom *)peekingRoomWithRoomId:(NSString*)roomId;


#pragma mark - Matrix users
/**
Expand Down
18 changes: 18 additions & 0 deletions MatrixSDK/MXSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,24 @@ - (void)stopPeeking:(MXPeekingRoom*)peekingRoom
[peekingRoom close];
}

- (BOOL)isPeekingInRoomWithRoomId:(NSString *)roomId
{
return ([self peekingRoomWithRoomId:roomId] != nil);
}

- (MXPeekingRoom *)peekingRoomWithRoomId:(NSString *)roomId
{
for (MXPeekingRoom *peekingRoom in peekingRooms)
{
if ([peekingRoom.roomId isEqualToString:roomId])
{
return peekingRoom;
}
}
return nil;
}


#pragma mark - Matrix users

- (MXUser *)userWithUserId:(NSString *)userId
Expand Down

0 comments on commit 90ca7b2

Please sign in to comment.