Gaia/Contacts/Data Refactor: Difference between revisions

Jump to navigation Jump to search
→‎Data flows: local and external modifications
(→‎Data flows: local and external modifications)
Line 92: Line 92:
=== Local contact addition or modification ===
=== Local contact addition or modification ===
[[File:Localcontactadd.png|1000px|x800px]]
[[File:Localcontactadd.png|1000px|x800px]]
Local contact addition or modifications needs to be done through the MozContacts API since Contact Provider's datastores are supposed to be readonly.
A Contact Consumer with access to the MozContacts API can add a new contact or modify an existing one via the MozContacts API, which will write the modification to the MozContacts internal indexedDB and the Local Contacts datastore. This datastore modification will trigger the datastore-change-* system message (and the DataStore.onchange event) which will wake the GCDS up. Once it is up, the GCDS will request a sync with the Local Contacts datastore to fetch the latest changes that will be recorded in the GCDS. This will also trigger a datastore-change-* notification and a DataStore.onchange event that will be received by the Contact Consumers observing this notifications. These Contact Consumers will need to sync with the GCDS to obtain the latest changes and query the appropriate Contact Provider where the changes were originated, in this case the Local Contact datastore.


=== External contact addition or modification ===
=== External contact addition or modification ===
[[File:Contactprovideraddmod.png|800px|x600px]]
[[File:Contactprovideraddmod.png|800px|x600px]]
The flow in this case is pretty similar to the previous one with the difference that the contact change is not done through the MozContacts API but instead it is done through the specific mechanism the Contact Provider has for modifications of the contact data they own. This could be an app specific UI, a synchronization with an external service, etc.


=== Contact consumer search ===
=== Contact consumer search ===
Confirmed users
483

edits

Navigation menu