Files
omnivore/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift
Jackson Harper e63b4f9b2c Abstract out fetching from view model so we can better handle multiple fetch folders
Rename LinkedItem to LibraryItem

More on following

Add new fetcher

Tab bar
2023-12-07 17:15:52 +08:00

83 lines
1.9 KiB
Swift

//
// File.swift
//
//
// Created by Jackson Harper on 6/29/23.
//
import Foundation
import Models
import PopupView
import Services
import SwiftUI
import Views
@MainActor
struct LibraryTabView: View {
@EnvironmentObject var dataService: DataService
@MainActor
public init() {
UITabBar.appearance().isHidden = true
UITabBar.appearance().backgroundColor = UIColor(Color.themeTabBarColor)
}
@StateObject private var followingViewModel = HomeFeedViewModel(
fetcher: InboxFetcher(),
listConfig: LibraryListConfig(
hasFeatureCards: false,
leadingSwipeActions: [.moveToInbox],
trailingSwipeActions: [.archive, .delete],
cardStyle: .library
)
)
@StateObject private var libraryViewModel = HomeFeedViewModel(
fetcher: InboxFetcher(),
listConfig: LibraryListConfig(
hasFeatureCards: true,
leadingSwipeActions: [.pin],
trailingSwipeActions: [.archive, .delete],
cardStyle: .library
)
)
@StateObject private var highlightsViewModel = HomeFeedViewModel(
fetcher: InboxFetcher(),
listConfig: LibraryListConfig(
hasFeatureCards: true,
leadingSwipeActions: [.pin],
trailingSwipeActions: [.archive, .delete],
cardStyle: .highlights
)
)
@State var selectedTab = "following"
var body: some View {
VStack(spacing: 0) {
TabView(selection: $selectedTab) {
NavigationView {
HomeView(viewModel: followingViewModel)
.navigationViewStyle(.stack)
}
.tag("following")
NavigationView {
HomeView(viewModel: libraryViewModel)
.navigationViewStyle(.stack)
}
.tag("inbox")
NavigationView {
ProfileView()
.navigationViewStyle(.stack)
}
.tag("profile")
}
CustomTabBar(selectedTab: $selectedTab)
}
.ignoresSafeArea()
}
}