forked from Manuel/meeting-assistant
- Introduced MacOsDesktopControlManifest to manage desktop control configurations. - Implemented MacOsDesktopControlService to handle the lifecycle of the macOS helper process. - Created MacOsWorkflowRulesEditorWindowService for managing workflow rules through a native window. - Developed a Swift helper for macOS that integrates with AppKit and Carbon for menu-bar controls and global hotkeys. - Added support for recording lifecycle actions via HTTP endpoints, maintaining consistency with existing Windows functionality. - Enhanced user experience by allowing macOS users to start/stop recordings and access settings through a menu-bar interface. - Documented design decisions, implementation evidence, and verification tasks for the new macOS features.
90 lines
3.0 KiB
C#
90 lines
3.0 KiB
C#
using MeetingAssistant.LaunchProfiles;
|
|
using MeetingAssistant.MacOs;
|
|
using MeetingAssistant.Workflow;
|
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace MeetingAssistant.Tests;
|
|
|
|
public sealed class MacOsDesktopControlManifestTests
|
|
{
|
|
[Fact]
|
|
public void MacOsApplicationRegistersARealInteractiveAgentWindow()
|
|
{
|
|
if (!OperatingSystem.IsMacOS())
|
|
{
|
|
return;
|
|
}
|
|
|
|
using var factory = new WebApplicationFactory<Program>();
|
|
|
|
var service = factory.Services.GetRequiredService<IWorkflowRulesEditorWindowService>();
|
|
|
|
Assert.IsType<MacOsWorkflowRulesEditorWindowService>(service);
|
|
}
|
|
|
|
[Fact]
|
|
public void ManifestPreservesConfiguredWindowsEquivalentShortcutsAndControlEndpoints()
|
|
{
|
|
var profiles = new[]
|
|
{
|
|
Profile("default", "Ctrl+Alt+M", "Ctrl+Alt+Z", "Ctrl+Alt+S"),
|
|
Profile("english", "Ctrl+Alt+L", "", "")
|
|
};
|
|
|
|
var hotkeys = new[]
|
|
{
|
|
new LaunchProfileHotkey("default", "Ctrl+Alt+M", LaunchProfileHotkeyAction.ToggleRecording),
|
|
new LaunchProfileHotkey("default", "Ctrl+Alt+Z", LaunchProfileHotkeyAction.AbortRecording),
|
|
new LaunchProfileHotkey("default", "Ctrl+Alt+S", LaunchProfileHotkeyAction.CaptureScreenshot),
|
|
new LaunchProfileHotkey("english", "Ctrl+Alt+L", LaunchProfileHotkeyAction.ToggleRecording)
|
|
};
|
|
|
|
var manifest = MacOsDesktopControlManifest.Create(
|
|
"http://127.0.0.1:5090",
|
|
profiles,
|
|
hotkeys);
|
|
|
|
Assert.Collection(
|
|
manifest.Hotkeys,
|
|
hotkey =>
|
|
{
|
|
Assert.Equal("Ctrl+Alt+M", hotkey.Shortcut);
|
|
Assert.Equal("/profiles/default/recording/toggle", hotkey.Endpoint);
|
|
},
|
|
hotkey =>
|
|
{
|
|
Assert.Equal("Ctrl+Alt+Z", hotkey.Shortcut);
|
|
Assert.Equal("/profiles/default/recording/abort", hotkey.Endpoint);
|
|
},
|
|
hotkey =>
|
|
{
|
|
Assert.Equal("Ctrl+Alt+S", hotkey.Shortcut);
|
|
Assert.Equal("/profiles/default/meetings/screenshot/capture", hotkey.Endpoint);
|
|
},
|
|
hotkey =>
|
|
{
|
|
Assert.Equal("Ctrl+Alt+L", hotkey.Shortcut);
|
|
Assert.Equal("/profiles/english/recording/toggle", hotkey.Endpoint);
|
|
});
|
|
Assert.Equal("http://127.0.0.1:5090/recording/status", manifest.StatusUrl);
|
|
Assert.Equal("http://127.0.0.1:5090/diagnostics/settings-and-logs", manifest.OpenAgentUrl);
|
|
}
|
|
|
|
private static LaunchProfile Profile(string name, string toggle, string abort, string screenshot)
|
|
{
|
|
return new LaunchProfile(name, new MeetingAssistantOptions
|
|
{
|
|
Hotkey = new HotkeyOptions
|
|
{
|
|
Toggle = toggle,
|
|
Abort = abort
|
|
},
|
|
Screenshots = new ScreenshotOptions
|
|
{
|
|
Hotkey = screenshot
|
|
}
|
|
});
|
|
}
|
|
}
|