Skip to content

Commit

Permalink
Fix: Don't calculate hashes
Browse files Browse the repository at this point in the history
Update HashesViewModel.cs
  • Loading branch information
yaira2 committed Nov 7, 2023
1 parent 278bff9 commit 2112946
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,9 @@
<data name="CalculationError" xml:space="preserve">
<value>An error occurred during the calculation</value>
</data>
<data name="CalculationOnlineFileHashError" xml:space="preserve">
<value>Can't calculate hash for online file</value>
</data>
<data name="Algorithm" xml:space="preserve">
<value>Algorithm</value>
</data>
Expand Down
19 changes: 7 additions & 12 deletions src/Files.App/ViewModels/Properties/HashesViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.WinUI;
using Files.App.Extensions;
using Files.App.Utils;
using Files.Shared.Extensions;
using Files.Shared.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Input;

namespace Files.App.ViewModels.Properties
Expand Down Expand Up @@ -80,6 +68,13 @@ private void ToggleIsEnabled(string? algorithm)
UserSettingsService.GeneralSettingsService.ShowHashesDictionary = ShowHashes;
}

// Don't calculate hashes for online files
if (_item.SyncStatusUI.SyncStatus == CloudDriveSyncStatus.FileOnline)
{
hashInfoItem.HashValue = "CalculationOnlineFileHashError".GetLocalizedResource();
return;
}

if (hashInfoItem.HashValue is null && hashInfoItem.IsEnabled)
{
hashInfoItem.IsCalculating = true;
Expand Down

0 comments on commit 2112946

Please sign in to comment.