Skip to content

Commit c95be34

Browse files
committed
Fixes
1 parent 54b3fb8 commit c95be34

3 files changed

Lines changed: 25 additions & 18 deletions

File tree

‎src/Shiny.AppDeviceBridge.Client/EventStreamContracts.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ public sealed record EventStreamTopics(IReadOnlyList<string> Topics);
3535

3636
/// <summary>Sent as <see cref="EventStreamProtocol.ErrorEvent"/> when the source behind a topic fails; the topic is dropped.</summary>
3737
/// <param name="Event">The topic whose source failed.</param>
38+
/// <param name="Message">What went wrong, for people.</param>
3839
public sealed record EventStreamError(string Event, string Message);

‎src/Shiny.AppDeviceBridge.Wifi/Shiny.AppDeviceBridge.Wifi.csproj‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<!-- Cleared: src/Directory.Build.props sets the single target. -->
55
<TargetFramework></TargetFramework>
66

7-
<!-- AddWifi has one signature on every target, but Android's manager needs Shiny's host, and UseShiny only
8-
exists in Shiny.Hosting.Maui's platform builds. The net10.0 build serves the maui-labs heads: macOS
9-
resolves Shiny.Net.Wifi's own macOS build at runtime, Linux gets the NetworkManager implementation. -->
10-
<TargetFrameworks>net10.0;net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
7+
<!-- Shiny.Net.Wifi declares AddWifi on its platform targets only, so the maui-labs macOS head gets a build of
8+
its own. Android's manager needs Shiny's host, and UseShiny only exists in Shiny.Hosting.Maui's platform
9+
builds; macOS has none of those and registers Shiny's core services directly. The net10.0 build serves the
10+
Linux (GTK4) head with the NetworkManager implementation, and registers nothing anywhere else. -->
11+
<TargetFrameworks>net10.0;net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-macos</TargetFrameworks>
1112
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
1213

1314
<UseMaui>true</UseMaui>
@@ -18,6 +19,7 @@
1819
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-android'))">21.0</SupportedOSPlatformVersion>
1920
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-ios'))">15.0</SupportedOSPlatformVersion>
2021
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-maccatalyst'))">15.0</SupportedOSPlatformVersion>
22+
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-macos'))">14.0</SupportedOSPlatformVersion>
2123
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
2224
</PropertyGroup>
2325

@@ -36,11 +38,16 @@
3638
<DefineConstants>$(DefineConstants);WIFI_LINUX</DefineConstants>
3739
</PropertyGroup>
3840

39-
<ItemGroup Condition="'$(TargetFramework)' != 'net10.0'">
41+
<ItemGroup Condition="'$(TargetFramework)' != 'net10.0' AND !$(TargetFramework.Contains('-macos'))">
4042
<PackageReference Include="Shiny.Hosting.Maui" />
4143
<Compile Include="../Shared/ShinyMauiHosting.cs" Link="ShinyMauiHosting.cs" />
4244
</ItemGroup>
4345

46+
<!-- No Shiny.Hosting.Maui build exists for macOS, so its core services are registered directly. -->
47+
<ItemGroup Condition="$(TargetFramework.Contains('-macos'))">
48+
<Compile Include="../Shared/ShinyCoreHosting.cs" Link="ShinyCoreHosting.cs" />
49+
</ItemGroup>
50+
4451
<ItemGroup>
4552
<ProjectReference Include="../Shiny.AppDeviceBridge/Shiny.AppDeviceBridge.csproj" />
4653
<ProjectReference Include="../Shiny.AppDeviceBridge.Wifi.Client/Shiny.AppDeviceBridge.Wifi.Client.csproj" />

‎src/Shiny.AppDeviceBridge.Wifi/WifiBridge.cs‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,27 @@ public static MauiAppBuilder AddWifiBridge(this MauiAppBuilder builder, bool hot
2525
{
2626
ArgumentNullException.ThrowIfNull(builder);
2727

28-
#if ANDROID || IOS || MACCATALYST || WINDOWS
28+
#if ANDROID || IOS || MACCATALYST || WINDOWS || MACOS
29+
#if MACOS
30+
builder.Services.EnsureShinyCore();
31+
#else
2932
builder.EnsureShiny();
3033
#endif
34+
builder.Services.AddWifi();
3135

32-
// Called as static methods: the net10.0 build references both Shiny.Net.Wifi and Shiny.Net.Wifi.Linux,
33-
// which each define AddWifi, so extension syntax would be ambiguous there.
34-
#if WIFI_LINUX
36+
if (hotspot)
37+
builder.Services.AddWifiHotspot();
38+
#elif WIFI_LINUX
39+
// Shiny.Net.Wifi has no implementation of its own for plain .NET: NetworkManager on Linux, and the bridge
40+
// answers 501 anywhere else.
3541
if (OperatingSystem.IsLinux())
3642
{
37-
global::Shiny.LinuxWifiServiceCollectionExtensions.AddWifi(builder.Services);
43+
builder.Services.AddWifi();
3844

3945
if (hotspot)
40-
global::Shiny.LinuxWifiServiceCollectionExtensions.AddWifiHotspot(builder.Services);
46+
builder.Services.AddWifiHotspot();
4147
}
42-
else
4348
#endif
44-
{
45-
global::Shiny.WifiServiceCollectionExtensions.AddWifi(builder.Services);
46-
47-
if (hotspot)
48-
global::Shiny.WifiServiceCollectionExtensions.AddWifiHotspot(builder.Services);
49-
}
5049

5150
builder.Services.AddWebAppBridge<WifiBridge>();
5251
return builder;

0 commit comments

Comments
 (0)