Skip to content

Provide database Collection to SyncManager #875

Closed
@rfc2822

Description

@rfc2822

Providing the respective database Collection to the SyncManager will allow us to reduce our dependency of the content providers.

For instance, we can then take the address book/calendar URL from the DB Collection.url field instead of caching it in the content provider and then taking it from there.

Right now, we have two main steps in the Syncer (let's take the CalendarSyncer as an example):

  1. (Do some other stuff, like handling colors.)
  2. updateLocalCalendars: sync the DB collections of type "calendar" with the Android content provider (the collections themselves, not the contents)
    • Create local calendars (= calendar in the content provider) for syncable collections that don't have a local calendar yet.
    • Update existing local calendars according to database and settings (title, URL, read/only flag, colors, …).
    • Delete existing local calendars that shall not be synced (anymore).
  3. Iterate through all local calendars and sync them with a CalendarSyncManager. In this step, we don't have the DB collection anymore, so we can't pass it to the SyncManager.

Now we want the DB collection to be available for the SyncManager. My approach would be to combine the main steps in the Syncer:

  1. (Do some other stuff, if necessary.)
  2. Sync list of DB collections with local calendars (the collections themselves, not the contents):
    • Create/update local calendar according to the database when needed like we already do.
    • Still in the same scope, we still have the DB collection and can pass it to the SyncManager. So we call the SyncManager here and pass the DB Collection.
    • Delete existing local calendars that shall not be synced (anymore).

Metadata

Metadata

Assignees

Labels

refactoringInternal improvement of existing functions

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions