load profile view model from home view model
This commit is contained in:
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user