diff --git a/CopyHistory/CopyHistory.xcodeproj/project.pbxproj b/CopyHistory/CopyHistory.xcodeproj/project.pbxproj index 44f9e2a..09f3163 100644 --- a/CopyHistory/CopyHistory.xcodeproj/project.pbxproj +++ b/CopyHistory/CopyHistory.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ CEA8AD0E2874C8E3003B6035 /* PasteboardService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardService.swift; sourceTree = ""; }; CEA8AD132874C8E3003B6035 /* CopyHistory.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = CopyHistory.entitlements; sourceTree = ""; }; CEA8AD362874CAA7003B6035 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = ""; }; + D5EDFC3C287BA72300B4507F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,12 +55,13 @@ CEA8AD042874C8E1003B6035 /* CopyHistory */ = { isa = PBXGroup; children = ( + D5EDFC3C287BA72300B4507F /* Info.plist */, + CE11282328774314008144F8 /* AppDelegate.swift */, + CEA8AD0E2874C8E3003B6035 /* PasteboardService.swift */, CEA8AD072874C8E1003B6035 /* ContentView.swift */, CEA8AD092874C8E3003B6035 /* Assets.xcassets */, - CEA8AD0E2874C8E3003B6035 /* PasteboardService.swift */, CEA8AD132874C8E3003B6035 /* CopyHistory.entitlements */, CEA8AD352874CAA7003B6035 /* Model.xcdatamodeld */, - CE11282328774314008144F8 /* AppDelegate.swift */, ); path = CopyHistory; sourceTree = ""; @@ -264,12 +266,13 @@ CODE_SIGN_ENTITLEMENTS = CopyHistory/CopyHistory.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = H6UU7923NK; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_CFBundleDisplayName = CopyHistory; + INFOPLIST_FILE = CopyHistory/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Copy History Mark Ⅱ"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; LD_RUNPATH_SEARCH_PATHS = ( @@ -293,12 +296,13 @@ CODE_SIGN_ENTITLEMENTS = CopyHistory/CopyHistory.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = H6UU7923NK; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_CFBundleDisplayName = CopyHistory; + INFOPLIST_FILE = CopyHistory/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Copy History Mark Ⅱ"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSHumanReadableCopyright = ""; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/CopyHistory/CopyHistory/AppDelegate.swift b/CopyHistory/CopyHistory/AppDelegate.swift index fb3cdd3..af42de5 100644 --- a/CopyHistory/CopyHistory/AppDelegate.swift +++ b/CopyHistory/CopyHistory/AppDelegate.swift @@ -60,6 +60,7 @@ private final class StatusBarController { popover.performClose(sender) } else { popover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) + NSApp.activate(ignoringOtherApps: true) } } } diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/Contents.json b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/Contents.json index 3f00db4..fc28518 100644 --- a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,51 +1,61 @@ { "images" : [ { + "filename" : "appicon16.png", "idiom" : "mac", "scale" : "1x", "size" : "16x16" }, { + "filename" : "appicon32 1.png", "idiom" : "mac", "scale" : "2x", "size" : "16x16" }, { + "filename" : "appicon32.png", "idiom" : "mac", "scale" : "1x", "size" : "32x32" }, { + "filename" : "appicon64.png", "idiom" : "mac", "scale" : "2x", "size" : "32x32" }, { + "filename" : "appicon128.png", "idiom" : "mac", "scale" : "1x", "size" : "128x128" }, { + "filename" : "appicon256 2.png", "idiom" : "mac", "scale" : "2x", "size" : "128x128" }, { + "filename" : "appicon256 3.png", "idiom" : "mac", "scale" : "1x", "size" : "256x256" }, { + "filename" : "appicon512 1.png", "idiom" : "mac", "scale" : "2x", "size" : "256x256" }, { + "filename" : "appicon512 3.png", "idiom" : "mac", "scale" : "1x", "size" : "512x512" }, { + "filename" : "appicon.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon.png new file mode 100644 index 0000000..c813fdb Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon128.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon128.png new file mode 100644 index 0000000..2cc2bd5 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon128.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon16.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon16.png new file mode 100644 index 0000000..06e93ba Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon16.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 2.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 2.png new file mode 100644 index 0000000..fd85a88 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 2.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 3.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 3.png new file mode 100644 index 0000000..fd85a88 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon256 3.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32 1.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32 1.png new file mode 100644 index 0000000..8d0fdd9 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32 1.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32.png new file mode 100644 index 0000000..8d0fdd9 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon32.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 1.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 1.png new file mode 100644 index 0000000..9d2e367 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 1.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 3.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 3.png new file mode 100644 index 0000000..9d2e367 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon512 3.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon64.png b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon64.png new file mode 100644 index 0000000..2d53c29 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/AppIcon.appiconset/appicon64.png differ diff --git a/CopyHistory/CopyHistory/Assets.xcassets/mainViewBackground.colorset/Contents.json b/CopyHistory/CopyHistory/Assets.xcassets/mainViewBackground.colorset/Contents.json new file mode 100644 index 0000000..169be60 --- /dev/null +++ b/CopyHistory/CopyHistory/Assets.xcassets/mainViewBackground.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF", + "red" : "0xFF" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "blue" : "0x33", + "green" : "0x33", + "red" : "0x33" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/Contents.json b/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/Contents.json new file mode 100644 index 0000000..b0a74a8 --- /dev/null +++ b/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "appicon512.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/appicon512.png b/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/appicon512.png new file mode 100644 index 0000000..9d2e367 Binary files /dev/null and b/CopyHistory/CopyHistory/Assets.xcassets/toolbarIcon.imageset/appicon512.png differ diff --git a/CopyHistory/CopyHistory/ContentView.swift b/CopyHistory/CopyHistory/ContentView.swift index ca705ba..4a94ecf 100644 --- a/CopyHistory/CopyHistory/ContentView.swift +++ b/CopyHistory/CopyHistory/ContentView.swift @@ -45,11 +45,6 @@ struct ContentView: View { isFocus = true } HStack { - Button(action: { - NSApplication.shared.terminate(nil) - }, label: { - Image(systemName: "xmark.circle") - }) Spacer() Button(action: { @@ -62,7 +57,7 @@ struct ContentView: View { .padding(.top, 8) .padding(.bottom, 16) } - .background(Color.white) + .background(Color.mainViewBackground) .alert( isPresented: $isAlertPresented, content: { @@ -111,13 +106,13 @@ struct Row: View { .frame(minHeight: 44) .contentShape(RoundedRectangle(cornerRadius: 20)) }) - .buttonStyle(PlainButtonStyle()) + .buttonStyle(PlainButtonStyle()) Button(action: { deleteButtonDidTap(item) }, label: { Image(systemName: "trash.fill") }) - .buttonStyle(PlainButtonStyle()) + .buttonStyle(PlainButtonStyle()) } .frame(height: 30) Divider().padding(EdgeInsets()) @@ -131,3 +126,7 @@ struct ContentView_Previews: PreviewProvider { ContentView().environmentObject(PasteboardService.build()) } } + +extension Color { + static var mainViewBackground = Color("mainViewBackground") +} diff --git a/CopyHistory/CopyHistory/Info.plist b/CopyHistory/CopyHistory/Info.plist new file mode 100644 index 0000000..bc11256 --- /dev/null +++ b/CopyHistory/CopyHistory/Info.plist @@ -0,0 +1,8 @@ + + + + + ITSAppUsesNonExemptEncryption + + + diff --git a/CopyHistory/CopyHistory/PasteboardService.swift b/CopyHistory/CopyHistory/PasteboardService.swift index db2fdea..4b2e878 100644 --- a/CopyHistory/CopyHistory/PasteboardService.swift +++ b/CopyHistory/CopyHistory/PasteboardService.swift @@ -37,8 +37,8 @@ final class PasteboardService: ObservableObject { latestChangeCount = pasteBoard.changeCount guard let newItem = pasteBoard.pasteboardItems?.first, - let type = newItem.availableType(from: newItem.types), - let data = newItem.data(forType: type) else { return } + let type = newItem.availableType(from: newItem.types), + let data = newItem.data(forType: type) else { return } let dataHash = CryptoKit.SHA256.hash(data: data).description if let alreadySavedItem = persistenceController.getCopiedItem(from: dataHash) { @@ -74,7 +74,7 @@ final class PasteboardService: ObservableObject { func didSelected(_ copiedItem: CopiedItem) { guard let contentTypeString = copiedItem.contentTypeString, - let contentData = copiedItem.content + let contentData = copiedItem.content else { return } let type = NSPasteboard.PasteboardType(contentTypeString) let item = NSPasteboardItem()