1
0
mirror of https://github.com/etesync/android synced 2024-11-17 13:30:00 +00:00

Add contact resource downloader.

This commit is contained in:
Tom Hacohen 2017-02-14 15:00:58 +00:00
parent 44be896df7
commit c58ae8fb1c

View File

@ -139,10 +139,9 @@ public class ContactsSyncManager extends SyncManager {
protected void processSyncEntry(SyncEntry cEntry) throws IOException, ContactsStorageException, CalendarStorageException { protected void processSyncEntry(SyncEntry cEntry) throws IOException, ContactsStorageException, CalendarStorageException {
InputStream is = new ByteArrayInputStream(cEntry.getContent().getBytes(Charsets.UTF_8)); InputStream is = new ByteArrayInputStream(cEntry.getContent().getBytes(Charsets.UTF_8));
// FIXME: Probably cache this and enable it. prepare downloader which may be used to download external resource like contact photos Contact.Downloader downloader = new ResourceDownloader();
// Contact.Downloader downloader = new ResourceDownloader(collectionURL);
Contact[] contacts = Contact.fromStream(is, Charsets.UTF_8, null); Contact[] contacts = Contact.fromStream(is, Charsets.UTF_8, downloader);
if (contacts.length == 0) { if (contacts.length == 0) {
App.log.warning("Received VCard without data, ignoring"); App.log.warning("Received VCard without data, ignoring");
return; return;
@ -222,8 +221,6 @@ public class ContactsSyncManager extends SyncManager {
@RequiredArgsConstructor @RequiredArgsConstructor
private class ResourceDownloader implements Contact.Downloader { private class ResourceDownloader implements Contact.Downloader {
final HttpUrl baseUrl;
@Override @Override
public byte[] download(String url, String accepts) { public byte[] download(String url, String accepts) {
HttpUrl httpUrl = HttpUrl.parse(url); HttpUrl httpUrl = HttpUrl.parse(url);