mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Added a delayed loading when opening a room (#3748)
* added a delayed loader * fixed an issue where the loading was not stopped * pr suggestions
This commit is contained in:
parent
b900eec5a2
commit
7560f2c5f1
@ -229,6 +229,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
private func handleRoomRoute(roomID: String, via: [String], presentationAction: PresentationAction? = nil, animated: Bool) async {
|
||||
guard roomID == self.roomID else { fatalError("Navigation route doesn't belong to this room flow.") }
|
||||
|
||||
showLoadingIndicator(delay: .milliseconds(250))
|
||||
defer { hideLoadingIndicator() }
|
||||
guard let room = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||
stateMachine.tryEvent(.presentJoinRoomScreen(via: via), userInfo: EventUserInfo(animated: animated))
|
||||
return
|
||||
@ -1618,6 +1620,21 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
flowCoordinator.start()
|
||||
}
|
||||
|
||||
private static let loadingIndicatorID = "\(RoomFlowCoordinator.self)-Loading"
|
||||
|
||||
private func showLoadingIndicator(delay: Duration? = nil) {
|
||||
userIndicatorController.submitIndicator(.init(id: Self.loadingIndicatorID,
|
||||
type: .modal(progress: .indeterminate,
|
||||
interactiveDismissDisabled: false,
|
||||
allowsInteraction: false),
|
||||
title: L10n.commonLoading, persistent: true),
|
||||
delay: delay)
|
||||
}
|
||||
|
||||
private func hideLoadingIndicator() {
|
||||
userIndicatorController.retractIndicatorWithId(Self.loadingIndicatorID)
|
||||
}
|
||||
}
|
||||
|
||||
private extension RoomFlowCoordinator {
|
||||
|
Loading…
x
Reference in New Issue
Block a user