-
Notifications
You must be signed in to change notification settings - Fork 1
ContactParser API
Deals with parsing between formats required for displaying contacts in the UI and the vCard stored in the database. Also provides functions for updating/modifying the two formats in response to user changes.
Clears all information about a contact held in the main panel
| Param | Type | Description |
|---|---|---|
| contactSections | Array |
Infomation to clear |
Clears all information about a contact held in the header
| Param | Type | Description |
|---|---|---|
| details | Array |
Infomation to clear |
ContactParser._parseProperty(property, cProperty, tProperty, cSections, tSections, pField, tpField, jCardIndex)
Parses a single property of a contact vCard for the UI
| Param | Type | Description |
|---|---|---|
| property | <Property |
The property to parse |
| cProperty | Array |
Contact property in UI |
| tProperty | Array |
Temporary contact property in UI (for editing purposes) |
| cSections | Array |
Contact sections in UI |
| tSections | Array |
Temporary contact sections in UI (for editing purposes) |
| pField | Array |
Personal details of contact fields in UI header |
| tpField | Array |
Temporary personal details of contact fields in UI header (for editing purposes) |
| jCardIndex | Integer |
Index of the jCard which the property belongs to |
Adds a personal property to the personal and temporary contact fields for the UI header of a contact
| Param | Type | Description |
|---|---|---|
| pField | Array |
Personal details of contact fields in UI header |
| tpField | Array |
Temporary personal details of contact fields in UI header (for editing purposes) |
| type | string |
The type of personal detail |
| jCardIndex | Intger |
Index of the jCard which the detail belongs to |
| cProperty | Property |
Contact property in UI header |
| tProperty | Property |
Temporary contact property in UI header (for editing purposes) |
| content | string |
The content of the property |
Adds a property to the appropriate contact section for displaying the contact in the UI
| Param | Type | Description |
|---|---|---|
| index | Integer |
The index of the contact section to add to |
| currentOption | string |
The option type associated with the property |
| content | string |
The content of the property |
| sections | Array |
The sections of the contact |
| jCardIndex | Integer |
Index of the jCard which the detail belongs to |
| property | Property |
Property to add |
Updates the value of an existing property that is from a contact section
| Param | Type | Description |
|---|---|---|
| ab | AddressBook |
The addressbook UI component |
| index | Integer |
The index of the temporary contact section to update |
| fieldID | Integer |
The index of the field in the temporary contact section to update |
| content | string |
The content to update the property with |
Updates the value of an existing property that is a personal detail
| Param | Type | Description |
|---|---|---|
| ab | AddressBook |
The addressbook UI component |
| detail | string |
The detail to update |
| content | string |
The content to update the property with |
Updates the option associated with a property
| Param | Type | Description |
|---|---|---|
| ab | AddressBook |
The addressbook UI component |
| option | string |
The option to update to |
| index | Integer |
The index of the temporary contact section to update |
| fieldID | Integer |
The index of the field in the temporary contact section to update |
Updates the profile image of a contact
| Param | Type | Description |
|---|---|---|
| ab | AddressBook |
The addressbook UI component |
| image | Blob |
The new image for the contact |
Removes a property from a contact
| Param | Type | Description |
|---|---|---|
| tempContact | Contact |
The temporary contact (for editing purposes) to be modified |
| tempSectionIndex | Integer |
The index of the temporary section of a contact to add to |
| tempSections | Array |
All sections of the contact |
| propertyID | Integer |
The id of the property to be removed |
| ab | AddressBook |
The addressbook UI component |
Adds a new property to a contact
| Param | Type | Description |
|---|---|---|
| tempContact | Contact |
The temporary contact (for editing purposes) to be modified |
| tempSectionIndex | Integer |
The index of the temporary section of a contact to add to |
| tempSections | Array |
All sections of the contact |
| ab | AddressBook |
The addressbook UI component |
Renames a contact on the sidebar
| Param | Type | Description |
|---|---|---|
| id | Integer |
The id of the contact to be renamed |
| name | string |
The new name of the contact |
| contactsList | Array |
The list of contacts displayed on the sidebar |
Deletes a contact from the sidebar
Returns: Array - contactsList The list of contacts with the desired contact removed
| Param | Type | Description |
|---|---|---|
| contactsList | Array |
The list of contacts displayed on the sidebar |
| id | Integer |
The id of the contact to be deleted |
Saves the contact details from the temporary details for the UI
| Param | Type | Description |
|---|---|---|
| tpSection | Array |
The temporary details to save |
| pSection | Array |
The permanent details to save to |
| tempContact | Contact |
The temporary contact to save |
| contactsList | Array |
The list of all contacts |
| name | string |
The name of the contact before editing |
| id | Integer |
The id of the contact being saved |
Saves the image of a contact to the sidebar/contacts list
| Param | Type | Description |
|---|---|---|
| contactsList | Array |
The list of all contacts |
| tempContact | Contact |
The temporary contact to save |
| id | Integer |
The id of the contact being saved |
Saves the contact sections from the temporary sections for the UI
| Param | Type | Description |
|---|---|---|
| tSections | Array |
The temporary sections of the contact to save |
| cSections | Array |
The permanent sections of the contact to save to |
| contact | Array |
The contact to save |
Cancels the editing of a contact and resets the temporary fields to the original set of fields
| Param | Type | Description |
|---|---|---|
| ab | AddressBook |
The addressbook UI component |
ContactParser.findCloneProperty(property, contact) ⇒ Property
Finds a property within a contact
Returns: Property - property - the identical found property
| Param | Type | Description |
|---|---|---|
| property | Property |
The property to find |
| contact | Contact |
The contact to search through |
Checks if two properties are identical
this: Array
| Param | Type | Description |
|---|---|---|
| element | Property |
The property to check |
| index | Integer |
The index of the other property |