Commit graph

95 commits

Author SHA1 Message Date
Christopher Willis-Ford
eed937fd18 fix: fix DisposedException by removing cancellation token
We really use the socket state to control the session, so there's no
need to also pass a CancellationToken around. The exception was being
caused when an unlucky callback happened after a session was disposed
and the callback tried to get a new token to check cancellation. If the
token source is already disposed, it can't provide a new token.

Also, remove some excessive logging and add more exception logging.
2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
5bae1ea319 fix(Mac): fix Safari, especially Link->Client notifications 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
71e7a13033 fix(Mac): correct target macOS version 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
d019142417 fix(Mac): show Safari extension menu only if supported 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
39cdf3cd50 fix(Mac): add real Bluetooth permissions request messages 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
58138c5c89 fix(Mac): hide Safari extensions for non-MAS builds
Non-MAS builds can still see the menu item by holding Option while
opening the menu.
2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
14f9f99b8c fix(Mac): Safari extension improvements
- Embed the extension into Scratch Link correctly
- Build the extension during the Scratch Link build (if necessary)
- Add a menu item in Scratch Link to show the Safari extension prefs
2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
9c6bb30273 fix(Mac): embed Safari helper extension into the Scratch Link app bundle 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
4c81a6d2c4 Mac: delete BluetoothReporter to fix notarization 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
f1503393ef Mac: output debug info on notarization failure 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
c2153c829e Mac: add 'cs.allow-jit' to entitlements 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
d042b56c13 ci(Mac): notarize the Developer ID build 2023-01-13 08:21:37 -08:00
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
Christopher Willis-Ford
63ca5c9c60 Mac: add signed build configs and build them on CI 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
953144379d Mac: misc reliability improvements
An `EventAwaiter` timeout now throws a `TimeoutException` instead of a
`TaskCanceledException`.

Disconnecting a micro:bit while subscribed for change notifications was
causing an exception because a notification was being triggered after
the socket closed. Fixing that led to an attempt to close the socket
after it was closed and set to `null`. That one was solved with a null
check.

For BT, connection is still not reliable but it's a step in the right
direction... I think. The socket lock is now held while opening the
RFCOMM channel, which is an awful long time to hold a lock, but really
no other thread should be messing with the socket during that time so I
guess it's the right thing to do. I also added debug printouts on the
RFCOMM event delegate.
2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
5132f28d78 Mac: force linker to preserve MacSessionManager ctor 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
322af62426 Mac: fix building Release, enable full linking 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
f9c9e0b0f4 Mac: implement version detail menu item 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
0e9c2b2ae9 Mac: implement quitting 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
5cfae5f4a5 Mac: add real icons 2023-01-13 08:21:37 -08:00
Christopher Willis-Ford
a882ff0cb6 Mac: remove unnecessary 'main' window
Also, enable `LSUIElement` in `Info.plist`
2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
15dc54897a Mac: use ActionAttribute to simplify selectors 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
672d716b9c Mac: set version to 2.0 in Info.plist 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
db051ddf65 Mac: add status bar item 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
eba7b98883 Mac BLE: reduce log SPAM 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
bddf0dc50f clean up JsonRpc2Exception a bit 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
7ec18de421 share BTSession's address privacy implementation with BLESession 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
0b0b8802a8 add an extension to lock a SemaphoreSlim with 'using' 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
3cd2113daf Mac BT: implement 'didReceiveMessage' 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
aa15fd0be2 Mac BT: implement send() 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
5312199e6b Mac BT: implement 'connect', remove 'ouiPrefix' 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
8fa4207a2b Mac BT: implement discovery tracking with device address privacy 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
8193d33f6d implement Mac BT discover 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
37f5cde173 implement enough BTSession to test Mac BT libs 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
ac5e4a4431 close BLE session if the device disconnects 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
930beaaea5 add event debug messages to cbManager 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
169b475f8b add Bluetooth items to Info.plist 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
172fc2c534 switch to Fleck for WebSockets 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
8be1d8b021 make ScratchLinkApp to take the place of MAUI app
Note that this builds and runs, but doesn't work: the Xamarin.Mac
implementation of `System.Net` always sets `IsWebSocketRequest` to
`false` and doesn't actually support WebSockets connections as a server.
2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
2c9e4c600a fixed usings and namespaces 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
59f00f9992 add frameworks for features lost in the move to Xamarin.Mac 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
2897e2d16f begin splitting scratch-link into scratch-link-{common,mac}
Note that this currently doesn't build since the files have not yet been
adapted to the new framework.
2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
e8ecc74cfe satisfy StyleCop 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
840d39b28a enable StyleCop in the new projects 2023-01-13 08:21:36 -08:00
Christopher Willis-Ford
a929cf2bbe add empty Xamarin projects for Mac & common code 2023-01-13 08:21:36 -08:00