From 5190019d8adc66f0a1732af70588b635a269d4dd Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Mon, 25 Jan 2016 15:53:16 +0100 Subject: [PATCH] [Contact] - API reference upgrade Change-Id: I4da4caf13642ecca2472b16f797b252a5992e817 Signed-off-by: Andrzej Popowski --- .../html/web/tizen/social/contact_tutorial_w.htm | 8 +- .../html/device_api/mobile/tizen/contact.html | 364 ++++++++++++++++++--- 2 files changed, 321 insertions(+), 51 deletions(-) diff --git a/org.tizen.tutorials/html/web/tizen/social/contact_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/social/contact_tutorial_w.htm index 0ab35a9..0f5fb67 100644 --- a/org.tizen.tutorials/html/web/tizen/social/contact_tutorial_w.htm +++ b/org.tizen.tutorials/html/web/tizen/social/contact_tutorial_w.htm @@ -469,7 +469,11 @@ try
  1. To manage a single person:
      -
    1. To retrieve persons, use the find() method of the ContactManager interface:

      tizen.contact.find(personsFoundCB);
    2. +
    3. To retrieve persons, use the find() method of the ContactManager interface. You can retrieve the most frequently used persons using a SortMode with the attribute usageCount.

      +
      +var sortMode = new tizen.SortMode("usageCount", "ASC");
      +tizen.contact.find(personsFoundCB, personsErrorCB, null, sortMode);
      +
    4. Update or delete the found persons in the personsFoundCB() event handler. In this example, the favorite flag of the first person is changed and the contact is updated using the update() method. The second person is deleted using the remove() method.

      /* Define the event success callback */
       function personsFoundCB(persons)
       {
      @@ -520,4 +524,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
       
       
       
      -
      \ No newline at end of file
      +
      diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html
      index be128ee..4d13efb 100644
      --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html
      +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/contact.html
      @@ -7,7 +7,6 @@
       
       
       
      -

      Contact API

      The Contact API provides functionality for managing address books. @@ -94,15 +93,19 @@ For more information on the Contact features, see ContactRelationship
    5. -
    6. 2.21. PersonArraySuccessCallback +
    7. 2.21. ContactExtensionInit
    8. -
    9. 2.22. ContactArraySuccessCallback +
    10. 2.22. ContactExtension
    11. -
    12. 2.23. AddressBookArraySuccessCallback +
    13. 2.23. PersonArraySuccessCallback
    14. -
    15. 2.24. AddressBookChangeCallback +
    16. 2.24. ContactArraySuccessCallback
    17. -
    18. 2.25. PersonsChangeCallback +
    19. 2.25. AddressBookArraySuccessCallback +
    20. +
    21. 2.26. AddressBookChangeCallback +
    22. +
    23. 2.27. PersonsChangeCallback
    24. @@ -228,6 +231,14 @@ For more information on the Contact features, see ContactExtensionInit + + + +ContactExtension + + + PersonArraySuccessCallback void onsuccess (Person[] persons) @@ -3315,6 +3326,8 @@ to an unknown error. attribute ContactId displayContactId; + readonly attribute long usageCount; + void link(PersonId personId) raises(WebAPIException); Person unlink(ContactId contactId) raises(WebAPIException); @@ -3442,6 +3455,21 @@ The contact, this value is indicating, is used to show detailed information of t

      Since: 2.0 +

      + +
    25. + readonly +long usageCount
      +The number of contact usage. +
      +
      +

      +usage type refers to contacts_usage_type_e of native API +

      +
      +

      +Since: +3.0

    26. @@ -3654,6 +3682,7 @@ contains invalid values. ContactEmailAddress[] emails; ContactInstantMessenger[] messengers; ContactRelationship[] relationships; + ContactExtension[] extensions; Date birthday; ContactAnniversary[] anniversaries; ContactOrganization[] organizations; @@ -3706,6 +3735,8 @@ This dictionary is used to input parameters when contacts are created. attribute ContactRelationship[] relationships; + attribute ContactExtension[] extensions; + attribute Date? birthday setraises(WebAPIException); attribute ContactAnniversary[] anniversaries setraises(WebAPIException); @@ -3738,44 +3769,6 @@ This dictionary is used to input parameters when contacts are created. var contact = null; - - var name = new tizen.ContactName({ - firstName: "Forrest", - lastName: "Gump" - }); - var addresses = [ new tizen.ContactAddress({ - city: "New York", - streetAddress: "46th St.", - isDefault: true }) ]; - var phoneNumbers = [ new tizen.ContactPhoneNumber("(111) 555-1212"), - new tizen.ContactPhoneNumber("(111) 555-1213") ]; - - try { - contact = new tizen.Contact({ - name: name, - addresses: addresses, - phoneNumbers: phoneNumbers - }); - } catch (err) { - console.log( 'The following error occurred while creating contact: ' + err.name); - } - - try { - if (contact) { - addressbook.add(contact); - console.log('Contact was added with ID ' + contact.id); - } - } catch (err) { - console.log( 'The following error occurred while adding: ' + err.name); - } - - -
      -

      Code example:

        // Gets the default address book.
      -  var addressbook = tizen.contact.getDefaultAddressBook();
      -
      -  var contact = null;
      -
         try {
           contact = new tizen.Contact(
                             "BEGIN:VCARD\n"+
      @@ -4043,6 +4036,28 @@ By default, this attribute is set to an empty array.
        
      +
    27. +ContactExtension[] +extensions
      +The extended data of the contact. +
      +
      +

      +By default, this attribute is set to an empty array. +

      +
      +

      +Since: +3.0 +

      +
      +

      Code example:

      +var contactInit = {};
      +			var extension = new tizen.ContactExtension({ data1: 20, data2: 'Place of birth: Elbląg' });
      +			contactInit.extensions = [extension];
      + 
      +
      +
    28. Date birthday [nullable]
      The birthday of the contact. @@ -5748,8 +5763,210 @@ By default, this attribute is initialized to null.
      +
      +

      2.21. ContactExtensionInit

      +
      +The ContactExtensionInit dictionary defines the properties of a ContactExtension to pass to the ContactExtension constructor. +
      +
       dictionary ContactExtensionInit
      +  {
      +    long data1;
      +    DOMString data2;
      +    DOMString data3;
      +    DOMString data4;
      +    DOMString data5;
      +    DOMString data6;
      +    DOMString data7;
      +    DOMString data8;
      +    DOMString data9;
      +    DOMString data10;
      +    DOMString data11;
      +    DOMString data12;
      +  };
      +

      +Since: +3.0 +

      +
      +

      +See ContactExtension interface for more information about the members. +

      +
      +
      +
      +

      2.22. ContactExtension

      +
      +The ContactExtension interface contains the extended data of the contact. +
      +
       [Constructor(optional ContactExtensionInit? extensionInitDict)]
      +  interface ContactExtension
      +  {
      +    attribute long data1;
      +
      +    attribute DOMString? data2;
      +
      +    attribute DOMString? data3;
      +
      +    attribute DOMString? data4;
      +
      +    attribute DOMString? data5;
      +
      +    attribute DOMString? data6;
      +
      +    attribute DOMString? data7;
      +
      +    attribute DOMString? data8;
      +
      +    attribute DOMString? data9;
      +
      +    attribute DOMString? data10;
      +
      +    attribute DOMString? data11;
      +
      +    attribute DOMString? data12;
      +  };
      +

      +Since: +3.0 +

      +
      +

      +See code example below. +

      +
      +
      +

      Code example:

       var name = new tizen.ContactName({ firstName: 'Anna' });
      +
      +  var contact_extension1 = new tizen.ContactExtension({ data1: 20, data2: 'Place of birth: Elbląg' });
      +  var contact_extension2 = new tizen.ContactExtension({ data3: 'Favourite color: green' });
      +  var contact1 = new tizen.Contact({
      +    name: name,
      +    extensions: [ contact_extension1, contact_extension2 ]
      +  });
      +
      +  console.log(contact1.extensions[1].data3); // It shows: 'Favourite color: green'
      +
      +
      +
      +

      Constructors

      +
      ContactExtension(optional ContactExtensionInit? extensionInitDict);
      +
      +
      +

      Attributes

      +
        +
      • +long data1
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data2 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data3 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data4 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data5 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data6 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data7 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data8 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data9 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data10 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data11 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      • +DOMString data12 [nullable]
        +The extended data of a contact. +
        +

        +Since: +3.0 +

        +
      • +
      +
      +
      -

      2.21. PersonArraySuccessCallback

      +

      2.23. PersonArraySuccessCallback

      The PersonArraySuccessCallback interface defines the success callback that is used for retrieving a list of persons. @@ -5798,7 +6015,7 @@ get or save a list of persons.
      -

      2.22. ContactArraySuccessCallback

      +

      2.24. ContactArraySuccessCallback

      The ContactArraySuccessCallback interface defines the success callback that is used for saving and retrieving a list of contacts. @@ -5848,7 +6065,7 @@ The Contacts that were successfully saved must have their identifiers set.
      -

      2.23. AddressBookArraySuccessCallback

      +

      2.25. AddressBookArraySuccessCallback

      The AddressBookArraySuccessCallback interface defines the success callback that is called when retrieving a list of AddressBooks.
      @@ -5896,7 +6113,7 @@ get address books.
      -

      2.24. AddressBookChangeCallback

      +

      2.26. AddressBookChangeCallback

      The AddressBookChangeCallback interface provides the methods to be called for address book change notifications. @@ -5994,7 +6211,7 @@ book change occurs (contact addition/update/deletion).
      -

      2.25. PersonsChangeCallback

      +

      2.27. PersonsChangeCallback

      The PersonsChangeCallback interface provides the methods to be called for change notifications.
      @@ -6226,6 +6443,8 @@ list change occurs (person addition/update/deletion). attribute ContactId displayContactId; + readonly attribute long usageCount; + void link(PersonId personId) raises(WebAPIException); Person unlink(ContactId contactId) raises(WebAPIException); @@ -6239,6 +6458,7 @@ list change occurs (person addition/update/deletion). ContactEmailAddress[] emails; ContactInstantMessenger[] messengers; ContactRelationship[] relationships; + ContactExtension[] extensions; Date birthday; ContactAnniversary[] anniversaries; ContactOrganization[] organizations; @@ -6277,6 +6497,8 @@ list change occurs (person addition/update/deletion). attribute ContactRelationship[] relationships; + attribute ContactExtension[] extensions; + attribute Date? birthday setraises(WebAPIException); attribute ContactAnniversary[] anniversaries setraises(WebAPIException); @@ -6474,6 +6696,50 @@ list change occurs (person addition/update/deletion). attribute DOMString? label; }; + dictionary ContactExtensionInit + { + long data1; + DOMString data2; + DOMString data3; + DOMString data4; + DOMString data5; + DOMString data6; + DOMString data7; + DOMString data8; + DOMString data9; + DOMString data10; + DOMString data11; + DOMString data12; + }; + + [Constructor(optional ContactExtensionInit? extensionInitDict)] + interface ContactExtension + { + attribute long data1; + + attribute DOMString? data2; + + attribute DOMString? data3; + + attribute DOMString? data4; + + attribute DOMString? data5; + + attribute DOMString? data6; + + attribute DOMString? data7; + + attribute DOMString? data8; + + attribute DOMString? data9; + + attribute DOMString? data10; + + attribute DOMString? data11; + + attribute DOMString? data12; + }; + [Callback=FunctionOnly, NoInterfaceObject] interface PersonArraySuccessCallback { void onsuccess(Person[] persons); }; -- 2.7.4