cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [16/50] [abbrv] git commit: * FirefoxOS quirks updated * name.formatted constructed with respect to honorific pre- and suffix
Date Mon, 05 May 2014 16:10:03 GMT
* FirefoxOS quirks updated
* name.formatted constructed with respect to honorific pre- and suffix


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/3478011b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/3478011b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/3478011b

Branch: refs/heads/cdvtest
Commit: 3478011b5c691da0d9f0c1edbc90b22294fa89c0
Parents: 8400410
Author: Piotr Zalewa <piotr@zalewa.info>
Authored: Tue Jan 7 13:06:29 2014 +0100
Committer: Piotr Zalewa <piotr@zalewa.info>
Committed: Tue Jan 7 13:06:29 2014 +0100

----------------------------------------------------------------------
 doc/index.md                   | 14 ++++++++++++++
 src/firefoxos/ContactsProxy.js | 19 ++++++++++---------
 2 files changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/3478011b/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 7d8bf36..190bf05 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -277,6 +277,12 @@ for details.
 
 - __urls__:  Partially supported. The first URL is stored in BlackBerry __webpage__ field.
 
+### FirefoxOS Quirks
+
+- __categories__: Partially supported. Fields __pref__ and __type__ are returning `null`
+
+- __organizations__: Partially supported. Fields __pref__, __type__ and __department__ are
returning `null`. Fields __name__ and __title__ stored in __org__ and __jobTitle__.
+
 ### iOS Quirks
 
 - __displayName__: Not supported on iOS, returning `null` unless there is no `ContactName`
specified, in which case it returns the composite name, __nickname__ or `""`, respectively.
@@ -395,6 +401,10 @@ a `ContactAddress[]` array.
 
 - __country__: Supported.
 
+### FirefoxOS Quirks
+
+- __formatted__: Currently not supported
+
 ### iOS Quirks
 
 - __pref__: Not supported on iOS devices, returning `false`.
@@ -556,6 +566,10 @@ Contains different kinds of information about a `Contact` object's name.
 
 - __honorificSuffix__: Not supported, returning `null`.
 
+### FirefoxOS Quirks
+
+- __formatted__: Partially supported, and read-only.  Returns a concatenation of `honorificPrefix`,
`givenName`, `middleName`, `familyName`, and `honorificSuffix`.
+
 ### iOS Quirks
 
 - __formatted__: Partially supported.  Returns iOS Composite Name, but is read-only.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/3478011b/src/firefoxos/ContactsProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/ContactsProxy.js b/src/firefoxos/ContactsProxy.js
index 1ccbed7..b0e2706 100644
--- a/src/firefoxos/ContactsProxy.js
+++ b/src/firefoxos/ContactsProxy.js
@@ -196,16 +196,17 @@ Contact.prototype.updateFromMozilla = function(moz) {
         return organizations;
     }
 
-    function createFormatted(cordova) {
+    function createFormatted(name) {
+        var fields = ['honorificPrefix', 'givenName', 'middleName', 
+                      'familyName', 'honorificSuffix'];
         var f = '';
-        if (cordova.name.givenName) {
-            f = cordova.name.givenName;
-        }
-        if (cordova.name.familyName) {
-            if (f) {
-                f += ' ';
+        for (var i = 0; i < fields.length; i++) {
+            if (name[fields[i]]) {
+                if (f) {
+                    f += ' ';
+                }
+                f += name[fields[i]];
             }
-            f += cordova.name.familyName;
         }
         return f;
     }
@@ -264,7 +265,7 @@ Contact.prototype.updateFromMozilla = function(moz) {
         this.organizations = createOrganizations(moz.org, moz.jobTitle);
     }
     // construct a read-only formatted value
-    this.name.formatted = createFormatted(this);
+    this.name.formatted = createFormatted(this.name);
 
     /*  Find out how to translate these parameters
         // photo: Blob


Mime
View raw message