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

Feature: Added support for changing the size format #16996

Merged
merged 3 commits into from
Apr 1, 2025
Merged

Conversation

yaira2
Copy link
Member

@yaira2 yaira2 commented Mar 30, 2025

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Confirmed the size unit reflects the selected option in settings

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for changing the size format displayed in the app, allowing users to choose between binary and decimal units.

  • Introduces a new view model property and corresponding user setting for the size unit format.
  • Updates size conversion logic in both view models and utility methods.
  • Adds a new enum and updates settings contracts to support the new size format selection.

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Files.App/ViewModels/Settings/FoldersViewModel.cs Adds SizeUnitsOptions initialization and SizeUnitFormat property for managing size display format.
src/Files.App/Services/Settings/FoldersSettingsService.cs Introduces a new SizeUnitFormat property to persist the user’s size format choice.
src/Files.App/Extensions/StringExtensions.cs Adjusts size string conversion logic based on the selected size unit format.
src/Files.App/Data/Models/ByteSize.cs Updates ShortString to use the appropriate size value based on the user preference.
src/Files.App/Data/Enums/SizeUnitTypes.cs Defines the enum representing available size unit formats.
src/Files.App/Data/Contracts/IFoldersSettingsService.cs Extends the settings service contract to include SizeUnitFormat.
Files not reviewed (2)
  • src/Files.App/Strings/en-US/Resources.resw: Language not supported
  • src/Files.App/Views/Settings/FoldersPage.xaml: Language not supported

@files-community files-community deleted a comment from Copilot bot Apr 1, 2025
@files-community files-community deleted a comment from Copilot bot Apr 1, 2025
Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

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

Tested locally, confirmed working well.
Settings title could be more descriptive maybe?

@dongle-the-gadget
Copy link
Contributor

On my machine, the toggle doesn't immediately refresh the view, causing the page to show units based on the old setting until the user navigates to a new page or manually refresh.

@0x5bfa
Copy link
Member

0x5bfa commented Apr 1, 2025

On my machine, the toggle doesn't immediately refresh the view, causing the page to show units based on the old setting until the user navigates to a new page or manually refresh.

I clicked the Refresh button to test, wouldnt it b challenging to reflect the change automatically? @yaira2

@yaira2
Copy link
Member Author

yaira2 commented Apr 1, 2025

On my machine, the toggle doesn't immediately refresh the view, causing the page to show units based on the old setting until the user navigates to a new page or manually refresh.

This should be addressed with my latest commit.

@yaira2 yaira2 requested a review from 0x5bfa April 1, 2025 20:10
@yaira2 yaira2 merged commit c38c680 into main Apr 1, 2025
8 checks passed
@yaira2 yaira2 deleted the ya/SizeUnits branch April 1, 2025 20:26
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Apr 1, 2025
@yaira2
Copy link
Member Author

yaira2 commented Apr 2, 2025

Tested locally, confirmed working well. Settings title could be more descriptive maybe?

We can technically display an example, but let's see how this works first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Ability to customize the way file sizes are displayed (units and decimal/binary bytes)
3 participants