mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Prevent crashes when tapping multiple space children in the spaces tab
Also introduce logs for SpaceFlowCoordinator state machine transitions
This commit is contained in:
committed by
Stefan Ceriu
parent
a7e7502780
commit
b2fefd5a7e
@@ -244,6 +244,16 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
selectedSpaceRoomSubject.send(nil)
|
selectedSpaceRoomSubject.send(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateMachine.addRouteMapping { event, fromState, _ in
|
||||||
|
guard case .startRoomFlow = event, case .roomFlow = fromState else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return fromState
|
||||||
|
} handler: { _ in
|
||||||
|
// Ignore tapping on multiple rooms at the same time
|
||||||
|
}
|
||||||
|
|
||||||
stateMachine.addRouteMapping { event, fromState, _ in
|
stateMachine.addRouteMapping { event, fromState, _ in
|
||||||
guard case .startRoomFlow = event, case .space = fromState else { return nil }
|
guard case .startRoomFlow = event, case .space = fromState else { return nil }
|
||||||
return .roomFlow(previousState: fromState)
|
return .roomFlow(previousState: fromState)
|
||||||
@@ -331,6 +341,14 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
stateMachine.addErrorHandler { context in
|
stateMachine.addErrorHandler { context in
|
||||||
fatalError("Unexpected transition: \(context)")
|
fatalError("Unexpected transition: \(context)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stateMachine.addAnyHandler(.any => .any) { context in
|
||||||
|
if let event = context.event {
|
||||||
|
MXLog.info("Transitioning from `\(context.fromState)` to `\(context.toState)` with event `\(event)`")
|
||||||
|
} else {
|
||||||
|
MXLog.info("Transitioning from \(context.fromState)` to `\(context.toState)`")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func presentSpace() {
|
private func presentSpace() {
|
||||||
|
|||||||
Reference in New Issue
Block a user