Add iOS Daily Puzzle widget#2965
Conversation
All eight fixes applied cleanly. Here's a concise account of each change:
| # | File | Fix |
|---|------|-----|
| 1 | `app.dart` | Chained both `saveWidgetData` calls inside `Future.wait([…]).then((_) { updateWidget })`, matching the `kidMode` pattern |
| 2 | `BoardStyle.swift` | Added an explicit `"system"` case that returns the brown scheme with a comment documenting why (iOS always falls back to brown since `CorePalette`/Material You is Android-only) |
| 3 | `DailyPuzzleEntry.swift` | Changed the placeholder FEN to the position after `1.e4 e5 2.Nf3 Nc6` (`w` to move) with `lastMove: "b8c6"` — so `isWhiteToMove == true` and the board renders from white's perspective |
| 4 | `app.dart` | Added `prev != null` guard (equivalent to kidMode's `state.hasValue`) so the cold-start fire with `prev = nil` is ignored and the widget isn't reloaded on every app launch |
| 5 | `DailyPuzzleFetcher.swift` | `nextUpdateDate` now constructs a UTC `Calendar` (`TimeZone(identifier: "UTC")`) before computing the next 00:05 trigger |
| 6 | `DailyPuzzleProvider.swift` | `snapshot` simply returns `.placeholder` — no network call; the `isPreview` check was redundant since the real fix is to not hit the network at all in snapshot |
| 7 | `DailyPuzzleWidgetView.swift` | `errorView` now renders `Text(message)` instead of the hardcoded string, so the parameter is actually used |
| 8 | `BoardStyle.swift` | Removed `let teal = …` from the top of `from()` and made it a `private static let tealLastMove` — allocated once lazily, referenced only by the three cases that use it |
|
What an impressive work! I will take the time to test and review it. Just responding to your questions for now:
Yes indeed the small puzzle widget has low value. Moreover if we add later other board widgets (like correspondence games for instance) we'd not be able to distinguish them. So I think you should drop it.
I think this is a good idea yes. If you feel like it is not too much work we could do it already in this PR to avoid adding too much assets in this repo. |
|
I think we're slowly getting there 😎
|
|
Looks amazing 💯 Minor nitpick: |
@HaonRekcef of course, I'd just need the FEN, do you have something specific in mind? 🙂 |
|
What about a smothered mate like this: FEN: from this puzzle: https://lichess.org/training/cGsUy |
|
Noah's puzzle pointed out another minor graphical bug Puzzles over 999 should have no comma 😉 |
|
I'll check tomorrow but I suspect it's not a bug but a feature. Number formatting depends on the device's region setting. So it could well be it is correct |
veloce
left a comment
There was a problem hiding this comment.
LGTM! Great work as usual.



Adds a new iOS home screen widget that displays today's chess puzzle from lichess.org. Scroll down for demos.
Features
Board rendering:
Data & refresh:
/api/puzzle/daily; uses the host configured in the main app (supports local dev server)Notes for reviewers
Board texture and piece images are sourced from the
ChessgroundAssetsswift package fromflutter-chessgroundEXTENSIONS.mddocuments how external contributors can build and test the widget locally using their own Apple Developer account, and what a Lichess org member needs to do when merging a new extension.Showcase
Theme support
Error state
Configuration
Videos
demo_config.mov
theme_change.mov