Conversation
|
Double-click race: the click handler doesn't guard against being triggered twice before ndefActive Byte order assumption: convertSerialNumber reverses bytes assuming LSB-first order (correct for FAB visibility: the button will appear for all users on NFC-capable browsers, not just SCC users. |
|
By the way, since literally only 2 devices are expected to use this feature, but 100-ish lines are now in everyone's bundle, the cleaner approach would be a Stimulus controller attached to a partial that's only rendered for |
|
SCC logic in the application layout: the main layout now has awareness of a specific user role, which tends to creep. If more role-specific UI gets added this way it becomes hard to reason about. JS is still global: the partial gates the button but nfc.js is still loaded for everyone via application.js. The JS and the HTML are now out of sync in terms of who they target. Consider something in the vein of: |
Add a button that enables NFC scanning on browsers where NFC is allowed. Tested on the Office Android Phone. Works like a barcode reader after permission is granted.