1
0
mirror of https://github.com/etesync/android synced 2024-12-23 23:18:46 +00:00

Calendar sync adapter service: minor cleanup.

This commit is contained in:
Tom Hacohen 2017-04-05 18:56:33 +01:00
parent b6f97ac955
commit 0a4d4a9d9e

View File

@ -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<Persistable> data = ((App) getContext().getApplicationContext()).getData();
Map<String, CollectionInfo> remote = new HashMap<>();
List<CollectionInfo> remoteCollections = JournalEntity.getCollections(data, service);
@ -152,8 +151,6 @@ public class CalendarsSyncAdapterService extends SyncAdapterService {
} finally {
dbHelper.close();
}
return ret;
}
}