Closed Bug 916642 Opened 6 years ago Closed 2 years ago

[Bluetooth File Transfer][Settings] Extracting common logic to a shared utility object from the two apps.

Categories

(Firefox OS Graveyard :: Gaia::Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: iliu, Unassigned)

Details

Since there are some redundant code in Bluetooth File Transfer, Settings, System(adapter only) apps, we have to extract common logic to a shared utility object. These common logic are as following:
* Bluetooth adapter
* Discovery devices
* Pairing device
* Manage paired/unpaired device list
Ian, is this issue in your plan this week or next week?
Flags: needinfo?(iliu)
Evelyn,

Since multiple files transfer spec. is released in v1.0(Bug 921085), I would like to implement new user story first. Then, we go back to refactor bluetooth module. Or you have any other concern and blocking work that we have to move the refactor work in front of the millstone.
Flags: needinfo?(iliu)
(In reply to Ian Liu [:ianliu] from comment #2)
> Evelyn,
> 
> Since multiple files transfer spec. is released in v1.0(Bug 921085), I would
> like to implement new user story first. Then, we go back to refactor
> bluetooth module. Or you have any other concern and blocking work that we
> have to move the refactor work in front of the millstone.

I think extract common logic to shared/js is necessary now, but we can push refactor stuff back.
Phase 1: We're aiming to extract Bluetooth common logic to shared utility object. The Bluetooth utility object should be designed and considered for the following modules.

system::"Bluetooth" (https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/bluetooth.js)
bluetooth:: "transfer.js" (https://github.com/mozilla-b2g/gaia/blob/master/apps/bluetooth/js/transfer.js)
dialer::"BluetoothHelper" (https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/dialer/js/bluetooth_helper.js)
shared::media::"MediaRemoteControls" (https://github.com/mozilla-b2g/gaia/blob/master/shared/js/media/remote_controls.js)

Any other request and suggestion, feel free to give comment. :)
Note that remote_controls.js is already a shared module in shared/js/media, if the common bluetooth logic(assuming it's bluetooth_common.js) will be also under shared/js, then if we don't do any tricks on like a shared module importing another shared module, the apps that importing the remote_controls.js will need to import the so called bluetooth_common.js as well, which might slow down the app, like startup time, and the sequence of importing the shared modules also matter if each of them has dependencies.
As we discussed last time, there are two levels of using bluetooth. The first level, which is also the one we focus, is observing the status of bluetooth connections. We need a object that helps initialize a bluetooth adapter and notify registers about the status change. 

The object is pretty much like what we have in system/js/bluetooth.js. We can use it as a base an refine it.
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.