-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Improves Files.App.Storage #10834
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
Improves Files.App.Storage #10834
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I haven't seen any problem.
src/Files.App.Storage/FtpStorage/FtpStorageFolder.cs
and src/Files.App.Storage/WindowsStorage/WindowsStorageFolder.cs
are alike on some spaces, but I do not think it'd be wise to try to fuse them.
public Task<bool> IsFileSystemAccessibleAsync(CancellationToken cancellationToken = default) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep it as is.
|
||
private static async Task<AsyncFtpClient> GetClient(string path, CancellationToken cancellationToken = default) | ||
{ | ||
using AsyncFtpClient client = path.GetFtpClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
statement here will dispose the client after the method exits. Remove it from here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides, you could refactor the method in FtpStorable.GetFtpClientAsync() - to use a string path
parameter, and remove this method
} | ||
|
||
public static Task EnsureConnectedAsync(this AsyncFtpClient ftpClient, CancellationToken cancellationToken = default) | ||
public static string GetFtpPath(this string path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't make GetFtpPath an extension method on string!!!!
@@ -5,7 +5,7 @@ namespace Files.Shared.Helpers | |||
{ | |||
public static class PathHelpers | |||
{ | |||
public static string GetParentDir(string path) | |||
public static string GetParentDir(this string path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nooo!!!
@@ -14,7 +14,7 @@ public static string GetParentDir(string path) | |||
return path.Substring(0, index != -1 ? index : path.Length); | |||
} | |||
|
|||
public static string Combine(string folder, string name) | |||
public static string Combine(this string folder, string name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Nooo!!!" here too
{ | ||
return Task.FromResult<ILocatableFolder?>(null); | ||
} | ||
=> Task.FromResult<ILocatableFolder?>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change please :)
public abstract class FtpStorable : ILocatableStorable | ||
{ | ||
/// <inheritdoc/> | ||
public string Path { get; protected set; } | ||
public string Id => string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, I wouldn't do anything to this for now, as Id
will be implemented here. (And in other places as well)
|
||
protected AsyncFtpClient GetFtpClient() | ||
protected async Task<AsyncFtpClient> GetFtpClient(CancellationToken cancellationToken = default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to GetFtpClientAsync
: base(path, name) | ||
{ | ||
} | ||
public FtpStorageFile(string path, string name) : base(path, name) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change :) (And in other places too)
@d2dyno1 @yaira2 @QuaintMako This pr has a lot of cancellation requests and conflicts with #10477. I am closing it because it is no longer needed. |
Resolved / Related Issues
Clean Storage code.
Validation
How did you test these changes?