diff --git a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift index e3f25dab3..a65b1def5 100644 --- a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift @@ -44,16 +44,16 @@ import Views NavigationView { // The first column is the sidebar. PrimaryContentSidebar(categories: categories) + .navigationBarTitleDisplayMode(.inline) // Second column is the Primary Nav Stack PrimaryContentCategory.feed.destinationView + .navigationBarTitleDisplayMode(.inline) } .navigationBarTitleDisplayMode(.inline) .accentColor(.appGrayTextContrast) .introspectSplitViewController { - $0.preferredSplitBehavior = .tile $0.preferredPrimaryColumnWidth = 160 - $0.presentsWithGesture = false $0.displayModeButtonVisibility = .always } } @@ -62,26 +62,23 @@ import Views @MainActor struct PrimaryContentSidebar: View { @State private var addLinkPresented = false + @State private var showProfile = false @State private var selectedCategory: PrimaryContentCategory? let categories: [PrimaryContentCategory] var innerBody: some View { List { - ForEach(categories, id: \.self) { category in - NavigationLink( - destination: category.destinationView, - tag: category, - selection: $selectedCategory, - label: { category.listLabel } - ) - #if os(iOS) - .listRowBackground( - category == selectedCategory - ? Color.appGraySolid.opacity(0.4).cornerRadius(8) - : Color.clear.cornerRadius(8) - ) - #endif - } + NavigationLink( + destination: PrimaryContentCategory.feed.destinationView, + tag: PrimaryContentCategory.feed, + selection: $selectedCategory, + label: { PrimaryContentCategory.feed.listLabel } + ) + .listRowBackground(Color.systemBackground.cornerRadius(8)) + + Button(action: { showProfile = true }, label: { + PrimaryContentCategory.profile.listLabel + }) Button(action: { addLinkPresented = true }, label: { Label("Add Link", systemImage: "plus.circle") @@ -97,6 +94,14 @@ import Views #endif } } + .sheet(isPresented: $showProfile) { + NavigationView { + PrimaryContentCategory.profile.destinationView + #if os(iOS) + .navigationBarTitleDisplayMode(.inline) + #endif + } + } } var body: some View { diff --git a/apple/OmnivoreKit/Sources/App/Views/RootView/RootViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/RootView/RootViewModel.swift index 18f63fe1c..24796a89f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/RootView/RootViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/RootView/RootViewModel.swift @@ -24,6 +24,8 @@ public final class RootViewModel: ObservableObject { EventTracker.registerUser(userID: viewer.unwrappedUserID) } + services.dataService.cleanupDeletedItems(in: services.dataService.viewContext) + #if DEBUG if CommandLine.arguments.contains("--uitesting") { services.authenticator.logout(dataService: services.dataService) diff --git a/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift b/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift index a9892ccef..5e3fe80f1 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift @@ -63,11 +63,10 @@ public final class DataService: ObservableObject { fatalError("Core Data store failed to load with error: \(error)") } } - cleanupDeletedItems(in: viewContext) } } - func cleanupDeletedItems(in context: NSManagedObjectContext) { + public func cleanupDeletedItems(in context: NSManagedObjectContext) { let fetchRequest: NSFetchRequest = LinkedItem.fetchRequest() let calendar = Calendar.current