mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 06:36:58 +02:00
Fix memory leak
This commit is contained in:
@@ -22,7 +22,7 @@ struct UserSessionsFlowCoordinatorParameters {
|
||||
let router: NavigationRouterType
|
||||
}
|
||||
|
||||
final class UserSessionsFlowCoordinator: Coordinator, Presentable {
|
||||
final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
|
||||
private let parameters: UserSessionsFlowCoordinatorParameters
|
||||
private let allSessionsService: UserSessionsOverviewService
|
||||
|
||||
@@ -191,6 +191,7 @@ final class UserSessionsFlowCoordinator: Coordinator, Presentable {
|
||||
private func showInfoSheet(parameters: InfoSheetCoordinatorParameters) {
|
||||
let coordinator = InfoSheetCoordinator(parameters: parameters)
|
||||
|
||||
coordinator.toPresentable().presentationController?.delegate = self
|
||||
coordinator.completion = { [weak self, weak coordinator] result in
|
||||
guard let self = self, let coordinator = coordinator else { return }
|
||||
|
||||
@@ -289,7 +290,7 @@ final class UserSessionsFlowCoordinator: Coordinator, Presentable {
|
||||
let modalRouter = NavigationRouter(navigationController: RiotNavigationController())
|
||||
modalRouter.setRootModule(coordinator)
|
||||
coordinator.start()
|
||||
|
||||
modalRouter.toPresentable().presentationController?.delegate = self
|
||||
navigationRouter.present(modalRouter, animated: true)
|
||||
}
|
||||
|
||||
@@ -419,17 +420,31 @@ extension UserSessionsFlowCoordinator: UserVerificationCoordinatorDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIAdaptivePresentationControllerDelegate
|
||||
|
||||
extension UserSessionsFlowCoordinator: UIAdaptivePresentationControllerDelegate {
|
||||
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
||||
guard let coordinator = childCoordinators.last else {
|
||||
return
|
||||
}
|
||||
|
||||
remove(childCoordinator: coordinator)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension InfoSheetCoordinatorParameters {
|
||||
init(userSessionInfo: UserSessionInfo) {
|
||||
self.init(title: userSessionInfo.bottomSheetTitle,
|
||||
description: userSessionInfo.bottomSheetDescription,
|
||||
action: .init(text: VectorL10n.userSessionGotIt, action: {}))
|
||||
action: .init(text: VectorL10n.userSessionGotIt, action: { }))
|
||||
}
|
||||
|
||||
init(filter: UserOtherSessionsFilter) {
|
||||
self.init(title: filter.bottomSheetTitle,
|
||||
description: filter.bottomSheetDescription,
|
||||
action: .init(text: VectorL10n.userSessionGotIt, action: {}))
|
||||
action: .init(text: VectorL10n.userSessionGotIt, action: { }))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-2
@@ -22,7 +22,7 @@ struct UserSessionNameCoordinatorParameters {
|
||||
let sessionInfo: UserSessionInfo
|
||||
}
|
||||
|
||||
final class UserSessionNameCoordinator: Coordinator, Presentable {
|
||||
final class UserSessionNameCoordinator: NSObject, Coordinator, Presentable {
|
||||
private let parameters: UserSessionNameCoordinatorParameters
|
||||
private let userSessionNameHostingController: UIViewController
|
||||
private var userSessionNameViewModel: UserSessionNameViewModelProtocol
|
||||
@@ -102,7 +102,7 @@ final class UserSessionNameCoordinator: Coordinator, Presentable {
|
||||
|
||||
private func showInfoSheet(parameters: InfoSheetCoordinatorParameters) {
|
||||
let coordinator = InfoSheetCoordinator(parameters: parameters)
|
||||
|
||||
coordinator.toPresentable().presentationController?.delegate = self
|
||||
coordinator.completion = { [weak self, weak coordinator] result in
|
||||
guard let self = self, let coordinator = coordinator else { return }
|
||||
|
||||
@@ -118,3 +118,15 @@ final class UserSessionNameCoordinator: Coordinator, Presentable {
|
||||
toPresentable().present(coordinator.toPresentable(), animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIAdaptivePresentationControllerDelegate
|
||||
|
||||
extension UserSessionNameCoordinator: UIAdaptivePresentationControllerDelegate {
|
||||
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
||||
guard let coordinator = childCoordinators.last else {
|
||||
return
|
||||
}
|
||||
|
||||
remove(childCoordinator: coordinator)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user