From 617afe074883f99827c9bbf539e7969025a8b39c Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:06:56 +0200 Subject: [PATCH 01/61] BuildSettings: Add property to allow split view detail view stacking. --- Config/BuildSettings.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index 321fb8b30..bb1b25a0a 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -281,6 +281,9 @@ final class BuildSettings: NSObject { static let roomScreenAllowStickerAction: Bool = true static let roomScreenAllowFilesAction: Bool = true + /// Allow split view detail view stacking + static let allowSplitViewDetailsScreenStacking: Bool = true + // MARK: - Room Contextual Menu static let roomContextualMenuShowMoreOptionForMessages: Bool = true From 6381f2e7aca080240fdf90a30b83384f09f67baa Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:07:44 +0200 Subject: [PATCH 02/61] Add UniversalLinkParameters. --- .../DeepLink/UniversalLinkParameters.swift | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Riot/Modules/DeepLink/UniversalLinkParameters.swift diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift new file mode 100644 index 000000000..baf2dbe94 --- /dev/null +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -0,0 +1,59 @@ +// +// 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 + +/// Parameters describing a universal link +@objcMembers +class UniversalLinkParameters: NSObject { + + // MARK: - Properties + + /// The unprocessed the universal link URL + let universalLinkURL: URL? + + /// The fragment part of the universal link + let fragment: String + + /// Indicates if the view to open after the link should replace or be stacked on visible views + let stackAboveVisibleViewsOnRedirect: Bool + + // MARK: - Setup + + init(fragment: String, + universalLinkURL: URL, + stackAboveVisibleViewsOnRedirect: Bool) { + self.fragment = fragment + self.universalLinkURL = universalLinkURL + self.stackAboveVisibleViewsOnRedirect = stackAboveVisibleViewsOnRedirect + + super.init() + } + + init?(universalLinkURL: URL, + stackAboveVisibleViewsOnRedirect: Bool) { + + guard let fixedURL = Tools.fixURL(withSeveralHashKeys: universalLinkURL), let fragment = fixedURL.fragment else { + return nil + } + + self.fragment = fragment + self.universalLinkURL = universalLinkURL + self.stackAboveVisibleViewsOnRedirect = stackAboveVisibleViewsOnRedirect + + super.init() + } +} From bb6283554f95a2f8a1bb61161cbe27f8578eb5c9 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:09:18 +0200 Subject: [PATCH 03/61] Add RoomPresentationParameters and RoomPreviewPresentationParameters to display a room or room preview with identifiers and presentation configuration. --- .../RoomPresentationParameters.swift | 56 +++++++++++++++++++ .../RoomPreviewPresentationParameters.swift | 40 +++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 Riot/Modules/Application/RoomPresentationParameters.swift create mode 100644 Riot/Modules/Application/RoomPreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/RoomPresentationParameters.swift b/Riot/Modules/Application/RoomPresentationParameters.swift new file mode 100644 index 000000000..46019f222 --- /dev/null +++ b/Riot/Modules/Application/RoomPresentationParameters.swift @@ -0,0 +1,56 @@ +// +// 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 room with a provided identifier in a specific matrix session. +@objcMembers +class RoomPresentationParameters: NSObject { + + // MARK: - Properties + + /// The room identifier + let roomId: String + + /// If not nil, the room will be opened on this event. + let eventId: String? + + /// The Matrix session in which the room should be available. + let mxSession: MXSession + + /// Indicate to pop to home and restore initial view hierarchy + let restoreInitialDisplay: Bool + + /// Indicate to stack above visible views + /// If this variable is set to true `restoreInitialDisplay` should be set to false to have effect + let stackAboveVisibleViews: Bool + + // MARK: - Setup + + init(roomId: String, + eventId: String?, + mxSession: MXSession, + restoreInitialDisplay: Bool, + stackAboveVisibleViews: Bool) { + self.roomId = roomId + self.eventId = eventId + self.mxSession = mxSession + self.restoreInitialDisplay = restoreInitialDisplay + self.stackAboveVisibleViews = stackAboveVisibleViews + + super.init() + } +} diff --git a/Riot/Modules/Application/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/RoomPreviewPresentationParameters.swift new file mode 100644 index 000000000..b84b25c0d --- /dev/null +++ b/Riot/Modules/Application/RoomPreviewPresentationParameters.swift @@ -0,0 +1,40 @@ +// +// 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 RoomPreviewPresentationParameters: RoomPresentationParameters { + + // MARK: - Properties + + /// The data for the room preview + let previewData: RoomPreviewData + + // MARK: - Setup + + init(previewData: RoomPreviewData, restoreInitialDisplay: Bool, stackAboveVisibleViews: Bool) { + self.previewData = previewData + + super.init(roomId: previewData.roomId, + eventId: previewData.eventId, + mxSession: previewData.mxSession, + restoreInitialDisplay: restoreInitialDisplay, + stackAboveVisibleViews: stackAboveVisibleViews) + } +} From da80f4e315492343395ba27e760a8e6f82475fc8 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:10:30 +0200 Subject: [PATCH 04/61] MasterTabBarController: Use RoomPresentationParameters and RoomPreviewPresentationParameters input parameters and selecting a room. --- Riot/Modules/TabBar/MasterTabBarController.h | 43 +++++++------------- Riot/Modules/TabBar/MasterTabBarController.m | 21 ++++------ 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 92d064685..b9a40a00a 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -42,7 +42,8 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { }; @protocol MasterTabBarControllerDelegate; - +@class RoomPresentationParameters; +@class RoomPreviewPresentationParameters; @interface MasterTabBarController : UITabBarController @@ -79,33 +80,16 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { */ - (void)showAuthenticationScreenAfterSoftLogout:(MXCredentials*)softLogoutCredentials; -/** - 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 mxSession the matrix session in which the room should be available. - */ -- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)mxSession; +/// 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; -/** - 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 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 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; /** 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)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 didSelectRoomPreviewWithData:(RoomPreviewData*)roomPreviewData; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomPresentationParameters*)roomPresentationParameters completion:(void (^)(void))completion; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomPreviewPresentationParameters completion:(void (^)(void))completion; + - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index f5ceb2895..ee917f8e4 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -584,33 +584,30 @@ } } -- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession -{ - [self selectRoomWithId:roomId andEventId:eventId inMatrixSession:matrixSession completion:nil]; -} - -- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion +- (void)selectRoomWithParameters:(RoomPresentationParameters*)paramaters completion:(void (^)(void))completion { [self releaseSelectedItem]; - _selectedRoomId = roomId; - _selectedEventId = eventId; - _selectedRoomSession = matrixSession; + _selectedRoomId = paramaters.roomId; + _selectedEventId = paramaters.eventId; + _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]; } -- (void)showRoomPreview:(RoomPreviewData *)roomPreviewData +- (void)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion { [self releaseSelectedItem]; + RoomPreviewData *roomPreviewData = parameters.previewData; + _selectedRoomPreviewData = roomPreviewData; _selectedRoomId = roomPreviewData.roomId; _selectedRoomSession = roomPreviewData.mxSession; - [self.masterTabBarDelegate masterTabBarController:self didSelectRoomPreviewWithData:roomPreviewData]; + [self.masterTabBarDelegate masterTabBarController:self didSelectRoomPreviewWithParameters:parameters completion:completion]; [self refreshSelectedControllerSelectedCellIfNeeded]; } From 28278ab47d961ef4a45188ed02c2ac2d53a6d75d Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:12:08 +0200 Subject: [PATCH 05/61] RoomVC: Update universal link management with UniversalLinkParameters. --- .../Room/RoomViewController+Spaces.swift | 22 +++++++++-------- Riot/Modules/Room/RoomViewController.h | 19 ++++----------- Riot/Modules/Room/RoomViewController.m | 24 +++++++++---------- 3 files changed, 28 insertions(+), 37 deletions(-) diff --git a/Riot/Modules/Room/RoomViewController+Spaces.swift b/Riot/Modules/Room/RoomViewController+Spaces.swift index f85197cd8..dfde5b11b 100644 --- a/Riot/Modules/Room/RoomViewController+Spaces.swift +++ b/Riot/Modules/Room/RoomViewController+Spaces.swift @@ -18,8 +18,10 @@ import Foundation /// this extension is temprorary and implements navigation to the Space bootom sheet. This should be moved to an universal link flow coordinator extension RoomViewController { - @objc func handleSpaceUniversalLink(with url: URL) { - let url = Tools.fixURL(withSeveralHashKeys: url) + + @objc func handleSpaceUniversalLink(with universalLinkParameters: UniversalLinkParameters) -> Bool { + + let url = universalLinkParameters.universalLinkURL var pathParamsObjc: NSArray? var queryParamsObjc: NSMutableDictionary? @@ -28,7 +30,7 @@ extension RoomViewController { // Sanity check guard let pathParams = pathParamsObjc as? [String], pathParams.count > 0 else { MXLog.error("[RoomViewController] Universal link: Error: No path parameters") - return + return false } var roomIdOrAliasParam: String? @@ -67,8 +69,7 @@ extension RoomViewController { } guard let roomIdOrAlias = roomIdOrAliasParam else { - AppDelegate.theDelegate().handleUniversalLinkURL(url) - return + return AppDelegate.theDelegate().handleUniversalLink(with: universalLinkParameters) } self.startActivityIndicator() @@ -94,14 +95,16 @@ extension RoomViewController { return } - self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomId, via: viaServers, from: url) + self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomId, via: viaServers, from: universalLinkParameters) } } else { - self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomIdOrAlias, via: viaServers, from: url) + self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomIdOrAlias, via: viaServers, from: universalLinkParameters) } + + return true } - private func requestSummaryAndShowSpaceDetail(forRoomWithId roomId: String, via: [String], from url: URL?) { + private func requestSummaryAndShowSpaceDetail(forRoomWithId roomId: String, via: [String], from universalLinkParameters: UniversalLinkParameters) { if self.mainSession.spaceService.getSpace(withId: roomId) != nil { self.stopActivityIndicator() self.showSpaceDetail(withId: roomId) @@ -116,12 +119,11 @@ extension RoomViewController { self.stopActivityIndicator() guard let publicRoom = response.value, publicRoom.roomTypeString == MXRoomTypeString.space.rawValue else { - AppDelegate.theDelegate().handleUniversalLinkURL(url) + AppDelegate.theDelegate().handleUniversalLink(with: universalLinkParameters) return } self.showSpaceDetail(with: publicRoom) } } - } diff --git a/Riot/Modules/Room/RoomViewController.h b/Riot/Modules/Room/RoomViewController.h index 7fa73286a..99598f5df 100644 --- a/Riot/Modules/Room/RoomViewController.h +++ b/Riot/Modules/Room/RoomViewController.h @@ -28,6 +28,7 @@ #import "UIViewController+RiotSearch.h" @class BadgeLabel; +@class UniversalLinkParameters; @protocol RoomViewControllerDelegate; NS_ASSUME_NONNULL_BEGIN @@ -170,26 +171,14 @@ extern NSNotificationName const RoomGroupCallTileTappedNotification; - (void)roomViewControllerPreviewDidTapCancel:(RoomViewController *)roomViewController; /** - Handle the fragment of a universal link. + Process universal link. @param roomViewController the `RoomViewController` instance. - @param fragment the fragment part of the universal link. - @param universalLinkURL the unprocessed the universal link URL (optional). - @return true to indicate that the fragment has been handled, or false when the fragment is not supported. - */ -- (BOOL)roomViewController:(RoomViewController *)roomViewController -handleUniversalLinkFragment:(NSString*)fragment - fromURL:(nullable NSURL*)universalLinkURL; - -/** - Process universal link. - - @param roomViewController the `RoomViewController` instance. - @param universalLinkURL the universal link URL. + @param parameters the universal link parameters. @return YES in case of processing success. */ - (BOOL)roomViewController:(RoomViewController *)roomViewController - handleUniversalLinkURL:(NSURL*)universalLinkURL; +handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters; @end diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 075a3f57f..aa056250b 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2189,26 +2189,26 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL { - if (self.delegate) - { - return [self.delegate roomViewController:self handleUniversalLinkURL:universalLinkURL]; - } - else - { - [self handleSpaceUniversalLinkWith:universalLinkURL]; - return YES; - } + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithUniversalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:BuildSettings.allowSplitViewDetailsScreenStacking]; + return [self handleUniversalLinkWithParameters:parameters]; } - + - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL +{ + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment + universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:BuildSettings.allowSplitViewDetailsScreenStacking]; + return [self handleUniversalLinkWithParameters:parameters]; +} + +- (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters { if (self.delegate) { - return [self.delegate roomViewController:self handleUniversalLinkFragment:fragment fromURL:universalLinkURL]; + return [self.delegate roomViewController:self handleUniversalLinkWithParameters:parameters]; } else { - return [[AppDelegate theDelegate] handleUniversalLinkFragment:fragment fromURL:universalLinkURL]; + return [self handleSpaceUniversalLinkWith:parameters]; } } From 4805516cf9569c50a0097c62b57e13c41d9752e7 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:15:35 +0200 Subject: [PATCH 06/61] TabBarCoordinator: Update RoomViewControllerDelegate conformance. Handle RoomPresentationParameters and RoomPreviewPresentationParameters. --- Riot/Modules/TabBar/TabBarCoordinator.swift | 59 +++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 8b1d3735a..89c6d6b85 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -365,7 +365,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } } - private func showRoom(with roomId: String) { + private func showRoom(withId roomId: String) { guard let matrixSession = self.parameters.userSessionsService.mainUserSession?.matrixSession else { return @@ -374,6 +374,18 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.showRoom(with: roomId, eventId: nil, matrixSession: matrixSession) } + private func showRoom(withPresentationParameters roomPresentationParameters: RoomPresentationParameters, completion: (() -> Void)?) { + + let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared, + session: roomPresentationParameters.mxSession, + roomId: roomPresentationParameters.roomId, + eventId: roomPresentationParameters.eventId) + + self.showRoom(with: roomCoordinatorParameters, + stackOnSplitViewDetail: roomPresentationParameters.stackAboveVisibleViews, + completion: completion) + } + private func showRoom(with roomId: String, eventId: String?, matrixSession: MXSession, completion: (() -> Void)? = nil) { // RoomCoordinator will be presented by the split view. @@ -394,7 +406,19 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.showRoom(with: roomCoordinatorParameters) } - private func showRoom(with parameters: RoomCoordinatorParameters, completion: (() -> Void)? = nil) { + private func showRoomPreview(withPresentationParameters roomPreviewPresentationParameters: RoomPreviewPresentationParameters, completion: (() -> Void)?) { + + let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared, + previewData: roomPreviewPresentationParameters.previewData) + + self.showRoom(with: roomCoordinatorParameters, + stackOnSplitViewDetail: roomPreviewPresentationParameters.stackAboveVisibleViews, + completion: completion) + } + + private func showRoom(with parameters: RoomCoordinatorParameters, + stackOnSplitViewDetail: Bool = false, + completion: (() -> Void)? = nil) { if let topRoomCoordinator = self.splitViewMasterPresentableDelegate?.detailModules.last as? RoomCoordinatorProtocol, parameters.roomId == topRoomCoordinator.roomId && parameters.session == topRoomCoordinator.mxSession { @@ -415,9 +439,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { coordinator.delegate = self coordinator.start(withCompletion: completion) self.add(childCoordinator: coordinator) - - self.replaceSplitViewDetails(with: coordinator) { - [weak self] in + + self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: stackOnSplitViewDetail) { [weak self] in // NOTE: The RoomDataSource releasing is handled in SplitViewCoordinator self?.remove(childCoordinator: coordinator) } @@ -428,6 +451,20 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToReplaceDetailWith: presentable, popCompletion: popCompletion) } + /// If the split view is collapsed (one column visible) it will push the Presentable on the primary navigation controller, otherwise it will show the Presentable as the secondary view of the split view on top of existing views. + private func stackSplitViewDetails(with presentable: Presentable, popCompletion: (() -> Void)? = nil) { + self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToStack: presentable, popCompletion: popCompletion) + } + + private func showSplitViewDetails(with presentable: Presentable, stackOnSplitViewDetail: Bool, popCompletion: (() -> Void)? = nil) { + + if stackOnSplitViewDetail { + self.stackSplitViewDetails(with: presentable, popCompletion: popCompletion) + } else { + self.replaceSplitViewDetails(with: presentable, popCompletion: popCompletion) + } + } + // MARK: UserSessions management private func registerUserSessionsServiceNotifications() { @@ -485,9 +522,13 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { // MARK: - MasterTabBarControllerDelegate extension TabBarCoordinator: MasterTabBarControllerDelegate { - - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewData: RoomPreviewData!) { - self.showRoomPreview(with: roomPreviewData) + + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomWith roomPresentationParameters: RoomPresentationParameters!, completion: (() -> Void)!) { + self.showRoom(withPresentationParameters: roomPresentationParameters, completion: completion) + } + + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewPresentationParameters: RoomPreviewPresentationParameters!, completion: (() -> Void)!) { + self.showRoomPreview(withPresentationParameters: roomPreviewPresentationParameters, completion: completion) } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!) { @@ -533,7 +574,7 @@ extension TabBarCoordinator: RoomCoordinatorDelegate { } func roomCoordinator(_ coordinator: RoomCoordinatorProtocol, didSelectRoomWithId roomId: String) { - self.showRoom(with: roomId) + self.showRoom(withId: roomId) } } From 85023dc271bd29d859551c1c5638cff2207a7232 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:20:39 +0200 Subject: [PATCH 07/61] LegacyAppDelegate: Update universal link management with UniversalLinkParameters. And handle show room with RoomPresentationParameters and room preview with RoomPreviewPresentationParameters. --- Riot/Modules/Application/LegacyAppDelegate.h | 24 +++++- Riot/Modules/Application/LegacyAppDelegate.m | 83 +++++++++++++++----- 2 files changed, 86 insertions(+), 21 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index ddf33c28b..cd4526a94 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -31,6 +31,9 @@ @protocol LegacyAppDelegateDelegate; @class CallBar; @class CallPresenter; +@class RoomPresentationParameters; +@class RoomPreviewPresentationParameters; +@class UniversalLinkParameters; #pragma mark - Notifications /** @@ -204,15 +207,24 @@ UINavigationControllerDelegate #pragma mark - Matrix Room handling // Show a room and jump to the given event if event id is not nil otherwise go to last messages. -- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay completion:(void (^)(void))completion; +- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters completion:(void (^)(void))completion; -- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay; +- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters; +// Restore display and show the room - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession; // Creates a new direct chat with the provided user id - (void)createDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))completion; +// Show room preview +- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion; + +- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters; + +// Restore display and show the room preview +- (void)showRoomPreview:(RoomPreviewData*)roomPreviewData; + // Reopen an existing direct room with this userId or creates a new one (if it doesn't exist) - (void)startDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))completion; @@ -241,6 +253,14 @@ UINavigationControllerDelegate */ - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL; +/** + Process universal link. + + @param parameters the universal link parameters. + @return YES in case of processing success. + */ +- (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters; + /** Extract params from the URL fragment part (after '#') of a vector.im Universal link: diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index c86695012..e470cef05 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1236,8 +1236,21 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni return [self handleUniversalLinkFragment:fragment fromURL:nil]; } + - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL + { + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:NO]; + + return [self handleUniversalLinkWithParameters:parameters]; +} + +- (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters +{ + NSString *fragment = parameters.fragment; + NSURL *universalLinkURL = parameters.universalLinkURL; + BOOL stackAboveVisibleViewsOnRedirect = parameters.stackAboveVisibleViewsOnRedirect; + BOOL continueUserActivity = NO; MXKAccountManager *accountManager = [MXKAccountManager sharedManager]; @@ -1347,7 +1360,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni else { // Open the room page - [self showRoom:roomId andEventId:eventId withMatrixSession:account.mxSession]; + RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession restoreInitialDisplay:!stackAboveVisibleViewsOnRedirect stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; + + [self showRoomWithParameters:roomPresentationParameters]; } continueUserActivity = YES; @@ -1398,7 +1413,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { universalLinkFragmentPendingRoomAlias = @{roomId: roomIdOrAlias}; - [self handleUniversalLinkFragment:newUniversalLinkFragment fromURL:universalLinkURL]; + UniversalLinkParameters *newParameters = [[UniversalLinkParameters alloc] initWithFragment:newUniversalLinkFragment universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:stackAboveVisibleViewsOnRedirect]; + + [self handleUniversalLinkWithParameters:newParameters]; } else { @@ -1436,7 +1453,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (notif.object == account.mxSession && account.mxSession.state == MXSessionStateRunning) { MXLogDebug(@"[AppDelegate] Universal link: The session is running. Retry the link"); - [self handleUniversalLinkFragment:fragment fromURL:universalLinkURL]; + [self handleUniversalLinkWithParameters:parameters]; } } }]; @@ -1494,7 +1511,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if ([universalLinkFragmentPending isEqualToString:fragment]) { MXLogDebug(@"[AppDelegate] Universal link: The user is now logged in. Retry the link"); - [self handleUniversalLinkFragment:fragment fromURL:universalLinkURL]; + [self handleUniversalLinkWithParameters:parameters]; } }]; } @@ -1559,7 +1576,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if ([universalLinkFragmentPending isEqualToString:fragment]) { MXLogDebug(@"[AppDelegate] Universal link: The user is now logged in. Retry the link"); - [self handleUniversalLinkFragment:fragment fromURL:universalLinkURL]; + [self handleUniversalLinkWithParameters:parameters]; } }]; } @@ -2782,8 +2799,17 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay completion:(void (^)(void))completion +- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters { + [self showRoomWithParameters:parameters completion:nil]; +} + +- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters completion:(void (^)(void))completion +{ + NSString *roomId = parameters.roomId; + MXSession *mxSession = parameters.mxSession; + BOOL restoreInitialDisplay = parameters.restoreInitialDisplay; + if (roomId && mxSession) { MXRoom *room = [mxSession roomWithRoomId:roomId]; @@ -2805,8 +2831,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni void (^selectRoom)(void) = ^() { // Select room to display its details (dispatch this action in order to let TabBarController end its refresh) - [self.masterTabBarController selectRoomWithId:roomId andEventId:eventId inMatrixSession:mxSession completion:^{ - + + [self.masterTabBarController selectRoomWithParameters:parameters completion:^{ // Remove delivered notifications for this room [self.pushNotificationService removeDeliveredNotificationsWithRoomId:roomId completion:nil]; @@ -2829,23 +2855,42 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay -{ - [self showRoom:roomId andEventId:eventId withMatrixSession:mxSession restoreInitialDisplay:restoreInitialDisplay completion:nil]; -} - - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession { - [self showRoom:roomId andEventId:eventId withMatrixSession:mxSession restoreInitialDisplay:YES completion:nil]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + eventId:eventId mxSession:mxSession restoreInitialDisplay:YES stackAboveVisibleViews:NO]; + + [self showRoomWithParameters:parameters]; +} + +- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion +{ + void (^showRoomPreview)(void) = ^() { + [self.masterTabBarController selectRoomPreviewWithParameters:parameters completion:completion]; + }; + + if (parameters.restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + showRoomPreview(); + }]; + } + else + { + showRoomPreview(); + } +} + +- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters +{ + [self showRoomPreviewWithParameters:parameters completion:nil]; } - (void)showRoomPreview:(RoomPreviewData*)roomPreviewData { - [self restoreInitialDisplay:^{ - - [_masterTabBarController showRoomPreview:roomPreviewData]; - - }]; + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:YES stackAboveVisibleViews:NO]; + + [self showRoomPreviewWithParameters:parameters]; } - (void)setVisibleRoomId:(NSString *)roomId From 2ad354e83e3c7e5c78eb63e241a2b3f2a443c901 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:21:19 +0200 Subject: [PATCH 08/61] RoomCoordinator: Update RoomViewControllerDelegate conformance. --- Riot/Modules/Room/RoomCoordinator.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Riot/Modules/Room/RoomCoordinator.swift b/Riot/Modules/Room/RoomCoordinator.swift index ce8f41ef7..dd3ca7d2f 100644 --- a/Riot/Modules/Room/RoomCoordinator.swift +++ b/Riot/Modules/Room/RoomCoordinator.swift @@ -231,12 +231,8 @@ extension RoomCoordinator: RoomViewControllerDelegate { func roomViewController(_ roomViewController: RoomViewController, showCompleteSecurityFor session: MXSession) { AppDelegate.theDelegate().presentCompleteSecurity(for: session) } - - func roomViewController(_ roomViewController: RoomViewController, handleUniversalLinkFragment fragment: String, from universalLinkURL: URL?) -> Bool { - return AppDelegate.theDelegate().handleUniversalLinkFragment(fragment, from: universalLinkURL) - } - func roomViewController(_ roomViewController: RoomViewController, handleUniversalLinkURL universalLinkURL: URL) -> Bool { - return AppDelegate.theDelegate().handleUniversalLinkURL(universalLinkURL) + func roomViewController(_ roomViewController: RoomViewController, handleUniversalLinkWith parameters: UniversalLinkParameters) -> Bool { + return AppDelegate.theDelegate().handleUniversalLink(with: parameters) } } From bbf1bf7c7c5f0f09d28737946d2d0703111c048f Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 12 Oct 2021 19:22:46 +0200 Subject: [PATCH 09/61] Update room display management where needed. --- .../Common/Recents/RecentsViewController.m | 45 +++++++++++++------ .../Files/HomeFilesSearchViewController.m | 17 +++++-- .../HomeMessagesSearchViewController.m | 17 +++++-- .../Rooms/DirectoryViewController.m | 17 +++++-- 4 files changed, 72 insertions(+), 24 deletions(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index d15bbdb0a..e5d5b6339 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -856,16 +856,29 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro } } -- (void)dispayRoomWithRoomId:(NSString*)roomId inMatrixSession:(MXSession*)matrixSession +- (void)showRoomWithRoomId:(NSString*)roomId inMatrixSession:(MXSession*)matrixSession { // Avoid multiple openings of rooms self.userInteractionEnabled = NO; + + // Do not stack views when showing room + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil + mxSession:matrixSession restoreInitialDisplay:NO + stackAboveVisibleViews:NO]; - [[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:matrixSession restoreInitialDisplay:NO completion:^{ + [[AppDelegate theDelegate] showRoomWithParameters:parameters completion:^{ self.userInteractionEnabled = YES; }]; } +- (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData +{ + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData + restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + + [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; +} + // Disable UI interactions in this screen while we are going to open another screen. // Interactions on reset on viewWillAppear. - (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled @@ -939,7 +952,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro } // Display the room preview - [self dispayRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession]; + [self showRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession]; } else if ([actionIdentifier isEqualToString:kInviteRecentTableViewCellAcceptButtonPressed]) { @@ -1462,7 +1475,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro else if ([self canShowRoomPreviewFor:invitedRoom]) { // Display the room preview - [self dispayRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession]; + [self showRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession]; } else { @@ -1982,7 +1995,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro if ([self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession roomWithRoomId:publicRoom.roomId]) { // Open the public room - [[AppDelegate theDelegate] showRoom:publicRoom.roomId andEventId:nil withMatrixSession:self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession restoreInitialDisplay:NO]; + [self showRoomWithRoomId:publicRoom.roomId + inMatrixSession:self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession]; } else { @@ -1996,14 +2010,15 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Try to get more information about the room before opening its preview [roomPreviewData peekInRoom:^(BOOL succeeded) { [self stopActivityIndicator]; - - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:roomPreviewData]; + + [self showRoomPreviewWithData:roomPreviewData]; }]; } else { RoomPreviewData *roomPreviewData = [[RoomPreviewData alloc] initWithPublicRoom:publicRoom andSession:self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession]; - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:roomPreviewData]; + + [self showRoomPreviewWithData:roomPreviewData]; } } } @@ -2069,7 +2084,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)recentListViewController:(MXKRecentListViewController *)recentListViewController didSelectRoom:(NSString *)roomId inMatrixSession:(MXSession *)matrixSession { - [self dispayRoomWithRoomId:roomId inMatrixSession:matrixSession]; + [self showRoomWithRoomId:roomId inMatrixSession:matrixSession]; } - (void)recentListViewController:(MXKRecentListViewController *)recentListViewController didSelectSuggestedRoom:(MXSpaceChildInfo *)childInfo @@ -2079,8 +2094,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro MXWeakify(self); [previewData peekInRoom:^(BOOL succeeded) { MXStrongifyAndReturnIfNil(self); - [self stopActivityIndicator]; - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:previewData]; + [self stopActivityIndicator]; + [self showRoomPreviewWithData:previewData]; }]; } @@ -2123,7 +2138,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)createRoomCoordinatorBridgePresenterDelegate:(CreateRoomCoordinatorBridgePresenter *)coordinatorBridgePresenter didCreateNewRoom:(MXRoom *)room { [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ - [[AppDelegate theDelegate] showRoom:room.roomId andEventId:nil withMatrixSession:self.mainSession restoreInitialDisplay:NO]; + [self showRoomWithRoomId:room.roomId inMatrixSession:self.mainSession]; }]; coordinatorBridgePresenter = nil; } @@ -2252,7 +2267,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro { // Room is known show it directly [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ - [[AppDelegate theDelegate] showRoom:room.roomId andEventId:nil withMatrixSession:self.mainSession restoreInitialDisplay:NO]; + [self showRoomWithRoomId:room.roomId + inMatrixSession:self.mainSession]; }]; coordinatorBridgePresenter = nil; } @@ -2280,7 +2296,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro if (succeeded) { [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:roomPreviewData]; + + [self showRoomPreviewWithData:roomPreviewData]; }]; self.roomsDirectoryCoordinatorBridgePresenter = nil; } else { diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index 958e2cb24..84dd46897 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -139,6 +139,17 @@ } } +- (void)showRoomWithId:(NSString*)roomId + andEventId:(NSString*)eventId + inMatrixSession:(MXSession*)session +{ + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + eventId:eventId mxSession:session + restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + + [[AppDelegate theDelegate] showRoomWithParameters:parameters]; +} + #pragma mark - MXKDataSourceDelegate - (Class)cellViewClassForCellData:(MXKCellData*)cellData @@ -188,9 +199,9 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; // Make the master tabBar view controller open the RoomViewController - [[AppDelegate theDelegate].masterTabBarController selectRoomWithId:cellData.roomId - andEventId:_selectedEvent.eventId - inMatrixSession:self.mainSession]; + [self showRoomWithId:cellData.roomId + andEventId:_selectedEvent.eventId + inMatrixSession:self.mainSession]; // Reset the selected event. HomeViewController got it when here _selectedEvent = nil; diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index 0dbc1cfcb..6c905f6fb 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -146,6 +146,17 @@ } } +- (void)showRoomWithId:(NSString*)roomId + andEventId:(NSString*)eventId + inMatrixSession:(MXSession*)session +{ + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + eventId:eventId mxSession:session + restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + + [[AppDelegate theDelegate] showRoomWithParameters:parameters]; +} + #pragma mark - MXKDataSourceDelegate - (Class)cellViewClassForCellData:(MXKCellData*)cellData @@ -239,9 +250,9 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; // Make the master tabBar view controller open the RoomViewController - [[AppDelegate theDelegate].masterTabBarController selectRoomWithId:cellData.roomId - andEventId:_selectedEvent.eventId - inMatrixSession:cellData.mxSession]; + [self showRoomWithId:cellData.roomId + andEventId:_selectedEvent.eventId + inMatrixSession:cellData.mxSession]; // Reset the selected event. HomeViewController got it when here _selectedEvent = nil; diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 502bb3754..c7c04221d 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -209,13 +209,13 @@ [self stopActivityIndicator]; - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:roomPreviewData]; + [self showRoomPreviewWithData:roomPreviewData]; }]; } else { RoomPreviewData *roomPreviewData = [[RoomPreviewData alloc] initWithPublicRoom:publicRoom andSession:dataSource.mxSession]; - [[AppDelegate theDelegate].masterTabBarController showRoomPreview:roomPreviewData]; + [self showRoomPreviewWithData:roomPreviewData]; } } @@ -233,8 +233,17 @@ #pragma mark - Private methods - (void)openRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession -{ - [[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:mxSession restoreInitialDisplay:NO]; +{ + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession + restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + [[AppDelegate theDelegate] showRoomWithParameters:parameters]; +} + +- (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData +{ + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:NO + stackAboveVisibleViews:NO]; + [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } - (void)refreshCurrentSelectedCell:(BOOL)forceVisible From c62470bc3c7664c66e07c0ab8c5d25623a6dda1f Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Oct 2021 12:29:59 +0200 Subject: [PATCH 10/61] RoomVC: Remove temporary space universal link handling. --- .../Room/RoomViewController+Spaces.swift | 129 ------------------ Riot/Modules/Room/RoomViewController.h | 4 - Riot/Modules/Room/RoomViewController.m | 16 +-- 3 files changed, 1 insertion(+), 148 deletions(-) delete mode 100644 Riot/Modules/Room/RoomViewController+Spaces.swift diff --git a/Riot/Modules/Room/RoomViewController+Spaces.swift b/Riot/Modules/Room/RoomViewController+Spaces.swift deleted file mode 100644 index dfde5b11b..000000000 --- a/Riot/Modules/Room/RoomViewController+Spaces.swift +++ /dev/null @@ -1,129 +0,0 @@ -// -// 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 - -/// this extension is temprorary and implements navigation to the Space bootom sheet. This should be moved to an universal link flow coordinator -extension RoomViewController { - - @objc func handleSpaceUniversalLink(with universalLinkParameters: UniversalLinkParameters) -> Bool { - - let url = universalLinkParameters.universalLinkURL - - var pathParamsObjc: NSArray? - var queryParamsObjc: NSMutableDictionary? - AppDelegate.theDelegate().parseUniversalLinkFragment(url?.fragment, outPathParams: &pathParamsObjc, outQueryParams: &queryParamsObjc) - - // Sanity check - guard let pathParams = pathParamsObjc as? [String], pathParams.count > 0 else { - MXLog.error("[RoomViewController] Universal link: Error: No path parameters") - return false - } - - var roomIdOrAliasParam: String? - var eventIdParam: String? - var userIdParam: String? - var groupIdParam: String? - - // Check permalink to room or event - if pathParams[0] == "room" && pathParams.count >= 2 { - - // The link is the form of "/room/[roomIdOrAlias]" or "/room/[roomIdOrAlias]/[eventId]" - roomIdOrAliasParam = pathParams[1] - - // Is it a link to an event of a room? - eventIdParam = pathParams.count >= 3 ? pathParams[2] : nil - - } else if pathParams[0] == "group" && pathParams.count >= 2 { - - // The link is the form of "/group/[groupId]" - groupIdParam = pathParams[1] - - } else if (pathParams[0].hasPrefix("#") || pathParams[0].hasPrefix("!")) && pathParams.count >= 1 { - - // The link is the form of "/#/[roomIdOrAlias]" or "/#/[roomIdOrAlias]/[eventId]" - // Such links come from matrix.to permalinks - roomIdOrAliasParam = pathParams[0] - eventIdParam = pathParams.count >= 2 ? pathParams[1] : nil - - } else if pathParams[0] == "user" && pathParams.count == 2 { // Check permalink to a user - // The link is the form of "/user/userId" - userIdParam = pathParams[1] - } else if pathParams[0].hasPrefix("@") && pathParams.count == 1 { - // The link is the form of "/#/[userId]" - // Such links come from matrix.to permalinks - userIdParam = pathParams[0] - } - - guard let roomIdOrAlias = roomIdOrAliasParam else { - return AppDelegate.theDelegate().handleUniversalLink(with: universalLinkParameters) - } - - self.startActivityIndicator() - - var viaServers: [String] = [] - if let queryParams = queryParamsObjc as? [String: Any], let via = queryParams["via"] as? [String] { - viaServers = via - } - - if roomIdOrAlias.hasPrefix("#") { - self.mainSession.matrixRestClient.roomId(forRoomAlias: roomIdOrAlias) { [weak self] response in - guard let self = self else { - return - } - - guard let roomId = response.value else { - self.stopActivityIndicator() - - if response.error != nil { - let errorMessage = VectorL10n.roomDoesNotExist(roomIdOrAlias) - AppDelegate.theDelegate().showAlert(withTitle: nil, message: errorMessage) - } - return - } - - self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomId, via: viaServers, from: universalLinkParameters) - } - } else { - self.requestSummaryAndShowSpaceDetail(forRoomWithId: roomIdOrAlias, via: viaServers, from: universalLinkParameters) - } - - return true - } - - private func requestSummaryAndShowSpaceDetail(forRoomWithId roomId: String, via: [String], from universalLinkParameters: UniversalLinkParameters) { - if self.mainSession.spaceService.getSpace(withId: roomId) != nil { - self.stopActivityIndicator() - self.showSpaceDetail(withId: roomId) - return - } - - self.mainSession.matrixRestClient.roomSummary(with: roomId, via: via) { [weak self] response in - guard let self = self else { - return - } - - self.stopActivityIndicator() - - guard let publicRoom = response.value, publicRoom.roomTypeString == MXRoomTypeString.space.rawValue else { - AppDelegate.theDelegate().handleUniversalLink(with: universalLinkParameters) - return - } - - self.showSpaceDetail(with: publicRoom) - } - } -} diff --git a/Riot/Modules/Room/RoomViewController.h b/Riot/Modules/Room/RoomViewController.h index 99598f5df..5016dec0f 100644 --- a/Riot/Modules/Room/RoomViewController.h +++ b/Riot/Modules/Room/RoomViewController.h @@ -87,10 +87,6 @@ extern NSNotificationName const RoomGroupCallTileTappedNotification; */ - (void)displayRoomPreview:(RoomPreviewData*)roomPreviewData; -- (void)showSpaceDetailWithPublicRoom:(MXPublicRoom *)publicRoom; - -- (void)showSpaceDetailWithId:(NSString *)spaceId; - /** Action used to handle some buttons. */ diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 2c7bacfc3..373b70109 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2218,7 +2218,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; } else { - return [self handleSpaceUniversalLinkWith:parameters]; + return [[AppDelegate theDelegate] handleUniversalLinkWithParameters:parameters]; } } @@ -6520,20 +6520,6 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; }]; } -- (void)showSpaceDetailWithPublicRoom:(MXPublicRoom *)publicRoom -{ - self.spaceDetailPresenter = [SpaceDetailPresenter new]; - self.spaceDetailPresenter.delegate = self; - [self.spaceDetailPresenter presentForSpaceWithPublicRoom:publicRoom from:self sourceView:nil session:self.mainSession animated:YES]; -} - -- (void)showSpaceDetailWithId:(NSString *)spaceId -{ - self.spaceDetailPresenter = [SpaceDetailPresenter new]; - self.spaceDetailPresenter.delegate = self; - [self.spaceDetailPresenter presentForSpaceWithId:spaceId from:self sourceView:nil session:self.mainSession animated:YES]; -} - #pragma mark - SpaceDetailPresenterDelegate - (void)spaceDetailPresenterDidComplete:(SpaceDetailPresenter *)presenter From eb2daaf684fcb649f03724b900ecd0a69c449e46 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Oct 2021 14:38:57 +0200 Subject: [PATCH 11/61] SpaceDetailPresenter: Avoid crash on iPad when the source view is nil. --- Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift index 39a331bc9..de3dc6558 100644 --- a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift +++ b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift @@ -98,7 +98,8 @@ class SpaceDetailPresenter: NSObject { } else { // Configure source view when view controller is presented with a popover viewController.modalPresentationStyle = .popover - if let sourceView = self.sourceView, let popoverPresentationController = viewController.popoverPresentationController { + if let popoverPresentationController = viewController.popoverPresentationController, let sourceView = sourceView ?? viewController.view { + popoverPresentationController.sourceView = sourceView popoverPresentationController.sourceRect = sourceView.bounds } From 5ba03c6d8893cab32767fb285ad136fb81f36a5d Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Oct 2021 14:43:08 +0200 Subject: [PATCH 12/61] Add space and space preview presentation parameters. --- .../SpacePresentationParameters.swift | 45 +++++++++++++++++++ .../SpacePreviewPresentationParameters.swift | 37 +++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 Riot/Modules/Application/SpacePresentationParameters.swift create mode 100644 Riot/Modules/Application/SpacePreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/SpacePresentationParameters.swift b/Riot/Modules/Application/SpacePresentationParameters.swift new file mode 100644 index 000000000..68357d2fe --- /dev/null +++ b/Riot/Modules/Application/SpacePresentationParameters.swift @@ -0,0 +1,45 @@ +// +// 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 space with a provided identifier in a specific matrix session. +@objcMembers +class SpacePresentationParameters: NSObject { + + // MARK: - Properties + + /// The room identifier + let roomId: String + + /// The Matrix session in which the room should be available. + let mxSession: MXSession + + /// Indicate to pop to home and restore initial view hierarchy + let restoreInitialDisplay: Bool + + // MARK: - Setup + + init(roomId: String, + mxSession: MXSession, + restoreInitialDisplay: Bool) { + self.roomId = roomId + self.mxSession = mxSession + self.restoreInitialDisplay = restoreInitialDisplay + + super.init() + } +} diff --git a/Riot/Modules/Application/SpacePreviewPresentationParameters.swift b/Riot/Modules/Application/SpacePreviewPresentationParameters.swift new file mode 100644 index 000000000..a26a953ef --- /dev/null +++ b/Riot/Modules/Application/SpacePreviewPresentationParameters.swift @@ -0,0 +1,37 @@ +// +// 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 space that is unknown for the user. +@objcMembers +class SpacePreviewPresentationParameters: SpacePresentationParameters { + + // MARK: - Properties + + /// The data for the room preview + let publicRoom: MXPublicRoom + + // MARK: - Setup + + init(publicRoom: MXPublicRoom, + mxSession: MXSession, + restoreInitialDisplay: Bool) { + self.publicRoom = publicRoom + + super.init(roomId: publicRoom.roomId, mxSession: mxSession, restoreInitialDisplay: restoreInitialDisplay) + } +} From ffb9586e9cd33e29c554e175ad13c68143c90ec8 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Oct 2021 14:45:47 +0200 Subject: [PATCH 13/61] LegacyAppDelegate: Update space detail presentation. Update room preview presentation. Prevent restoring initial display when not needed. --- Riot/Modules/Application/LegacyAppDelegate.m | 126 +++++++++++++++---- 1 file changed, 100 insertions(+), 26 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index e470cef05..a1167f3ba 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1245,11 +1245,12 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni return [self handleUniversalLinkWithParameters:parameters]; } -- (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)parameters +- (BOOL)handleUniversalLinkWithParameters:(UniversalLinkParameters*)universalLinkParameters { - NSString *fragment = parameters.fragment; - NSURL *universalLinkURL = parameters.universalLinkURL; - BOOL stackAboveVisibleViewsOnRedirect = parameters.stackAboveVisibleViewsOnRedirect; + NSString *fragment = universalLinkParameters.fragment; + NSURL *universalLinkURL = universalLinkParameters.universalLinkURL; + BOOL stackAboveVisibleViewsOnRedirect = universalLinkParameters.stackAboveVisibleViewsOnRedirect; + BOOL restoreInitialDisplay = !stackAboveVisibleViewsOnRedirect; BOOL continueUserActivity = NO; MXKAccountManager *accountManager = [MXKAccountManager sharedManager]; @@ -1351,16 +1352,14 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (room.summary.roomType == MXRoomTypeSpace) { - [self restoreInitialDisplay:^{ - self.spaceDetailPresenter = [SpaceDetailPresenter new]; - self.spaceDetailPresenter.delegate = self; - [self.spaceDetailPresenter presentForSpaceWithId:room.roomId from:self.masterNavigationController sourceView:nil session:account.mxSession animated:YES]; - }]; + SpacePresentationParameters *spacePresentationParameters = [[SpacePresentationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay]; + + [self showSpaceWithParameters:spacePresentationParameters]; } else { // Open the room page - RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession restoreInitialDisplay:!stackAboveVisibleViewsOnRedirect stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; + RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; [self showRoomWithParameters:roomPresentationParameters]; } @@ -1369,10 +1368,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } else { - // We will display something but we need to do some requests before. - // So, come back to the home VC and show its loading wheel while processing - [self restoreInitialDisplay:^{ - + void(^findRoom)(void) = ^{ if ([_masterTabBarController.selectedViewController isKindOfClass:MXKActivityHandlingViewController.class]) { MXKActivityHandlingViewController *homeViewController = (MXKActivityHandlingViewController*)_masterTabBarController.selectedViewController; @@ -1453,7 +1449,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (notif.object == account.mxSession && account.mxSession.state == MXSessionStateRunning) { MXLogDebug(@"[AppDelegate] Universal link: The session is running. Retry the link"); - [self handleUniversalLinkWithParameters:parameters]; + [self handleUniversalLinkWithParameters:universalLinkParameters]; } } }]; @@ -1472,26 +1468,44 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni roomPreviewData.viaServers = queryParams[@"via"]; } + RoomPreviewPresentationParameters *roomPreviewPresentationParameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:restoreInitialDisplay stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; + [account.mxSession.matrixRestClient roomSummaryWith:roomIdOrAlias via:roomPreviewData.viaServers success:^(MXPublicRoom *room) { if ([room.roomTypeString isEqualToString:MXRoomTypeStringSpace]) { [homeViewController stopActivityIndicator]; - self.spaceDetailPresenter = [SpaceDetailPresenter new]; - self.spaceDetailPresenter.delegate = self; - [self.spaceDetailPresenter presentForSpaceWithPublicRoom:room from:self.masterNavigationController sourceView:nil session:account.mxSession animated:YES]; + SpacePreviewPresentationParameters *spacePreviewPresentationParameters = [[SpacePreviewPresentationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay]; + + [self showSpacePreviewWithParameters:spacePreviewPresentationParameters]; } else { - [self peekInRoomWithId:roomIdOrAlias forPreviewData:roomPreviewData params:pathParams]; + [self peekInRoomWithPresentationParameters:roomPreviewPresentationParameters pathParams:pathParams]; } } failure:^(NSError *error) { - [self peekInRoomWithId:roomIdOrAlias forPreviewData:roomPreviewData params:pathParams]; + [self peekInRoomWithPresentationParameters:roomPreviewPresentationParameters pathParams:pathParams]; }]; } } - }]; + }; + + + // We will display something but we need to do some requests before. + // So, come back to the home VC and show its loading wheel while processing + + if (restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + findRoom(); + }]; + } + else + { + findRoom(); + } + // Let's say we are handling the case continueUserActivity = YES; @@ -1511,7 +1525,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if ([universalLinkFragmentPending isEqualToString:fragment]) { MXLogDebug(@"[AppDelegate] Universal link: The user is now logged in. Retry the link"); - [self handleUniversalLinkWithParameters:parameters]; + [self handleUniversalLinkWithParameters:universalLinkParameters]; } }]; } @@ -1576,7 +1590,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if ([universalLinkFragmentPending isEqualToString:fragment]) { MXLogDebug(@"[AppDelegate] Universal link: The user is now logged in. Retry the link"); - [self handleUniversalLinkWithParameters:parameters]; + [self handleUniversalLinkWithParameters:universalLinkParameters]; } }]; } @@ -1594,7 +1608,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Unknown command: Do nothing except coming back to the main screen MXLogDebug(@"[AppDelegate] Universal link: TODO: Do not know what to do with the link arguments: %@", pathParams); - [self popToHomeViewControllerAnimated:NO completion:nil]; + if (restoreInitialDisplay) + { + [self popToHomeViewControllerAnimated:NO completion:nil]; + } } return continueUserActivity; @@ -1618,8 +1635,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)peekInRoomWithId:(NSString*)roomIdOrAlias forPreviewData:(RoomPreviewData *)roomPreviewData params:(NSArray *)pathParams +- (void)peekInRoomWithPresentationParameters:(RoomPreviewPresentationParameters*)presentationParameters pathParams:(NSArray *)pathParams { + RoomPreviewData *roomPreviewData = presentationParameters.previewData; + NSString *roomIdOrAlias = presentationParameters.roomId; + // Is it a link to an event of a room? // If yes, the event will be displayed once the room is joined roomPreviewData.eventId = (pathParams.count >= 3) ? pathParams[2] : nil; @@ -1641,7 +1661,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } self->universalLinkFragmentPendingRoomAlias = nil; - [self showRoomPreview:roomPreviewData]; + [self showRoomPreviewWithParameters:presentationParameters]; }]; } @@ -2893,6 +2913,60 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self showRoomPreviewWithParameters:parameters]; } +- (void)showSpacePreviewWithParameters:(SpacePreviewPresentationParameters*)parameters +{ + UIViewController *presentingViewController = self.presentedViewController; + UIView *sourceView = presentingViewController.view; + + self.spaceDetailPresenter = [SpaceDetailPresenter new]; + self.spaceDetailPresenter.delegate = self; + + void(^showSpace)(void) = ^{ + [self.spaceDetailPresenter presentForSpaceWithPublicRoom:parameters.publicRoom + from:presentingViewController sourceView:sourceView + session:parameters.mxSession animated:YES]; + }; + + if (parameters.restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + showSpace(); + }]; + } + else + { + showSpace(); + } +} + +- (void)showSpaceWithParameters:(SpacePresentationParameters*)parameters +{ + UIViewController *presentingViewController = self.presentedViewController; + UIView *sourceView = presentingViewController.view; + + self.spaceDetailPresenter = [SpaceDetailPresenter new]; + self.spaceDetailPresenter.delegate = self; + + void(^showSpace)(void) = ^{ + [self.spaceDetailPresenter presentForSpaceWithId:parameters.roomId + from:presentingViewController + sourceView:sourceView + session:parameters.mxSession + animated:YES]; + }; + + if (parameters.restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + showSpace(); + }]; + } + else + { + showSpace(); + } +} + - (void)setVisibleRoomId:(NSString *)roomId { if (roomId) From 0c2433950e24957d58c068bbf29440bfca660238 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Oct 2021 19:33:21 +0200 Subject: [PATCH 14/61] SpaceDetailPresenter: Fix source view issue on iPad. --- .../Spaces/SpaceDetail/SpaceDetailPresenter.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift index de3dc6558..ec928bd90 100644 --- a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift +++ b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift @@ -88,17 +88,17 @@ class SpaceDetailPresenter: NSObject { private func present(_ viewController: SpaceDetailViewController, animated: Bool) { + guard let presentingViewController = self.presentingViewController?.presentedViewController ?? self.presentingViewController else { + MXLog.error("[SpaceDetailPresenter] present no presentingViewController found") + return + } + if UIDevice.current.isPhone { - guard let rootViewController = self.presentingViewController else { - MXLog.error("[SpaceDetailPresenter] present no rootViewController found") - return - } - - slidingModalPresenter.present(viewController, from: rootViewController.presentedViewController ?? rootViewController, animated: true, completion: nil) + slidingModalPresenter.present(viewController, from: presentingViewController, animated: true, completion: nil) } else { // Configure source view when view controller is presented with a popover viewController.modalPresentationStyle = .popover - if let popoverPresentationController = viewController.popoverPresentationController, let sourceView = sourceView ?? viewController.view { + if let popoverPresentationController = viewController.popoverPresentationController, let sourceView = sourceView ?? presentingViewController.view { popoverPresentationController.sourceView = sourceView popoverPresentationController.sourceRect = sourceView.bounds From 687df745d1f586c51ff87e478dabf0c5f9e9a629 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:28:39 +0200 Subject: [PATCH 15/61] Create UniversalLinkPresentationParameters. --- .../UniversalLinkPresentationParameters.swift | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Riot/Modules/Application/UniversalLinkPresentationParameters.swift diff --git a/Riot/Modules/Application/UniversalLinkPresentationParameters.swift b/Riot/Modules/Application/UniversalLinkPresentationParameters.swift new file mode 100644 index 000000000..14164e544 --- /dev/null +++ b/Riot/Modules/Application/UniversalLinkPresentationParameters.swift @@ -0,0 +1,61 @@ +// +// 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 used when a universla link is triggered +@objcMembers +class UniversalLinkPresentationParameters: NSObject { + + // MARK: - Properties + + /// Indicate to pop to home and restore initial view hierarchy + let restoreInitialDisplay: Bool + + /// Indicate to stack above visible views + /// If this variable is set to true `restoreInitialDisplay` should be set to false to have effect + let stackAboveVisibleViews: Bool + + /// The object that triggers the universal link action. + let sender: AnyObject? + + /// The view containing the anchor rectangle for the popover. Useful for iPad if a universlink trigger a pop over. + let sourceView: UIView? + + /// The view controller from which the universal link is triggered + var presentingViewController: UIViewController? { + return self.sender as? UIViewController + } + + // MARK: - Properties + + init(restoreInitialDisplay: Bool, + stackAboveVisibleViews: Bool, + sender: AnyObject?, + sourceView: UIView?) { + self.restoreInitialDisplay = restoreInitialDisplay + self.stackAboveVisibleViews = stackAboveVisibleViews + self.sender = sender + self.sourceView = sourceView + + super.init() + } + + /// For the moment this initializer assume that `stackAboveVisibleViews = false` means `restoreInitialDisplay = true` and the opposite + convenience init(stackAboveVisibleViews: Bool) { + self.init(restoreInitialDisplay: !stackAboveVisibleViews, stackAboveVisibleViews: stackAboveVisibleViews, sender: nil, sourceView: nil) + } +} From b8b42bd0471bbaea18619ba15b1e8699ac484e98 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:30:49 +0200 Subject: [PATCH 16/61] UniversalLinkParameters: Add presentation parameters property. --- .../DeepLink/UniversalLinkParameters.swift | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift index baf2dbe94..d70dccb4c 100644 --- a/Riot/Modules/DeepLink/UniversalLinkParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -27,33 +27,46 @@ class UniversalLinkParameters: NSObject { /// The fragment part of the universal link let fragment: String - - /// Indicates if the view to open after the link should replace or be stacked on visible views - let stackAboveVisibleViewsOnRedirect: Bool + + /// Presentation parameters + let presentationParameters: UniversalLinkPresentationParameters // MARK: - Setup init(fragment: String, universalLinkURL: URL, - stackAboveVisibleViewsOnRedirect: Bool) { + presentationParameters: UniversalLinkPresentationParameters) { self.fragment = fragment self.universalLinkURL = universalLinkURL - self.stackAboveVisibleViewsOnRedirect = stackAboveVisibleViewsOnRedirect + self.presentationParameters = presentationParameters super.init() } - init?(universalLinkURL: URL, + convenience init(fragment: String, + universalLinkURL: URL, stackAboveVisibleViewsOnRedirect: Bool) { + let presentationParameters = UniversalLinkPresentationParameters( stackAboveVisibleViews: stackAboveVisibleViewsOnRedirect) + + self.init(fragment: fragment, universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) + } + + convenience init?(universalLinkURL: URL, + presentationParameters: UniversalLinkPresentationParameters) { + guard let fixedURL = Tools.fixURL(withSeveralHashKeys: universalLinkURL), let fragment = fixedURL.fragment else { return nil } - self.fragment = fragment - self.universalLinkURL = universalLinkURL - self.stackAboveVisibleViewsOnRedirect = stackAboveVisibleViewsOnRedirect + self.init(fragment: fragment, universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) + } + + convenience init?(universalLinkURL: URL, + stackAboveVisibleViewsOnRedirect: Bool) { - super.init() + let presentationParameters = UniversalLinkPresentationParameters( stackAboveVisibleViews: stackAboveVisibleViewsOnRedirect) + + self.init(universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) } } From 477b02c8de7a7cd5b272b67c735c5aec5a105ecf Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:31:19 +0200 Subject: [PATCH 17/61] SpacePresentationParameters: Update with UniversalLinkPresentationParameters. --- .../Modules/Application/SpacePresentationParameters.swift | 8 ++++---- .../Application/SpacePreviewPresentationParameters.swift | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Riot/Modules/Application/SpacePresentationParameters.swift b/Riot/Modules/Application/SpacePresentationParameters.swift index 68357d2fe..54c1a3b0f 100644 --- a/Riot/Modules/Application/SpacePresentationParameters.swift +++ b/Riot/Modules/Application/SpacePresentationParameters.swift @@ -28,17 +28,17 @@ class SpacePresentationParameters: NSObject { /// The Matrix session in which the room should be available. let mxSession: MXSession - /// Indicate to pop to home and restore initial view hierarchy - let restoreInitialDisplay: Bool + /// Universal link presentation parameters. + let presentationParameters: UniversalLinkPresentationParameters // MARK: - Setup init(roomId: String, mxSession: MXSession, - restoreInitialDisplay: Bool) { + presentationParameters: UniversalLinkPresentationParameters) { self.roomId = roomId self.mxSession = mxSession - self.restoreInitialDisplay = restoreInitialDisplay + self.presentationParameters = presentationParameters super.init() } diff --git a/Riot/Modules/Application/SpacePreviewPresentationParameters.swift b/Riot/Modules/Application/SpacePreviewPresentationParameters.swift index a26a953ef..72ff1fc97 100644 --- a/Riot/Modules/Application/SpacePreviewPresentationParameters.swift +++ b/Riot/Modules/Application/SpacePreviewPresentationParameters.swift @@ -29,9 +29,9 @@ class SpacePreviewPresentationParameters: SpacePresentationParameters { init(publicRoom: MXPublicRoom, mxSession: MXSession, - restoreInitialDisplay: Bool) { + presentationParameters: UniversalLinkPresentationParameters) { self.publicRoom = publicRoom - super.init(roomId: publicRoom.roomId, mxSession: mxSession, restoreInitialDisplay: restoreInitialDisplay) + super.init(roomId: publicRoom.roomId, mxSession: mxSession, presentationParameters: presentationParameters) } } From 9d6946ddf1535b469ad7e6898b2117438462ba01 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:32:04 +0200 Subject: [PATCH 18/61] RoomVC: Update with UniversalLinkPresentationParameters. --- Riot/Modules/Room/RoomViewController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 373b70109..c232f1889 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2197,16 +2197,21 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; return [[AppDelegate theDelegate] showAlertWithTitle:title message:message]; } +- (UniversalLinkPresentationParameters*)buildUniversalLinkPresentationParamters +{ + return [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; +} + - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL { - UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithUniversalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:BuildSettings.allowSplitViewDetailsScreenStacking]; + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithUniversalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParamters]]; return [self handleUniversalLinkWithParameters:parameters]; } - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL { UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment - universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:BuildSettings.allowSplitViewDetailsScreenStacking]; + universalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParamters]]; return [self handleUniversalLinkWithParameters:parameters]; } From 81698d113c5434ddfafd60fa10910ba07152b22a Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:37:13 +0200 Subject: [PATCH 19/61] LegacyAppDelegate: Handle UniversalLinkPresentationParameters for space presentation. --- Riot/Modules/Application/LegacyAppDelegate.m | 43 +++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index a1167f3ba..8ef488f6d 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1249,8 +1249,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSString *fragment = universalLinkParameters.fragment; NSURL *universalLinkURL = universalLinkParameters.universalLinkURL; - BOOL stackAboveVisibleViewsOnRedirect = universalLinkParameters.stackAboveVisibleViewsOnRedirect; - BOOL restoreInitialDisplay = !stackAboveVisibleViewsOnRedirect; + UniversalLinkPresentationParameters *universalLinkPresentationParameters = universalLinkParameters.presentationParameters; + BOOL stackAboveVisibleViewsOnRedirect = universalLinkPresentationParameters.stackAboveVisibleViews; + BOOL restoreInitialDisplay = universalLinkPresentationParameters.restoreInitialDisplay; BOOL continueUserActivity = NO; MXKAccountManager *accountManager = [MXKAccountManager sharedManager]; @@ -1352,7 +1353,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (room.summary.roomType == MXRoomTypeSpace) { - SpacePresentationParameters *spacePresentationParameters = [[SpacePresentationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay]; + SpacePresentationParameters *spacePresentationParameters = [[SpacePresentationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; [self showSpaceWithParameters:spacePresentationParameters]; } @@ -1409,7 +1410,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { universalLinkFragmentPendingRoomAlias = @{roomId: roomIdOrAlias}; - UniversalLinkParameters *newParameters = [[UniversalLinkParameters alloc] initWithFragment:newUniversalLinkFragment universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:stackAboveVisibleViewsOnRedirect]; + UniversalLinkParameters *newParameters = [[UniversalLinkParameters alloc] initWithFragment:newUniversalLinkFragment universalLinkURL:universalLinkURL presentationParameters:universalLinkPresentationParameters]; [self handleUniversalLinkWithParameters:newParameters]; } @@ -1475,7 +1476,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { [homeViewController stopActivityIndicator]; - SpacePreviewPresentationParameters *spacePreviewPresentationParameters = [[SpacePreviewPresentationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay]; + SpacePreviewPresentationParameters *spacePreviewPresentationParameters = [[SpacePreviewPresentationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; [self showSpacePreviewWithParameters:spacePreviewPresentationParameters]; } @@ -2915,8 +2916,18 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showSpacePreviewWithParameters:(SpacePreviewPresentationParameters*)parameters { - UIViewController *presentingViewController = self.presentedViewController; - UIView *sourceView = presentingViewController.view; + UIViewController *presentingViewController; + UIView *sourceView; + + if (parameters.presentationParameters.presentingViewController) + { + presentingViewController = parameters.presentationParameters.presentingViewController; + sourceView = parameters.presentationParameters.sourceView; + } + else + { + presentingViewController = self.masterNavigationController; + } self.spaceDetailPresenter = [SpaceDetailPresenter new]; self.spaceDetailPresenter.delegate = self; @@ -2927,7 +2938,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni session:parameters.mxSession animated:YES]; }; - if (parameters.restoreInitialDisplay) + if (parameters.presentationParameters.restoreInitialDisplay) { [self restoreInitialDisplay:^{ showSpace(); @@ -2941,8 +2952,18 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showSpaceWithParameters:(SpacePresentationParameters*)parameters { - UIViewController *presentingViewController = self.presentedViewController; - UIView *sourceView = presentingViewController.view; + UIViewController *presentingViewController; + UIView *sourceView; + + if (parameters.presentationParameters.presentingViewController) + { + presentingViewController = parameters.presentationParameters.presentingViewController; + sourceView = parameters.presentationParameters.sourceView; + } + else + { + presentingViewController = self.masterNavigationController; + } self.spaceDetailPresenter = [SpaceDetailPresenter new]; self.spaceDetailPresenter.delegate = self; @@ -2955,7 +2976,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni animated:YES]; }; - if (parameters.restoreInitialDisplay) + if (parameters.presentationParameters.restoreInitialDisplay) { [self restoreInitialDisplay:^{ showSpace(); From cbd618fd9e048f3f98acc20b70ddcd1daeeb9334 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 07:50:20 +0200 Subject: [PATCH 20/61] Move files. --- .../{ => ScreenPresentation}/RoomPresentationParameters.swift | 0 .../RoomPreviewPresentationParameters.swift | 0 .../{ => ScreenPresentation}/SpacePresentationParameters.swift | 0 .../SpacePreviewPresentationParameters.swift | 0 .../UniversalLinkPresentationParameters.swift | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename Riot/Modules/Application/{ => ScreenPresentation}/RoomPresentationParameters.swift (100%) rename Riot/Modules/Application/{ => ScreenPresentation}/RoomPreviewPresentationParameters.swift (100%) rename Riot/Modules/Application/{ => ScreenPresentation}/SpacePresentationParameters.swift (100%) rename Riot/Modules/Application/{ => ScreenPresentation}/SpacePreviewPresentationParameters.swift (100%) rename Riot/Modules/{Application => DeepLink}/UniversalLinkPresentationParameters.swift (100%) diff --git a/Riot/Modules/Application/RoomPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/RoomPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift diff --git a/Riot/Modules/Application/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/RoomPreviewPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/SpacePresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/SpacePresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift diff --git a/Riot/Modules/Application/SpacePreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/SpacePreviewPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/UniversalLinkPresentationParameters.swift b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/UniversalLinkPresentationParameters.swift rename to Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift From 1791fe4688aaa8c6f75393d854f4b53c3975b643 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 08:29:15 +0200 Subject: [PATCH 21/61] RoomPresentationParameters: Use UniversalLinkPresentationParameters. --- .../RoomPresentationParameters.swift | 14 ++++---------- .../RoomPreviewPresentationParameters.swift | 8 +++----- .../UniversalLinkPresentationParameters.swift | 9 +++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift index 46019f222..6f36f2e54 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift @@ -31,25 +31,19 @@ class RoomPresentationParameters: NSObject { /// The Matrix session in which the room should be available. let mxSession: MXSession - /// Indicate to pop to home and restore initial view hierarchy - let restoreInitialDisplay: Bool - - /// Indicate to stack above visible views - /// If this variable is set to true `restoreInitialDisplay` should be set to false to have effect - let stackAboveVisibleViews: Bool + /// Universal link presentation parameters. + let presentationParameters: UniversalLinkPresentationParameters // MARK: - Setup init(roomId: String, eventId: String?, mxSession: MXSession, - restoreInitialDisplay: Bool, - stackAboveVisibleViews: Bool) { + presentationParameters: UniversalLinkPresentationParameters) { self.roomId = roomId self.eventId = eventId self.mxSession = mxSession - self.restoreInitialDisplay = restoreInitialDisplay - self.stackAboveVisibleViews = stackAboveVisibleViews + self.presentationParameters = presentationParameters super.init() } diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift index b84b25c0d..1b71f5e57 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift @@ -28,13 +28,11 @@ class RoomPreviewPresentationParameters: RoomPresentationParameters { // MARK: - Setup - init(previewData: RoomPreviewData, restoreInitialDisplay: Bool, stackAboveVisibleViews: Bool) { + init(previewData: RoomPreviewData, presentationParameters: UniversalLinkPresentationParameters) { self.previewData = previewData - + super.init(roomId: previewData.roomId, eventId: previewData.eventId, - mxSession: previewData.mxSession, - restoreInitialDisplay: restoreInitialDisplay, - stackAboveVisibleViews: stackAboveVisibleViews) + mxSession: previewData.mxSession, presentationParameters: presentationParameters) } } diff --git a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift index 14164e544..36c2fb79f 100644 --- a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift @@ -52,6 +52,15 @@ class UniversalLinkPresentationParameters: NSObject { self.sourceView = sourceView super.init() + } + + convenience init(restoreInitialDisplay: Bool, stackAboveVisibleViews: Bool) { + self.init(restoreInitialDisplay: restoreInitialDisplay, stackAboveVisibleViews: stackAboveVisibleViews, sender: nil, sourceView: nil) + } + + /// In this initializer `stackAboveVisibleViews` is set to false` + convenience init(restoreInitialDisplay: Bool) { + self.init(restoreInitialDisplay: restoreInitialDisplay, stackAboveVisibleViews: false, sender: nil, sourceView: nil) } /// For the moment this initializer assume that `stackAboveVisibleViews = false` means `restoreInitialDisplay = true` and the opposite From 61a1bf1aaff2c53d93b56766830d172a5d141cb7 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 08:31:51 +0200 Subject: [PATCH 22/61] Update RoomPresentationParameters usage. --- Riot/Modules/Application/LegacyAppDelegate.m | 19 ++++++++++++------- .../Common/Recents/RecentsViewController.m | 11 +++++++---- .../Files/HomeFilesSearchViewController.m | 4 +++- .../HomeMessagesSearchViewController.m | 4 +++- .../Rooms/DirectoryViewController.m | 9 ++++++--- Riot/Modules/TabBar/TabBarCoordinator.swift | 4 ++-- 6 files changed, 33 insertions(+), 18 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 8ef488f6d..03c7c7656 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1250,7 +1250,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni NSString *fragment = universalLinkParameters.fragment; NSURL *universalLinkURL = universalLinkParameters.universalLinkURL; UniversalLinkPresentationParameters *universalLinkPresentationParameters = universalLinkParameters.presentationParameters; - BOOL stackAboveVisibleViewsOnRedirect = universalLinkPresentationParameters.stackAboveVisibleViews; BOOL restoreInitialDisplay = universalLinkPresentationParameters.restoreInitialDisplay; BOOL continueUserActivity = NO; @@ -1360,7 +1359,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni else { // Open the room page - RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession restoreInitialDisplay:restoreInitialDisplay stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; + RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; [self showRoomWithParameters:roomPresentationParameters]; } @@ -1469,7 +1468,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni roomPreviewData.viaServers = queryParams[@"via"]; } - RoomPreviewPresentationParameters *roomPreviewPresentationParameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:restoreInitialDisplay stackAboveVisibleViews:stackAboveVisibleViewsOnRedirect]; + RoomPreviewPresentationParameters *roomPreviewPresentationParameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; [account.mxSession.matrixRestClient roomSummaryWith:roomIdOrAlias via:roomPreviewData.viaServers success:^(MXPublicRoom *room) { if ([room.roomTypeString isEqualToString:MXRoomTypeStringSpace]) @@ -2829,7 +2828,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSString *roomId = parameters.roomId; MXSession *mxSession = parameters.mxSession; - BOOL restoreInitialDisplay = parameters.restoreInitialDisplay; + BOOL restoreInitialDisplay = parameters.presentationParameters. restoreInitialDisplay; if (roomId && mxSession) { @@ -2878,8 +2877,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession { + // Ask to restore initial display + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId - eventId:eventId mxSession:mxSession restoreInitialDisplay:YES stackAboveVisibleViews:NO]; + eventId:eventId mxSession:mxSession presentationParameters:presentationParameters]; [self showRoomWithParameters:parameters]; } @@ -2890,7 +2892,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self.masterTabBarController selectRoomPreviewWithParameters:parameters completion:completion]; }; - if (parameters.restoreInitialDisplay) + if (parameters.presentationParameters.restoreInitialDisplay) { [self restoreInitialDisplay:^{ showRoomPreview(); @@ -2909,7 +2911,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showRoomPreview:(RoomPreviewData*)roomPreviewData { - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:YES stackAboveVisibleViews:NO]; + // Ask to restore initial display + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; + + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [self showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index e5d5b6339..a93f6494e 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -862,9 +862,10 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro self.userInteractionEnabled = NO; // Do not stack views when showing room + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil - mxSession:matrixSession restoreInitialDisplay:NO - stackAboveVisibleViews:NO]; + mxSession:matrixSession presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters completion:^{ self.userInteractionEnabled = YES; @@ -873,8 +874,10 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData { - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData - restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + // Do not stack views when showing room + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil]; + + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index 84dd46897..d1dbdde12 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -143,9 +143,11 @@ andEventId:(NSString*)eventId inMatrixSession:(MXSession*)session { + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:session - restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index 6c905f6fb..a850228b9 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -150,9 +150,11 @@ andEventId:(NSString*)eventId inMatrixSession:(MXSession*)session { + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:session - restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index c7c04221d..fa6e93929 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -234,15 +234,18 @@ - (void)openRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession { + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession - restoreInitialDisplay:NO stackAboveVisibleViews:NO]; + presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } - (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData { - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData restoreInitialDisplay:NO - stackAboveVisibleViews:NO]; + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters: presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 89c6d6b85..55679c252 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -382,7 +382,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { eventId: roomPresentationParameters.eventId) self.showRoom(with: roomCoordinatorParameters, - stackOnSplitViewDetail: roomPresentationParameters.stackAboveVisibleViews, + stackOnSplitViewDetail: roomPresentationParameters.presentationParameters.stackAboveVisibleViews, completion: completion) } @@ -412,7 +412,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { previewData: roomPreviewPresentationParameters.previewData) self.showRoom(with: roomCoordinatorParameters, - stackOnSplitViewDetail: roomPreviewPresentationParameters.stackAboveVisibleViews, + stackOnSplitViewDetail: roomPreviewPresentationParameters.presentationParameters.stackAboveVisibleViews, completion: completion) } From bf063d076af10fbbf1aecaab4631e5715765a984 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 08:57:19 +0200 Subject: [PATCH 23/61] SplitViewPresentable: Add possiblity to reset detail stack. --- Riot/Modules/SplitView/SplitViewCoordinator.swift | 4 ++++ Riot/Modules/SplitView/SplitViewPresentable.swift | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Riot/Modules/SplitView/SplitViewCoordinator.swift b/Riot/Modules/SplitView/SplitViewCoordinator.swift index 1fd948dd0..479ebf702 100644 --- a/Riot/Modules/SplitView/SplitViewCoordinator.swift +++ b/Riot/Modules/SplitView/SplitViewCoordinator.swift @@ -351,4 +351,8 @@ extension SplitViewCoordinator: SplitViewMasterPresentableDelegate { detailNavigationRouter.push(detailPresentable, animated: true, popCompletion: popCompletion) } + + func splitViewMasterPresentableWantsToResetDetail(_ presentable: Presentable) { + self.resetDetailNavigationControllerWithPlaceholder(animated: false) + } } diff --git a/Riot/Modules/SplitView/SplitViewPresentable.swift b/Riot/Modules/SplitView/SplitViewPresentable.swift index 3521c76bd..7932a4815 100644 --- a/Riot/Modules/SplitView/SplitViewPresentable.swift +++ b/Riot/Modules/SplitView/SplitViewPresentable.swift @@ -26,6 +26,9 @@ protocol SplitViewMasterPresentableDelegate: AnyObject { /// Stack the detailPresentable on the existing split view detail stack func splitViewMasterPresentable(_ presentable: Presentable, wantsToStack detailPresentable: Presentable, popCompletion: (() -> Void)?) + + /// Reset detail stack with placeholder + func splitViewMasterPresentableWantsToResetDetail(_ presentable: Presentable) } /// `SplitViewMasterPresentableDelegate` default implementation From 8ef534a08864fe4a6e8af8962c0cf2654d651a33 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 08:57:55 +0200 Subject: [PATCH 24/61] TabBarCoordinator: Reset split view detail on room leave. --- Riot/Modules/TabBar/TabBarCoordinator.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 55679c252..47c198ae1 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -446,6 +446,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } } + // MARK: Split view + /// If the split view is collapsed (one column visible) it will push the Presentable on the primary navigation controller, otherwise it will show the Presentable as the secondary view of the split view. private func replaceSplitViewDetails(with presentable: Presentable, popCompletion: (() -> Void)? = nil) { self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToReplaceDetailWith: presentable, popCompletion: popCompletion) @@ -465,6 +467,10 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } } + private func resetSplitViewDetails() { + self.splitViewMasterPresentableDelegate?.splitViewMasterPresentableWantsToResetDetail(self) + } + // MARK: UserSessions management private func registerUserSessionsServiceNotifications() { @@ -566,7 +572,8 @@ extension TabBarCoordinator: RoomCoordinatorDelegate { } func roomCoordinatorDidLeaveRoom(_ coordinator: RoomCoordinatorProtocol) { - self.navigationRouter.popModule(animated: true) + // For the moment when a room is leaved reset the split detail with placeholder + self.resetSplitViewDetails() } func roomCoordinatorDidCancelRoomPreview(_ coordinator: RoomCoordinatorProtocol) { From cb3025da19e9f38f8945e3823559959d43df9791 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 09:21:02 +0200 Subject: [PATCH 25/61] RoomVC: Fix typo. --- Riot/Modules/Room/RoomViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index c232f1889..357e19b69 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2197,21 +2197,21 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; return [[AppDelegate theDelegate] showAlertWithTitle:title message:message]; } -- (UniversalLinkPresentationParameters*)buildUniversalLinkPresentationParamters +- (UniversalLinkPresentationParameters*)buildUniversalLinkPresentationParameters { return [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; } - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL { - UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithUniversalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParamters]]; + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithUniversalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParameters]]; return [self handleUniversalLinkWithParameters:parameters]; } - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL { UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment - universalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParamters]]; + universalLinkURL:universalLinkURL presentationParameters:[self buildUniversalLinkPresentationParameters]]; return [self handleUniversalLinkWithParameters:parameters]; } From 8538d8e0aac381cacf10fbafe6e6e1e17cc50878 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 11:57:56 +0200 Subject: [PATCH 26/61] LegacyAppDelegate: Handle universal link presentation parameters when showing contact. --- Riot/Modules/Application/LegacyAppDelegate.m | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 03c7c7656..e1a93f972 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1553,7 +1553,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Create the contact related to this member MXKContact *contact = [[MXKContact alloc] initMatrixContactWithDisplayName:displayName andMatrixID:userId]; - [self showContact:contact]; + [self showContact:contact presentationParameters:universalLinkPresentationParameters]; continueUserActivity = YES; } @@ -3105,13 +3105,22 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - Contacts handling -- (void)showContact:(MXKContact*)contact +- (void)showContact:(MXKContact*)contact presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters { - [self restoreInitialDisplay:^{ - + void(^showContact)(void) = ^{ [self.masterTabBarController selectContact:contact]; - - }]; + }; + + if (presentationParameters.restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + showContact(); + }]; + } + else + { + showContact(); + } } #pragma mark - Matrix Groups handling From c9491551340ba38e42bc5a140a92384fa5a751bb Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 12:29:01 +0200 Subject: [PATCH 27/61] LegacyAppDelegate: Handle show group with universal link presentation parameters. --- Riot/Modules/Application/LegacyAppDelegate.m | 27 ++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index e1a93f972..d9ba969ee 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1240,7 +1240,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL { - UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment universalLinkURL:universalLinkURL stackAboveVisibleViewsOnRedirect:NO]; + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + + UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment universalLinkURL:universalLinkURL presentationParameters:presentationParameters]; return [self handleUniversalLinkWithParameters:parameters]; } @@ -1572,7 +1574,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } // Display the group details - [self showGroup:group withMatrixSession:account.mxSession]; + [self showGroup:group withMatrixSession:account.mxSession presentationParamters:universalLinkPresentationParameters]; continueUserActivity = YES; } @@ -3125,14 +3127,23 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - Matrix Groups handling -- (void)showGroup:(MXGroup*)group withMatrixSession:(MXSession*)mxSession +- (void)showGroup:(MXGroup*)group withMatrixSession:(MXSession*)mxSession presentationParamters:(UniversalLinkPresentationParameters*)presentationParameters { - [self restoreInitialDisplay:^{ - + void(^showGroup)(void) = ^{ // Select group to display its details (dispatch this action in order to let TabBarController end its refresh) - [_masterTabBarController selectGroup:group inMatrixSession:mxSession]; - - }]; + [self.masterTabBarController selectGroup:group inMatrixSession:mxSession]; + }; + + if (presentationParameters.restoreInitialDisplay) + { + [self restoreInitialDisplay:^{ + showGroup(); + }]; + } + else + { + showGroup(); + } } - (void)promptForStunServerFallback From 9e0cf5a65af7eed7912bf0e0e9a1de78a6f62340 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 12:29:49 +0200 Subject: [PATCH 28/61] UniversalLinkParameters & UniversalLinkPresentationParameters remove useless initializers. --- .../DeepLink/UniversalLinkParameters.swift | 17 ----------------- .../UniversalLinkPresentationParameters.swift | 5 ----- 2 files changed, 22 deletions(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift index d70dccb4c..ded621196 100644 --- a/Riot/Modules/DeepLink/UniversalLinkParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -43,15 +43,6 @@ class UniversalLinkParameters: NSObject { super.init() } - convenience init(fragment: String, - universalLinkURL: URL, - stackAboveVisibleViewsOnRedirect: Bool) { - - let presentationParameters = UniversalLinkPresentationParameters( stackAboveVisibleViews: stackAboveVisibleViewsOnRedirect) - - self.init(fragment: fragment, universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) - } - convenience init?(universalLinkURL: URL, presentationParameters: UniversalLinkPresentationParameters) { @@ -61,12 +52,4 @@ class UniversalLinkParameters: NSObject { self.init(fragment: fragment, universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) } - - convenience init?(universalLinkURL: URL, - stackAboveVisibleViewsOnRedirect: Bool) { - - let presentationParameters = UniversalLinkPresentationParameters( stackAboveVisibleViews: stackAboveVisibleViewsOnRedirect) - - self.init(universalLinkURL: universalLinkURL, presentationParameters: presentationParameters) - } } diff --git a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift index 36c2fb79f..eed0dd9f0 100644 --- a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift @@ -62,9 +62,4 @@ class UniversalLinkPresentationParameters: NSObject { convenience init(restoreInitialDisplay: Bool) { self.init(restoreInitialDisplay: restoreInitialDisplay, stackAboveVisibleViews: false, sender: nil, sourceView: nil) } - - /// For the moment this initializer assume that `stackAboveVisibleViews = false` means `restoreInitialDisplay = true` and the opposite - convenience init(stackAboveVisibleViews: Bool) { - self.init(restoreInitialDisplay: !stackAboveVisibleViews, stackAboveVisibleViews: stackAboveVisibleViews, sender: nil, sourceView: nil) - } } From d0ef8433021eb4345c38e7dcc10cc4de32fe4f1e Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 15:55:46 +0200 Subject: [PATCH 29/61] UniversalLink: Improve group and contact presentation behaviour. --- Riot/Modules/Application/LegacyAppDelegate.m | 4 ++-- Riot/Modules/TabBar/MasterTabBarController.h | 11 ++++++++--- Riot/Modules/TabBar/MasterTabBarController.m | 18 ++++++++++++++++-- Riot/Modules/TabBar/TabBarCoordinator.swift | 17 ++++++++--------- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index d9ba969ee..41ca783ad 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -3110,7 +3110,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showContact:(MXKContact*)contact presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters { void(^showContact)(void) = ^{ - [self.masterTabBarController selectContact:contact]; + [self.masterTabBarController selectContact:contact withPresentationParameters:presentationParameters]; }; if (presentationParameters.restoreInitialDisplay) @@ -3131,7 +3131,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { void(^showGroup)(void) = ^{ // Select group to display its details (dispatch this action in order to let TabBarController end its refresh) - [self.masterTabBarController selectGroup:group inMatrixSession:mxSession]; + [self.masterTabBarController selectGroup:group inMatrixSession:mxSession presentationParameters:presentationParameters]; }; if (presentationParameters.restoreInitialDisplay) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index b9a40a00a..a548b570b 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -44,6 +44,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { @protocol MasterTabBarControllerDelegate; @class RoomPresentationParameters; @class RoomPreviewPresentationParameters; +@class UniversalLinkPresentationParameters; @interface MasterTabBarController : UITabBarController @@ -96,14 +97,18 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { */ - (void)selectContact:(MXKContact*)contact; +- (void)selectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; + /** Open a GroupDetailsViewController to display the information of the provided group. - @param group + @param group Selected community. @param matrixSession the matrix session in which the group should be available. */ - (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession; +- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; + /** Release the current selected item (if any). */ @@ -189,7 +194,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomPresentationParameters*)roomPresentationParameters completion:(void (^)(void))completion; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomPreviewPresentationParameters completion:(void (^)(void))completion; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; @end diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 291e3282c..a83fed236 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -615,24 +615,38 @@ } - (void)selectContact:(MXKContact*)contact +{ + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + + [self selectContact:contact withPresentationParameters:presentationParameters]; +} + +- (void)selectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters { [self releaseSelectedItem]; _selectedContact = contact; - [self.masterTabBarDelegate masterTabBarController:self didSelectContact:contact]; + [self.masterTabBarDelegate masterTabBarController:self didSelectContact:contact withPresentationParameters:presentationParameters]; [self refreshSelectedControllerSelectedCellIfNeeded]; } - (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession +{ + UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + + [self selectGroup:group inMatrixSession:matrixSession presentationParameters:presentationParameters]; +} + +- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters { [self releaseSelectedItem]; _selectedGroup = group; _selectedGroupSession = matrixSession; - [self.masterTabBarDelegate masterTabBarController:self didSelectGroup:group inMatrixSession:matrixSession]; + [self.masterTabBarDelegate masterTabBarController:self didSelectGroup:group inMatrixSession:matrixSession presentationParameters:presentationParameters]; [self refreshSelectedControllerSelectedCellIfNeeded]; } diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 47c198ae1..99ce129f6 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -340,27 +340,26 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } // FIXME: Should be displayed from a tab. - private func showContactDetails(with contact: MXKContact) { + private func showContactDetails(with contact: MXKContact, presentationParameters: UniversalLinkPresentationParameters) { let coordinatorParameters = ContactDetailsCoordinatorParameters(contact: contact) let coordinator = ContactDetailsCoordinator(parameters: coordinatorParameters) coordinator.start() self.add(childCoordinator: coordinator) - self.replaceSplitViewDetails(with: coordinator) { [weak self] in + self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in self?.remove(childCoordinator: coordinator) } } // FIXME: Should be displayed from a tab. - private func showGroupDetails(with group: MXGroup, for matrixSession: MXSession) { + private func showGroupDetails(with group: MXGroup, for matrixSession: MXSession, presentationParameters: UniversalLinkPresentationParameters) { let coordinatorParameters = GroupDetailsCoordinatorParameters(session: matrixSession, group: group) let coordinator = GroupDetailsCoordinator(parameters: coordinatorParameters) coordinator.start() self.add(childCoordinator: coordinator) - self.replaceSplitViewDetails(with: coordinator) { - [weak self] in + self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in self?.remove(childCoordinator: coordinator) } } @@ -537,8 +536,8 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { self.showRoomPreview(withPresentationParameters: roomPreviewPresentationParameters, completion: completion) } - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!) { - self.showContactDetails(with: contact) + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!, with presentationParameters: UniversalLinkPresentationParameters!) { + self.showContactDetails(with: contact, presentationParameters: presentationParameters) } func masterTabBarControllerDidCompleteAuthentication(_ masterTabBarController: MasterTabBarController!) { @@ -549,8 +548,8 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { self.showRoom(with: roomId, eventId: eventId, matrixSession: matrixSession, completion: completion) } - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect group: MXGroup!, inMatrixSession matrixSession: MXSession!) { - self.showGroupDetails(with: group, for: matrixSession) + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect group: MXGroup!, inMatrixSession matrixSession: MXSession!, presentationParameters: UniversalLinkPresentationParameters!) { + self.showGroupDetails(with: group, for: matrixSession, presentationParameters: presentationParameters) } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, needsSideMenuIconWithNotification displayNotification: Bool) { From b107d615ff5960585a82bc522f3045c5b1af6309 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 15:59:51 +0200 Subject: [PATCH 30/61] Update changes. --- changelog.d/4834.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4834.change diff --git a/changelog.d/4834.change b/changelog.d/4834.change new file mode 100644 index 000000000..a4cc38029 --- /dev/null +++ b/changelog.d/4834.change @@ -0,0 +1 @@ +Navigation: Enable room stacking. \ No newline at end of file From baed10e909fc7700899843040dcda8a52b3e2035 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:24:18 +0200 Subject: [PATCH 31/61] Update Riot/Modules/Common/Recents/RecentsViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Common/Recents/RecentsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 6793412cc..3ae363429 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -865,7 +865,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil - mxSession:matrixSession presentationParameters: presentationParameters]; + mxSession:matrixSession presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters completion:^{ self.userInteractionEnabled = YES; From 9978920be344c52eadca554a9be5ff279cf13205 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:24:35 +0200 Subject: [PATCH 32/61] Update Riot/Modules/Common/Recents/RecentsViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Common/Recents/RecentsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 3ae363429..5f9db04eb 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -877,7 +877,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Do not stack views when showing room UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil]; - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters: presentationParameters]; + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } From 0691c087be4e8e8a1cb6666be085c553bdf01cb3 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:24:50 +0200 Subject: [PATCH 33/61] Update Riot/Modules/Common/Recents/RecentsViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Common/Recents/RecentsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 5f9db04eb..892ec222e 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -1998,7 +1998,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro { // Open the public room [self showRoomWithRoomId:publicRoom.roomId - inMatrixSession:self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession]; + inMatrixSession:self.recentsDataSource.publicRoomsDirectoryDataSource.mxSession]; } else { From 91baf4414564631776a8080e3e05f7ccb912b7fe Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:25:00 +0200 Subject: [PATCH 34/61] Update Riot/Modules/Common/Recents/RecentsViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Common/Recents/RecentsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 892ec222e..4577e5d4a 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -2276,7 +2276,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Room is known show it directly [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ [self showRoomWithRoomId:room.roomId - inMatrixSession:self.mainSession]; + inMatrixSession:self.mainSession]; }]; coordinatorBridgePresenter = nil; } From e620e94af9851c72c03f2b524731ad677a986544 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:26:21 +0200 Subject: [PATCH 35/61] Update Riot/Modules/Common/Recents/RecentsViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Common/Recents/RecentsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 4577e5d4a..84bcc3d03 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -2096,7 +2096,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro MXWeakify(self); [previewData peekInRoom:^(BOOL succeeded) { MXStrongifyAndReturnIfNil(self); - [self stopActivityIndicator]; + [self stopActivityIndicator]; [self showRoomPreviewWithData:previewData]; }]; } From 059d99ca29ddb23050899c764a9775adf6dc11e7 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:27:31 +0200 Subject: [PATCH 36/61] Update Riot/Modules/TabBar/TabBarCoordinator.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/TabBar/TabBarCoordinator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 99ce129f6..828b8be56 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -571,7 +571,7 @@ extension TabBarCoordinator: RoomCoordinatorDelegate { } func roomCoordinatorDidLeaveRoom(_ coordinator: RoomCoordinatorProtocol) { - // For the moment when a room is leaved reset the split detail with placeholder + // For the moment when a room is left, reset the split detail with placeholder self.resetSplitViewDetails() } From dcc0662ebc3c903db32591bb168762490255145f Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:27:42 +0200 Subject: [PATCH 37/61] Update Riot/Modules/Application/LegacyAppDelegate.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Application/LegacyAppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 41ca783ad..1c1daa39a 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -2830,7 +2830,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSString *roomId = parameters.roomId; MXSession *mxSession = parameters.mxSession; - BOOL restoreInitialDisplay = parameters.presentationParameters. restoreInitialDisplay; + BOOL restoreInitialDisplay = parameters.presentationParameters.restoreInitialDisplay; if (roomId && mxSession) { From b36920848d87a3f464dab526073d2d02b1fef7c5 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:32:38 +0200 Subject: [PATCH 38/61] Update Riot/Modules/Application/LegacyAppDelegate.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Application/LegacyAppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 1c1daa39a..babfda1a4 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -2853,7 +2853,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni void (^selectRoom)(void) = ^() { // Select room to display its details (dispatch this action in order to let TabBarController end its refresh) - + [self.masterTabBarController selectRoomWithParameters:parameters completion:^{ // Remove delivered notifications for this room [self.pushNotificationService removeDeliveredNotificationsWithRoomId:roomId completion:nil]; From 54508430d8ce261a8d3a47a253d92ac86ddeb6e6 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:32:57 +0200 Subject: [PATCH 39/61] Update Riot/Modules/Application/LegacyAppDelegate.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Application/LegacyAppDelegate.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index babfda1a4..1479f23ca 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -2941,8 +2941,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni void(^showSpace)(void) = ^{ [self.spaceDetailPresenter presentForSpaceWithPublicRoom:parameters.publicRoom - from:presentingViewController sourceView:sourceView - session:parameters.mxSession animated:YES]; + from:presentingViewController + sourceView:sourceView + session:parameters.mxSession + animated:YES]; }; if (parameters.presentationParameters.restoreInitialDisplay) From 5ee733186c639535f591c7f28c42071ab7e7b429 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:33:13 +0200 Subject: [PATCH 40/61] Update Riot/Modules/DeepLink/UniversalLinkParameters.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/DeepLink/UniversalLinkParameters.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift index ded621196..6438b0ef2 100644 --- a/Riot/Modules/DeepLink/UniversalLinkParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -44,7 +44,7 @@ class UniversalLinkParameters: NSObject { } convenience init?(universalLinkURL: URL, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: UniversalLinkPresentationParameters) { guard let fixedURL = Tools.fixURL(withSeveralHashKeys: universalLinkURL), let fragment = fixedURL.fragment else { return nil From a540719f24e39106bcd5a67ead336c63b1c02f19 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:33:22 +0200 Subject: [PATCH 41/61] Update Riot/Modules/TabBar/TabBarCoordinator.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/TabBar/TabBarCoordinator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 828b8be56..7a76ea736 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -457,7 +457,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.splitViewMasterPresentableDelegate?.splitViewMasterPresentable(self, wantsToStack: presentable, popCompletion: popCompletion) } - private func showSplitViewDetails(with presentable: Presentable, stackOnSplitViewDetail: Bool, popCompletion: (() -> Void)? = nil) { + private func showSplitViewDetails(with presentable: Presentable, stackedOnSplitViewDetail: Bool, popCompletion: (() -> Void)? = nil) { if stackOnSplitViewDetail { self.stackSplitViewDetails(with: presentable, popCompletion: popCompletion) From 74cdd06201b649328f22565528a3217bdf1a6a41 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:33:45 +0200 Subject: [PATCH 42/61] Update Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift index eed0dd9f0..b3f2f37b6 100644 --- a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift @@ -16,7 +16,7 @@ import Foundation -/// Presentation parameters used when a universla link is triggered +/// Presentation parameters used when a universal link is triggered @objcMembers class UniversalLinkPresentationParameters: NSObject { From 0e1c67fb2dae3edd05a0aaf12a1f8f5631f4b898 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:35:02 +0200 Subject: [PATCH 43/61] Update Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift index b3f2f37b6..58fc9a29e 100644 --- a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift @@ -35,7 +35,7 @@ class UniversalLinkPresentationParameters: NSObject { /// The view containing the anchor rectangle for the popover. Useful for iPad if a universlink trigger a pop over. let sourceView: UIView? - /// The view controller from which the universal link is triggered + /// The view controller from which the universal link is triggered. `nil` if triggered from some other kind of object. var presentingViewController: UIViewController? { return self.sender as? UIViewController } From 3ae15dd794f6c5fa355cb714c06c66fd523c5947 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:38:48 +0200 Subject: [PATCH 44/61] Fix indentation issues. --- .../GlobalSearch/Files/HomeFilesSearchViewController.m | 5 +++-- .../GlobalSearch/Messages/HomeMessagesSearchViewController.m | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index d1dbdde12..10e8f44e0 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -146,8 +146,9 @@ UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId - eventId:eventId mxSession:session - presentationParameters: presentationParameters]; + eventId:eventId + mxSession:session + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index a850228b9..1f617898f 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -153,8 +153,9 @@ UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId - eventId:eventId mxSession:session - presentationParameters: presentationParameters]; + eventId:eventId + mxSession:session + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } From b998ae0d19df85b4a0b879260ecf9babe2e42c38 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:40:27 +0200 Subject: [PATCH 45/61] Update Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index fa6e93929..340741e32 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -237,7 +237,7 @@ UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession - presentationParameters: presentationParameters]; + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } From d4a864b408d2548a7dc464acfe3396a3cc0dd3ac Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:41:00 +0200 Subject: [PATCH 46/61] Update Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 340741e32..ba9b9445e 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -245,7 +245,7 @@ { UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters: presentationParameters]; + RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } From cd938e6c48a8c4ad9dc99fe28434c22b8a361f49 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:41:27 +0200 Subject: [PATCH 47/61] Update Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift index ec928bd90..2e22cc87d 100644 --- a/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift +++ b/Riot/Modules/Spaces/SpaceDetail/SpaceDetailPresenter.swift @@ -88,7 +88,7 @@ class SpaceDetailPresenter: NSObject { private func present(_ viewController: SpaceDetailViewController, animated: Bool) { - guard let presentingViewController = self.presentingViewController?.presentedViewController ?? self.presentingViewController else { + guard let presentingViewController = self.presentingViewController?.presentedViewController ?? self.presentingViewController else { MXLog.error("[SpaceDetailPresenter] present no presentingViewController found") return } From 343eda4eff3c377974e0c1eb740bd8789f7ef187 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:47:33 +0200 Subject: [PATCH 48/61] UniversalLinkParameters: Make `universalLinkURL` property non optional. --- Riot/Modules/DeepLink/UniversalLinkParameters.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift index 6438b0ef2..79f1a79b1 100644 --- a/Riot/Modules/DeepLink/UniversalLinkParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -23,7 +23,7 @@ class UniversalLinkParameters: NSObject { // MARK: - Properties /// The unprocessed the universal link URL - let universalLinkURL: URL? + let universalLinkURL: URL /// The fragment part of the universal link let fragment: String From d718131cc207dfa8e9b5a03f364514e7ec56382f Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:50:00 +0200 Subject: [PATCH 49/61] DirectoryViewController: Refactor show room with id method. --- Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index ba9b9445e..f429eaae3 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -193,7 +193,7 @@ if ([dataSource.mxSession roomWithRoomId:publicRoom.roomId]) { // Open the public room. - [self openRoomWithId:publicRoom.roomId inMatrixSession:dataSource.mxSession]; + [self showRoomWithId:publicRoom.roomId inMatrixSession:dataSource.mxSession]; } else { @@ -232,7 +232,7 @@ #pragma mark - Private methods -- (void)openRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession +- (void)showRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession { UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; From e8a8862291fa7cb4886713eadd7bed049139fd62 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 20 Oct 2021 18:51:19 +0200 Subject: [PATCH 50/61] TabBarCoordinator: Fix refacto issues. --- Riot/Modules/TabBar/TabBarCoordinator.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 7a76ea736..149f3356e 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -347,7 +347,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { coordinator.start() self.add(childCoordinator: coordinator) - self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in + self.showSplitViewDetails(with: coordinator, stackedOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in self?.remove(childCoordinator: coordinator) } } @@ -359,7 +359,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { coordinator.start() self.add(childCoordinator: coordinator) - self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in + self.showSplitViewDetails(with: coordinator, stackedOnSplitViewDetail: presentationParameters.stackAboveVisibleViews) { [weak self] in self?.remove(childCoordinator: coordinator) } } @@ -439,7 +439,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { coordinator.start(withCompletion: completion) self.add(childCoordinator: coordinator) - self.showSplitViewDetails(with: coordinator, stackOnSplitViewDetail: stackOnSplitViewDetail) { [weak self] in + self.showSplitViewDetails(with: coordinator, stackedOnSplitViewDetail: stackOnSplitViewDetail) { [weak self] in // NOTE: The RoomDataSource releasing is handled in SplitViewCoordinator self?.remove(childCoordinator: coordinator) } @@ -459,7 +459,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { private func showSplitViewDetails(with presentable: Presentable, stackedOnSplitViewDetail: Bool, popCompletion: (() -> Void)? = nil) { - if stackOnSplitViewDetail { + if stackedOnSplitViewDetail { self.stackSplitViewDetails(with: presentable, popCompletion: popCompletion) } else { self.replaceSplitViewDetails(with: presentable, popCompletion: popCompletion) From 0d1f8305e99bde4303f022551007827e5c471bba Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 10:00:37 +0200 Subject: [PATCH 51/61] Rename UniversalLinkPresentationParameters to ScreenPresentationParameters. --- Riot/Modules/Application/LegacyAppDelegate.m | 12 ++++++------ .../RoomPresentationParameters.swift | 4 ++-- .../RoomPreviewPresentationParameters.swift | 2 +- .../ScreenPresentationParameters.swift} | 2 +- .../SpacePresentationParameters.swift | 4 ++-- .../SpacePreviewPresentationParameters.swift | 2 +- Riot/Modules/Common/Recents/RecentsViewController.m | 4 ++-- Riot/Modules/DeepLink/UniversalLinkParameters.swift | 6 +++--- .../Files/HomeFilesSearchViewController.m | 2 +- .../Messages/HomeMessagesSearchViewController.m | 2 +- .../GlobalSearch/Rooms/DirectoryViewController.m | 4 ++-- Riot/Modules/Room/RoomViewController.m | 4 ++-- Riot/Modules/TabBar/MasterTabBarController.h | 10 +++++----- Riot/Modules/TabBar/MasterTabBarController.m | 8 ++++---- Riot/Modules/TabBar/TabBarCoordinator.swift | 8 ++++---- 15 files changed, 37 insertions(+), 37 deletions(-) rename Riot/Modules/{DeepLink/UniversalLinkPresentationParameters.swift => Application/ScreenPresentation/ScreenPresentationParameters.swift} (97%) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 1479f23ca..3e94f3ed2 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1240,7 +1240,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; UniversalLinkParameters *parameters = [[UniversalLinkParameters alloc] initWithFragment:fragment universalLinkURL:universalLinkURL presentationParameters:presentationParameters]; @@ -1251,7 +1251,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSString *fragment = universalLinkParameters.fragment; NSURL *universalLinkURL = universalLinkParameters.universalLinkURL; - UniversalLinkPresentationParameters *universalLinkPresentationParameters = universalLinkParameters.presentationParameters; + ScreenPresentationParameters *universalLinkPresentationParameters = universalLinkParameters.presentationParameters; BOOL restoreInitialDisplay = universalLinkPresentationParameters.restoreInitialDisplay; BOOL continueUserActivity = NO; @@ -2880,7 +2880,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession { // Ask to restore initial display - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:mxSession presentationParameters:presentationParameters]; @@ -2914,7 +2914,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (void)showRoomPreview:(RoomPreviewData*)roomPreviewData { // Ask to restore initial display - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; @@ -3109,7 +3109,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - Contacts handling -- (void)showContact:(MXKContact*)contact presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters +- (void)showContact:(MXKContact*)contact presentationParameters:(ScreenPresentationParameters*)presentationParameters { void(^showContact)(void) = ^{ [self.masterTabBarController selectContact:contact withPresentationParameters:presentationParameters]; @@ -3129,7 +3129,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni #pragma mark - Matrix Groups handling -- (void)showGroup:(MXGroup*)group withMatrixSession:(MXSession*)mxSession presentationParamters:(UniversalLinkPresentationParameters*)presentationParameters +- (void)showGroup:(MXGroup*)group withMatrixSession:(MXSession*)mxSession presentationParamters:(ScreenPresentationParameters*)presentationParameters { void(^showGroup)(void) = ^{ // Select group to display its details (dispatch this action in order to let TabBarController end its refresh) diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift index 6f36f2e54..b04e2f9a5 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift @@ -32,14 +32,14 @@ class RoomPresentationParameters: NSObject { let mxSession: MXSession /// Universal link presentation parameters. - let presentationParameters: UniversalLinkPresentationParameters + let presentationParameters: ScreenPresentationParameters // MARK: - Setup init(roomId: String, eventId: String?, mxSession: MXSession, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: ScreenPresentationParameters) { self.roomId = roomId self.eventId = eventId self.mxSession = mxSession diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift index 1b71f5e57..773509179 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift @@ -28,7 +28,7 @@ class RoomPreviewPresentationParameters: RoomPresentationParameters { // MARK: - Setup - init(previewData: RoomPreviewData, presentationParameters: UniversalLinkPresentationParameters) { + init(previewData: RoomPreviewData, presentationParameters: ScreenPresentationParameters) { self.previewData = previewData super.init(roomId: previewData.roomId, diff --git a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/ScreenPresentationParameters.swift similarity index 97% rename from Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/ScreenPresentationParameters.swift index 58fc9a29e..65d206514 100644 --- a/Riot/Modules/DeepLink/UniversalLinkPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/ScreenPresentationParameters.swift @@ -18,7 +18,7 @@ import Foundation /// Presentation parameters used when a universal link is triggered @objcMembers -class UniversalLinkPresentationParameters: NSObject { +class ScreenPresentationParameters: NSObject { // MARK: - Properties diff --git a/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift index 54c1a3b0f..f28e864b0 100644 --- a/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift @@ -29,13 +29,13 @@ class SpacePresentationParameters: NSObject { let mxSession: MXSession /// Universal link presentation parameters. - let presentationParameters: UniversalLinkPresentationParameters + let presentationParameters: ScreenPresentationParameters // MARK: - Setup init(roomId: String, mxSession: MXSession, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: ScreenPresentationParameters) { self.roomId = roomId self.mxSession = mxSession self.presentationParameters = presentationParameters diff --git a/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift index 72ff1fc97..0a5f45a96 100644 --- a/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift @@ -29,7 +29,7 @@ class SpacePreviewPresentationParameters: SpacePresentationParameters { init(publicRoom: MXPublicRoom, mxSession: MXSession, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: ScreenPresentationParameters) { self.publicRoom = publicRoom super.init(roomId: publicRoom.roomId, mxSession: mxSession, presentationParameters: presentationParameters) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 84bcc3d03..a8c95fea3 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -862,7 +862,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro self.userInteractionEnabled = NO; // Do not stack views when showing room - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:matrixSession presentationParameters:presentationParameters]; @@ -875,7 +875,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData { // Do not stack views when showing room - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil]; RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; diff --git a/Riot/Modules/DeepLink/UniversalLinkParameters.swift b/Riot/Modules/DeepLink/UniversalLinkParameters.swift index 79f1a79b1..611988232 100644 --- a/Riot/Modules/DeepLink/UniversalLinkParameters.swift +++ b/Riot/Modules/DeepLink/UniversalLinkParameters.swift @@ -29,13 +29,13 @@ class UniversalLinkParameters: NSObject { let fragment: String /// Presentation parameters - let presentationParameters: UniversalLinkPresentationParameters + let presentationParameters: ScreenPresentationParameters // MARK: - Setup init(fragment: String, universalLinkURL: URL, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: ScreenPresentationParameters) { self.fragment = fragment self.universalLinkURL = universalLinkURL self.presentationParameters = presentationParameters @@ -44,7 +44,7 @@ class UniversalLinkParameters: NSObject { } convenience init?(universalLinkURL: URL, - presentationParameters: UniversalLinkPresentationParameters) { + presentationParameters: ScreenPresentationParameters) { guard let fixedURL = Tools.fixURL(withSeveralHashKeys: universalLinkURL), let fragment = fixedURL.fragment else { return nil diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index 10e8f44e0..3d9b0b5be 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -143,7 +143,7 @@ andEventId:(NSString*)eventId inMatrixSession:(MXSession*)session { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index 1f617898f..bfaa59d99 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -150,7 +150,7 @@ andEventId:(NSString*)eventId inMatrixSession:(MXSession*)session { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index f429eaae3..46d427ce0 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -234,7 +234,7 @@ - (void)showRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession presentationParameters:presentationParameters]; @@ -243,7 +243,7 @@ - (void)showRoomPreviewWithData:(RoomPreviewData*)roomPreviewData { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index b478e3f78..5b4ad0c2b 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2202,9 +2202,9 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; return [[AppDelegate theDelegate] showAlertWithTitle:title message:message]; } -- (UniversalLinkPresentationParameters*)buildUniversalLinkPresentationParameters +- (ScreenPresentationParameters*)buildUniversalLinkPresentationParameters { - return [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; + return [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:BuildSettings.allowSplitViewDetailsScreenStacking sender:self sourceView:nil]; } - (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index a548b570b..452009a23 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -44,7 +44,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { @protocol MasterTabBarControllerDelegate; @class RoomPresentationParameters; @class RoomPreviewPresentationParameters; -@class UniversalLinkPresentationParameters; +@class ScreenPresentationParameters; @interface MasterTabBarController : UITabBarController @@ -97,7 +97,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { */ - (void)selectContact:(MXKContact*)contact; -- (void)selectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; +- (void)selectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters; /** Open a GroupDetailsViewController to display the information of the provided group. @@ -107,7 +107,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { */ - (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession; -- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; +- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters; /** Release the current selected item (if any). @@ -194,7 +194,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomPresentationParameters*)roomPresentationParameters completion:(void (^)(void))completion; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomPreviewPresentationParameters completion:(void (^)(void))completion; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters; @end diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index a83fed236..de24af110 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -616,12 +616,12 @@ - (void)selectContact:(MXKContact*)contact { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; [self selectContact:contact withPresentationParameters:presentationParameters]; } -- (void)selectContact:(MXKContact*)contact withPresentationParameters:(UniversalLinkPresentationParameters*)presentationParameters +- (void)selectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters { [self releaseSelectedItem]; @@ -634,12 +634,12 @@ - (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession { - UniversalLinkPresentationParameters *presentationParameters = [[UniversalLinkPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; + ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES stackAboveVisibleViews:NO]; [self selectGroup:group inMatrixSession:matrixSession presentationParameters:presentationParameters]; } -- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(UniversalLinkPresentationParameters*)presentationParameters +- (void)selectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters { [self releaseSelectedItem]; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 149f3356e..d13998179 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -340,7 +340,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } // FIXME: Should be displayed from a tab. - private func showContactDetails(with contact: MXKContact, presentationParameters: UniversalLinkPresentationParameters) { + private func showContactDetails(with contact: MXKContact, presentationParameters: ScreenPresentationParameters) { let coordinatorParameters = ContactDetailsCoordinatorParameters(contact: contact) let coordinator = ContactDetailsCoordinator(parameters: coordinatorParameters) @@ -353,7 +353,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } // FIXME: Should be displayed from a tab. - private func showGroupDetails(with group: MXGroup, for matrixSession: MXSession, presentationParameters: UniversalLinkPresentationParameters) { + private func showGroupDetails(with group: MXGroup, for matrixSession: MXSession, presentationParameters: ScreenPresentationParameters) { let coordinatorParameters = GroupDetailsCoordinatorParameters(session: matrixSession, group: group) let coordinator = GroupDetailsCoordinator(parameters: coordinatorParameters) coordinator.start() @@ -536,7 +536,7 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { self.showRoomPreview(withPresentationParameters: roomPreviewPresentationParameters, completion: completion) } - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!, with presentationParameters: UniversalLinkPresentationParameters!) { + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!, with presentationParameters: ScreenPresentationParameters!) { self.showContactDetails(with: contact, presentationParameters: presentationParameters) } @@ -548,7 +548,7 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { self.showRoom(with: roomId, eventId: eventId, matrixSession: matrixSession, completion: completion) } - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect group: MXGroup!, inMatrixSession matrixSession: MXSession!, presentationParameters: UniversalLinkPresentationParameters!) { + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect group: MXGroup!, inMatrixSession matrixSession: MXSession!, presentationParameters: ScreenPresentationParameters!) { self.showGroupDetails(with: group, for: matrixSession, presentationParameters: presentationParameters) } From 6ab705416d2274f9802614599e00d158b35f8bac Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 10:55:13 +0200 Subject: [PATCH 52/61] Refactor RoomPresentationParameters to RoomScreenParameters. --- Riot/Modules/Application/LegacyAppDelegate.h | 6 +++--- Riot/Modules/Application/LegacyAppDelegate.m | 10 +++++----- .../RoomPreviewPresentationParameters.swift | 2 +- ...Parameters.swift => RoomScreenParameters.swift} | 2 +- .../Modules/Common/Recents/RecentsViewController.m | 2 +- .../Files/HomeFilesSearchViewController.m | 2 +- .../Messages/HomeMessagesSearchViewController.m | 2 +- .../GlobalSearch/Rooms/DirectoryViewController.m | 2 +- Riot/Modules/TabBar/MasterTabBarController.h | 9 ++++----- Riot/Modules/TabBar/MasterTabBarController.m | 2 +- Riot/Modules/TabBar/TabBarCoordinator.swift | 14 +++++++------- 11 files changed, 26 insertions(+), 27 deletions(-) rename Riot/Modules/Application/ScreenPresentation/{RoomPresentationParameters.swift => RoomScreenParameters.swift} (97%) diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index cd4526a94..4c9e6e236 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -31,7 +31,7 @@ @protocol LegacyAppDelegateDelegate; @class CallBar; @class CallPresenter; -@class RoomPresentationParameters; +@class RoomScreenParameters; @class RoomPreviewPresentationParameters; @class UniversalLinkParameters; @@ -207,9 +207,9 @@ UINavigationControllerDelegate #pragma mark - Matrix Room handling // Show a room and jump to the given event if event id is not nil otherwise go to last messages. -- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters completion:(void (^)(void))completion; +- (void)showRoomWithParameters:(RoomScreenParameters*)parameters completion:(void (^)(void))completion; -- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters; +- (void)showRoomWithParameters:(RoomScreenParameters*)parameters; // Restore display and show the room - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession; diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 3e94f3ed2..ff636679f 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1361,9 +1361,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni else { // Open the room page - RoomPresentationParameters *roomPresentationParameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; + RoomScreenParameters *roomScreenParameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; - [self showRoomWithParameters:roomPresentationParameters]; + [self showRoomWithParameters:roomScreenParameters]; } continueUserActivity = YES; @@ -2821,12 +2821,12 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters +- (void)showRoomWithParameters:(RoomScreenParameters*)parameters { [self showRoomWithParameters:parameters completion:nil]; } -- (void)showRoomWithParameters:(RoomPresentationParameters*)parameters completion:(void (^)(void))completion +- (void)showRoomWithParameters:(RoomScreenParameters*)parameters completion:(void (^)(void))completion { NSString *roomId = parameters.roomId; MXSession *mxSession = parameters.mxSession; @@ -2882,7 +2882,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Ask to restore initial display ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; - RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:mxSession presentationParameters:presentationParameters]; [self showRoomWithParameters:parameters]; diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift index 773509179..823fc0404 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift @@ -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: RoomPresentationParameters { +class RoomPreviewPresentationParameters: RoomScreenParameters { // MARK: - Properties diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift similarity index 97% rename from Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift index b04e2f9a5..1a9a1ee6a 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift @@ -18,7 +18,7 @@ import Foundation /// Presentation parameters to display a room with a provided identifier in a specific matrix session. @objcMembers -class RoomPresentationParameters: NSObject { +class RoomScreenParameters: NSObject { // MARK: - Properties diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index a8c95fea3..b61cba1cf 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -864,7 +864,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Do not stack views when showing room ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil + RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:nil mxSession:matrixSession presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters completion:^{ diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index 3d9b0b5be..2c8ab8e5b 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -145,7 +145,7 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:session presentationParameters:presentationParameters]; diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index bfaa59d99..f617edd0f 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -152,7 +152,7 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId + RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:session presentationParameters:presentationParameters]; diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 46d427ce0..9701b67b2 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -236,7 +236,7 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPresentationParameters *parameters = [[RoomPresentationParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession + RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 452009a23..221c96d5e 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -42,7 +42,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { }; @protocol MasterTabBarControllerDelegate; -@class RoomPresentationParameters; +@class RoomScreenParameters; @class RoomPreviewPresentationParameters; @class ScreenPresentationParameters; @@ -84,7 +84,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { /// 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; +- (void)selectRoomWithParameters:(RoomScreenParameters*)parameters 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. @@ -191,9 +191,8 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { - (void)masterTabBarControllerDidCompleteAuthentication:(MasterTabBarController *)masterTabBarController; - (void)masterTabBarController:(MasterTabBarController*)masterTabBarController needsSideMenuIconWithNotification:(BOOL)displayNotification; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomWithParameters:(RoomPresentationParameters*)roomPresentationParameters completion:(void (^)(void))completion; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)roomPreviewPresentationParameters completion:(void (^)(void))completion; - +- (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 didSelectContact:(MXKContact*)contact withPresentationParameters:(ScreenPresentationParameters*)presentationParameters; - (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectGroup:(MXGroup*)group inMatrixSession:(MXSession*)matrixSession presentationParameters:(ScreenPresentationParameters*)presentationParameters; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index de24af110..89e6d5e0b 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -586,7 +586,7 @@ } } -- (void)selectRoomWithParameters:(RoomPresentationParameters*)paramaters completion:(void (^)(void))completion +- (void)selectRoomWithParameters:(RoomScreenParameters*)paramaters completion:(void (^)(void))completion { [self releaseSelectedItem]; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index d13998179..ae61e8921 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -373,15 +373,15 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.showRoom(with: roomId, eventId: nil, matrixSession: matrixSession) } - private func showRoom(withPresentationParameters roomPresentationParameters: RoomPresentationParameters, completion: (() -> Void)?) { + private func showRoom(withPresentationParameters roomScreenParameters: RoomScreenParameters, completion: (() -> Void)?) { let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared, - session: roomPresentationParameters.mxSession, - roomId: roomPresentationParameters.roomId, - eventId: roomPresentationParameters.eventId) + session: roomScreenParameters.mxSession, + roomId: roomScreenParameters.roomId, + eventId: roomScreenParameters.eventId) self.showRoom(with: roomCoordinatorParameters, - stackOnSplitViewDetail: roomPresentationParameters.presentationParameters.stackAboveVisibleViews, + stackOnSplitViewDetail: roomScreenParameters.presentationParameters.stackAboveVisibleViews, completion: completion) } @@ -528,8 +528,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { // MARK: - MasterTabBarControllerDelegate extension TabBarCoordinator: MasterTabBarControllerDelegate { - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomWith roomPresentationParameters: RoomPresentationParameters!, completion: (() -> Void)!) { - self.showRoom(withPresentationParameters: roomPresentationParameters, completion: completion) + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomWith roomScreenParameters: RoomScreenParameters!, completion: (() -> Void)!) { + self.showRoom(withPresentationParameters: roomScreenParameters, completion: completion) } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewPresentationParameters: RoomPreviewPresentationParameters!, completion: (() -> Void)!) { From 638321d123bf4f8d7038ae5fa0f30f1b9b4da5f0 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 11:00:45 +0200 Subject: [PATCH 53/61] Refactor RoomPreviewPresentationParameters to RoomPreviewScreenParameters. --- Riot/Modules/Application/LegacyAppDelegate.h | 6 +-- .../RoomPreviewPresentationParameters.swift | 2 +- .../RoomPreviewScreenParameters.swift | 38 +++++++++++++++++++ .../Common/Recents/RecentsViewController.m | 2 +- .../Rooms/DirectoryViewController.m | 2 +- Riot/Modules/TabBar/MasterTabBarController.h | 6 +-- Riot/Modules/TabBar/MasterTabBarController.m | 2 +- Riot/Modules/TabBar/TabBarCoordinator.swift | 10 ++--- 8 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index 4c9e6e236..b87f32f5a 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -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; diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift index 823fc0404..b2a2d9197 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift @@ -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 diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift new file mode 100644 index 000000000..b2a2d9197 --- /dev/null +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift @@ -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) + } +} diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index b61cba1cf..723ee91dd 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -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]; } diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 9701b67b2..49d320c22 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -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]; } diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 221c96d5e..8524a2b3c 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -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; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 89e6d5e0b..9781434c2 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -599,7 +599,7 @@ [self refreshSelectedControllerSelectedCellIfNeeded]; } -- (void)selectRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion +- (void)selectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion { [self releaseSelectedItem]; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index ae61e8921..4a71f0769 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -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!) { From 2cd80ff4ec665fed40437c7a311af77c8f64d9fa Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 11:40:18 +0200 Subject: [PATCH 54/61] Refactor RoomScreenParameters to RoomNavigationParameters. --- Riot/Modules/Application/LegacyAppDelegate.h | 6 ++--- Riot/Modules/Application/LegacyAppDelegate.m | 24 +++++++++---------- ...s.swift => RoomNavigationParameters.swift} | 6 ++--- .../RoomPreviewScreenParameters.swift | 2 +- .../Common/Recents/RecentsViewController.m | 6 +++-- .../Files/HomeFilesSearchViewController.m | 8 +++---- .../HomeMessagesSearchViewController.m | 2 +- .../Rooms/DirectoryViewController.m | 6 +++-- Riot/Modules/TabBar/MasterTabBarController.h | 6 ++--- Riot/Modules/TabBar/MasterTabBarController.m | 2 +- Riot/Modules/TabBar/TabBarCoordinator.swift | 14 +++++------ 11 files changed, 43 insertions(+), 39 deletions(-) rename Riot/Modules/Application/ScreenPresentation/{RoomScreenParameters.swift => RoomNavigationParameters.swift} (87%) diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index b87f32f5a..0d7f223d2 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -31,7 +31,7 @@ @protocol LegacyAppDelegateDelegate; @class CallBar; @class CallPresenter; -@class RoomScreenParameters; +@class RoomNavigationParameters; @class RoomPreviewScreenParameters; @class UniversalLinkParameters; @@ -207,9 +207,9 @@ UINavigationControllerDelegate #pragma mark - Matrix Room handling // Show a room and jump to the given event if event id is not nil otherwise go to last messages. -- (void)showRoomWithParameters:(RoomScreenParameters*)parameters completion:(void (^)(void))completion; +- (void)showRoomWithParameters:(RoomNavigationParameters*)parameters completion:(void (^)(void))completion; -- (void)showRoomWithParameters:(RoomScreenParameters*)parameters; +- (void)showRoomWithParameters:(RoomNavigationParameters*)parameters; // Restore display and show the room - (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession; diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index ff636679f..7e5505b43 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1361,9 +1361,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni else { // Open the room page - RoomScreenParameters *roomScreenParameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; + RoomNavigationParameters *roomNavigationParameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; - [self showRoomWithParameters:roomScreenParameters]; + [self showRoomWithParameters:roomNavigationParameters]; } continueUserActivity = YES; @@ -1470,7 +1470,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni roomPreviewData.viaServers = queryParams[@"via"]; } - RoomPreviewPresentationParameters *roomPreviewPresentationParameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; + RoomPreviewScreenParameters *roomPreviewScreenParameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; [account.mxSession.matrixRestClient roomSummaryWith:roomIdOrAlias via:roomPreviewData.viaServers success:^(MXPublicRoom *room) { if ([room.roomTypeString isEqualToString:MXRoomTypeStringSpace]) @@ -1483,10 +1483,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } else { - [self peekInRoomWithPresentationParameters:roomPreviewPresentationParameters pathParams:pathParams]; + [self peekInRoomWithPresentationParameters:roomPreviewScreenParameters pathParams:pathParams]; } } failure:^(NSError *error) { - [self peekInRoomWithPresentationParameters:roomPreviewPresentationParameters pathParams:pathParams]; + [self peekInRoomWithPresentationParameters:roomPreviewScreenParameters pathParams:pathParams]; }]; } @@ -1637,7 +1637,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)peekInRoomWithPresentationParameters:(RoomPreviewPresentationParameters*)presentationParameters pathParams:(NSArray *)pathParams +- (void)peekInRoomWithPresentationParameters:(RoomPreviewScreenParameters*)presentationParameters pathParams:(NSArray *)pathParams { RoomPreviewData *roomPreviewData = presentationParameters.previewData; NSString *roomIdOrAlias = presentationParameters.roomId; @@ -2821,12 +2821,12 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoomWithParameters:(RoomScreenParameters*)parameters +- (void)showRoomWithParameters:(RoomNavigationParameters*)parameters { [self showRoomWithParameters:parameters completion:nil]; } -- (void)showRoomWithParameters:(RoomScreenParameters*)parameters completion:(void (^)(void))completion +- (void)showRoomWithParameters:(RoomNavigationParameters*)parameters completion:(void (^)(void))completion { NSString *roomId = parameters.roomId; MXSession *mxSession = parameters.mxSession; @@ -2882,13 +2882,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Ask to restore initial display ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; - RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId + RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:mxSession presentationParameters:presentationParameters]; [self showRoomWithParameters:parameters]; } -- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters completion:(void (^)(void))completion +- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion { void (^showRoomPreview)(void) = ^() { [self.masterTabBarController selectRoomPreviewWithParameters:parameters completion:completion]; @@ -2906,7 +2906,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoomPreviewWithParameters:(RoomPreviewPresentationParameters*)parameters +- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters { [self showRoomPreviewWithParameters:parameters completion:nil]; } @@ -2916,7 +2916,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Ask to restore initial display ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; - RoomPreviewPresentationParameters *parameters = [[RoomPreviewPresentationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; + RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [self showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomNavigationParameters.swift similarity index 87% rename from Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift rename to Riot/Modules/Application/ScreenPresentation/RoomNavigationParameters.swift index 1a9a1ee6a..7308a5701 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomScreenParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomNavigationParameters.swift @@ -16,9 +16,9 @@ import Foundation -/// Presentation parameters to display a room with a provided identifier in a specific matrix session. +/// Navigation parameters to display a room with a provided identifier in a specific matrix session. @objcMembers -class RoomScreenParameters: NSObject { +class RoomNavigationParameters: NSObject { // MARK: - Properties @@ -31,7 +31,7 @@ class RoomScreenParameters: NSObject { /// The Matrix session in which the room should be available. let mxSession: MXSession - /// Universal link presentation parameters. + /// Screen presentation parameters. let presentationParameters: ScreenPresentationParameters // MARK: - Setup diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift index b2a2d9197..377b94912 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift @@ -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 RoomPreviewScreenParameters: RoomScreenParameters { +class RoomPreviewScreenParameters: RoomNavigationParameters { // MARK: - Properties diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 723ee91dd..fae2185f7 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -864,8 +864,10 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Do not stack views when showing room ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:nil - mxSession:matrixSession presentationParameters:presentationParameters]; + RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId + eventId:nil + mxSession:matrixSession + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters completion:^{ self.userInteractionEnabled = YES; diff --git a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m index 2c8ab8e5b..05043e47b 100644 --- a/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Files/HomeFilesSearchViewController.m @@ -145,10 +145,10 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId - eventId:eventId - mxSession:session - presentationParameters:presentationParameters]; + RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId + eventId:eventId + mxSession:session + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index f617edd0f..635d84118 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -152,7 +152,7 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId + RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:session presentationParameters:presentationParameters]; diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 49d320c22..c026136c9 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -236,8 +236,10 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomScreenParameters *parameters = [[RoomScreenParameters alloc] initWithRoomId:roomId eventId:nil mxSession:mxSession - presentationParameters:presentationParameters]; + RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId + eventId:nil + mxSession:mxSession + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; } diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 8524a2b3c..f15ef6547 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -42,7 +42,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { }; @protocol MasterTabBarControllerDelegate; -@class RoomScreenParameters; +@class RoomNavigationParameters; @class RoomPreviewScreenParameters; @class ScreenPresentationParameters; @@ -84,7 +84,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { /// 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:(RoomScreenParameters*)parameters completion:(void (^)(void))completion; +- (void)selectRoomWithParameters:(RoomNavigationParameters*)parameters 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. @@ -191,7 +191,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 didSelectRoomWithParameters:(RoomNavigationParameters*)roomNavigationParameters 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; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 9781434c2..fb6bf4f19 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -586,7 +586,7 @@ } } -- (void)selectRoomWithParameters:(RoomScreenParameters*)paramaters completion:(void (^)(void))completion +- (void)selectRoomWithParameters:(RoomNavigationParameters*)paramaters completion:(void (^)(void))completion { [self releaseSelectedItem]; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 4a71f0769..24f119ab3 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -373,15 +373,15 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.showRoom(with: roomId, eventId: nil, matrixSession: matrixSession) } - private func showRoom(withPresentationParameters roomScreenParameters: RoomScreenParameters, completion: (() -> Void)?) { + private func showRoom(withNavigationParameters roomNavigationParameters: RoomNavigationParameters, completion: (() -> Void)?) { let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared, - session: roomScreenParameters.mxSession, - roomId: roomScreenParameters.roomId, - eventId: roomScreenParameters.eventId) + session: roomNavigationParameters.mxSession, + roomId: roomNavigationParameters.roomId, + eventId: roomNavigationParameters.eventId) self.showRoom(with: roomCoordinatorParameters, - stackOnSplitViewDetail: roomScreenParameters.presentationParameters.stackAboveVisibleViews, + stackOnSplitViewDetail: roomNavigationParameters.presentationParameters.stackAboveVisibleViews, completion: completion) } @@ -528,8 +528,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { // MARK: - MasterTabBarControllerDelegate extension TabBarCoordinator: MasterTabBarControllerDelegate { - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomWith roomScreenParameters: RoomScreenParameters!, completion: (() -> Void)!) { - self.showRoom(withPresentationParameters: roomScreenParameters, completion: completion) + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomWith roomNavigationParameters: RoomNavigationParameters!, completion: (() -> Void)!) { + self.showRoom(withNavigationParameters: roomNavigationParameters, completion: completion) } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewScreenParameters: RoomPreviewScreenParameters!, completion: (() -> Void)!) { From d7c892d7a806f1324e89d857045c0e73aead47c5 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 11:57:13 +0200 Subject: [PATCH 55/61] Refactor RoomPreviewScreenParameters to RoomPreviewNavigationParameters. --- Riot/Modules/Application/LegacyAppDelegate.h | 6 +++--- Riot/Modules/Application/LegacyAppDelegate.m | 14 +++++++------- ...swift => RoomPreviewNavigationParameters.swift} | 7 ++++--- .../Modules/Common/Recents/RecentsViewController.m | 2 +- .../GlobalSearch/Rooms/DirectoryViewController.m | 2 +- Riot/Modules/TabBar/TabBarCoordinator.swift | 10 +++++----- 6 files changed, 21 insertions(+), 20 deletions(-) rename Riot/Modules/Application/ScreenPresentation/{RoomPreviewScreenParameters.swift => RoomPreviewNavigationParameters.swift} (79%) diff --git a/Riot/Modules/Application/LegacyAppDelegate.h b/Riot/Modules/Application/LegacyAppDelegate.h index 0d7f223d2..6a3e2c3be 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.h +++ b/Riot/Modules/Application/LegacyAppDelegate.h @@ -32,7 +32,7 @@ @class CallBar; @class CallPresenter; @class RoomNavigationParameters; -@class RoomPreviewScreenParameters; +@class RoomPreviewNavigationParameters; @class UniversalLinkParameters; #pragma mark - Notifications @@ -218,9 +218,9 @@ UINavigationControllerDelegate - (void)createDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))completion; // Show room preview -- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion; +- (void)showRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)parameters completion:(void (^)(void))completion; -- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters; +- (void)showRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)parameters; // Restore display and show the room preview - (void)showRoomPreview:(RoomPreviewData*)roomPreviewData; diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 7e5505b43..e06b57df7 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1470,7 +1470,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni roomPreviewData.viaServers = queryParams[@"via"]; } - RoomPreviewScreenParameters *roomPreviewScreenParameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; + RoomPreviewNavigationParameters *roomPreviewNavigationParameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; [account.mxSession.matrixRestClient roomSummaryWith:roomIdOrAlias via:roomPreviewData.viaServers success:^(MXPublicRoom *room) { if ([room.roomTypeString isEqualToString:MXRoomTypeStringSpace]) @@ -1483,10 +1483,10 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } else { - [self peekInRoomWithPresentationParameters:roomPreviewScreenParameters pathParams:pathParams]; + [self peekInRoomWithNavigationParameters:roomPreviewNavigationParameters pathParams:pathParams]; } } failure:^(NSError *error) { - [self peekInRoomWithPresentationParameters:roomPreviewScreenParameters pathParams:pathParams]; + [self peekInRoomWithNavigationParameters:roomPreviewNavigationParameters pathParams:pathParams]; }]; } @@ -1637,7 +1637,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)peekInRoomWithPresentationParameters:(RoomPreviewScreenParameters*)presentationParameters pathParams:(NSArray *)pathParams +- (void)peekInRoomWithNavigationParameters:(RoomPreviewNavigationParameters*)presentationParameters pathParams:(NSArray *)pathParams { RoomPreviewData *roomPreviewData = presentationParameters.previewData; NSString *roomIdOrAlias = presentationParameters.roomId; @@ -2888,7 +2888,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self showRoomWithParameters:parameters]; } -- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion +- (void)showRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)parameters completion:(void (^)(void))completion { void (^showRoomPreview)(void) = ^() { [self.masterTabBarController selectRoomPreviewWithParameters:parameters completion:completion]; @@ -2906,7 +2906,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters +- (void)showRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)parameters { [self showRoomPreviewWithParameters:parameters completion:nil]; } @@ -2916,7 +2916,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Ask to restore initial display ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:YES]; - RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; + RoomPreviewNavigationParameters *parameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [self showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewNavigationParameters.swift similarity index 79% rename from Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift rename to Riot/Modules/Application/ScreenPresentation/RoomPreviewNavigationParameters.swift index 377b94912..e59d2687f 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewScreenParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewNavigationParameters.swift @@ -16,10 +16,10 @@ import Foundation -/// Presentation parameters to display a preview of a room that is unknown for the user. +/// Navigation 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: RoomNavigationParameters { +class RoomPreviewNavigationParameters: RoomNavigationParameters { // MARK: - Properties @@ -33,6 +33,7 @@ class RoomPreviewScreenParameters: RoomNavigationParameters { super.init(roomId: previewData.roomId, eventId: previewData.eventId, - mxSession: previewData.mxSession, presentationParameters: presentationParameters) + mxSession: previewData.mxSession, + presentationParameters: presentationParameters) } } diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index fae2185f7..f47f08a9d 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -879,7 +879,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro // Do not stack views when showing room ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO sender:nil sourceView:nil]; - RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; + RoomPreviewNavigationParameters *parameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index c026136c9..2f6e791d7 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -247,7 +247,7 @@ { ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; - RoomPreviewScreenParameters *parameters = [[RoomPreviewScreenParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; + RoomPreviewNavigationParameters *parameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomPreviewWithParameters:parameters]; } diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 24f119ab3..cb8fbaa6c 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -405,13 +405,13 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { self.showRoom(with: roomCoordinatorParameters) } - private func showRoomPreview(withPresentationParameters roomPreviewScreenParameters: RoomPreviewScreenParameters, completion: (() -> Void)?) { + private func showRoomPreview(withNavigationParameters roomPreviewNavigationParameters: RoomPreviewNavigationParameters, completion: (() -> Void)?) { let roomCoordinatorParameters = RoomCoordinatorParameters(navigationRouterStore: NavigationRouterStore.shared, - previewData: roomPreviewScreenParameters.previewData) + previewData: roomPreviewNavigationParameters.previewData) self.showRoom(with: roomCoordinatorParameters, - stackOnSplitViewDetail: roomPreviewScreenParameters.presentationParameters.stackAboveVisibleViews, + stackOnSplitViewDetail: roomPreviewNavigationParameters.presentationParameters.stackAboveVisibleViews, completion: completion) } @@ -532,8 +532,8 @@ extension TabBarCoordinator: MasterTabBarControllerDelegate { self.showRoom(withNavigationParameters: roomNavigationParameters, completion: completion) } - func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewScreenParameters: RoomPreviewScreenParameters!, completion: (() -> Void)!) { - self.showRoomPreview(withPresentationParameters: roomPreviewScreenParameters, completion: completion) + func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelectRoomPreviewWith roomPreviewScreenParameters: RoomPreviewNavigationParameters!, completion: (() -> Void)!) { + self.showRoomPreview(withNavigationParameters: roomPreviewScreenParameters, completion: completion) } func masterTabBarController(_ masterTabBarController: MasterTabBarController!, didSelect contact: MXKContact!, with presentationParameters: ScreenPresentationParameters!) { From 0c8b7135ec25cf1b9f47120209c913200ebc90a4 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 14:47:17 +0200 Subject: [PATCH 56/61] Refactor RoomPreviewScreenParameters to RoomPreviewNavigationParameters. --- Riot/Modules/TabBar/MasterTabBarController.h | 6 +++--- Riot/Modules/TabBar/MasterTabBarController.m | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index f15ef6547..8207629a4 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -43,7 +43,7 @@ typedef NS_ENUM(NSUInteger, MasterTabBarIndex) { @protocol MasterTabBarControllerDelegate; @class RoomNavigationParameters; -@class RoomPreviewScreenParameters; +@class RoomPreviewNavigationParameters; @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:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion; +- (void)selectRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)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:(RoomNavigationParameters*)roomNavigationParameters completion:(void (^)(void))completion; -- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)roomScreenPresentationParameters completion:(void (^)(void))completion; +- (void)masterTabBarController:(MasterTabBarController *)masterTabBarController didSelectRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)roomPreviewNavigationParameters 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; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index fb6bf4f19..3cca72eb7 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -599,7 +599,7 @@ [self refreshSelectedControllerSelectedCellIfNeeded]; } -- (void)selectRoomPreviewWithParameters:(RoomPreviewScreenParameters*)parameters completion:(void (^)(void))completion +- (void)selectRoomPreviewWithParameters:(RoomPreviewNavigationParameters*)parameters completion:(void (^)(void))completion { [self releaseSelectedItem]; From 1b5540c0649b80db3d1e303c8c3f93a149a4e9ef Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 15:22:38 +0200 Subject: [PATCH 57/61] Refactor SpacePresentationParameters to SpaceNavigationParameters. --- Riot/Modules/Application/LegacyAppDelegate.m | 12 ++++++------ .../RoomPreviewPresentationParameters.swift | 5 +++-- ...ameters.swift => SpaceNavigationParameters.swift} | 6 +++--- ....swift => SpacePreviewNavigationParameters.swift} | 8 +++++--- 4 files changed, 17 insertions(+), 14 deletions(-) rename Riot/Modules/Application/ScreenPresentation/{SpacePresentationParameters.swift => SpaceNavigationParameters.swift} (85%) rename Riot/Modules/Application/ScreenPresentation/{SpacePreviewPresentationParameters.swift => SpacePreviewNavigationParameters.swift} (75%) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index e06b57df7..b8640da39 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1354,9 +1354,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (room.summary.roomType == MXRoomTypeSpace) { - SpacePresentationParameters *spacePresentationParameters = [[SpacePresentationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; + SpaceNavigationParameters *spaceNavigationParameters = [[SpaceNavigationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; - [self showSpaceWithParameters:spacePresentationParameters]; + [self showSpaceWithParameters:spaceNavigationParameters]; } else { @@ -1477,9 +1477,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { [homeViewController stopActivityIndicator]; - SpacePreviewPresentationParameters *spacePreviewPresentationParameters = [[SpacePreviewPresentationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; + SpacePreviewNavigationParameters *spacePreviewNavigationParameters = [[SpacePreviewNavigationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; - [self showSpacePreviewWithParameters:spacePreviewPresentationParameters]; + [self showSpacePreviewWithParameters:spacePreviewNavigationParameters]; } else { @@ -2921,7 +2921,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self showRoomPreviewWithParameters:parameters]; } -- (void)showSpacePreviewWithParameters:(SpacePreviewPresentationParameters*)parameters +- (void)showSpacePreviewWithParameters:(SpacePreviewNavigationParameters*)parameters { UIViewController *presentingViewController; UIView *sourceView; @@ -2959,7 +2959,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } } -- (void)showSpaceWithParameters:(SpacePresentationParameters*)parameters +- (void)showSpaceWithParameters:(SpaceNavigationParameters*)parameters { UIViewController *presentingViewController; UIView *sourceView; diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift index b2a2d9197..4fc217951 100644 --- a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift @@ -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 RoomPreviewScreenParameters: RoomScreenParameters { +class RoomPreviewScreenParameters: RoomNavigationParameters { // MARK: - Properties @@ -33,6 +33,7 @@ class RoomPreviewScreenParameters: RoomScreenParameters { super.init(roomId: previewData.roomId, eventId: previewData.eventId, - mxSession: previewData.mxSession, presentationParameters: presentationParameters) + mxSession: previewData.mxSession, + presentationParameters: presentationParameters) } } diff --git a/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpaceNavigationParameters.swift similarity index 85% rename from Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/SpaceNavigationParameters.swift index f28e864b0..f335e56bf 100644 --- a/Riot/Modules/Application/ScreenPresentation/SpacePresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/SpaceNavigationParameters.swift @@ -16,9 +16,9 @@ import Foundation -/// Presentation parameters to display a space with a provided identifier in a specific matrix session. +/// Navigation parameters to display a space with a provided identifier in a specific matrix session. @objcMembers -class SpacePresentationParameters: NSObject { +class SpaceNavigationParameters: NSObject { // MARK: - Properties @@ -28,7 +28,7 @@ class SpacePresentationParameters: NSObject { /// The Matrix session in which the room should be available. let mxSession: MXSession - /// Universal link presentation parameters. + /// Screen presentation parameters. let presentationParameters: ScreenPresentationParameters // MARK: - Setup diff --git a/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenPresentation/SpacePreviewNavigationParameters.swift similarity index 75% rename from Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift rename to Riot/Modules/Application/ScreenPresentation/SpacePreviewNavigationParameters.swift index 0a5f45a96..b24ab1781 100644 --- a/Riot/Modules/Application/ScreenPresentation/SpacePreviewPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenPresentation/SpacePreviewNavigationParameters.swift @@ -16,9 +16,9 @@ import Foundation -/// Presentation parameters to display a preview of a space that is unknown for the user. +/// Navigation parameters to display a preview of a space that is unknown for the user. @objcMembers -class SpacePreviewPresentationParameters: SpacePresentationParameters { +class SpacePreviewNavigationParameters: SpaceNavigationParameters { // MARK: - Properties @@ -32,6 +32,8 @@ class SpacePreviewPresentationParameters: SpacePresentationParameters { presentationParameters: ScreenPresentationParameters) { self.publicRoom = publicRoom - super.init(roomId: publicRoom.roomId, mxSession: mxSession, presentationParameters: presentationParameters) + super.init(roomId: publicRoom.roomId, + mxSession: mxSession, + presentationParameters: presentationParameters) } } From 6a1829d247577c71ac6d2a5368f3fc31c8f4ac89 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 15:23:01 +0200 Subject: [PATCH 58/61] Update folder name. --- .../RoomNavigationParameters.swift | 0 .../RoomPreviewNavigationParameters.swift | 0 .../RoomPreviewPresentationParameters.swift | 0 .../ScreenPresentationParameters.swift | 0 .../SpaceNavigationParameters.swift | 0 .../SpacePreviewNavigationParameters.swift | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/RoomNavigationParameters.swift (100%) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/RoomPreviewNavigationParameters.swift (100%) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/RoomPreviewPresentationParameters.swift (100%) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/ScreenPresentationParameters.swift (100%) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/SpaceNavigationParameters.swift (100%) rename Riot/Modules/Application/{ScreenPresentation => ScreenNavigation}/SpacePreviewNavigationParameters.swift (100%) diff --git a/Riot/Modules/Application/ScreenPresentation/RoomNavigationParameters.swift b/Riot/Modules/Application/ScreenNavigation/RoomNavigationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/RoomNavigationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/RoomNavigationParameters.swift diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewNavigationParameters.swift b/Riot/Modules/Application/ScreenNavigation/RoomPreviewNavigationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/RoomPreviewNavigationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/RoomPreviewNavigationParameters.swift diff --git a/Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/RoomPreviewPresentationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/ScreenPresentation/ScreenPresentationParameters.swift b/Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/ScreenPresentationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift diff --git a/Riot/Modules/Application/ScreenPresentation/SpaceNavigationParameters.swift b/Riot/Modules/Application/ScreenNavigation/SpaceNavigationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/SpaceNavigationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/SpaceNavigationParameters.swift diff --git a/Riot/Modules/Application/ScreenPresentation/SpacePreviewNavigationParameters.swift b/Riot/Modules/Application/ScreenNavigation/SpacePreviewNavigationParameters.swift similarity index 100% rename from Riot/Modules/Application/ScreenPresentation/SpacePreviewNavigationParameters.swift rename to Riot/Modules/Application/ScreenNavigation/SpacePreviewNavigationParameters.swift From cc28f92d39d34e31972f56161994cf7415ab13dc Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 15:32:43 +0200 Subject: [PATCH 59/61] Make some refacto. --- Riot/Modules/Application/LegacyAppDelegate.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index b8640da39..6b9816643 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1251,8 +1251,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { NSString *fragment = universalLinkParameters.fragment; NSURL *universalLinkURL = universalLinkParameters.universalLinkURL; - ScreenPresentationParameters *universalLinkPresentationParameters = universalLinkParameters.presentationParameters; - BOOL restoreInitialDisplay = universalLinkPresentationParameters.restoreInitialDisplay; + ScreenPresentationParameters *screenPresentationParameters = universalLinkParameters.presentationParameters; + BOOL restoreInitialDisplay = screenPresentationParameters.restoreInitialDisplay; BOOL continueUserActivity = NO; MXKAccountManager *accountManager = [MXKAccountManager sharedManager]; @@ -1354,14 +1354,14 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni if (room.summary.roomType == MXRoomTypeSpace) { - SpaceNavigationParameters *spaceNavigationParameters = [[SpaceNavigationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; + SpaceNavigationParameters *spaceNavigationParameters = [[SpaceNavigationParameters alloc] initWithRoomId:room.roomId mxSession:account.mxSession presentationParameters:screenPresentationParameters]; [self showSpaceWithParameters:spaceNavigationParameters]; } else { // Open the room page - RoomNavigationParameters *roomNavigationParameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: universalLinkPresentationParameters]; + RoomNavigationParameters *roomNavigationParameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId eventId:eventId mxSession:account.mxSession presentationParameters: screenPresentationParameters]; [self showRoomWithParameters:roomNavigationParameters]; } @@ -1411,7 +1411,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { universalLinkFragmentPendingRoomAlias = @{roomId: roomIdOrAlias}; - UniversalLinkParameters *newParameters = [[UniversalLinkParameters alloc] initWithFragment:newUniversalLinkFragment universalLinkURL:universalLinkURL presentationParameters:universalLinkPresentationParameters]; + UniversalLinkParameters *newParameters = [[UniversalLinkParameters alloc] initWithFragment:newUniversalLinkFragment universalLinkURL:universalLinkURL presentationParameters:screenPresentationParameters]; [self handleUniversalLinkWithParameters:newParameters]; } @@ -1470,14 +1470,14 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni roomPreviewData.viaServers = queryParams[@"via"]; } - RoomPreviewNavigationParameters *roomPreviewNavigationParameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:universalLinkPresentationParameters]; + RoomPreviewNavigationParameters *roomPreviewNavigationParameters = [[RoomPreviewNavigationParameters alloc] initWithPreviewData:roomPreviewData presentationParameters:screenPresentationParameters]; [account.mxSession.matrixRestClient roomSummaryWith:roomIdOrAlias via:roomPreviewData.viaServers success:^(MXPublicRoom *room) { if ([room.roomTypeString isEqualToString:MXRoomTypeStringSpace]) { [homeViewController stopActivityIndicator]; - SpacePreviewNavigationParameters *spacePreviewNavigationParameters = [[SpacePreviewNavigationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession presentationParameters:universalLinkPresentationParameters]; + SpacePreviewNavigationParameters *spacePreviewNavigationParameters = [[SpacePreviewNavigationParameters alloc] initWithPublicRoom:room mxSession:account.mxSession presentationParameters:screenPresentationParameters]; [self showSpacePreviewWithParameters:spacePreviewNavigationParameters]; } @@ -1555,7 +1555,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Create the contact related to this member MXKContact *contact = [[MXKContact alloc] initMatrixContactWithDisplayName:displayName andMatrixID:userId]; - [self showContact:contact presentationParameters:universalLinkPresentationParameters]; + [self showContact:contact presentationParameters:screenPresentationParameters]; continueUserActivity = YES; } @@ -1574,7 +1574,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } // Display the group details - [self showGroup:group withMatrixSession:account.mxSession presentationParamters:universalLinkPresentationParameters]; + [self showGroup:group withMatrixSession:account.mxSession presentationParamters:screenPresentationParameters]; continueUserActivity = YES; } From 2cb2464b36c897030f9d6723f9f8641c7e31d665 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 16:16:32 +0200 Subject: [PATCH 60/61] Update comments. --- .../RoomPreviewPresentationParameters.swift | 39 ------------------- .../ScreenPresentationParameters.swift | 2 +- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift diff --git a/Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift b/Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift deleted file mode 100644 index 4fc217951..000000000 --- a/Riot/Modules/Application/ScreenNavigation/RoomPreviewPresentationParameters.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// 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: RoomNavigationParameters { - - // 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) - } -} diff --git a/Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift b/Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift index 65d206514..6b7666eb7 100644 --- a/Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift +++ b/Riot/Modules/Application/ScreenNavigation/ScreenPresentationParameters.swift @@ -16,7 +16,7 @@ import Foundation -/// Presentation parameters used when a universal link is triggered +/// Screen presentation parameters used when a universal link is triggered @objcMembers class ScreenPresentationParameters: NSObject { From e46edb7fae90b9ee5d31c34c558742134445a816 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 16:45:13 +0200 Subject: [PATCH 61/61] Update Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- .../Messages/HomeMessagesSearchViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m index 635d84118..1050bbd1b 100644 --- a/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m +++ b/Riot/Modules/GlobalSearch/Messages/HomeMessagesSearchViewController.m @@ -153,9 +153,9 @@ ScreenPresentationParameters *presentationParameters = [[ScreenPresentationParameters alloc] initWithRestoreInitialDisplay:NO stackAboveVisibleViews:NO]; RoomNavigationParameters *parameters = [[RoomNavigationParameters alloc] initWithRoomId:roomId - eventId:eventId - mxSession:session - presentationParameters:presentationParameters]; + eventId:eventId + mxSession:session + presentationParameters:presentationParameters]; [[AppDelegate theDelegate] showRoomWithParameters:parameters]; }