mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
load profile view model from home view model
This commit is contained in:
parent
762747be95
commit
9b04a162c7
3 changed files with 11 additions and 12 deletions
|
|
@ -11,6 +11,10 @@ extension HomeFeedViewModel {
|
|||
LinkItemDetailViewModel.make(feedItem: feedItem, services: services)
|
||||
}
|
||||
|
||||
if UIDevice.isIPhone {
|
||||
viewModel.profileContainerViewModel = ProfileContainerViewModel.make(services: services)
|
||||
}
|
||||
|
||||
viewModel.bind(services: services)
|
||||
viewModel.loadItems(dataService: services.dataService, searchQuery: nil, isRefresh: false)
|
||||
return viewModel
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import Utils
|
|||
public final class HomeFeedViewModel: ObservableObject {
|
||||
let detailViewModelCreator: (FeedItem) -> LinkItemDetailViewModel
|
||||
var currentDetailViewModel: LinkItemDetailViewModel?
|
||||
public var profileContainerViewModel: ProfileContainerViewModel?
|
||||
|
||||
@Published public var items = [FeedItem]()
|
||||
@Published public var isLoading = false
|
||||
|
|
@ -256,13 +257,15 @@ public struct HomeFeedView: View {
|
|||
|
||||
public var body: some View {
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPhone {
|
||||
if UIDevice.isIPhone, let profileContainerViewModel = viewModel.profileContainerViewModel {
|
||||
NavigationView {
|
||||
conditionalInnerBody
|
||||
.toolbar {
|
||||
ToolbarItem {
|
||||
NavigationLink(
|
||||
destination: { EmptyView() },
|
||||
destination: {
|
||||
ProfileContainerView(viewModel: profileContainerViewModel)
|
||||
},
|
||||
label: { Image.profileTab.padding() }
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,16 +30,8 @@ public struct ProfileContainerView: View {
|
|||
|
||||
public var body: some View {
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPhone {
|
||||
NavigationView {
|
||||
Form {
|
||||
innerBody
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Form {
|
||||
innerBody
|
||||
}
|
||||
Form {
|
||||
innerBody
|
||||
}
|
||||
#elseif os(macOS)
|
||||
List {
|
||||
|
|
|
|||
Loading…
Reference in a new issue