Handle alias room permalinks

This commit is contained in:
Stefan Ceriu
2024-04-22 18:05:18 +03:00
committed by Stefan Ceriu
parent 8ba544bc44
commit 69ffd3be46
8 changed files with 200 additions and 44 deletions
@@ -190,16 +190,21 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
}
case .userProfile(let userID):
if isExternalURL {
userSessionFlowCoordinator?.handleAppRoute(route, animated: true)
handleAppRoute(route)
} else {
userSessionFlowCoordinator?.handleAppRoute(.roomMemberDetails(userID: userID), animated: true)
handleAppRoute(.roomMemberDetails(userID: userID))
}
case .room(let roomID):
// check that the room is joined here, if not use a joinRoom route.
if isExternalURL {
userSessionFlowCoordinator?.handleAppRoute(route, animated: true)
handleAppRoute(route)
} else {
userSessionFlowCoordinator?.handleAppRoute(.childRoom(roomID: roomID), animated: true)
handleAppRoute(.childRoom(roomID: roomID))
}
case .roomAlias(let alias):
if isExternalURL {
handleAppRoute(route)
} else {
handleAppRoute(.childRoomAlias(alias))
}
default:
break
@@ -255,7 +260,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
return
}
// Handle here the account switching when available
handleAppRoute(.room(roomID: roomID))
}
@@ -24,8 +24,12 @@ enum AppRoute: Equatable {
case roomList
/// A room, shown as the root of the stack (popping any child rooms).
case room(roomID: String)
/// A room, shown as the root of the stack (popping any child rooms).
case roomAlias(String)
/// A room, pushed as a child of any existing rooms on the stack.
case childRoom(roomID: String)
/// A room, pushed as a child of any existing rooms on the stack.
case childRoomAlias(String)
/// The information about a particular room.
case roomDetails(roomID: String)
/// The profile of a member within the current room.
@@ -125,6 +129,8 @@ struct MatrixPermalinkParser: URLParser {
switch parseMatrixEntityFrom(uri: url.absoluteString)?.id {
case .room(let id):
return .room(roomID: id)
case .roomAlias(let alias):
return .roomAlias(alias)
case .user(let id):
return .userProfile(userID: id)
default: