Skip to content

sync: smoother shared preference manager clearing (fixes #13008)#12877

Merged
dogi merged 5 commits into
masterfrom
refactor-clear-shared-pref-16783400589895170730
Apr 16, 2026
Merged

sync: smoother shared preference manager clearing (fixes #13008)#12877
dogi merged 5 commits into
masterfrom
refactor-clear-shared-pref-16783400589895170730

Conversation

@dogi
Copy link
Copy Markdown
Member

@dogi dogi commented Apr 10, 2026

This PR moves the SharedPreferences clearing logic from SyncActivity's companion object into SharedPrefManager. This eliminates the need for manual dependency injection via EntryPointAccessors when clearing data and properly encapsulates preference lifecycle management.

Changes:

  • Added clearPreferences() to SharedPrefManager and injected ApplicationContext as a class property for accessing PreferenceManager.
  • Replaced the call in SettingsActivity and SyncActivity with the injected SharedPrefManager instance.
  • Removed unused imports and cleaned up the companion object.

PR created automatically by Jules for task 16783400589895170730 started by @dogi

Moves the logic for clearing SharedPreferences while preserving the FIRST_LAUNCH and MANUAL_CONFIG keys out of SyncActivity's companion object and into a new `clearPreferences()` instance method on `SharedPrefManager`.

Call sites in SettingsActivity and SyncActivity have been updated to call this new method on their injected SharedPrefManager instances. Extraneous Dagger EntryPoint imports were removed.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Collaborator

@Okuro3499 Okuro3499 left a comment

Choose a reason for hiding this comment

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

SharedPrefManager.kt:13 — change val context: Context back to private val context: Context. There's no reason to expose it publicly.

Modifies the `SharedPrefManager` constructor to use `private val context` instead of `val context` so that the `Context` is not publicly exposed by the manager instance.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@dogi
Copy link
Copy Markdown
Member Author

dogi commented Apr 16, 2026

@copilot resolve the merge conflicts in this pull request

Co-authored-by: dogi <13684059+dogi@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented Apr 16, 2026

SharedPrefManager.kt:13 — change val context: Context back to private val context: Context. There's no reason to expose it publicly.

Updated in commit 5d3062d: SharedPrefManager now uses @ApplicationContext private val context: Context.

@copilot resolve the merge conflicts in this pull request

Resolved by merging origin/master into this branch and fixing the SyncActivity conflict while keeping the SharedPrefManager-based clear logic refactor. Included in commit 3658a84.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.foojay.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xmx64m -Xms64m -Dorg.gradle.appname=gradlew -jar /home/REDACTED/work/myplanet/myplanet/gradle/wrapper/gradle-wrapper.jar assembleDefaultDebug testDefaultDebugUnitTest --no-daemon (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of dogi April 16, 2026 15:58
@dogi dogi changed the title Refactor clearSharedPref to SharedPrefManager sync: smoother shared preference manager clearing (fixes #13008) Apr 16, 2026
@dogi dogi merged commit 41e073e into master Apr 16, 2026
4 checks passed
@Okuro3499 Okuro3499 deleted the refactor-clear-shared-pref-16783400589895170730 branch April 20, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants