immich/mobile/lib/providers
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
..
album feat(mobile): enhance album sorting functionality with order handling (#24816) 2026-02-07 10:11:37 +05:30
asset_viewer chore: dart http foreground upload (#24883) 2026-01-15 20:10:08 -06:00
backup fix: upload progress bar flickering (#25829) 2026-02-03 09:28:29 -06:00
image refactor(mobile): consolidate image requests (#25743) 2026-02-05 12:16:42 -05:00
infrastructure feat(mobile): Allow users to set album cover from mobile app (#25515) 2026-02-22 05:53:39 +00:00
map chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
search chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
timeline chore: refactor mobile events (#24263) 2025-11-30 12:43:33 -06:00
activity.provider.dart fix(mobile): sync album and asset activity state when add/remove asset level activity (#23484) 2025-11-10 13:25:43 -06:00
activity.provider.g.dart fix(mobile): sync album and asset activity state when add/remove asset level activity (#23484) 2025-11-10 13:25:43 -06:00
activity_service.provider.dart feat: (mobile) open asset viewer from album activity page (#23182) 2025-10-24 09:02:56 -05:00
activity_service.provider.g.dart feat: (mobile) open asset viewer from album activity page (#23182) 2025-10-24 09:02:56 -05:00
activity_statistics.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
activity_statistics.provider.g.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
api.provider.dart feat(mobile): enabled DCM (#17957) 2025-06-09 11:09:02 -05:00
api.provider.g.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
app_life_cycle.provider.dart fix: slow hash reconcilation (#25503) 2026-01-26 09:12:00 -06:00
app_settings.provider.dart refactor: DCM - const border radius, constructor & switch expressions (#19515) 2025-06-25 13:06:24 +05:30
app_settings.provider.g.dart refactor: DCM - const border radius, constructor & switch expressions (#19515) 2025-06-25 13:06:24 +05:30
asset.provider.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
auth.provider.dart chore: dart http foreground upload (#24883) 2026-01-15 20:10:08 -06:00
background_sync.provider.dart feat: add cloud id during native sync (#20418) 2026-01-14 12:34:11 -06:00
cast.provider.dart fix: mobile edit handling (#25315) 2026-01-19 12:22:53 -06:00
cleanup.provider.dart feat: keep settings for free up space (#25460) 2026-01-24 10:40:34 -06:00
db.provider.dart refactor(mobile): services and providers (#9232) 2024-05-02 15:59:14 -05:00
folder.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
gallery_permission.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
haptic_feedback.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
immich_logo_provider.dart feat(mobile): enabled DCM (#17957) 2025-06-09 11:09:02 -05:00
immich_logo_provider.g.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
local_auth.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
locale_provider.dart feat(mobile): exclude locales from overpass font (#14158) 2024-11-19 09:36:46 -06:00
memory.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
multiselect.provider.dart refactor(mobile): services and providers (#9232) 2024-05-02 15:59:14 -05:00
network.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
notification_permission.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
oauth.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
partner.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
routes.provider.dart fix: show in timeline from search page (#23440) 2025-10-31 14:55:28 -05:00
secure_storage.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
server_info.provider.dart fix(mobile): hide latest version warnings (#26036) 2026-02-13 08:15:25 +05:30
shared_link.provider.dart fix: mobile unawaited_futures lint (#21661) 2025-10-27 09:32:52 -05:00
sync_status.provider.dart feat: add cloud id during native sync (#20418) 2026-01-14 12:34:11 -06:00
tab.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
theme.provider.dart chore(mobile): add debugPrint lint rule (#21872) 2025-09-12 18:56:00 -04:00
timeline.provider.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
trash.provider.dart feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473) 2025-11-10 16:20:51 +00:00
upload_profile_image.provider.dart feat(mobile): Allow users to set profile picture from asset viewer (#25517) 2026-02-22 06:02:33 +00:00
user.provider.dart chore: bump line length to 120 (#20191) 2025-07-25 02:37:22 +00:00
websocket.provider.dart fix: mobile edit handling (#25315) 2026-01-19 12:22:53 -06:00