Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
66b3c39
feat:Add receipt enhancement mode with live receipt edge detection
OlimpiaZurek Nov 3, 2026
5e17ec6
Merge branch 'main' into feat/ai-capture-vision-detector
OlimpiaZurek Nov 4, 2026
9588439
fix tests
OlimpiaZurek Nov 4, 2026
ffbdd6b
fix:Use a default export for the document quad type
OlimpiaZurek Nov 4, 2026
191bab2
fix: Fix Android crash when receipt enhancement is turned on
OlimpiaZurek Nov 5, 2026
d744fcb
Merge branch 'main' into feat/ai-capture-vision-detector
OlimpiaZurek Nov 5, 2026
91b6100
Follow the receipt's real edge in the scan outline
OlimpiaZurek Nov 6, 2026
43c02d7
fix:Drop unused edge geometry exports
OlimpiaZurek Nov 6, 2026
5e7ca4f
Hide the disabled enhancement switch from screen readers
OlimpiaZurek Nov 6, 2026
e958f2d
Merge branch 'main' into feat/ai-capture-vision-detector
OlimpiaZurek Nov 6, 2026
9fdbc72
Fix corner speed when zooming and clear outline on detector errors
OlimpiaZurek Nov 9, 2026
32b94ca
Keep the receipt outline on the paper with fingers, folds and turned …
OlimpiaZurek Nov 10, 2026
8a5f433
Address review: split platform readers, release the detector, mount d…
OlimpiaZurek Nov 10, 2026
5cab901
Merge branch 'main' into feat/ai-capture-vision-detector
OlimpiaZurek Nov 10, 2026
c60076e
fix unit test
OlimpiaZurek Nov 10, 2026
232476e
fix: Fix Android outline lost when returning to Scan
OlimpiaZurek Nov 16, 2026
fa69a77
fix: Stop remounting Scan on every tab switch
OlimpiaZurek Nov 16, 2026
9d75c35
Merge branch 'main' into feat/ai-capture-vision-detector
OlimpiaZurek Nov 16, 2026
c4385a1
fix: Pass request type to MultiScanProvider in test
OlimpiaZurek Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions __mocks__/react-native-nitro-modules.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const NitroModules = {
createHybridObject: jest.fn(() => ({
getAll: jest.fn(() => Promise.resolve([])),
detect: jest.fn(() => undefined),
detectYuv: jest.fn(() => undefined),
open: jest.fn(() => 1),
release: jest.fn(),
})),
};

Expand Down
3 changes: 2 additions & 1 deletion __mocks__/react-native-vision-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const useCameraDevice = jest.fn(() => null);
const useCameraDevices = jest.fn(() => []);
const useCameraPermission = jest.fn(() => ({hasPermission: false, requestPermission: jest.fn(() => Promise.resolve(false))}));
const usePhotoOutput = jest.fn(() => ({capturePhoto: jest.fn(), capturePhotoToFile: jest.fn()}));
const useFrameOutput = jest.fn(() => ({}));

const Camera = Object.assign(
jest.fn(() => null),
Expand All @@ -11,4 +12,4 @@ const Camera = Object.assign(
},
);

export {Camera, useCameraDevice, useCameraDevices, useCameraPermission, usePhotoOutput};
export {Camera, useCameraDevice, useCameraDevices, useCameraPermission, useFrameOutput, usePhotoOutput};
17 changes: 16 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,22 @@
"workerd",
"ftyp",
"ftypheic",
"JFIF"
"JFIF",
"docquad",
"docquadnet",
"Kierdorf",
"logits",
"luma",
"Onnx",
"onnxruntime",
"opset",
"Synchronizable",
"Synchronizables",
"BGRA",
"Casiez",
"hypot",
"logit",
"Unretained"
],
"ignorePaths": [
".github/actions/javascript/**/index.js",
Expand Down
32 changes: 31 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,32 @@ PODS:
- ReactCommon/turbomodule/core
- ReactNativeDependencies
- Yoga
- VisionCameraWorklets (5.2.3):
- hermes-engine
- NitroModules
- RCTRequired
- RCTTypeSafety
- React-callinvoker
- React-Core
- React-Core-prebuilt
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- ReactNativeDependencies
- RNWorklets
- VisionCamera
- Yoga
- Yoga (0.0.0)

DEPENDENCIES:
Expand Down Expand Up @@ -3652,6 +3678,7 @@ DEPENDENCIES:
- TrustKit (~> 3.0)
- UMAppLoader (from `../node_modules/unimodules-app-loader/ios`)
- VisionCamera (from `../node_modules/react-native-vision-camera`)
- VisionCameraWorklets (from `../node_modules/react-native-vision-camera-worklets`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -4003,6 +4030,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/unimodules-app-loader/ios"
VisionCamera:
:path: "../node_modules/react-native-vision-camera"
VisionCameraWorklets:
:path: "../node_modules/react-native-vision-camera-worklets"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand All @@ -4019,7 +4048,7 @@ SPEC CHECKSUMS:
callstack-repack: 391af9d65585f106b57ca693880593dc2c89db5c
EXConstants: fa5647482320b7bde855057f8b86580456d4b9f0
expensify-react-native-background-task: 36103a7c2d62b3f5682a6e2773186d08e46338c5
ExpensifyNitroUtils: d627f58d9dd38c2dd4833f59b2c078cf61ad0171
ExpensifyNitroUtils: 4165f3f29dbd700d651c1f93ad833818a1f0f63b
Expo: ce613ebd8e7f9dcd68bae3ec53038db24d3a6ec4
ExpoAsset: 98143758ff37e14c9ff2a4e7673097db00473011
ExpoAudio: b69f36525132edba8d87a715b3a20c678ef78b30
Expand Down Expand Up @@ -4203,6 +4232,7 @@ SPEC CHECKSUMS:
TweetNacl: 3abf4d1d2082b0114e7a67410e300892448951e6
UMAppLoader: 173cb90a3039aa9c1b84bace4487e1907a4a5a39
VisionCamera: c0e2c308592613de270de5f6e722b53d04a26f0d
VisionCameraWorklets: 6934662e331a1300a45f6e2236e156de643f2c0d
Yoga: c30c859b7e9b75e547b600b486fe33165f60de00

PODFILE CHECKSUM: 22066e0768760f4bad500b497f3d1576110fd025
Expand Down
1 change: 1 addition & 0 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"focus-trap",
"react-native-quick-crypto",
"react-native-quick-base64",
"react-native-vision-camera-worklets",
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-private-property-in-object",
"@babel/plugin-transform-export-namespace-from",
Expand Down
2 changes: 2 additions & 0 deletions modules/ExpensifyNitroUtils/ExpensifyNitroUtils.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Pod::Spec.new do |s|
"cpp/**/*.{hpp,cpp}",
]

s.frameworks = "Vision"

s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => [
"${PODS_ROOT}/RCT-Folly",
Expand Down
3 changes: 3 additions & 0 deletions modules/ExpensifyNitroUtils/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
consumerProguardFiles "proguard-rules.pro"

externalNativeBuild {
cmake {
Expand Down Expand Up @@ -125,5 +126,7 @@ dependencies {

// Add a dependency on NitroModules
implementation project(":react-native-nitro-modules")

implementation "com.microsoft.onnxruntime:onnxruntime-android:1.30.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android app size grows for every user

The 13.4 MB docquadnet256_trained_opset17.ort asset and the onnxruntime-android native libraries ship in every Android build, HybridApp included, although only beta users can turn the feature on.

We need to get sign-off on the size increase, or download the model on demand (or ship it as a Play Feature Delivery module).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at moving the model to an on-demand download (our own, or Play Feature Delivery), but both make the feature depend on the network. Scanning is something people do offline, at a restaurant, while traveling, or with a weak signal, and the app is built to work offline. With an on-demand model, the first time someone turns enhancements on without a connection they get no outline at all. A half-finished download leaves it broken until it’s retried. Play Feature Delivery also only works for Play Store installs and changes how HybridApp is built and released. Shipping the model in the app keeps the feature working offline from the first use.

I’d keep it bundled and get sign-off on the size. Who should approve it? cc: @AndrewGable

}

2 changes: 2 additions & 0 deletions modules/ExpensifyNitroUtils/android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ONNX Runtime's native code looks up its Java classes, fields and constructors through JNI, so R8 must not strip or rename them.
-keep class ai.onnxruntime.** { *; }
201 changes: 201 additions & 0 deletions modules/ExpensifyNitroUtils/android/src/main/assets/docquad/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DocQuadNet-256 (document corner model, trained weights)

File: docquadnet256_trained_opset17.ort
SHA-256: f0f2f52d7d79ff02d346c8f9d0c9e903407366aeea1747cdcff160c401e3e72a
Copyright (C) 2026 Christian Kierdorf
License: Apache License, Version 2.0 (see LICENSE in this directory)
Source: Make a Copy (MakeACopy), https://github.com/egdels/makeacopy
app/src/main/assets/docquad/docquadnet256_trained_opset17.ort

The file is included unmodified, as published in the Make a Copy repository. Its NOTICE file lists the datasets the
model was trained on (UVDoc, SmartDoc, Describable Textures Dataset, CORD); none of their images or labels are part of
the model or of this repository.
Binary file not shown.
Loading
Loading