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 issue where the adaptive layout toggle was always disabled #12049

Merged
merged 1 commit into from
Apr 14, 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
14 changes: 4 additions & 10 deletions src/Files.App/Contexts/DisplayPage/DisplayPageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ internal class DisplayPageContext : ObservableObject, IDisplayPageContext
private readonly IPageContext context = Ioc.Default.GetRequiredService<IPageContext>();
private readonly IFoldersSettingsService settings = Ioc.Default.GetRequiredService<IFoldersSettingsService>();

private bool isLayoutAdaptiveEnabled = false;
public bool IsLayoutAdaptiveEnabled
{
get => isLayoutAdaptiveEnabled;
set => settings.SyncFolderPreferencesAcrossDirectories = value;
}
public bool IsLayoutAdaptiveEnabled => !settings.SyncFolderPreferencesAcrossDirectories;

private LayoutTypes layoutType = LayoutTypes.None;
public LayoutTypes LayoutType
Expand Down Expand Up @@ -182,9 +177,8 @@ private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e
{
if (e.PropertyName is nameof(IFoldersSettingsService.SyncFolderPreferencesAcrossDirectories))
{
bool isEnabled = settings.SyncFolderPreferencesAcrossDirectories;
if (SetProperty(ref isLayoutAdaptiveEnabled, isEnabled, nameof(IsLayoutAdaptiveEnabled)))
SetProperty(ref layoutType, GetLayoutType(), nameof(LayoutType));
OnPropertyChanged(nameof(IsLayoutAdaptiveEnabled));
SetProperty(ref layoutType, GetLayoutType(), nameof(LayoutType));
}
}

Expand Down Expand Up @@ -216,7 +210,7 @@ private LayoutTypes GetLayoutType()
if (viewModel is null)
return LayoutTypes.None;

bool isAdaptive = isLayoutAdaptiveEnabled && viewModel.IsAdaptiveLayoutEnabled && !viewModel.IsLayoutModeFixed;
bool isAdaptive = IsLayoutAdaptiveEnabled && viewModel.IsAdaptiveLayoutEnabled && !viewModel.IsLayoutModeFixed;
if (isAdaptive)
return LayoutTypes.Adaptive;

Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Contexts/DisplayPage/IDisplayPageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Files.App.Contexts
{
public interface IDisplayPageContext : INotifyPropertyChanging, INotifyPropertyChanged
{
bool IsLayoutAdaptiveEnabled { get; set; }
bool IsLayoutAdaptiveEnabled { get; }
LayoutTypes LayoutType { get; set; }

SortOption SortOption { get; set; }
Expand Down