MasterTabBarController: Use RoomPresentationParameters and RoomPreviewPresentationParameters input parameters and selecting a room.

This commit is contained in:
SBiOSoftWhare 2021-10-12 19:10:30 +02:00
parent bb6283554f
commit da80f4e315
2 changed files with 23 additions and 41 deletions

View file

@ -42,7 +42,8 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
}; };
@protocol MasterTabBarControllerDelegate; @protocol MasterTabBarControllerDelegate;
@class RoomPresentationParameters;
@class RoomPreviewPresentationParameters;
@interface MasterTabBarController : UITabBarController @interface MasterTabBarController : UITabBarController
@ -79,33 +80,16 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
*/ */
- (void)showAuthenticationScreenAfterSoftLogout:(MXCredentials*)softLogoutCredentials; - (void)showAuthenticationScreenAfterSoftLogout:(MXCredentials*)softLogoutCredentials;
/** /// Open the room with the provided identifier in a specific matrix session.
Open the room with the provided identifier in a specific matrix session. /// @param parameters the presentation parameters that contains room information plus display information.
/// @param completion the block to execute at the end of the operation.
- (void)selectRoomWithParameters:(RoomPresentationParameters*)parameters completion:(void (^)(void))completion;
@param roomId the room identifier. /// Open the RoomViewController to display the preview of a room that is unknown for the user.
@param eventId if not nil, the room will be opened on this event. /// This room can come from an email invitation link or a simple link to a room.
@param mxSession the matrix session in which the room should be available. /// @param parameters the presentation parameters that contains room preview information plus display information.
*/ /// @param completion the block to execute at the end of the operation.
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)mxSession; - (void)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion;
/**
Open the room with the provided identifier in a specific matrix session.
@param roomId the room identifier.
@param eventId if not nil, the room will be opened on this event.
@param matrixSession the matrix session in which the room should be available.
@param completion the block to execute at the end of the operation.
*/
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion;
/**
Open the RoomViewController to display the preview of a room that is unknown for the user.
This room can come from an email invitation link or a simple link to a room.
@param roomPreviewData the data for the room preview.
*/
- (void)showRoomPreview:(RoomPreviewData*)roomPreviewData;
/** /**
Open a ContactDetailsViewController to display the information of the provided contact. Open a ContactDetailsViewController to display the information of the provided contact.
@ -202,8 +186,9 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
- (void)masterTabBarControllerDidCompleteAuthentication:(MasterTabBarController *)masterTabBarController; - (void)masterTabBarControllerDidCompleteAuthentication:(MasterTabBarController *)masterTabBarController;
- (void)masterTabBarController:(MasterTabBarController*)masterTabBarController needsSideMenuIconWithNotification:(BOOL)displayNotification; - (void)masterTabBarController:(MasterTabBarController*)masterTabBarController needsSideMenuIconWithNotification:(BOOL)displayNotification;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomPresentationParameters*)roomPresentationParameters completion:(void (^)(void))completion;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithData:(RoomPreviewData*)roomPreviewData; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomPreviewPresentationParameters completion:(void (^)(void))completion;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession;

View file

@ -584,33 +584,30 @@
} }
} }
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession - (void)selectRoomWithParameters:(RoomPresentationParameters*)paramaters completion:(void (^)(void))completion
{
[self selectRoomWithId:roomId andEventId:eventId inMatrixSession:matrixSession completion:nil];
}
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion
{ {
[self releaseSelectedItem]; [self releaseSelectedItem];
_selectedRoomId = roomId; _selectedRoomId = paramaters.roomId;
_selectedEventId = eventId; _selectedEventId = paramaters.eventId;
_selectedRoomSession = matrixSession; _selectedRoomSession = paramaters.mxSession;
[self.masterTabBarDelegate masterTabBarController:self didSelectRoomWithId:roomId andEventId:eventId inMatrixSession:matrixSession completion:completion]; [self.masterTabBarDelegate masterTabBarController:self didSelectRoomWithParameters:paramaters completion:completion];
[self refreshSelectedControllerSelectedCellIfNeeded]; [self refreshSelectedControllerSelectedCellIfNeeded];
} }
- (void)showRoomPreview:(RoomPreviewData *)roomPreviewData - (void)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion
{ {
[self releaseSelectedItem]; [self releaseSelectedItem];
RoomPreviewData *roomPreviewData = parameters.previewData;
_selectedRoomPreviewData = roomPreviewData; _selectedRoomPreviewData = roomPreviewData;
_selectedRoomId = roomPreviewData.roomId; _selectedRoomId = roomPreviewData.roomId;
_selectedRoomSession = roomPreviewData.mxSession; _selectedRoomSession = roomPreviewData.mxSession;
[self.masterTabBarDelegate masterTabBarController:self didSelectRoomPreviewWithData:roomPreviewData]; [self.masterTabBarDelegate masterTabBarController:self didSelectRoomPreviewWithParameters:parameters completion:completion];
[self refreshSelectedControllerSelectedCellIfNeeded]; [self refreshSelectedControllerSelectedCellIfNeeded];
} }