Skip to content

feat(updates): toggle to disable background update check (closes #528)#529

Merged
rainxchzed merged 2 commits into
mainfrom
feat/528-disable-update-check
May 6, 2026
Merged

feat(updates): toggle to disable background update check (closes #528)#529
rainxchzed merged 2 commits into
mainfrom
feat/528-disable-update-check

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented May 6, 2026

Closes #528

Summary

Adds a "Background update check" toggle in Tweaks → Updates so users who don't want periodic update checks can disable them entirely. Saves battery for users who prefer to check manually from each app's details screen.

What changed

  • TweaksRepository: new `getUpdateCheckEnabled() / setUpdateCheckEnabled()` backed by DataStore key `update_check_enabled` (defaults to `true` for back-compat).
  • UpdateScheduleManager: new `cancel()` method on the interface; Android impl delegates to existing `UpdateScheduler.cancel()`, Desktop is a no-op.
  • TweaksViewModel: new `OnUpdateCheckEnabledToggled` action handler — persists the flag and either reschedules (with the current interval) or cancels all update workers immediately.
  • Tweaks UI: new toggle card at the top of the Updates section. Interval picker chips are disabled when the toggle is off, so the UI matches behaviour.
  • GithubStoreApp: cold-start scheduling reads the flag — disabled → cancel + skip schedule.
  • BootReceiver: post-reboot scheduling reads the flag via Koin GlobalContext + runBlocking inside `goAsync()` — disabled → cancel + skip.
  • OnUpdateCheckIntervalChanged handler now skips reschedule when the toggle is off (no resurrecting a cancelled schedule by changing interval).

Test plan

  • Toggle off → all WorkManager update workers cancel; no notifications, no battery drain.
  • Toggle off → toggle on → periodic check resumes with the previously-selected interval.
  • Toggle off → change interval → no schedule fires (interval is persisted but inactive).
  • Toggle off → reboot device → BootReceiver respects the flag, no schedule.
  • Toggle on (default) → existing 1.8.0 users see no behaviour change after upgrade.
  • Manual update check from any app's Details screen still works regardless of toggle state.
  • What's-new sheet on next 1.8.1 install lists the new toggle in device language.

Summary by CodeRabbit

  • New Features

    • Users can now disable background update checks from settings to save battery, while retaining the ability to manually check for updates at any time.
  • Localization

    • Updated release notes and UI strings across multiple languages to support the new update check toggle feature.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

This PR adds functionality to enable or disable background update checks via a user-facing toggle in the Tweaks settings. When disabled, any scheduled update checks are canceled; when enabled, they are rescheduled. The feature includes new repository methods, state management, UI components, and boot-time handling across multiple languages.

Changes

Update Check Toggle Feature

Layer / File(s) Summary
Domain & Data Interfaces
core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/repository/TweaksRepository.kt, core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/system/UpdateScheduleManager.kt
TweaksRepository exposes getUpdateCheckEnabled(): Flow<Boolean> and setUpdateCheckEnabled(enabled: Boolean). UpdateScheduleManager adds cancel() method to support canceling scheduled update checks.
Repository Implementation
core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/TweaksRepositoryImpl.kt
Implements new getter/setter for update check enabled preference with a default of true; adds UPDATE_CHECK_ENABLED_KEY constant.
Update Scheduler Support
core/data/src/androidMain/kotlin/zed/rainxch/core/data/services/AndroidUpdateScheduleManager.kt, core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopUpdateScheduleManager.kt
Android and Desktop implementations add cancel() overrides to support canceling pending update checks.
Presentation State & Actions
feature/tweaks/presentation/src/commonMain/kotlin/zed/rainxch/tweaks/presentation/TweaksState.kt, feature/tweaks/presentation/src/commonMain/kotlin/zed/rainxch/tweaks/presentation/TweaksAction.kt
TweaksState adds updateCheckEnabled: Boolean = true property. TweaksAction adds OnUpdateCheckEnabledToggled(val enabled: Boolean) data class.
ViewModel Logic
feature/tweaks/presentation/src/commonMain/kotlin/zed/rainxch/tweaks/presentation/TweaksViewModel.kt
Adds loadUpdateCheckEnabled() to subscribe to repository flow and update state. Modifies OnUpdateCheckIntervalChanged to reschedule only when enabled. Adds handler for OnUpdateCheckEnabledToggled to persist state and schedule or cancel updates accordingly.
UI Components
feature/tweaks/presentation/src/commonMain/kotlin/zed/rainxch/tweaks/presentation/components/sections/Installation.kt
Introduces BackgroundUpdateCheckToggleCard composable with title, description, and switch. Updates updatesSection to render the toggle before interval picker. Updates UpdateCheckIntervalCard signature to accept enabled parameter and respect disabled state in FilterChip.
App Integration & Boot Handling
composeApp/src/androidMain/kotlin/zed/rainxch/githubstore/app/GithubStoreApp.kt, core/data/src/androidMain/kotlin/zed/rainxch/core/data/services/BootReceiver.kt
scheduleBackgroundUpdateChecks retrieves TweaksRepository, checks getUpdateCheckEnabled(), and cancels or schedules accordingly. BootReceiver refactored to async handling with coroutine-based flag retrieval, defaulting to enabled on error; schedules or cancels based on flag with logging.
Localization
core/presentation/src/commonMain/composeResources/values*/strings-*.xml (all 13 locales)
Added update_check_enabled_title and update_check_enabled_description strings in English and all supported languages (ar, bn, es, fr, hi, it, ja, ko, pl, ru, tr, zh-CN).
Release Notes
core/presentation/src/commonMain/composeResources/files/whatsnew/*/16.json (all 13 locales)
Updated IMPROVED section in all locales to include bullet points about the new ability to disable background update checks for battery savings and manual control.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as UI Toggle
    participant ViewModel
    participant Repository
    participant Scheduler
    
    User->>UI: Toggle update checks on/off
    UI->>ViewModel: OnUpdateCheckEnabledToggled(enabled)
    ViewModel->>Repository: setUpdateCheckEnabled(enabled)
    Repository->>Repository: Persist preference
    ViewModel->>ViewModel: Update state
    alt enabled == true
        ViewModel->>Scheduler: reschedule(interval)
        Scheduler->>Scheduler: Schedule periodic checks
    else enabled == false
        ViewModel->>Scheduler: cancel()
        Scheduler->>Scheduler: Cancel pending checks
    end
    ViewModel->>UI: updateCheckEnabled = enabled
    UI->>User: Display toggle state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A toggle for the weary soul,
No more checks to drain the pole,
Battery saved, control reclaimed,
Background whispers, gently tamed,
Updates wait for willing hands!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding a toggle to disable background update checks, which directly addresses the issue objective.
Linked Issues check ✅ Passed All core requirements from issue #528 are met: toggle/option to disable auto-checks [#528], battery usage reduction capability [#528], manual checks retained [#528], backward compatibility maintained [#528], UI surface and localization added [#528].
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the toggle feature and its dependencies: repository layer, scheduler interfaces, view model logic, UI components, and internationalization strings. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/528-disable-update-check

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rainxchzed rainxchzed merged commit 0368e72 into main May 6, 2026
1 check passed
@rainxchzed rainxchzed deleted the feat/528-disable-update-check branch May 6, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please add an option to remove Update auto check

1 participant