Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<data android:pathPattern="/training/....." />
<data android:pathPattern="/study/........" />

<data android:pathPattern="/storm" />
<data android:pathPattern="/streak" />
<data android:path="/storm" />
<data android:path="/streak" />

<!-- Either game or challenge -->
<data android:pathPattern="/........" />
Expand Down
38 changes: 17 additions & 21 deletions lib/src/app_links.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,37 @@ import 'package:lichess_mobile/src/view/puzzle/streak_screen.dart';
import 'package:lichess_mobile/src/view/study/study_screen.dart';

Route<dynamic>? resolveAppLinkUri(BuildContext context, Uri appLinkUri) {
if (appLinkUri.pathSegments.length < 2 || appLinkUri.pathSegments[1].isEmpty) {
return null;
}

final id = appLinkUri.pathSegments[1];
if (appLinkUri.pathSegments.isEmpty) return null;

switch (appLinkUri.pathSegments[0]) {
case 'streak':
return buildScreenRoute(context, screen: const StreakScreen());
case 'storm':
return buildScreenRoute(context, screen: const StormScreen());
case 'study':
final id = appLinkUri.pathSegments[1];
return buildScreenRoute(context, screen: StudyScreen(id: StudyId(id)));
case 'training':
final id = appLinkUri.pathSegments[1];
return buildScreenRoute(
context,
screen: PuzzleScreen(angle: PuzzleAngle.fromKey('mix'), puzzleId: PuzzleId(id)),
);
case _:
{
final gameId = GameId(appLinkUri.pathSegments[0]);
final orientation = appLinkUri.pathSegments.getOrNull(2);
if (gameId.isValid) {
return buildScreenRoute(
context,
screen: ArchivedGameScreen(
gameId: gameId,
orientation: orientation == 'black' ? Side.black : Side.white,
),
);
} else {
// TODO if it's not a game, it's a challenge.
// So we should show a accept/decline screen here.
return null;
}
final gameId = GameId(appLinkUri.pathSegments[0]);
final orientation = appLinkUri.pathSegments.getOrNull(2);
if (gameId.isValid) {
return buildScreenRoute(
context,
screen: ArchivedGameScreen(
gameId: gameId,
orientation: orientation == 'black' ? Side.black : Side.white,
),
);
} else {
// TODO if it's not a game, it's a challenge.
// So we should show a accept/decline screen here.
return null;
}
}
}