Gaia/Contacts/Data Refactor
Current situation
Current contacts app have been growing with time around the mozContact API, started like a simple application but has been adding more and more requirements.
It was not just the only FirefoxOS app using this api, so mozContacts end up trying to support several requirements from different applications, and at the end of the day what we have is a store for vcard objects, which limited search capabilities.
With the inclusion of external contacts sources like Facebook, Gmail, Hotmail, vcard from sdcard, bluethoot and so on, we have been extending the use of the API via hacks and dark techniques.
Also we added a great feature like contacts merging, everything working under the same mozContacts API.
Problems
Some problems that we are facing now are the following:
- Contacts list performance:
- Due to the design of contacts app, we should be able to jump to letters and scroll super fast with the letter shor cuts. It wasn't right to add application specific requirements to mozContacts API so we have been doing black magic to keep the performance at 60fps when loading huge amount of contacts ( > 2000).
- Search restrictions:
- Again, adding more and more indexes just cause specific app requirements wasn't a good idea so we had to implement our search based on DOM, which is extremly slow and affects as well to the contacts list rendering time.
- Impossible to unmerge contacts:
- During the process of merging contacts we end up losing the information as we just have a mozContacts API, we lose data when we merge.
- Dependency with Facebook integration:
- When we started to create the FB integration we needed to somehow make the contacts live in mozContacts but as well apply some legal restrictions to how data was shared. We didn't have the same technology that we have right now for doing that and this made our code being dependant of one partner.
- Hard to integrate with 3rd party contacts providers:
- We added extra support for Gmail and Hotmail contacts but this is embeded in the Contacts application itself, which is not scalable. We want to make any app capable of provide contacts to have a seamless integration with the Contacts APP.
Architecture
Current context
- mozContacts API
- Right now is frozen, we know that and will be for good a nice way of storing contacts locally, but we won't be able to add extra requirements.
- DataStore API
- The Datastore API is a new API designed to make apps share information or making them collaborate to add data to a common store. It allows synchronization and being able to notify about changes. It's a pretty simple key/value store, where both key and value can be any kind of objectm, and it doesn't implement any kind of search, just direct access by key.