Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract sync framework interaction to separate class #1137

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented Nov 21, 2024

Purpose

This is part of moving further away from the Sync Adapter Framework, which has been mostly replaced by Work Manager and is only used for sync requests coming from 3rd party apps and content changes.

While SyncAdapterServices is the entry point for said sync requests we are still en-/disabling general sync-ability and content triggered syncs for the sync framework via ContentResolver calls. These calls should be made from a single central place.

If we would ever like to change the notification of changed content provider entries to JobScheduler / WorkManager (https://github.com/bitfireAT/davx5/issues/247), it will be possible by adapting mainly this class and SyncAdapterServices.

Short description

  • Create SyncFrameworkIntegration class with all necessary methods.
  • Use it everywhere ContentResolver calls are made, except in the migrations

Note that due to the Android 7 contacts upload work-around there are still several places where ContentResolver.SYNC_EXTRAS_UPLOAD is in use.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup added the refactoring Internal improvement of existing functions label Nov 21, 2024
@sunkup sunkup self-assigned this Nov 21, 2024
@sunkup sunkup linked an issue Nov 21, 2024 that may be closed by this pull request
@sunkup sunkup force-pushed the 1115-architecture-do-sync-framework-integration-in-a-separate-class branch from 0eb66c2 to 248eefb Compare November 25, 2024 10:06
@sunkup sunkup marked this pull request as ready for review November 25, 2024 10:19
@sunkup sunkup requested a review from ArnyminerZ November 25, 2024 10:19
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small things, otherwise looks good 😄

@sunkup sunkup requested a review from ArnyminerZ November 25, 2024 11:08
ArnyminerZ
ArnyminerZ previously approved these changes Nov 25, 2024
Copy link
Member

@ArnyminerZ ArnyminerZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@sunkup sunkup requested a review from rfc2822 November 25, 2024 12:24
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good and I think it's a good starting point for possible improvements in the future. For instance now setIsSycnable and setSyncOnContentChange must be both called and you have to know that. In a future version it's maybe possible that we call methods more "blackbox" style without knowing such details. But this shouldn't be done in this PR.

@rfc2822 rfc2822 merged commit 4ff7ff8 into main-ose Nov 25, 2024
8 checks passed
@rfc2822 rfc2822 deleted the 1115-architecture-do-sync-framework-integration-in-a-separate-class branch November 25, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal improvement of existing functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Architecture] Do sync framework integration in a separate class
3 participants