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

View File

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

View File

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

View File

@ -12,38 +12,23 @@ struct MainViewPresenter: View {
@Environment(\.modelContext) private var modelContext @Environment(\.modelContext) private var modelContext
@Query private var items: [OCProject] @Query private var items: [OCProject]
@AppStorage(Preferences.themeColour) var themeColor = Color.blue.toHex()!
@State private var newProjectName = "" @State private var newProjectName = ""
@State private var addNewProject = false @State private var addNewProject = false
var body: some View { var body: some View {
NavigationSplitView { NavigationView {
List { List {
ForEach(items) { project in ForEach(items) { project in
NavigationLink { NavigationLink {
CueCardViewPresenter(project: project) CueCardViewPresenter(project: project)
} label: { } label: {
VStack(alignment: .leading) { ProjectCard(project: project)
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")")
} }
.padding(.vertical, 3) .padding(.vertical, 3)
} }
} }
.navigationTitle("Projects") .navigationTitle("Projects")
} detail: {
Text("Select an item")
} }
} }
} }
@ -57,3 +42,25 @@ struct MainViewPresenter: View {
return MainViewPresenter() return MainViewPresenter()
.modelContainer(container) .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")")
}
}
}