Update
This commit is contained in:
parent
e973d850ed
commit
f9e74d2dfe
@ -1,4 +1,5 @@
|
|||||||
import AppKit
|
import AppKit
|
||||||
|
import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@main
|
@main
|
||||||
@ -6,11 +7,28 @@ struct FchatiApp: App {
|
|||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
MenuBarExtra("Fchati", systemImage: "message") {
|
MenuBarExtra("Fchati", systemImage: "message") {
|
||||||
RootView()
|
RootView()
|
||||||
|
.background(WindowConfigurator())
|
||||||
}
|
}
|
||||||
.menuBarExtraStyle(.window)
|
.menuBarExtraStyle(.window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevents the popover from closing when clicking outside.
|
||||||
|
private struct WindowConfigurator: NSViewRepresentable {
|
||||||
|
func makeNSView(context: Context) -> NSView {
|
||||||
|
let view = NSView()
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
guard let window = view.window else { return }
|
||||||
|
window.level = .floating
|
||||||
|
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||||
|
window.isMovableByWindowBackground = false
|
||||||
|
}
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateNSView(_ nsView: NSView, context: Context) {}
|
||||||
|
}
|
||||||
|
|
||||||
enum AppTab: String, CaseIterable, Identifiable {
|
enum AppTab: String, CaseIterable, Identifiable {
|
||||||
case chat = "Chat"
|
case chat = "Chat"
|
||||||
case pairing = "Pairing"
|
case pairing = "Pairing"
|
||||||
|
|||||||
@ -209,6 +209,7 @@ final class AppSession: ObservableObject {
|
|||||||
KeychainStore.peerID = peerID
|
KeychainStore.peerID = peerID
|
||||||
KeychainStore.peerName = peerName
|
KeychainStore.peerName = peerName
|
||||||
state = .connected(peerID: peerID, peerName: peerName)
|
state = .connected(peerID: peerID, peerName: peerName)
|
||||||
|
NotificationManager.shared.notify(from: "Fchati", body: "\(peerName) connected")
|
||||||
}
|
}
|
||||||
|
|
||||||
case "read":
|
case "read":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user