Fix deep link loop for imported games with anonymous players#3046
Conversation
|
Just noticed that #3043 was opened and merged while I was working on my PR. You guys are fast :). This one might not be required anymore. |
|
@berenbums I see you added a test case that is useful so you could create a new PR with the test :) |
|
The PR is still useful imo, can you solve the conflict @berenbums ? Thanks! |
da4d367 to
500471f
Compare
|
Combined the changes and updated the test case. Thank you for the quick feedback! |
|
Hmm, I am not sure we want the proposed changes: When getting a live game link of a game between two anon users we would end in the analysis board, where there wont be any move updates. Ideally we should open it in the tvScreen. |
|
I see. I didn't get that, thanks for the insight @HaonRekcef . So we only want the test in this PR @berenbums |
500471f to
2b64bc8
Compare
|
Makes sense to me, thanks @HaonRekcef . Updated the PR so it only adds a new test case: A |
Summary
Imported PGNs without a
[Result]tag and without[White]/[Black]tags fall into an infinite deep-link loop when shared into the Lichess mobile app. This PR routes those games to the analysis screen instead.Reproducible by hitting
POST /api/importwith a PGN that lacks a result and player tags and then opening the returnedhttps://lichess.org/{id}.Root cause
When a PGN is imported without a
Resulttag, Lichess records the game withstatus: "started". When[White]/[Black]tags are missing too, the players come back anonymous ({"name": "?"}with nouser)._tryResolveGameLinkinapp_links_service.dartthen returnsnull, because both, the AnalysisScreen (game.finished) and TvScreen (game.playerOf(orientation).user) checks fail.handleAppLinkfalls through tolaunchUrl(uri), which the OS routes back into the app via the verifiedlichess.org/{id}intent filter, looping indefinitely.Fix
Open the game in
AnalysisScreenwhenever it's finished or has no real player on the orientation side. Open inTvScreenotherwise.