idek what i was doing bruh

This commit is contained in:
june 2025-02-14 23:34:59 +13:00
parent 154c02ca6c
commit 9319e8904b
No known key found for this signature in database
4 changed files with 81 additions and 74 deletions

View File

@ -509,7 +509,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = OnCue/OnCue.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"OnCue/Preview Content\"";
DEVELOPMENT_TEAM = 9MP5435PRF;
ENABLE_PREVIEWS = YES;
@ -546,7 +546,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = OnCue/OnCue.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"OnCue/Preview Content\"";
DEVELOPMENT_TEAM = 9MP5435PRF;
ENABLE_PREVIEWS = YES;

View File

@ -20,33 +20,33 @@ struct OnCueApp: App {
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
#if DEBUG
// Use an autorelease pool to make sure Swift deallocates the persistent
// container before setting up the SwiftData stack.
try autoreleasepool {
let desc = NSPersistentStoreDescription(url: modelConfiguration.url)
let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.xyz.breadone.oncue")
desc.cloudKitContainerOptions = opts
// Load the store synchronously so it completes before initializing the
// CloudKit schema.
desc.shouldAddStoreAsynchronously = false
if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [OCProject.self, OCCard.self]) {
let container = NSPersistentCloudKitContainer(name: "OnCue", managedObjectModel: mom)
container.persistentStoreDescriptions = [desc]
container.loadPersistentStores {_, err in
if let err {
fatalError(err.localizedDescription)
}
}
// Initialize the CloudKit schema after the store finishes loading.
try container.initializeCloudKitSchema()
// Remove and unload the store from the persistent container.
if let store = container.persistentStoreCoordinator.persistentStores.first {
try container.persistentStoreCoordinator.remove(store)
}
}
}
#endif
// #if DEBUG
// // Use an autorelease pool to make sure Swift deallocates the persistent
// // container before setting up the SwiftData stack.
// try autoreleasepool {
// let desc = NSPersistentStoreDescription(url: modelConfiguration.url)
// let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.xyz.breadone.oncue")
// desc.cloudKitContainerOptions = opts
// // Load the store synchronously so it completes before initializing the
// // CloudKit schema.
// desc.shouldAddStoreAsynchronously = false
// if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [OCProject.self, OCCard.self]) {
// let container = NSPersistentCloudKitContainer(name: "OnCue", managedObjectModel: mom)
// container.persistentStoreDescriptions = [desc]
// container.loadPersistentStores {_, err in
// if let err {
// fatalError(err.localizedDescription)
// }
// }
// // Initialize the CloudKit schema after the store finishes loading.
// try container.initializeCloudKitSchema()
// // Remove and unload the store from the persistent container.
// if let store = container.persistentStoreCoordinator.persistentStores.first {
// try container.persistentStoreCoordinator.remove(store)
// }
// }
// }
// #endif
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {

View File

@ -19,33 +19,33 @@ struct OnCuePresenter_Watch_AppApp: App {
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
#if DEBUG
// Use an autorelease pool to make sure Swift deallocates the persistent
// container before setting up the SwiftData stack.
try autoreleasepool {
let desc = NSPersistentStoreDescription(url: modelConfiguration.url)
let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.xyz.breadone.oncue")
desc.cloudKitContainerOptions = opts
// Load the store synchronously so it completes before initializing the
// CloudKit schema.
desc.shouldAddStoreAsynchronously = false
if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [OCProject.self, OCCard.self]) {
let container = NSPersistentCloudKitContainer(name: "OnCue", managedObjectModel: mom)
container.persistentStoreDescriptions = [desc]
container.loadPersistentStores {_, err in
if let err {
fatalError(err.localizedDescription)
}
}
// Initialize the CloudKit schema after the store finishes loading.
try container.initializeCloudKitSchema()
// Remove and unload the store from the persistent container.
if let store = container.persistentStoreCoordinator.persistentStores.first {
try container.persistentStoreCoordinator.remove(store)
}
}
}
#endif
// #if DEBUG
// // Use an autorelease pool to make sure Swift deallocates the persistent
// // container before setting up the SwiftData stack.
// try autoreleasepool {
// let desc = NSPersistentStoreDescription(url: modelConfiguration.url)
// let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.xyz.breadone.oncue")
// desc.cloudKitContainerOptions = opts
// // Load the store synchronously so it completes before initializing the
// // CloudKit schema.
// desc.shouldAddStoreAsynchronously = false
// if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [OCProject.self, OCCard.self]) {
// let container = NSPersistentCloudKitContainer(name: "OnCue", managedObjectModel: mom)
// container.persistentStoreDescriptions = [desc]
// container.loadPersistentStores {_, err in
// if let err {
// fatalError(err.localizedDescription)
// }
// }
// // Initialize the CloudKit schema after the store finishes loading.
// try container.initializeCloudKitSchema()
// // Remove and unload the store from the persistent container.
// if let store = container.persistentStoreCoordinator.persistentStores.first {
// try container.persistentStoreCoordinator.remove(store)
// }
// }
// }
// #endif
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")

View File

@ -12,38 +12,23 @@ struct MainViewPresenter: View {
@Environment(\.modelContext) private var modelContext
@Query private var items: [OCProject]
@AppStorage(Preferences.themeColour) var themeColor = Color.blue.toHex()!
@State private var newProjectName = ""
@State private var addNewProject = false
var body: some View {
NavigationSplitView {
NavigationView {
List {
ForEach(items) { project in
NavigationLink {
CueCardViewPresenter(project: project)
} label: {
VStack(alignment: .leading) {
if (project.color == Color.clear.toHex()!) {
Text("\(project.name)")
.bold()
.font(.title2)
.foregroundStyle(Color(hex: themeColor) ?? .blue)
} else {
Text("\(project.name)")
.bold()
.font(.title2)
.foregroundStyle(Color(hex: project.color) ?? .white)
ProjectCard(project: project)
}
Text("\(project.cards?.count ?? 0) \(project.cards?.count ?? 0 == 1 ? "Card" : "Cards")")
} }
.padding(.vertical, 3)
}
}
.navigationTitle("Projects")
} detail: {
Text("Select an item")
}
}
}
@ -57,3 +42,25 @@ struct MainViewPresenter: View {
return MainViewPresenter()
.modelContainer(container)
}
struct ProjectCard: View {
@AppStorage(Preferences.themeColour) var themeColor = Color.blue.toHex()!
let project: OCProject
var body: some View {
VStack(alignment: .leading) {
if (project.color == Color.clear.toHex()!) {
Text("\(project.name)")
.bold()
.font(.title2)
.foregroundStyle(Color(hex: themeColor) ?? .blue)
} else {
Text("\(project.name)")
.bold()
.font(.title2)
.foregroundStyle(Color(hex: project.color) ?? .white)
}
Text("\(project.cards?.count ?? 0) \(project.cards?.count ?? 0 == 1 ? "Card" : "Cards")")
}
}
}