Skip to content

feat: support creating challenge links#2828

Merged
veloce merged 6 commits into
lichess-org:mainfrom
tom-anders:play-with-a-friend-rebased
Mar 31, 2026
Merged

feat: support creating challenge links#2828
veloce merged 6 commits into
lichess-org:mainfrom
tom-anders:play-with-a-friend-rebased

Conversation

@tom-anders

@tom-anders tom-anders commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #2015
Closes #856

Demo:

challengelink.webm

EDIT

Issues found during testing (WIP):

  • create a challenge with a logged in user, scan QR code to open it in the app with a anonymous; the app let you decline the challenge with a reason, but the challenger never received the update nor the decline reason

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “challenge a friend” support by enabling creation of open challenges (no destination user) and surfacing a shareable link + QR code while waiting for an opponent, addressing the “game invite link” feature requests.

Changes:

  • Allow ChallengeRequest.destUser to be nullable and implement /api/challenge/open creation with immediate self-accept (color selection).
  • Introduce new game-screen states and loading UI for open challenges, including link/QR sharing.
  • Add qr_flutter dependency and adjust call sites to the updated CreateChallengeBottomSheet constructor.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/model/challenge/challenge_repository_test.dart Adds coverage for creating an open challenge and auto-accepting with chosen color.
pubspec.yaml Adds qr_flutter dependency.
pubspec.lock Locks qr_flutter and transitive qr.
lib/src/widgets/board.dart Changes overlay layout to be unconstrained/centered.
lib/src/view/user/user_screen.dart Updates CreateChallengeBottomSheet call to named param.
lib/src/view/user/online_bots_screen.dart Updates CreateChallengeBottomSheet call to named param.
lib/src/view/play/play_menu.dart Adds “Challenge a friend” entry that opens the challenge bottom sheet with user: null.
lib/src/view/play/create_challenge_bottom_sheet.dart Makes user nullable via named constructor args.
lib/src/view/game/game_screen_providers.dart Adds open/user challenge “created” states and splits challenge creation vs response waiting.
lib/src/view/game/game_screen.dart Adds rendering for OpenChallengeCreatedState and renames loading widget for user challenges.
lib/src/view/game/game_loading_board.dart Adds open-challenge waiting UI with link copy + QR + share button; refactors overlay card UI.
lib/src/view/board_editor/board_editor_screen.dart Updates CreateChallengeBottomSheet call to named params.
lib/src/model/lobby/create_game_service.dart Splits challenge creation from waiting for challenge response.
lib/src/model/challenge/challenge_repository.dart Implements /api/challenge/open create + immediate accept; adds accept color query param.
lib/src/model/challenge/challenge_preferences.dart Allows makeRequest to accept nullable destination user.
lib/src/model/challenge/challenge.dart Makes ChallengeRequest.destUser nullable and documents open-challenge semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/view/game/game_loading_board.dart Outdated
Comment thread lib/src/view/game/game_loading_board.dart Outdated
Comment thread lib/src/view/game/game_loading_board.dart
Comment thread lib/src/view/game/game_loading_board.dart
Comment thread lib/src/view/game/game_screen_providers.dart
Comment thread lib/src/view/game/game_screen_providers.dart
@tom-anders tom-anders force-pushed the play-with-a-friend-rebased branch 3 times, most recently from 5c6705d to 0b52b69 Compare March 22, 2026 21:23
@tom-anders tom-anders marked this pull request as ready for review March 22, 2026 21:24
@tom-anders tom-anders force-pushed the play-with-a-friend-rebased branch 2 times, most recently from e7118df to 0e0f2d6 Compare March 22, 2026 21:57
@veloce

veloce commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

I'll put this on hold until we figure out how to deal with anon challenge creation.

@tom-anders tom-anders force-pushed the play-with-a-friend-rebased branch from 0e0f2d6 to 3d62e46 Compare March 26, 2026 19:39
@tom-anders

Copy link
Copy Markdown
Collaborator Author

@veloce Fix for anon challenges is here: lichess-org/lila#20101 so I think you can start reviewing already if you have the time

@tom-anders tom-anders force-pushed the play-with-a-friend-rebased branch from 3d62e46 to e169d95 Compare March 26, 2026 19:53

@veloce veloce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

Now I need some time to test this properly.

Comment thread lib/src/view/play/play_menu.dart Outdated
},
);
},
leading: const Icon(LichessIcons.crossed_swords),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps find a better icon here. I'll think about it. Like a link or qr code icon maybe.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, on the website it uses the friend icon.

Btw, as a follow-up, I’m planning to add a „or challenge a friend“ button to the „share challenge link“ dialog which would open the friends screen and allow you to pick a user, turning the open challenge into a directed one. The website has the same functionality, what do you think about adding it here as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better in another PR (that you can base on this one if you like).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, just wanted to get a quick feedback before I'd start working on it. I'll wait for this PR to be merged first and then do a follow-up

@veloce veloce force-pushed the play-with-a-friend-rebased branch from e169d95 to a6ce096 Compare March 30, 2026 09:14
@veloce veloce merged commit 4e0e13c into lichess-org:main Mar 31, 2026
1 check passed
veloce pushed a commit that referenced this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game Invites [Feature request]PLAYING ONLINE WITH UNREGISTERED FRIEND ON LICHESS..

3 participants