Add intrinsic sized bottom sheet

This commit is contained in:
Alfonso Grillo
2022-11-09 12:05:47 +01:00
parent f0027faba3
commit 1538a3b6ac
4 changed files with 44 additions and 9 deletions
@@ -126,7 +126,7 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
self.showLogoutConfirmation(for: [sessionInfo])
}
case let .showSessionStateInfo(sessionInfo):
self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo))
self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo, parentSize: self.toPresentable().view.bounds.size))
}
}
pushScreen(with: coordinator)
@@ -167,7 +167,7 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
case let .logoutFromUserSessions(sessionInfos: sessionInfos):
self.showLogoutConfirmation(for: sessionInfos)
case let .showSessionStateByFilter(filter):
self.showInfoSheet(parameters: .init(filter: filter))
self.showInfoSheet(parameters: .init(filter: filter, parentSize: self.toPresentable().view.bounds.size))
}
}
pushScreen(with: coordinator)
@@ -447,16 +447,18 @@ extension UserSessionsFlowCoordinator: UIAdaptivePresentationControllerDelegate
// MARK: Private
private extension InfoSheetCoordinatorParameters {
init(userSessionInfo: UserSessionInfo) {
init(userSessionInfo: UserSessionInfo, parentSize: CGSize) {
self.init(title: userSessionInfo.bottomSheetTitle,
description: userSessionInfo.bottomSheetDescription,
action: .init(text: VectorL10n.userSessionGotIt, action: { }))
action: .init(text: VectorL10n.userSessionGotIt, action: { }),
parentSize: parentSize)
}
init(filter: UserOtherSessionsFilter) {
init(filter: UserOtherSessionsFilter, parentSize: CGSize) {
self.init(title: filter.bottomSheetTitle,
description: filter.bottomSheetDescription,
action: .init(text: VectorL10n.userSessionGotIt, action: { }))
action: .init(text: VectorL10n.userSessionGotIt, action: { }),
parentSize: parentSize)
}
}
@@ -61,7 +61,8 @@ final class UserSessionNameCoordinator: NSObject, Coordinator, Presentable {
case .learnMore:
self.showInfoSheet(parameters: .init(title: VectorL10n.userSessionRenameSessionTitle,
description: VectorL10n.userSessionRenameSessionDescription,
action: .init(text: VectorL10n.userSessionGotIt, action: {})))
action: .init(text: VectorL10n.userSessionGotIt, action: {}),
parentSize: self.toPresentable().view.bounds.size))
}
}
}