Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(mobile): encapsulate most access to photomanager in repository #12754

Merged
merged 7 commits into from
Sep 18, 2024

Conversation

fyfrey
Copy link
Contributor

@fyfrey fyfrey commented Sep 17, 2024

This PR encapsulates access to PhotoManager library

  • access to get albums/assets is now in new AlbumMediaRepository, AssetMediaRepository, FileMediaRepository
  • replaces occurrences of AssetEntity with Asset
  • replaces occurrences of AssetPathEntity with Album
  • selective imports for the few places where access to PhotoManager is required (image providers etc., PMProgressHandler)
  • CI check to ensure no new access to PhotoManager is added
  • tested that the app still works (backup, album selection, manual backup, syncing, ...)

Somebody with an iOS device needs to test that livePhotos still work (upload, download, viewing, ..)

TODO in follow-up PRs:

  • remove the last references to PhotoManager in service classes
  • remove AssetEntity contained in Asset
  • add more tests once PhotoManager is finally hidden behind the MediaRepositorys (mockable!)
  • access MediaRepository only from services (and not directly in pages!)

@fyfrey fyfrey force-pushed the refactor/mobile-photomanager-repo branch from bbffcd5 to ba88eac Compare September 18, 2024 11:34
@fyfrey fyfrey marked this pull request as ready for review September 18, 2024 13:02
@fyfrey fyfrey requested a review from bo0tzz as a code owner September 18, 2024 13:02
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

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

Looks great is it possible to add any unit tests for this yet?

mobile/lib/providers/backup/backup.provider.dart Outdated Show resolved Hide resolved
mobile/lib/repositories/media.repository.dart Outdated Show resolved Hide resolved
mobile/lib/repositories/media.repository.dart Outdated Show resolved Hide resolved
@fyfrey
Copy link
Contributor Author

fyfrey commented Sep 18, 2024

Looks great is it possible to add any unit tests for this yet?

Added one more test for the AlbumService dealing with local assets.

@fyfrey fyfrey merged commit 6995cc2 into main Sep 18, 2024
35 checks passed
@fyfrey fyfrey deleted the refactor/mobile-photomanager-repo branch September 18, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants