Add Periphery configuration, remove unused code

This commit is contained in:
Arkadiusz Fal 2021-09-29 16:29:17 +02:00
parent 1b1be1aefe
commit e270b7b213
28 changed files with 400 additions and 242 deletions

View File

@ -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"))
}

View File

@ -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!

View File

@ -4,10 +4,6 @@ import Foundation
final class RecentsModel: ObservableObject {
@Default(.recentlyOpened) var items
var isEmpty: Bool {
items.isEmpty
}
func clear() {
items = []
}

View File

@ -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
}

View File

@ -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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
37D4B18B26717B3800C925CA /* VideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoView.swift; sourceTree = "<group>"; };
37D4B19626717E1500C925CA /* Video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Video.swift; sourceTree = "<group>"; };
@ -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 */

View File

@ -34,7 +34,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0D32671614900C925CA"
BuildableName = "Tests iOS.xctest"
BlueprintName = "Tests iOS"
BlueprintName = "Tests (iOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -33,8 +33,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0DD2671614900C925CA"
BuildableName = "Tests macOS.xctest"
BlueprintName = "Tests macOS"
BuildableName = "Tests (macOS).xctest"
BlueprintName = "Tests (macOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</TestableReference>

View File

@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app"
BlueprintName = "Pearvidious (Apple TV)"
BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -33,8 +33,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B170267164B000C925CA"
BuildableName = "Tests Apple TV.xctest"
BlueprintName = "Tests Apple TV"
BuildableName = "Tests (tvOS).xctest"
BlueprintName = "Tests (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</TestableReference>
@ -65,8 +65,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app"
BlueprintName = "Pearvidious (Apple TV)"
BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
@ -82,8 +82,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app"
BlueprintName = "Pearvidious (Apple TV)"
BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37FD43E62704A2240073EE42"
BuildableName = "Periphery (macOS)"
BlueprintName = "Periphery (macOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37FD43E62704A2240073EE42"
BuildableName = "Periphery (macOS)"
BlueprintName = "Periphery (macOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -4,11 +4,6 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>Pearvidious (Apple TV).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Pearvidious (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
@ -19,19 +14,39 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>Pearvidious (tvOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Periphery (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>Periphery (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>Periphery (tvOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>Playground (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
<integer>6</integer>
</dict>
<key>Playground (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
<integer>7</integer>
</dict>
<key>Playground (Playground) 3.xcscheme</key>
<dict>
@ -59,7 +74,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
<integer>5</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
@ -84,6 +99,11 @@
<key>primary</key>
<true/>
</dict>
<key>37FD43E62704A2240073EE42</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@ -5,9 +5,11 @@ import SwiftUI
struct AppSidebarNavigation: View {
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
#if os(iOS)
@EnvironmentObject<NavigationModel> private var navigation
@State private var didApplyPrimaryViewWorkAround = false
#endif
var body: some View {
#if os(iOS)

View File

@ -2,7 +2,6 @@ import Defaults
import SwiftUI
struct AppSidebarRecents: View {
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<RecentsModel> private var recents
@Default(.recentlyOpened) private var recentItems

View File

@ -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"
}
}

View File

@ -6,10 +6,6 @@ struct ContentView: View {
@StateObject private var playback = PlaybackModel()
@StateObject private var recents = RecentsModel()
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<InstancesModel> private var instances
@EnvironmentObject<PlaylistsModel> private var playlists
#if os(iOS)
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
#endif

View File

@ -19,7 +19,6 @@ struct VideoPlayerView: View {
#endif
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlaybackModel> private var playback
var resource: Resource {

View File

@ -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 {

View File

@ -42,11 +42,7 @@ struct PlaylistFormView: View {
.padding(.leading, 10)
.focused($focused)
Picker("Visibility", selection: $visibility) {
ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in
Text(visibility.name)
}
}
visibilityFormItem
.pickerStyle(.segmented)
}
@ -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

View File

@ -5,18 +5,12 @@ import SwiftUI
struct PlaylistsView: View {
@EnvironmentObject<PlaylistsModel> private var model
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> 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,12 +92,15 @@ struct PlaylistsView: View {
}
#endif
}
#if os(tvOS)
.focusScope(focusNamespace)
#endif
.onAppear {
model.load()
}
}
#if os(tvOS)
var toolbar: some View {
HStack {
if model.isEmpty {
@ -126,6 +123,7 @@ struct PlaylistsView: View {
.padding(.leading, 40)
}
}
#endif
func hintText(_ text: String) -> some View {
VStack {

View File

@ -3,11 +3,15 @@ import Foundation
import SwiftUI
struct SettingsView: View {
#if os(macOS)
private enum Tabs: Hashable {
case playback, instances
}
#endif
#if os(iOS)
@Environment(\.dismiss) private var dismiss
#endif
var body: some View {
#if os(macOS)

View File

@ -78,6 +78,7 @@ struct TrendingCountry: View {
#endif
}
#if !os(macOS)
var searchPlacement: SearchFieldPlacement {
#if os(iOS)
.navigationBarDrawer(displayMode: .always)
@ -85,6 +86,7 @@ struct TrendingCountry: View {
.automatic
#endif
}
#endif
func selectCountryAndDismiss(_ country: Country? = nil) {
if let selected = country ?? selection {

View File

@ -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,6 +48,7 @@ struct VideoView: View {
#endif
}
#if os(iOS)
var horizontalRow: some View {
HStack(alignment: .top, spacing: 2) {
Section {
@ -115,6 +116,7 @@ struct VideoView: View {
#endif
}
}
#endif
var verticalRow: some View {
VStack(alignment: .leading, spacing: 0) {

View File

@ -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) {

View File

@ -12,8 +12,10 @@ struct SearchView: View {
@State private var presentingClearConfirmation = false
@State private var recentsChanged = false
#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,7 +206,8 @@ struct SearchView: View {
#endif
}
func clearButton(_ item: RecentItem) -> some View {
#if !os(macOS)
func deleteButton(_ item: RecentItem) -> some View {
Button(role: .destructive) {
recents.close(item)
recentsChanged.toggle()
@ -212,6 +215,7 @@ struct SearchView: View {
Label("Delete", systemImage: "trash")
}
}
#endif
var clearAllButton: some View {
Button("Clear All", role: .destructive) {

View File

@ -7,7 +7,9 @@ struct SignInRequiredView<Content: View>: View {
@EnvironmentObject<InvidiousAPI> private var api
@Default(.instances) private var instances
#if !os(macOS)
@EnvironmentObject<NavigationModel> private var navigation
#endif
init(title: String, @ViewBuilder content: @escaping () -> Content) {
self.title = title

View File

@ -2,7 +2,6 @@ import Defaults
import SwiftUI
struct VideoContextMenuView: View {
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
@EnvironmentObject<PlaylistsModel> private var playlists
@EnvironmentObject<RecentsModel> private var recents

View File

@ -4,7 +4,6 @@ import SwiftUI
struct WatchNowView: View {
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> 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")
}
}
}

View File

@ -5,10 +5,6 @@ struct InstancesSettingsView: View {
@Default(.instances) private var instances
@EnvironmentObject<InstancesModel> private var model
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<SubscriptionsModel> private var subscriptions
@EnvironmentObject<PlaylistsModel> private var playlists
@State private var selectedInstanceID: Instance.ID?
@State private var selectedAccount: Instance.Account?

View File

@ -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)) {