-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[camera_avfoundation] Implementation swift migration - part 2 #9007
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
base: main
Are you sure you want to change the base?
[camera_avfoundation] Implementation swift migration - part 2 #9007
Conversation
aa4269d
to
8be6136
Compare
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Show resolved
Hide resolved
...ra/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation_objc/QueueUtils.m
Show resolved
Hide resolved
8be6136
to
859ad13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a complete review, left a few questions
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
859ad13
to
63292b4
Compare
@@ -55,6 +60,6 @@ final class CameraCaptureSessionQueueRaceConditionTests: XCTestCase { | |||
// `captureSessionQueue` passed into `AVCaptureVideoDataOutput::setSampleBufferDelegate:queue:` | |||
// API will cause a crash. | |||
XCTAssertNotNil( | |||
cameraPlugin.captureSessionQueue, "captureSessionQueue must not be nil after create method.") | |||
captureSessionQueue, "captureSessionQueue must not be nil after create method.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it because you are making captureSessionQueue
private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift
Outdated
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraOrientationTests.swift
Show resolved
Hide resolved
import Flutter | ||
import ObjectiveC | ||
|
||
// Import Objectice-C part of the implementation when SwiftPM is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add more details to this? (e.g. things like 2 modules for swift pm but one module for cocoapods, due to swift pm's language restriction)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, but then I’d have to update all 44 files that include it. We should’ve done this in the previous PR. TBH I don’t think it’s necessary since the conditional imports are temporary
import camera_avfoundation_objc | ||
#endif | ||
|
||
typealias CaptureNamedDeviceFactory = (String) -> FLTCaptureDevice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's "named device"? is there an "unnamed" device?
maybe just CaptureDeviceFactory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an "unnamed" factory CaptureDeviceFactory
which doesn't receive a device name as an argument. It should be removed in the future because it is causing this issue but at the moment there are 2 factories. I will change the order of words because CaptureNamedDeviceFactory
makes little sense
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
camera?.dartAPI = FCPCameraEventApi( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is strange, why is camera still optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean regarding the guard
above? That guard is in the onFrameAvailable
lambda and this is outside of it. I will add a guard outside
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
...a/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift
Outdated
Show resolved
Hide resolved
63292b4
to
2898d01
Compare
Migrates camera implementation as part of flutter/flutter#119109
This PR migrates
CameraPlugin
class.Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
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 ↩3