feat: support creating challenge links#2828
feat: support creating challenge links#2828tom-anders wants to merge 1 commit intolichess-org:mainfrom
Conversation
There was a problem hiding this comment.
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.destUserto be nullable and implement/api/challenge/opencreation with immediate self-accept (color selection). - Introduce new game-screen states and loading UI for open challenges, including link/QR sharing.
- Add
qr_flutterdependency and adjust call sites to the updatedCreateChallengeBottomSheetconstructor.
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.
5c6705d to
0b52b69
Compare
e7118df to
0e0f2d6
Compare
|
I'll put this on hold until we figure out how to deal with anon challenge creation. |
0e0f2d6 to
3d62e46
Compare
|
@veloce Fix for anon challenges is here: lichess-org/lila#20101 so I think you can start reviewing already if you have the time |
3d62e46 to
e169d95
Compare
veloce
left a comment
There was a problem hiding this comment.
Code looks good!
Now I need some time to test this properly.
| }, | ||
| ); | ||
| }, | ||
| leading: const Icon(LichessIcons.crossed_swords), |
There was a problem hiding this comment.
Perhaps find a better icon here. I'll think about it. Like a link or qr code icon maybe.
There was a problem hiding this comment.
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?
Closes #2015
Closes #856
Demo:
challengelink.webm