Improved phonebook photos

Closes #385
This commit is contained in:
Igor Zhukov 2014-07-22 12:36:49 +04:00
parent 9060ec2a44
commit 62046f307f

View File

@ -320,7 +320,7 @@ angular.module('myApp.services', [])
}
})
.service('PhonebookContactsService', function ($q, $modal, $sce) {
.service('PhonebookContactsService', function ($q, $modal, $sce, FileManager) {
var phonebookContactsPromise;
@ -376,9 +376,12 @@ angular.module('myApp.services', [])
contact.phones.push(this.result.tel[i].value);
}
}
if (this.result.photo) {
contact.photo = URL.createObjectURL(this.result.photo[0]);
} else {
if (this.result.photo && this.result.photo[0]) {
try {
contact.photo = FileManager.getUrl(this.result.photo[0]);
} catch (e) {}
}
if (!contact.photo) {
contact.photo = 'img/placeholders/UserAvatar' + ((Math.abs(count) % 8) + 1) + '@2x.png';
}
contact.photo = $sce.trustAsResourceUrl(contact.photo);