Repository navigation
feat(scan): read Code 128 tracking barcodes; change list for structured tracking codes - #111
Merged
Merged
Conversation
resizePhoto measured Dimensions.get('window') — the device screen — rather
than the image at the given uri. Captured photos were scaled to the phone's
point size and into the screen's aspect ratio, so proof-of-delivery images
uploaded at a fraction of their real resolution.
Read the actual dimensions with Image.getSize, wrapped as a promise. On
failure it resolves null and resizePhoto returns the original uri, so an
unreadable image uploads full size rather than being lost.
Fixes #89
Fix POD photo resizing to use image dimensions instead of screen size
Release Navigator v2.0.11
Both prefixes are honoured so a release branch opened before the rename still releases. A merge that produces no tag and no publish looks exactly like a successful one, so the cutover is deliberately not a flag day.
ci(release): adopt the release/v* branch convention
Fleetbase labels now print a Code 128 barcode carrying the bare tracking number beside the QR code, and capture-qr accepts it. Scan for it too, so either code on a label is enough. Type QrCodeScanner's onScan with vision-camera's Code result: it has always passed the result object, not a string.
Conflicts came from the v2.0.11 release commits this branch carries: - src/utils/index.js: keep the image-dimension resize fix, in v3's JSDoc style - translations/en.json: keep v3's strings and main's location disclosure copy; drop the unused skipForNow - src/legacy/features/Shared/ProofScreen.js: v3 deleted it; QrCodeScanner already scans code-128 - package.json: drop main's jest key, which collides with v3's jest.config.js; its modulePathIgnorePatterns move there
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to fleetbase/fleetops#356, which changes what tracking labels encode:
https://<console>/track-order?order=<tracking number>&r=<owner public_id>&v=1. It used to be the owner's bare uuid.capture-qraccepts the new url, a bare tracking number or public id, and the bare uuid on labels already in circulation. The app keeps working with old and new labels without this PR, because it sends the raw scanned value and the server decides.This PR
QrCodeScanner(used byProofOfDeliveryScreen) and the legacyProofScreenalso scancode-128, so a driver can scan either code on a label. A smudged QR can fall back to the barcode.QrCodeScanner'sonScanis now typed with vision-camera'sCode. It has always passed the result object, not a string. The v2 screen already readsdata.value; the type now says so.Change list for the app (not in this PR)
v3
ProofCaptureScreensends the scanner's whole result object ascode(feature/v3-redesign, Navigator v3 — Waypoint redesign, expansion and refactor #109). It typesonScanas(code: string), butQrCodeScannerpasses the vision-cameraCode, so:scannedholds objects;prev.includes(code)never matches, so re-scanning a parcel after the 3s cooldown counts it twice;useProofCaptureposts an object ascode.The server has always rejected that, and still does, with "Unable to validate QR code data." (400). Fix:
onScan={(code) => onScanValue(code.value)}, and keepscannedas strings. With this PR's typing, that branch stops compiling once it mergesmain, which is the point.When v3 wires up
expected(the scan checklist, currently never passed): compare by the tracking number inside the code, not the raw string. A QR scan is now a url, and older labels hold a uuid. Parse it withnew URL(value).searchParams.get('order'), fall back to the raw value for a bare barcode, and compare without regard to case. Don't treat a uuid as a mismatch; let the server decide it.Optional, scan-to-open: the url's
rparameter is the owner's public id (order_…,waypoint_…,entity_…). An in-app scanner can open that record directly, or callPOST tracking-numbers/from-qr, which resolves every format within the driver's company.Don't depend on the host or the route. The host varies by install, and the public tracking page is being rebuilt, so its route will change; a later form may carry the tracking number in the path (
/track/<number>). On the device, readrandvfrom the query and treat an unknownvas best effort. For the tracking number, or anything authoritative, send the raw value to the server (capture-qrorfrom-qr), whose parser follows every form.Displaying codes: the barcode image is now a wide 1D barcode, about 330×60px at native size, not a squarer PDF417. The order and entity screens size it at 190×80 and
w-40 h-18(legacy), which squash it. That's fine for display, but give it a wider box if drivers are expected to scan it off the phone screen.Testing
Verified through CI. To check on a device: scan a newly printed label's QR, then its barcode, then an old label's QR, on an order with
pod_method: scan. All three should record a "Verified by QR Code Scan" proof.