Skip to content

Commit cfb8772

Browse files
committed
Init
0 parents  commit cfb8772

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3079
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Space HUD.xcodeproj/project.pbxproj

Lines changed: 522 additions & 0 deletions
Large diffs are not rendered by default.

Space HUD.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Space HUD.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>Space HUD.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

Space HUD/AppDelegate.swift

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//
2+
// AppDelegate.swift
3+
// Space HUD
4+
//
5+
// Created by Pavel Makhov on 2022-11-18.
6+
//
7+
8+
import Cocoa
9+
import SwiftUI
10+
11+
@main
12+
class AppDelegate: NSObject, NSApplicationDelegate {
13+
14+
var popover: NSPopover!
15+
var statusBarItem: NSStatusItem!
16+
@ObservedObject var model = Model()
17+
let client = SpaceClient()
18+
var contentView: ContentView?
19+
20+
func applicationDidFinishLaunching(_ aNotification: Notification) {
21+
22+
contentView = ContentView(model: self.model)
23+
24+
let popover = NSPopover()
25+
popover.contentSize = NSSize(width: 600, height: 400)
26+
popover.behavior = .transient
27+
popover.contentViewController = NSHostingController(rootView: contentView)
28+
self.popover = popover
29+
30+
self.statusBarItem = NSStatusBar.system.statusItem(withLength: CGFloat(NSStatusItem.variableLength))
31+
32+
if let button = self.statusBarItem.button {
33+
let logo = NSImage(named: "space-logo")
34+
logo?.size = NSSize(width: 18, height: 18)
35+
button.image = NSImage(named: "space-logo")
36+
button.action = #selector(togglePopover(_:))
37+
}
38+
39+
client.getIssueStatuses{ resp in
40+
Constants.issueStatuses = resp
41+
}
42+
43+
44+
NSApp.setActivationPolicy(.accessory)
45+
}
46+
47+
@objc func togglePopover(_ sender: AnyObject?) {
48+
if let button = self.statusBarItem.button {
49+
if self.popover.isShown {
50+
self.popover.performClose(sender)
51+
} else {
52+
self.model.refresh();
53+
self.popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY)
54+
}
55+
}
56+
}
57+
58+
func applicationWillTerminate(_ aNotification: Notification) {
59+
// Insert code here to tear down your application
60+
}
61+
62+
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
63+
return true
64+
}
65+
66+
@objc
67+
func quit() {
68+
NSLog("User click Quit")
69+
NSApplication.shared.terminate(self)
70+
}
71+
72+
}
73+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "spacebar-16.png",
5+
"idiom" : "mac",
6+
"scale" : "1x",
7+
"size" : "16x16"
8+
},
9+
{
10+
"filename" : "spacebar-32.png",
11+
"idiom" : "mac",
12+
"scale" : "2x",
13+
"size" : "16x16"
14+
},
15+
{
16+
"filename" : "spacebar-33.png",
17+
"idiom" : "mac",
18+
"scale" : "1x",
19+
"size" : "32x32"
20+
},
21+
{
22+
"filename" : "spacebar-64.png",
23+
"idiom" : "mac",
24+
"scale" : "2x",
25+
"size" : "32x32"
26+
},
27+
{
28+
"filename" : "spacebar-128.png",
29+
"idiom" : "mac",
30+
"scale" : "1x",
31+
"size" : "128x128"
32+
},
33+
{
34+
"filename" : "spacebar-256.png",
35+
"idiom" : "mac",
36+
"scale" : "2x",
37+
"size" : "128x128"
38+
},
39+
{
40+
"filename" : "spacebar-257.png",
41+
"idiom" : "mac",
42+
"scale" : "1x",
43+
"size" : "256x256"
44+
},
45+
{
46+
"filename" : "spacebar-512.png",
47+
"idiom" : "mac",
48+
"scale" : "2x",
49+
"size" : "256x256"
50+
},
51+
{
52+
"filename" : "spacebar-513.png",
53+
"idiom" : "mac",
54+
"scale" : "1x",
55+
"size" : "512x512"
56+
},
57+
{
58+
"filename" : "spacebar-1024.png",
59+
"idiom" : "mac",
60+
"scale" : "2x",
61+
"size" : "512x512"
62+
}
63+
],
64+
"info" : {
65+
"author" : "xcode",
66+
"version" : 1
67+
}
68+
}

0 commit comments

Comments
 (0)