Closed Bug 1109495 Opened 10 years ago Closed 7 years ago

Implement a nfc_share.js library

Categories

(Firefox OS Graveyard :: NFC, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: allstars.chh, Unassigned)

References

Details

In Bug 1050164 we have made shrinking_ui.js as a share library, so app could import this library, and then launch Shrinking UI when mozNfc.onpeerfound is called,and perhaps listen to shrinking-sent event to send the Data, then dismiss the shrinking ui when mozNfc.onpeerlost is notified.

But this means the app has to know the NFC API, and knows how to use Shrinking_UI.js properly. And most apps like Gallery, Music, Video, ... etc, they just want to share their content by NFC, and don't want to know some many details about these NFC API and ShrinkingUI.js.

Also for Contacts app, it also needs to include nfc_utils.js, to encode the vcards into a NDEF Records.

Maybe we can have a more high level share library called nfc_share.js, and this nfc_share.js could manipulate NFC API, and launch/dismiss Shrinking UI accordingly, and use nfc_utils.js to encode the NDEF for the app.

So this lib could have following interface
- enableSharing(boolean enabled)
- onShare() // called when user swipes on the Shrinking UI.
- sendBlob(Blob blob) 
- sendData(...) for the data to be sent is of URL, Mime, Text, ...etc.

And all those apps need to do is to 
1. add nfc/nfc-share permission in their manifest.
2. import this library
3. call the interfaces and implement the onShare callback.

I think this could greatly reduce the development effort for our apps.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.