-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Spaces] M10.8 Browsing users in a space #4682 #4742
Changes from 1 commit
7caa033
02c3d5f
91d9169
2e690e5
20fd906
4e3e803
e46f5fa
be96096
7b539ec
652d71b
db7bbc4
4da3741
c2e4d91
f4fb4be
ada879e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType { | |
private weak var splitViewCoordinator: SplitViewCoordinatorType? | ||
fileprivate weak var sideMenuCoordinator: SideMenuCoordinatorType? | ||
|
||
private let userSessionsService: UserSessionsService | ||
let userSessionsService: UserSessionsService | ||
|
||
/// Main user Matrix session | ||
private var mainMatrixSession: MXSession? { | ||
|
@@ -131,7 +131,7 @@ final class AppCoordinator: NSObject, AppCoordinatorType { | |
|
||
private func addSideMenu() { | ||
let appInfo = AppInfo.current | ||
let coordinatorParameters = SideMenuCoordinatorParameters(appNavigator: self.appNavigator, userSessionsService: self.userSessionsService, appInfo: appInfo) | ||
let coordinatorParameters = SideMenuCoordinatorParameters(appNavigator: self.appNavigator, appCoordinator: self, userSessionsService: self.userSessionsService, appInfo: appInfo) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
let coordinator = SideMenuCoordinator(parameters: coordinatorParameters) | ||
coordinator.delegate = self | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,16 @@ import SafariServices | |
|
||
class SideMenuCoordinatorParameters { | ||
let appNavigator: AppNavigatorProtocol | ||
let appCoordinator: AppCoordinator | ||
let userSessionsService: UserSessionsService | ||
let appInfo: AppInfo | ||
|
||
init(appNavigator: AppNavigatorProtocol, | ||
appCoordinator: AppCoordinator, | ||
userSessionsService: UserSessionsService, | ||
appInfo: AppInfo) { | ||
self.appNavigator = appNavigator | ||
self.appCoordinator = appCoordinator | ||
self.userSessionsService = userSessionsService | ||
self.appInfo = appInfo | ||
} | ||
|
@@ -218,7 +221,8 @@ final class SideMenuCoordinator: NSObject, SideMenuCoordinatorType { | |
} | ||
|
||
private func showMembers(spaceId: String, session: MXSession) { | ||
let spaceMembersCoordinator = SpaceMembersCoordinator(session: session, spaceId: spaceId) | ||
let parameters = SpaceMembersCoordinatorParameters(userSessionsService: parameters.appCoordinator.userSessionsService, session: session, spaceId: spaceId) | ||
let spaceMembersCoordinator = SpaceMembersCoordinator(parameters: parameters) | ||
spaceMembersCoordinator.delegate = self | ||
let presentable = spaceMembersCoordinator.toPresentable() | ||
presentable.presentationController?.delegate = self | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if it's fine to let it here I think it can be interesting to put |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try to keep it private and inject this instance from Coordinators to other Coordinators.
For places where we still can't inject instances such as
UserSessionsService
from side to side. The parent does not have the reference or the flow is started from ObjC class.We can temporary define and use a shared instance like
UserSessionsService.shared
but we still continue to inject it from the outside like:CoordinatorParameters(userSessionsService: UserSessionsService.shared)
to avoid having singleton inside Coordinators. And inAppCoordinator.init
we can temporary useself.userSessionsService = UserSessionsService.shared
until we can avoid singleton in the app.