Skip to content

Conversation

@prateekmedia
Copy link
Member

@prateekmedia prateekmedia commented Oct 29, 2025

Description

Use 1024px for widgets

  • Enables it for internal users.

Tests

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 587 to 615
Future<Map<String, dynamic>?> _processWidgetImage(
Map<String, dynamic> param,
) async {
final Uint8List bytes = param['bytes'] as Uint8List;
final int targetSize = param['targetSize'] as int;

final img.Image? decoded = img.decodeImage(bytes);
if (decoded == null) {
return null;
}

final int originalWidth = decoded.width;
final int originalHeight = decoded.height;
final int minSide = math.min(originalWidth, originalHeight);
if (minSide <= 0) {
return null;
}

img.Image working = decoded;
bool croppedToSquare = false;
if (originalWidth != originalHeight) {
final int cropSize = minSide;
final int left = ((originalWidth - cropSize) / 2).round();
final int top = ((originalHeight - cropSize) / 2).round();
working = img.copyCrop(
decoded,
x: math.max(0, left),
y: math.max(0, top),
width: cropSize,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle EXIF orientation before cropping widget images

The new PNG generation path decodes bytes with img.decodeImage and immediately crops/resizes the raw buffer, but the image package does not apply EXIF orientation. Portrait photos whose rotation is stored in metadata will therefore be written sideways and cropped from the wrong edge. The previous implementation rendered via Flutter codecs, which respect EXIF, so this is a regression that will misalign a large fraction of camera images. Consider baking orientation (e.g. img.bakeOrientation) or decoding with a codec that honors EXIF before cropping.

Useful? React with 👍 / 👎.

@prateekmedia prateekmedia marked this pull request as draft November 3, 2025 13:25
@prateekmedia prateekmedia changed the title [mob][photos] upscale widget images to 1024px [mob][photos] resize widget images to 1024px Nov 4, 2025
@prateekmedia prateekmedia marked this pull request as ready for review November 4, 2025 13:06
@prateekmedia
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 355 to 359
try {
final File? downloaded = await downloadAndDecrypt(file);
if (downloaded != null && await downloaded.exists()) {
final Uint8List bytes = await downloaded.readAsBytes();
if (bytes.isNotEmpty) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remote widget images bypass cache and redownload each update

The new V2 code now fetches remote images via downloadAndDecrypt and later deletes the returned file in _WidgetSourceBytes.dispose. The previous implementation called getFileFromServer, which stores decrypted files in the cache manager so subsequent widget syncs can reuse them. With this change, every widget refresh will download and decrypt the same photo again, even when it was already fetched, which unnecessarily increases network traffic and battery usage for widgets that sync periodically. Reusing getFileFromServer or persisting the downloaded file would keep the caching behavior.

Useful? React with 👍 / 👎.

- Fix caching: use getFileFromServer instead of downloadAndDecrypt
- Add file size check (50MB limit) before downloading remote files
- Track failed render attempts to avoid retry loops on bad files
- Add try-catch around image processing to handle malformed images/OOM
- Show dimensions and source label for internal users with TODO
- Remove duplicate home_widget import and fix type reference

Co-authored-by: Claude <[email protected]>
@prateekmedia
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ua741
Copy link
Member

ua741 commented Nov 10, 2025

As discussed, let's keep the logic to render within home_page.dart only

@prateekmedia prateekmedia merged commit 231bc96 into ente-io:main Nov 10, 2025
4 checks passed
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.

2 participants