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") resource(baseURL: account.url, path: "\(InvidiousAPI.basePath)/auth/feed")
} }
var stats: Resource {
resource(baseURL: account.url, path: basePathAppending("stats"))
}
var subscriptions: Resource { var subscriptions: Resource {
resource(baseURL: account.url, path: basePathAppending("auth/subscriptions")) resource(baseURL: account.url, path: basePathAppending("auth/subscriptions"))
} }

View File

@ -11,8 +11,6 @@ final class NavigationModel: ObservableObject {
@Published var showingVideo = false @Published var showingVideo = false
@Published var video: Video? @Published var video: Video?
@Published var returnToDetails = false
@Published var presentingAddToPlaylist = false @Published var presentingAddToPlaylist = false
@Published var videoToAddToPlaylist: Video! @Published var videoToAddToPlaylist: Video!

View File

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

View File

@ -87,18 +87,6 @@ class Stream: Equatable, Hashable {
assets.dropFirst().allSatisfy { $0 == assets.first } 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 { static func == (lhs: Stream, rhs: Stream) -> Bool {
lhs.resolution == rhs.resolution && lhs.kind == rhs.kind lhs.resolution == rhs.resolution && lhs.kind == rhs.kind
} }

View File

@ -6,6 +6,31 @@
objectVersion = 55; objectVersion = 55;
objects = { 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 */ /* Begin PBXBuildFile section */
3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B17F267B4DFB00704544 /* TrendingCountry.swift */; }; 3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B17F267B4DFB00704544 /* TrendingCountry.swift */; };
3705B182267B4E4900704544 /* TrendingCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B181267B4E4900704544 /* TrendingCategory.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 */; }; 37BE0BDC26A2367F0092E2DB /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BE0BDB26A2367F0092E2DB /* Player.swift */; };
37C194C726F6A9C8005D3B96 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; }; 37C194C726F6A9C8005D3B96 /* RecentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C194C626F6A9C8005D3B96 /* RecentsModel.swift */; };
37C194C826F6A9C8005D3B96 /* 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 */; }; 37C7A1D5267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; };
37C7A1D6267BFD9D0010EAD6 /* 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 */; }; 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 */; }; 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 */; }; 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 */; }; 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 */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -386,13 +411,13 @@
37D4B0C42671614800C925CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 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; }; 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; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 37D4B19626717E1500C925CA /* Video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Video.swift; sourceTree = "<group>"; };
@ -695,10 +720,10 @@
children = ( children = (
37D4B0C92671614900C925CA /* Pearvidious.app */, 37D4B0C92671614900C925CA /* Pearvidious.app */,
37D4B0CF2671614900C925CA /* Pearvidious.app */, 37D4B0CF2671614900C925CA /* Pearvidious.app */,
37D4B0D42671614900C925CA /* Tests iOS.xctest */, 37D4B0D42671614900C925CA /* Tests (iOS).xctest */,
37D4B0DE2671614900C925CA /* Tests macOS.xctest */, 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */,
37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */, 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */,
37D4B171267164B000C925CA /* Tests Apple TV.xctest */, 37D4B171267164B000C925CA /* Tests (tvOS).xctest */,
37BA796326DC40CB002A0235 /* Shared Tests.xctest */, 37BA796326DC40CB002A0235 /* Shared Tests.xctest */,
); );
name = Products; name = Products;
@ -849,9 +874,9 @@
productReference = 37D4B0CF2671614900C925CA /* Pearvidious.app */; productReference = 37D4B0CF2671614900C925CA /* Pearvidious.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
37D4B0D32671614900C925CA /* Tests iOS */ = { 37D4B0D32671614900C925CA /* Tests (iOS) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests iOS" */; buildConfigurationList = 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (iOS)" */;
buildPhases = ( buildPhases = (
37D4B0D02671614900C925CA /* Sources */, 37D4B0D02671614900C925CA /* Sources */,
37D4B0D12671614900C925CA /* Frameworks */, 37D4B0D12671614900C925CA /* Frameworks */,
@ -862,14 +887,14 @@
dependencies = ( dependencies = (
37D4B0D62671614900C925CA /* PBXTargetDependency */, 37D4B0D62671614900C925CA /* PBXTargetDependency */,
); );
name = "Tests iOS"; name = "Tests (iOS)";
productName = "Tests iOS"; productName = "Tests iOS";
productReference = 37D4B0D42671614900C925CA /* Tests iOS.xctest */; productReference = 37D4B0D42671614900C925CA /* Tests (iOS).xctest */;
productType = "com.apple.product-type.bundle.ui-testing"; productType = "com.apple.product-type.bundle.ui-testing";
}; };
37D4B0DD2671614900C925CA /* Tests macOS */ = { 37D4B0DD2671614900C925CA /* Tests (macOS) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests macOS" */; buildConfigurationList = 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (macOS)" */;
buildPhases = ( buildPhases = (
37D4B0DA2671614900C925CA /* Sources */, 37D4B0DA2671614900C925CA /* Sources */,
37D4B0DB2671614900C925CA /* Frameworks */, 37D4B0DB2671614900C925CA /* Frameworks */,
@ -880,14 +905,14 @@
dependencies = ( dependencies = (
37D4B0E02671614900C925CA /* PBXTargetDependency */, 37D4B0E02671614900C925CA /* PBXTargetDependency */,
); );
name = "Tests macOS"; name = "Tests (macOS)";
productName = "Tests macOS"; productName = "Tests macOS";
productReference = 37D4B0DE2671614900C925CA /* Tests macOS.xctest */; productReference = 37D4B0DE2671614900C925CA /* Tests (macOS).xctest */;
productType = "com.apple.product-type.bundle.ui-testing"; productType = "com.apple.product-type.bundle.ui-testing";
}; };
37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */ = { 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (Apple TV)" */; buildConfigurationList = 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (tvOS)" */;
buildPhases = ( buildPhases = (
37D4B154267164AE00C925CA /* Sources */, 37D4B154267164AE00C925CA /* Sources */,
37D4B155267164AE00C925CA /* Frameworks */, 37D4B155267164AE00C925CA /* Frameworks */,
@ -897,7 +922,7 @@
); );
dependencies = ( dependencies = (
); );
name = "Pearvidious (Apple TV)"; name = "Pearvidious (tvOS)";
packageProductDependencies = ( packageProductDependencies = (
37D4B19C2671817900C925CA /* SwiftyJSON */, 37D4B19C2671817900C925CA /* SwiftyJSON */,
37B767DF2678C5BF0098BAA8 /* Logging */, 37B767DF2678C5BF0098BAA8 /* Logging */,
@ -906,12 +931,12 @@
37BADCA8269A570B009BE4FB /* Alamofire */, 37BADCA8269A570B009BE4FB /* Alamofire */,
); );
productName = Pearvidious; productName = Pearvidious;
productReference = 37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */; productReference = 37D4B158267164AE00C925CA /* Pearvidious (tvOS).app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
37D4B170267164B000C925CA /* Tests Apple TV */ = { 37D4B170267164B000C925CA /* Tests (tvOS) */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests Apple TV" */; buildConfigurationList = 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests (tvOS)" */;
buildPhases = ( buildPhases = (
37D4B16D267164B000C925CA /* Sources */, 37D4B16D267164B000C925CA /* Sources */,
37D4B16E267164B000C925CA /* Frameworks */, 37D4B16E267164B000C925CA /* Frameworks */,
@ -922,9 +947,9 @@
dependencies = ( dependencies = (
37D4B173267164B000C925CA /* PBXTargetDependency */, 37D4B173267164B000C925CA /* PBXTargetDependency */,
); );
name = "Tests Apple TV"; name = "Tests (tvOS)";
productName = PearvidiousUITests; productName = PearvidiousUITests;
productReference = 37D4B171267164B000C925CA /* Tests Apple TV.xctest */; productReference = 37D4B171267164B000C925CA /* Tests (tvOS).xctest */;
productType = "com.apple.product-type.bundle.ui-testing"; productType = "com.apple.product-type.bundle.ui-testing";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@ -962,6 +987,12 @@
CreatedOnToolsVersion = 13.0; CreatedOnToolsVersion = 13.0;
TestTargetID = 37D4B157267164AE00C925CA; TestTargetID = 37D4B157267164AE00C925CA;
}; };
37FD43E62704A2240073EE42 = {
CreatedOnToolsVersion = 13.0;
};
37FD43EB2704A7710073EE42 = {
CreatedOnToolsVersion = 13.0;
};
}; };
}; };
buildConfigurationList = 37D4B0C02671614700C925CA /* Build configuration list for PBXProject "Pearvidious" */; buildConfigurationList = 37D4B0C02671614700C925CA /* Build configuration list for PBXProject "Pearvidious" */;
@ -987,11 +1018,13 @@
targets = ( targets = (
37D4B0C82671614900C925CA /* Pearvidious (iOS) */, 37D4B0C82671614900C925CA /* Pearvidious (iOS) */,
37D4B0CE2671614900C925CA /* Pearvidious (macOS) */, 37D4B0CE2671614900C925CA /* Pearvidious (macOS) */,
37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */, 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */,
37D4B0D32671614900C925CA /* Tests iOS */, 37D4B0D32671614900C925CA /* Tests (iOS) */,
37D4B0DD2671614900C925CA /* Tests macOS */, 37D4B0DD2671614900C925CA /* Tests (macOS) */,
37D4B170267164B000C925CA /* Tests Apple TV */, 37D4B170267164B000C925CA /* Tests (tvOS) */,
37BA796226DC40CB002A0235 /* Shared Tests */, 37BA796226DC40CB002A0235 /* Shared Tests */,
37FD43E62704A2240073EE42 /* Periphery (macOS) */,
37FD43EB2704A7710073EE42 /* Periphery (tvOS) */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -1052,6 +1085,43 @@
}; };
/* End PBXResourcesBuildPhase section */ /* 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 */ /* Begin PBXSourcesBuildPhase section */
37BA795F26DC40CB002A0235 /* Sources */ = { 37BA795F26DC40CB002A0235 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
@ -1309,11 +1379,11 @@
37BE0BD726A1D4A90092E2DB /* PlayerViewController.swift in Sources */, 37BE0BD726A1D4A90092E2DB /* PlayerViewController.swift in Sources */,
37484C3326FCB8F900287258 /* AccountValidator.swift in Sources */, 37484C3326FCB8F900287258 /* AccountValidator.swift in Sources */,
37CEE4C32677B697005A1EFE /* Stream.swift in Sources */, 37CEE4C32677B697005A1EFE /* Stream.swift in Sources */,
37C194C926F6A9C8005D3B96 /* RecentsModel.swift in Sources */,
37F64FE626FE70A60081B69E /* RedrawOnViewModifier.swift in Sources */, 37F64FE626FE70A60081B69E /* RedrawOnViewModifier.swift in Sources */,
37484C2B26FC83FF00287258 /* AccountFormView.swift in Sources */, 37484C2B26FC83FF00287258 /* AccountFormView.swift in Sources */,
37BA793D26DB8EE4002A0235 /* PlaylistVideosView.swift in Sources */, 37BA793D26DB8EE4002A0235 /* PlaylistVideosView.swift in Sources */,
3711404126B206A6005B3555 /* SearchModel.swift in Sources */, 3711404126B206A6005B3555 /* SearchModel.swift in Sources */,
37FD43F02704A9C00073EE42 /* RecentsModel.swift in Sources */,
379775952689365600DD52A8 /* Array+Next.swift in Sources */, 379775952689365600DD52A8 /* Array+Next.swift in Sources */,
3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */, 3705B180267B4DFB00704544 /* TrendingCountry.swift in Sources */,
373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */, 373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */,
@ -1363,7 +1433,7 @@
}; };
37D4B173267164B000C925CA /* PBXTargetDependency */ = { 37D4B173267164B000C925CA /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = 37D4B157267164AE00C925CA /* Pearvidious (Apple TV) */; target = 37D4B157267164AE00C925CA /* Pearvidious (tvOS) */;
targetProxy = 37D4B172267164B000C925CA /* PBXContainerItemProxy */; targetProxy = 37D4B172267164B000C925CA /* PBXContainerItemProxy */;
}; };
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
@ -1876,6 +1946,42 @@
}; };
name = Release; 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 */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
@ -1915,7 +2021,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests iOS" */ = { 37D4B0F22671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (iOS)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
37D4B0F32671614900C925CA /* Debug */, 37D4B0F32671614900C925CA /* Debug */,
@ -1924,7 +2030,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests macOS" */ = { 37D4B0F52671614900C925CA /* Build configuration list for PBXNativeTarget "Tests (macOS)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
37D4B0F62671614900C925CA /* Debug */, 37D4B0F62671614900C925CA /* Debug */,
@ -1933,7 +2039,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (Apple TV)" */ = { 37D4B177267164B000C925CA /* Build configuration list for PBXNativeTarget "Pearvidious (tvOS)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
37D4B178267164B000C925CA /* Debug */, 37D4B178267164B000C925CA /* Debug */,
@ -1942,7 +2048,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests Apple TV" */ = { 37D4B17D267164B000C925CA /* Build configuration list for PBXNativeTarget "Tests (tvOS)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
37D4B17E267164B000C925CA /* Debug */, 37D4B17E267164B000C925CA /* Debug */,
@ -1951,6 +2057,24 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; 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 */ /* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */ /* Begin XCRemoteSwiftPackageReference section */

View File

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

View File

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

View File

@ -15,8 +15,8 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA" BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app" BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (Apple TV)" BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj"> ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
@ -33,8 +33,8 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B170267164B000C925CA" BlueprintIdentifier = "37D4B170267164B000C925CA"
BuildableName = "Tests Apple TV.xctest" BuildableName = "Tests (tvOS).xctest"
BlueprintName = "Tests Apple TV" BlueprintName = "Tests (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj"> ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference> </BuildableReference>
</TestableReference> </TestableReference>
@ -65,8 +65,8 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA" BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app" BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (Apple TV)" BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj"> ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
@ -82,8 +82,8 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B157267164AE00C925CA" BlueprintIdentifier = "37D4B157267164AE00C925CA"
BuildableName = "Pearvidious (Apple TV).app" BuildableName = "Pearvidious (tvOS).app"
BlueprintName = "Pearvidious (Apple TV)" BlueprintName = "Pearvidious (tvOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj"> ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </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> <dict>
<key>SchemeUserState</key> <key>SchemeUserState</key>
<dict> <dict>
<key>Pearvidious (Apple TV).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Pearvidious (iOS).xcscheme_^#shared#^_</key> <key>Pearvidious (iOS).xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
@ -19,19 +14,39 @@
<key>orderHint</key> <key>orderHint</key>
<integer>0</integer> <integer>0</integer>
</dict> </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> <key>Playground (Playground) 1.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>5</integer> <integer>6</integer>
</dict> </dict>
<key>Playground (Playground) 2.xcscheme</key> <key>Playground (Playground) 2.xcscheme</key>
<dict> <dict>
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>6</integer> <integer>7</integer>
</dict> </dict>
<key>Playground (Playground) 3.xcscheme</key> <key>Playground (Playground) 3.xcscheme</key>
<dict> <dict>
@ -59,7 +74,7 @@
<key>isShown</key> <key>isShown</key>
<false/> <false/>
<key>orderHint</key> <key>orderHint</key>
<integer>4</integer> <integer>5</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>
@ -84,6 +99,11 @@
<key>primary</key> <key>primary</key>
<true/> <true/>
</dict> </dict>
<key>37FD43E62704A2240073EE42</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict> </dict>
</dict> </dict>
</plist> </plist>

View File

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

View File

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

View File

@ -26,12 +26,4 @@ struct AppSidebarSubscriptions: View {
subscriptions.load() 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 playback = PlaybackModel()
@StateObject private var recents = RecentsModel() @StateObject private var recents = RecentsModel()
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<InstancesModel> private var instances
@EnvironmentObject<PlaylistsModel> private var playlists
#if os(iOS) #if os(iOS)
@Environment(\.horizontalSizeClass) private var horizontalSizeClass @Environment(\.horizontalSizeClass) private var horizontalSizeClass
#endif #endif

View File

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

View File

@ -90,7 +90,6 @@ struct AddToPlaylistView: View {
VStack(alignment: formAlignment) { VStack(alignment: formAlignment) {
#if os(tvOS) #if os(tvOS)
selectPlaylistButton selectPlaylistButton
#else #else
Picker("Playlist", selection: $model.selectedPlaylistID) { Picker("Playlist", selection: $model.selectedPlaylistID) {
@ -132,14 +131,6 @@ struct AddToPlaylistView: View {
.padding(.horizontal) .padding(.horizontal)
} }
private var footerAlignment: HorizontalAlignment {
#if os(tvOS)
.trailing
#else
.leading
#endif
}
private var selectPlaylistButton: some View { private var selectPlaylistButton: some View {
Button(model.currentPlaylist?.title ?? "Select playlist") { Button(model.currentPlaylist?.title ?? "Select playlist") {
guard model.currentPlaylist != nil else { guard model.currentPlaylist != nil else {

View File

@ -42,12 +42,8 @@ struct PlaylistFormView: View {
.padding(.leading, 10) .padding(.leading, 10)
.focused($focused) .focused($focused)
Picker("Visibility", selection: $visibility) { visibilityFormItem
ForEach(Playlist.Visibility.allCases, id: \.self) { visibility in .pickerStyle(.segmented)
Text(visibility.name)
}
}
.pickerStyle(.segmented)
} }
HStack { HStack {
@ -126,7 +122,7 @@ struct PlaylistFormView: View {
Text("Visibility") Text("Visibility")
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
visibilityButton visibilityFormItem
} }
.padding(.top, 10) .padding(.top, 10)
@ -189,7 +185,7 @@ struct PlaylistFormView: View {
editing ? api.playlist(playlist.id) : api.playlists editing ? api.playlist(playlist.id) : api.playlists
} }
var visibilityButton: some View { var visibilityFormItem: some View {
#if os(macOS) #if os(macOS)
Picker("Visibility", selection: $visibility) { Picker("Visibility", selection: $visibility) {
ForEach(Playlist.Visibility.allCases) { visibility in ForEach(Playlist.Visibility.allCases) { visibility in

View File

@ -5,18 +5,12 @@ import SwiftUI
struct PlaylistsView: View { struct PlaylistsView: View {
@EnvironmentObject<PlaylistsModel> private var model @EnvironmentObject<PlaylistsModel> private var model
@EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
@State private var showingNewPlaylist = false @State private var showingNewPlaylist = false
@State private var createdPlaylist: Playlist? @State private var createdPlaylist: Playlist?
@State private var showingEditPlaylist = false @State private var showingEditPlaylist = false
@State private var editedPlaylist: Playlist? @State private var editedPlaylist: Playlist?
@State private var showingAddToPlaylist = false
@State private var videoIDToAddToPlaylist = ""
@Namespace private var focusNamespace @Namespace private var focusNamespace
var videos: [Video] { var videos: [Video] {
@ -98,34 +92,38 @@ struct PlaylistsView: View {
} }
#endif #endif
} }
.focusScope(focusNamespace) #if os(tvOS)
.focusScope(focusNamespace)
#endif
.onAppear { .onAppear {
model.load() model.load()
} }
} }
var toolbar: some View { #if os(tvOS)
HStack { var toolbar: some View {
if model.isEmpty { HStack {
Text("No Playlists") if model.isEmpty {
.foregroundColor(.secondary) Text("No Playlists")
} else { .foregroundColor(.secondary)
Text("Current Playlist") } else {
.foregroundColor(.secondary) 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 { func hintText(_ text: String) -> some View {
VStack { VStack {

View File

@ -3,11 +3,15 @@ import Foundation
import SwiftUI import SwiftUI
struct SettingsView: View { struct SettingsView: View {
private enum Tabs: Hashable { #if os(macOS)
case playback, instances 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 { var body: some View {
#if os(macOS) #if os(macOS)

View File

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

View File

@ -6,10 +6,10 @@ struct VideoView: View {
#if os(iOS) #if os(iOS)
@Environment(\.verticalSizeClass) private var verticalSizeClass @Environment(\.verticalSizeClass) private var verticalSizeClass
@Environment(\.horizontalCells) private var horizontalCells
#endif #endif
@Environment(\.inNavigationView) private var inNavigationView @Environment(\.inNavigationView) private var inNavigationView
@Environment(\.horizontalCells) private var horizontalCells
var video: Video var video: Video
@ -48,73 +48,75 @@ struct VideoView: View {
#endif #endif
} }
var horizontalRow: some View { #if os(iOS)
HStack(alignment: .top, spacing: 2) { var horizontalRow: some View {
Section { 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) #if os(tvOS)
thumbnailImage(quality: .medium) if video.playTime != nil || video.live || video.upcoming {
#else Spacer()
thumbnail
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
} }
.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 { var verticalRow: some View {
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {

View File

@ -89,18 +89,6 @@ struct ChannelVideosView: View {
return resource 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 { var subscriptionToggleButton: some View {
Group { Group {
if subscriptions.isSubscribing(channel.id) { if subscriptions.isSubscribing(channel.id) {

View File

@ -12,8 +12,10 @@ struct SearchView: View {
@State private var presentingClearConfirmation = false @State private var presentingClearConfirmation = false
@State private var recentsChanged = false @State private var recentsChanged = false
@State private var searchDebounce = Debounce() #if os(tvOS)
@State private var recentsDebounce = Debounce() @State private var searchDebounce = Debounce()
@State private var recentsDebounce = Debounce()
#endif
@Environment(\.navigationStyle) private var navigationStyle @Environment(\.navigationStyle) private var navigationStyle
@ -183,11 +185,11 @@ struct SearchView: View {
} }
#if os(iOS) #if os(iOS)
.swipeActions(edge: .trailing) { .swipeActions(edge: .trailing) {
clearButton(item) deleteButton(item)
} }
#elseif os(tvOS) #elseif os(tvOS)
.contextMenu { .contextMenu {
clearButton(item) deleteButton(item)
} }
#endif #endif
} }
@ -204,14 +206,16 @@ struct SearchView: View {
#endif #endif
} }
func clearButton(_ item: RecentItem) -> some View { #if !os(macOS)
Button(role: .destructive) { func deleteButton(_ item: RecentItem) -> some View {
recents.close(item) Button(role: .destructive) {
recentsChanged.toggle() recents.close(item)
} label: { recentsChanged.toggle()
Label("Delete", systemImage: "trash") } label: {
Label("Delete", systemImage: "trash")
}
} }
} #endif
var clearAllButton: some View { var clearAllButton: some View {
Button("Clear All", role: .destructive) { Button("Clear All", role: .destructive) {

View File

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

View File

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

View File

@ -4,7 +4,6 @@ import SwiftUI
struct WatchNowView: View { struct WatchNowView: View {
@EnvironmentObject<InvidiousAPI> private var api @EnvironmentObject<InvidiousAPI> private var api
@EnvironmentObject<NavigationModel> private var navigation
var body: some View { var body: some View {
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
@ -21,7 +20,7 @@ struct WatchNowView: View {
// TODO: adding sections to view // TODO: adding sections to view
// =================== // ===================
// WatchNowPlaylistSection(id: "IVPLmRFYLGYZpq61SpujNw3EKbzzGNvoDmH") // 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 @Default(.instances) private var instances
@EnvironmentObject<InstancesModel> private var model @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 selectedInstanceID: Instance.ID?
@State private var selectedAccount: Instance.Account? @State private var selectedAccount: Instance.Account?

View File

@ -16,7 +16,7 @@ struct AccountSelectionView: View {
api.setAccount(account) api.setAccount(account)
} }
} }
.disabled(nextAccount == nil) .disabled(instances.isEmpty)
.contextMenu { .contextMenu {
ForEach(instances) { instance in ForEach(instances) { instance in
Button(accountButtonTitle(instance: instance, account: instance.anonymousAccount)) { Button(accountButtonTitle(instance: instance, account: instance.anonymousAccount)) {