mirror of
https://github.com/scratchfoundation/scratch-link.git
synced 2024-11-14 19:05:03 -05:00
72a0308e9c
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.
29 lines
856 B
C#
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),
|
|
};
|
|
}
|
|
}
|