mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-14 14:40:20 +03:00
34 lines
791 B
Swift
34 lines
791 B
Swift
// Copyright © 2021 Encrypted Ink. All rights reserved.
|
|
|
|
import Cocoa
|
|
|
|
class Agent {
|
|
|
|
private var connectivity: NearbyConnectivity!
|
|
|
|
func start() {
|
|
connectivity = NearbyConnectivity(delegate: self)
|
|
}
|
|
|
|
}
|
|
|
|
func showScreen() { // TODO: make private
|
|
NSApplication.shared.windows.forEach { $0.close() }
|
|
let storyboard = NSStoryboard(name: "Main", bundle: nil)
|
|
let windowController = storyboard.instantiateInitialController() as? NSWindowController
|
|
windowController?.showWindow(nil)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
windowController?.window?.makeKeyAndOrderFront(nil)
|
|
}
|
|
|
|
extension Agent: NearbyConnectivityDelegate {
|
|
|
|
func didFind(link: String) {
|
|
globalLink = link
|
|
showScreen()
|
|
}
|
|
|
|
}
|
|
|
|
var globalLink = ""
|