Confirmed users
483
edits
m (→Data flows) |
(→Data flows: .) |
||
Line 72: | Line 72: | ||
[[File:Contactconsumerinitialfetch.png|800px|x600px]] | [[File:Contactconsumerinitialfetch.png|800px|x600px]] | ||
'''Preconditions''' The GCDS has at least one Contact Provider registered and contains pointers to the mozContact information contained in this (or these) Contact Provider(s) in the form of mozContact IDs. | '''Preconditions''' | ||
The GCDS has at least one Contact Provider registered and contains pointers to the mozContact information contained in this (or these) Contact Provider(s) in the form of mozContact IDs. | |||
Contact Consumers needs to initially create a local [https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API IndexedDB] to store a copy of all the mozContact information stored in the Contact Providers that are registered with the GCDS. It will need to add the appropriate indexes to this indexedDB to allow the specific searches for the specific needs of the Contact Consumer. | |||
The Contact Consumer that wants to obtain the global contact information and store it locally needs to query the GCDS via the DataStore API. It will need to do an initial [[WebAPI/DataStore#Sync|sync]] to obtain the whole list of records stored in the GCDS. Per each record, it should find an array of this form: | |||
[{ | |||
owner: 'contactprovider1', | |||
contactId: 'aId' | |||
}, { | |||
owner: 'contactprovidern', | |||
contactId: 'anotherId' | |||
}] | |||
This array will usually has a length of one element only. If it contains more than one element, it means that the contact has been passively merged and so the Contact Consumer can safely ignore the rest of the elements of the array because they contain IDs for mozContacts that are an exact copy of the one corresponding to the ID stored in the first position of the array. | |||
The ''owner'' field of the object is the name of the datastore that contains the actual mozContact information the Contact Consumer is interested on. So the Contact Consumer needs to query this datastore with the value of the ''contactId'' field to obtain the mozContact information. Once it gets this information, it can store it locally in its indexedDB and repeat the process for each ID stored in the GCDS. | |||
=== Local contact addition === | === Local contact addition === |