Initial project setup - Phases 1-3 complete

This commit is contained in:
Trey t
2026-04-06 11:28:40 -05:00
commit c77e506db5
293 changed files with 14233 additions and 0 deletions

46
UI/Pin/PinView.swift Normal file
View File

@@ -0,0 +1,46 @@
import SwiftUI
import ProxyCore
import GRDB
struct PinView: View {
@State private var pinnedRequests: [CapturedTraffic] = []
@State private var observation: AnyDatabaseCancellable?
private let trafficRepo = TrafficRepository()
var body: some View {
Group {
if pinnedRequests.isEmpty {
EmptyStateView(
icon: "pin.slash",
title: "No Pinned Requests",
subtitle: "Pin requests from the Home tab to save them here for quick access."
)
} else {
List {
ForEach(pinnedRequests) { request in
NavigationLink(value: request.id) {
TrafficRowView(traffic: request)
}
}
}
.navigationDestination(for: Int64?.self) { id in
if let id {
RequestDetailView(trafficId: id)
}
}
}
}
.navigationTitle("Pin")
.task {
observation = trafficRepo.observePinnedTraffic()
.start(in: DatabaseManager.shared.dbPool) { error in
print("Pin observation error: \(error)")
} onChange: { pinned in
withAnimation {
pinnedRequests = pinned
}
}
}
}
}