Skip to content

Commit

Permalink
Fix an issue with filter only working once:
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jan 24, 2023
1 parent dad8d82 commit 9a674ca
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
19 changes: 12 additions & 7 deletions Sources/PulseUI/Features/Console/ConsoleView-ios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ public struct ConsoleView: View {
.onAppear { viewModel.isViewVisible = true }
.onDisappear { viewModel.isViewVisible = false }
.navigationTitle(viewModel.title)
.navigationBarItems(leading: leadingNavigationBarItems, trailing: trailingNavigationBarItems)
.toolbar {
ToolbarItemGroup(placement: .navigationBarLeading) {
leadingNavigationBarItems
}
ToolbarItemGroup(placement: .navigationBarTrailing) {
trailingNavigationBarItems
}
}
.background(ConsoleRouterView(viewModel: viewModel))
}

Expand All @@ -40,13 +47,11 @@ public struct ConsoleView: View {
private var trailingNavigationBarItems: some View {
switch viewModel.source {
case .store:
HStack {
ConsoleShareButton(viewModel: viewModel)
Button(action: { viewModel.router.isShowingFilters = true }) {
Image(systemName: "line.horizontal.3.decrease.circle")
}
ConsoleContextMenu(viewModel: viewModel)
ConsoleShareButton(viewModel: viewModel)
Button(action: { viewModel.router.isShowingFilters = true }) {
Image(systemName: "line.horizontal.3.decrease.circle")
}
ConsoleContextMenu(viewModel: viewModel)
case .entities:
ConsoleShareButton(viewModel: viewModel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct ConsoleToolbarView: View {
}
}
Spacer()
HStack(spacing: 12) {
HStack(spacing: 14) {
ConsoleFiltersView(viewModel: viewModel)
}.padding(.trailing, -2)
}
Expand Down
40 changes: 21 additions & 19 deletions Sources/PulseUI/Features/Inspector/NetworkInspectorView-ios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ struct NetworkInspectorView: View {
contents
}
.inlineNavigationTitle(viewModel.title)
.navigationBarItems(trailing: trailingNavigationBarItems)
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
trailingNavigationBarItems
}
}
.sheet(item: $shareItems, content: ShareView.init)
}

Expand Down Expand Up @@ -62,24 +66,22 @@ struct NetworkInspectorView: View {

@ViewBuilder
private var trailingNavigationBarItems: some View {
HStack {
viewModel.pinViewModel.map { PinButton(viewModel: $0, isTextNeeded: false) }
Menu(content: {
AttributedStringShareMenu(shareItems: $shareItems) {
TextRenderer(options: .sharing).make { $0.render(viewModel.task, content: .sharing) }
}
Button(action: { shareItems = ShareItems([viewModel.task.cURLDescription()]) }) {
Label("Share as cURL", systemImage: "square.and.arrow.up")
}
}, label: {
Image(systemName: "square.and.arrow.up")
})
Menu(content: {
NetworkMessageContextMenu(task: viewModel.task, sharedItems: $shareItems)
}, label: {
Image(systemName: "ellipsis.circle")
})
}
viewModel.pinViewModel.map { PinButton(viewModel: $0, isTextNeeded: false) }
Menu(content: {
AttributedStringShareMenu(shareItems: $shareItems) {
TextRenderer(options: .sharing).make { $0.render(viewModel.task, content: .sharing) }
}
Button(action: { shareItems = ShareItems([viewModel.task.cURLDescription()]) }) {
Label("Share as cURL", systemImage: "square.and.arrow.up")
}
}, label: {
Image(systemName: "square.and.arrow.up")
})
Menu(content: {
NetworkMessageContextMenu(task: viewModel.task, sharedItems: $shareItems)
}, label: {
Image(systemName: "ellipsis.circle")
})
}
}

Expand Down

0 comments on commit 9a674ca

Please sign in to comment.