immich/mobile/test
Timon f0cf3311d5
feat(mobile): Allow users to set profile picture from asset viewer (#25517)
* init

* fix

* styling

* temporary workaround for 500 error

**Root cause:**
The autogenerated Dart OpenAPI client (`UsersApi.createProfileImage()`) had two issues:
1. It set `Content-Type: multipart/form-data` without a boundary, which overrode the correct header that Dart's `MultipartRequest` would set (`multipart/form-data; boundary=...`).
2. It added the file to both `mp.fields` and `mp.files`, creating a duplicate text field.

**Result:**
Multer on the server failed to parse the multipart body, so `@UploadedFile()` was `undefined` → accessing `file.path` in `UserService.createProfileImage()` threw → **500 Internal Server Error**.

**Workaround:**
Bypass the autogenerated method in `UserApiRepository.createProfileImage()` and send the multipart request directly using the same `ApiClient` (basePath + auth), ensuring:
- No manual `Content-Type` header (let `MultipartRequest` set it with boundary)
- File only in `mp.files`, not `mp.fields`
- Proper filename fallback

* Revert "temporary workaround for 500 error"

This reverts commit 8436cd402632ca7be9272a1c72fdaf0763dcefb6.

* generate route for ProfilePictureCropPage

* add route import

* simplify

* try this

* Revert "try this"

This reverts commit fcf37d2801055c49010ddb4fd271feb900ee645a.

* try patching

* Reapply "temporary workaround for 500 error"

This reverts commit faeed810c21e4c9f0839dfff1f34aa6183469e56.

* Revert "Reapply "temporary workaround for 500 error""

This reverts commit a14a0b76d14975af98ef91748576a79cef959635.

* fix upload

* Refactor image conversion logic by introducing a new utility function. Replace inline image-to-Uint8List conversion with the new utility in EditImagePage, DriftEditImagePage, and ProfilePictureCropPage.

* use toast over snack

* format

* Revert "try patching"

This reverts commit 68a616522a1eee88c4a9755a314c0017e6450c0f.

* Enhance toast notification in ProfilePictureCropPage to include success type for better user feedback.

* Revert "simplify"

This reverts commit 8e85057a40.

* format

* add tests

* refactor to use statefulwidget

* format

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
2026-02-22 06:02:33 +00:00
..
domain feat(mobile): enhance album sorting functionality with order handling (#24816) 2026-02-07 10:11:37 +05:30
drift/main chore: add indexes for foreign keys (#25925) 2026-02-12 19:58:31 +05:30
fixtures fix: mobile edit handling (#25315) 2026-01-19 12:22:53 -06:00
infrastructure fix: local date time group fall back (#26110) 2026-02-10 11:47:13 -06:00
mocks feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473) 2025-11-10 16:20:51 +00:00
modules feat: image editing (#24155) 2026-01-09 17:59:52 -05:00
pages/search chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
presentation/widgets/remote_album feat(mobile): album options to kebab menu (#24204) 2025-12-26 18:46:05 +00:00
services fix: free up space using small batch size to reliably work on Android (#26047) 2026-02-09 11:48:55 -06:00
test_utils fix: mobile edit handling (#25315) 2026-01-19 12:22:53 -06:00
utils feat(mobile): Allow users to set profile picture from asset viewer (#25517) 2026-02-22 06:02:33 +00:00
api.mocks.dart fix: width and height migration issue (#25643) 2026-01-28 15:14:50 -06:00
dto.mocks.dart fix(mobile): fix text search (#14873) 2025-01-07 16:26:14 +00:00
mock_http_override.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
repository.mocks.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
service.mocks.dart fix(mobile): auto trash using MANAGE_MEDIA (#17828) 2025-04-24 19:09:50 -05:00
test_utils.dart fix: mobile edit handling (#25315) 2026-01-19 12:22:53 -06:00
widget_tester_extensions.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00