Skip to content

Commit

Permalink
Remove non-fatal CameraCore asserts (#10181)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidme-stripe authored Feb 18, 2025
1 parent 2e9fa4f commit 9f5d63d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CHANGELOG

## XX.XX.XX - 20XX-XX-XX
### CardScan
* [FIXED][10181](https://github.com/stripe/stripe-android/pull/10181) Fixed a crash that happened on some devices with odd camera-to-screen ratios

### Financial Connections
- [ADDED] Financial Connections now supports dark mode and will automatically adapt to the device's theme. [Learn more](https://docs.stripe.com/financial-connections/other-data-powered-products?platform=android#connections-customize-android) about configuring appearance settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ fun determineViewFinderCrop(
previewBounds: Rect,
viewFinder: Rect
): Rect {
require(
viewFinder.left >= previewBounds.left &&
viewFinder.right <= previewBounds.right &&
viewFinder.top >= previewBounds.top &&
viewFinder.bottom <= previewBounds.bottom
) { "View finder $viewFinder is outside preview image bounds $previewBounds" }

// Scale the cardFinder to match the full image
return previewBounds
.projectRegionOfInterest(
Expand All @@ -74,13 +67,6 @@ fun cropCameraPreviewToViewFinder(
previewBounds: Rect,
viewFinder: Rect
): Bitmap {
require(
viewFinder.left >= previewBounds.left &&
viewFinder.right <= previewBounds.right &&
viewFinder.top >= previewBounds.top &&
viewFinder.bottom <= previewBounds.bottom
) { "View finder $viewFinder is outside preview image bounds $previewBounds" }

return cameraPreviewImage.crop(
determineViewFinderCrop(cameraPreviewImage.size(), previewBounds, viewFinder)
)
Expand All @@ -102,13 +88,6 @@ fun cropCameraPreviewToSquare(
previewBounds: Rect,
viewFinder: Rect
): Bitmap {
require(
viewFinder.left >= previewBounds.left &&
viewFinder.right <= previewBounds.right &&
viewFinder.top >= previewBounds.top &&
viewFinder.bottom <= previewBounds.bottom
) { "Card finder is outside preview image bounds" }

val visiblePreview = getVisiblePreview(previewBounds)
val squareViewFinder = maxAspectRatioInSize(visiblePreview, 1F).centerOn(viewFinder)

Expand Down

0 comments on commit 9f5d63d

Please sign in to comment.