From 1db2f32297aa9047d2dfcb20f448b9d5ceb6bf9f Mon Sep 17 00:00:00 2001 From: Nolan Waite Date: Mon, 18 Mar 2024 01:29:38 -0300 Subject: [PATCH] Maintain consistent top-down menu order in posts screen (#1185) * Maintain consistent top-down menu order in posts screen * Delete CopyMarkdown extension and detritus No more copypasting posts into issues for me. --- .../Posts/PostsPageViewController.swift | 9 +- .../BookmarksTableViewController.swift | 6 +- Awful.xcodeproj/project.pbxproj | 488 ------------------ .../xcschemes/CopyMarkdownApp.xcscheme | 78 --- .../xcschemes/CopyMarkdownExtension.xcscheme | 97 ---- CopyMarkdown/App/App.entitlements | 10 - CopyMarkdown/App/AppDelegate.swift | 18 - .../AccentColor.colorset/Contents.json | 11 - .../AppIcon.appiconset/Contents.json | 58 --- .../App/Assets.xcassets/Contents.json | 6 - CopyMarkdown/App/Base.lproj/Main.storyboard | 172 ------ CopyMarkdown/App/Info.plist | 32 -- CopyMarkdown/App/ViewController.swift | 48 -- CopyMarkdown/Extension/Extension.entitlements | 10 - CopyMarkdown/Extension/Info.plist | 62 --- .../Extension/SafariExtensionHandler.swift | 74 --- CopyMarkdown/Extension/copy-awful-markdown.js | 106 ---- 17 files changed, 13 insertions(+), 1272 deletions(-) delete mode 100644 Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownApp.xcscheme delete mode 100644 Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownExtension.xcscheme delete mode 100644 CopyMarkdown/App/App.entitlements delete mode 100644 CopyMarkdown/App/AppDelegate.swift delete mode 100644 CopyMarkdown/App/Assets.xcassets/AccentColor.colorset/Contents.json delete mode 100644 CopyMarkdown/App/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 CopyMarkdown/App/Assets.xcassets/Contents.json delete mode 100644 CopyMarkdown/App/Base.lproj/Main.storyboard delete mode 100644 CopyMarkdown/App/Info.plist delete mode 100644 CopyMarkdown/App/ViewController.swift delete mode 100644 CopyMarkdown/Extension/Extension.entitlements delete mode 100644 CopyMarkdown/Extension/Info.plist delete mode 100644 CopyMarkdown/Extension/SafariExtensionHandler.swift delete mode 100644 CopyMarkdown/Extension/copy-awful-markdown.js diff --git a/App/View Controllers/Posts/PostsPageViewController.swift b/App/View Controllers/Posts/PostsPageViewController.swift index b8d473803..1eac750d7 100644 --- a/App/View Controllers/Posts/PostsPageViewController.swift +++ b/App/View Controllers/Posts/PostsPageViewController.swift @@ -110,6 +110,9 @@ final class PostsPageViewController: ViewController { private lazy var hiddenMenuButton: HiddenMenuButton = { let postActionButton = HiddenMenuButton() postActionButton.alpha = 0 + if #available(iOS 16.0, *) { + postActionButton.preferredMenuElementOrder = .fixed + } postsView.addSubview(postActionButton) return postActionButton }() @@ -555,7 +558,11 @@ final class PostsPageViewController: ViewController { private func actionsItem() -> UIBarButtonItem { - UIBarButtonItem(title: "Menu", image: UIImage(named: "steamed-ham"), primaryAction: nil, menu: threadActionsMenu()) + let buttonItem = UIBarButtonItem(title: "Menu", image: UIImage(named: "steamed-ham"), menu: threadActionsMenu()) + if #available(iOS 16.0, *) { + buttonItem.preferredMenuElementOrder = .fixed + } + return buttonItem } private func refetchPosts() { diff --git a/App/View Controllers/Threads/BookmarksTableViewController.swift b/App/View Controllers/Threads/BookmarksTableViewController.swift index 324a95037..fe96846ce 100644 --- a/App/View Controllers/Threads/BookmarksTableViewController.swift +++ b/App/View Controllers/Threads/BookmarksTableViewController.swift @@ -292,10 +292,14 @@ extension BookmarksTableViewController { contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint ) -> UIContextMenuConfiguration? { - return .makeFromThreadList( + let configuration = UIContextMenuConfiguration.makeFromThreadList( for: dataSource!.thread(at: indexPath), presenter: self ) + if #available(iOS 16.0, *) { + configuration.preferredMenuElementOrder = .fixed + } + return configuration } } diff --git a/Awful.xcodeproj/project.pbxproj b/Awful.xcodeproj/project.pbxproj index 176b43bf4..3acae7e98 100644 --- a/Awful.xcodeproj/project.pbxproj +++ b/Awful.xcodeproj/project.pbxproj @@ -114,14 +114,6 @@ 1C4EE1CE28470C2400A7507E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2D0BB35827F440AF00242D2A /* Assets.xcassets */; }; 1C53451E2B8BF3A7001DA96A /* PSMenuItem in Frameworks */ = {isa = PBXBuildFile; productRef = 1C53451D2B8BF3A7001DA96A /* PSMenuItem */; }; 1C5345212B8BF48F001DA96A /* ScrollViewDelegateMultiplexer in Frameworks */ = {isa = PBXBuildFile; productRef = 1C5345202B8BF48F001DA96A /* ScrollViewDelegateMultiplexer */; }; - 1C56972524C3F1900077CA62 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C56972424C3F1900077CA62 /* AppDelegate.swift */; }; - 1C56972824C3F1900077CA62 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1C56972624C3F1900077CA62 /* Main.storyboard */; }; - 1C56972A24C3F1900077CA62 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C56972924C3F1900077CA62 /* ViewController.swift */; }; - 1C56972C24C3F1900077CA62 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1C56972B24C3F1900077CA62 /* Assets.xcassets */; }; - 1C56973324C3F1910077CA62 /* CopyMarkdownExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 1C56973224C3F1910077CA62 /* CopyMarkdownExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 1C56973724C3F1910077CA62 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C56973624C3F1910077CA62 /* Cocoa.framework */; }; - 1C56973A24C3F1910077CA62 /* SafariExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C56973924C3F1910077CA62 /* SafariExtensionHandler.swift */; }; - 1C56973F24C3F1910077CA62 /* copy-awful-markdown.js in Resources */ = {isa = PBXBuildFile; fileRef = 1C56973E24C3F1910077CA62 /* copy-awful-markdown.js */; }; 1C5C2B8D22D195BF00EA5A80 /* ImgurAnonymousAPI in Frameworks */ = {isa = PBXBuildFile; productRef = 1C5C2B8C22D195BF00EA5A80 /* ImgurAnonymousAPI */; }; 1C5C2C5322D2579E00EA5A80 /* TUSafariActivity.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1C5C2C5222D2579D00EA5A80 /* TUSafariActivity.bundle */; }; 1C5C2C5922D2586D00EA5A80 /* ARChromeActivity.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1C5C2C5822D2586D00EA5A80 /* ARChromeActivity.xcassets */; }; @@ -238,13 +230,6 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 1C56973424C3F1910077CA62 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; - proxyType = 1; - remoteGlobalIDString = 1C56973124C3F1910077CA62; - remoteInfo = "CopyMarkdownSafariExtension Extension"; - }; 1C66A9F619DD393A001B9A41 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; @@ -272,17 +257,6 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; - 1C56974924C3F1910077CA62 /* Embed Foundation Extensions */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 13; - files = ( - 1C56973324C3F1910077CA62 /* CopyMarkdownExtension.appex in Embed Foundation Extensions */, - ); - name = "Embed Foundation Extensions"; - runOnlyForDeploymentPostprocessing = 0; - }; 1C66A9DD19DD304F001B9A41 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -431,19 +405,7 @@ 1C4EAD5D1BC0622D0008BE54 /* AwfulCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AwfulCore.swift; sourceTree = ""; }; 1C53451C2B8BF365001DA96A /* PSMenuItem */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = PSMenuItem; sourceTree = ""; }; 1C53451F2B8BF3F2001DA96A /* ScrollViewDelegateMultiplexer */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = ScrollViewDelegateMultiplexer; sourceTree = ""; }; - 1C56972124C3F1900077CA62 /* CopyMarkdownApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CopyMarkdownApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1C56972324C3F1900077CA62 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; }; - 1C56972424C3F1900077CA62 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 1C56972724C3F1900077CA62 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 1C56972924C3F1900077CA62 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 1C56972B24C3F1900077CA62 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 1C56972D24C3F1900077CA62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1C56973224C3F1910077CA62 /* CopyMarkdownExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = CopyMarkdownExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 1C56973624C3F1910077CA62 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; - 1C56973924C3F1910077CA62 /* SafariExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariExtensionHandler.swift; sourceTree = ""; }; - 1C56973E24C3F1910077CA62 /* copy-awful-markdown.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = "copy-awful-markdown.js"; sourceTree = ""; }; - 1C56974524C3F1910077CA62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1C56974624C3F1910077CA62 /* Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Extension.entitlements; sourceTree = ""; }; 1C5C2C5222D2579D00EA5A80 /* TUSafariActivity.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TUSafariActivity.bundle; sourceTree = ""; }; 1C5C2C5822D2586D00EA5A80 /* ARChromeActivity.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ARChromeActivity.xcassets; sourceTree = ""; }; 1C5C81BE22DA336A00EFD8A9 /* ChromeActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChromeActivity.swift; sourceTree = ""; }; @@ -577,21 +539,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1C56971E24C3F1900077CA62 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1C56972F24C3F1910077CA62 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1C56973724C3F1910077CA62 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1C66A9EC19DD3939001B9A41 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -669,8 +616,6 @@ 1C66A9EF19DD3939001B9A41 /* SmilieKeyboard.appex */, 1C3A143319DFC5D10022C44C /* SmilieExtractor.app */, 1C9AEBC3210C3B2200C9A567 /* AwfulTests.xctest */, - 1C56972124C3F1900077CA62 /* CopyMarkdownApp.app */, - 1C56973224C3F1910077CA62 /* CopyMarkdownExtension.appex */, ); name = Products; sourceTree = ""; @@ -906,39 +851,6 @@ path = Scripts; sourceTree = ""; }; - 1C56972224C3F1900077CA62 /* App */ = { - isa = PBXGroup; - children = ( - 1C56972324C3F1900077CA62 /* App.entitlements */, - 1C56972424C3F1900077CA62 /* AppDelegate.swift */, - 1C56972B24C3F1900077CA62 /* Assets.xcassets */, - 1C56972D24C3F1900077CA62 /* Info.plist */, - 1C56972624C3F1900077CA62 /* Main.storyboard */, - 1C56972924C3F1900077CA62 /* ViewController.swift */, - ); - path = App; - sourceTree = ""; - }; - 1C56973824C3F1910077CA62 /* Extension */ = { - isa = PBXGroup; - children = ( - 1C56973E24C3F1910077CA62 /* copy-awful-markdown.js */, - 1C56974624C3F1910077CA62 /* Extension.entitlements */, - 1C56974524C3F1910077CA62 /* Info.plist */, - 1C56973924C3F1910077CA62 /* SafariExtensionHandler.swift */, - ); - path = Extension; - sourceTree = ""; - }; - 1C56974E24C3F39B0077CA62 /* CopyMarkdown */ = { - isa = PBXGroup; - children = ( - 1C56972224C3F1900077CA62 /* App */, - 1C56973824C3F1910077CA62 /* Extension */, - ); - path = CopyMarkdown; - sourceTree = ""; - }; 1C5C2C4E22D254D600EA5A80 /* TUSafariActivity */ = { isa = PBXGroup; children = ( @@ -1176,7 +1088,6 @@ 1C2F1B7E2B8BD05D00808818 /* AwfulSettingsUI */, 1C1F0F132B8B091600F097D3 /* AwfulTheming */, 1C15334D20708EFF0021A2BD /* Config */, - 1C56974E24C3F39B0077CA62 /* CopyMarkdown */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 1CDAC85B2AE10966006CEE88 /* ImgurAnonymousAPI */, 1C04DEBF2B9396DA0067957F /* LessStylesheet */, @@ -1270,42 +1181,6 @@ productReference = 1C3A143319DFC5D10022C44C /* SmilieExtractor.app */; productType = "com.apple.product-type.application"; }; - 1C56972024C3F1900077CA62 /* CopyMarkdownApp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1C56974D24C3F1910077CA62 /* Build configuration list for PBXNativeTarget "CopyMarkdownApp" */; - buildPhases = ( - 1C56971D24C3F1900077CA62 /* Sources */, - 1C56971E24C3F1900077CA62 /* Frameworks */, - 1C56971F24C3F1900077CA62 /* Resources */, - 1C56974924C3F1910077CA62 /* Embed Foundation Extensions */, - ); - buildRules = ( - ); - dependencies = ( - 1C56973524C3F1910077CA62 /* PBXTargetDependency */, - ); - name = CopyMarkdownApp; - productName = CopyMarkdownSafariExtension; - productReference = 1C56972124C3F1900077CA62 /* CopyMarkdownApp.app */; - productType = "com.apple.product-type.application"; - }; - 1C56973124C3F1910077CA62 /* CopyMarkdownExtension */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1C56974C24C3F1910077CA62 /* Build configuration list for PBXNativeTarget "CopyMarkdownExtension" */; - buildPhases = ( - 1C56972E24C3F1910077CA62 /* Sources */, - 1C56972F24C3F1910077CA62 /* Frameworks */, - 1C56973024C3F1910077CA62 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CopyMarkdownExtension; - productName = "CopyMarkdownSafariExtension Extension"; - productReference = 1C56973224C3F1910077CA62 /* CopyMarkdownExtension.appex */; - productType = "com.apple.product-type.app-extension"; - }; 1C66A9EE19DD3939001B9A41 /* SmilieKeyboard */ = { isa = PBXNativeTarget; buildConfigurationList = 1C66A9FC19DD393A001B9A41 /* Build configuration list for PBXNativeTarget "SmilieKeyboard" */; @@ -1401,12 +1276,6 @@ 1C3A143219DFC5D10022C44C = { CreatedOnToolsVersion = 6.0.1; }; - 1C56972024C3F1900077CA62 = { - CreatedOnToolsVersion = 12.0; - }; - 1C56973124C3F1910077CA62 = { - CreatedOnToolsVersion = 12.0; - }; 1C66A9EE19DD3939001B9A41 = { CreatedOnToolsVersion = 6.0.1; DevelopmentTeam = 9RR6L9X39A; @@ -1461,8 +1330,6 @@ 1C9AEBC2210C3B2200C9A567 /* AwfulTests */, 1C66A9EE19DD3939001B9A41 /* SmilieKeyboard */, 1C3A143219DFC5D10022C44C /* SmilieExtractor */, - 1C56972024C3F1900077CA62 /* CopyMarkdownApp */, - 1C56973124C3F1910077CA62 /* CopyMarkdownExtension */, ); }; /* End PBXProject section */ @@ -1479,23 +1346,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1C56971F24C3F1900077CA62 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1C56972C24C3F1900077CA62 /* Assets.xcassets in Resources */, - 1C56972824C3F1900077CA62 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1C56973024C3F1910077CA62 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1C56973F24C3F1910077CA62 /* copy-awful-markdown.js in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1C66A9ED19DD3939001B9A41 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1592,23 +1442,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 1C56971D24C3F1900077CA62 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1C56972A24C3F1900077CA62 /* ViewController.swift in Sources */, - 1C56972524C3F1900077CA62 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1C56972E24C3F1910077CA62 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1C56973A24C3F1910077CA62 /* SafariExtensionHandler.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 1C66A9EB19DD3939001B9A41 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1763,11 +1596,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 1C56973524C3F1910077CA62 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 1C56973124C3F1910077CA62 /* CopyMarkdownExtension */; - targetProxy = 1C56973424C3F1910077CA62 /* PBXContainerItemProxy */; - }; 1C66A9F719DD393A001B9A41 /* PBXTargetDependency */ = { isa = PBXTargetDependency; platformFilter = ios; @@ -1798,14 +1626,6 @@ name = LaunchScreen.xib; sourceTree = ""; }; - 1C56972624C3F1900077CA62 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 1C56972724C3F1900077CA62 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -1839,296 +1659,6 @@ }; name = Release; }; - 1C56974724C3F1910077CA62 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = CopyMarkdown/App/App.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = 9RR6L9X39A; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = CopyMarkdown/App/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.awfulapp.CopyMarkdown; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 1C56974824C3F1910077CA62 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = CopyMarkdown/App/App.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = 9RR6L9X39A; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = CopyMarkdown/App/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.awfulapp.CopyMarkdown; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - 1C56974A24C3F1910077CA62 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = CopyMarkdown/Extension/Extension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = 9RR6L9X39A; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = CopyMarkdown/Extension/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@executable_path/../../../../Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.awfulapp.CopyMarkdown-Extension"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 1C56974B24C3F1910077CA62 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = CopyMarkdown/Extension/Extension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = 9RR6L9X39A; - ENABLE_HARDENED_RUNTIME = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = CopyMarkdown/Extension/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@executable_path/../../../../Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.awfulapp.CopyMarkdown-Extension"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; 1C66A9FD19DD393A001B9A41 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2259,24 +1789,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - 1C56974C24C3F1910077CA62 /* Build configuration list for PBXNativeTarget "CopyMarkdownExtension" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1C56974A24C3F1910077CA62 /* Debug */, - 1C56974B24C3F1910077CA62 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 1C56974D24C3F1910077CA62 /* Build configuration list for PBXNativeTarget "CopyMarkdownApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1C56974724C3F1910077CA62 /* Debug */, - 1C56974824C3F1910077CA62 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; 1C66A9FC19DD393A001B9A41 /* Build configuration list for PBXNativeTarget "SmilieKeyboard" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownApp.xcscheme b/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownApp.xcscheme deleted file mode 100644 index 390708185..000000000 --- a/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownApp.xcscheme +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownExtension.xcscheme b/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownExtension.xcscheme deleted file mode 100644 index e1e46a837..000000000 --- a/Awful.xcodeproj/xcshareddata/xcschemes/CopyMarkdownExtension.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CopyMarkdown/App/App.entitlements b/CopyMarkdown/App/App.entitlements deleted file mode 100644 index f2ef3ae02..000000000 --- a/CopyMarkdown/App/App.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - - diff --git a/CopyMarkdown/App/AppDelegate.swift b/CopyMarkdown/App/AppDelegate.swift deleted file mode 100644 index 2ebf5b62b..000000000 --- a/CopyMarkdown/App/AppDelegate.swift +++ /dev/null @@ -1,18 +0,0 @@ -// AppDelegate.swift -// -// Copyright 2020 Awful Contributors. CC BY-NC-SA 3.0 US https://github.com/Awful/Awful.app - -import Cocoa - -@NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - - func applicationDidFinishLaunching(_ aNotification: Notification) { - // Insert code here to initialize your application - } - - func applicationWillTerminate(_ aNotification: Notification) { - // Insert code here to tear down your application - } - -} diff --git a/CopyMarkdown/App/Assets.xcassets/AccentColor.colorset/Contents.json b/CopyMarkdown/App/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb8789700..000000000 --- a/CopyMarkdown/App/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CopyMarkdown/App/Assets.xcassets/AppIcon.appiconset/Contents.json b/CopyMarkdown/App/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 3f00db43e..000000000 --- a/CopyMarkdown/App/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "scale" : "1x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" - }, - { - "idiom" : "mac", - "scale" : "1x", - "size" : "512x512" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CopyMarkdown/App/Assets.xcassets/Contents.json b/CopyMarkdown/App/Assets.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/CopyMarkdown/App/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/CopyMarkdown/App/Base.lproj/Main.storyboard b/CopyMarkdown/App/Base.lproj/Main.storyboard deleted file mode 100644 index d8a420832..000000000 --- a/CopyMarkdown/App/Base.lproj/Main.storyboard +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CopyMarkdown/App/Info.plist b/CopyMarkdown/App/Info.plist deleted file mode 100644 index 3a47359b2..000000000 --- a/CopyMarkdown/App/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Copy Awful Markdown - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © Awful Contributors. All rights reserved. - NSMainStoryboardFile - Main - NSPrincipalClass - NSApplication - - diff --git a/CopyMarkdown/App/ViewController.swift b/CopyMarkdown/App/ViewController.swift deleted file mode 100644 index 951c3c67d..000000000 --- a/CopyMarkdown/App/ViewController.swift +++ /dev/null @@ -1,48 +0,0 @@ -// ViewController.swift -// -// Copyright 2020 Awful Contributors. CC BY-NC-SA 3.0 US https://github.com/Awful/Awful.app - -import Cocoa -import SafariServices.SFSafariApplication -import SafariServices.SFSafariExtensionManager - -let extensionName = "Copy Awful Markdown" -let extensionBundleIdentifier = "com.awfulapp.CopyMarkdown-Extension" - -class ViewController: NSViewController { - - @IBOutlet var appNameLabel: NSTextField! - - override func viewDidLoad() { - super.viewDidLoad() - self.appNameLabel.stringValue = extensionName - SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in - guard let state = state, error == nil else { - // Insert code to inform the user that something went wrong. - return - } - - DispatchQueue.main.async { - if (state.isEnabled) { - self.appNameLabel.stringValue = "The \(extensionName) extension is currently on." - } else { - self.appNameLabel.stringValue = "The \(extensionName) extension is currently off. You can turn it on in Safari Extensions preferences." - } - } - } - } - - @IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) { - SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in - guard error == nil else { - // Insert code to inform the user that something went wrong. - return - } - - DispatchQueue.main.async { - NSApplication.shared.terminate(nil) - } - } - } - -} diff --git a/CopyMarkdown/Extension/Extension.entitlements b/CopyMarkdown/Extension/Extension.entitlements deleted file mode 100644 index f2ef3ae02..000000000 --- a/CopyMarkdown/Extension/Extension.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - - diff --git a/CopyMarkdown/Extension/Info.plist b/CopyMarkdown/Extension/Info.plist deleted file mode 100644 index 8e9d9aca8..000000000 --- a/CopyMarkdown/Extension/Info.plist +++ /dev/null @@ -1,62 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Copy Awful Markdown - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSExtension - - NSExtensionPointIdentifier - com.apple.Safari.extension - NSExtensionPrincipalClass - $(PRODUCT_MODULE_NAME).SafariExtensionHandler - SFSafariContentScript - - - Script - copy-awful-markdown.js - - - SFSafariContextMenu - - - Command - CopyMarkdown - Text - Copy Awful Markdown - - - SFSafariWebsiteAccess - - Allowed Domains - - forums.somethingawful.com - - Level - Some - - - NSHumanReadableCopyright - Copyright © Awful Contributors. All rights reserved. - NSHumanReadableDescription - Adds a “Copy Awful Markdown” context menu item to Something Awful Forums posts for convenient copy-pasting into issues. - - diff --git a/CopyMarkdown/Extension/SafariExtensionHandler.swift b/CopyMarkdown/Extension/SafariExtensionHandler.swift deleted file mode 100644 index 748d43f9f..000000000 --- a/CopyMarkdown/Extension/SafariExtensionHandler.swift +++ /dev/null @@ -1,74 +0,0 @@ -// SafariExtensionHandler.swift -// -// Copyright 2020 Awful Contributors. CC BY-NC-SA 3.0 US https://github.com/Awful/Awful.app - -import AppKit -import SafariServices - -class SafariExtensionHandler: SFSafariExtensionHandler { - - enum Command: String { - case copyMarkdown = "CopyMarkdown" - } - - override func validateContextMenuItem( - withCommand command: String, - in page: SFSafariPage, - userInfo: [String : Any]? = nil, - validationHandler: @escaping (Bool, String?) -> Void - ) { - switch Command(rawValue: command) { - case .copyMarkdown: - page.getPropertiesWithCompletionHandler { props in - switch props?.url?.lastPathComponent.lowercased() { - case "announcement.php", "showthread.php": - validationHandler(false, nil) - default: - validationHandler(true, nil) - } - } - - default: - fatalError("Unexpected command \(command)") - } - } - - enum ScriptMessageName: String { - case copyMarkdown - } - - override func contextMenuItemSelected( - withCommand command: String, - in page: SFSafariPage, - userInfo: [String : Any]? = nil - ) { - switch Command(rawValue: command) { - case .copyMarkdown: - page.dispatchMessageToScript(withName: ScriptMessageName.copyMarkdown.rawValue) - - default: - fatalError("Unexpected command \(command)") - } - } - - enum ExtensionMessageName: String { - case setPasteboard - } - - override func messageReceived( - withName messageName: String, - from page: SFSafariPage, - userInfo: [String: Any]? = nil - ) { - switch ExtensionMessageName(rawValue: messageName) { - case .setPasteboard: - let pboard = NSPasteboard.general - pboard.declareTypes([.string], owner: self) - let ok = pboard.setString(userInfo!["text"] as! String, forType: .string) - print("ok: \(ok)") - - default: - fatalError("Unexpected message \(messageName)") - } - } -} diff --git a/CopyMarkdown/Extension/copy-awful-markdown.js b/CopyMarkdown/Extension/copy-awful-markdown.js deleted file mode 100644 index e709f656f..000000000 --- a/CopyMarkdown/Extension/copy-awful-markdown.js +++ /dev/null @@ -1,106 +0,0 @@ -if (window.top === window) { - safari.self.addEventListener("message", event => { - switch (event.name) { - case "copyMarkdown": - copyMarkdown(event); - break; - default: - console.log(`unexpected message ${event.name}`); - break; - } - }); -} - -function copyMarkdown(event) { - const selection = window.getSelection(); - const anchor = selection.anchorNode; - if (anchor == null) return; - - const post = (anchor.closest ? anchor : anchor.parentElement).closest('table.post'); - - const postbody = post.querySelector('td.postbody'); - const body = markdownifyChildren(postbody); - - const author = post.querySelector('dl.userinfo dt.author').textContent; - const link = post.querySelector('td.postdate a[href ^= "#post"]'); - const url = link != null ? link.href : window.location; - const attribution = `— [${author}](${url})`; - - const unquoted = body + "\n" + attribution; - const markdown = '> ' + unquoted.replace(/\n/g, "\n> "); - safari.extension.dispatchMessage("setPasteboard", {text: markdown}); - - function markdownify(node) { - switch (node.nodeType) { - case Node.ELEMENT_NODE: - switch (node.tagName) { - case 'A': - return `[${markdownifyChildren(node)}](${node.href || ""})`; - case 'B': - return `**${markdownifyChildren(node)}**`; - case 'BR': - return `\n`; - case 'DIV': - return ``; - case 'I': - return `*${markdownifyChildren(node)}*`; - case 'IMG': - if (isSmilie(node)) { - return node.alt.trim(); - } - return `![${node.alt.trim() || ""}](${node.src || ""})`; - case 'OL': - return `\n${markdownifyListItems(node, "1.")}\n`; - case 'P': - return ``; - case 'UL': - return `\n${markdownifyListItems(node, "-")}\n`; - default: - return markdownifyChildren(node); - } - - case Node.TEXT_NODE: - return node.textContent.replace(/\s+/g, ' ').trim(); - } - } - - function markdownifyChildren(node) { - return Array.from(node.childNodes).map(markdownify).join(""); - } - - function markdownifyListItems(node, prefix) { - return Array.from(node.childNodes) - .filter(n => n.tagName == 'LI') - .map(n => `${prefix} ${markdownify(n)}`) - .join(""); - } - - function isSmilie(img) { - if (!img.alt) return false; - let url; - try { - url = new URL(img.src || ""); - } catch { - return false; - } - const pathComponents = url.pathname.split('/'); - switch (url.host.toLowerCase()) { - case 'fi.somethingawful.com': - return (pathComponents.includes("smilies") - || pathComponents.includes("posticons") - || pathComponents.includes("customtitles")); - case 'i.somethingawful.com': - return (pathComponents.includes("emot") - || pathComponents.includes("emoticons") - || pathComponents.includes("images") - || (pathComponents.includes("u") - && (pathComponents.includes("adminuploads") - || pathComponents.includes("garbageday")))); - case 'forumimages.somethingawful.com': - return (pathComponents[1] == "images" - || pathComponents.includes("posticons")); - default: - return false - } - } -}