Refactor RoomPreviewPresentationParameters to RoomPreviewScreenParameters.

This commit is contained in:
SBiOSoftWhare 2021-10-21 11:00:45 +02:00
parent 6ab705416d
commit 638321d123
8 changed files with 53 additions and 15 deletions

View file

@ -32,7 +32,7 @@
@class CallBar;
@class CallPresenter;
@class RoomScreenParameters;
@class RoomPreviewPresentationParameters;
@class RoomPreviewScreenParameters;
@class UniversalLinkParameters;
#pragma mark - Notifications
@ -218,9 +218,9 @@ UINavigationControllerDelegate
- (void)createDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))completion;
// Show room preview
- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion;
- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion;
- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters;
- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters;
// Restore display and show the room preview
- (void)showRoomPreview:(RoomPreviewData*)roomPreviewData;

View file

@ -19,7 +19,7 @@ import Foundation
/// Presentation parameters to display a 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.
@objcMembers
class RoomPreviewPresentationParameters: RoomScreenParameters {
class RoomPreviewScreenParameters: RoomScreenParameters {
// MARK: - Properties

View file

@ -0,0 +1,38 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Presentation parameters to display a 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.
@objcMembers
class RoomPreviewScreenParameters: RoomScreenParameters {
// MARK: - Properties
/// The data for the room preview
let previewData: RoomPreviewData
// MARK: - Setup
init(previewData: RoomPreviewData, presentationParameters: ScreenPresentationParameters) {
self.previewData = previewData
super.init(roomId: previewData.roomId,
eventId: previewData.eventId,
mxSession: previewData.mxSession, presentationParameters: presentationParameters)
}
}

View file

@ -877,7 +877,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
// Do not stack views when showing room
ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil];
RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters];
RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters];
[[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters];
}

View file

@ -245,7 +245,7 @@
{
ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO];
RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters];
RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters];
[[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters];
}

View file

@ -43,7 +43,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
@protocol MasterTabBarControllerDelegate;
@class RoomScreenParameters;
@class RoomPreviewPresentationParameters;
@class RoomPreviewScreenParameters;
@class ScreenPresentationParameters;
@interface MasterTabBarController : UITabBarController
@ -90,7 +90,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
/// This room can come from an email invitation link or a simple link to a room.
/// @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)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion;
- (void)selectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion;
/**
Open a ContactDetailsViewController to display the information of the provided contact.
@ -192,7 +192,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) {
- (void)masterTabBarControllerDidCompleteAuthentication:(MasterTabBarController *)masterTabBarController;
- (void)masterTabBarController:(MasterTabBarController*)masterTabBarController needsSideMenuIconWithNotification:(BOOL)displayNotification;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomScreenParameters*)roomScreenParameters completion:(void (^)(void))completion;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomScreenPresentationParameters completion:(void (^)(void))completion;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)roomScreenPresentationParameters completion:(void (^)(void))completion;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters;
- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters;

View file

@ -599,7 +599,7 @@
[self refreshSelectedControllerSelectedCellIfNeeded];
}
- (void)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion
- (void)selectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion
{
[self releaseSelectedItem];

View file

@ -405,13 +405,13 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
self.showRoom(with: roomCoordinatorParameters)
}
private func showRoomPreview(withPresentationParameters roomPreviewPresentationParameters: RoomPreviewPresentationParameters, completion: (() -> Void)?) {
private func showRoomPreview(withPresentationParameters roomPreviewScreenParameters: RoomPreviewScreenParameters, completion: (() -> Void)?) {
let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared,
previewData: roomPreviewPresentationParameters.previewData)
previewData: roomPreviewScreenParameters.previewData)
self.showRoom(with: roomCoordinatorParameters,
stackOnSplitViewDetail: roomPreviewPresentationParameters.presentationParameters.stackAboveVisibleViews,
stackOnSplitViewDetail: roomPreviewScreenParameters.presentationParameters.stackAboveVisibleViews,
completion: completion)
}
@ -532,8 +532,8 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate {
self.showRoom(withPresentationParameters: roomScreenParameters, completion: completion)
}
func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewPresentationParameters: RoomPreviewPresentationParameters!, completion: (() -> Void)!) {
self.showRoomPreview(withPresentationParameters: roomPreviewPresentationParameters, completion: completion)
func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewScreenParameters: RoomPreviewScreenParameters!, completion: (() -> Void)!) {
self.showRoomPreview(withPresentationParameters: roomPreviewScreenParameters, completion: completion)
}
func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!, with presentationParameters: ScreenPresentationParameters!) {