Skip to content

Commit bd3d3f6

Browse files
committed
Merge branch 'release/v0.10.2'
2 parents c00323b + 070c440 commit bd3d3f6

Some content is hidden

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

57 files changed

+199
-131
lines changed

Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks-Debug-input-files.xcfilelist

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks-Debug-output-files.xcfilelist

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks-Release-input-files.xcfilelist

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks-Release-output-files.xcfilelist

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks.sh

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1030"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

uPic/AppDelegate.swift

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,31 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2929
let storyboard = NSStoryboard(name: "Preferences", bundle: nil)
3030
return storyboard.instantiateInitialController() as? PreferencesWindowController ?? PreferencesWindowController()
3131
}()
32+
33+
func applicationWillFinishLaunching(_ notification: Notification) {
34+
// 添加 url scheme 监听
35+
NSAppleEventManager.shared().setEventHandler(self, andSelector:#selector(handleGetURLEvent(event:withReplyEvent:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
36+
37+
}
3238

3339
func applicationDidFinishLaunching(_ aNotification: Notification) {
3440
// Insert code here to initialize your application
3541
ConfigManager.shared.firstSetup()
3642

3743
self.resetNewVersionLaunchAtLogin()
3844

39-
indicator.minValue = 0.0
40-
indicator.maxValue = 1.0
41-
indicator.doubleValue = 0.0
42-
indicator.isIndeterminate = false
43-
indicator.controlSize = NSControl.ControlSize.small
44-
indicator.style = NSProgressIndicator.Style.spinning
45-
indicator.isHidden = true
46-
4745
setupStatusBar()
4846

4947
// 添加 Finder 右键文件上传监听
5048
UploadNotifier.addObserver(observer: self, selector: #selector(uploadFilesFromFinderMenu), notification: .uploadFiles)
51-
52-
// DistributedNotificationCenter.default()
53-
// .addObserver(self, selector: #selector(uploadFilesFromFinderMenu), name: NSNotification.Name(rawValue: "uploadByFinder"), object: nil)
5449
}
5550

5651
func applicationWillTerminate(_ notification: Notification) {
5752
NSStatusBar.system.removeStatusItem(statusItem)
5853
// 移除 Finder 右键文件上传监听
5954
UploadNotifier.removeObserver(observer: self, notification: .uploadFiles)
6055
}
61-
56+
6257
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
6358
return true
6459
}
@@ -97,6 +92,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9792

9893
self.uploadFiles(urls)
9994
}
95+
96+
@objc func handleGetURLEvent(event: NSAppleEventDescriptor!, withReplyEvent: NSAppleEventDescriptor!) {
97+
if let urlString = event.paramDescriptor(forKeyword: AEKeyword(keyDirectObject))?.stringValue, let url = NSURL(string: urlString) {
98+
// 解析出参数
99+
var param = urlString
100+
let i = "\(url.scheme!)://".count
101+
param.removeFirst(i)
102+
103+
var fileUrl: URL?
104+
if param.isAbsolutePath {
105+
fileUrl = URL(fileURLWithPath: param)
106+
} else {
107+
fileUrl = URL(string: param.urlDecoded())
108+
}
109+
110+
if let fileUrl = fileUrl, let data = try? Data(contentsOf: fileUrl) {
111+
self.uploadFiles([data])
112+
}
113+
}
114+
}
100115

101116
}
102117

@@ -125,8 +140,15 @@ extension AppDelegate {
125140
}
126141

127142
statusItem.menu = statusItemMenu
128-
129-
143+
144+
// 初始化任务栏进度图标
145+
indicator.minValue = 0.0
146+
indicator.maxValue = 1.0
147+
indicator.doubleValue = 0.0
148+
indicator.isIndeterminate = false
149+
indicator.controlSize = NSControl.ControlSize.small
150+
indicator.style = NSProgressIndicator.Style.spinning
151+
indicator.isHidden = true
130152
}
131153

132154
func setStatusBarIcon(isIndicator: Bool = false) {
@@ -216,6 +238,12 @@ extension AppDelegate {
216238
if let jpg = imgData?.convertImageData(.jpeg) {
217239
self.uploadFiles([jpg])
218240
}
241+
} else {
242+
if let urlStr = NSPasteboard.general.string(forType: NSPasteboard.PasteboardType.string) {
243+
if let url = URL(string: urlStr.urlEncoded()), let data = try? Data(contentsOf: url) {
244+
self.uploadFiles([data])
245+
}
246+
}
219247
}
220248

221249
}
13.1 KB
669 Bytes
43.7 KB
1.51 KB
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
{
2-
"images": [
2+
"images" : [
33
{
4-
"size": "16x16",
5-
"idiom": "mac",
6-
"filename": "icon_16x16.png",
7-
"scale": "1x"
4+
"size" : "16x16",
5+
"idiom" : "mac",
6+
"filename" : "16.png",
7+
"scale" : "1x"
88
},
99
{
10-
"size": "16x16",
11-
"idiom": "mac",
12-
"filename": "icon_16x16@2x.png",
13-
"scale": "2x"
10+
"size" : "16x16",
11+
"idiom" : "mac",
12+
"filename" : "16@2x.png",
13+
"scale" : "2x"
1414
},
1515
{
16-
"size": "32x32",
17-
"idiom": "mac",
18-
"filename": "icon_32x32.png",
19-
"scale": "1x"
16+
"size" : "32x32",
17+
"idiom" : "mac",
18+
"filename" : "32.png",
19+
"scale" : "1x"
2020
},
2121
{
22-
"size": "32x32",
23-
"idiom": "mac",
24-
"filename": "icon_32x32@2x.png",
25-
"scale": "2x"
22+
"size" : "32x32",
23+
"idiom" : "mac",
24+
"filename" : "32@2x.png",
25+
"scale" : "2x"
2626
},
2727
{
28-
"size": "128x128",
29-
"idiom": "mac",
30-
"filename": "icon_128x128.png",
31-
"scale": "1x"
28+
"size" : "128x128",
29+
"idiom" : "mac",
30+
"filename" : "128.png",
31+
"scale" : "1x"
3232
},
3333
{
34-
"size": "128x128",
35-
"idiom": "mac",
36-
"filename": "icon_128x128@2x.png",
37-
"scale": "2x"
34+
"size" : "128x128",
35+
"idiom" : "mac",
36+
"filename" : "128@2x.png",
37+
"scale" : "2x"
3838
},
3939
{
40-
"size": "256x256",
41-
"idiom": "mac",
42-
"filename": "icon_256x256.png",
43-
"scale": "1x"
40+
"size" : "256x256",
41+
"idiom" : "mac",
42+
"filename" : "256.png",
43+
"scale" : "1x"
4444
},
4545
{
46-
"size": "256x256",
47-
"idiom": "mac",
48-
"filename": "icon_256x256@2x.png",
49-
"scale": "2x"
46+
"size" : "256x256",
47+
"idiom" : "mac",
48+
"filename" : "256@2x.png",
49+
"scale" : "2x"
5050
},
5151
{
52-
"size": "512x512",
53-
"idiom": "mac",
54-
"filename": "icon_512x512.png",
55-
"scale": "1x"
52+
"size" : "512x512",
53+
"idiom" : "mac",
54+
"filename" : "512.png",
55+
"scale" : "1x"
5656
},
5757
{
58-
"size": "512x512",
59-
"idiom": "mac",
60-
"filename": "icon_512x512@2x.png",
61-
"scale": "2x"
58+
"size" : "512x512",
59+
"idiom" : "mac",
60+
"filename" : "512@2x.png",
61+
"scale" : "2x"
6262
}
6363
],
64-
"info": {
65-
"version": 1,
66-
"author": "xcode"
64+
"info" : {
65+
"version" : 1,
66+
"author" : "xcode"
6767
}
6868
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"images": [
2+
"images" : [
33
{
4-
"idiom": "universal",
5-
"filename": "icon_128x128@2x.png",
6-
"scale": "1x"
4+
"idiom" : "universal",
5+
"filename" : "about.png",
6+
"scale" : "1x"
77
},
88
{
9-
"idiom": "universal",
10-
"scale": "2x"
9+
"idiom" : "universal",
10+
"scale" : "2x"
1111
},
1212
{
13-
"idiom": "universal",
14-
"scale": "3x"
13+
"idiom" : "universal",
14+
"scale" : "3x"
1515
}
1616
],
17-
"info": {
18-
"version": 1,
19-
"author": "xcode"
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
2020
}
2121
}
501 KB
Binary file not shown.

uPic/Assets.xcassets/statusIcon.imageset/Contents.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
},
77
{
88
"idiom" : "universal",
9-
"filename" : "icon_32x32.png",
9+
"filename" : "menubar.png",
1010
"scale" : "2x"
1111
},
1212
{
1313
"idiom" : "universal",
14+
"filename" : "menubar@2x.png",
1415
"scale" : "3x"
1516
}
1617
],
Binary file not shown.
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
{
2-
"images": [
2+
"images" : [
33
{
4-
"idiom": "universal",
5-
"filename": "icon_16x16.png",
6-
"scale": "1x"
4+
"idiom" : "universal",
5+
"scale" : "1x"
76
},
87
{
9-
"idiom": "universal",
10-
"filename": "icon_32x32.png",
11-
"scale": "2x"
8+
"idiom" : "universal",
9+
"filename" : "wait.png",
10+
"scale" : "2x"
1211
},
1312
{
14-
"idiom": "universal",
15-
"filename": "media-up.png",
16-
"scale": "3x"
13+
"idiom" : "universal",
14+
"filename" : "wait@2x.png",
15+
"scale" : "3x"
1716
}
1817
],
19-
"info": {
20-
"version": 1,
21-
"author": "xcode"
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
2221
},
23-
"properties": {
24-
"template-rendering-intent": "template"
22+
"properties" : {
23+
"template-rendering-intent" : "template"
2524
}
2625
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
635 Bytes

0 commit comments

Comments
 (0)