Skip to content

Commit 4e946e0

Browse files
feat: add new icon management and add docs
1 parent d4f3288 commit 4e946e0

File tree

14 files changed

+59
-2
lines changed

14 files changed

+59
-2
lines changed

GitHub Notifications.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
311107F324AE81A900D7CE07 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 311107F224AE81A900D7CE07 /* assets */; };
1011
3145EAD524A93D940096F234 /* GitHubService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3145EAD424A93D940096F234 /* GitHubService.swift */; };
1112
3145EAD724A9C3660096F234 /* GeneralPreferenceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3145EAD624A9C3660096F234 /* GeneralPreferenceViewController.swift */; };
1213
3145EADB24AA0E730096F234 /* GeneralPreferenceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3145EADA24AA0E730096F234 /* GeneralPreferenceViewController.xib */; };
@@ -21,6 +22,8 @@
2122
/* End PBXBuildFile section */
2223

2324
/* Begin PBXFileReference section */
25+
311107F124ADCA1D00D7CE07 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
26+
311107F224AE81A900D7CE07 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = "<group>"; };
2427
3145EAD424A93D940096F234 /* GitHubService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubService.swift; sourceTree = "<group>"; };
2528
3145EAD624A9C3660096F234 /* GeneralPreferenceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralPreferenceViewController.swift; sourceTree = "<group>"; };
2629
3145EADA24AA0E730096F234 /* GeneralPreferenceViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GeneralPreferenceViewController.xib; sourceTree = "<group>"; };
@@ -51,6 +54,8 @@
5154
31EA4CB924A509F40044C1FF = {
5255
isa = PBXGroup;
5356
children = (
57+
311107F224AE81A900D7CE07 /* assets */,
58+
311107F124ADCA1D00D7CE07 /* README.md */,
5459
31EA4CC424A509F40044C1FF /* GitHub Notifications */,
5560
31EA4CC324A509F40044C1FF /* Products */,
5661
);
@@ -156,6 +161,7 @@
156161
isa = PBXResourcesBuildPhase;
157162
buildActionMask = 2147483647;
158163
files = (
164+
311107F324AE81A900D7CE07 /* assets in Resources */,
159165
3145EADB24AA0E730096F234 /* GeneralPreferenceViewController.xib in Resources */,
160166
31EA4CD024A509F40044C1FF /* Main.storyboard in Resources */,
161167
31EA4CCD24A509F40044C1FF /* Preview Assets.xcassets in Resources */,

GitHub Notifications/AppDelegate.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
103103
}
104104

105105
self.firstMenuItem?.title = "\(notifications.count) notification\(notifications.count > 1 ? "s" : "")"
106+
107+
let doesNotificationExist = notifications.count >= 1
108+
109+
let itemImage = NSImage(named: doesNotificationExist ? "StatusItemImageNotification" : "StatusItemImage")
110+
itemImage?.isTemplate = false
111+
112+
DispatchQueue.main.async {
113+
self.statusItem.button?.image = itemImage
114+
}
106115

107116
} catch {
108117
print("error trying to convert data to JSON")

GitHub Notifications/Assets.xcassets/StatusItemImage.imageset/Contents.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"images" : [
33
{
4-
"filename" : "GitHub-Mark-Light-16px.png",
4+
"filename" : "StatusItemImage_1.png",
55
"idiom" : "universal",
66
"scale" : "1x"
77
},
88
{
9-
"filename" : "GitHub-Mark-Light-32px.png",
9+
"filename" : "StatusItemImage_2.png",
1010
"idiom" : "universal",
1111
"scale" : "2x"
1212
},
1313
{
14+
"filename" : "StatusItemImage_3.png",
1415
"idiom" : "universal",
1516
"scale" : "3x"
1617
}
Binary file not shown.
Binary file not shown.
293 Bytes
Loading
423 Bytes
Loading
748 Bytes
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "StatusItemImageNotification_1.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "StatusItemImageNotification_2.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "StatusItemImageNotification_3.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
384 Bytes
Loading

0 commit comments

Comments
 (0)