From 22c88c8308c4a98953c4064a67d7f78c5b33ab56 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 4 Apr 2023 20:24:52 -0400 Subject: [PATCH] Servicing: v2.4.61 (#11972) --- src/Files.App/Helpers/QuickLookHelpers.cs | 8 +++++--- src/Files.App/ViewModels/FolderSettingsViewModel.cs | 9 ++++++--- src/Files.App/Views/BaseShellPage.cs | 10 ++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Files.App/Helpers/QuickLookHelpers.cs b/src/Files.App/Helpers/QuickLookHelpers.cs index d87ac4c471c1..0f0d6609f72d 100644 --- a/src/Files.App/Helpers/QuickLookHelpers.cs +++ b/src/Files.App/Helpers/QuickLookHelpers.cs @@ -18,9 +18,11 @@ public static async Task ToggleQuickLook(string path, bool switchPreview = false { bool isQuickLookAvailable = await DetectQuickLookAvailability(); - if (isQuickLookAvailable == false) + if (!isQuickLookAvailable) { - App.Logger.LogInformation("QuickLook not detected"); + if (!switchPreview) + App.Logger.LogInformation("QuickLook not detected"); + return; } @@ -76,4 +78,4 @@ static async Task QuickLookServerAvailable() return false; } } -} +} \ No newline at end of file diff --git a/src/Files.App/ViewModels/FolderSettingsViewModel.cs b/src/Files.App/ViewModels/FolderSettingsViewModel.cs index 9f11e87157db..f48127e9e3b5 100644 --- a/src/Files.App/ViewModels/FolderSettingsViewModel.cs +++ b/src/Files.App/ViewModels/FolderSettingsViewModel.cs @@ -94,11 +94,14 @@ public bool IsLayoutModeChanging set => SetProperty(ref isLayoutModeChanging, value); } - public Type GetLayoutType(string folderPath) + public Type GetLayoutType(string folderPath, bool changeLayoutMode = true) { var prefsForPath = GetLayoutPreferencesForPath(folderPath); - IsLayoutModeChanging = LayoutPreference.LayoutMode != prefsForPath.LayoutMode; - LayoutPreference = prefsForPath; + if (changeLayoutMode) + { + IsLayoutModeChanging = LayoutPreference.LayoutMode != prefsForPath.LayoutMode; + LayoutPreference = prefsForPath; + } return (prefsForPath.LayoutMode) switch { diff --git a/src/Files.App/Views/BaseShellPage.cs b/src/Files.App/Views/BaseShellPage.cs index 12de35e8f7ef..22947fc71c33 100644 --- a/src/Files.App/Views/BaseShellPage.cs +++ b/src/Files.App/Views/BaseShellPage.cs @@ -486,9 +486,10 @@ public void ResetNavigationStackLayoutMode() { foreach (PageStackEntry entry in ItemDisplay.BackStack.ToList()) { - if (entry.Parameter is NavigationArguments args) + if (entry.Parameter is NavigationArguments args && + args.NavPathParam is not null and not "Home") { - var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam); + var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam, false); if (!entry.SourcePageType.Equals(correctPageType)) { int index = ItemDisplay.BackStack.IndexOf(entry); @@ -501,9 +502,10 @@ public void ResetNavigationStackLayoutMode() foreach (PageStackEntry entry in ItemDisplay.ForwardStack.ToList()) { - if (entry.Parameter is NavigationArguments args) + if (entry.Parameter is NavigationArguments args && + args.NavPathParam is not null and not "Home") { - var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam); + var correctPageType = FolderSettings.GetLayoutType(args.NavPathParam, false); if (!entry.SourcePageType.Equals(correctPageType)) { int index = ItemDisplay.ForwardStack.IndexOf(entry);