-
Notifications
You must be signed in to change notification settings - Fork 982
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
Support Xcode 16 #4066
Support Xcode 16 #4066
Changes from all commits
636a8fb
d13fc70
ebdef6f
d2b0008
fe7fe54
153e55f
6fe8fa3
35c8353
22cbcac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,34 @@ | |
ReferencedContainer = "container:Stripe3DS2/Stripe3DS2.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "41D17A3F2C5A73A6007C6EE6" | ||
BuildableName = "StripeConnect.framework" | ||
BlueprintName = "StripeConnect" | ||
ReferencedContainer = "container:StripeConnect/StripeConnect.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "NO" | ||
buildForProfiling = "NO" | ||
buildForArchiving = "NO" | ||
buildForAnalyzing = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "41D17A492C5A73A7007C6EE6" | ||
BuildableName = "StripeConnectTests.xctest" | ||
BlueprintName = "StripeConnectTests" | ||
ReferencedContainer = "container:StripeConnect/StripeConnect.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
Comment on lines
+177
to
+204
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adds StripeConnect to |
||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,9 +356,9 @@ class ScanBaseViewController: UIViewController, AVCaptureVideoDataOutputSampleBu | |
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
ScanBaseViewController.isAppearing = true | ||
/// Set beginning of scan session | ||
// Set beginning of scan session | ||
ScanAnalyticsManager.shared.setScanSessionStartTime(time: Date()) | ||
/// Check and log torch availability | ||
// Check and log torch availability | ||
Comment on lines
+359
to
+361
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Swiftlint fix |
||
ScanAnalyticsManager.shared.logTorchSupportTask( | ||
supported: videoFeed.hasTorchAndIsAvailable() | ||
) | ||
|
@@ -413,22 +413,20 @@ class ScanBaseViewController: UIViewController, AVCaptureVideoDataOutputSampleBu | |
from connection: AVCaptureConnection | ||
) { | ||
if self.machineLearningSemaphore.wait(timeout: .now()) == .success { | ||
ScanBaseViewController.machineLearningQueue.async { | ||
self.captureOutputWork(sampleBuffer: sampleBuffer) | ||
guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer), | ||
let fullCameraImage = pixelBuffer.cgImage() else { | ||
self.machineLearningSemaphore.signal() | ||
return | ||
} | ||
} | ||
} | ||
|
||
func captureOutputWork(sampleBuffer: CMSampleBuffer) { | ||
guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { | ||
return | ||
} | ||
|
||
guard let fullCameraImage = pixelBuffer.cgImage() else { | ||
return | ||
ScanBaseViewController.machineLearningQueue.async { [weak self] in | ||
self?.captureOutputWork(fullCameraImage: fullCameraImage) | ||
self?.machineLearningSemaphore.signal() | ||
} | ||
} | ||
} | ||
Comment on lines
415
to
+427
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both I'm unsure if this is the intended behavior – if it's expensive to convert CMSampleBuffer -> CVImageBuffer -> CIImage, then we're now doing that work on the main thread. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my memory from implementing the equivalent for Identity, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. In fact, this is what it's designed for. Generally the camera feed is faster than the ML model can process images, so the idea is that you want to block the thread that is reading from the camera in order to finish processing the image in CoreML before asking for more camera frames, otherwise you end queuing up so much of the video buffer that the displayed camera feed begins to drop frames and the app lags. Here's an excerpt from the copy of the CoreML survival guide that gives a basic example: Public link (page 400): There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So yeah, given that we're explicitly calling |
||
|
||
func captureOutputWork(fullCameraImage: CGImage) { | ||
// confirm videoGravity settings in previewView. Calculations based on .resizeAspectFill | ||
DispatchQueue.main.async { | ||
assert(self.previewView?.videoPreviewLayer.videoGravity == .resizeAspectFill) | ||
|
@@ -472,9 +470,9 @@ class ScanBaseViewController: UIViewController, AVCaptureVideoDataOutputSampleBu | |
// MARK: - OcrMainLoopComplete logic | ||
func complete(creditCardOcrResult: CreditCardOcrResult) { | ||
ocrMainLoop()?.mainLoopDelegate = nil | ||
/// Stop the previewing when we are done | ||
// Stop the previewing when we are done | ||
self.previewView?.videoPreviewLayer.session?.stopRunning() | ||
/// Log total frames processed | ||
// Log total frames processed | ||
ScanAnalyticsManager.shared.logMainLoopImageProcessedRepeatingTask( | ||
.init(executions: self.getScanStats().scans) | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ stages: | |
workflows: | ||
- framework-tests: {} | ||
- test-builds-xcode-15: {} | ||
- test-builds-xcode-16: {} | ||
- test-builds-vision: {} | ||
- install-tests-non-carthage: {} | ||
- lint-tests: {} | ||
|
@@ -53,7 +54,9 @@ stages: | |
workflows: | ||
- framework-tests-no-mocks: {} | ||
- test-builds-xcode-15: {} | ||
- test-builds-xcode-16: {} | ||
- test-builds-xcode-15-release: {} | ||
- test-builds-xcode-16-release: {} | ||
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adds tests to ensure the frameworks build on both Xcode 15 and 16 |
||
- test-builds-vision: {} | ||
- deploy-docs: {} | ||
- install-tests-non-carthage: {} | ||
|
@@ -71,6 +74,7 @@ stages: | |
stage-nightly-all: | ||
workflows: | ||
- test-builds-xcode-15-release: {} | ||
- test-builds-xcode-16-release: {} | ||
- framework-tests-no-mocks: {} | ||
- check-docs: {} | ||
- legacy-tests-15: {} | ||
|
@@ -348,6 +352,21 @@ workflows: | |
bitrise.io: | ||
stack: osx-xcode-15.0.x | ||
machine_type_id: g2-m1.8core | ||
test-builds-xcode-16: | ||
steps: | ||
- xcode-build-for-test@2: | ||
inputs: | ||
- scheme: AllStripeFrameworks | ||
- destination: generic/platform=iOS Simulator | ||
- deploy-to-bitrise-io@2: {} | ||
envs: | ||
- DEFAULT_TEST_DEVICE: platform=iOS Simulator,name=iPhone 15,OS=18.0 | ||
before_run: | ||
- prep_all | ||
meta: | ||
bitrise.io: | ||
stack: osx-xcode-16.0.x | ||
machine_type_id: g2-m1.8core | ||
test-builds-xcode-15-release: | ||
steps: | ||
- script@1: | ||
|
@@ -360,6 +379,18 @@ workflows: | |
bitrise.io: | ||
stack: osx-xcode-15.0.x | ||
machine_type_id: g2-m1.8core | ||
test-builds-xcode-16-release: | ||
steps: | ||
- script@1: | ||
inputs: | ||
- content: xcodebuild build -workspace "Stripe.xcworkspace" -scheme "AllStripeFrameworks" -configuration "Release" -sdk "iphonesimulator" | xcpretty | ||
title: Build release builds | ||
before_run: | ||
- prep_all | ||
meta: | ||
bitrise.io: | ||
stack: osx-xcode-16.0.x | ||
machine_type_id: g2-m1.8core | ||
test-builds-vision: | ||
steps: | ||
- xcode-build-for-test@2: | ||
|
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 hash corresponds to the 3.9.4 release tag:
https://github.com/erikdoe/ocmock/releases/tag/v3.9.4
Swift Package manager doesn't allow OCMock unless you add it using a commit hash:
erikdoe/ocmock#500 (comment)