Skip to content

Commit

Permalink
Fix: Fixed issue were clicking tags in columns layout would crash app (
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrariofilippo authored Mar 16, 2023
1 parent ad9cf73 commit 9c70d8d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/Files.App/Views/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,20 @@ public void SubmitSearch(string query, bool searchUnindexedItems)
FilesystemViewModel.CancelSearch();
InstanceViewModel.CurrentSearchQuery = query;
InstanceViewModel.SearchedUnindexedItems = searchUnindexedItems;
ItemDisplay.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), new NavigationArguments()

var args = new NavigationArguments()
{
AssociatedTabInstance = this,
IsSearchResultPage = true,
SearchPathParam = FilesystemViewModel.WorkingDirectory,
SearchQuery = query,
SearchUnindexedItems = searchUnindexedItems,
});
};

if (this is ColumnShellPage)
NavigateToPath(FilesystemViewModel.WorkingDirectory, typeof(DetailsLayoutBrowser), args);
else
ItemDisplay.Navigate(InstanceViewModel.FolderSettings.GetLayoutType(FilesystemViewModel.WorkingDirectory), args);
}

public void NavigateWithArguments(Type sourcePageType, NavigationArguments navArgs)
Expand All @@ -479,7 +485,10 @@ public void NavigateWithArguments(Type sourcePageType, NavigationArguments navAr

public void NavigateToPath(string navigationPath, NavigationArguments? navArgs = null)
{
NavigateToPath(navigationPath, FolderSettings.GetLayoutType(navigationPath), navArgs);
var layout = navigationPath.StartsWith("tag:")
? typeof(DetailsLayoutBrowser)
: FolderSettings.GetLayoutType(navigationPath);
NavigateToPath(navigationPath, layout, navArgs);
}

public Task TabItemDragOver(object sender, DragEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Views/ColumnShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public override void Forward_Click()

public override void Up_Click()
{
this.FindAscendant<ColumnViewBrowser>().NavigateUp();
this.FindAscendant<ColumnViewBrowser>()?.NavigateUp();
}

public override void NavigateToPath(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null)
Expand Down
8 changes: 7 additions & 1 deletion src/Files.App/Views/LayoutModes/ColumnViewBrowser.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,13 @@ public void MoveFocusToNextBlade(int currentBladeIndex)

public void SetSelectedPathOrNavigate(string navigationPath, Type sourcePageType, NavigationArguments navArgs = null)
{
var destPath = navArgs is not null ? (navArgs.IsSearchResultPage ? navArgs.SearchPathParam : navArgs.NavPathParam) : navigationPath;
if (navArgs is not null && navArgs.IsSearchResultPage)
{
ParentShellPageInstance?.NavigateToPath(navArgs.SearchPathParam, typeof(DetailsLayoutBrowser), navArgs);
return;
}

var destPath = navArgs is not null ? navArgs.NavPathParam : navigationPath;
var columnPath = ((ColumnHost.ActiveBlades.Last().Content as Frame)?.Content as ColumnShellPage)?.FilesystemViewModel.WorkingDirectory;
var columnFirstPath = ((ColumnHost.ActiveBlades.First().Content as Frame)?.Content as ColumnShellPage)?.FilesystemViewModel.WorkingDirectory;

Expand Down

0 comments on commit 9c70d8d

Please sign in to comment.