Skip to content

Commit 4d37d41

Browse files
Jen-Unoclaude
andcommitted
refactor(fit-app): drop macOS Dock P/Invoke; address review comments
Samples must not use unmanaged code. Remove the AppKit P/Invoke Dock-icon path (MacOSDockIcon.cs, App.Desktop.cs, DockIcon.png + its wiring in App.xaml.cs and the csproj). The branded icon still ships via Uno.Resizetizer — the app icon on every platform, and the packaged macOS .app shows it in the Dock; the generic tile on an unbundled `dotnet run` is an accepted dev-only cosmetic limitation. Also dispose the previous PathGeometry before replacing it in WeeklyRing.UpdateArc (flagged by review). Addresses the github-code-quality review on #930. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2a643a4 commit 4d37d41

6 files changed

Lines changed: 5 additions & 141 deletions

File tree

studio/fit-app/FitBeginnerApp/App.xaml.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,8 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
8787
MainWindow.SetWindowIcon();
8888

8989
Host = await builder.NavigateAsync<Shell>();
90-
91-
// On the macOS desktop (Skia) head, brand the Dock during an unbundled dev run; the partial
92-
// method is implemented only in Platforms/Desktop and is elided (a no-op) on every other head.
93-
TrySetDesktopDockIcon();
9490
}
9591

96-
// Implemented in Platforms/Desktop/App.Desktop.cs; elided on the iOS / Android / WebAssembly heads.
97-
partial void TrySetDesktopDockIcon();
98-
9992
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
10093
{
10194
views.Register(

studio/fit-app/FitBeginnerApp/FitBeginnerApp.csproj

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,4 @@
6161
<Content Include="Assets/Fonts/Montserrat-Bold.ttf" />
6262
</ItemGroup>
6363

64-
<!--
65-
macOS Dock icon (Skia desktop head only): a pre-baked rounded "squircle" macOS-grid PNG, copied
66-
next to the executable so Platforms/Desktop/App.Desktop.cs can hand its path to
67-
NSApplication.applicationIconImage during a dev run. macOS does not mask applicationIconImage, so
68-
the rounded grid is baked in; it was rasterized from the app's Resizetizer icon assets. Other
69-
platforms/OSes never use it.
70-
-->
71-
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0-desktop'">
72-
<Content Include="Platforms/Desktop/DockIcon.png" Link="DockIcon.png" CopyToOutputDirectory="PreserveNewest" />
73-
</ItemGroup>
74-
7564
</Project>

studio/fit-app/FitBeginnerApp/Platforms/Desktop/App.Desktop.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.
-37.2 KB
Binary file not shown.

studio/fit-app/FitBeginnerApp/Platforms/Desktop/MacOSDockIcon.cs

Lines changed: 0 additions & 99 deletions
This file was deleted.

studio/fit-app/FitBeginnerApp/Presentation/WeeklyRing.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ private void UpdateArc()
134134
var fraction = Math.Clamp(Progress, 0, 1);
135135
if (fraction <= 0)
136136
{
137+
// Release the native geometry backing the old arc before detaching it.
138+
(ArcPath.Data as IDisposable)?.Dispose();
137139
ArcPath.Data = null;
138140
return;
139141
}
@@ -161,6 +163,9 @@ private void UpdateArc()
161163

162164
var geometry = new PathGeometry();
163165
geometry.Figures.Add(figure);
166+
// Dispose the geometry from the previous update before it is replaced (UpdateArc runs on
167+
// every progress tick during the entrance animation, so a fresh geometry is built each time).
168+
(ArcPath.Data as IDisposable)?.Dispose();
164169
ArcPath.Data = geometry;
165170
}
166171

0 commit comments

Comments
 (0)