From 0a4d4a9d9ef7869b36fba8ad25698fa77ee757a2 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 5 Apr 2017 18:56:33 +0100 Subject: [PATCH] Calendar sync adapter service: minor cleanup. --- .../syncadapter/CalendarsSyncAdapterService.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarsSyncAdapterService.java b/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarsSyncAdapterService.java index 28d23c91..4f1805d2 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarsSyncAdapterService.java +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/CalendarsSyncAdapterService.java @@ -72,7 +72,9 @@ public class CalendarsSyncAdapterService extends SyncAdapterService { new RefreshCollections(account, CollectionInfo.Type.CALENDAR).run(); - HttpUrl principal = updateLocalCalendars(provider, account, settings); + updateLocalCalendars(provider, account, settings); + + HttpUrl principal = HttpUrl.get(settings.getUri()); for (LocalCalendar calendar : (LocalCalendar[]) LocalCalendar.find(account, provider, LocalCalendar.Factory.INSTANCE, CalendarContract.Calendars.SYNC_EVENTS + "!=0", null)) { App.log.info("Synchronizing calendar #" + calendar.getId() + ", URL: " + calendar.getName()); @@ -106,16 +108,13 @@ public class CalendarsSyncAdapterService extends SyncAdapterService { App.log.info("Calendar sync complete"); } - private HttpUrl updateLocalCalendars(ContentProviderClient provider, Account account, AccountSettings settings) throws CalendarStorageException { - HttpUrl ret = null; + private void updateLocalCalendars(ContentProviderClient provider, Account account, AccountSettings settings) throws CalendarStorageException { ServiceDB.OpenHelper dbHelper = new ServiceDB.OpenHelper(getContext()); try { // enumerate remote and local calendars SQLiteDatabase db = dbHelper.getReadableDatabase(); Long service = dbHelper.getService(db, account, Services.SERVICE_CALDAV); - ret = HttpUrl.get(settings.getUri()); - EntityDataStore data = ((App) getContext().getApplicationContext()).getData(); Map remote = new HashMap<>(); List remoteCollections = JournalEntity.getCollections(data, service); @@ -152,8 +151,6 @@ public class CalendarsSyncAdapterService extends SyncAdapterService { } finally { dbHelper.close(); } - - return ret; } }