mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Only open read now in the inbox view
This commit is contained in:
parent
eadfbc3436
commit
30771c3498
4 changed files with 39 additions and 33 deletions
|
|
@ -148,26 +148,6 @@ struct AnimatingCellHeight: AnimatableModifier {
|
|||
viewModel.selectedItem = linkedItem
|
||||
viewModel.linkIsActive = true
|
||||
}
|
||||
.onOpenURL { url in
|
||||
viewModel.linkRequest = nil
|
||||
if let deepLink = DeepLink.make(from: url) {
|
||||
switch deepLink {
|
||||
case let .search(query):
|
||||
viewModel.searchTerm = query
|
||||
case let .savedSearch(named):
|
||||
if let filter = viewModel.findFilter(dataService, named: named) {
|
||||
viewModel.appliedFilter = filter
|
||||
}
|
||||
case let .webAppLinkRequest(requestID):
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
|
||||
withoutAnimation {
|
||||
viewModel.linkRequest = LinkRequest(id: UUID(), serverID: requestID)
|
||||
viewModel.presentWebContainer = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.fullScreenCover(isPresented: $searchPresented) {
|
||||
LibrarySearchView(homeFeedViewModel: self.viewModel)
|
||||
}
|
||||
|
|
@ -294,7 +274,7 @@ struct AnimatingCellHeight: AnimatableModifier {
|
|||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
if let linkRequest = viewModel.linkRequest {
|
||||
if let linkRequest = viewModel.linkRequest, viewModel.listConfig.hasReadNowSection {
|
||||
PresentationLink(
|
||||
transition: PresentationLinkTransition.slide(
|
||||
options: PresentationLinkTransition.SlideTransitionOptions(edge: .trailing,
|
||||
|
|
@ -998,7 +978,7 @@ struct ScrollViewOffsetPreferenceKey: PreferenceKey {
|
|||
#if os(iOS)
|
||||
// Allows us to present a sheet without animation
|
||||
// Used to configure full screen modal view coming from share extension read now button action
|
||||
private extension View {
|
||||
public extension View {
|
||||
func withoutAnimation(_ completion: @escaping () -> Void) {
|
||||
UIView.setAnimationsEnabled(false)
|
||||
completion()
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ enum CardStyle {
|
|||
|
||||
struct LibraryListConfig {
|
||||
var hasFeatureCards = false
|
||||
var hasReadNowSection = false
|
||||
var leadingSwipeActions = [SwipeAction]()
|
||||
var trailingSwipeActions = [SwipeAction]()
|
||||
var cardStyle = CardStyle.library
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public struct LibrarySplitView: View {
|
|||
fetcher: LibraryItemFetcher(),
|
||||
listConfig: LibraryListConfig(
|
||||
hasFeatureCards: true,
|
||||
hasReadNowSection: true,
|
||||
leadingSwipeActions: [.pin],
|
||||
trailingSwipeActions: [.archive, .delete],
|
||||
cardStyle: .library
|
||||
|
|
@ -22,6 +23,7 @@ public struct LibrarySplitView: View {
|
|||
fetcher: LibraryItemFetcher(),
|
||||
listConfig: LibraryListConfig(
|
||||
hasFeatureCards: false,
|
||||
hasReadNowSection: false,
|
||||
leadingSwipeActions: [.moveToInbox],
|
||||
trailingSwipeActions: [.archive, .delete],
|
||||
cardStyle: .library
|
||||
|
|
|
|||
|
|
@ -29,28 +29,30 @@ struct LibraryTabView: View {
|
|||
UITabBar.appearance().isHidden = true
|
||||
}
|
||||
|
||||
@StateObject private var followingViewModel = HomeFeedViewModel(
|
||||
folder: "following",
|
||||
fetcher: LibraryItemFetcher(),
|
||||
listConfig: LibraryListConfig(
|
||||
hasFeatureCards: false,
|
||||
leadingSwipeActions: [.moveToInbox],
|
||||
trailingSwipeActions: [.archive, .delete],
|
||||
cardStyle: .library
|
||||
)
|
||||
)
|
||||
|
||||
@StateObject private var libraryViewModel = HomeFeedViewModel(
|
||||
folder: "inbox",
|
||||
fetcher: LibraryItemFetcher(),
|
||||
listConfig: LibraryListConfig(
|
||||
hasFeatureCards: true,
|
||||
hasReadNowSection: true,
|
||||
leadingSwipeActions: [.pin],
|
||||
trailingSwipeActions: [.archive, .delete],
|
||||
cardStyle: .library
|
||||
)
|
||||
)
|
||||
|
||||
@StateObject private var followingViewModel = HomeFeedViewModel(
|
||||
folder: "following",
|
||||
fetcher: LibraryItemFetcher(),
|
||||
listConfig: LibraryListConfig(
|
||||
hasFeatureCards: false,
|
||||
hasReadNowSection: false,
|
||||
leadingSwipeActions: [.moveToInbox],
|
||||
trailingSwipeActions: [.archive, .delete],
|
||||
cardStyle: .library
|
||||
)
|
||||
)
|
||||
|
||||
private let syncManager = LibrarySyncManager()
|
||||
|
||||
var body: some View {
|
||||
|
|
@ -97,5 +99,26 @@ struct LibraryTabView: View {
|
|||
await syncManager.syncItems(dataService: dataService)
|
||||
}
|
||||
}
|
||||
.onOpenURL { url in
|
||||
libraryViewModel.linkRequest = nil
|
||||
if let deepLink = DeepLink.make(from: url) {
|
||||
switch deepLink {
|
||||
case let .search(query):
|
||||
libraryViewModel.searchTerm = query
|
||||
case let .savedSearch(named):
|
||||
if let filter = libraryViewModel.findFilter(dataService, named: named) {
|
||||
libraryViewModel.appliedFilter = filter
|
||||
}
|
||||
case let .webAppLinkRequest(requestID):
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) {
|
||||
withoutAnimation {
|
||||
libraryViewModel.linkRequest = LinkRequest(id: UUID(), serverID: requestID)
|
||||
libraryViewModel.presentWebContainer = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedTab = "inbox"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue