From c58ae8fb1c1d938f436b7fe5a4422016ccc3e257 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 14 Feb 2017 15:00:58 +0000 Subject: [PATCH] Add contact resource downloader. --- .../bitfire/davdroid/syncadapter/ContactsSyncManager.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java index 62308d1a..280a1c76 100644 --- a/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java +++ b/app/src/main/java/at/bitfire/davdroid/syncadapter/ContactsSyncManager.java @@ -139,10 +139,9 @@ public class ContactsSyncManager extends SyncManager { protected void processSyncEntry(SyncEntry cEntry) throws IOException, ContactsStorageException, CalendarStorageException { 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(collectionURL); + Contact.Downloader downloader = new ResourceDownloader(); - Contact[] contacts = Contact.fromStream(is, Charsets.UTF_8, null); + Contact[] contacts = Contact.fromStream(is, Charsets.UTF_8, downloader); if (contacts.length == 0) { App.log.warning("Received VCard without data, ignoring"); return; @@ -222,8 +221,6 @@ public class ContactsSyncManager extends SyncManager { @RequiredArgsConstructor private class ResourceDownloader implements Contact.Downloader { - final HttpUrl baseUrl; - @Override public byte[] download(String url, String accepts) { HttpUrl httpUrl = HttpUrl.parse(url);