mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Notifications are now handled when the app is in a killed state (#801)
* WIP, added support for receiver id and managed a way to store the app router state * WIP, added support for receiver id and managed a way to store the app router state * Notification Manager is now becoming the UNUserNotificationDelegate ASAP * code improvements + changelog * fixed Unit Tests * pr suggestions
This commit is contained in:
@@ -16,6 +16,40 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
import URLRouting
|
||||
|
||||
enum AppRoute {
|
||||
case room(roomID: String)
|
||||
}
|
||||
|
||||
struct AppRouterManager {
|
||||
private let deeplinkRouter = OneOf {
|
||||
Route(.case(AppRoute.room(roomID:))) {
|
||||
// Check with product if this is the expect path
|
||||
Path { "room" }
|
||||
Query {
|
||||
Field("id") { Parse(.string) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let permalinkRouter = OneOf {
|
||||
Route(.case(AppRoute.room(roomID:))) {
|
||||
Host("matrix.to")
|
||||
Path {
|
||||
"#"
|
||||
Parse(.string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func route(from url: URL) -> AppRoute? {
|
||||
var route: AppRoute?
|
||||
if let deeplinkRoute = try? deeplinkRouter.match(url: url) {
|
||||
route = deeplinkRoute
|
||||
} else if let permalinkRoute = try? permalinkRouter.match(url: url) {
|
||||
route = permalinkRoute
|
||||
}
|
||||
return route
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user