-
Notifications
You must be signed in to change notification settings - Fork 32
/
contact-helper.ios.js
121 lines (101 loc) · 3.07 KB
/
contact-helper.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
var KnownLabel = require("./known-label");
// Could not find respective constants for these???
var HOME_FAX = "_$!<HomeFAX>!$_";
var WORK_FAX = "_$!<WorkFAX>!$_";
var MAIN = "_$!<Main>!$_";
exports.getiOSValue = function(key, contactData){
if (key === 'notes') {
key = 'note';
}
return contactData.isKeyAvailable(key) ? contactData[key] : "";
};
exports.getGenericLabel = function (nativeLabel) {
var genericLabel = nativeLabel;
switch (nativeLabel) {
case CNLabelHome:
genericLabel = KnownLabel.HOME;
break;
case CNLabelWork:
genericLabel = KnownLabel.WORK;
break;
case CNLabelOther:
genericLabel = KnownLabel.OTHER;
break;
};
return genericLabel;
};
exports.getNativeGenericLabel = function (label) {
var nativeGenericLabel = label;
switch (label) {
case KnownLabel.HOME:
nativeGenericLabel = CNLabelHome;
break;
case KnownLabel.WORK:
nativeGenericLabel = CNLabelWork;
break;
case KnownLabel.OTHER:
nativeGenericLabel = CNLabelOther;
break;
};
return nativeGenericLabel;
};
exports.getPhoneLabel = function (nativeLabel) {
var phoneLabel = exports.getGenericLabel(nativeLabel);
switch (nativeLabel) {
case kABPersonPhoneMobileLabel:
phoneLabel = KnownLabel.MOBILE;
break;
case HOME_FAX:
phoneLabel = KnownLabel.FAX_HOME;
break;
case WORK_FAX:
phoneLabel = KnownLabel.FAX_WORK;
break;
case kABPersonPhonePagerLabel:
phoneLabel = KnownLabel.PAGER;
break;
case MAIN:
phoneLabel = KnownLabel.MAIN;
break;
};
return phoneLabel;
};
exports.getNativePhoneLabel = function (label) {
var nativePhoneLabel = exports.getNativeGenericLabel(label);
switch (label) {
case KnownLabel.MOBILE:
nativePhoneLabel = kABPersonPhoneMobileLabel;
break;
case KnownLabel.FAX_HOME:
nativePhoneLabel = HOME_FAX;
break;
case KnownLabel.FAX_WORK:
nativePhoneLabel = WORK_FAX;
break;
case KnownLabel.PAGER:
nativePhoneLabel = kABPersonPhonePagerLabel;
break;
case KnownLabel.MAIN:
nativePhoneLabel = MAIN;
break;
};
return nativePhoneLabel;
};
exports.getWebsiteLabel = function (nativeLabel) {
var phoneLabel = exports.getGenericLabel(nativeLabel);
switch (nativeLabel) {
case CNLabelURLAddressHomePage:
phoneLabel = KnownLabel.HOMEPAGE;
break;
};
return phoneLabel;
};
exports.getNativeWebsiteLabel = function (label) {
var nativeWebsiteLabel = exports.getNativeGenericLabel(label);
switch (label) {
case KnownLabel.HOMEPAGE:
nativeWebsiteLabel = CNLabelURLAddressHomePage;
break;
};
return nativeWebsiteLabel;
};