Skip to content

Commit

Permalink
Merge branch 'release/v0.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gee1k committed Aug 10, 2019
2 parents c00323b + 070c440 commit bd3d3f6
Show file tree
Hide file tree
Showing 57 changed files with 199 additions and 131 deletions.
8 changes: 5 additions & 3 deletions Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Pods/Target Support Files/Pods-uPic/Pods-uPic-frameworks.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
56 changes: 42 additions & 14 deletions uPic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,31 @@ class AppDelegate: NSObject, NSApplicationDelegate {
let storyboard = NSStoryboard(name: "Preferences", bundle: nil)
return storyboard.instantiateInitialController() as? PreferencesWindowController ?? PreferencesWindowController()
}()

func applicationWillFinishLaunching(_ notification: Notification) {
// 添加 url scheme 监听
NSAppleEventManager.shared().setEventHandler(self, andSelector:#selector(handleGetURLEvent(event:withReplyEvent:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))

}

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

self.resetNewVersionLaunchAtLogin()

indicator.minValue = 0.0
indicator.maxValue = 1.0
indicator.doubleValue = 0.0
indicator.isIndeterminate = false
indicator.controlSize = NSControl.ControlSize.small
indicator.style = NSProgressIndicator.Style.spinning
indicator.isHidden = true

setupStatusBar()

// 添加 Finder 右键文件上传监听
UploadNotifier.addObserver(observer: self, selector: #selector(uploadFilesFromFinderMenu), notification: .uploadFiles)

// DistributedNotificationCenter.default()
// .addObserver(self, selector: #selector(uploadFilesFromFinderMenu), name: NSNotification.Name(rawValue: "uploadByFinder"), object: nil)
}

func applicationWillTerminate(_ notification: Notification) {
NSStatusBar.system.removeStatusItem(statusItem)
// 移除 Finder 右键文件上传监听
UploadNotifier.removeObserver(observer: self, notification: .uploadFiles)
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
return true
}
Expand Down Expand Up @@ -97,6 +92,26 @@ class AppDelegate: NSObject, NSApplicationDelegate {

self.uploadFiles(urls)
}

@objc func handleGetURLEvent(event: NSAppleEventDescriptor!, withReplyEvent: NSAppleEventDescriptor!) {
if let urlString = event.paramDescriptor(forKeyword: AEKeyword(keyDirectObject))?.stringValue, let url = NSURL(string: urlString) {
// 解析出参数
var param = urlString
let i = "\(url.scheme!)://".count
param.removeFirst(i)

var fileUrl: URL?
if param.isAbsolutePath {
fileUrl = URL(fileURLWithPath: param)
} else {
fileUrl = URL(string: param.urlDecoded())
}

if let fileUrl = fileUrl, let data = try? Data(contentsOf: fileUrl) {
self.uploadFiles([data])
}
}
}

}

Expand Down Expand Up @@ -125,8 +140,15 @@ extension AppDelegate {
}

statusItem.menu = statusItemMenu



// 初始化任务栏进度图标
indicator.minValue = 0.0
indicator.maxValue = 1.0
indicator.doubleValue = 0.0
indicator.isIndeterminate = false
indicator.controlSize = NSControl.ControlSize.small
indicator.style = NSProgressIndicator.Style.spinning
indicator.isHidden = true
}

func setStatusBarIcon(isIndicator: Bool = false) {
Expand Down Expand Up @@ -216,6 +238,12 @@ extension AppDelegate {
if let jpg = imgData?.convertImageData(.jpeg) {
self.uploadFiles([jpg])
}
} else {
if let urlStr = NSPasteboard.general.string(forType: NSPasteboard.PasteboardType.string) {
if let url = URL(string: urlStr.urlEncoded()), let data = try? Data(contentsOf: url) {
self.uploadFiles([data])
}
}
}

}
Expand Down
Binary file added uPic/Assets.xcassets/AppIcon.appiconset/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added uPic/Assets.xcassets/AppIcon.appiconset/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added uPic/Assets.xcassets/AppIcon.appiconset/256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added uPic/Assets.xcassets/AppIcon.appiconset/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added uPic/Assets.xcassets/AppIcon.appiconset/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 44 additions & 44 deletions uPic/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
{
"images": [
"images" : [
{
"size": "16x16",
"idiom": "mac",
"filename": "icon_16x16.png",
"scale": "1x"
"size" : "16x16",
"idiom" : "mac",
"filename" : "16.png",
"scale" : "1x"
},
{
"size": "16x16",
"idiom": "mac",
"filename": "icon_16x16@2x.png",
"scale": "2x"
"size" : "16x16",
"idiom" : "mac",
"filename" : "16@2x.png",
"scale" : "2x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "icon_32x32.png",
"scale": "1x"
"size" : "32x32",
"idiom" : "mac",
"filename" : "32.png",
"scale" : "1x"
},
{
"size": "32x32",
"idiom": "mac",
"filename": "icon_32x32@2x.png",
"scale": "2x"
"size" : "32x32",
"idiom" : "mac",
"filename" : "32@2x.png",
"scale" : "2x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "icon_128x128.png",
"scale": "1x"
"size" : "128x128",
"idiom" : "mac",
"filename" : "128.png",
"scale" : "1x"
},
{
"size": "128x128",
"idiom": "mac",
"filename": "icon_128x128@2x.png",
"scale": "2x"
"size" : "128x128",
"idiom" : "mac",
"filename" : "128@2x.png",
"scale" : "2x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "icon_256x256.png",
"scale": "1x"
"size" : "256x256",
"idiom" : "mac",
"filename" : "256.png",
"scale" : "1x"
},
{
"size": "256x256",
"idiom": "mac",
"filename": "icon_256x256@2x.png",
"scale": "2x"
"size" : "256x256",
"idiom" : "mac",
"filename" : "256@2x.png",
"scale" : "2x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "icon_512x512.png",
"scale": "1x"
"size" : "512x512",
"idiom" : "mac",
"filename" : "512.png",
"scale" : "1x"
},
{
"size": "512x512",
"idiom": "mac",
"filename": "icon_512x512@2x.png",
"scale": "2x"
"size" : "512x512",
"idiom" : "mac",
"filename" : "512@2x.png",
"scale" : "2x"
}
],
"info": {
"version": 1,
"author": "xcode"
"info" : {
"version" : 1,
"author" : "xcode"
}
}
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.
22 changes: 11 additions & 11 deletions uPic/Assets.xcassets/about.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"images": [
"images" : [
{
"idiom": "universal",
"filename": "icon_128x128@2x.png",
"scale": "1x"
"idiom" : "universal",
"filename" : "about.png",
"scale" : "1x"
},
{
"idiom": "universal",
"scale": "2x"
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom": "universal",
"scale": "3x"
"idiom" : "universal",
"scale" : "3x"
}
],
"info": {
"version": 1,
"author": "xcode"
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added uPic/Assets.xcassets/about.imageset/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
3 changes: 2 additions & 1 deletion uPic/Assets.xcassets/statusIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "icon_32x32.png",
"filename" : "menubar.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
Expand Down
Binary file not shown.
Binary file added uPic/Assets.xcassets/statusIcon.imageset/menubar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 14 additions & 15 deletions uPic/Assets.xcassets/uploadIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
{
"images": [
"images" : [
{
"idiom": "universal",
"filename": "icon_16x16.png",
"scale": "1x"
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom": "universal",
"filename": "icon_32x32.png",
"scale": "2x"
"idiom" : "universal",
"filename" : "wait.png",
"scale" : "2x"
},
{
"idiom": "universal",
"filename": "media-up.png",
"scale": "3x"
"idiom" : "universal",
"filename" : "wait@2x.png",
"scale" : "3x"
}
],
"info": {
"version": 1,
"author": "xcode"
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties": {
"template-rendering-intent": "template"
"properties" : {
"template-rendering-intent" : "template"
}
}
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added uPic/Assets.xcassets/uploadIcon.imageset/wait.png
Loading

0 comments on commit bd3d3f6

Please sign in to comment.