mirror of
https://github.com/kean/Pulse.git
synced 2026-05-30 21:07:33 +00:00
New Request Summary design on tvOS
This commit is contained in:
@@ -55,8 +55,10 @@
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
launchAutomaticallySubstyle = "32">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/Pulse">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
@@ -64,7 +66,7 @@
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</RemoteRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
@@ -73,8 +75,10 @@
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
launchAutomaticallySubstyle = "32">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/Pulse">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
@@ -82,7 +86,16 @@
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
BuildableName = "Pulse Demo watchOS.app"
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
|
||||
@@ -54,8 +54,10 @@
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/Pulse">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
@@ -63,7 +65,7 @@
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</RemoteRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
@@ -71,8 +73,10 @@
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/Pulse">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
@@ -80,7 +84,16 @@
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0CEAB3D925FE862D00F09B0F"
|
||||
BuildableName = "Pulse Demo watchOS.app"
|
||||
BlueprintName = "Pulse Demo watchOS"
|
||||
ReferencedContainer = "container:Pulse.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
|
||||
@@ -5,25 +5,28 @@
|
||||
import SwiftUI
|
||||
import PulseCore
|
||||
|
||||
#if os(iOS) || os(watchOS) || os(macOS)
|
||||
|
||||
struct NetworkInspectorSummaryView: View {
|
||||
@ObservedObject var viewModel: NetworkInspectorSummaryViewModel
|
||||
|
||||
var body: some View {
|
||||
#if os(iOS) || os(macOS)
|
||||
ScrollView {
|
||||
VStack {
|
||||
contents
|
||||
}.padding()
|
||||
}.background(invisibleLinks)
|
||||
#elseif os(watchOS)
|
||||
ScrollView {
|
||||
#if os(watchOS)
|
||||
Spacer().frame(height: 24)
|
||||
VStack(spacing: 24) {
|
||||
contents
|
||||
}
|
||||
#else
|
||||
VStack {
|
||||
contents
|
||||
}.padding()
|
||||
#endif
|
||||
}.background(invisibleLinks)
|
||||
#elseif os(tvOS)
|
||||
List {
|
||||
contents
|
||||
}
|
||||
.background(linksView)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if os(iOS) || os(macOS)
|
||||
@@ -71,9 +74,42 @@ struct NetworkInspectorSummaryView: View {
|
||||
KeyValueSectionView(viewModel: viewModel.requestHeaders, limit: 10)
|
||||
KeyValueSectionView(viewModel: viewModel.responseHeaders, limit: 10)
|
||||
}
|
||||
#elseif os(tvOS)
|
||||
var metrics: NetworkInspectorMetricsViewModel?
|
||||
|
||||
@ViewBuilder
|
||||
private var contents: some View {
|
||||
makeKeyValueSection(viewModel: viewModel.summaryModel)
|
||||
if let error = viewModel.errorModel {
|
||||
makeKeyValueSection(viewModel: error)
|
||||
}
|
||||
NavigationLink(destination: NetworkInspectorResponseView(viewModel: viewModel.requestBodyViewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: viewModel.requestBodySection)
|
||||
}
|
||||
if viewModel.responseSummary != nil {
|
||||
NavigationLink(destination: NetworkInspectorResponseView(viewModel: viewModel.responseBodyViewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: viewModel.responseBodySection)
|
||||
}
|
||||
}
|
||||
if let timing = viewModel.timingDetailsModel, let metrics = metrics {
|
||||
NavigationLink(destination: NetworkInspectorMetricsView(viewModel: metrics).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: timing)
|
||||
}
|
||||
}
|
||||
makeKeyValueSection(viewModel: viewModel.requestHeaders)
|
||||
if viewModel.responseSummary != nil {
|
||||
makeKeyValueSection(viewModel: viewModel.responseHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
func makeKeyValueSection(viewModel: KeyValueSectionViewModel) -> some View {
|
||||
NavigationLink(destination: KeyValueSectionView(viewModel: viewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: viewModel, limit: 5)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private var linksView: some View {
|
||||
private var invisibleLinks: some View {
|
||||
VStack {
|
||||
if let errorModel = viewModel.errorModel {
|
||||
NavigationLink.programmatic(isActive: $viewModel.isErrorRawLinkActive) {
|
||||
@@ -104,5 +140,3 @@ struct NetworkInspectorSummaryView: View {
|
||||
.backport.hideAccessibility()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,57 +55,6 @@ struct NetworkInspectorView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
#elseif os(watchOS)
|
||||
var body: some View {
|
||||
NetworkInspectorSummaryView(viewModel: viewModel.makeSummaryModel())
|
||||
.navigationBarTitle(Text(viewModel.title))
|
||||
.toolbar {
|
||||
if let viewModel = viewModel.pin {
|
||||
PinButton(viewModel: viewModel, isTextNeeded: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
#elseif os(tvOS)
|
||||
var body: some View {
|
||||
List {
|
||||
let viewModel = self.viewModel.makeSummaryModel()
|
||||
|
||||
makeKeyValueSection(viewModel: viewModel.summaryModel)
|
||||
|
||||
if let error = viewModel.errorModel {
|
||||
makeKeyValueSection(viewModel: error)
|
||||
}
|
||||
if let request = viewModel.requestBodySection {
|
||||
NavigationLink(destination: NetworkInspectorResponseView(viewModel: viewModel.requestBodyViewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: request)
|
||||
}
|
||||
}
|
||||
if let response = viewModel.responseBodySection {
|
||||
NavigationLink(destination: NetworkInspectorResponseView(viewModel: viewModel.responseBodyViewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: response)
|
||||
}
|
||||
}
|
||||
if let timing = viewModel.timingDetailsModel, let metrics = self.viewModel.makeMetricsModel() {
|
||||
NavigationLink(destination: NetworkInspectorMetricsView(viewModel: metrics).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: timing)
|
||||
}
|
||||
}
|
||||
if let parameters = viewModel.requestParameters {
|
||||
makeKeyValueSection(viewModel: parameters)
|
||||
}
|
||||
|
||||
makeKeyValueSection(viewModel: viewModel.requestHeaders)
|
||||
if let responseHeaders = viewModel.responseHeaders {
|
||||
makeKeyValueSection(viewModel: responseHeaders)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func makeKeyValueSection(viewModel: KeyValueSectionViewModel) -> some View {
|
||||
NavigationLink(destination: KeyValueSectionView(viewModel: viewModel).focusable(true)) {
|
||||
KeyValueSectionView(viewModel: viewModel, limit: 5)
|
||||
}
|
||||
}
|
||||
#elseif os(macOS)
|
||||
let onClose: () -> Void
|
||||
|
||||
@@ -164,11 +113,23 @@ struct NetworkInspectorView: View {
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
|
||||
#elseif os(watchOS)
|
||||
var body: some View {
|
||||
NetworkInspectorSummaryView(viewModel: viewModel.makeSummaryModel())
|
||||
.navigationBarTitle(Text(viewModel.title))
|
||||
.toolbar {
|
||||
if let viewModel = viewModel.pin {
|
||||
PinButton(viewModel: viewModel, isTextNeeded: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
#elseif os(tvOS)
|
||||
var body: some View {
|
||||
NetworkInspectorSummaryView(viewModel: viewModel.makeSummaryModel(), metrics: viewModel.makeMetricsModel())
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(iOS) || os(macOS)
|
||||
|
||||
@ViewBuilder
|
||||
private var selectedTabView: some View {
|
||||
switch selectedTab {
|
||||
|
||||
Reference in New Issue
Block a user