Repository navigation
Live Activity: keep every picture to what its surface and its node can draw - #8
Conversation
iOS draws a grey placeholder instead of a picture that is, on either side,
1.2 times the Live Activity's Lock Screen view (in pixels) or more. A
900x600 fallback asset was refused on a 3x iPhone ("Max size exceeded:
1346.4x576"), so the card showed a grey box. The old cap (900 px longest
side) did not keep the height under 576 px.
Every picture a card draws, the bundled asset and the picture the app
stored for an Image value, now goes through ffDrawable, which keeps each
side to 343 x 160 points at the screen's scale. Home screen widgets keep
their 900 px cap through the same helper (SwiftPictureBound).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sbis04
left a comment
There was a problem hiding this comment.
The Lock Screen fix works, but the compact and minimal island still draw the grey placeholder: the archive limit is per surface, not the Lock Screen's.
Repro (iPhone 17 Pro simulator, iOS 26.5, this branch): a Custom card with a 900x600 asset on a 24x24 image in islandCompactLeading and islandMinimal. Start the card, background the app. ffDrawable shrinks it to 720x480 and the extension still refuses it, once per surface:
[com.apple.chrono:archiving] [12: 720x480] Max size exceeded: 457.500000x220.000000; using placeholder image
457.5x220 px is about 127x61 pt at 3x times 1.2, so any picture over roughly 380x180 px in those surfaces turns grey. This covers assets and stored Image values alike: a value whose largest node fills the Lock Screen is stored at 900 px.
Suggestion: shrink to the node's frame when it is fixed (a 24 pt node needs 72 px), otherwise to a bound for each surface rather than one for the whole host.
Nit: FFValueImage now redraws the picture on every body pass. FFAssetImage caches its result; this could cache by image and scale too.
Checked otherwise: the 343x160 Lock Screen bound math holds, home widgets keep the 900 px bound, and the CHANGELOG line is there.
The archive limit is per surface, not the Lock Screen's: a 900x600 asset
in a 24x24 node on the compact and minimal island was shrunk to 720x480
and still refused ("Max size exceeded: 457.5x220").
- Each Custom card surface's view sets its own bound (the ffPictureBound
environment value). Limits measured on an iPhone 17 Pro, iOS 26.5, 3x:
Lock Screen and expanded 1346.4x576 px, each compact side 457.5x220,
minimal 202.5x220. Bounds: 343x160 pt (Lock Screen, expanded), 108x52
(compact), 48x52 (minimal), each about 85% of its limit or less. Home
widgets keep the 900 px longest-side default.
- An image node with a fixed frame passes it to FFAssetImage and
FFValueImage, and its picture is kept just large enough to cover it at
the screen's scale (a 24 pt node needs 72 px at 3x). One fixed side
bounds a contained picture only.
- FFAssetImage's cache key includes the bound and the frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shrunk picture is cached by the picture's identity, the screen's scale, the surface's bound and the node's frame, at most 16 entries (a few pictures on up to five surfaces). An entry keeps a weak reference to its source and is used only when that is the very same picture, so a new picture that takes a freed one's address never gets its result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rame Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, the archive limit is per surface. All three points are fixed:
On the simulator, your repro (900x600 asset in a 24x24 node on compact leading and minimal) plus a large picture with no fixed size on each of the five surfaces gave no "Max size exceeded" line. Without the bounds, the same card logged 24. The CHANGELOG entry is updated in f741327, and the PR description now has the measured table. All six new tests fail on fb1c6c6. |
sbis04
left a comment
There was a problem hiding this comment.
LGTM, thanks. Re-ran the repro on f741327 (iPhone 17 Pro simulator, iOS 26.5), adding a fill/cover 900x600 asset on compact trailing. Every picture was permitted, no "Max size exceeded":
| Surface | Picture | Archived |
|---|---|---|
| compact leading, 24x24 | 900x600 asset | 108x72 |
| minimal, 24x24 | 900x600 asset | 108x72 |
| compact trailing, fill/cover | 900x600 asset | 234x156 |
| Lock Screen, 36x36 | 120x120 asset | 108x108 |
Tests pass in all three packages, analyze clean.
Nit: home widgets change too. A fixed-size asset is now shrunk to its frame (a 40 pt node gets 120 px at 3x). That's harmless, but the CHANGELOG says home widgets "keep the 900 px longest side", which is now only true for images without a fixed size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Fixed the CHANGELOG in 71cc69d: home screen widgets keep the 900 px longest side as their bound, and a fixed-size image node is now shrunk to just what covers it, as on a card (a 40-point image gets 120 pixels at 3x). Images without a fixed size are drawn as before. The PR description says the same. |
Live Activity: keep every picture to what its surface and its node can draw
Problem
A Custom card's picture could show as an empty grey box. iOS archives each Live Activity surface's view and puts a grey placeholder in place of any picture that is, on either side, 1.2 times that surface's size or more, measured in pixels. Each surface has its own limit. The widget extension logs:
FFAssetImageonly capped the longest side at 900 px, so a 900x600 asset (600 px tall) was refused on the Lock Screen. The island surfaces are much smaller, so the compact and minimal island refused pictures that the Lock Screen draws. The picture the app stores for an Image value was drawn as stored, so it could hit the same limits.Change
flutterflow_native_layout:ffDrawable(_:_:)helper. Before a picture is drawn, it is shrunk to the bound of the surface it is on and, when the node has a fixed size, to just what covers that size at the screen'sdisplayScale(a 24-point node needs 72 px at 3x). With both sides fixed, the larger side ratio is used. With one fixed side, only a contained (.fit) picture is bounded by it: a cover or stretched picture fills the free side and may be drawn larger.ffPictureBoundenvironment value (FFPictureBound).nativeLayoutSwiftBuildingBlockstakes apictures:bound (SwiftPictureBound) as its default. A host whose surfaces differ sets it on each surface's view (SwiftPictureBound.swift). The default,kSwiftHomeWidgetPictureBound, is the current 900 px longest side, so home screen widgets keep that bound. Their fixed-size image nodes are now also shrunk to their frame (a 40-point node gets 120 px at 3x); images without a fixed size are drawn as before.width:/height:(points) toFFAssetImageandFFValueImage.FFAssetImagecaches by path, scale, bound and frame.FFValueImagecaches its shrunk picture by the picture's identity, scale, bound and frame (at most 16 entries). An entry keeps a weak reference to its source and is used only for that same picture, so a new picture that reuses a freed one's address never gets the old result.flutterflow_live_activity: each Custom card surface's view sets its own bound (kLiveActivityPictureBounds): 343 x 160 points on the Lock Screen and the expanded island, 108 x 52 on each compact side, 48 x 52 on the minimal island.kLiveActivityPictureBound(343 x 160) is the default.kLiveActivityImageMaxPixels, which said the limit was about a megapixel. Stored pictures are now shrunk again when drawn.FFIconLoader) already makes a 120-point thumbnail. It is only used where no layout is designed, so it is unchanged.Measured (iPhone 17 Pro simulator, iOS 26.5, 3x)
Each surface's limit, logged with the shrinking turned off and a distinct oversized picture on each surface:
Each bound is about 85% of its limit or less. The limit is 1.2 x the surface's points x the screen scale, so a bound in points has the same margin at 2x. The Lock Screen bound also fits a 375-point phone (about 343 points wide). The run without bounds logged 24 "Max size exceeded" lines. With this change, the log has none on any surface. The Lock Screen draws the photo where the run without bounds drew a grey box.
Lock Screen picture sizes found earlier, before this change:
Tests
flutterflow_live_activity:the cards Swift / shrinks every picture to the bound of the surface it is on. It checks each surface's bound and that each bound stays at least 10% under the measured limit.flutterflow_native_layout:every picture is kept to the bound of the surface it is ona picture with a fixed frame is kept just large enough to cover ita shrunk picture is cached by picture, scale, bound and framea picture / in a fixed frame is drawn no larger than ita picture / with one fixed side is drawn no larger than it only when containeddart analyzeis clean, and all tests pass: 57 in native_layout, 154 in live_activity, 51 at the root.Analytics
No new events. This changes generated Swift only. The visible change is that the picture appears instead of a grey box, and nothing reports image placeholders today.
🤖 Generated with Claude Code