Skip to content

Commit b564a39

Browse files
committed
Use api functions instead of project reference for code quality
1 parent 168f898 commit b564a39

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.IO;
43
using System.Text.Json;
5-
using Flow.Launcher.Infrastructure.Logger;
64
using System;
5+
using Flow.Launcher.Infrastructure.Logger;
6+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
77
using Microsoft.Data.Sqlite;
88

99
namespace Flow.Launcher.Plugin.BrowserBookmark;
1010

1111
public abstract class ChromiumBookmarkLoader : IBookmarkLoader
1212
{
13+
private readonly static string ClassName = nameof(ChromiumBookmarkLoader);
14+
1315
private readonly string _faviconCacheDir;
1416

1517
protected ChromiumBookmarkLoader()
@@ -44,7 +46,7 @@ protected List<Bookmark> LoadBookmarks(string browserDataPath, string name)
4446
}
4547
catch (Exception ex)
4648
{
47-
Log.Exception($"Failed to register bookmark file monitoring: {bookmarkPath}", ex);
49+
Main._context.API.LogException(ClassName, $"Failed to register bookmark file monitoring: {bookmarkPath}", ex);
4850
}
4951

5052
var source = name + (Path.GetFileName(profile) == "Default" ? "" : $" ({Path.GetFileName(profile)})");
@@ -136,7 +138,7 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
136138
}
137139
catch (Exception ex)
138140
{
139-
Log.Exception($"Failed to copy favicon DB: {dbPath}", ex);
141+
Main._context.API.LogException(ClassName, $"Failed to copy favicon DB: {dbPath}", ex);
140142
return;
141143
}
142144

@@ -189,7 +191,7 @@ ORDER BY b.width DESC
189191
}
190192
catch (Exception ex)
191193
{
192-
Log.Exception($"Failed to extract bookmark favicon: {bookmark.Url}", ex);
194+
Main._context.API.LogException(ClassName, $"Failed to extract bookmark favicon: {bookmark.Url}", ex);
193195
}
194196
}
195197

@@ -199,7 +201,7 @@ ORDER BY b.width DESC
199201
}
200202
catch (Exception ex)
201203
{
202-
Log.Exception($"Failed to connect to SQLite: {tempDbPath}", ex);
204+
Main._context.API.LogException(ClassName, $"Failed to connect to SQLite: {tempDbPath}", ex);
203205
}
204206

205207
// Delete temporary file
@@ -209,12 +211,12 @@ ORDER BY b.width DESC
209211
}
210212
catch (Exception ex)
211213
{
212-
Log.Exception($"Failed to delete temporary favicon DB: {tempDbPath}", ex);
214+
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex);
213215
}
214216
}
215217
catch (Exception ex)
216218
{
217-
Log.Exception($"Failed to load favicon DB: {dbPath}", ex);
219+
Main._context.API.LogException(ClassName, $"Failed to load favicon DB: {dbPath}", ex);
218220
}
219221
}
220222

@@ -226,7 +228,7 @@ private static void SaveBitmapData(byte[] imageData, string outputPath)
226228
}
227229
catch (Exception ex)
228230
{
229-
Log.Exception($"Failed to save image: {outputPath}", ex);
231+
Main._context.API.LogException(ClassName, $"Failed to save image: {outputPath}", ex);
230232
}
231233
}
232234
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Library</OutputType>
@@ -81,6 +81,7 @@
8181
</ItemGroup>
8282

8383
<ItemGroup>
84+
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
8485
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
8586
</ItemGroup>
8687

0 commit comments

Comments
 (0)