From a7c39f6d0e19e2271bb2a58bdf3f66ac94dcf3eb Mon Sep 17 00:00:00 2001 From: Svend Date: Sun, 24 Nov 2019 13:05:09 +0800 Subject: [PATCH 1/7] :bug: typo --- uPic/PreferencesWindow/zh-Hans.lproj/Preferences.strings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uPic/PreferencesWindow/zh-Hans.lproj/Preferences.strings b/uPic/PreferencesWindow/zh-Hans.lproj/Preferences.strings index 224c98fb..d0106574 100644 --- a/uPic/PreferencesWindow/zh-Hans.lproj/Preferences.strings +++ b/uPic/PreferencesWindow/zh-Hans.lproj/Preferences.strings @@ -81,7 +81,7 @@ "Vu4-Wz-Agk.title" = "✉️ 联系:"; /* Class = "NSTextFieldCell"; title = "截图上传"; ObjectID = "Xd9-iA-emU"; */ -"Xd9-iA-emU.title" = "截图上传"; +"Xd9-iA-emU.title" = "截图上传:"; /* Class = "NSTextFieldCell"; title = "文件网址:"; ObjectID = "ZK1-y8-8KP"; */ "ZK1-y8-8KP.title" = "文件网址:"; From f8e5f5b638e2c60b9071b1eff4c155d859108235 Mon Sep 17 00:00:00 2001 From: nlnlnull Date: Mon, 25 Nov 2019 14:28:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Podfile | 3 + Podfile.lock | 2 +- uPic.xcodeproj/project.pbxproj | 16 +++-- uPic/Models/BaseUploader.swift | 7 +- .../HistoryThumbnailConstant.swift | 39 ++++++++++ .../HistoryRecord/HistoryThumbnailItem.swift | 72 ++++++++++++++++--- .../HistoryRecord/HistoryThumbnailModel.swift | 22 ++++-- .../HistoryRecord/HistoryThumbnailView.swift | 14 ++-- uPic/Views/StatusMenuController.swift | 2 +- 9 files changed, 141 insertions(+), 36 deletions(-) create mode 100644 uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift diff --git a/Podfile b/Podfile index b07885ef..5631e298 100644 --- a/Podfile +++ b/Podfile @@ -1,3 +1,6 @@ +source 'https://cdn.cocoapods.org/' +install! 'cocoapods', :generate_multiple_pod_projects => true +inhibit_all_warnings! platform :osx, '10.12' target 'uPic' do diff --git a/Podfile.lock b/Podfile.lock index 7708ea68..c7845c3e 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -54,6 +54,6 @@ SPEC CHECKSUMS: SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7 SwiftyXMLParser: 8271497e0a37b5c04b0b167c77b4896e36175a21 -PODFILE CHECKSUM: 52b4a11e25d2b5c9c278b36d5f1a95acfef8bc5e +PODFILE CHECKSUM: 3db51175519b196167037cd55cbc3403dd631842 COCOAPODS: 1.8.4 diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 5041dc7a..2ca6587a 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ 4B9870502361A87700EDED1B /* HistoryPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B98704E2361A87700EDED1B /* HistoryPreviewViewController.swift */; }; 4BB6C412236295DC0046FDC0 /* HistoryThumbnailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */; }; 4BBA45BB235F081C0079F253 /* HistoryThumbnailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */; }; + 4BEFD811238B738E00BBE64D /* HistoryThumbnailConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */; }; 68BBB3EF25C92DCAE216A4DF /* AmazonS3Uploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */; }; 68BBB6E5FFBB050D05107413 /* AmazonS3HostConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB8CF2838A67CA1AD438F /* AmazonS3HostConfig.swift */; }; 68BBB99780D7F4586458D4F5 /* AmazonS3Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */; }; @@ -271,6 +272,7 @@ 4B98704E2361A87700EDED1B /* HistoryPreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryPreviewViewController.swift; sourceTree = ""; }; 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailModel.swift; sourceTree = ""; }; 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailItem.swift; sourceTree = ""; }; + 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailConstant.swift; sourceTree = ""; }; 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Util.swift; sourceTree = ""; }; 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Uploader.swift; sourceTree = ""; }; 68BBB8CF2838A67CA1AD438F /* AmazonS3HostConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3HostConfig.swift; sourceTree = ""; }; @@ -636,6 +638,7 @@ 4B66A851235F02A000DED242 /* HistoryRecord */ = { isa = PBXGroup; children = ( + 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */, 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */, 4B66A84F235ED44600DED242 /* HistoryThumbnailView.swift */, 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */, @@ -957,6 +960,7 @@ 16068C7522AEC1D1004D39B7 /* PreferencesViewController.swift in Sources */, 161C3BE122C483380092114F /* CustomUploader.swift in Sources */, 169F073A22AF4549008E8525 /* AboutPreferencesViewController.swift in Sources */, + 4BEFD811238B738E00BBE64D /* HistoryThumbnailConstant.swift in Sources */, 1690E7E722BF174300FC81F8 /* QiniuHostConfig.swift in Sources */, 1675516222ABF80300D3EB6F /* NSDragingInfoExt.swift in Sources */, 1662AC7322C0BBF7003AC924 /* AmazonS3Region.swift in Sources */, @@ -1188,7 +1192,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20191124; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1218,7 +1222,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20191124; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1243,7 +1247,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicHelper/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1266,7 +1270,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicHelper/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1289,7 +1293,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1314,7 +1318,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = EEH44D56FW; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/uPic/Models/BaseUploader.swift b/uPic/Models/BaseUploader.swift index 5094ba3f..3fa7e133 100644 --- a/uPic/Models/BaseUploader.swift +++ b/uPic/Models/BaseUploader.swift @@ -30,8 +30,6 @@ class BaseUploader { thumbnailFileDataBase64String = fileData } - let thumbnailWidth: CGFloat = 160 - var thumbnailHeight: CGFloat = thumbnailWidth * 0.5 var thumbnailData: Data? var previewWidth: CGFloat = 0 var previewHeight: CGFloat = 0 @@ -51,17 +49,14 @@ class BaseUploader { previewWidth = bigSize * originalScale } - let imageSize = NSSize(width: thumbnailWidth, height: thumbnailWidth / originalScale) + let imageSize = NSSize(width: previewDefaulWidthGlobal, height: previewDefaulWidthGlobal / originalScale) thumbnailData = image.resizeImage(size: imageSize).tiffRepresentation - thumbnailHeight = imageSize.height isImage = true } var previewModel = HistoryThumbnailModel() previewModel.url = url previewModel.fileName = fileName - previewModel.thumbnailWidth = thumbnailWidth - previewModel.thumbnailHeight = thumbnailHeight + 20 previewModel.previewWidth = previewWidth previewModel.previewHeight = previewHeight previewModel.thumbnailData = thumbnailData diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift b/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift new file mode 100644 index 00000000..d6868f92 --- /dev/null +++ b/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift @@ -0,0 +1,39 @@ +// +// HistoryThumbnailConstant.swift +// uPic +// +// Created by 侯猛 on 2019/11/25. +// Copyright © 2019 Svend Jin. All rights reserved. +// + +import Foundation + +/// 历史记录总宽 +var historyRecordViewWidthGlobal: CGFloat { + return 500 +} +/// 预览图列数 +var previewLineNumberGlobal: Int { + return 3 +} +/// 预览图间距 +var previewLineSpacingGlobal: CGFloat { + return 5 +} +/// 历史记录内边距 +var historyRecordLeftRightInsetGlobal: CGFloat { + return 5 +} +/// 预览图宽度 +var previewWidthGlobal: CGFloat { + return (historyRecordViewWidthGlobal - CGFloat((previewLineNumberGlobal - 1)) * previewLineSpacingGlobal - historyRecordLeftRightInsetGlobal * 2) / CGFloat(previewLineNumberGlobal) +} +/// 预览图默认宽度 +var previewDefaulWidthGlobal: CGFloat { + return 300 +} + +/// 文件名滚动时间速度 s 单位 +var fileNameScrollAnimationTime: TimeInterval { + return 0.03 +} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift index 2671def1..d8bf9cd3 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift @@ -17,14 +17,22 @@ class HistoryThumbnailItem: NSCollectionViewItem { private var clickCopyButton: NSButton! + private var fileNameScrollView: NSScrollView! + private(set) var fileName: NSTextField! /// 计时器 private var _timer: DispatchSourceTimer? + private var _scrollTimer: DispatchSourceTimer? + var mouseStatusHandler: ((MouseStatus, NSPoint?, NSView) -> Void)? var copyUrl: (() -> Void)? + var lastFileNameScrollContentOffsetX: CGFloat = 0 + + var defaultFileNameScrollContentOffset: NSPoint = .zero + private var contentView: HistoryThumbnailContentView! override func loadView() { @@ -45,14 +53,21 @@ class HistoryThumbnailItem: NSCollectionViewItem { clickCopyButton = NSButton() clickCopyButton.isTransparent = true contentView.addSubview(clickCopyButton) + fileName = NSTextField() + fileName.backgroundColor = NSColor.clear fileName.canDrawSubviewsIntoLayer = true fileName.cell = VerticalCenteringCell() fileName.alignment = .center fileName.isEditable = false fileName.appearance = NSAppearance(named: NSAppearance.Name.aqua) fileName.textColor = NSColor.white - contentView.addSubview(fileName) + + fileNameScrollView = NSScrollView() + fileNameScrollView.backgroundColor = NSColor.clear + fileNameScrollView.documentView = fileName + fileNameScrollView.drawsBackground = false + contentView.addSubview(fileNameScrollView) } private func addConstraintCustom() { @@ -60,11 +75,14 @@ class HistoryThumbnailItem: NSCollectionViewItem { make.left.right.top.equalToSuperview() make.bottom.equalToSuperview().inset(20) } - fileName.snp.makeConstraints { (make) in + fileNameScrollView.snp.makeConstraints { (make) in make.left.right.equalTo(previewImageView) make.top.equalTo(previewImageView.snp.bottom) make.bottom.equalToSuperview() } + fileName.snp.makeConstraints { (make) in + make.width.greaterThanOrEqualTo(fileNameScrollView.snp.width).priority(.high) + } clickCopyButton.snp.makeConstraints { (make) in make.edges.equalToSuperview() } @@ -72,17 +90,23 @@ class HistoryThumbnailItem: NSCollectionViewItem { private func addBindSignal() { contentView.mouseStatusHandler = { [weak self] status, point, mouseView in + guard let self = self else { return } switch status { case .entered: - self?.dispatchTimer(timeInterval: 0.5) { [weak self] in - self?.mouseStatusHandler?(.entered, point, mouseView) - self?.cancelTimer() + self.defaultFileNameScrollContentOffset = self.fileNameScrollView.documentVisibleRect.origin + self.dispatchTimer(timeInterval: 0.5) { [weak self] in + guard let self = self else { return } + self.mouseStatusHandler?(.entered, point, mouseView) + self.cancelTimer() + self.beginScrollFileName() } case .exited: - self?.mouseStatusHandler?(.exited, point, mouseView) - self?.cancelTimer() + self.mouseStatusHandler?(.exited, point, mouseView) + self.cancelTimer() + self.cancelScrollTimer() + self.fileNameScrollView.documentView?.scroll(self.defaultFileNameScrollContentOffset) case .moved: - self?.mouseStatusHandler?(.moved, point, mouseView) + self.mouseStatusHandler?(.moved, point, mouseView) } } clickCopyButton.addTarget { [weak self] (_) in @@ -90,10 +114,40 @@ class HistoryThumbnailItem: NSCollectionViewItem { } } + private func beginScrollFileName() { + cancelScrollTimer() + guard fileName.frame.width - (abs(fileName.frame.minX) * 2) > fileNameScrollView.frame.width else { + return + } + let queue: DispatchQueue = DispatchQueue.global() + let scrollTimer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: 0), queue: queue) + _scrollTimer = scrollTimer + scrollTimer.schedule(deadline: .now(), repeating: fileNameScrollAnimationTime, leeway: DispatchTimeInterval.seconds(0)) + scrollTimer.setEventHandler(handler: { [weak self] in + DispatchQueue.main.async(execute: { + guard let self = self else { return } + let x = self.fileNameScrollView.documentVisibleRect.origin.x + 1 + self.fileNameScrollView.documentView?.scroll(NSPoint(x: x, y: 0)) + if self.fileNameScrollView.documentVisibleRect.origin.x == self.lastFileNameScrollContentOffsetX { + self.cancelScrollTimer() + return + } + self.lastFileNameScrollContentOffsetX = x + }) + }) + scrollTimer.resume() + return + } + private func cancelTimer() { _timer?.cancel() } + private func cancelScrollTimer() { + lastFileNameScrollContentOffsetX = 0 + _scrollTimer?.cancel() + } + private func dispatchTimer(timeInterval: TimeInterval, handler:@escaping ()->()) { cancelTimer() let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) @@ -120,5 +174,5 @@ class VerticalCenteringCell: NSTextFieldCell { newRect.origin.y += heightDelta * 0.5 return newRect } - + } diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailModel.swift b/uPic/Views/HistoryRecord/HistoryThumbnailModel.swift index d2204233..1eab4153 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailModel.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailModel.swift @@ -7,12 +7,26 @@ // import Foundation +import Cocoa struct HistoryThumbnailModel { var url: String = "" var fileName: String? - var thumbnailWidth: CGFloat = 0 - var thumbnailHeight: CGFloat = 0 + var thumbnailSize: NSSize { + return NSSize(width: thumbnailWidth, height: thumbnailHeight) + } + var thumbnailWidth: CGFloat { + return previewWidthGlobal + } + var thumbnailHeight: CGFloat { + var height: CGFloat = 0 + guard let imageData = thumbnailData, let image = NSImage(data: imageData) else { + height = thumbnailWidth * 0.5 + 20 + return height + } + height = thumbnailWidth * (image.size.height / image.size.width) + 20 + return height + } var previewWidth: CGFloat = 0 var previewHeight: CGFloat = 0 var thumbnailData: Data? @@ -22,8 +36,6 @@ struct HistoryThumbnailModel { var model = HistoryThumbnailModel() model.url = keyValue["url"] as! String model.fileName = keyValue["fileName"] as? String - model.thumbnailWidth = keyValue["thumbnailWidth"] as! CGFloat - model.thumbnailHeight = keyValue["thumbnailHeight"] as! CGFloat model.previewWidth = keyValue["previewWidth"] as! CGFloat model.previewHeight = keyValue["previewHeight"] as! CGFloat model.thumbnailData = keyValue["thumbnailData"] as? Data @@ -35,8 +47,6 @@ struct HistoryThumbnailModel { var historyKeyValue: [String: Any] = [:] historyKeyValue["url"] = url historyKeyValue["fileName"] = fileName - historyKeyValue["thumbnailWidth"] = thumbnailWidth - historyKeyValue["thumbnailHeight"] = thumbnailHeight historyKeyValue["previewWidth"] = previewWidth historyKeyValue["previewHeight"] = previewHeight if let thumbnailData = thumbnailData { diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift index 177f8fdb..b8b2f99b 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift @@ -10,6 +10,7 @@ import Cocoa import Alamofire import Kingfisher + extension NSUserInterfaceItemIdentifier { static let collectionViewItem = NSUserInterfaceItemIdentifier(NSStringFromClass(HistoryThumbnailItem.self)) } @@ -46,11 +47,12 @@ class HistoryThumbnailView: NSView { private func initializeView() { let flowLayout = HistoryThumbnailFlowLayout() - flowLayout.edgeInset = NSEdgeInsets(top: 10.0, left: 5, bottom: 10.0, right: 5) - flowLayout.columnCount = 3 - flowLayout.lineSpacing = 4 + flowLayout.edgeInset = NSEdgeInsets(top: historyRecordLeftRightInsetGlobal, left: 5, bottom: 50.0, right: historyRecordLeftRightInsetGlobal) + flowLayout.columnCount = previewLineNumberGlobal + flowLayout.lineSpacing = previewLineSpacingGlobal mainCollectionView = NSCollectionView(frame: bounds) + mainCollectionView.backgroundColors = [NSColor.clear] mainCollectionView.collectionViewLayout = flowLayout mainCollectionView.register(HistoryThumbnailItem.self, forItemWithIdentifier: .collectionViewItem) @@ -76,6 +78,7 @@ class HistoryThumbnailView: NSView { prePopover = NSPopover() prePopover.contentViewController = preImageViewController prePopover.animates = false + } @objc @@ -167,10 +170,7 @@ extension HistoryThumbnailView: NSCollectionViewDelegateFlowLayout { func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize { let historyList = ConfigManager.shared.getHistoryList_New() let model = historyList[indexPath.item] - let itemSize = NSSize(width: model.thumbnailWidth, - height: model.thumbnailHeight) - - return itemSize + return model.thumbnailSize } } diff --git a/uPic/Views/StatusMenuController.swift b/uPic/Views/StatusMenuController.swift index de8eabbd..1601ff3d 100644 --- a/uPic/Views/StatusMenuController.swift +++ b/uPic/Views/StatusMenuController.swift @@ -216,7 +216,7 @@ class StatusMenuController: NSObject, NSMenuDelegate { let previewView = HistoryThumbnailView() historyMenu.delegate = self previewView.superMenu = historyMenu - previewView.frame.size = NSSize(width: 500, height: 400) + previewView.frame.size = NSSize(width: historyRecordViewWidthGlobal, height: 400) imgMenuItem.view = previewView } From af2f33a5cd4bac1ba9debd400d77bd9938799537 Mon Sep 17 00:00:00 2001 From: nlnlnull Date: Mon, 25 Nov 2019 16:17:01 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uPic.xcodeproj/project.pbxproj | 4 ++ .../HistoryPreviewCustomScrollView.swift | 22 +++++++++++ .../HistoryRecord/HistoryThumbnailItem.swift | 38 ++++++++++++------- .../HistoryRecord/HistoryThumbnailView.swift | 5 ++- 4 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 uPic/Views/HistoryRecord/HistoryPreviewCustomScrollView.swift diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 2ca6587a..335190d9 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -116,6 +116,7 @@ 4BB6C412236295DC0046FDC0 /* HistoryThumbnailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */; }; 4BBA45BB235F081C0079F253 /* HistoryThumbnailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */; }; 4BEFD811238B738E00BBE64D /* HistoryThumbnailConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */; }; + 4BEFD813238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */; }; 68BBB3EF25C92DCAE216A4DF /* AmazonS3Uploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */; }; 68BBB6E5FFBB050D05107413 /* AmazonS3HostConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB8CF2838A67CA1AD438F /* AmazonS3HostConfig.swift */; }; 68BBB99780D7F4586458D4F5 /* AmazonS3Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */; }; @@ -273,6 +274,7 @@ 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailModel.swift; sourceTree = ""; }; 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailItem.swift; sourceTree = ""; }; 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailConstant.swift; sourceTree = ""; }; + 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryPreviewCustomScrollView.swift; sourceTree = ""; }; 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Util.swift; sourceTree = ""; }; 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Uploader.swift; sourceTree = ""; }; 68BBB8CF2838A67CA1AD438F /* AmazonS3HostConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3HostConfig.swift; sourceTree = ""; }; @@ -645,6 +647,7 @@ 4B09F11323695F8D000208BD /* HistoryThumbnailContentView.swift */, 4B112CA623603DBB009E79B4 /* HistoryThumbnailFlowLayout.swift */, 4B98704E2361A87700EDED1B /* HistoryPreviewViewController.swift */, + 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */, ); path = HistoryRecord; sourceTree = ""; @@ -925,6 +928,7 @@ 167D7F4922B4D2F500DD0A7A /* HostConfig.swift in Sources */, 164C3A0222B2AB22003ADE39 /* ConfigNotifier.swift in Sources */, 164C3A0022B2AA6C003ADE39 /* Notifier.swift in Sources */, + 4BEFD813238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift in Sources */, 1657019D22C8953B00C57EE9 /* WeiboUploader.swift in Sources */, 1690E7ED22BF2E4F00FC81F8 /* QiniuUtil.swift in Sources */, 166B4A5522B9CFD7001288ED /* ConfigSheetController.swift in Sources */, diff --git a/uPic/Views/HistoryRecord/HistoryPreviewCustomScrollView.swift b/uPic/Views/HistoryRecord/HistoryPreviewCustomScrollView.swift new file mode 100644 index 00000000..93e8701e --- /dev/null +++ b/uPic/Views/HistoryRecord/HistoryPreviewCustomScrollView.swift @@ -0,0 +1,22 @@ +// +// HistoryPreviewCustomScrollView.swift +// uPic +// +// Created by 侯猛 on 2019/11/25. +// Copyright © 2019 Svend Jin. All rights reserved. +// + +import Cocoa + +class HistoryPreviewCustomScrollView: NSScrollView { + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + + // Drawing code here. + } + + override func hitTest(_ point: NSPoint) -> NSView? { + return nil + } +} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift index d8bf9cd3..2247da18 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift @@ -17,7 +17,7 @@ class HistoryThumbnailItem: NSCollectionViewItem { private var clickCopyButton: NSButton! - private var fileNameScrollView: NSScrollView! + private var fileNameScrollView: HistoryPreviewCustomScrollView! private(set) var fileName: NSTextField! /// 计时器 @@ -29,9 +29,9 @@ class HistoryThumbnailItem: NSCollectionViewItem { var copyUrl: (() -> Void)? - var lastFileNameScrollContentOffsetX: CGFloat = 0 + private var lastFileNameScrollContentOffsetX: CGFloat = 0 - var defaultFileNameScrollContentOffset: NSPoint = .zero + private var defaultFileNameScrollContentOffset: NSPoint? private var contentView: HistoryThumbnailContentView! @@ -63,10 +63,11 @@ class HistoryThumbnailItem: NSCollectionViewItem { fileName.appearance = NSAppearance(named: NSAppearance.Name.aqua) fileName.textColor = NSColor.white - fileNameScrollView = NSScrollView() + fileNameScrollView = HistoryPreviewCustomScrollView() fileNameScrollView.backgroundColor = NSColor.clear fileNameScrollView.documentView = fileName fileNameScrollView.drawsBackground = false + fileNameScrollView.documentView?.scroll(.zero) contentView.addSubview(fileNameScrollView) } @@ -93,7 +94,6 @@ class HistoryThumbnailItem: NSCollectionViewItem { guard let self = self else { return } switch status { case .entered: - self.defaultFileNameScrollContentOffset = self.fileNameScrollView.documentVisibleRect.origin self.dispatchTimer(timeInterval: 0.5) { [weak self] in guard let self = self else { return } self.mouseStatusHandler?(.entered, point, mouseView) @@ -103,8 +103,7 @@ class HistoryThumbnailItem: NSCollectionViewItem { case .exited: self.mouseStatusHandler?(.exited, point, mouseView) self.cancelTimer() - self.cancelScrollTimer() - self.fileNameScrollView.documentView?.scroll(self.defaultFileNameScrollContentOffset) + self.cancelScrollTimer(true) case .moved: self.mouseStatusHandler?(.moved, point, mouseView) } @@ -115,10 +114,14 @@ class HistoryThumbnailItem: NSCollectionViewItem { } private func beginScrollFileName() { - cancelScrollTimer() + cancelScrollTimer(true) guard fileName.frame.width - (abs(fileName.frame.minX) * 2) > fileNameScrollView.frame.width else { return } + if defaultFileNameScrollContentOffset == nil { + defaultFileNameScrollContentOffset = fileNameScrollView.documentVisibleRect.origin + } + var bestRightDuration: CGFloat = 0 let queue: DispatchQueue = DispatchQueue.global() let scrollTimer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: 0), queue: queue) _scrollTimer = scrollTimer @@ -126,13 +129,19 @@ class HistoryThumbnailItem: NSCollectionViewItem { scrollTimer.setEventHandler(handler: { [weak self] in DispatchQueue.main.async(execute: { guard let self = self else { return } - let x = self.fileNameScrollView.documentVisibleRect.origin.x + 1 + var x = self.fileNameScrollView.documentVisibleRect.origin.x + 1 + if (x + self.view.bounds.width) > self.fileNameScrollView.documentView?.frame.size.width ?? 0 { + x = (self.fileNameScrollView.documentView?.frame.size.width ?? 0) - self.fileNameScrollView.frame.size.width + } self.fileNameScrollView.documentView?.scroll(NSPoint(x: x, y: 0)) if self.fileNameScrollView.documentVisibleRect.origin.x == self.lastFileNameScrollContentOffsetX { - self.cancelScrollTimer() - return + bestRightDuration += CGFloat(fileNameScrollAnimationTime) + if bestRightDuration >= 3 { + self.cancelScrollTimer(true) + self.beginScrollFileName() + } } - self.lastFileNameScrollContentOffsetX = x + self.lastFileNameScrollContentOffsetX = self.fileNameScrollView.documentVisibleRect.origin.x }) }) scrollTimer.resume() @@ -143,9 +152,12 @@ class HistoryThumbnailItem: NSCollectionViewItem { _timer?.cancel() } - private func cancelScrollTimer() { + func cancelScrollTimer(_ resetLeft: Bool = false) { lastFileNameScrollContentOffsetX = 0 _scrollTimer?.cancel() + if resetLeft, let defaultFileNameScrollContentOffset = defaultFileNameScrollContentOffset { + fileNameScrollView.documentView?.scroll(defaultFileNameScrollContentOffset) + } } private func dispatchTimer(timeInterval: TimeInterval, handler:@escaping ()->()) { diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift index b8b2f99b..a2280cca 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift @@ -103,8 +103,9 @@ class HistoryThumbnailView: NSView { @objc // 滑动 private func boundsDidChangeNotification(notification: NSNotification) { if prePopover.isShown { - self.prePopover.performClose(self) + prePopover.performClose(self) } + currentCell?.cancelScrollTimer(true) } } @@ -128,10 +129,10 @@ extension HistoryThumbnailView: NSCollectionViewDataSource { self?.superMenu.cancelTracking() } item.mouseStatusHandler = { [weak self] status, point, mouseView in - self?.currentCell = item guard let self = self else { return } + self.currentCell = item guard model.isImage == true else { if self.prePopover.isShown { self.prePopover.performClose(item.view) } return From 612201a58d37838d369b52002a95810f063d4af2 Mon Sep 17 00:00:00 2001 From: nlnlnull Date: Tue, 26 Nov 2019 13:29:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E9=87=8D=E5=A4=8D=E8=BF=90=E8=A1=8C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uPic.xcodeproj/project.pbxproj | 4 + .../HistoryPreviewViewController.swift | 2 +- .../HistoryThumbnailConstant.swift | 4 + .../HistoryThumbnailContentView.swift | 10 +- .../HistoryRecord/HistoryThumbnailItem.swift | 130 ++++++++---------- .../HistoryRecord/HistoryThumbnailLabel.swift | 53 +++++++ .../HistoryRecord/HistoryThumbnailView.swift | 36 +++-- 7 files changed, 148 insertions(+), 91 deletions(-) create mode 100644 uPic/Views/HistoryRecord/HistoryThumbnailLabel.swift diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 335190d9..92720c13 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ 4B9870502361A87700EDED1B /* HistoryPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B98704E2361A87700EDED1B /* HistoryPreviewViewController.swift */; }; 4BB6C412236295DC0046FDC0 /* HistoryThumbnailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */; }; 4BBA45BB235F081C0079F253 /* HistoryThumbnailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */; }; + 4BC11BDC238CD8CD001641A6 /* HistoryThumbnailLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */; }; 4BEFD811238B738E00BBE64D /* HistoryThumbnailConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */; }; 4BEFD813238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */; }; 68BBB3EF25C92DCAE216A4DF /* AmazonS3Uploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */; }; @@ -273,6 +274,7 @@ 4B98704E2361A87700EDED1B /* HistoryPreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryPreviewViewController.swift; sourceTree = ""; }; 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailModel.swift; sourceTree = ""; }; 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailItem.swift; sourceTree = ""; }; + 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailLabel.swift; sourceTree = ""; }; 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailConstant.swift; sourceTree = ""; }; 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryPreviewCustomScrollView.swift; sourceTree = ""; }; 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Util.swift; sourceTree = ""; }; @@ -640,6 +642,7 @@ 4B66A851235F02A000DED242 /* HistoryRecord */ = { isa = PBXGroup; children = ( + 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */, 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */, 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */, 4B66A84F235ED44600DED242 /* HistoryThumbnailView.swift */, @@ -915,6 +918,7 @@ 1602ED9722ADEFB200AA8638 /* BaseUploader.swift in Sources */, 163632F322B2751D00805E7F /* BoolType.swift in Sources */, 1646B80722C79346009271DF /* GiteeHostConfig.swift in Sources */, + 4BC11BDC238CD8CD001641A6 /* HistoryThumbnailLabel.swift in Sources */, 1618D1A822E99E2100831601 /* UploadNotifier.swift in Sources */, 4B09F11423695F8D000208BD /* HistoryThumbnailContentView.swift in Sources */, 161C3BE722C49BE90092114F /* RequestMethods.swift in Sources */, diff --git a/uPic/Views/HistoryRecord/HistoryPreviewViewController.swift b/uPic/Views/HistoryRecord/HistoryPreviewViewController.swift index ec9d882b..1c02af0d 100644 --- a/uPic/Views/HistoryRecord/HistoryPreviewViewController.swift +++ b/uPic/Views/HistoryRecord/HistoryPreviewViewController.swift @@ -22,7 +22,7 @@ class HistoryPreviewViewController: NSViewController { private var heightConstraint: Constraint! override func loadView() { - contentView = HistoryThumbnailContentView() + contentView = HistoryThumbnailContentView(frame: .zero, turnOnMonitoring: false) view = contentView } diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift b/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift index d6868f92..70beeec4 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailConstant.swift @@ -37,3 +37,7 @@ var previewDefaulWidthGlobal: CGFloat { var fileNameScrollAnimationTime: TimeInterval { return 0.03 } + +var fileNameScrollingTime: CGFloat { + return 1 +} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift index 511958bf..b8060347 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift @@ -22,12 +22,13 @@ class HistoryThumbnailContentView: NSView { var mousePointView: NSView! - override init(frame frameRect: NSRect) { + var turnOnMonitoring: Bool = true + + init(frame frameRect: NSRect, turnOnMonitoring: Bool = true) { super.init(frame: frameRect) mousePointView = NSView(frame: NSRect(x: 0, y: 0, width: 30, height: 30)) mousePointView.wantsLayer = true mousePointView.layer?.backgroundColor = NSColor.clear.cgColor -// mousePointView.layer?.backgroundColor = NSColor.red.cgColor addSubview(mousePointView) } @@ -46,8 +47,11 @@ class HistoryThumbnailContentView: NSView { } private func createTrackingArea() { + if turnOnMonitoring == false { + return + } removeTrackingArea() - let options : NSTrackingArea.Options = [.mouseEnteredAndExited, .activeAlways] + let options : NSTrackingArea.Options = [.mouseEnteredAndExited, .activeInKeyWindow] let newBounds = NSRect(x: 5, y: 5, width: bounds.width - 10, height: bounds.height - 10) trackingArea = NSTrackingArea(rect: newBounds, options: options, owner: self, userInfo: nil) addTrackingArea(trackingArea!) diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift index 2247da18..088da028 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift @@ -13,13 +13,15 @@ import SnapKit class HistoryThumbnailItem: NSCollectionViewItem { + private var fileNameLeftRightSpacing: CGFloat = 5 + private(set) var previewImageView: NSImageView! private var clickCopyButton: NSButton! - private var fileNameScrollView: HistoryPreviewCustomScrollView! + private(set) var fileNameView: NSView! - private(set) var fileName: NSTextField! + private(set) var fileName: HistoryThumbnailLabel! /// 计时器 private var _timer: DispatchSourceTimer? @@ -29,14 +31,14 @@ class HistoryThumbnailItem: NSCollectionViewItem { var copyUrl: (() -> Void)? - private var lastFileNameScrollContentOffsetX: CGFloat = 0 - - private var defaultFileNameScrollContentOffset: NSPoint? + private var fileNameLeft: Constraint? private var contentView: HistoryThumbnailContentView! + private var whetherToScrollSequentially: Bool = true + override func loadView() { - contentView = HistoryThumbnailContentView() + contentView = HistoryThumbnailContentView(frame: .zero, turnOnMonitoring: true) view = contentView } @@ -54,21 +56,11 @@ class HistoryThumbnailItem: NSCollectionViewItem { clickCopyButton.isTransparent = true contentView.addSubview(clickCopyButton) - fileName = NSTextField() - fileName.backgroundColor = NSColor.clear - fileName.canDrawSubviewsIntoLayer = true - fileName.cell = VerticalCenteringCell() - fileName.alignment = .center - fileName.isEditable = false - fileName.appearance = NSAppearance(named: NSAppearance.Name.aqua) - fileName.textColor = NSColor.white + fileNameView = NSView() + contentView.addSubview(fileNameView) - fileNameScrollView = HistoryPreviewCustomScrollView() - fileNameScrollView.backgroundColor = NSColor.clear - fileNameScrollView.documentView = fileName - fileNameScrollView.drawsBackground = false - fileNameScrollView.documentView?.scroll(.zero) - contentView.addSubview(fileNameScrollView) + fileName = HistoryThumbnailLabel() + fileNameView.addSubview(fileName) } private func addConstraintCustom() { @@ -76,13 +68,17 @@ class HistoryThumbnailItem: NSCollectionViewItem { make.left.right.top.equalToSuperview() make.bottom.equalToSuperview().inset(20) } - fileNameScrollView.snp.makeConstraints { (make) in - make.left.right.equalTo(previewImageView) - make.top.equalTo(previewImageView.snp.bottom) + + fileNameView.snp.makeConstraints { (make) in + make.left.right.equalToSuperview().inset(fileNameLeftRightSpacing) make.bottom.equalToSuperview() + make.height.equalTo(20) } fileName.snp.makeConstraints { (make) in - make.width.greaterThanOrEqualTo(fileNameScrollView.snp.width).priority(.high) + fileNameLeft = make.left.equalToSuperview().constraint + make.bottom.equalToSuperview() + make.height.equalTo(20) + make.width.greaterThanOrEqualTo(fileNameView) } clickCopyButton.snp.makeConstraints { (make) in make.edges.equalToSuperview() @@ -103,7 +99,7 @@ class HistoryThumbnailItem: NSCollectionViewItem { case .exited: self.mouseStatusHandler?(.exited, point, mouseView) self.cancelTimer() - self.cancelScrollTimer(true) + self.cancelScrollTimer() case .moved: self.mouseStatusHandler?(.moved, point, mouseView) } @@ -114,77 +110,63 @@ class HistoryThumbnailItem: NSCollectionViewItem { } private func beginScrollFileName() { - cancelScrollTimer(true) - guard fileName.frame.width - (abs(fileName.frame.minX) * 2) > fileNameScrollView.frame.width else { - return - } - if defaultFileNameScrollContentOffset == nil { - defaultFileNameScrollContentOffset = fileNameScrollView.documentVisibleRect.origin - } - var bestRightDuration: CGFloat = 0 - let queue: DispatchQueue = DispatchQueue.global() - let scrollTimer = DispatchSource.makeTimerSource(flags: DispatchSource.TimerFlags(rawValue: 0), queue: queue) + guard fileName.frame.size.width != fileNameView.frame.size.width else { return } + cancelScrollTimer() + if _scrollTimer != nil { return } + var stayTime: CGFloat = 0 + let scrollTimer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) _scrollTimer = scrollTimer - scrollTimer.schedule(deadline: .now(), repeating: fileNameScrollAnimationTime, leeway: DispatchTimeInterval.seconds(0)) + scrollTimer.schedule(wallDeadline: .now(), repeating: fileNameScrollAnimationTime) scrollTimer.setEventHandler(handler: { [weak self] in - DispatchQueue.main.async(execute: { - guard let self = self else { return } - var x = self.fileNameScrollView.documentVisibleRect.origin.x + 1 - if (x + self.view.bounds.width) > self.fileNameScrollView.documentView?.frame.size.width ?? 0 { - x = (self.fileNameScrollView.documentView?.frame.size.width ?? 0) - self.fileNameScrollView.frame.size.width + guard let self = self else { return } + let fileNameWidth = self.fileName.frame.size.width + let fileNameMinX = self.fileName.frame.origin.x + var newLeft: CGFloat = 0 + if self.whetherToScrollSequentially { + newLeft = fileNameMinX - 1 + } else { + newLeft = fileNameMinX + 1 + } + let fileNameMaxX = newLeft + fileNameWidth + if fileNameMaxX <= self.fileNameView.bounds.width, self.whetherToScrollSequentially == true { + stayTime += CGFloat(fileNameScrollAnimationTime) + if stayTime >= fileNameScrollingTime { + stayTime = 0 + self.whetherToScrollSequentially = false } - self.fileNameScrollView.documentView?.scroll(NSPoint(x: x, y: 0)) - if self.fileNameScrollView.documentVisibleRect.origin.x == self.lastFileNameScrollContentOffsetX { - bestRightDuration += CGFloat(fileNameScrollAnimationTime) - if bestRightDuration >= 3 { - self.cancelScrollTimer(true) - self.beginScrollFileName() - } + return + } else if fileNameMinX >= 0, self.whetherToScrollSequentially == false { + stayTime += CGFloat(fileNameScrollAnimationTime) + if stayTime >= fileNameScrollingTime { + stayTime = 0 + self.whetherToScrollSequentially = true } - self.lastFileNameScrollContentOffsetX = self.fileNameScrollView.documentVisibleRect.origin.x - }) + return + } + self.fileNameLeft?.update(offset: newLeft) }) scrollTimer.resume() return } - private func cancelTimer() { + func cancelTimer() { _timer?.cancel() } - func cancelScrollTimer(_ resetLeft: Bool = false) { - lastFileNameScrollContentOffsetX = 0 + func cancelScrollTimer() { + fileNameLeft?.update(offset: 0) _scrollTimer?.cancel() - if resetLeft, let defaultFileNameScrollContentOffset = defaultFileNameScrollContentOffset { - fileNameScrollView.documentView?.scroll(defaultFileNameScrollContentOffset) - } } private func dispatchTimer(timeInterval: TimeInterval, handler:@escaping ()->()) { cancelTimer() + if _timer != nil { return } let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) _timer = timer timer.schedule(wallDeadline: .now() + timeInterval, repeating: timeInterval) timer.setEventHandler(handler: { - DispatchQueue.main.async { - handler() - } - + handler() }) timer.resume() } } - -class VerticalCenteringCell: NSTextFieldCell { - - override func drawingRect(forBounds rect: NSRect) -> NSRect { - var newRect: NSRect = super.drawingRect(forBounds: rect) - let textSize: NSSize = cellSize(forBounds: rect) - let heightDelta: CGFloat = newRect.size.height - textSize.height - guard heightDelta > 0 else { return newRect } - newRect.size.height = textSize.height - newRect.origin.y += heightDelta * 0.5 - return newRect - } - -} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailLabel.swift b/uPic/Views/HistoryRecord/HistoryThumbnailLabel.swift new file mode 100644 index 00000000..d89ff82b --- /dev/null +++ b/uPic/Views/HistoryRecord/HistoryThumbnailLabel.swift @@ -0,0 +1,53 @@ +// +// HistoryThumbnailLabel.swift +// uPic +// +// Created by 侯猛 on 2019/11/26. +// Copyright © 2019 Svend Jin. All rights reserved. +// + +import Cocoa + +class HistoryThumbnailLabel: NSView { + + private(set) var fileName: NSTextField! + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + + fileName = NSTextField() + fileName.cell = VerticalCenteringCell() + fileName.backgroundColor = NSColor.clear + fileName.canDrawSubviewsIntoLayer = true + fileName.alignment = .center + fileName.isEditable = false + fileName.appearance = NSAppearance(named: NSAppearance.Name.aqua) + fileName.textColor = NSColor.white + addSubview(fileName) + + + fileName.snp.makeConstraints { (make) in + make.edges.equalToSuperview() + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + + +class VerticalCenteringCell: NSTextFieldCell { + + override func drawingRect(forBounds rect: NSRect) -> NSRect { + var newRect: NSRect = super.drawingRect(forBounds: rect) + let textSize: NSSize = cellSize(forBounds: rect) + let heightDelta: CGFloat = newRect.size.height - textSize.height + guard heightDelta > 0 else { return newRect } + newRect.size.height = textSize.height + newRect.origin.y += heightDelta * 0.5 + return newRect + } + +} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift index a2280cca..9ecc6b67 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift @@ -9,6 +9,7 @@ import Cocoa import Alamofire import Kingfisher +import SnapKit extension NSUserInterfaceItemIdentifier { @@ -42,10 +43,10 @@ class HistoryThumbnailView: NSView { override init(frame frameRect: NSRect) { super.init(frame: frameRect) initializeView() + addConstraintCustom() } private func initializeView() { - let flowLayout = HistoryThumbnailFlowLayout() flowLayout.edgeInset = NSEdgeInsets(top: historyRecordLeftRightInsetGlobal, left: 5, bottom: 50.0, right: historyRecordLeftRightInsetGlobal) flowLayout.columnCount = previewLineNumberGlobal @@ -59,9 +60,12 @@ class HistoryThumbnailView: NSView { mainCollectionView.delegate = self mainCollectionView.dataSource = self + let clipView = NSClipView() + clipView.documentView = mainCollectionView + mainScrollView = NSScrollView(frame: bounds) mainScrollView.backgroundColor = NSColor.clear - mainScrollView.documentView = mainCollectionView + mainScrollView.contentView = clipView addSubview(mainScrollView) mainScrollView.contentView.postsBoundsChangedNotifications = true let center = NotificationCenter.default @@ -70,7 +74,7 @@ class HistoryThumbnailView: NSView { clearHistoryButton = NSButton(image: NSImage(named: "cleanButton")!, target: self, action: #selector(clearHistory)) clearHistoryButton.appearance = NSAppearance(named: NSAppearance.Name.aqua) clearHistoryButton.bezelStyle = .smallSquare - clearHistoryButton.toolTip = "Clear upload history".localized + clearHistoryButton.toolTip = "\("Clear upload history".localized) \(ConfigManager.shared.getHistoryList_New().count)" clearHistoryButton.isTransparent = true addSubview(clearHistoryButton) @@ -78,7 +82,19 @@ class HistoryThumbnailView: NSView { prePopover = NSPopover() prePopover.contentViewController = preImageViewController prePopover.animates = false + } + + private func addConstraintCustom () { + + mainScrollView.snp.makeConstraints { (make) in + make.edges.equalToSuperview() + } + clearHistoryButton.snp.makeConstraints { (make) in + make.right.equalToSuperview().offset(-20) + make.bottom.equalToSuperview() + make.width.height.equalTo(44) + } } @objc @@ -87,13 +103,6 @@ class HistoryThumbnailView: NSView { mainCollectionView.reloadData() } - override func layout() { - super.layout() - mainScrollView.frame = NSRect(x: 0, y: 0, width: bounds.size.width, height: bounds.size.height) - clearHistoryButton.frame = NSRect(x: bounds.size.width - 60, y: 0, width: 44, height: 44) - } - - // copy history url @objc func copyUrl(_ url: String) { let outputUrl = (NSApplication.shared.delegate as? AppDelegate)?.copyUrls(urls: [url]) @@ -105,7 +114,8 @@ class HistoryThumbnailView: NSView { if prePopover.isShown { prePopover.performClose(self) } - currentCell?.cancelScrollTimer(true) + currentCell?.cancelScrollTimer() + currentCell?.cancelTimer() } } @@ -116,7 +126,7 @@ extension HistoryThumbnailView: NSCollectionViewDataSource { let model = historyList[indexPath.item] let item = collectionView.makeItem(withIdentifier: .collectionViewItem, for: indexPath) as! HistoryThumbnailItem let urlString = model.url - item.fileName.stringValue = URL(string: urlString.urlEncoded())!.lastPathComponent + item.fileName.fileName.stringValue = URL(string: urlString.urlEncoded())!.lastPathComponent if model.isImage == true { if let imageData = model.thumbnailData { item.previewImageView.image = NSImage(data: imageData) @@ -185,6 +195,6 @@ extension HistoryThumbnailView: HistoryThumbnailFlowLayoutDelegate { extension HistoryThumbnailView: NSMenuDelegate { func menuWillOpen(_ menu: NSMenu) { - mainCollectionView.reloadData() +// mainCollectionView.reloadData() } } From 5dd5662a5b3b127bffe5677cff45f066a13f72b7 Mon Sep 17 00:00:00 2001 From: nlnlnull Date: Tue, 26 Nov 2019 14:48:13 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uPic.xcodeproj/project.pbxproj | 4 ++ .../HistoryThumbnailContentView.swift | 10 ++++ .../HistoryRecord/HistoryThumbnailItem.swift | 43 ++++---------- .../HistoryRecord/HistoryThumbnailTimer.swift | 57 +++++++++++++++++++ .../HistoryRecord/HistoryThumbnailView.swift | 6 +- 5 files changed, 82 insertions(+), 38 deletions(-) create mode 100644 uPic/Views/HistoryRecord/HistoryThumbnailTimer.swift diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 92720c13..81c462e5 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -116,6 +116,7 @@ 4BB6C412236295DC0046FDC0 /* HistoryThumbnailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */; }; 4BBA45BB235F081C0079F253 /* HistoryThumbnailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */; }; 4BC11BDC238CD8CD001641A6 /* HistoryThumbnailLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */; }; + 4BC11BDE238CFD53001641A6 /* HistoryThumbnailTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC11BDD238CFD53001641A6 /* HistoryThumbnailTimer.swift */; }; 4BEFD811238B738E00BBE64D /* HistoryThumbnailConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */; }; 4BEFD813238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */; }; 68BBB3EF25C92DCAE216A4DF /* AmazonS3Uploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */; }; @@ -275,6 +276,7 @@ 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailModel.swift; sourceTree = ""; }; 4BBA45B9235F081C0079F253 /* HistoryThumbnailItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailItem.swift; sourceTree = ""; }; 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailLabel.swift; sourceTree = ""; }; + 4BC11BDD238CFD53001641A6 /* HistoryThumbnailTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailTimer.swift; sourceTree = ""; }; 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryThumbnailConstant.swift; sourceTree = ""; }; 4BEFD812238BB2F200BBE64D /* HistoryPreviewCustomScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryPreviewCustomScrollView.swift; sourceTree = ""; }; 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Util.swift; sourceTree = ""; }; @@ -643,6 +645,7 @@ isa = PBXGroup; children = ( 4BC11BDB238CD8CD001641A6 /* HistoryThumbnailLabel.swift */, + 4BC11BDD238CFD53001641A6 /* HistoryThumbnailTimer.swift */, 4BEFD810238B738E00BBE64D /* HistoryThumbnailConstant.swift */, 4BB6C411236295DC0046FDC0 /* HistoryThumbnailModel.swift */, 4B66A84F235ED44600DED242 /* HistoryThumbnailView.swift */, @@ -956,6 +959,7 @@ 1647474522B66E3400F9575D /* Util.swift in Sources */, 167620ED230819C0008F8363 /* ImgurHostConfig.swift in Sources */, 1657019F22C897A400C57EE9 /* WeiboConfigView.swift in Sources */, + 4BC11BDE238CFD53001641A6 /* HistoryThumbnailTimer.swift in Sources */, 1662AC7122C0AC53003AC924 /* AliyunConfigView.swift in Sources */, 1675516A22ACAA5900D3EB6F /* AppPublic.swift in Sources */, 4B9870502361A87700EDED1B /* HistoryPreviewViewController.swift in Sources */, diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift index b8060347..add4f0b4 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailContentView.swift @@ -55,6 +55,16 @@ class HistoryThumbnailContentView: NSView { let newBounds = NSRect(x: 5, y: 5, width: bounds.width - 10, height: bounds.height - 10) trackingArea = NSTrackingArea(rect: newBounds, options: options, owner: self, userInfo: nil) addTrackingArea(trackingArea!) + + guard var mouseLocation = window?.mouseLocationOutsideOfEventStream else { + return + } + mouseLocation = convert(mouseLocation, from: nil) + if NSPointInRect(mouseLocation, bounds) { + mouseEntered(with: NSEvent()) + } else { + mouseExited(with: NSEvent()) + } } private func removeTrackingArea() { diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift index 088da028..22231fa7 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailItem.swift @@ -37,6 +37,10 @@ class HistoryThumbnailItem: NSCollectionViewItem { private var whetherToScrollSequentially: Bool = true + func updateTrackingAreas() { + contentView.updateTrackingAreas() + } + override func loadView() { contentView = HistoryThumbnailContentView(frame: .zero, turnOnMonitoring: true) view = contentView @@ -90,16 +94,16 @@ class HistoryThumbnailItem: NSCollectionViewItem { guard let self = self else { return } switch status { case .entered: - self.dispatchTimer(timeInterval: 0.5) { [weak self] in + HistoryThumbnailTimer.shared.dispatchTimer(timeInterval: 0.5) { [weak self] timer in guard let self = self else { return } self.mouseStatusHandler?(.entered, point, mouseView) - self.cancelTimer() + timer.cancel() self.beginScrollFileName() } case .exited: self.mouseStatusHandler?(.exited, point, mouseView) - self.cancelTimer() - self.cancelScrollTimer() + HistoryThumbnailTimer.shared.cancelAllTimer() + self.fileNameLeft?.update(offset: 0) case .moved: self.mouseStatusHandler?(.moved, point, mouseView) } @@ -111,13 +115,8 @@ class HistoryThumbnailItem: NSCollectionViewItem { private func beginScrollFileName() { guard fileName.frame.size.width != fileNameView.frame.size.width else { return } - cancelScrollTimer() - if _scrollTimer != nil { return } var stayTime: CGFloat = 0 - let scrollTimer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) - _scrollTimer = scrollTimer - scrollTimer.schedule(wallDeadline: .now(), repeating: fileNameScrollAnimationTime) - scrollTimer.setEventHandler(handler: { [weak self] in + HistoryThumbnailTimer.shared.dispatchScrollTimer(timeInterval: fileNameScrollAnimationTime) { [weak self] timer in guard let self = self else { return } let fileNameWidth = self.fileName.frame.size.width let fileNameMinX = self.fileName.frame.origin.x @@ -144,29 +143,7 @@ class HistoryThumbnailItem: NSCollectionViewItem { return } self.fileNameLeft?.update(offset: newLeft) - }) - scrollTimer.resume() + } return } - - func cancelTimer() { - _timer?.cancel() - } - - func cancelScrollTimer() { - fileNameLeft?.update(offset: 0) - _scrollTimer?.cancel() - } - - private func dispatchTimer(timeInterval: TimeInterval, handler:@escaping ()->()) { - cancelTimer() - if _timer != nil { return } - let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) - _timer = timer - timer.schedule(wallDeadline: .now() + timeInterval, repeating: timeInterval) - timer.setEventHandler(handler: { - handler() - }) - timer.resume() - } } diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailTimer.swift b/uPic/Views/HistoryRecord/HistoryThumbnailTimer.swift new file mode 100644 index 00000000..35d2fdbd --- /dev/null +++ b/uPic/Views/HistoryRecord/HistoryThumbnailTimer.swift @@ -0,0 +1,57 @@ +// +// HistoryThumbnailTimer.swift +// uPic +// +// Created by 侯猛 on 2019/11/26. +// Copyright © 2019 Svend Jin. All rights reserved. +// + +import Cocoa + +class HistoryThumbnailTimer { + + static let shared = HistoryThumbnailTimer() + private init() {} + + /// 计时器 + private var _timer: DispatchSourceTimer? + /// 计时器 + private var _scrollTimer: DispatchSourceTimer? + + func dispatchTimer(timeInterval: TimeInterval, handler:@escaping (DispatchSourceTimer)->()) { + cancelTimer() + if _timer?.isCancelled == false { return } + let timer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) + _timer = timer + timer.schedule(wallDeadline: .now() + timeInterval, repeating: timeInterval) + timer.setEventHandler(handler: { + handler(timer) + }) + timer.resume() + } + + func dispatchScrollTimer(timeInterval: TimeInterval, handler:@escaping (DispatchSourceTimer)->()) { + cancelTimer() + if _scrollTimer?.isCancelled == false { return } + let scrollTimer = DispatchSource.makeTimerSource(flags: [], queue: DispatchQueue.main) + _scrollTimer = scrollTimer + scrollTimer.schedule(wallDeadline: .now(), repeating: timeInterval) + scrollTimer.setEventHandler(handler: { + handler(scrollTimer) + }) + scrollTimer.resume() + } + + func cancelTimer() { + _timer?.cancel() + } + + func cancelScrollTimer() { + _scrollTimer?.cancel() + } + + func cancelAllTimer() { + _timer?.cancel() + _scrollTimer?.cancel() + } +} diff --git a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift index 9ecc6b67..f475a485 100644 --- a/uPic/Views/HistoryRecord/HistoryThumbnailView.swift +++ b/uPic/Views/HistoryRecord/HistoryThumbnailView.swift @@ -111,11 +111,7 @@ class HistoryThumbnailView: NSView { @objc // 滑动 private func boundsDidChangeNotification(notification: NSNotification) { - if prePopover.isShown { - prePopover.performClose(self) - } - currentCell?.cancelScrollTimer() - currentCell?.cancelTimer() + currentCell?.updateTrackingAreas() } } From 3d863d9adcb500360b06186d8b306a8b47fda332 Mon Sep 17 00:00:00 2001 From: Svend Date: Tue, 26 Nov 2019 16:16:46 +0800 Subject: [PATCH 6/7] :sparkles: File name is too long to scroll :sparkles: File name is too long to scroll. :bug: Fixed history timer repeatedly calling bug. :art: Optimize the display & disappear logic when sliding. --- uPic.xcodeproj/project.pbxproj | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 81c462e5..58b5514e 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -1204,7 +1204,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20191124; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1234,7 +1234,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20191124; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1256,10 +1256,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = uPicHelper/uPicHelper.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicHelper/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1279,10 +1279,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = uPicHelper/uPicHelper.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicHelper/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1302,10 +1302,10 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = NO; CODE_SIGN_ENTITLEMENTS = uPicFinderExtension/uPicFinderExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1327,10 +1327,10 @@ buildSettings = { APPLICATION_EXTENSION_API_ONLY = NO; CODE_SIGN_ENTITLEMENTS = uPicFinderExtension/uPicFinderExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = EEH44D56FW; + DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( From 0178f948dd475dc1c7f7a79c5688d088789a71a3 Mon Sep 17 00:00:00 2001 From: Svend Date: Tue, 26 Nov 2019 16:18:10 +0800 Subject: [PATCH 7/7] :bookmark: Releasing v0.14.1 - :sparkles: File name is too long to scroll. - :bug: Fixed history timer repeatedly calling bug. - :art: Optimize the display & disappear logic when sliding. --- uPic.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 58b5514e..25e6d41b 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -1203,7 +1203,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 20191124; + CURRENT_PROJECT_VERSION = 20191126; DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; @@ -1212,7 +1212,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 0.14.0; + MARKETING_VERSION = 0.14.1; PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1233,7 +1233,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 20191124; + CURRENT_PROJECT_VERSION = 20191126; DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; @@ -1242,7 +1242,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 0.14.0; + MARKETING_VERSION = 0.14.1; PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "";