Skip to content

Commit 680efbe

Browse files
committed
Implement Sync drive
1 parent 40103fa commit 680efbe

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/Files.App/Utils/Cloud/CloudProviders.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public enum CloudProviders
4545

4646
LucidLink,
4747

48-
kDrive
48+
kDrive,
49+
50+
Sync
4951
}
5052
}

src/Files.App/Utils/Cloud/Detector/CloudDetector.cs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private static IEnumerable<ICloudDetector> EnumerateDetectors()
3434
yield return new GenericCloudDetector();
3535
yield return new SynologyDriveCloudDetector();
3636
yield return new LucidLinkCloudDetector();
37+
yield return new SyncCloudDetector();
3738
}
3839
}
3940
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.IO;
2+
using Windows.Storage;
3+
4+
namespace Files.App.Utils.Cloud
5+
{
6+
/// <summary>
7+
/// Provides a utility for Sync Cloud detection.
8+
/// </summary>
9+
public sealed class SyncCloudDetector : AbstractCloudDetector
10+
{
11+
protected override async IAsyncEnumerable<ICloudProvider> GetProviders()
12+
{
13+
string syncFolderPath = Path.Combine(Constants.UserEnvironmentPaths.HomePath, "Sync");
14+
15+
if (Directory.Exists(syncFolderPath))
16+
{
17+
foreach (string directory in Directory.GetDirectories(syncFolderPath))
18+
{
19+
var folder = await StorageFolder.GetFolderFromPathAsync(directory);
20+
21+
yield return new CloudProvider(CloudProviders.Sync)
22+
{
23+
Name = $"Sync - {folder.Name}",
24+
SyncFolder = directory,
25+
// IconData = (needs icon)
26+
};
27+
}
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)