diff --git a/.gitignore b/.gitignore index f56d8479..fc3a9f79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -dist -# Created by https://www.toptal.com/developers/gitignore/api/node,macos,windows,linux,webstorm,visualstudiocode -# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,windows,linux,webstorm,visualstudiocode +# Created by https://www.toptal.com/developers/gitignore/api/node,linux,macos,windows,webstorm,visualstudiocode,xcode +# Edit at https://www.toptal.com/developers/gitignore?templates=node,linux,macos,windows,webstorm,visualstudiocode,xcode ### Linux ### *~ @@ -219,7 +218,6 @@ dist .idea/**/usage.statistics.xml .idea/**/dictionaries .idea/**/shelf -.idea # AWS User-specific .idea/**/aws.xml @@ -323,8 +321,6 @@ fabric.properties # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij .idea/**/azureSettings.xml -.idea/**/*.xml - ### Windows ### # Windows thumbnail cache files Thumbs.db @@ -351,4 +347,21 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.toptal.com/developers/gitignore/api/node,macos,windows,linux,webstorm,visualstudiocode +### Xcode ### +## User settings +xcuserdata/ + +## Xcode 8 and earlier +*.xcscmblueprint +*.xccheckout + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcodeproj/project.xcworkspace/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno +**/xcshareddata/WorkspaceSettings.xcsettings + +# End of https://www.toptal.com/developers/gitignore/api/node,linux,macos,windows,webstorm,visualstudiocode,xcode diff --git a/safari/README.md b/safari/README.md new file mode 100644 index 00000000..8657d197 --- /dev/null +++ b/safari/README.md @@ -0,0 +1,38 @@ +## Building + +This belongs in `package.json`. Later. + +```sh +❯ # `npm run dev` does not work, hot module reloading is broken in Safari + +❯ npm run build + +❯ xcodebuild -scheme RowsX -configuration Release -project ./safari/RowsX/RowsX.xcodeproj/ +``` + +## Safari extension development for Chrome developers + +Official, [long version](https://developer.apple.com/documentation/safariservices/safari_web_extensions/running_your_safari_web_extension#3744467). + +### Developer mode toggle on chrome://extensions/ + +For Safari > 17.0 + +1. Safari > Settings... +2. `Advanced` tab +3. Check `Show features for web developers` at bottom +4. `Developer` tab +5. Check `Extensions: Allow unsigned extensions` at bottom + +### Inspect views service worker + +Develop > Web Extension Background Content > RowsX Personal + +### Reloading + +The `xcodebuild` command reloads the extension automatically. + +Indicators that it has reloaded: + +- The Inspector window will close +- If you have `RowsX` selected in the Extensions tab of Preferences, it will deselect diff --git a/safari/RowsX/RowsX Extension/Info.plist b/safari/RowsX/RowsX Extension/Info.plist new file mode 100644 index 00000000..9ee504dc --- /dev/null +++ b/safari/RowsX/RowsX Extension/Info.plist @@ -0,0 +1,13 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.web-extension + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler + + + diff --git a/safari/RowsX/RowsX Extension/RowsX_Extension.entitlements b/safari/RowsX/RowsX Extension/RowsX_Extension.entitlements new file mode 100644 index 00000000..f2ef3ae0 --- /dev/null +++ b/safari/RowsX/RowsX Extension/RowsX_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/safari/RowsX/RowsX Extension/SafariWebExtensionHandler.swift b/safari/RowsX/RowsX Extension/SafariWebExtensionHandler.swift new file mode 100644 index 00000000..e7bd7bbf --- /dev/null +++ b/safari/RowsX/RowsX Extension/SafariWebExtensionHandler.swift @@ -0,0 +1,38 @@ +// +// SafariWebExtensionHandler.swift +// RowsX Extension +// +// Created by rusty on 4/23/24. +// + +import SafariServices +import os.log + +class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { + + func beginRequest(with context: NSExtensionContext) { + let request = context.inputItems.first as? NSExtensionItem + + let profile: UUID? + if #available(iOS 17.0, macOS 14.0, *) { + profile = request?.userInfo?[SFExtensionProfileKey] as? UUID + } else { + profile = request?.userInfo?["profile"] as? UUID + } + + let message: Any? + if #available(iOS 17.0, macOS 14.0, *) { + message = request?.userInfo?[SFExtensionMessageKey] + } else { + message = request?.userInfo?["message"] + } + + os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)", String(describing: message), profile?.uuidString ?? "none") + + let response = NSExtensionItem() + response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ] + + context.completeRequest(returningItems: [ response ], completionHandler: nil) + } + +} diff --git a/safari/RowsX/RowsX.xcodeproj/project.pbxproj b/safari/RowsX/RowsX.xcodeproj/project.pbxproj new file mode 100644 index 00000000..b1ee5a2a --- /dev/null +++ b/safari/RowsX/RowsX.xcodeproj/project.pbxproj @@ -0,0 +1,612 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + D3AF21282BD8371B00828FB0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AF21272BD8371B00828FB0 /* AppDelegate.swift */; }; + D3AF212C2BD8371B00828FB0 /* Main.html in Resources */ = {isa = PBXBuildFile; fileRef = D3AF212A2BD8371B00828FB0 /* Main.html */; }; + D3AF212E2BD8371B00828FB0 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = D3AF212D2BD8371B00828FB0 /* Icon.png */; }; + D3AF21302BD8371B00828FB0 /* Style.css in Resources */ = {isa = PBXBuildFile; fileRef = D3AF212F2BD8371B00828FB0 /* Style.css */; }; + D3AF21322BD8371B00828FB0 /* Script.js in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21312BD8371B00828FB0 /* Script.js */; }; + D3AF21342BD8371B00828FB0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AF21332BD8371B00828FB0 /* ViewController.swift */; }; + D3AF21372BD8371B00828FB0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21352BD8371B00828FB0 /* Main.storyboard */; }; + D3AF21392BD8371C00828FB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21382BD8371C00828FB0 /* Assets.xcassets */; }; + D3AF21422BD8371D00828FB0 /* RowsX Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = D3AF21412BD8371D00828FB0 /* RowsX Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + D3AF21472BD8371D00828FB0 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3AF21462BD8371D00828FB0 /* SafariWebExtensionHandler.swift */; }; + D3AF215D2BD8371D00828FB0 /* service-worker-loader.js in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21542BD8371D00828FB0 /* service-worker-loader.js */; }; + D3AF215E2BD8371D00828FB0 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21552BD8371D00828FB0 /* index.html */; }; + D3AF215F2BD8371D00828FB0 /* empty.svg in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21562BD8371D00828FB0 /* empty.svg */; }; + D3AF21602BD8371D00828FB0 /* app_icons in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21572BD8371D00828FB0 /* app_icons */; }; + D3AF21612BD8371D00828FB0 /* icons in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21582BD8371D00828FB0 /* icons */; }; + D3AF21622BD8371D00828FB0 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = D3AF21592BD8371D00828FB0 /* manifest.json */; }; + D3AF21632BD8371D00828FB0 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3AF215A2BD8371D00828FB0 /* fonts */; }; + D3AF21642BD8371D00828FB0 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = D3AF215B2BD8371D00828FB0 /* assets */; }; + D3AF21652BD8371D00828FB0 /* logo.svg in Resources */ = {isa = PBXBuildFile; fileRef = D3AF215C2BD8371D00828FB0 /* logo.svg */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D3AF21432BD8371D00828FB0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D3AF211C2BD8371B00828FB0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D3AF21402BD8371D00828FB0; + remoteInfo = "RowsX Extension"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D3AF214F2BD8371D00828FB0 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + D3AF21422BD8371D00828FB0 /* RowsX Extension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + D3AF21242BD8371B00828FB0 /* RowsX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RowsX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3AF21272BD8371B00828FB0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + D3AF212B2BD8371B00828FB0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = Base; path = ../Base.lproj/Main.html; sourceTree = ""; }; + D3AF212D2BD8371B00828FB0 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + D3AF212F2BD8371B00828FB0 /* Style.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = Style.css; sourceTree = ""; }; + D3AF21312BD8371B00828FB0 /* Script.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Script.js; sourceTree = ""; }; + D3AF21332BD8371B00828FB0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + D3AF21362BD8371B00828FB0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + D3AF21382BD8371C00828FB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + D3AF213A2BD8371C00828FB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D3AF213B2BD8371C00828FB0 /* RowsX.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RowsX.entitlements; sourceTree = ""; }; + D3AF213C2BD8371C00828FB0 /* RowsX.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RowsX.entitlements; sourceTree = ""; }; + D3AF21412BD8371D00828FB0 /* RowsX Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "RowsX Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + D3AF21462BD8371D00828FB0 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; + D3AF21482BD8371D00828FB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D3AF21492BD8371D00828FB0 /* RowsX_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RowsX_Extension.entitlements; sourceTree = ""; }; + D3AF21542BD8371D00828FB0 /* service-worker-loader.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = "service-worker-loader.js"; path = "../../../dist/service-worker-loader.js"; sourceTree = ""; }; + D3AF21552BD8371D00828FB0 /* index.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = index.html; path = ../../../dist/index.html; sourceTree = ""; }; + D3AF21562BD8371D00828FB0 /* empty.svg */ = {isa = PBXFileReference; lastKnownFileType = text; name = empty.svg; path = ../../../dist/empty.svg; sourceTree = ""; }; + D3AF21572BD8371D00828FB0 /* app_icons */ = {isa = PBXFileReference; lastKnownFileType = folder; name = app_icons; path = ../../../dist/app_icons; sourceTree = ""; }; + D3AF21582BD8371D00828FB0 /* icons */ = {isa = PBXFileReference; lastKnownFileType = folder; name = icons; path = ../../../dist/icons; sourceTree = ""; }; + D3AF21592BD8371D00828FB0 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = manifest.json; path = ../../../dist/manifest.json; sourceTree = ""; }; + D3AF215A2BD8371D00828FB0 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../dist/fonts; sourceTree = ""; }; + D3AF215B2BD8371D00828FB0 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../../../dist/assets; sourceTree = ""; }; + D3AF215C2BD8371D00828FB0 /* logo.svg */ = {isa = PBXFileReference; lastKnownFileType = text; name = logo.svg; path = ../../../dist/logo.svg; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D3AF21212BD8371B00828FB0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3AF213E2BD8371D00828FB0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D3AF211B2BD8371B00828FB0 = { + isa = PBXGroup; + children = ( + D3AF21262BD8371B00828FB0 /* RowsX */, + D3AF21452BD8371D00828FB0 /* RowsX Extension */, + D3AF21252BD8371B00828FB0 /* Products */, + ); + sourceTree = ""; + }; + D3AF21252BD8371B00828FB0 /* Products */ = { + isa = PBXGroup; + children = ( + D3AF21242BD8371B00828FB0 /* RowsX.app */, + D3AF21412BD8371D00828FB0 /* RowsX Extension.appex */, + ); + name = Products; + sourceTree = ""; + }; + D3AF21262BD8371B00828FB0 /* RowsX */ = { + isa = PBXGroup; + children = ( + D3AF21272BD8371B00828FB0 /* AppDelegate.swift */, + D3AF21332BD8371B00828FB0 /* ViewController.swift */, + D3AF21352BD8371B00828FB0 /* Main.storyboard */, + D3AF21382BD8371C00828FB0 /* Assets.xcassets */, + D3AF213A2BD8371C00828FB0 /* Info.plist */, + D3AF213B2BD8371C00828FB0 /* RowsX.entitlements */, + D3AF213C2BD8371C00828FB0 /* RowsX.entitlements */, + D3AF21292BD8371B00828FB0 /* Resources */, + ); + path = RowsX; + sourceTree = ""; + }; + D3AF21292BD8371B00828FB0 /* Resources */ = { + isa = PBXGroup; + children = ( + D3AF212A2BD8371B00828FB0 /* Main.html */, + D3AF212D2BD8371B00828FB0 /* Icon.png */, + D3AF212F2BD8371B00828FB0 /* Style.css */, + D3AF21312BD8371B00828FB0 /* Script.js */, + ); + path = Resources; + sourceTree = ""; + }; + D3AF21452BD8371D00828FB0 /* RowsX Extension */ = { + isa = PBXGroup; + children = ( + D3AF21532BD8371D00828FB0 /* Resources */, + D3AF21462BD8371D00828FB0 /* SafariWebExtensionHandler.swift */, + D3AF21482BD8371D00828FB0 /* Info.plist */, + D3AF21492BD8371D00828FB0 /* RowsX_Extension.entitlements */, + ); + path = "RowsX Extension"; + sourceTree = ""; + }; + D3AF21532BD8371D00828FB0 /* Resources */ = { + isa = PBXGroup; + children = ( + D3AF21542BD8371D00828FB0 /* service-worker-loader.js */, + D3AF21552BD8371D00828FB0 /* index.html */, + D3AF21562BD8371D00828FB0 /* empty.svg */, + D3AF21572BD8371D00828FB0 /* app_icons */, + D3AF21582BD8371D00828FB0 /* icons */, + D3AF21592BD8371D00828FB0 /* manifest.json */, + D3AF215A2BD8371D00828FB0 /* fonts */, + D3AF215B2BD8371D00828FB0 /* assets */, + D3AF215C2BD8371D00828FB0 /* logo.svg */, + ); + name = Resources; + path = "RowsX Extension"; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D3AF21232BD8371B00828FB0 /* RowsX */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3AF21502BD8371D00828FB0 /* Build configuration list for PBXNativeTarget "RowsX" */; + buildPhases = ( + D3AF21202BD8371B00828FB0 /* Sources */, + D3AF21212BD8371B00828FB0 /* Frameworks */, + D3AF21222BD8371B00828FB0 /* Resources */, + D3AF214F2BD8371D00828FB0 /* Embed Foundation Extensions */, + ); + buildRules = ( + ); + dependencies = ( + D3AF21442BD8371D00828FB0 /* PBXTargetDependency */, + ); + name = RowsX; + productName = RowsX; + productReference = D3AF21242BD8371B00828FB0 /* RowsX.app */; + productType = "com.apple.product-type.application"; + }; + D3AF21402BD8371D00828FB0 /* RowsX Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3AF214C2BD8371D00828FB0 /* Build configuration list for PBXNativeTarget "RowsX Extension" */; + buildPhases = ( + D3AF213D2BD8371D00828FB0 /* Sources */, + D3AF213E2BD8371D00828FB0 /* Frameworks */, + D3AF213F2BD8371D00828FB0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "RowsX Extension"; + productName = "RowsX Extension"; + productReference = D3AF21412BD8371D00828FB0 /* RowsX Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D3AF211C2BD8371B00828FB0 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1520; + LastUpgradeCheck = 1520; + TargetAttributes = { + D3AF21232BD8371B00828FB0 = { + CreatedOnToolsVersion = 15.2; + }; + D3AF21402BD8371D00828FB0 = { + CreatedOnToolsVersion = 15.2; + }; + }; + }; + buildConfigurationList = D3AF211F2BD8371B00828FB0 /* Build configuration list for PBXProject "RowsX" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = D3AF211B2BD8371B00828FB0; + productRefGroup = D3AF21252BD8371B00828FB0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D3AF21232BD8371B00828FB0 /* RowsX */, + D3AF21402BD8371D00828FB0 /* RowsX Extension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D3AF21222BD8371B00828FB0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3AF212E2BD8371B00828FB0 /* Icon.png in Resources */, + D3AF21372BD8371B00828FB0 /* Main.storyboard in Resources */, + D3AF21322BD8371B00828FB0 /* Script.js in Resources */, + D3AF212C2BD8371B00828FB0 /* Main.html in Resources */, + D3AF21392BD8371C00828FB0 /* Assets.xcassets in Resources */, + D3AF21302BD8371B00828FB0 /* Style.css in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3AF213F2BD8371D00828FB0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3AF215D2BD8371D00828FB0 /* service-worker-loader.js in Resources */, + D3AF21652BD8371D00828FB0 /* logo.svg in Resources */, + D3AF21642BD8371D00828FB0 /* assets in Resources */, + D3AF21602BD8371D00828FB0 /* app_icons in Resources */, + D3AF215E2BD8371D00828FB0 /* index.html in Resources */, + D3AF21632BD8371D00828FB0 /* fonts in Resources */, + D3AF21612BD8371D00828FB0 /* icons in Resources */, + D3AF21622BD8371D00828FB0 /* manifest.json in Resources */, + D3AF215F2BD8371D00828FB0 /* empty.svg in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D3AF21202BD8371B00828FB0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3AF21342BD8371B00828FB0 /* ViewController.swift in Sources */, + D3AF21282BD8371B00828FB0 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3AF213D2BD8371D00828FB0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3AF21472BD8371D00828FB0 /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D3AF21442BD8371D00828FB0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D3AF21402BD8371D00828FB0 /* RowsX Extension */; + targetProxy = D3AF21432BD8371D00828FB0 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + D3AF212A2BD8371B00828FB0 /* Main.html */ = { + isa = PBXVariantGroup; + children = ( + D3AF212B2BD8371B00828FB0 /* Base */, + ); + name = Main.html; + sourceTree = ""; + }; + D3AF21352BD8371B00828FB0 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + D3AF21362BD8371B00828FB0 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + D3AF214A2BD8371D00828FB0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + D3AF214B2BD8371D00828FB0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + D3AF214D2BD8371D00828FB0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "RowsX Extension/RowsX_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "RowsX Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "RowsX Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rows.RowsX.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + D3AF214E2BD8371D00828FB0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "RowsX Extension/RowsX_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "RowsX Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "RowsX Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rows.RowsX.Extension; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + D3AF21512BD8371D00828FB0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = RowsX/RowsX.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = RowsX/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = RowsX; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rows.RowsX; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + D3AF21522BD8371D00828FB0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = RowsX/RowsX.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = RowsX/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = RowsX; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = com.rows.RowsX; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D3AF211F2BD8371B00828FB0 /* Build configuration list for PBXProject "RowsX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3AF214A2BD8371D00828FB0 /* Debug */, + D3AF214B2BD8371D00828FB0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D3AF214C2BD8371D00828FB0 /* Build configuration list for PBXNativeTarget "RowsX Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3AF214D2BD8371D00828FB0 /* Debug */, + D3AF214E2BD8371D00828FB0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D3AF21502BD8371D00828FB0 /* Build configuration list for PBXNativeTarget "RowsX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3AF21512BD8371D00828FB0 /* Debug */, + D3AF21522BD8371D00828FB0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D3AF211C2BD8371B00828FB0 /* Project object */; +} diff --git a/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/safari/RowsX/RowsX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/safari/RowsX/RowsX/AppDelegate.swift b/safari/RowsX/RowsX/AppDelegate.swift new file mode 100644 index 00000000..cda82108 --- /dev/null +++ b/safari/RowsX/RowsX/AppDelegate.swift @@ -0,0 +1,21 @@ +// +// AppDelegate.swift +// RowsX +// +// Created by rusty on 4/23/24. +// + +import Cocoa + +@main +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ notification: Notification) { + // Override point for customization after application launch. + } + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + +} diff --git a/safari/RowsX/RowsX/Assets.xcassets/AccentColor.colorset/Contents.json b/safari/RowsX/RowsX/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/safari/RowsX/RowsX/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/Contents.json b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..5c2eca5a --- /dev/null +++ b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "mac-icon-16@1x.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "mac-icon-16@2x.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "mac-icon-32@1x.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "mac-icon-32@2x.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "mac-icon-128@1x.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "mac-icon-128@2x.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "mac-icon-256@1x.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "mac-icon-256@2x.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "mac-icon-512@1x.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "mac-icon-512@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png new file mode 100644 index 00000000..1490db24 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png new file mode 100644 index 00000000..57ef7f2b Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png new file mode 100644 index 00000000..78b0940a Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png new file mode 100644 index 00000000..80a9f901 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png new file mode 100644 index 00000000..57ef7f2b Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png new file mode 100644 index 00000000..c3968565 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png new file mode 100644 index 00000000..80a9f901 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png new file mode 100644 index 00000000..fa702729 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png new file mode 100644 index 00000000..c3968565 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png new file mode 100644 index 00000000..3becacc8 Binary files /dev/null and b/safari/RowsX/RowsX/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png differ diff --git a/safari/RowsX/RowsX/Assets.xcassets/Contents.json b/safari/RowsX/RowsX/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/safari/RowsX/RowsX/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/RowsX/RowsX/Assets.xcassets/LargeIcon.imageset/Contents.json b/safari/RowsX/RowsX/Assets.xcassets/LargeIcon.imageset/Contents.json new file mode 100644 index 00000000..a19a5492 --- /dev/null +++ b/safari/RowsX/RowsX/Assets.xcassets/LargeIcon.imageset/Contents.json @@ -0,0 +1,20 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/safari/RowsX/RowsX/Base.lproj/Main.html b/safari/RowsX/RowsX/Base.lproj/Main.html new file mode 100644 index 00000000..98c9abd8 --- /dev/null +++ b/safari/RowsX/RowsX/Base.lproj/Main.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + RowsX Icon +

You can turn on RowsX’s extension in Safari Extensions preferences.

+

RowsX’s extension is currently on. You can turn it off in Safari Extensions preferences.

+

RowsX’s extension is currently off. You can turn it on in Safari Extensions preferences.

+ + + diff --git a/safari/RowsX/RowsX/Base.lproj/Main.storyboard b/safari/RowsX/RowsX/Base.lproj/Main.storyboard new file mode 100644 index 00000000..d7b97243 --- /dev/null +++ b/safari/RowsX/RowsX/Base.lproj/Main.storyboard @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/safari/RowsX/RowsX/Info.plist b/safari/RowsX/RowsX/Info.plist new file mode 100644 index 00000000..98770f0b --- /dev/null +++ b/safari/RowsX/RowsX/Info.plist @@ -0,0 +1,8 @@ + + + + + SFSafariWebExtensionConverterVersion + 15.2 + + diff --git a/safari/RowsX/RowsX/Resources/Icon.png b/safari/RowsX/RowsX/Resources/Icon.png new file mode 100644 index 00000000..9dad833c Binary files /dev/null and b/safari/RowsX/RowsX/Resources/Icon.png differ diff --git a/safari/RowsX/RowsX/Resources/Script.js b/safari/RowsX/RowsX/Resources/Script.js new file mode 100644 index 00000000..42bb0d0b --- /dev/null +++ b/safari/RowsX/RowsX/Resources/Script.js @@ -0,0 +1,22 @@ +function show(enabled, useSettingsInsteadOfPreferences) { + if (useSettingsInsteadOfPreferences) { + document.getElementsByClassName('state-on')[0].innerText = "RowsX’s extension is currently on. You can turn it off in the Extensions section of Safari Settings."; + document.getElementsByClassName('state-off')[0].innerText = "RowsX’s extension is currently off. You can turn it on in the Extensions section of Safari Settings."; + document.getElementsByClassName('state-unknown')[0].innerText = "You can turn on RowsX’s extension in the Extensions section of Safari Settings."; + document.getElementsByClassName('open-preferences')[0].innerText = "Quit and Open Safari Settings…"; + } + + if (typeof enabled === "boolean") { + document.body.classList.toggle(`state-on`, enabled); + document.body.classList.toggle(`state-off`, !enabled); + } else { + document.body.classList.remove(`state-on`); + document.body.classList.remove(`state-off`); + } +} + +function openPreferences() { + webkit.messageHandlers.controller.postMessage("open-preferences"); +} + +document.querySelector("button.open-preferences").addEventListener("click", openPreferences); diff --git a/safari/RowsX/RowsX/Resources/Style.css b/safari/RowsX/RowsX/Resources/Style.css new file mode 100644 index 00000000..cbde9e69 --- /dev/null +++ b/safari/RowsX/RowsX/Resources/Style.css @@ -0,0 +1,45 @@ +* { + -webkit-user-select: none; + -webkit-user-drag: none; + cursor: default; +} + +:root { + color-scheme: light dark; + + --spacing: 20px; +} + +html { + height: 100%; +} + +body { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + gap: var(--spacing); + margin: 0 calc(var(--spacing) * 2); + height: 100%; + + font: -apple-system-short-body; + text-align: center; +} + +body:not(.state-on, .state-off) :is(.state-on, .state-off) { + display: none; +} + +body.state-on :is(.state-off, .state-unknown) { + display: none; +} + +body.state-off :is(.state-on, .state-unknown) { + display: none; +} + +button { + font-size: 1em; +} diff --git a/safari/RowsX/RowsX/RowsX.entitlements b/safari/RowsX/RowsX/RowsX.entitlements new file mode 100644 index 00000000..625af03d --- /dev/null +++ b/safari/RowsX/RowsX/RowsX.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + + diff --git a/safari/RowsX/RowsX/ViewController.swift b/safari/RowsX/RowsX/ViewController.swift new file mode 100644 index 00000000..9b2c50c2 --- /dev/null +++ b/safari/RowsX/RowsX/ViewController.swift @@ -0,0 +1,57 @@ +// +// ViewController.swift +// RowsX +// +// Created by rusty on 4/23/24. +// + +import Cocoa +import SafariServices +import WebKit + +let extensionBundleIdentifier = "com.rows.RowsX.Extension" + +class ViewController: NSViewController, WKNavigationDelegate, WKScriptMessageHandler { + + @IBOutlet var webView: WKWebView! + + override func viewDidLoad() { + super.viewDidLoad() + + self.webView.navigationDelegate = self + + self.webView.configuration.userContentController.add(self, name: "controller") + + self.webView.loadFileURL(Bundle.main.url(forResource: "Main", withExtension: "html")!, allowingReadAccessTo: Bundle.main.resourceURL!) + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + 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 #available(macOS 13, *) { + webView.evaluateJavaScript("show(\(state.isEnabled), true)") + } else { + webView.evaluateJavaScript("show(\(state.isEnabled), false)") + } + } + } + } + + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { + if (message.body as! String != "open-preferences") { + return; + } + + SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in + DispatchQueue.main.async { + NSApplication.shared.terminate(nil) + } + } + } + +}