-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
fix: do not hang on analyze image if there are no results #1274
Changes from all commits
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 |
---|---|---|
|
@@ -665,17 +665,31 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | |
} | ||
|
||
guard let barcodes: [VNBarcodeObservation] = request.results as? [VNBarcodeObservation] else { | ||
DispatchQueue.main.async { | ||
result([ | ||
"name": "barcode", | ||
"data": [], | ||
]) | ||
} | ||
return | ||
} | ||
|
||
if barcodes.isEmpty { | ||
DispatchQueue.main.async { | ||
result([ | ||
"name": "barcode", | ||
"data": [], | ||
]) | ||
} | ||
return | ||
} | ||
|
||
result([ | ||
"name": "barcode", | ||
"data": barcodes.map({ $0.toMap(imageWidth: Int(ciImage.extent.width), imageHeight: Int(ciImage.extent.height), scanWindow: self.scanWindow) }), | ||
]) | ||
DispatchQueue.main.async { | ||
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. Adding a dispatch queue block, just in case (is the only relevant statement that didn't have it) |
||
result([ | ||
"name": "barcode", | ||
"data": barcodes.map({ $0.toMap(imageWidth: Int(ciImage.extent.width), imageHeight: Int(ciImage.extent.height), scanWindow: self.scanWindow) }), | ||
]) | ||
} | ||
}) | ||
|
||
if !symbologies.isEmpty { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; | ||
58A22AC50A792ECA6D027507 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 419C3BC9593F6DE903D740F0 /* Pods_RunnerTests.framework */; }; | ||
F209F1436A19CBC32BFFB26A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEB40B96A6FFC92607527710 /* Pods_Runner.framework */; }; | ||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; | ||
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. This is the same change for SPM as in #1273 but for MacOS, which I forgot to add. |
||
/* End PBXBuildFile section */ | ||
|
||
/* Begin PBXContainerItemProxy section */ | ||
|
@@ -103,6 +104,7 @@ | |
isa = PBXFrameworksBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, | ||
F209F1436A19CBC32BFFB26A /* Pods_Runner.framework in Frameworks */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
|
@@ -231,6 +233,9 @@ | |
productType = "com.apple.product-type.bundle.unit-test"; | ||
}; | ||
33CC10EC2044A3C60003C045 /* Runner */ = { | ||
packageProductDependencies = ( | ||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, | ||
); | ||
isa = PBXNativeTarget; | ||
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; | ||
buildPhases = ( | ||
|
@@ -256,6 +261,9 @@ | |
|
||
/* Begin PBXProject section */ | ||
33CC10E52044A3C60003C045 /* Project object */ = { | ||
packageReferences = ( | ||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, | ||
); | ||
isa = PBXProject; | ||
attributes = { | ||
LastSwiftUpdateCheck = 0920; | ||
|
@@ -789,6 +797,18 @@ | |
defaultConfigurationName = Release; | ||
}; | ||
/* End XCConfigurationList section */ | ||
/* Begin XCLocalSwiftPackageReference section */ | ||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { | ||
isa = XCLocalSwiftPackageReference; | ||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; | ||
}; | ||
/* End XCLocalSwiftPackageReference section */ | ||
/* Begin XCSwiftPackageProductDependency section */ | ||
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { | ||
isa = XCSwiftPackageProductDependency; | ||
productName = FlutterGeneratedPluginSwiftPackage; | ||
}; | ||
/* End XCSwiftPackageProductDependency section */ | ||
}; | ||
rootObject = 33CC10E52044A3C60003C045 /* Project object */; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,24 @@ | |
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<PreActions> | ||
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. This is the same change for SPM as in #1273 but for MacOS, which I forgot to add. |
||
<ExecutionAction | ||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction"> | ||
<ActionContent | ||
title = "Run Prepare Flutter Framework Script" | ||
scriptText = ""$FLUTTER_ROOT"/packages/flutter_tools/bin/macos_assemble.sh prepare "> | ||
<EnvironmentBuildable> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" | ||
BuildableName = "mobile_scanner_example.app" | ||
BlueprintName = "Runner" | ||
ReferencedContainer = "container:Runner.xcodeproj"> | ||
</BuildableReference> | ||
</EnvironmentBuildable> | ||
</ActionContent> | ||
</ExecutionAction> | ||
</PreActions> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
|
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.
We apparently forgot these two :(