Skip to content

feat: support creating challenge links#2828

Open
tom-anders wants to merge 1 commit intolichess-org:mainfrom
tom-anders:play-with-a-friend-rebased
Open

feat: support creating challenge links#2828
tom-anders wants to merge 1 commit intolichess-org:mainfrom
tom-anders:play-with-a-friend-rebased

Conversation

@tom-anders
Copy link
Copy Markdown
Collaborator

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

Closes #2015
Closes #856

Demo:

challengelink.webm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

@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
Copy link
Copy Markdown
Contributor

veloce commented Mar 23, 2026

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
Copy link
Copy Markdown
Contributor

@veloce veloce left a comment

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.

},
);
},
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?

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