OBLS-822 Disable DataWedge keystroke output for barcode inputs - #437
Open
jmiranda wants to merge 1 commit into
Open
OBLS-822 Disable DataWedge keystroke output for barcode inputs#437jmiranda wants to merge 1 commit into
jmiranda wants to merge 1 commit into
Conversation
Scans were delivered both as an intent broadcast (useScanListener) and as keystroke output typed into the focused field, so a barcode input applied the value twice — the scanned string was appended to itself (e.g. a scan of "4354210" was submitted as "43542104354210"). Reproduced on TC52 and TC53e. Keystroke output is a profile-wide DataWedge setting and cannot be scoped to one field, so toggle it at runtime: mute it while any barcode input is active (scans then arrive only via the intent broadcast) and restore it when none is, so plain inputs elsewhere can still be populated by scanning. Reference counted so overlapping inputs keep it muted until the last one unmounts. Manual keyboard entry is unaffected — this only controls the scanner's keystroke output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018esj4qV5h4teD7M6WfHahM
jmiranda
requested review from
awalkowiak and
olewandowski1
and
a lite review from Copilot
August 6, 2026 00:49
There was a problem hiding this comment.
Pull request overview
This PR addresses duplicated/doubled barcode values on Zebra devices by explicitly managing DataWedge’s Keystroke output at runtime, ensuring scans are delivered only through the existing intent broadcast path while scan listeners are active.
Changes:
- Adds a DataWedge KEYSTROKE plugin config generator (
getKeystrokeOutputConfig) to togglekeystroke_output_enabled. - Updates
useScanListenerto reference-count active scan consumers and mute/unmute keystroke output when consumers mount/unmount. - Keeps the intent-based scan subscription model from #423, adding keystroke control around it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/hooks/useScanListener.ts | Adds reference-counted keystroke mute/restore around the existing DataWedge intent listener. |
| src/hooks/constant.ts | Adds KEYSTROKE plugin config builder used to toggle DataWedge keystroke output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+77
to
+83
| PLUGIN_CONFIG: { | ||
| PLUGIN_NAME: 'KEYSTROKE', | ||
| RESET_CONFIG: 'true', | ||
| PARAM_LIST: { | ||
| keystroke_output_enabled: enabled ? 'true' : 'false' | ||
| } | ||
| } |
Comment on lines
+90
to
+96
| return () => { | ||
| subscription.remove(); | ||
| activeConsumerCount -= 1; | ||
| if (activeConsumerCount === 0) { | ||
| setKeystrokeOutput(true); | ||
| } | ||
| }; |
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.
Fixes the duplicate/doubled barcode value on scan (OBLS-822), a regression from the intent-based scan capture in #423.
Problem
A scan was delivered through two DataWedge channels at once:
useScanListener→onChange(value)(the path added in OBLS-822 Capture DataWedge scans via intent broadcast #423), andBecause keystroke typing is additive and the intent
onChangereplaces, the two concatenate: the scanned string is appended to itself. Confirmed on TC52 and TC53e — a scan of4354210submitted as43542104354210, andABP N60C IQ3980asABP N60C IQ3980ABP N60C IQ3980.It did not reproduce on a TC20, which is the tell: the app never explicitly controlled keystroke output —
configureProfileOnce()only sets the BARCODE and INTENT plugins (CONFIG_MODE: 'UPDATE'), leaving the Keystroke plugin at each device's default. So whether both channels fire (and whether they concatenate, which also depends on intent-vs-keystroke delivery timing) was left to per-device DataWedge state.Fix
Explicitly control keystroke output so behavior is deterministic across devices. Keystroke output is a profile-wide setting (the OPENBOXES profile is associated with every activity) and can't be scoped to a single field, so it's toggled at runtime:
useScanListenerconsumer) is active → the scan arrives only via the intent broadcast, never also typed into the field.The active-consumer count is reference-counted so overlapping inputs (e.g. a screen input and a modal input during a dialog transition) keep it muted until the last one unmounts.
Manual keyboard entry is unaffected —
keystroke_output_enabledcontrols only the scanner's keystroke emulation, not the soft keyboard.Scope
src/hooks/constant.ts—getKeystrokeOutputConfig(enabled)(KEYSTROKE plugin config).src/hooks/useScanListener.ts— reference-counted keystroke mute/restore around the existing intent subscription. No change to the subscription model otherwise.Testing
Built locally (
./gradlew assembleRelease) and sideloaded to a TC52: the doubling is gone — scans on the Inbound Sortation screen now apply the value once. Manual typing into scan fields still works.🤖 Generated with Claude Code
Generated by Claude Code