diff --git a/Safari/BlockerExtension/BlockerExtension.entitlements b/Safari/BlockerExtension/BlockerExtension.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/Safari/BlockerExtension/BlockerExtension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Safari/BlockerExtension/ContentBlockerRequestHandler.swift b/Safari/BlockerExtension/ContentBlockerRequestHandler.swift new file mode 100644 index 00000000..784a78c5 --- /dev/null +++ b/Safari/BlockerExtension/ContentBlockerRequestHandler.swift @@ -0,0 +1,22 @@ +// +// ContentBlockerRequestHandler.swift +// BlockerExtension +// +// Created by Bruce Roettgers on 07.04.19. +// Copyright © 2019 Dirk Hulverscheidt. All rights reserved. +// + +import Foundation + +class ContentBlockerRequestHandler: NSObject, NSExtensionRequestHandling { + + func beginRequest(with context: NSExtensionContext) { + let attachment = NSItemProvider(contentsOf: Bundle.main.url(forResource: "blockerList", withExtension: "json"))! + + let item = NSExtensionItem() + item.attachments = [attachment] + + context.completeRequest(returningItems: [item], completionHandler: nil) + } + +} diff --git a/Safari/BlockerExtension/Info.plist b/Safari/BlockerExtension/Info.plist new file mode 100644 index 00000000..208be7c9 --- /dev/null +++ b/Safari/BlockerExtension/Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + BlockerExtension + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.content-blocker + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).ContentBlockerRequestHandler + + NSHumanReadableCopyright + Copyright © 2019 Dirk Hulverscheidt. All rights reserved. + NSHumanReadableDescription + Add a description of what your extension does here. + + diff --git a/Safari/BlockerExtension/blockerList.json b/Safari/BlockerExtension/blockerList.json new file mode 100644 index 00000000..21f8272a --- /dev/null +++ b/Safari/BlockerExtension/blockerList.json @@ -0,0 +1,11 @@ +[ + { + "action": { + "type": "block" + }, + "trigger": { + "url-filter": ".*", + "resource-type": ["script"] + } + } +] diff --git a/Safari/HelloGoodbye.xcodeproj/project.pbxproj b/Safari/HelloGoodbye.xcodeproj/project.pbxproj new file mode 100644 index 00000000..6d9649f1 --- /dev/null +++ b/Safari/HelloGoodbye.xcodeproj/project.pbxproj @@ -0,0 +1,494 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + EDDE49D5225A9834005DE7A4 /* HelloGoodbye.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = EDDE49D4225A9834005DE7A4 /* HelloGoodbye.entitlements */; }; + EDDE49D7225A9834005DE7A4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDDE49D6225A9834005DE7A4 /* AppDelegate.swift */; }; + EDDE49DA225A9834005DE7A4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EDDE49D8225A9834005DE7A4 /* Main.storyboard */; }; + EDDE49DC225A9834005DE7A4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDDE49DB225A9834005DE7A4 /* ViewController.swift */; }; + EDDE49DE225A9836005DE7A4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EDDE49DD225A9836005DE7A4 /* Assets.xcassets */; }; + EDDE4A07225A98DF005DE7A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDDE49E9225A9836005DE7A4 /* Cocoa.framework */; }; + EDDE4A0A225A98DF005DE7A4 /* blockerList.json in Resources */ = {isa = PBXBuildFile; fileRef = EDDE4A09225A98DF005DE7A4 /* blockerList.json */; }; + EDDE4A0C225A98DF005DE7A4 /* ContentBlockerRequestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDDE4A0B225A98DF005DE7A4 /* ContentBlockerRequestHandler.swift */; }; + EDDE4A11225A98DF005DE7A4 /* BlockerExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = EDDE4A06225A98DF005DE7A4 /* BlockerExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + EDDE4A0F225A98DF005DE7A4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = EDDE49C9225A9834005DE7A4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EDDE4A05225A98DF005DE7A4; + remoteInfo = BlockerExtension; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + EDDE49FE225A9836005DE7A4 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + EDDE4A11225A98DF005DE7A4 /* BlockerExtension.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + EDDE49D1225A9834005DE7A4 /* HelloGoodbye.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloGoodbye.app; sourceTree = BUILT_PRODUCTS_DIR; }; + EDDE49D4225A9834005DE7A4 /* HelloGoodbye.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HelloGoodbye.entitlements; sourceTree = ""; }; + EDDE49D6225A9834005DE7A4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + EDDE49D9225A9834005DE7A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + EDDE49DB225A9834005DE7A4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + EDDE49DD225A9836005DE7A4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + EDDE49DF225A9836005DE7A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + EDDE49E9225A9836005DE7A4 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + EDDE4A06225A98DF005DE7A4 /* BlockerExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = BlockerExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + EDDE4A09225A98DF005DE7A4 /* blockerList.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = blockerList.json; sourceTree = ""; }; + EDDE4A0B225A98DF005DE7A4 /* ContentBlockerRequestHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentBlockerRequestHandler.swift; sourceTree = ""; }; + EDDE4A0D225A98DF005DE7A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + EDDE4A0E225A98DF005DE7A4 /* BlockerExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = BlockerExtension.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + EDDE49CE225A9834005DE7A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDDE4A03225A98DF005DE7A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EDDE4A07225A98DF005DE7A4 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + EDDE49C8225A9834005DE7A4 = { + isa = PBXGroup; + children = ( + EDDE49D3225A9834005DE7A4 /* HelloGoodbye */, + EDDE4A08225A98DF005DE7A4 /* BlockerExtension */, + EDDE49E8225A9836005DE7A4 /* Frameworks */, + EDDE49D2225A9834005DE7A4 /* Products */, + ); + sourceTree = ""; + }; + EDDE49D2225A9834005DE7A4 /* Products */ = { + isa = PBXGroup; + children = ( + EDDE49D1225A9834005DE7A4 /* HelloGoodbye.app */, + EDDE4A06225A98DF005DE7A4 /* BlockerExtension.appex */, + ); + name = Products; + sourceTree = ""; + }; + EDDE49D3225A9834005DE7A4 /* HelloGoodbye */ = { + isa = PBXGroup; + children = ( + EDDE49D4225A9834005DE7A4 /* HelloGoodbye.entitlements */, + EDDE49D6225A9834005DE7A4 /* AppDelegate.swift */, + EDDE49D8225A9834005DE7A4 /* Main.storyboard */, + EDDE49DB225A9834005DE7A4 /* ViewController.swift */, + EDDE49DD225A9836005DE7A4 /* Assets.xcassets */, + EDDE49DF225A9836005DE7A4 /* Info.plist */, + ); + path = HelloGoodbye; + sourceTree = ""; + }; + EDDE49E8225A9836005DE7A4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EDDE49E9225A9836005DE7A4 /* Cocoa.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + EDDE4A08225A98DF005DE7A4 /* BlockerExtension */ = { + isa = PBXGroup; + children = ( + EDDE4A09225A98DF005DE7A4 /* blockerList.json */, + EDDE4A0B225A98DF005DE7A4 /* ContentBlockerRequestHandler.swift */, + EDDE4A0D225A98DF005DE7A4 /* Info.plist */, + EDDE4A0E225A98DF005DE7A4 /* BlockerExtension.entitlements */, + ); + path = BlockerExtension; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + EDDE49D0225A9834005DE7A4 /* HelloGoodbye */ = { + isa = PBXNativeTarget; + buildConfigurationList = EDDE49FF225A9836005DE7A4 /* Build configuration list for PBXNativeTarget "HelloGoodbye" */; + buildPhases = ( + EDDE49CD225A9834005DE7A4 /* Sources */, + EDDE49CE225A9834005DE7A4 /* Frameworks */, + EDDE49CF225A9834005DE7A4 /* Resources */, + EDDE49FE225A9836005DE7A4 /* Embed App Extensions */, + ); + buildRules = ( + ); + dependencies = ( + EDDE4A10225A98DF005DE7A4 /* PBXTargetDependency */, + ); + name = HelloGoodbye; + productName = HelloGoodbye; + productReference = EDDE49D1225A9834005DE7A4 /* HelloGoodbye.app */; + productType = "com.apple.product-type.application"; + }; + EDDE4A05225A98DF005DE7A4 /* BlockerExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = EDDE4A12225A98DF005DE7A4 /* Build configuration list for PBXNativeTarget "BlockerExtension" */; + buildPhases = ( + EDDE4A02225A98DF005DE7A4 /* Sources */, + EDDE4A03225A98DF005DE7A4 /* Frameworks */, + EDDE4A04225A98DF005DE7A4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BlockerExtension; + productName = BlockerExtension; + productReference = EDDE4A06225A98DF005DE7A4 /* BlockerExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + EDDE49C9225A9834005DE7A4 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1020; + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = "Dirk Hulverscheidt"; + TargetAttributes = { + EDDE49D0225A9834005DE7A4 = { + CreatedOnToolsVersion = 10.2; + }; + EDDE4A05225A98DF005DE7A4 = { + CreatedOnToolsVersion = 10.2; + }; + }; + }; + buildConfigurationList = EDDE49CC225A9834005DE7A4 /* Build configuration list for PBXProject "HelloGoodbye" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = EDDE49C8225A9834005DE7A4; + productRefGroup = EDDE49D2225A9834005DE7A4 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + EDDE49D0225A9834005DE7A4 /* HelloGoodbye */, + EDDE4A05225A98DF005DE7A4 /* BlockerExtension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + EDDE49CF225A9834005DE7A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDDE49D5225A9834005DE7A4 /* HelloGoodbye.entitlements in Resources */, + EDDE49DE225A9836005DE7A4 /* Assets.xcassets in Resources */, + EDDE49DA225A9834005DE7A4 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDDE4A04225A98DF005DE7A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDDE4A0A225A98DF005DE7A4 /* blockerList.json in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + EDDE49CD225A9834005DE7A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDDE49DC225A9834005DE7A4 /* ViewController.swift in Sources */, + EDDE49D7225A9834005DE7A4 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDDE4A02225A98DF005DE7A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDDE4A0C225A98DF005DE7A4 /* ContentBlockerRequestHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + EDDE4A10225A98DF005DE7A4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EDDE4A05225A98DF005DE7A4 /* BlockerExtension */; + targetProxy = EDDE4A0F225A98DF005DE7A4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + EDDE49D8225A9834005DE7A4 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + EDDE49D9225A9834005DE7A4 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + EDDE49F9225A9836005DE7A4 /* 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_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_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + EDDE49FA225A9836005DE7A4 /* 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_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_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + EDDE4A00225A9836005DE7A4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = HelloGoodbye/HelloGoodbye.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = BN988BU552; + INFOPLIST_FILE = HelloGoodbye/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = hulverscheidtdirk.HelloGoodbye; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + EDDE4A01225A9836005DE7A4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = HelloGoodbye/HelloGoodbye.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = BN988BU552; + INFOPLIST_FILE = HelloGoodbye/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = hulverscheidtdirk.HelloGoodbye; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + EDDE4A13225A98DF005DE7A4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = BlockerExtension/BlockerExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = BN988BU552; + INFOPLIST_FILE = BlockerExtension/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = hulverscheidtdirk.HelloGoodbye.BlockerExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + EDDE4A14225A98DF005DE7A4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = BlockerExtension/BlockerExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = BN988BU552; + INFOPLIST_FILE = BlockerExtension/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = hulverscheidtdirk.HelloGoodbye.BlockerExtension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + EDDE49CC225A9834005DE7A4 /* Build configuration list for PBXProject "HelloGoodbye" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EDDE49F9225A9836005DE7A4 /* Debug */, + EDDE49FA225A9836005DE7A4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + EDDE49FF225A9836005DE7A4 /* Build configuration list for PBXNativeTarget "HelloGoodbye" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EDDE4A00225A9836005DE7A4 /* Debug */, + EDDE4A01225A9836005DE7A4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + EDDE4A12225A98DF005DE7A4 /* Build configuration list for PBXNativeTarget "BlockerExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EDDE4A13225A98DF005DE7A4 /* Debug */, + EDDE4A14225A98DF005DE7A4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = EDDE49C9225A9834005DE7A4 /* Project object */; +} diff --git a/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..eddd8876 --- /dev/null +++ b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcuserdata/bruceroettgers.xcuserdatad/UserInterfaceState.xcuserstate b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcuserdata/bruceroettgers.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..b49a5066 Binary files /dev/null and b/Safari/HelloGoodbye.xcodeproj/project.xcworkspace/xcuserdata/bruceroettgers.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Safari/HelloGoodbye.xcodeproj/xcuserdata/bruceroettgers.xcuserdatad/xcschemes/xcschememanagement.plist b/Safari/HelloGoodbye.xcodeproj/xcuserdata/bruceroettgers.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..469c4104 --- /dev/null +++ b/Safari/HelloGoodbye.xcodeproj/xcuserdata/bruceroettgers.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,24 @@ + + + + + SchemeUserState + + BlockerExtension.xcscheme_^#shared#^_ + + orderHint + 2 + + HelloGoodbye Extension.xcscheme_^#shared#^_ + + orderHint + 1 + + HelloGoodbye.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Safari/HelloGoodbye/AppDelegate.swift b/Safari/HelloGoodbye/AppDelegate.swift new file mode 100644 index 00000000..875fc7c5 --- /dev/null +++ b/Safari/HelloGoodbye/AppDelegate.swift @@ -0,0 +1,22 @@ +// +// AppDelegate.swift +// HelloGoodbye +// +// Created by Bruce Roettgers on 07.04.19. +// Copyright © 2019 Dirk Hulverscheidt. All rights reserved. +// + +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/Safari/HelloGoodbye/Assets.xcassets/AppIcon.appiconset/Contents.json b/Safari/HelloGoodbye/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..2db2b1c7 --- /dev/null +++ b/Safari/HelloGoodbye/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Safari/HelloGoodbye/Assets.xcassets/Contents.json b/Safari/HelloGoodbye/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Safari/HelloGoodbye/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Safari/HelloGoodbye/Base.lproj/Main.storyboard b/Safari/HelloGoodbye/Base.lproj/Main.storyboard new file mode 100644 index 00000000..7b91efd5 --- /dev/null +++ b/Safari/HelloGoodbye/Base.lproj/Main.storyboard @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Safari/HelloGoodbye/HelloGoodbye.entitlements b/Safari/HelloGoodbye/HelloGoodbye.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/Safari/HelloGoodbye/HelloGoodbye.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Safari/HelloGoodbye/Info.plist b/Safari/HelloGoodbye/Info.plist new file mode 100644 index 00000000..fe03be31 --- /dev/null +++ b/Safari/HelloGoodbye/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2019 Dirk Hulverscheidt. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Safari/HelloGoodbye/ViewController.swift b/Safari/HelloGoodbye/ViewController.swift new file mode 100644 index 00000000..5b16b646 --- /dev/null +++ b/Safari/HelloGoodbye/ViewController.swift @@ -0,0 +1,30 @@ +// +// ViewController.swift +// HelloGoodbye +// +// Created by Bruce Roettgers on 07.04.19. +// Copyright © 2019 Dirk Hulverscheidt. All rights reserved. +// + +import Cocoa +import SafariServices.SFSafariApplication + +class ViewController: NSViewController { + + @IBOutlet var appNameLabel: NSTextField! + + override func viewDidLoad() { + super.viewDidLoad() + self.appNameLabel.stringValue = "HelloGoodbye"; + } + + @IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) { + SFSafariApplication.showPreferencesForExtension(withIdentifier: "hulverscheidtdirk.HelloGoodbye.BlockerExtension") { error in + if let _ = error { + // Insert code to inform the user that something went wrong. + + } + } + } + +}