Skip to content

feat: implement "Clear Downloads" confirmation dialog and UI improvem…#358

Merged
rainxchzed merged 3 commits intomainfrom
clear-cache-enhancment
Mar 26, 2026
Merged

feat: implement "Clear Downloads" confirmation dialog and UI improvem…#358
rainxchzed merged 3 commits intomainfrom
clear-cache-enhancment

Conversation

@rainxchzed
Copy link
Copy Markdown
Member

@rainxchzed rainxchzed commented Mar 26, 2026

…ents

  • Add ClearDownloadsDialog to provide a confirmation step before deleting downloaded APKs.
  • Update ProfileViewModel and ProfileState to manage the visibility of the clear downloads dialog and handle confirm/dismiss actions.
  • Rename "Clear cache" to "Downloaded Packages" in the UI and update related string resources to be more descriptive.
  • Enhance the storage section in the Profile settings with a new layout, including a "Delete All" icon button and detailed storage information.
  • Refactor ProfileAction to include explicit confirmation and dismissal events for clearing downloads.
  • Fix syntax in ScrollbarContainer.android.kt by removing unnecessary backticks from @Composable annotations.

Summary by CodeRabbit

  • New Features

    • Added "Downloaded Packages" management section in profile settings, allowing users to delete all downloaded packages with a confirmation dialog.
  • Bug Fixes

    • Fixed download cancellation logic to properly delete files only when an active download is actually cancelled.
    • Fixed syntax issues in platform-specific code.
  • Documentation

    • Added localized strings for downloads management UI components.

…ents

- Add `ClearDownloadsDialog` to provide a confirmation step before deleting downloaded APKs.
- Update `ProfileViewModel` and `ProfileState` to manage the visibility of the clear downloads dialog and handle confirm/dismiss actions.
- Rename "Clear cache" to "Downloaded Packages" in the UI and update related string resources to be more descriptive.
- Enhance the storage section in the Profile settings with a new layout, including a "Delete All" icon button and detailed storage information.
- Refactor `ProfileAction` to include explicit confirmation and dismissal events for clearing downloads.
- Fix syntax in `ScrollbarContainer.android.kt` by removing unnecessary backticks from `@Composable` annotations.
…letion

- Update `AndroidDownloader` and `DesktopDownloader` to only delete local files if an active download was successfully cancelled.
- Move file deletion logic inside the active download check to ensure only incomplete files associated with a current session are removed.
- Simplify the `cancelDownload` return value to strictly reflect the cancellation status.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 681bbbcc-5d7b-419d-8a5e-406161d8a0fe

📥 Commits

Reviewing files that changed from the base of the PR and between 69cb26b and d829571.

📒 Files selected for processing (10)
  • core/data/src/androidMain/kotlin/zed/rainxch/core/data/services/AndroidDownloader.kt
  • core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopDownloader.kt
  • core/presentation/src/androidMain/kotlin/zed/rainxch/core/presentation/components/ScrollbarContainer.android.kt
  • core/presentation/src/commonMain/composeResources/values/strings.xml
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileAction.kt
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileRoot.kt
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileState.kt
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/ProfileViewModel.kt
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/ClearDownloadsDialog.kt
  • feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/sections/Others.kt

Walkthrough

PR refactors the download-clearing feature from cache-clearing terminology, updates downloader cancellation logic to delete files only when active downloads are canceled, and fixes a Compose syntax issue in ScrollbarContainer.

Changes

Cohort / File(s) Summary
Downloader cancellation logic
core/data/src/androidMain/kotlin/.../AndroidDownloader.kt, core/data/src/jvmMain/kotlin/.../DesktopDownloader.kt
Modified cancelDownload() to delete files only when cancelled == true (i.e., when an active download is actually canceled), rather than unconditionally. Return value now reflects only cancellation status, not file deletion status.
ScrollbarContainer syntax fix
core/presentation/src/androidMain/kotlin/.../ScrollbarContainer.android.kt
Removed backticks from @Composable type annotations in both composable overloads and corrected stray syntax issues to align with standard Kotlin Compose conventions.
Profile state & actions
feature/profile/presentation/src/commonMain/kotlin/.../ProfileAction.kt, feature/profile/presentation/src/commonMain/kotlin/.../ProfileState.kt, feature/profile/presentation/src/commonMain/kotlin/.../ProfileViewModel.kt
Added OnClearDownloadsConfirm and OnClearDownloadsDismiss actions, introduced isClearDownloadsDialogVisible state field, and wired downloads-clearing dialog control flow with updated error message from "clear cache" to "clear downloads".
Profile UI components
feature/profile/presentation/src/commonMain/kotlin/.../ProfileRoot.kt, feature/profile/presentation/src/commonMain/kotlin/.../components/ClearDownloadsDialog.kt, feature/profile/presentation/src/commonMain/kotlin/.../components/sections/Others.kt
Added new ClearDownloadsDialog composable, integrated conditional dialog rendering in ProfileRoot, updated "others" card UI with new icon (Inventory2), subtitle, button styling (error-themed FilledTonalButton), and DeleteOutline icon.
String resources
core/presentation/src/commonMain/composeResources/values/strings.xml
Added new string keys for downloads UI: downloaded_packages, downloaded_packages_description, delete_all, delete_downloads_confirmation_title, delete_downloads_confirmation_message (with %1$s placeholder), and downloads_cleared; retained legacy clear_cache for compatibility.

Possibly related PRs

Poem

🐰 Files hop and dance in neat cohorts,
Downloads now cleared with care, no sorts,
Dialogs bloom with buttons so fair,
Logic refined with cancellation care—
A fresher storage, curated with flair! 🎀

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ 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 clear-cache-enhancment

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 d246298 into main Mar 26, 2026
@rainxchzed rainxchzed deleted the clear-cache-enhancment branch March 26, 2026 06:06
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.

1 participant