Organize files

This commit is contained in:
Ethan Pippin 2021-10-12 18:12:14 -06:00
parent 4e75905f70
commit 7dd253c530
25 changed files with 47 additions and 91 deletions

View File

@ -92,7 +92,6 @@
5377CBF5263B596A003A4E83 /* JellyfinPlayerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5377CBF4263B596A003A4E83 /* JellyfinPlayerApp.swift */; };
5377CBF9263B596B003A4E83 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5377CBF8263B596B003A4E83 /* Assets.xcassets */; };
5377CBFC263B596B003A4E83 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5377CBFB263B596B003A4E83 /* Preview Assets.xcassets */; };
5377CBFE263B596B003A4E83 /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5377CBFD263B596B003A4E83 /* PersistenceController.swift */; };
5377CC01263B596B003A4E83 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 5377CBFF263B596B003A4E83 /* Model.xcdatamodeld */; };
5389276E263C25100035E14B /* ContinueWatchingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5389276D263C25100035E14B /* ContinueWatchingView.swift */; };
53892770263C25230035E14B /* NextUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5389276F263C25230035E14B /* NextUpView.swift */; };
@ -186,7 +185,6 @@
6220D0C926D63F3700B8E046 /* Stinsen in Frameworks */ = {isa = PBXBuildFile; productRef = 6220D0C826D63F3700B8E046 /* Stinsen */; };
6220D0CC26D640C400B8E046 /* AppURLHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6220D0CB26D640C400B8E046 /* AppURLHandler.swift */; };
6225FCCB2663841E00E067F6 /* ParallaxHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6225FCCA2663841E00E067F6 /* ParallaxHeader.swift */; };
6228B1C22670EB010067FD35 /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5377CBFD263B596B003A4E83 /* PersistenceController.swift */; };
624C21752685CF60007F1390 /* SearchablePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 624C21742685CF60007F1390 /* SearchablePickerView.swift */; };
625CB5682678B6FB00530A6E /* SplashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5672678B6FB00530A6E /* SplashView.swift */; };
625CB56A2678B71200530A6E /* SplashViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5692678B71200530A6E /* SplashViewModel.swift */; };
@ -405,7 +403,6 @@
5377CBF4263B596A003A4E83 /* JellyfinPlayerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JellyfinPlayerApp.swift; sourceTree = "<group>"; };
5377CBF8263B596B003A4E83 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5377CBFB263B596B003A4E83 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
5377CBFD263B596B003A4E83 /* PersistenceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceController.swift; sourceTree = "<group>"; };
5377CC00263B596B003A4E83 /* JellyfinPlayer.xcdatamodel */ = {isa = PBXFileReference; explicitFileType = wrapper.xcdatamodel; path = JellyfinPlayer.xcdatamodel; sourceTree = "<group>"; };
5377CC02263B596B003A4E83 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5389276D263C25100035E14B /* ContinueWatchingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContinueWatchingView.swift; sourceTree = "<group>"; };
@ -744,10 +741,10 @@
535870AB2669D8D300D05A09 /* Objects */ = {
isa = PBXGroup;
children = (
62EC353326766B03000E9F2D /* DeviceRotationViewModifier.swift */,
53192D5C265AA78A008A4215 /* DeviceProfileBuilder.swift */,
535870AC2669D8DD00D05A09 /* Typings.swift */,
E1AD104926D94822003E4A08 /* DetailItem.swift */,
53192D5C265AA78A008A4215 /* DeviceProfileBuilder.swift */,
62EC353326766B03000E9F2D /* DeviceRotationViewModifier.swift */,
535870AC2669D8DD00D05A09 /* Typings.swift */,
E1F0204D26CCCA74001C1C3B /* VideoPlayerJumpLength.swift */,
);
path = Objects;
@ -794,34 +791,18 @@
isa = PBXGroup;
children = (
E13DD3BB27163C3E009D4DAF /* App */,
62C29E9D26D0FE5900C1D2E7 /* Coordinators */,
53F866422687A45400DCD1D7 /* Components */,
62ECA01926FA6D6900E8EBB7 /* Singleton */,
53AD124C2670278D0094A276 /* JellyfinPlayer.entitlements */,
62ECA01926FA6D6900E8EBB7 /* AppURLHandler */,
5377CBF8263B596B003A4E83 /* Assets.xcassets */,
5338F74D263B61370014BF09 /* ConnectToServerView.swift */,
5389276D263C25100035E14B /* ContinueWatchingView.swift */,
53F866422687A45400DCD1D7 /* Components */,
62C29E9D26D0FE5900C1D2E7 /* Coordinators */,
5377CC02263B596B003A4E83 /* Info.plist */,
E14F7D0A26DB3714007C3AE6 /* ItemView */,
53FF7F29263CF3F500585C35 /* LatestMediaView.swift */,
53E4E646263F6CF100F67C6B /* LibraryFilterView.swift */,
6213388F265F83A900A81A2A /* LibraryListView.swift */,
53EE24E5265060780068F029 /* LibrarySearchView.swift */,
53DF641D263D9C0600A7CD1A /* LibraryView.swift */,
53892771263C8C6F0035E14B /* LoadingView.swift */,
5389276F263C25230035E14B /* NextUpView.swift */,
5377CBFD263B596B003A4E83 /* PersistenceController.swift */,
53AD124C2670278D0094A276 /* JellyfinPlayer.entitlements */,
5377CBFA263B596B003A4E83 /* Preview Content */,
539B2DA4263BA5B8007FF1A4 /* SettingsView.swift */,
E173DA4F26D048D600CC4EB7 /* ServerDetailView.swift */,
535BAEA4264A151C005FA86D /* VideoPlayer.swift */,
0959A5FC2686D29800C7C9A9 /* VideoUpNextView.swift */,
53313B8F265EEA6D00947AA3 /* VideoPlayer.storyboard */,
535BAEA4264A151C005FA86D /* VideoPlayer.swift */,
532E68CE267D9F6B007B9F13 /* VideoPlayerCastDeviceSelector.swift */,
53F8377C265FF67C00F456B3 /* VideoPlayerSettingsView.swift */,
625CB5672678B6FB00530A6E /* SplashView.swift */,
625CB56E2678C23300530A6E /* HomeView.swift */,
62ECA01726FA685A00E8EBB7 /* DeepLink.swift */,
0959A5FC2686D29800C7C9A9 /* VideoUpNextView.swift */,
E13DD3D027165886009D4DAF /* Views */,
);
path = JellyfinPlayer;
sourceTree = "<group>";
@ -997,13 +978,13 @@
isa = PBXGroup;
children = (
5389277B263CC3DB0035E14B /* BlurHashDecode.swift */,
E13DD3C727164B1E009D4DAF /* UIDeviceExtensions.swift */,
6267B3D526710B8900A7371D /* CollectionExtensions.swift */,
E173DA5126D04AAF00CC4EB7 /* ColorExtension.swift */,
62CB3F4A2685BB77003D0A6F /* DefaultsExtension.swift */,
6267B3D92671138200A7371D /* ImageExtensions.swift */,
E1AD105226D96D5F003E4A08 /* JellyfinAPIExtensions */,
621338922660107500A81A2A /* StringExtensions.swift */,
E13DD3C727164B1E009D4DAF /* UIDeviceExtensions.swift */,
6220D0AC26D5EABB00B8E046 /* ViewExtensions.swift */,
);
path = Extensions;
@ -1050,12 +1031,13 @@
path = Singleton;
sourceTree = "<group>";
};
62ECA01926FA6D6900E8EBB7 /* Singleton */ = {
62ECA01926FA6D6900E8EBB7 /* AppURLHandler */ = {
isa = PBXGroup;
children = (
6220D0CB26D640C400B8E046 /* AppURLHandler.swift */,
62ECA01726FA685A00E8EBB7 /* DeepLink.swift */,
);
path = Singleton;
path = AppURLHandler;
sourceTree = "<group>";
};
AE8C3157265D6F5E008AA076 /* Resources */ = {
@ -1096,6 +1078,28 @@
path = SwiftfinStore;
sourceTree = "<group>";
};
E13DD3D027165886009D4DAF /* Views */ = {
isa = PBXGroup;
children = (
5338F74D263B61370014BF09 /* ConnectToServerView.swift */,
5389276D263C25100035E14B /* ContinueWatchingView.swift */,
625CB56E2678C23300530A6E /* HomeView.swift */,
E14F7D0A26DB3714007C3AE6 /* ItemView */,
53FF7F29263CF3F500585C35 /* LatestMediaView.swift */,
53E4E646263F6CF100F67C6B /* LibraryFilterView.swift */,
6213388F265F83A900A81A2A /* LibraryListView.swift */,
53EE24E5265060780068F029 /* LibrarySearchView.swift */,
53DF641D263D9C0600A7CD1A /* LibraryView.swift */,
53892771263C8C6F0035E14B /* LoadingView.swift */,
5389276F263C25230035E14B /* NextUpView.swift */,
E173DA4F26D048D600CC4EB7 /* ServerDetailView.swift */,
539B2DA4263BA5B8007FF1A4 /* SettingsView.swift */,
625CB5672678B6FB00530A6E /* SplashView.swift */,
53F8377C265FF67C00F456B3 /* VideoPlayerSettingsView.swift */,
);
path = Views;
sourceTree = "<group>";
};
E14F7D0A26DB3714007C3AE6 /* ItemView */ = {
isa = PBXGroup;
children = (
@ -1616,7 +1620,6 @@
625CB5732678C32A00530A6E /* HomeViewModel.swift in Sources */,
62C29EA826D103D500C1D2E7 /* LibraryListCoordinator.swift in Sources */,
62E632DC267D2E130063E547 /* LibrarySearchViewModel.swift in Sources */,
5377CBFE263B596B003A4E83 /* PersistenceController.swift in Sources */,
6220D0BD26D60D6600B8E046 /* ItemViewModel.swift in Sources */,
62C29E9F26D1016600C1D2E7 /* MainCoordinator.swift in Sources */,
5389276E263C25100035E14B /* ContinueWatchingView.swift in Sources */,
@ -1718,7 +1721,6 @@
E1AD105926D9A543003E4A08 /* LazyView.swift in Sources */,
628B95372670CB800091AF3B /* JellyfinWidget.swift in Sources */,
E1AD105426D97161003E4A08 /* BaseItemDtoExtensions.swift in Sources */,
6228B1C22670EB010067FD35 /* PersistenceController.swift in Sources */,
E1FCD09A26C4F35A007C8DCF /* ErrorMessage.swift in Sources */,
628B95272670CABD0091AF3B /* NextUpWidget.swift in Sources */,
6220D0AF26D5EABE00B8E046 /* ViewExtensions.swift in Sources */,

View File

@ -1,55 +0,0 @@
/* JellyfinPlayer/Swiftfin is subject to the terms of the Mozilla Public
* License, v2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright 2021 Aiden Vigue & Jellyfin Contributors
*/
import CoreData
struct PersistenceController {
static let shared = PersistenceController()
static var preview: PersistenceController = {
let result = PersistenceController(inMemory: true)
let viewContext = result.container.viewContext
do {
try viewContext.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nsError = error as NSError
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
}
return result
}()
let container: NSPersistentCloudKitContainer
init(inMemory: Bool = false) {
container = NSPersistentCloudKitContainer(name: "Model")
container.persistentStoreDescriptions = [NSPersistentStoreDescription(url: FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: "group.me.vigue.jellyfin.mobileclient")!.appendingPathComponent("\(container.name).sqlite"))]
if inMemory {
container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
}
container.loadPersistentStores(completionHandler: { (_, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
}
}

View File

@ -16,7 +16,7 @@ enum SwiftfinStore {
final class Server: CoreStoreObject {
@Field.Stored("url")
@Field.Stored("uri")
var url: String = ""
@Field.Stored("name")
@ -25,18 +25,27 @@ enum SwiftfinStore {
@Field.Stored("id")
var id: String = ""
@Field.Stored("os")
var os: String = ""
@Field.Stored("version")
var version: String = ""
@Field.Relationship("users", inverse: \User.$server)
var users: Set<User>
}
final class User: CoreStoreObject {
@Field.Stored("name")
@Field.Stored("username")
var name: String = ""
@Field.Stored("id")
var id: String = ""
@Field.Stored("appleTVID")
var appleTVID: String = ""
@Field.Relationship("server")
var server: Server?
}