mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
Room preview of room link: Try to get more information to display from the hs
This commit is contained in:
@@ -43,4 +43,33 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)fetchPreviewData:(void (^)(BOOL))completion
|
||||
{
|
||||
// Make an /initialSync request to get preview data
|
||||
[_mxSession.matrixRestClient initialSyncOfRoom:_roomId withLimit:0 success:^(MXRoomInitialSync *roomInitialSync) {
|
||||
|
||||
MXRoomState *roomState = [[MXRoomState alloc] initWithRoomId:_roomId andMatrixSession:_mxSession andDirection:YES];
|
||||
|
||||
// Make roomState digest state events of the room
|
||||
for (MXEvent *stateEvent in roomInitialSync.state)
|
||||
{
|
||||
// Skip members events as they are not not interesting here and can be numerous
|
||||
if (stateEvent.eventType != MXEventTypeRoomMember)
|
||||
{
|
||||
[roomState handleStateEvent:stateEvent];
|
||||
}
|
||||
}
|
||||
|
||||
// Report retrieved data
|
||||
_roomName = roomState.displayname;
|
||||
_roomAvatarUrl = roomState.avatar;
|
||||
_roomTopic = roomState.topic;
|
||||
|
||||
completion(YES);
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
completion(NO);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user