diff --git a/Model/InvidiousAPI.swift b/Model/InvidiousAPI.swift index d8787d31..4256d495 100644 --- a/Model/InvidiousAPI.swift +++ b/Model/InvidiousAPI.swift @@ -171,10 +171,6 @@ final class InvidiousAPI: Service, ObservableObject { resource(baseURL: account.url, path: "\(InvidiousAPI.basePath)/auth/feed") } - var stats: Resource { - resource(baseURL: account.url, path: basePathAppending("stats")) - } - var subscriptions: Resource { resource(baseURL: account.url, path: basePathAppending("auth/subscriptions")) } diff --git a/Model/NavigationModel.swift b/Model/NavigationModel.swift index b624e4c0..107d8886 100644 --- a/Model/NavigationModel.swift +++ b/Model/NavigationModel.swift @@ -11,8 +11,6 @@ final class NavigationModel: ObservableObject { @Published var showingVideo = false @Published var video: Video? - @Published var returnToDetails = false - @Published var presentingAddToPlaylist = false @Published var videoToAddToPlaylist: Video! diff --git a/Model/RecentsModel.swift b/Model/RecentsModel.swift index f35448cc..4efe50a1 100644 --- a/Model/RecentsModel.swift +++ b/Model/RecentsModel.swift @@ -4,10 +4,6 @@ import Foundation final class RecentsModel: ObservableObject { @Default(.recentlyOpened) var items - var isEmpty: Bool { - items.isEmpty - } - func clear() { items = [] } diff --git a/Model/Stream.swift b/Model/Stream.swift index 6beafaa3..d8b138d2 100644 --- a/Model/Stream.swift +++ b/Model/Stream.swift @@ -87,18 +87,6 @@ class Stream: Equatable, Hashable { assets.dropFirst().allSatisfy { $0 == assets.first } } - var assetsLoaded: Bool { - assets.allSatisfy { $0.statusOfValue(forKey: "playable", error: nil) == .loaded } - } - - var loadedAssets: [AVURLAsset] { - assets.filter { $0.statusOfValue(forKey: "playable", error: nil) == .loaded } - } - - func cancelLoadingAssets() { - assets.forEach { $0.cancelLoading() } - } - static func == (lhs: Stream, rhs: Stream) -> Bool { lhs.resolution == rhs.resolution && lhs.kind == rhs.kind } diff --git a/Pearvidious.xcodeproj/project.pbxproj b/Pearvidious.xcodeproj/project.pbxproj index 36a717d8..e590dae2 100644 --- a/Pearvidious.xcodeproj/project.pbxproj +++ b/Pearvidious.xcodeproj/project.pbxproj @@ -6,6 +6,31 @@ objectVersion = 55; objects = { +/* Begin PBXAggregateTarget section */ + 37FD43E62704A2240073EE42 /* Periphery (macOS) */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 37FD43E72704A2240073EE42 /* Build configuration list for PBXAggregateTarget "Periphery (macOS)" */; + buildPhases = ( + 37FD43EA2704A2350073EE42 /* ShellScript */, + ); + dependencies = ( + ); + name = "Periphery (macOS)"; + productName = "Periphery (Unused code)"; + }; + 37FD43EB2704A7710073EE42 /* Periphery (tvOS) */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 37FD43EC2704A7710073EE42 /* Build configuration list for PBXAggregateTarget "Periphery (tvOS)" */; + buildPhases = ( + 37FD43EF2704A7780073EE42 /* ShellScript */, + ); + dependencies = ( + ); + name = "Periphery (tvOS)"; + productName = "Periphery (iOS)"; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B17F267B4DFB00704544 /* TrendingCountry.swift */; }; 3705B182267B4E4900704544 /* TrendingCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B181267B4E4900704544 /* TrendingCategory.swift */; }; @@ -216,7 +241,6 @@ 37BE0BDC26A2367F0092E2DB /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BE0BDB26A2367F0092E2DB /* Player.swift */; }; 37C194C726F6A9C8005D3B96 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; }; 37C194C826F6A9C8005D3B96 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; }; - 37C194C926F6A9C8005D3B96 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; }; 37C7A1D5267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; }; 37C7A1D6267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; }; 37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; }; @@ -268,6 +292,7 @@ 37FD43E32704847C0073EE42 /* View+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD43E22704847C0073EE42 /* View+Fixtures.swift */; }; 37FD43E42704847C0073EE42 /* View+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD43E22704847C0073EE42 /* View+Fixtures.swift */; }; 37FD43E52704847C0073EE42 /* View+Fixtures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD43E22704847C0073EE42 /* View+Fixtures.swift */; }; + 37FD43F02704A9C00073EE42 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -386,13 +411,13 @@ 37D4B0C42671614800C925CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 37D4B0C92671614900C925CA /* Pearvidious.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pearvidious.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37D4B0CF2671614900C925CA /* Pearvidious.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pearvidious.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 37D4B0D42671614900C925CA /* Tests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 37D4B0D42671614900C925CA /* Tests (iOS).xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests (iOS).xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 37D4B0D82671614900C925CA /* Tests_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_iOS.swift; sourceTree = ""; }; - 37D4B0DE2671614900C925CA /* Tests macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests (macOS).xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 37D4B0E22671614900C925CA /* Tests_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_macOS.swift; sourceTree = ""; }; - 37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Pearvidious (Apple TV).app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Pearvidious (tvOS).app"; sourceTree = BUILT_PRODUCTS_DIR; }; 37D4B15E267164AF00C925CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 37D4B171267164B000C925CA /* Tests Apple TV.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests Apple TV.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 37D4B171267164B000C925CA /* Tests (tvOS).xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests (tvOS).xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 37D4B175267164B000C925CA /* PearvidiousUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PearvidiousUITests.swift; sourceTree = ""; }; 37D4B18B26717B3800C925CA /* VideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoView.swift; sourceTree = ""; }; 37D4B19626717E1500C925CA /* Video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Video.swift; sourceTree = ""; }; @@ -695,10 +720,10 @@ children = ( 37D4B0C92671614900C925CA /* Pearvidious.app */, 37D4B0CF2671614900C925CA /* Pearvidious.app */, - 37D4B0D42671614900C925CA /* Tests iOS.xctest */, - 37D4B0DE2671614900C925CA /* Tests macOS.xctest */, - 37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */, - 37D4B171267164B000C925CA /* Tests Apple TV.xctest */, + 37D4B0D42671614900C925CA /* Tests (iOS).xctest */, + 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */, + 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */, + 37D4B171267164B000C925CA /* Tests (tvOS).xctest */, 37BA796326DC40CB002A0235 /* Shared Tests.xctest */, ); name = Products; @@ -849,9 +874,9 @@ productReference = 37D4B0CF2671614900C925CA /* Pearvidious.app */; productType = "com.apple.product-type.application"; }; - 37D4B0D32671614900C925CA /* Tests iOS */ = { + 37D4B0D32671614900C925CA /* Tests (iOS) */ = { isa = PBXNativeTarget; - buildConfigurationList = 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests iOS" */; + buildConfigurationList = 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (iOS)" */; buildPhases = ( 37D4B0D02671614900C925CA /* Sources */, 37D4B0D12671614900C925CA /* Frameworks */, @@ -862,14 +887,14 @@ dependencies = ( 37D4B0D62671614900C925CA /* PBXTargetDependency */, ); - name = "Tests iOS"; + name = "Tests (iOS)"; productName = "Tests iOS"; - productReference = 37D4B0D42671614900C925CA /* Tests iOS.xctest */; + productReference = 37D4B0D42671614900C925CA /* Tests (iOS).xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; - 37D4B0DD2671614900C925CA /* Tests macOS */ = { + 37D4B0DD2671614900C925CA /* Tests (macOS) */ = { isa = PBXNativeTarget; - buildConfigurationList = 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests macOS" */; + buildConfigurationList = 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (macOS)" */; buildPhases = ( 37D4B0DA2671614900C925CA /* Sources */, 37D4B0DB2671614900C925CA /* Frameworks */, @@ -880,14 +905,14 @@ dependencies = ( 37D4B0E02671614900C925CA /* PBXTargetDependency */, ); - name = "Tests macOS"; + name = "Tests (macOS)"; productName = "Tests macOS"; - productReference = 37D4B0DE2671614900C925CA /* Tests macOS.xctest */; + productReference = 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; - 37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */ = { + 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */ = { isa = PBXNativeTarget; - buildConfigurationList = 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (Apple TV)" */; + buildConfigurationList = 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (tvOS)" */; buildPhases = ( 37D4B154267164AE00C925CA /* Sources */, 37D4B155267164AE00C925CA /* Frameworks */, @@ -897,7 +922,7 @@ ); dependencies = ( ); - name = "Pearvidious (Apple TV)"; + name = "Pearvidious (tvOS)"; packageProductDependencies = ( 37D4B19C2671817900C925CA /* SwiftyJSON */, 37B767DF2678C5BF0098BAA8 /* Logging */, @@ -906,12 +931,12 @@ 37BADCA8269A570B009BE4FB /* Alamofire */, ); productName = Pearvidious; - productReference = 37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */; + productReference = 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */; productType = "com.apple.product-type.application"; }; - 37D4B170267164B000C925CA /* Tests Apple TV */ = { + 37D4B170267164B000C925CA /* Tests (tvOS) */ = { isa = PBXNativeTarget; - buildConfigurationList = 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests Apple TV" */; + buildConfigurationList = 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests (tvOS)" */; buildPhases = ( 37D4B16D267164B000C925CA /* Sources */, 37D4B16E267164B000C925CA /* Frameworks */, @@ -922,9 +947,9 @@ dependencies = ( 37D4B173267164B000C925CA /* PBXTargetDependency */, ); - name = "Tests Apple TV"; + name = "Tests (tvOS)"; productName = PearvidiousUITests; - productReference = 37D4B171267164B000C925CA /* Tests Apple TV.xctest */; + productReference = 37D4B171267164B000C925CA /* Tests (tvOS).xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; /* End PBXNativeTarget section */ @@ -962,6 +987,12 @@ CreatedOnToolsVersion = 13.0; TestTargetID = 37D4B157267164AE00C925CA; }; + 37FD43E62704A2240073EE42 = { + CreatedOnToolsVersion = 13.0; + }; + 37FD43EB2704A7710073EE42 = { + CreatedOnToolsVersion = 13.0; + }; }; }; buildConfigurationList = 37D4B0C02671614700C925CA /* Build configuration list for PBXProject "Pearvidious" */; @@ -987,11 +1018,13 @@ targets = ( 37D4B0C82671614900C925CA /* Pearvidious (iOS) */, 37D4B0CE2671614900C925CA /* Pearvidious (macOS) */, - 37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */, - 37D4B0D32671614900C925CA /* Tests iOS */, - 37D4B0DD2671614900C925CA /* Tests macOS */, - 37D4B170267164B000C925CA /* Tests Apple TV */, + 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */, + 37D4B0D32671614900C925CA /* Tests (iOS) */, + 37D4B0DD2671614900C925CA /* Tests (macOS) */, + 37D4B170267164B000C925CA /* Tests (tvOS) */, 37BA796226DC40CB002A0235 /* Shared Tests */, + 37FD43E62704A2240073EE42 /* Periphery (macOS) */, + 37FD43EB2704A7710073EE42 /* Periphery (tvOS) */, ); }; /* End PBXProject section */ @@ -1052,6 +1085,43 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 37FD43EA2704A2350073EE42 /* 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 (macOS)\" \\\n --targets \"Pearvidious (macOS)\" \\\n --retain-objc-accessible \\\n --retain-public\n"; + }; + 37FD43EF2704A7780073EE42 /* 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 (Apple TV)\" \\\n --targets \"Pearvidious (Apple TV)\" \\\n --retain-objc-accessible \\\n --retain-public\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 37BA795F26DC40CB002A0235 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -1309,11 +1379,11 @@ 37BE0BD726A1D4A90092E2DB /* PlayerViewController.swift in Sources */, 37484C3326FCB8F900287258 /* AccountValidator.swift in Sources */, 37CEE4C32677B697005A1EFE /* Stream.swift in Sources */, - 37C194C926F6A9C8005D3B96 /* RecentsModel.swift in Sources */, 37F64FE626FE70A60081B69E /* RedrawOnViewModifier.swift in Sources */, 37484C2B26FC83FF00287258 /* AccountFormView.swift in Sources */, 37BA793D26DB8EE4002A0235 /* PlaylistVideosView.swift in Sources */, 3711404126B206A6005B3555 /* SearchModel.swift in Sources */, + 37FD43F02704A9C00073EE42 /* RecentsModel.swift in Sources */, 379775952689365600DD52A8 /* Array+Next.swift in Sources */, 3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */, 373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */, @@ -1363,7 +1433,7 @@ }; 37D4B173267164B000C925CA /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */; + target = 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */; targetProxy = 37D4B172267164B000C925CA /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -1876,6 +1946,42 @@ }; name = Release; }; + 37FD43E82704A2240073EE42 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 37FD43E92704A2240073EE42 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 37FD43ED2704A7710073EE42 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 37FD43EE2704A7710073EE42 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 78Z5H3M6RJ; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1915,7 +2021,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests iOS" */ = { + 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (iOS)" */ = { isa = XCConfigurationList; buildConfigurations = ( 37D4B0F32671614900C925CA /* Debug */, @@ -1924,7 +2030,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests macOS" */ = { + 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (macOS)" */ = { isa = XCConfigurationList; buildConfigurations = ( 37D4B0F62671614900C925CA /* Debug */, @@ -1933,7 +2039,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (Apple TV)" */ = { + 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (tvOS)" */ = { isa = XCConfigurationList; buildConfigurations = ( 37D4B178267164B000C925CA /* Debug */, @@ -1942,7 +2048,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests Apple TV" */ = { + 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests (tvOS)" */ = { isa = XCConfigurationList; buildConfigurations = ( 37D4B17E267164B000C925CA /* Debug */, @@ -1951,6 +2057,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 37FD43E72704A2240073EE42 /* Build configuration list for PBXAggregateTarget "Periphery (macOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37FD43E82704A2240073EE42 /* Debug */, + 37FD43E92704A2240073EE42 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 37FD43EC2704A7710073EE42 /* Build configuration list for PBXAggregateTarget "Periphery (tvOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 37FD43ED2704A7710073EE42 /* Debug */, + 37FD43EE2704A7710073EE42 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ diff --git a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (iOS).xcscheme b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (iOS).xcscheme index d71ca478..88e8d25c 100644 --- a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (iOS).xcscheme +++ b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (iOS).xcscheme @@ -34,7 +34,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "37D4B0D32671614900C925CA" BuildableName = "Tests iOS.xctest" - BlueprintName = "Tests iOS" + BlueprintName = "Tests (iOS)" ReferencedContainer = "container:Pearvidious.xcodeproj"> diff --git a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (macOS).xcscheme b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (macOS).xcscheme index fe28b91d..073cc9cf 100644 --- a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (macOS).xcscheme +++ b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (macOS).xcscheme @@ -33,8 +33,8 @@ diff --git a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (Apple TV).xcscheme b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (tvOS).xcscheme similarity index 88% rename from Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (Apple TV).xcscheme rename to Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (tvOS).xcscheme index 82863632..6e26ba8b 100644 --- a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (Apple TV).xcscheme +++ b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Pearvidious (tvOS).xcscheme @@ -15,8 +15,8 @@ @@ -33,8 +33,8 @@ @@ -65,8 +65,8 @@ @@ -82,8 +82,8 @@ diff --git a/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (macOS).xcscheme b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (macOS).xcscheme new file mode 100644 index 00000000..4a150a21 --- /dev/null +++ b/Pearvidious.xcodeproj/xcshareddata/xcschemes/Periphery (macOS).xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist b/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist index bdd05800..3f84297d 100644 --- a/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Pearvidious.xcodeproj/xcuserdata/arek.xcuserdatad/xcschemes/xcschememanagement.plist @@ -4,11 +4,6 @@ SchemeUserState - Pearvidious (Apple TV).xcscheme_^#shared#^_ - - orderHint - 1 - Pearvidious (iOS).xcscheme_^#shared#^_ orderHint @@ -19,19 +14,39 @@ orderHint 0 + Pearvidious (tvOS).xcscheme_^#shared#^_ + + orderHint + 1 + + Periphery (iOS).xcscheme_^#shared#^_ + + orderHint + 7 + + Periphery (macOS).xcscheme_^#shared#^_ + + orderHint + 3 + + Periphery (tvOS).xcscheme_^#shared#^_ + + orderHint + 4 + Playground (Playground) 1.xcscheme isShown orderHint - 5 + 6 Playground (Playground) 2.xcscheme isShown orderHint - 6 + 7 Playground (Playground) 3.xcscheme @@ -59,7 +74,7 @@ isShown orderHint - 4 + 5 SuppressBuildableAutocreation @@ -84,6 +99,11 @@ primary + 37FD43E62704A2240073EE42 + + primary + + diff --git a/Shared/Navigation/AppSidebarNavigation.swift b/Shared/Navigation/AppSidebarNavigation.swift index 90079f4e..953e29c1 100644 --- a/Shared/Navigation/AppSidebarNavigation.swift +++ b/Shared/Navigation/AppSidebarNavigation.swift @@ -5,9 +5,11 @@ import SwiftUI struct AppSidebarNavigation: View { @EnvironmentObject private var api - @EnvironmentObject private var navigation - @State private var didApplyPrimaryViewWorkAround = false + #if os(iOS) + @EnvironmentObject private var navigation + @State private var didApplyPrimaryViewWorkAround = false + #endif var body: some View { #if os(iOS) diff --git a/Shared/Navigation/AppSidebarRecents.swift b/Shared/Navigation/AppSidebarRecents.swift index 5261cadd..a9f4943b 100644 --- a/Shared/Navigation/AppSidebarRecents.swift +++ b/Shared/Navigation/AppSidebarRecents.swift @@ -2,7 +2,6 @@ import Defaults import SwiftUI struct AppSidebarRecents: View { - @EnvironmentObject private var navigation @EnvironmentObject private var recents @Default(.recentlyOpened) private var recentItems diff --git a/Shared/Navigation/AppSidebarSubscriptions.swift b/Shared/Navigation/AppSidebarSubscriptions.swift index 5da81841..337c8662 100644 --- a/Shared/Navigation/AppSidebarSubscriptions.swift +++ b/Shared/Navigation/AppSidebarSubscriptions.swift @@ -26,12 +26,4 @@ struct AppSidebarSubscriptions: View { subscriptions.load() } } - - var unsubscribeAlertTitle: String { - if let channel = navigation.channelToUnsubscribe { - return "Unsubscribe from \(channel.name)" - } - - return "Unknown channel" - } } diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift index 990d1312..5ae3fc43 100644 --- a/Shared/Navigation/ContentView.swift +++ b/Shared/Navigation/ContentView.swift @@ -6,10 +6,6 @@ struct ContentView: View { @StateObject private var playback = PlaybackModel() @StateObject private var recents = RecentsModel() - @EnvironmentObject private var api - @EnvironmentObject private var instances - @EnvironmentObject private var playlists - #if os(iOS) @Environment(\.horizontalSizeClass) private var horizontalSizeClass #endif diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index e818fdab..c947a924 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -19,7 +19,6 @@ struct VideoPlayerView: View { #endif @EnvironmentObject private var api - @EnvironmentObject private var navigation @EnvironmentObject private var playback var resource: Resource { diff --git a/Shared/Playlists/AddToPlaylistView.swift b/Shared/Playlists/AddToPlaylistView.swift index e54ac527..59aa6a38 100644 --- a/Shared/Playlists/AddToPlaylistView.swift +++ b/Shared/Playlists/AddToPlaylistView.swift @@ -90,7 +90,6 @@ struct AddToPlaylistView: View { VStack(alignment: formAlignment) { #if os(tvOS) - selectPlaylistButton #else Picker("Playlist", selection: $model.selectedPlaylistID) { @@ -132,14 +131,6 @@ struct AddToPlaylistView: View { .padding(.horizontal) } - private var footerAlignment: HorizontalAlignment { - #if os(tvOS) - .trailing - #else - .leading - #endif - } - private var selectPlaylistButton: some View { Button(model.currentPlaylist?.title ?? "Select playlist") { guard model.currentPlaylist != nil else { diff --git a/Shared/Playlists/PlaylistFormView.swift b/Shared/Playlists/PlaylistFormView.swift index ac766ef0..9360c80b 100644 --- a/Shared/Playlists/PlaylistFormView.swift +++ b/Shared/Playlists/PlaylistFormView.swift @@ -42,12 +42,8 @@ struct PlaylistFormView: View { .padding(.leading, 10) .focused($focused) - Picker("Visibility", selection: $visibility) { - ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in - Text(visibility.name) - } - } - .pickerStyle(.segmented) + visibilityFormItem + .pickerStyle(.segmented) } HStack { @@ -126,7 +122,7 @@ struct PlaylistFormView: View { Text("Visibility") .frame(maxWidth: .infinity, alignment: .leading) - visibilityButton + visibilityFormItem } .padding(.top, 10) @@ -189,7 +185,7 @@ struct PlaylistFormView: View { editing ? api.playlist(playlist.id) : api.playlists } - var visibilityButton: some View { + var visibilityFormItem: some View { #if os(macOS) Picker("Visibility", selection: $visibility) { ForEach(Playlist.Visibility.allCases) { visibility in diff --git a/Shared/Playlists/PlaylistsView.swift b/Shared/Playlists/PlaylistsView.swift index ebb2821c..d4ecc9ca 100644 --- a/Shared/Playlists/PlaylistsView.swift +++ b/Shared/Playlists/PlaylistsView.swift @@ -5,18 +5,12 @@ import SwiftUI struct PlaylistsView: View { @EnvironmentObject private var model - @EnvironmentObject private var api - @EnvironmentObject private var navigation - @State private var showingNewPlaylist = false @State private var createdPlaylist: Playlist? @State private var showingEditPlaylist = false @State private var editedPlaylist: Playlist? - @State private var showingAddToPlaylist = false - @State private var videoIDToAddToPlaylist = "" - @Namespace private var focusNamespace var videos: [Video] { @@ -98,34 +92,38 @@ struct PlaylistsView: View { } #endif } - .focusScope(focusNamespace) + #if os(tvOS) + .focusScope(focusNamespace) + #endif .onAppear { model.load() } } - var toolbar: some View { - HStack { - if model.isEmpty { - Text("No Playlists") - .foregroundColor(.secondary) - } else { - Text("Current Playlist") - .foregroundColor(.secondary) + #if os(tvOS) + var toolbar: some View { + HStack { + if model.isEmpty { + Text("No Playlists") + .foregroundColor(.secondary) + } else { + Text("Current Playlist") + .foregroundColor(.secondary) - selectPlaylistButton + selectPlaylistButton + } + + if model.currentPlaylist != nil { + editPlaylistButton + } + + Spacer() + + newPlaylistButton + .padding(.leading, 40) } - - if model.currentPlaylist != nil { - editPlaylistButton - } - - Spacer() - - newPlaylistButton - .padding(.leading, 40) } - } + #endif func hintText(_ text: String) -> some View { VStack { diff --git a/Shared/Settings/SettingsView.swift b/Shared/Settings/SettingsView.swift index f68a1de8..63907df3 100644 --- a/Shared/Settings/SettingsView.swift +++ b/Shared/Settings/SettingsView.swift @@ -3,11 +3,15 @@ import Foundation import SwiftUI struct SettingsView: View { - private enum Tabs: Hashable { - case playback, instances - } + #if os(macOS) + private enum Tabs: Hashable { + case playback, instances + } + #endif - @Environment(\.dismiss) private var dismiss + #if os(iOS) + @Environment(\.dismiss) private var dismiss + #endif var body: some View { #if os(macOS) diff --git a/Shared/Trending/TrendingCountry.swift b/Shared/Trending/TrendingCountry.swift index fb92b8f4..12a471db 100644 --- a/Shared/Trending/TrendingCountry.swift +++ b/Shared/Trending/TrendingCountry.swift @@ -78,13 +78,15 @@ struct TrendingCountry: View { #endif } - var searchPlacement: SearchFieldPlacement { - #if os(iOS) - .navigationBarDrawer(displayMode: .always) - #else - .automatic - #endif - } + #if !os(macOS) + var searchPlacement: SearchFieldPlacement { + #if os(iOS) + .navigationBarDrawer(displayMode: .always) + #else + .automatic + #endif + } + #endif func selectCountryAndDismiss(_ country: Country? = nil) { if let selected = country ?? selection { diff --git a/Shared/Videos/VideoView.swift b/Shared/Videos/VideoView.swift index 561f1243..2d3ad8aa 100644 --- a/Shared/Videos/VideoView.swift +++ b/Shared/Videos/VideoView.swift @@ -6,10 +6,10 @@ struct VideoView: View { #if os(iOS) @Environment(\.verticalSizeClass) private var verticalSizeClass + @Environment(\.horizontalCells) private var horizontalCells #endif @Environment(\.inNavigationView) private var inNavigationView - @Environment(\.horizontalCells) private var horizontalCells var video: Video @@ -48,73 +48,75 @@ struct VideoView: View { #endif } - var horizontalRow: some View { - HStack(alignment: .top, spacing: 2) { - Section { + #if os(iOS) + var horizontalRow: some View { + HStack(alignment: .top, spacing: 2) { + Section { + #if os(tvOS) + thumbnailImage(quality: .medium) + #else + thumbnail + #endif + } + .frame(maxWidth: 320) + + VStack(alignment: .leading, spacing: 0) { + videoDetail(video.title, lineLimit: 5) + .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) + + videoDetail(video.author) + + if additionalDetailsAvailable { + Spacer() + + HStack { + if let date = video.publishedDate { + VStack { + Image(systemName: "calendar") + Text(date) + } + } + + if video.views != 0 { + VStack { + Image(systemName: "eye") + Text(video.viewsCount!) + } + } + } + .foregroundColor(.secondary) + } + } + .padding() + .frame(minHeight: 180) + #if os(tvOS) - thumbnailImage(quality: .medium) - #else - thumbnail + if video.playTime != nil || video.live || video.upcoming { + Spacer() + + VStack(alignment: .center) { + Spacer() + + if let time = video.playTime { + HStack(spacing: 4) { + Image(systemName: "clock") + Text(time) + .fontWeight(.bold) + } + .foregroundColor(.secondary) + } else if video.live { + DetailBadge(text: "Live", style: .outstanding) + } else if video.upcoming { + DetailBadge(text: "Upcoming", style: .informational) + } + + Spacer() + } + } #endif } - .frame(maxWidth: 320) - - VStack(alignment: .leading, spacing: 0) { - videoDetail(video.title, lineLimit: 5) - .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) - - videoDetail(video.author) - - if additionalDetailsAvailable { - Spacer() - - HStack { - if let date = video.publishedDate { - VStack { - Image(systemName: "calendar") - Text(date) - } - } - - if video.views != 0 { - VStack { - Image(systemName: "eye") - Text(video.viewsCount!) - } - } - } - .foregroundColor(.secondary) - } - } - .padding() - .frame(minHeight: 180) - - #if os(tvOS) - if video.playTime != nil || video.live || video.upcoming { - Spacer() - - VStack(alignment: .center) { - Spacer() - - if let time = video.playTime { - HStack(spacing: 4) { - Image(systemName: "clock") - Text(time) - .fontWeight(.bold) - } - .foregroundColor(.secondary) - } else if video.live { - DetailBadge(text: "Live", style: .outstanding) - } else if video.upcoming { - DetailBadge(text: "Upcoming", style: .informational) - } - - Spacer() - } - } - #endif } - } + #endif var verticalRow: some View { VStack(alignment: .leading, spacing: 0) { diff --git a/Shared/Views/ChannelVideosView.swift b/Shared/Views/ChannelVideosView.swift index a035b645..2010bdf0 100644 --- a/Shared/Views/ChannelVideosView.swift +++ b/Shared/Views/ChannelVideosView.swift @@ -89,18 +89,6 @@ struct ChannelVideosView: View { return resource } - #if !os(tvOS) - var subscriptionToolbarItemPlacement: ToolbarItemPlacement { - #if os(iOS) - if horizontalSizeClass == .regular { - return .primaryAction // swiftlint:disable:this implicit_return - } - #endif - - return .automatic - } - #endif - var subscriptionToggleButton: some View { Group { if subscriptions.isSubscribing(channel.id) { diff --git a/Shared/Views/SearchView.swift b/Shared/Views/SearchView.swift index c3c9a64b..a5d094cb 100644 --- a/Shared/Views/SearchView.swift +++ b/Shared/Views/SearchView.swift @@ -12,8 +12,10 @@ struct SearchView: View { @State private var presentingClearConfirmation = false @State private var recentsChanged = false - @State private var searchDebounce = Debounce() - @State private var recentsDebounce = Debounce() + #if os(tvOS) + @State private var searchDebounce = Debounce() + @State private var recentsDebounce = Debounce() + #endif @Environment(\.navigationStyle) private var navigationStyle @@ -183,11 +185,11 @@ struct SearchView: View { } #if os(iOS) .swipeActions(edge: .trailing) { - clearButton(item) + deleteButton(item) } #elseif os(tvOS) .contextMenu { - clearButton(item) + deleteButton(item) } #endif } @@ -204,14 +206,16 @@ struct SearchView: View { #endif } - func clearButton(_ item: RecentItem) -> some View { - Button(role: .destructive) { - recents.close(item) - recentsChanged.toggle() - } label: { - Label("Delete", systemImage: "trash") + #if !os(macOS) + func deleteButton(_ item: RecentItem) -> some View { + Button(role: .destructive) { + recents.close(item) + recentsChanged.toggle() + } label: { + Label("Delete", systemImage: "trash") + } } - } + #endif var clearAllButton: some View { Button("Clear All", role: .destructive) { diff --git a/Shared/Views/SignInRequiredView.swift b/Shared/Views/SignInRequiredView.swift index bff849f9..40492271 100644 --- a/Shared/Views/SignInRequiredView.swift +++ b/Shared/Views/SignInRequiredView.swift @@ -7,7 +7,9 @@ struct SignInRequiredView: View { @EnvironmentObject private var api @Default(.instances) private var instances - @EnvironmentObject private var navigation + #if !os(macOS) + @EnvironmentObject private var navigation + #endif init(title: String, @ViewBuilder content: @escaping () -> Content) { self.title = title diff --git a/Shared/Views/VideoContextMenuView.swift b/Shared/Views/VideoContextMenuView.swift index 916f406e..7d833386 100644 --- a/Shared/Views/VideoContextMenuView.swift +++ b/Shared/Views/VideoContextMenuView.swift @@ -2,7 +2,6 @@ import Defaults import SwiftUI struct VideoContextMenuView: View { - @EnvironmentObject private var api @EnvironmentObject private var navigation @EnvironmentObject private var playlists @EnvironmentObject private var recents diff --git a/Shared/Watch Now/WatchNowView.swift b/Shared/Watch Now/WatchNowView.swift index 4f71295c..dd6c99d2 100644 --- a/Shared/Watch Now/WatchNowView.swift +++ b/Shared/Watch Now/WatchNowView.swift @@ -4,7 +4,6 @@ import SwiftUI struct WatchNowView: View { @EnvironmentObject private var api - @EnvironmentObject private var navigation var body: some View { ScrollView(.vertical, showsIndicators: false) { @@ -21,7 +20,7 @@ struct WatchNowView: View { // TODO: adding sections to view // =================== // WatchNowPlaylistSection(id: "IVPLmRFYLGYZpq61SpujNw3EKbzzGNvoDmH") -// WatchNowSection(resource: InvidiousAPI.shared.channelVideos("UCBJycsmduvYEL83R_U4JriQ"), label: "MKBHD") +// WatchNowSection(resource: api.channelVideos("UCBJycsmduvYEL83R_U4JriQ"), label: "MKBHD") } } } diff --git a/macOS/Settings/InstancesSettingsView.swift b/macOS/Settings/InstancesSettingsView.swift index 080c7d2b..a6baf134 100644 --- a/macOS/Settings/InstancesSettingsView.swift +++ b/macOS/Settings/InstancesSettingsView.swift @@ -5,10 +5,6 @@ struct InstancesSettingsView: View { @Default(.instances) private var instances @EnvironmentObject private var model - @EnvironmentObject private var api - @EnvironmentObject private var subscriptions - @EnvironmentObject private var playlists - @State private var selectedInstanceID: Instance.ID? @State private var selectedAccount: Instance.Account? diff --git a/tvOS/AccountSelectionView.swift b/tvOS/AccountSelectionView.swift index ba554771..d03933b3 100644 --- a/tvOS/AccountSelectionView.swift +++ b/tvOS/AccountSelectionView.swift @@ -16,7 +16,7 @@ struct AccountSelectionView: View { api.setAccount(account) } } - .disabled(nextAccount == nil) + .disabled(instances.isEmpty) .contextMenu { ForEach(instances) { instance in Button(accountButtonTitle(instance: instance, account: instance.anonymousAccount)) {