diff --git a/.gitignore b/.gitignore index 3e6af795..2218adeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,93 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ +# +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + # SwiftLint Remote Config Cache -.swiftlint/RemoteConfigCache \ No newline at end of file +.swiftlint/RemoteConfigCache diff --git a/Model/Player/PlayerTVMenu.swift b/Model/Player/PlayerTVMenu.swift index c7f337bf..2eaf6d31 100644 --- a/Model/Player/PlayerTVMenu.swift +++ b/Model/Player/PlayerTVMenu.swift @@ -36,7 +36,7 @@ extension PlayerModel { } return UIAction( - title: "Restore \(segment.category)", + title: "Restore \(segment.title())", image: UIImage(systemName: "arrow.uturn.left.circle") ) { _ in self.restoreLastSkippedSegment() diff --git a/Model/Segment.swift b/Model/Segment.swift index 7894af10..e21675d8 100644 --- a/Model/Segment.swift +++ b/Model/Segment.swift @@ -13,10 +13,6 @@ class Segment: ObservableObject, Hashable { segment.first! } - var startTime: CMTime { - CMTime(seconds: start, preferredTimescale: 1000) - } - var end: Double { segment.last! } @@ -25,10 +21,6 @@ class Segment: ObservableObject, Hashable { CMTime(seconds: end, preferredTimescale: 1000) } - var duration: Double { - end - start - } - init(category: String, segment: [Double], uuid: String, videoDuration: Int) { self.category = category self.segment = segment diff --git a/Open in Yattee/Info.plist b/Open in Yattee/Info.plist new file mode 100644 index 00000000..9ee504dc --- /dev/null +++ b/Open in Yattee/Info.plist @@ -0,0 +1,13 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.web-extension + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler + + + diff --git a/Open in Yattee/Open in Yattee.entitlements b/Open in Yattee/Open in Yattee.entitlements new file mode 100644 index 00000000..18aff0ce --- /dev/null +++ b/Open in Yattee/Open in Yattee.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Open in Yattee/Resources/images/icon-128.png b/Open in Yattee/Resources/images/icon-128.png new file mode 100644 index 00000000..c919eb00 Binary files /dev/null and b/Open in Yattee/Resources/images/icon-128.png differ diff --git a/Open in Yattee/Resources/images/icon-256.png b/Open in Yattee/Resources/images/icon-256.png new file mode 100644 index 00000000..6bd3d206 Binary files /dev/null and b/Open in Yattee/Resources/images/icon-256.png differ diff --git a/Open in Yattee/Resources/images/icon-48.png b/Open in Yattee/Resources/images/icon-48.png new file mode 100644 index 00000000..353e8fbd Binary files /dev/null and b/Open in Yattee/Resources/images/icon-48.png differ diff --git a/Open in Yattee/Resources/images/icon-512.png b/Open in Yattee/Resources/images/icon-512.png new file mode 100644 index 00000000..2200828b Binary files /dev/null and b/Open in Yattee/Resources/images/icon-512.png differ diff --git a/Open in Yattee/Resources/images/icon-64.png b/Open in Yattee/Resources/images/icon-64.png new file mode 100644 index 00000000..995689f7 Binary files /dev/null and b/Open in Yattee/Resources/images/icon-64.png differ diff --git a/Open in Yattee/Resources/images/icon-96.png b/Open in Yattee/Resources/images/icon-96.png new file mode 100644 index 00000000..cb079d20 Binary files /dev/null and b/Open in Yattee/Resources/images/icon-96.png differ diff --git a/Open in Yattee/Resources/images/toolbar-icon-16.png b/Open in Yattee/Resources/images/toolbar-icon-16.png new file mode 100644 index 00000000..ad014f6e Binary files /dev/null and b/Open in Yattee/Resources/images/toolbar-icon-16.png differ diff --git a/Open in Yattee/Resources/images/toolbar-icon-19.png b/Open in Yattee/Resources/images/toolbar-icon-19.png new file mode 100644 index 00000000..33eb01e7 Binary files /dev/null and b/Open in Yattee/Resources/images/toolbar-icon-19.png differ diff --git a/Open in Yattee/Resources/images/toolbar-icon-32.png b/Open in Yattee/Resources/images/toolbar-icon-32.png new file mode 100644 index 00000000..a71914b0 Binary files /dev/null and b/Open in Yattee/Resources/images/toolbar-icon-32.png differ diff --git a/Open in Yattee/Resources/images/toolbar-icon-38.png b/Open in Yattee/Resources/images/toolbar-icon-38.png new file mode 100644 index 00000000..990e7f41 Binary files /dev/null and b/Open in Yattee/Resources/images/toolbar-icon-38.png differ diff --git a/Open in Yattee/Resources/manifest.json b/Open in Yattee/Resources/manifest.json new file mode 100644 index 00000000..0fc7a575 --- /dev/null +++ b/Open in Yattee/Resources/manifest.json @@ -0,0 +1,36 @@ +{ + "manifest_version": 2, + "default_locale": "en", + + "name": "Open in Yattee", + "description": "Open YouTube videos in Yattee app", + "version": "1.0", + + "icons": { + "48": "images/icon-48.png", + "96": "images/icon-96.png", + "128": "images/icon-128.png", + "256": "images/icon-256.png", + "512": "images/icon-512.png" + }, + "content_scripts": [{ + "js": [ "content.js" ], + "matches": [ + "*://*.youtube-nocookie.com/*", + "*://*.youtube.com/*", + "*://*.youtu.be/*" + ] + }], + + "browser_action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/toolbar-icon-16.png", + "19": "images/toolbar-icon-19.png", + "32": "images/toolbar-icon-32.png", + "38": "images/toolbar-icon-38.png" + } + }, + + "permissions": [ ] +} diff --git a/Open in Yattee/Resources/popup.css b/Open in Yattee/Resources/popup.css new file mode 100644 index 00000000..5b149b9e --- /dev/null +++ b/Open in Yattee/Resources/popup.css @@ -0,0 +1,15 @@ +:root { + color-scheme: light dark; +} + +body { + width: 100px; + padding: 10px; + + font-family: system-ui; + text-align: center; +} + +@media (prefers-color-scheme: dark) { + /* Dark Mode styles go here. */ +} diff --git a/Open in Yattee/Resources/popup.html b/Open in Yattee/Resources/popup.html new file mode 100644 index 00000000..ac523193 --- /dev/null +++ b/Open in Yattee/Resources/popup.html @@ -0,0 +1,11 @@ + + + + + + + + + Hello World! + + diff --git a/Open in Yattee/Resources/popup.js b/Open in Yattee/Resources/popup.js new file mode 100644 index 00000000..5c1aa869 --- /dev/null +++ b/Open in Yattee/Resources/popup.js @@ -0,0 +1 @@ +console.log("Hello World!", browser); diff --git a/Open in Yattee/SafariWebExtensionHandler.swift b/Open in Yattee/SafariWebExtensionHandler.swift new file mode 100644 index 00000000..0802eadb --- /dev/null +++ b/Open in Yattee/SafariWebExtensionHandler.swift @@ -0,0 +1,15 @@ +import os.log +import SafariServices + +final class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { + func beginRequest(with context: NSExtensionContext) { + let item = context.inputItems[0] as! NSExtensionItem + let message = item.userInfo?[SFExtensionMessageKey] + os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg) + + let response = NSExtensionItem() + response.userInfo = [SFExtensionMessageKey: ["Response to": message]] + + context.completeRequest(returningItems: [response], completionHandler: nil) + } +} diff --git a/Open in Yattee/content.js b/Open in Yattee/content.js new file mode 100644 index 00000000..3a646afc --- /dev/null +++ b/Open in Yattee/content.js @@ -0,0 +1,26 @@ +if (document.readyState !== 'complete') { + window.addEventListener('load', redirectAndReplaceContentWithLink); +} else { + redirectAndReplaceContentWithLink(); +} + +function yatteeUrl() { + return window.location.href.replace(/^https?:\/\//, 'yattee://'); +} + +function yatteeLink() { + return 'Open in Yattee'; +} + +function redirect() { + window.location.href = yatteeUrl() +} + +function replaceContentWithLink() { + document.querySelector('body').innerHTML = yatteeLink(); +} + +function redirectAndReplaceContentWithLink(){ + redirect() + replaceContentWithLink() +} diff --git a/Pearvidious.xcodeproj/project.pbxproj b/Pearvidious.xcodeproj/project.pbxproj index f45bd28b..2c480aed 100644 --- a/Pearvidious.xcodeproj/project.pbxproj +++ b/Pearvidious.xcodeproj/project.pbxproj @@ -7,6 +7,17 @@ objects = { /* Begin PBXAggregateTarget section */ + 37A3B19C27258492000FB5EE /* Periphery (iOS) */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 37A3B19D27258492000FB5EE /* Build configuration list for PBXAggregateTarget "Periphery (iOS)" */; + buildPhases = ( + 37A3B1A0272584A6000FB5EE /* ShellScript */, + ); + dependencies = ( + ); + name = "Periphery (iOS)"; + productName = "Periphery (iOS)"; + }; 37FD43E62704A2240073EE42 /* Periphery (macOS) */ = { isa = PBXAggregateTarget; buildConfigurationList = 37FD43E72704A2240073EE42 /* Build configuration list for PBXAggregateTarget "Periphery (macOS)" */; @@ -201,6 +212,22 @@ 379775932689365600DD52A8 /* Array+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379775922689365600DD52A8 /* Array+Next.swift */; }; 379775942689365600DD52A8 /* Array+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379775922689365600DD52A8 /* Array+Next.swift */; }; 379775952689365600DD52A8 /* Array+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 379775922689365600DD52A8 /* Array+Next.swift */; }; + 37A3B15A27255E7F000FB5EE /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A3B15927255E7F000FB5EE /* SafariWebExtensionHandler.swift */; }; + 37A3B15F27255E7F000FB5EE /* images in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B15E27255E7F000FB5EE /* images */; }; + 37A3B16127255E7F000FB5EE /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16027255E7F000FB5EE /* manifest.json */; }; + 37A3B16527255E7F000FB5EE /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16427255E7F000FB5EE /* content.js */; }; + 37A3B16727255E7F000FB5EE /* popup.html in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16627255E7F000FB5EE /* popup.html */; }; + 37A3B16927255E7F000FB5EE /* popup.css in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16827255E7F000FB5EE /* popup.css */; }; + 37A3B16B27255E7F000FB5EE /* popup.js in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16A27255E7F000FB5EE /* popup.js */; }; + 37A3B17027255E7F000FB5EE /* Open in Yattee (macOS).appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 37A3B15727255E7F000FB5EE /* Open in Yattee (macOS).appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 37A3B18F2725735F000FB5EE /* Open in Yattee (iOS).appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 37A3B1792725735F000FB5EE /* Open in Yattee (iOS).appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 37A3B194272574FB000FB5EE /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A3B15927255E7F000FB5EE /* SafariWebExtensionHandler.swift */; }; + 37A3B19627257503000FB5EE /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16427255E7F000FB5EE /* content.js */; }; + 37A3B1972725750B000FB5EE /* popup.js in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16A27255E7F000FB5EE /* popup.js */; }; + 37A3B1982725750B000FB5EE /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16027255E7F000FB5EE /* manifest.json */; }; + 37A3B1992725750B000FB5EE /* popup.html in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16627255E7F000FB5EE /* popup.html */; }; + 37A3B19A2725750B000FB5EE /* popup.css in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B16827255E7F000FB5EE /* popup.css */; }; + 37A3B19B2725750F000FB5EE /* images in Resources */ = {isa = PBXBuildFile; fileRef = 37A3B15E27255E7F000FB5EE /* images */; }; 37A9965A26D6F8CA006E3224 /* HorizontalCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A9965926D6F8CA006E3224 /* HorizontalCells.swift */; }; 37A9965B26D6F8CA006E3224 /* HorizontalCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A9965926D6F8CA006E3224 /* HorizontalCells.swift */; }; 37A9965C26D6F8CA006E3224 /* HorizontalCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37A9965926D6F8CA006E3224 /* HorizontalCells.swift */; }; @@ -387,6 +414,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 37A3B16E27255E7F000FB5EE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 37D4B0BD2671614700C925CA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 37A3B15627255E7F000FB5EE; + remoteInfo = "Open in Yattee"; + }; + 37A3B18D2725735F000FB5EE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 37D4B0BD2671614700C925CA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 37A3B1782725735F000FB5EE; + remoteInfo = "Open in Yattee"; + }; 37D4B0D52671614900C925CA /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 37D4B0BD2671614700C925CA /* Project object */; @@ -410,6 +451,31 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 37A3B17127255E7F000FB5EE /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 37A3B17027255E7F000FB5EE /* Open in Yattee (macOS).appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; + 37A3B1932725735F000FB5EE /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 37A3B18F2725735F000FB5EE /* Open in Yattee (iOS).appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 3700155A271B0D4D0049C794 /* PipedAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PipedAPI.swift; sourceTree = ""; }; 3700155E271B12DD0049C794 /* SiestaConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiestaConfiguration.swift; sourceTree = ""; }; @@ -469,6 +535,17 @@ 3797758A2689345500DD52A8 /* Store.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Store.swift; sourceTree = ""; }; 379775922689365600DD52A8 /* Array+Next.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Next.swift"; sourceTree = ""; }; 37992DC726CC50BC003D4C27 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 37A3B15727255E7F000FB5EE /* Open in Yattee (macOS).appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Open in Yattee (macOS).appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + 37A3B15927255E7F000FB5EE /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; + 37A3B15E27255E7F000FB5EE /* images */ = {isa = PBXFileReference; lastKnownFileType = folder; path = images; sourceTree = ""; }; + 37A3B16027255E7F000FB5EE /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = manifest.json; sourceTree = ""; }; + 37A3B16427255E7F000FB5EE /* content.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = content.js; sourceTree = ""; }; + 37A3B16627255E7F000FB5EE /* popup.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = popup.html; sourceTree = ""; }; + 37A3B16827255E7F000FB5EE /* popup.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = popup.css; sourceTree = ""; }; + 37A3B16A27255E7F000FB5EE /* popup.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = popup.js; sourceTree = ""; }; + 37A3B16C27255E7F000FB5EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 37A3B16D27255E7F000FB5EE /* Open in Yattee.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Open in Yattee.entitlements"; sourceTree = ""; }; + 37A3B1792725735F000FB5EE /* Open in Yattee (iOS).appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Open in Yattee (iOS).appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 37A9965926D6F8CA006E3224 /* HorizontalCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HorizontalCells.swift; sourceTree = ""; }; 37A9965D26D6F9B9006E3224 /* WatchNowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchNowView.swift; sourceTree = ""; }; 37AAF27D26737323007FC770 /* PopularView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularView.swift; sourceTree = ""; }; @@ -547,6 +624,20 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 37A3B15427255E7F000FB5EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 37A3B1762725735F000FB5EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 37D4B0C62671614900C925CA /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -811,6 +902,30 @@ path = iOS; sourceTree = ""; }; + 37A3B15827255E7F000FB5EE /* Open in Yattee */ = { + isa = PBXGroup; + children = ( + 37A3B15B27255E7F000FB5EE /* Resources */, + 37A3B16427255E7F000FB5EE /* content.js */, + 37A3B16C27255E7F000FB5EE /* Info.plist */, + 37A3B16D27255E7F000FB5EE /* Open in Yattee.entitlements */, + 37A3B15927255E7F000FB5EE /* SafariWebExtensionHandler.swift */, + ); + path = "Open in Yattee"; + sourceTree = ""; + }; + 37A3B15B27255E7F000FB5EE /* Resources */ = { + isa = PBXGroup; + children = ( + 37A3B15E27255E7F000FB5EE /* images */, + 37A3B16027255E7F000FB5EE /* manifest.json */, + 37A3B16627255E7F000FB5EE /* popup.html */, + 37A3B16827255E7F000FB5EE /* popup.css */, + 37A3B16A27255E7F000FB5EE /* popup.js */, + ); + path = Resources; + sourceTree = ""; + }; 37BA796C26DC4105002A0235 /* Extensions */ = { isa = PBXGroup; children = ( @@ -854,6 +969,7 @@ 37D4B1B72672CFE300C925CA /* Model */, 37C7A9022679058300E721B4 /* Extensions */, 3748186426A762300084E870 /* Fixtures */, + 37A3B15827255E7F000FB5EE /* Open in Yattee */, 377FC7D1267A080300A6BBAF /* Frameworks */, 37D4B0CA2671614900C925CA /* Products */, 37D4B174267164B000C925CA /* Tests Apple TV */, @@ -896,6 +1012,8 @@ 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */, 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */, 37D4B171267164B000C925CA /* Tests (tvOS).xctest */, + 37A3B15727255E7F000FB5EE /* Open in Yattee (macOS).appex */, + 37A3B1792725735F000FB5EE /* Open in Yattee (iOS).appex */, ); name = Products; sourceTree = ""; @@ -994,6 +1112,40 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 37A3B15627255E7F000FB5EE /* Open in Yattee (macOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 37A3B17427255E7F000FB5EE /* Build configuration list for PBXNativeTarget "Open in Yattee (macOS)" */; + buildPhases = ( + 37A3B15327255E7F000FB5EE /* Sources */, + 37A3B15427255E7F000FB5EE /* Frameworks */, + 37A3B15527255E7F000FB5EE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Open in Yattee (macOS)"; + productName = "Open in Yattee"; + productReference = 37A3B15727255E7F000FB5EE /* Open in Yattee (macOS).appex */; + productType = "com.apple.product-type.app-extension"; + }; + 37A3B1782725735F000FB5EE /* Open in Yattee (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 37A3B1902725735F000FB5EE /* Build configuration list for PBXNativeTarget "Open in Yattee (iOS)" */; + buildPhases = ( + 37A3B1752725735F000FB5EE /* Sources */, + 37A3B1762725735F000FB5EE /* Frameworks */, + 37A3B1772725735F000FB5EE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Open in Yattee (iOS)"; + productName = "Open in Yattee"; + productReference = 37A3B1792725735F000FB5EE /* Open in Yattee (iOS).appex */; + productType = "com.apple.product-type.app-extension"; + }; 37D4B0C82671614900C925CA /* Pearvidious (iOS) */ = { isa = PBXNativeTarget; buildConfigurationList = 37D4B0EC2671614900C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (iOS)" */; @@ -1002,10 +1154,12 @@ 37D4B0C62671614900C925CA /* Frameworks */, 37D4B0C72671614900C925CA /* Resources */, 37CC3F48270CE89B00608308 /* ShellScript */, + 37A3B1932725735F000FB5EE /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + 37A3B18E2725735F000FB5EE /* PBXTargetDependency */, ); name = "Pearvidious (iOS)"; packageProductDependencies = ( @@ -1032,10 +1186,12 @@ 37D4B0CC2671614900C925CA /* Frameworks */, 37D4B0CD2671614900C925CA /* Resources */, 37CC3F4A270CE8D000608308 /* ShellScript */, + 37A3B17127255E7F000FB5EE /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + 37A3B16F27255E7F000FB5EE /* PBXTargetDependency */, ); name = "Pearvidious (macOS)"; packageProductDependencies = ( @@ -1143,9 +1299,18 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1300; + LastSwiftUpdateCheck = 1310; LastUpgradeCheck = 1310; TargetAttributes = { + 37A3B15627255E7F000FB5EE = { + CreatedOnToolsVersion = 13.1; + }; + 37A3B1782725735F000FB5EE = { + CreatedOnToolsVersion = 13.1; + }; + 37A3B19C27258492000FB5EE = { + CreatedOnToolsVersion = 13.1; + }; 37D4B0C82671614900C925CA = { CreatedOnToolsVersion = 13.0; }; @@ -1203,16 +1368,45 @@ 37D4B0C82671614900C925CA /* Pearvidious (iOS) */, 37D4B0CE2671614900C925CA /* Pearvidious (macOS) */, 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */, + 37A3B1782725735F000FB5EE /* Open in Yattee (iOS) */, + 37A3B15627255E7F000FB5EE /* Open in Yattee (macOS) */, + 37A3B19C27258492000FB5EE /* Periphery (iOS) */, + 37FD43E62704A2240073EE42 /* Periphery (macOS) */, + 37FD43EB2704A7710073EE42 /* Periphery (tvOS) */, 37D4B0D32671614900C925CA /* Tests (iOS) */, 37D4B0DD2671614900C925CA /* Tests (macOS) */, 37D4B170267164B000C925CA /* Tests (tvOS) */, - 37FD43E62704A2240073EE42 /* Periphery (macOS) */, - 37FD43EB2704A7710073EE42 /* Periphery (tvOS) */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 37A3B15527255E7F000FB5EE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37A3B16927255E7F000FB5EE /* popup.css in Resources */, + 37A3B16727255E7F000FB5EE /* popup.html in Resources */, + 37A3B15F27255E7F000FB5EE /* images in Resources */, + 37A3B16127255E7F000FB5EE /* manifest.json in Resources */, + 37A3B16527255E7F000FB5EE /* content.js in Resources */, + 37A3B16B27255E7F000FB5EE /* popup.js in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 37A3B1772725735F000FB5EE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37A3B1982725750B000FB5EE /* manifest.json in Resources */, + 37A3B1992725750B000FB5EE /* popup.html in Resources */, + 37A3B19A2725750B000FB5EE /* popup.css in Resources */, + 37A3B19627257503000FB5EE /* content.js in Resources */, + 37A3B1972725750B000FB5EE /* popup.js in Resources */, + 37A3B19B2725750F000FB5EE /* images in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 37D4B0C72671614900C925CA /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1262,6 +1456,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 37A3B1A0272584A6000FB5EE /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "periphery scan \\\n --project \"Pearvidious.xcodeproj\" \\\n --schemes \"Pearvidious (iOS)\" \\\n --targets \"Pearvidious (iOS)\" \\\n --retain-objc-accessible \\\n --retain-public \\\n -- -destination \"platform=iOS\\ Simulator,name=iPhone\\ 8,OS=15.0\"\n"; + }; 37CC3F48270CE89B00608308 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1350,6 +1561,22 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 37A3B15327255E7F000FB5EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37A3B15A27255E7F000FB5EE /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 37A3B1752725735F000FB5EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 37A3B194272574FB000FB5EE /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 37D4B0C52671614900C925CA /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1715,6 +1942,16 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 37A3B16F27255E7F000FB5EE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 37A3B15627255E7F000FB5EE /* Open in Yattee (macOS) */; + targetProxy = 37A3B16E27255E7F000FB5EE /* PBXContainerItemProxy */; + }; + 37A3B18E2725735F000FB5EE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 37A3B1782725735F000FB5EE /* Open in Yattee (iOS) */; + targetProxy = 37A3B18D2725735F000FB5EE /* PBXContainerItemProxy */; + }; 37D4B0D62671614900C925CA /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 37D4B0C82671614900C925CA /* Pearvidious (iOS) */; @@ -1733,6 +1970,157 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 37A3B17227255E7F000FB5EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CODE_SIGN_ENTITLEMENTS = "Open in Yattee/Open in Yattee.entitlements"; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Open in Yattee/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Open in Yattee"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "net.arekf.Pearvidious.Open-in-Yattee"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 37A3B17327255E7F000FB5EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CODE_SIGN_ENTITLEMENTS = "Open in Yattee/Open in Yattee.entitlements"; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Open in Yattee/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Open in Yattee"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "net.arekf.Pearvidious.Open-in-Yattee"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 37A3B1912725735F000FB5EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Open in Yattee/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Open in Yattee"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "net.arekf.Pearvidious.Open-in-Yattee"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 37A3B1922725735F000FB5EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Open in Yattee/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Open in Yattee"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "net.arekf.Pearvidious.Open-in-Yattee"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 37A3B19E27258492000FB5EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 37A3B19F27258492000FB5EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; 37D4B0EA2671614900C925CA /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1847,6 +2235,7 @@ 37D4B0ED2671614900C925CA /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; @@ -1878,6 +2267,7 @@ 37D4B0EE2671614900C925CA /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; @@ -1910,10 +2300,11 @@ 37D4B0F02671614900C925CA /* 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 = Shared/Pearvidious.entitlements; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -1943,10 +2334,11 @@ 37D4B0F12671614900C925CA /* 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 = Shared/Pearvidious.entitlements; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -2231,6 +2623,33 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 37A3B17427255E7F000FB5EE /* Build configuration list for PBXNativeTarget "Open in Yattee (macOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37A3B17227255E7F000FB5EE /* Debug */, + 37A3B17327255E7F000FB5EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 37A3B1902725735F000FB5EE /* Build configuration list for PBXNativeTarget "Open in Yattee (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37A3B1912725735F000FB5EE /* Debug */, + 37A3B1922725735F000FB5EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 37A3B19D27258492000FB5EE /* Build configuration list for PBXAggregateTarget "Periphery (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37A3B19E27258492000FB5EE /* Debug */, + 37A3B19F27258492000FB5EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 37D4B0C02671614700C925CA /* Build configuration list for PBXProject "Pearvidious" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (iOS).xcscheme b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (iOS).xcscheme new file mode 100644 index 00000000..0e713bc0 --- /dev/null +++ b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (iOS).xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index 15e94d43..00000000 --- a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist b/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index f776532a..00000000 --- a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,109 +0,0 @@ - - - - - SchemeUserState - - Pearvidious (iOS).xcscheme_^#shared#^_ - - orderHint - 1 - - Pearvidious (macOS).xcscheme_^#shared#^_ - - orderHint - 0 - - Pearvidious (tvOS).xcscheme_^#shared#^_ - - orderHint - 2 - - Periphery (iOS).xcscheme_^#shared#^_ - - orderHint - 7 - - Periphery (macOS).xcscheme_^#shared#^_ - - orderHint - 3 - - Periphery (tvOS).xcscheme_^#shared#^_ - - orderHint - 4 - - Playground (Playground) 1.xcscheme - - isShown - - orderHint - 6 - - Playground (Playground) 2.xcscheme - - isShown - - orderHint - 7 - - Playground (Playground) 3.xcscheme - - isShown - - orderHint - 3 - - Playground (Playground) 4.xcscheme - - isShown - - orderHint - 7 - - Playground (Playground) 5.xcscheme - - isShown - - orderHint - 8 - - Playground (Playground).xcscheme - - isShown - - orderHint - 5 - - - SuppressBuildableAutocreation - - 37D4B0CE2671614900C925CA - - primary - - - 37D4B0DD2671614900C925CA - - primary - - - 37D4B157267164AE00C925CA - - primary - - - 37D4B170267164B000C925CA - - primary - - - 37FD43E62704A2240073EE42 - - primary - - - - - diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift index 7757bb09..dd3e00aa 100644 --- a/Shared/Navigation/ContentView.swift +++ b/Shared/Navigation/ContentView.swift @@ -35,9 +35,6 @@ struct ContentView: View { } .onAppear(perform: configure) - .handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"])) - .onOpenURL(perform: handleOpenedURL) - .environmentObject(accounts) .environmentObject(instances) .environmentObject(navigation) @@ -72,6 +69,8 @@ struct ContentView: View { } #endif #if !os(tvOS) + .handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"])) + .onOpenURL(perform: handleOpenedURL) .sheet(isPresented: $navigation.presentingAddToPlaylist) { AddToPlaylistView(video: navigation.videoToAddToPlaylist) .environmentObject(playlists) @@ -118,24 +117,26 @@ struct ContentView: View { navigation.presentingWelcomeScreen = true } - func handleOpenedURL(_ url: URL) { - guard !accounts.current.isNil else { - return - } + #if !os(tvOS) + func handleOpenedURL(_ url: URL) { + guard !accounts.current.isNil else { + return + } - let parser = VideoURLParser(url: url) + let parser = VideoURLParser(url: url) - guard let id = parser.id else { - return - } + guard let id = parser.id else { + return + } - accounts.api.video(id).load().onSuccess { response in - if let video: Video = response.typedContent() { - self.player.playNow(video, at: parser.time) - self.player.presentPlayer() + accounts.api.video(id).load().onSuccess { response in + if let video: Video = response.typedContent() { + self.player.playNow(video, at: parser.time) + self.player.presentPlayer() + } } } - } + #endif } struct ContentView_Previews: PreviewProvider { diff --git a/Shared/PearvidiousApp.swift b/Shared/PearvidiousApp.swift index 046c599e..a43edcc8 100644 --- a/Shared/PearvidiousApp.swift +++ b/Shared/PearvidiousApp.swift @@ -11,8 +11,8 @@ struct PearvidiousApp: App { WindowGroup { ContentView() } - .handlesExternalEvents(matching: Set(["*"])) #if !os(tvOS) + .handlesExternalEvents(matching: Set(["*"])) .commands { SidebarCommands() } diff --git a/Shared/Player/PlaybackBar.swift b/Shared/Player/PlaybackBar.swift index e39cfbcc..8928411b 100644 --- a/Shared/Player/PlaybackBar.swift +++ b/Shared/Player/PlaybackBar.swift @@ -95,16 +95,19 @@ struct PlaybackBar: View { } private var restoreLastSkippedSegmentButton: some View { - Button { - player.restoreLastSkippedSegment() - } label: { - HStack(spacing: 4) { - Image(systemName: "arrow.uturn.left.circle") - Text(player.lastSkipped!.category) - Text("•") + HStack(spacing: 4) { + Button { + player.restoreLastSkippedSegment() + } label: { + HStack(spacing: 4) { + Image(systemName: "arrow.uturn.left.circle") + Text(player.lastSkipped!.title()) + } } + .buttonStyle(.plain) + + Text("•") } - .buttonStyle(.plain) } private var streamControl: some View { diff --git a/Shared/Settings/InstancesSettings.swift b/Shared/Settings/InstancesSettings.swift index 114eca5f..e8fb4845 100644 --- a/Shared/Settings/InstancesSettings.swift +++ b/Shared/Settings/InstancesSettings.swift @@ -5,9 +5,6 @@ struct InstancesSettings: View { @Default(.instances) private var instances @EnvironmentObject private var accounts - @EnvironmentObject private var instancesModel - @EnvironmentObject private var subscriptions - @EnvironmentObject private var playlists @State private var selectedInstanceID: Instance.ID? @State private var selectedAccount: Account? @@ -69,6 +66,5 @@ struct InstancesSettingsView_Previews: PreviewProvider { InstancesSettings() } .frame(width: 400, height: 270) - .environmentObject(InstancesModel()) } } diff --git a/Shared/Videos/HorizontalCells.swift b/Shared/Videos/HorizontalCells.swift index 1e798c76..97404625 100644 --- a/Shared/Videos/HorizontalCells.swift +++ b/Shared/Videos/HorizontalCells.swift @@ -2,10 +2,6 @@ import Defaults import SwiftUI struct HorizontalCells: View { - #if os(iOS) - @Environment(\.verticalSizeClass) private var verticalSizeClass - #endif - var items = [ContentItem]() var body: some View { diff --git a/Shared/Views/SignInRequiredView.swift b/Shared/Views/SignInRequiredView.swift index 774dd29d..43fe259e 100644 --- a/Shared/Views/SignInRequiredView.swift +++ b/Shared/Views/SignInRequiredView.swift @@ -7,10 +7,6 @@ struct SignInRequiredView: View { @EnvironmentObject private var accounts - #if !os(macOS) - @EnvironmentObject private var navigation - #endif - @Default(.instances) private var instances init(title: String, @ViewBuilder content: @escaping () -> Content) { diff --git a/Shared/Views/WelcomeScreen.swift b/Shared/Views/WelcomeScreen.swift index f4b1024b..6b37a468 100644 --- a/Shared/Views/WelcomeScreen.swift +++ b/Shared/Views/WelcomeScreen.swift @@ -5,7 +5,6 @@ struct WelcomeScreen: View { @Environment(\.dismiss) private var dismiss @EnvironmentObject private var accounts - @EnvironmentObject private var navigation @Default(.accounts) private var allAccounts