From ae07ddf736a5056e2932367366ed019cec39511e Mon Sep 17 00:00:00 2001
From: Yair <39923744+yaira2@users.noreply.github.com>
Date: Sun, 26 Nov 2023 10:24:01 -0500
Subject: [PATCH] Feature: Hide pCloud from drives list (#14084)
---
src/Files.App/Data/Models/AppModel.cs | 10 ++++++++++
src/Files.App/Services/RemovableDrivesService.cs | 3 ++-
src/Files.App/Utils/Cloud/CloudDrivesDetector.cs | 2 ++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/Files.App/Data/Models/AppModel.cs b/src/Files.App/Data/Models/AppModel.cs
index 7a9e7448a9f8..52c3c1b11dc2 100644
--- a/src/Files.App/Data/Models/AppModel.cs
+++ b/src/Files.App/Data/Models/AppModel.cs
@@ -101,5 +101,15 @@ public string GoogleDrivePath
get => googleDrivePath;
set => SetProperty(ref googleDrivePath, value);
}
+
+ private string pCloudDrivePath = string.Empty;
+ ///
+ /// Gets or sets a value indicating the path for pCloud Drive.
+ ///
+ public string PCloudDrivePath
+ {
+ get => pCloudDrivePath;
+ set => SetProperty(ref pCloudDrivePath, value);
+ }
}
}
diff --git a/src/Files.App/Services/RemovableDrivesService.cs b/src/Files.App/Services/RemovableDrivesService.cs
index 06748cd2c51f..d603f5e254d2 100644
--- a/src/Files.App/Services/RemovableDrivesService.cs
+++ b/src/Files.App/Services/RemovableDrivesService.cs
@@ -20,6 +20,7 @@ public async IAsyncEnumerable GetDrivesAsync()
{
var list = DriveInfo.GetDrives();
var googleDrivePath = App.AppModel.GoogleDrivePath;
+ var pCloudDrivePath = App.AppModel.PCloudDrivePath;
foreach (var drive in list)
{
@@ -43,7 +44,7 @@ public async IAsyncEnumerable GetDrivesAsync()
var driveItem = await DriveItem.CreateFromPropertiesAsync(res.Result, drive.Name.TrimEnd('\\'), label, type, thumbnail);
// Don't add here because Google Drive is already displayed under cloud drives
- if (drive.Name == googleDrivePath)
+ if (drive.Name == googleDrivePath || drive.Name == pCloudDrivePath)
continue;
App.Logger.LogInformation($"Drive added: {driveItem.Path}, {driveItem.Type}");
diff --git a/src/Files.App/Utils/Cloud/CloudDrivesDetector.cs b/src/Files.App/Utils/Cloud/CloudDrivesDetector.cs
index 7fdf9715c0dd..067977f5ac50 100644
--- a/src/Files.App/Utils/Cloud/CloudDrivesDetector.cs
+++ b/src/Files.App/Utils/Cloud/CloudDrivesDetector.cs
@@ -245,6 +245,8 @@ private static Task> DetectpCloudDrive()
string iconPath = Path.Combine(programFilesFolder, "pCloud Drive", "pCloud.exe");
var iconFile = Win32API.ExtractSelectedIconsFromDLL(iconPath, new List() { 32512 }, 32).FirstOrDefault();
+ App.AppModel.PCloudDrivePath = syncedFolder;
+
results.Add(new CloudProvider(CloudProviders.pCloud)
{
Name = $"pCloud Drive",