Skip to content

Commit

Permalink
Fix: Fixed issue where Git submenu was shown for non-GitHub repos (fi…
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu authored Apr 16, 2024
1 parent 93e5754 commit 8c96b8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Files.App/Data/Models/CurrentInstanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,23 @@ public bool CanTagFilesInPage
get => !isPageTypeRecycleBin && !isPageTypeFtp && !isPageTypeZipFolder;
}

public bool IsGitRepository => !string.IsNullOrWhiteSpace(gitRepositoryPath);
private bool isGitRepository;
public bool IsGitRepository
{
get => isGitRepository;
set
{
SetProperty(ref isGitRepository, value);
}
}

private string? gitRepositoryPath;
public string? GitRepositoryPath
{
get => gitRepositoryPath;
set
{
if (SetProperty(ref gitRepositoryPath, value))
OnPropertyChanged(nameof(IsGitRepository));
SetProperty(ref gitRepositoryPath, value);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
AppInstance.InstanceViewModel.IsPageTypeZipFolder = false;
AppInstance.InstanceViewModel.IsPageTypeLibrary = false;
AppInstance.InstanceViewModel.GitRepositoryPath = null;
AppInstance.InstanceViewModel.IsGitRepository = false;
AppInstance.ToolbarViewModel.CanRefresh = true;
AppInstance.ToolbarViewModel.CanGoBack = AppInstance.CanNavigateBackward;
AppInstance.ToolbarViewModel.CanGoForward = AppInstance.CanNavigateForward;
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/Shells/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ protected async void FilesystemViewModel_DirectoryInfoUpdated(object sender, Eve
if (InstanceViewModel.GitRepositoryPath != FilesystemViewModel.GitDirectory)
{
InstanceViewModel.GitRepositoryPath = FilesystemViewModel.GitDirectory;
InstanceViewModel.IsGitRepository = FilesystemViewModel.IsValidGitDirectory;

InstanceViewModel.GitBranchName = headBranch is not null
? headBranch.Name
Expand Down

0 comments on commit 8c96b8f

Please sign in to comment.