| 1 | import AppKit |
| 2 | import CallsKit |
| 3 | import SwiftUI |
| 4 | |
| 5 | /// Offline visual fixtures of the mini window: at its smallest, default |
| 6 | /// and a larger size, with and without the hover controls, and collapsed |
| 7 | /// to a tab, muted and not. There is no call behind them, so the stage is |
| 8 | /// your own (absent) camera and the tab says "Just you". |
| 9 | @MainActor enum MiniWindowSnapshots { |
| 10 | static func save(to folder: URL) async throws { |
| 11 | for scheme in [ColorScheme.light, .dark] { |
| 12 | let suffix = LobbySnapshots.name(scheme) |
| 13 | for width in [MiniWindowRules.minimumWidth, MiniWindowRules.size.width, 480] { |
| 14 | let size = CGSize(width: width, height: width / MiniWindowRules.aspect) |
| 15 | for hovering in [false, true] { |
| 16 | let call = Call(playAudio: false) |
| 17 | try await LobbySnapshots.render( |
| 18 | MiniWindowSnapshot.window(call: call, hovering: hovering), scheme: scheme, size: size, |
| 19 | to: folder.appendingPathComponent( |
| 20 | "mini-\(Int(width))\(hovering ? "-hover" : "")-\(suffix).png")) |
| 21 | } |
| 22 | } |
| 23 | for muted in [false, true] { |
| 24 | let call = Call(playAudio: false) |
| 25 | if muted { call.mute() } |
| 26 | try await LobbySnapshots.render( |
| 27 | MiniWindowSnapshot.tab(call: call), scheme: scheme, size: MiniWindowTab.size, |
| 28 | to: folder.appendingPathComponent("tab\(muted ? "-muted" : "")-\(suffix).png")) |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |