Invitation Notification design improvements and navigation (#1091)

* invitation notification

* handling navigation to the invite view

* improved invite notifications

# Conflicts:
#	NSE/Sources/NotificationServiceExtension.swift

* improved the design

* improved the navigation handling on iPad vs iPhone

* comment

* code improvement

* better doc
This commit is contained in:
Mauro
2023-06-19 10:03:32 +02:00
committed by GitHub
parent 4de39201ed
commit 1b90060c9e
8 changed files with 89 additions and 39 deletions
@@ -71,8 +71,17 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.tryEvent(.presentRoomDetails(roomID: roomID), userInfo: EventUserInfo(animated: animated))
case .roomList:
stateMachine.tryEvent(.dismissRoom, userInfo: EventUserInfo(animated: animated))
case .invites:
break
}
}
func clearRoute(animated: Bool) {
guard stateMachine.state != .initial else {
return
}
stateMachine.tryEvent(.dismissRoom, userInfo: EventUserInfo(animated: animated))
}
// MARK: - Private
@@ -290,10 +299,10 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
private func dismissRoom(animated: Bool) {
// The room isn't in the same navigation stack of the home screen.
// Animating the popToRoot causes weird animations on when the room is left from room's details
navigationStackCoordinator.popToRoot(animated: false)
// Setting the detail coordinator to nil afirst allows the dismiss to work properly
// if followed immediately by another navigation on iPhone
navigationSplitCoordinator.setDetailCoordinator(nil, animated: animated)
navigationStackCoordinator.popToRoot(animated: false)
roomProxy = nil
timelineController = nil
@@ -91,13 +91,22 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
case .roomList, .initial:
break
}
switch appRoute {
case .room, .roomDetails, .roomList:
roomFlowCoordinator.handleAppRoute(appRoute, animated: animated)
case .invites:
if UIDevice.current.isPhone {
roomFlowCoordinator.clearRoute(animated: animated)
}
stateMachine.processEvent(.showInvitesScreen, userInfo: .init(animated: animated))
}
}
func clearRoute(animated: Bool) {
fatalError("not necessary as of right now")
}
// MARK: - Private
// swiftlint:disable:next cyclomatic_complexity
@@ -141,6 +150,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
case (.roomList, .showInvitesScreen, .invitesScreen):
self.presentInvitesList(animated: animated)
case (.invitesScreen, .showInvitesScreen, .invitesScreen):
break
case (.invitesScreen, .closedInvitesScreen, .roomList):
break
@@ -131,6 +131,9 @@ class UserSessionFlowCoordinatorStateMachine {
case (.showInvitesScreen, .roomList(let selectedRoomId)):
return .invitesScreen(selectedRoomId: selectedRoomId)
case (.showInvitesScreen, .invitesScreen(let selectedRoomId)):
return .invitesScreen(selectedRoomId: selectedRoomId)
case (.closedInvitesScreen, .invitesScreen(let selectedRoomId)):
return .roomList(selectedRoomId: selectedRoomId)