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

Code Quality: Rename & Refactor ViewModels #12380

Closed
wants to merge 5 commits into from

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented May 17, 2023

Description

As the title. Phase 1-2, it is actually a part of the phase 1.

  1. Rename files with the appropriate name and put them into appropriate namespace for each.

PR Checklist

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Related Code Quality: Continued work to clean up entire project #12340
  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?

Screenshots

None

@0x5bfa 0x5bfa changed the title Code Quality: Rename & Refactor ViewModels (phase 2) Code Quality: Rename & Refactor ViewModels (phase 2-1) May 17, 2023
@0x5bfa 0x5bfa changed the title Code Quality: Rename & Refactor ViewModels (phase 2-1) Code Quality: Rename & Refactor ViewModels (phase 1-2) May 17, 2023
@yaira2 yaira2 changed the title Code Quality: Rename & Refactor ViewModels (phase 1-2) Code Quality: Rename & Refactor ViewModels May 17, 2023
Copy link
Contributor

@ferrariofilippo ferrariofilippo left a comment

Choose a reason for hiding this comment

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

Here are some suggestions. Hope I've not been too picky...
When there are naming issues, I added just one comment per file
I'll probably need to re-review this once you finish
Thank you again for your huge work on refactoring

Comment on lines 57 to 59
{
if (FolderSettings is FolderSettingsViewModel viewModel)
if (FolderSettings is FolderSettingsService viewModel)
viewModel.DirectorySortOption = value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you rename the variable from viewModel to simply model?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will fix.

CurrentInstanceViewModel InstanceViewModel { get; }
CurrentInstanceModel InstanceViewModel { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

Copy link
Member Author

@0x5bfa 0x5bfa May 17, 2023

Choose a reason for hiding this comment

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

What do you mean? I changed the suffix to Model. If you mean you are pointing variable naming, I font change yet because those previous viewmodels are referenced everywhere. Once I changed class name, diff became huge.(As i clarified in my cleaning up issue, it will be stage2:)

src/Files.App/Views/Shells/BaseShellPage.cs Show resolved Hide resolved
Comment on lines +2230 to +2231
var isSystem = ((SystemIO.FileAttributes)findData.dwFileAttributes & SystemIO.FileAttributes.System) == SystemIO.FileAttributes.System;
var isHidden = ((SystemIO.FileAttributes)findData.dwFileAttributes & SystemIO.FileAttributes.Hidden) == SystemIO.FileAttributes.Hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it System.IO?

Comment on lines -382 to +366
public ItemViewModel(FolderSettingsViewModel folderSettingsViewModel)
public ItemViewModel(FolderSettingsService folderSettingsViewModel)
Copy link
Contributor

Choose a reason for hiding this comment

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

Variable name

{
public static string LayoutSettingsDbPath
=> SystemIO.Path.Combine(ApplicationData.Current.LocalFolder.Path, "user_settings.db");
private IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetRequiredService<IUserSettingsService>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you inject it in the constructor?

Comment on lines +275 to +277

public FolderSettingsService()
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Spacing

@0x5bfa
Copy link
Member Author

0x5bfa commented May 18, 2023

I have to split up more and more. Reopening.

@0x5bfa 0x5bfa marked this pull request as draft May 18, 2023 14:30
@0x5bfa 0x5bfa closed this May 19, 2023
@0x5bfa
Copy link
Member Author

0x5bfa commented May 19, 2023

there was extra work...

@0x5bfa 0x5bfa deleted the 5bfa/cleanup-viewmodels2 branch May 19, 2023 12:39
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