scratch-link/scratch-link-mac/MacSessionManager.cs
Christopher Willis-Ford 72a0308e9c Mac: fix symbols being optimized out
Using "SdkOnly" instead of "Full" doesn't increase the app size by even
1MB, and it no longer leads to seemingly random crashes due to some part
of the code being optimized out.
2023-01-13 08:21:37 -08:00

29 lines
856 B
C#

// <copyright file="MacSessionManager.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink.Mac;
using Fleck;
using ScratchLink.Mac.BLE;
using ScratchLink.Mac.BT;
/// <summary>
/// Implements the Mac-specific functionality of the SessionManager.
/// </summary>
internal class MacSessionManager : SessionManager
{
/// <inheritdoc/>
protected override Session MakeNewSession(IWebSocketConnection webSocket)
{
var requestPath = webSocket.ConnectionInfo.Path;
return requestPath switch
{
"/scratch/ble" => new MacBLESession(webSocket),
"/scratch/bt" => new MacBTSession(webSocket),
// for unrecognized paths, return a base Session for debugging
_ => new Session(webSocket),
};
}
}