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

Fix: Fixed regressions caused by "Always apply most current layout" #11965

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Files.App/ViewModels/FolderSettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 6 additions & 4 deletions src/Files.App/Views/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,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);
Expand All @@ -518,9 +519,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);
Expand Down