Populate contact share protos.

pull/1/head
Matthew Chen 7 years ago
parent 757234d309
commit e22e9a7842

@ -153,19 +153,19 @@ NS_ASSUME_NONNULL_BEGIN
OWSSignalServiceProtosDataMessageContactName *nameProto = contactProto.name; OWSSignalServiceProtosDataMessageContactName *nameProto = contactProto.name;
if (nameProto.hasGivenName) { if (nameProto.hasGivenName) {
contactShare.givenName = nameProto.givenName; contactShare.givenName = nameProto.givenName.ows_stripped;
} }
if (nameProto.hasFamilyName) { if (nameProto.hasFamilyName) {
contactShare.familyName = nameProto.familyName; contactShare.familyName = nameProto.familyName.ows_stripped;
} }
if (nameProto.hasPrefix) { if (nameProto.hasPrefix) {
contactShare.namePrefix = nameProto.prefix; contactShare.namePrefix = nameProto.prefix.ows_stripped;
} }
if (nameProto.hasSuffix) { if (nameProto.hasSuffix) {
contactShare.nameSuffix = nameProto.suffix; contactShare.nameSuffix = nameProto.suffix.ows_stripped;
} }
if (nameProto.hasMiddleName) { if (nameProto.hasMiddleName) {
contactShare.middleName = nameProto.middleName; contactShare.middleName = nameProto.middleName.ows_stripped;
} }
} }
@ -196,6 +196,8 @@ NS_ASSUME_NONNULL_BEGIN
} }
contactShare.addresses = [addresses copy]; contactShare.addresses = [addresses copy];
// TODO: Avatar
return contactShare; return contactShare;
} }
@ -220,13 +222,16 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
if (phoneNumberProto.hasLabel) { if (phoneNumberProto.hasLabel) {
result.label = phoneNumberProto.label; result.label = phoneNumberProto.label.ows_stripped;
} }
if (phoneNumberProto.hasValue) { if (phoneNumberProto.hasValue) {
result.phoneNumber = phoneNumberProto.value; result.phoneNumber = phoneNumberProto.value.ows_stripped;
} else { } else {
return nil; return nil;
} }
if (!result.isValid) {
return nil;
}
return result; return result;
} }
@ -250,13 +255,16 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
if (emailProto.hasLabel) { if (emailProto.hasLabel) {
result.label = emailProto.label; result.label = emailProto.label.ows_stripped;
} }
if (emailProto.hasValue) { if (emailProto.hasValue) {
result.email = emailProto.value; result.email = emailProto.value.ows_stripped;
} else { } else {
return nil; return nil;
} }
if (!result.isValid) {
return nil;
}
return result; return result;
} }
@ -278,28 +286,31 @@ NS_ASSUME_NONNULL_BEGIN
} }
} }
if (addressProto.hasLabel) { if (addressProto.hasLabel) {
result.label = addressProto.label; result.label = addressProto.label.ows_stripped;
} }
if (addressProto.hasStreet) { if (addressProto.hasStreet) {
result.street = addressProto.street; result.street = addressProto.street.ows_stripped;
} }
if (addressProto.hasPobox) { if (addressProto.hasPobox) {
result.pobox = addressProto.pobox; result.pobox = addressProto.pobox.ows_stripped;
} }
if (addressProto.hasNeighborhood) { if (addressProto.hasNeighborhood) {
result.neighborhood = addressProto.neighborhood; result.neighborhood = addressProto.neighborhood.ows_stripped;
} }
if (addressProto.hasCity) { if (addressProto.hasCity) {
result.city = addressProto.city; result.city = addressProto.city.ows_stripped;
} }
if (addressProto.hasRegion) { if (addressProto.hasRegion) {
result.region = addressProto.region; result.region = addressProto.region.ows_stripped;
} }
if (addressProto.hasPostcode) { if (addressProto.hasPostcode) {
result.postcode = addressProto.postcode; result.postcode = addressProto.postcode.ows_stripped;
} }
if (addressProto.hasCountry) { if (addressProto.hasCountry) {
result.country = addressProto.country; result.country = addressProto.country.ows_stripped;
}
if (!result.isValid) {
return nil;
} }
return result; return result;
} }

Loading…
Cancel
Save