From 6d61e6c9ae454671e95245ca1d6ac82f52a4f1b4 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 22 Feb 2024 15:26:55 +0800 Subject: [PATCH 1/5] Make browser full screen for ipad --- .../Sources/App/Views/WebReader/WebReaderContainer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index b922c8298..639bb7c90 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -432,7 +432,7 @@ struct WebReaderContainerView: View { }, label: { Text(LocalText.readerSave) }) } #if os(iOS) - .sheet(item: $safariWebLink) { + .fullScreenCover(item: $safariWebLink) { SafariView(url: $0.url) .ignoresSafeArea(.all, edges: .bottom) } From 48dfbdd0f95e0df6afe683aa04112a98d35b62e0 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 22 Feb 2024 15:28:36 +0800 Subject: [PATCH 2/5] Fix observation of items for the grid --- .../App/Views/Home/HomeFeedViewIOS.swift | 32 +++++++++++-------- .../App/Views/Home/HomeFeedViewModel.swift | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index c581f6646..92438d1ac 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -530,8 +530,13 @@ struct AnimatingCellHeight: AnimatableModifier { ) } else { HomeFeedGridView( + listTitle: $listTitle, + isListScrolled: $isListScrolled, + prefersListLayout: $prefersListLayout, + isEditMode: $isEditMode, + selection: $selection, viewModel: viewModel, - isListScrolled: $isListScrolled + showFeatureCards: showFeatureCards ) } }.sheet(isPresented: $viewModel.showLabelsSheet) { @@ -574,10 +579,6 @@ struct AnimatingCellHeight: AnimatableModifier { .dynamicTypeSize(.small ... .accessibility1) } - func menuItems(for item: Models.LibraryItem) -> some View { - libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item) - } - var featureCard: some View { VStack(spacing: 0) { if Color.isDarkMode { @@ -745,7 +746,7 @@ struct AnimatingCellHeight: AnimatableModifier { .listRowSeparatorTint(Color.thBorderColor) .listRowInsets(.init(top: 0, leading: horizontalInset, bottom: 10, trailing: horizontalInset)) .contextMenu { - menuItems(for: item) + libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item) } .swipeActions(edge: .leading, allowsFullSwipe: true) { if let listConfig = viewModel.currentListConfig { @@ -938,11 +939,20 @@ struct AnimatingCellHeight: AnimatableModifier { @EnvironmentObject var dataService: DataService @EnvironmentObject var audioController: AudioController - @State var isContextMenuOpen = false + @Binding var listTitle: String + @Binding var isListScrolled: Bool + @Binding var prefersListLayout: Bool + @Binding var isEditMode: EditMode + @State private var showHideFeatureAlert = false + @Binding var selection: Set @ObservedObject var viewModel: HomeFeedViewModel - @Binding var isListScrolled: Bool + let showFeatureCards: Bool + + @State var shouldScrollToTop = false + @State var topItem: Models.LibraryItem? + @ObservedObject var networkMonitor = NetworkMonitor() func contextMenuActionHandler(item: Models.LibraryItem, action: GridCardAction) { switch action { @@ -972,10 +982,6 @@ struct AnimatingCellHeight: AnimatableModifier { .dynamicTypeSize(.small ... .accessibility1) } - func menuItems(for item: Models.LibraryItem) -> some View { - libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item) - } - var body: some View { VStack(alignment: .leading) { Color.systemBackground.frame(height: 1) @@ -1018,7 +1024,7 @@ struct AnimatingCellHeight: AnimatableModifier { viewModel: viewModel ) .contextMenu { - menuItems(for: item) + libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item) } .onAppear { if idx >= viewModel.fetcher.items.count - 5 { diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index ceec00508..af5d6d68c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -13,7 +13,7 @@ enum LoadingBarStyle { @MainActor final class HomeFeedViewModel: NSObject, ObservableObject { let filterKey: String - @Published var fetcher: LibraryItemFetcher + @ObservedObject var fetcher: LibraryItemFetcher let folderConfigs: [String: LibraryListConfig] @Published var isLoading = false From 6617fa84131f77230ebe667daf079906bfed84ae Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 22 Feb 2024 15:28:49 +0800 Subject: [PATCH 3/5] Add unarchive and trash to grid context menu --- .../Sources/App/Views/Home/LibraryItemMenu.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift index 2b68877bf..7e8bda89a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift @@ -13,6 +13,14 @@ import Views action: { viewModel.itemUnderTitleEdit = item }, label: { Label("Edit Info", systemImage: "info.circle") } ) + Button( + action: { viewModel.setLinkArchived(dataService: dataService, objectID: item.objectID, archived: !item.isArchived) }, + label: { Label(item.isArchived ? "Unarchive" : "Archive", systemImage: "inbox") } + ) + Button( + action: { viewModel.removeLibraryItem(dataService: dataService, objectID: item.objectID) }, + label: { Label("Remove", systemImage: "trash") } + ) Button( action: { viewModel.itemUnderLabelEdit = item }, label: { Label(item.labels?.count == 0 ? "Add Labels" : "Edit Labels", systemImage: "tag") } From 82db51b24e4568a4d04a5075cbb24a3f3b3c993f Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 22 Feb 2024 15:30:36 +0800 Subject: [PATCH 4/5] Correct the archive icon --- .../Sources/App/Views/Home/LibraryItemMenu.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift index 7e8bda89a..76b369d08 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryItemMenu.swift @@ -15,7 +15,12 @@ import Views ) Button( action: { viewModel.setLinkArchived(dataService: dataService, objectID: item.objectID, archived: !item.isArchived) }, - label: { Label(item.isArchived ? "Unarchive" : "Archive", systemImage: "inbox") } + label: { + Label( + item.isArchived ? "Unarchive" : "Archive", + systemImage: item.isArchived ? "tray.and.arrow.down.fill" : "archivebox" + ) + } ) Button( action: { viewModel.removeLibraryItem(dataService: dataService, objectID: item.objectID) }, From 23be43cb032282019677113ee00c6171adc36627 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 22 Feb 2024 17:21:16 +0800 Subject: [PATCH 5/5] Bump iOS version --- apple/Omnivore.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apple/Omnivore.xcodeproj/project.pbxproj b/apple/Omnivore.xcodeproj/project.pbxproj index d943ee073..4e0f6563b 100644 --- a/apple/Omnivore.xcodeproj/project.pbxproj +++ b/apple/Omnivore.xcodeproj/project.pbxproj @@ -1389,7 +1389,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.44.0; + MARKETING_VERSION = 1.45.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app; @@ -1424,7 +1424,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 1.44.0; + MARKETING_VERSION = 1.45.0; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1479,7 +1479,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.44.0; + MARKETING_VERSION = 1.45.0; PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app; PRODUCT_NAME = Omnivore; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1820,7 +1820,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.44.0; + MARKETING_VERSION = 1.45.0; PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app; PRODUCT_NAME = Omnivore; PROVISIONING_PROFILE_SPECIFIER = "";