feat(app): open chats from pipelines://chat/<id> notification links
The app routes pipelines://chat/<id> to that chat, alongside the existing pipelines://run/<id>, and Android registers the chat host so a tapped ntfy notification opens the app on it.
This commit is contained in:
@@ -26,12 +26,15 @@ class AppRouteParser extends RouteInformationParser<AppRoute> {
|
||||
/// `/runs/7/stage/plan?visit=1` keeps the query instead of losing it to
|
||||
/// `Uri.path`. A fragment is not part of an app route.
|
||||
///
|
||||
/// The native notification link `pipelines://run/<id>` (the URL the server
|
||||
/// publishes as the notification's click target, as the Android client
|
||||
/// registers it) is the run route `/runs/<id>`.
|
||||
/// The native notification links the server publishes as a notification's
|
||||
/// click target (and the apps register): `pipelines://run/<id>` is the run
|
||||
/// route `/runs/<id>` and `pipelines://chat/<id>` the chat route `/chat/<id>`.
|
||||
String routeLocation(Uri uri) {
|
||||
final path = uri.scheme == 'pipelines' && uri.host == 'run'
|
||||
final native = uri.scheme == 'pipelines';
|
||||
final path = native && uri.host == 'run'
|
||||
? '/runs${uri.path}'
|
||||
: native && uri.host == 'chat'
|
||||
? '/chat${uri.path}'
|
||||
: uri.path;
|
||||
return uri.hasQuery ? '$path?${uri.query}' : path;
|
||||
}
|
||||
@@ -218,7 +221,6 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
_route = route;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// The location a launch starts at: the browser location on the web, the
|
||||
|
||||
Reference in New Issue
Block a user