[cross_file_darwin] iOS/macOS implementation of cross_file - #12910
bparrishMines wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the cross_file_darwin package, providing a Darwin-specific implementation for the cross_file plugin, including support for security-scoped resources and PhotoKit assets. The implementation uses Pigeon for communication between Dart and native code, along with FFI for native asset resource management. The review identified several critical issues, including a missing delegate assignment in AssetResourceReader, incorrect URI-to-file-path conversions in canRead methods, a missing return statement in lastModified, and inconsistent parameter usage in helper methods within darwin_scoped_storage_cross_file.dart.
| func openRead(localIdentifier: String, delegate: AssetResourceReaderDelegate) -> Bool { | ||
| let assets = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil) |
There was a problem hiding this comment.
The delegate parameter passed to openRead is never assigned to self.delegate. As a result, self.delegate remains nil, and the callbacks onDataReceived and onCompletion are never triggered.
func openRead(localIdentifier: String, delegate: AssetResourceReaderDelegate) -> Bool {
self.delegate = delegate
let assets = PHAsset.fetchAssets(withLocalIdentifiers: [localIdentifier], options: nil)There was a problem hiding this comment.
very good catch. This is the down side of not being able to write tests when the api requires out of app user interactions.
cross_file
Part of flutter/flutter#91869
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2