Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 8 additions & 3 deletions Core/HistoryTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ public class HistoryTracker : IHistoryTracker
private readonly System.Timers.Timer _saveTimer = new(2000) { AutoReset = false };
private bool _dirty;

public HistoryTracker()
public HistoryTracker() : this(AppPaths.AppFolder, true)
{
}

internal HistoryTracker(string folderPath, bool autoSave = false)
{
_filePath = Path.Combine(folderPath, "history.json");
_saveTimer.Elapsed += (_, _) => FlushSave();
Load();
if (autoSave && _history.Count == 0)
Save();
}

public IReadOnlyDictionary<string, HistoryEntry> History => _history;
Expand All @@ -33,7 +40,6 @@ public void Load()
if (!File.Exists(_filePath))
{
_history = new();
Save();
return;
}

Expand All @@ -44,7 +50,6 @@ public void Load()
{
System.Diagnostics.Debug.WriteLine($"HistoryTracker.Load failed: {ex.Message}");
_history = new();
Save();
}
finally
{
Expand Down
3 changes: 2 additions & 1 deletion HistoryTrackerTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using SmartFocus.Core;
using SmartFocus.Core.Interfaces;
using SmartFocus.Models;
using System.IO;

namespace SmartFocus.Tests;

public class HistoryTrackerTests
{
private readonly IHistoryTracker _tracker = new HistoryTracker();
private readonly IHistoryTracker _tracker = new HistoryTracker(Path.GetTempPath());

[Fact]
public void RegisterUse_IncrementsFrequency()
Expand Down
129 changes: 0 additions & 129 deletions RELEASE.md

This file was deleted.

Loading