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

Essentials.FileSystem refactored to interface and singleton #4633

Conversation

moljac
Copy link
Contributor

@moljac moljac commented Feb 11, 2022

WORK IN PROGRESS

Description of Change

Implements #

Additions made

  • Adds

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the WinUI, Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

  • Does this PR introduce a new control? (If yes, add an example using SemanticProperties to the SemanticsPage)
  • APIs that modify focusability?
  • APIs that modify any text property on a control?
  • Does this PR modify view nesting or view arrangement in anyway?
  • Is there the smallest possibility that your PR will change accessibility?
  • I'm not sure, please help me

If any of the above checkboxes apply to your PR, then the PR will need to provide testing to demonstrate that accessibility still works.

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Eilon Eilon added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Feb 11, 2022
@moljac moljac changed the title Essentials.FileSystem refactored to interface and singleton Essentials.FileSystem WIP refactored to interface and singleton Feb 11, 2022
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

There are some build errors here:

/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(83,34): error CS0506: 'BookmarkDataFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(172,34): error CS0506: 'UIDocumentFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(194,34): error CS0506: 'UIImageFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(215,34): error CS0506: 'PHAssetFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(145,4): error CS0103: The name 'Init' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(175,19): error CS1501: No overload for method 'GetContentType' takes 1 arguments [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(208,7): error CS0103: The name 'Current' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(83,34): error CS0506: 'BookmarkDataFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(172,34): error CS0506: 'UIDocumentFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(194,34): error CS0506: 'UIImageFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.ios.cs(215,34): error CS0506: 'PHAssetFileResult.OpenReadAsync()': cannot override inherited member 'FileBase.OpenReadAsync()' because it is not marked virtual, abstract, or override [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(145,4): error CS0103: The name 'Init' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(175,19): error CS1501: No overload for method 'GetContentType' takes 1 arguments [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(208,7): error CS0103: The name 'Current' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(145,4): error CS0103: The name 'Init' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(175,19): error CS1501: No overload for method 'GetContentType' takes 1 arguments [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.shared.cs(208,7): error CS0103: The name 'Current' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.android.cs(11,50): error CS0736: 'FileSystemImplementation' does not implement instance interface member 'IFileSystem.CacheDirectory'. 'FileSystemImplementation.CacheDirectory' cannot implement the interface member because it is static. [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]
/Users/builder/azdo/_work/2/s/src/Essentials/src/FileSystem/FileSystem.android.cs(11,50): error CS0736: 'FileSystemImplementation' does not implement instance interface member 'IFileSystem.AppDataDirectory'. 'FileSystemImplementation.AppDataDirectory' cannot implement the interface member because it is static. [/Users/builder/azdo/_work/2/s/src/Essentials/src/Essentials.csproj]

Ops, I have seen later that it is still in progress.

@moljac
Copy link
Contributor Author

moljac commented Feb 14, 2022

@jsuarezruiz

This one was a bit thougher than the others. I pushed all working refactorings as PR and added H1 WORK IN PROGRESS (I have no sufficient rights to mark PR as draft, or label it or assign).

This was done merely so we would not double our work (syncing efforts).

@Redth Redth requested a review from mattleibow February 24, 2022 14:41
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Just going to mention it for completeness, but I think this is different, should the return FileResult be IFileResult (like the screenshots api #4699)

This might be different as FileResult might very well be a representation of a file on disk. However, what happens if some unit testing system or platform wants/needs to represent a file system as a virtual one? Like say a single blob with offsets?

@@ -87,6 +128,20 @@ internal static string Clean(string extension, bool trimLeadingPeriod = false)
return extension;
}
}

#nullable enable
Copy link
Member

Choose a reason for hiding this comment

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

The nullable scope should also cover Current, so ight as well use a single block.

@Redth Redth changed the title Essentials.FileSystem WIP refactored to interface and singleton Essentials.FileSystem refactored to interface and singleton Feb 24, 2022
@Redth Redth merged commit 4ef677f into dotnet:main Feb 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants