refactor(mobile): Migrate durationInSeconds to durationInMilliseconds#26615
Open
LeLunZ wants to merge 5 commits intoimmich-app:mainfrom
Open
refactor(mobile): Migrate durationInSeconds to durationInMilliseconds#26615LeLunZ wants to merge 5 commits intoimmich-app:mainfrom
LeLunZ wants to merge 5 commits intoimmich-app:mainfrom
Conversation
7f5adde to
9f09fa8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the asset duration field from durationInSeconds (integer, seconds precision) to durationInMilliseconds (integer, milliseconds precision) across the entire mobile stack. This fixes a bug where animated images shorter than one second would have their duration truncated to 0 and be displayed as still images.
Changes:
- Renames
durationInSeconds→durationInMillisecondsacross all domain models, DB entities, platform pigeon APIs (Dart/Swift/Kotlin), and SQL queries. - Adds a Drift DB migration (v21 → v22) that renames the column and multiplies existing values by 1000.
- Extends
toDuration()to parse fractional seconds (e.g.,"0:00:00.500000") in addition to plainHH:MM:SSstrings.
Reviewed changes
Copilot reviewed 34 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
mobile/lib/domain/models/asset/base_asset.model.dart |
Core model field rename; playbackStyle and duration getters updated |
mobile/lib/infrastructure/utils/asset.mixin.dart |
Drift table mixin field renamed |
mobile/lib/infrastructure/repositories/db.repository.dart |
Schema version bumped to 22; migration from v21 added |
mobile/lib/infrastructure/repositories/db.repository.steps.dart |
Generated migration steps for Schema22 |
mobile/lib/extensions/string_extensions.dart |
toDuration() updated to handle fractional seconds |
mobile/ios/Runner/Sync/PHAssetExtensions.swift |
iOS: duration now passed as milliseconds (* 1000) |
mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt |
Android: removed /1000 division (MediaStore already provides ms) |
mobile/pigeon/native_sync_api.dart / Messages.g.* |
Platform message field rename in Dart/Swift/Kotlin |
| All entity/drift files | Auto-generated code updated to reflect new column name |
| All test files | Test fixtures and stubs updated |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8 tasks
5ec11ee to
6e8b0eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last refinement for showing animated images. Migrating
durationInSecondstodurationInMilliseconds.This is needed so all remote animated images show as actual animated images.
The current problem is that if an animated image is shorter than a second, then the duration will be set to 0, and thus all remote assets will just show as still image.
I hope I didn't touch any old code (old ISAR entities).
Regarding migration of current values: The db migration just multiplies the current value with
1000which isn't optimal but:_assetsEqualwill notice the change in milliseconds and updates the object._populateLocalAssetPlaybackStyleagain?