Validate/reformat phone numbers in contact syncs

Turns out there's no garauntee that Android will send us contact info
with phone numbers in e164 format. When that happens, we fail to update
the correct contact. Fix by performing validation on the incoming number
before attempting to merge changes to the name, avatar, or color.

Fixes #903
pull/749/head
lilia 9 years ago
parent 59c684db8a
commit f2bdafc7e9

@ -128,14 +128,22 @@
function onContactReceived(ev) {
var contactDetails = ev.contactDetails;
ConversationController.create({
var c = new Whisper.Conversation({
name: contactDetails.name,
id: contactDetails.number,
avatar: contactDetails.avatar,
color: contactDetails.color,
type: 'private',
active_at: Date.now()
}).save();
});
var error;
if (error = c.validateNumber()) {
console.log(error);
return;
}
ConversationController.create(c).save();
}
function onGroupReceived(ev) {

Loading…
Cancel
Save