Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: CI

on:
push:
branches:
- main
- master
pull_request:

concurrency:
Expand All @@ -14,8 +11,6 @@ concurrency:
jobs:
build-and-test:
runs-on: macos-26
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"

steps:
- name: Check out repository
Expand All @@ -29,18 +24,21 @@ jobs:
- name: Show Xcode version
run: xcodebuild -version

- name: Install XcodeGen
run: brew install xcodegen
- name: Install tools
run: brew install xcodegen swiftlint

- name: Generate Xcode project
run: xcodegen generate
- name: Lint
run: swiftlint lint --quiet --strict Apps Packages/InspectCore/Sources

- name: Test InspectCore package
shell: bash
run: |
set -o pipefail
swift test --package-path Packages/InspectCore

- name: Generate Xcode project
run: xcodegen generate

- name: Build iOS app for Simulator
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ output/
Pods/
fastlane/README.md
fastlane/report.xml
Configs/LocalOverrides.xcconfig
project.local.yml
.asc/
Rust/**/target/
Inspect.xcodeproj/
11 changes: 9 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ disabled_rules:
- line_length
- file_length
- type_body_length
- identifier_name
- cyclomatic_complexity
- function_body_length
- opening_brace
- optional_data_string_conversion
- trailing_comma

excluded:
- Carthage
Expand All @@ -13,4 +15,9 @@ excluded:
- ./QRCode


identifier_name:
excluded:
- i
- id

force_cast: warning
4 changes: 2 additions & 2 deletions Apps/iOS/Sources/InspectAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import UIKit

final class InspectAppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
_: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
options _: UIScene.ConnectionOptions
) -> UISceneConfiguration {
let configuration = UISceneConfiguration(
name: nil,
Expand Down
20 changes: 10 additions & 10 deletions Apps/iOS/Sources/InspectAppRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ struct InspectAppRootView: View {
showsMonitorCard: false,
showsAboutCard: false
)
.tabItem {
Label(InspectSection.inspect.title, systemImage: InspectSection.inspect.systemImage)
}
.tag(InspectSection.inspect)
.accessibilityIdentifier("tab.inspect")
.tabItem {
Label(InspectSection.inspect.title, systemImage: InspectSection.inspect.systemImage)
}
.tag(InspectSection.inspect)
.accessibilityIdentifier("tab.inspect")

InspectionMonitorView {
await liveMonitorManager.refresh()
}
.tabItem {
Label(InspectSection.monitor.title, systemImage: InspectSection.monitor.systemImage)
}
.tag(InspectSection.monitor)
.accessibilityIdentifier("tab.monitor")
.tabItem {
Label(InspectSection.monitor.title, systemImage: InspectSection.monitor.systemImage)
}
.tag(InspectSection.monitor)
.accessibilityIdentifier("tab.monitor")

InspectSettingsView(manager: liveMonitorManager)
.tabItem {
Expand Down
2 changes: 1 addition & 1 deletion Apps/iOS/Sources/InspectQuickAction.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import UIKit
import InspectKit
import UIKit

enum InspectQuickAction {
static let inspectType = "in.fourplex.Inspect.shortcut.inspect"
Expand Down
9 changes: 5 additions & 4 deletions Apps/iOS/Sources/InspectSceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import UIKit

final class InspectSceneDelegate: NSObject, UIWindowSceneDelegate {
func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
_: UIScene,
willConnectTo _: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
guard let shortcutItem = connectionOptions.shortcutItem,
let route = InspectQuickAction.route(for: shortcutItem) else {
let route = InspectQuickAction.route(for: shortcutItem)
else {
return
}

InspectAppRouteCenter.submit(route)
}

func windowScene(
_ windowScene: UIWindowScene,
_: UIWindowScene,
performActionFor shortcutItem: UIApplicationShortcutItem,
completionHandler: @escaping (Bool) -> Void
) {
Expand Down
2 changes: 1 addition & 1 deletion Apps/iOS/Sources/InspectSettingsSections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct InspectTunnelSettingsSection: View {
systemImage: "checkmark.shield",
tint: .green
) {
Text(manager.isConfigured ? InspectionCommonStrings.yes : InspectionCommonStrings.no)
Text(manager.isConfigured ? InspectionCommonStrings.yesLabel : InspectionCommonStrings.noLabel)
.font(.subheadline.weight(.medium))
.foregroundStyle(.primary)
.monospacedDigit()
Expand Down
14 changes: 7 additions & 7 deletions Apps/iOS/Sources/LiveMonitorManager.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Foundation
import InspectCore
import InspectKit
import Foundation
@preconcurrency import NetworkExtension
import Observation
#if canImport(WidgetKit)
import WidgetKit
import WidgetKit
#endif

@MainActor
Expand Down Expand Up @@ -36,10 +36,10 @@ final class LiveMonitorManager {
if desiredLiveMonitorEnabled == nil {
desiredLiveMonitorEnabled = LiveMonitorTunnelState.isActive(for: manager.connection.status)
}
self.lastErrorMessage = nil
lastErrorMessage = nil
logger.verbose("Refresh complete. status=\(manager.connection.status.inspectionDescription) configured=\(manager.isEnabled)")
} catch {
self.lastErrorMessage = error.localizedDescription
lastErrorMessage = error.localizedDescription
logger.critical("Refresh failed: \(error.localizedDescription)")
}
}
Expand Down Expand Up @@ -167,9 +167,9 @@ final class LiveMonitorManager {
InspectionLiveMonitorPreferenceStore.setEnabled(
LiveMonitorTunnelState.isActive(for: currentStatus)
)
#if canImport(WidgetKit)
WidgetCenter.shared.reloadTimelines(ofKind: InspectWidgetKind.liveMonitor)
#endif
#if canImport(WidgetKit)
WidgetCenter.shared.reloadTimelines(ofKind: InspectWidgetKind.liveMonitor)
#endif
logger.verbose("Updated state. status=\(currentStatus.inspectionDescription) configured=\(isConfigured)")
}

Expand Down
5 changes: 3 additions & 2 deletions Apps/macOS/Sources/InspectMacLiveMonitorManager.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import InspectCore
import InspectKit
import Foundation
@preconcurrency import NetworkExtension
import Observation

Expand Down Expand Up @@ -184,7 +184,8 @@ final class InspectMacLiveMonitorManager {

if preservesActiveStatus,
LiveMonitorTunnelState.isActive(for: status),
LiveMonitorTunnelState.isActive(for: refreshedStatus) == false {
LiveMonitorTunnelState.isActive(for: refreshedStatus) == false
{
effectiveStatus = status
} else {
effectiveStatus = refreshedStatus
Expand Down
39 changes: 25 additions & 14 deletions Apps/macOS/Sources/InspectMacRootView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AppKit
import InspectCore
import InspectKit
import SwiftUI

Expand Down Expand Up @@ -56,7 +57,8 @@ struct InspectMacRootView: View {
case let .report(report, opensCertificateDetail):
if opensCertificateDetail {
externalCertificateRoute = InspectionCertificateRoute(
report: report,
inspection: TLSInspection(report: report),
initialReportIndex: 0,
initialSelectionIndex: 0
)
} else {
Expand All @@ -77,7 +79,8 @@ struct InspectMacRootView: View {
case let .report(report, opensCertificateDetail):
if opensCertificateDetail {
externalCertificateRoute = InspectionCertificateRoute(
report: report,
inspection: TLSInspection(report: report),
initialReportIndex: 0,
initialSelectionIndex: 0
)
}
Expand All @@ -99,26 +102,34 @@ struct InspectMacRootView: View {
@ViewBuilder
private var detailView: some View {
let inspectSessionID = appModel.inspectSessionID

switch appModel.selectedSection {
case .inspect:
ZStack {
InspectionRootView(
showsMonitorCard: false,
showsAboutCard: false
)
.id(inspectSessionID)
case .monitor:
.opacity(appModel.selectedSection == .inspect ? 1 : 0)
.allowsHitTesting(appModel.selectedSection == .inspect)
.accessibilityHidden(appModel.selectedSection != .inspect)

InspectionMonitorView {
await manager.refresh()
}
case .settings:
InspectMacSettingsView(manager: manager)
case nil:
ContentUnavailableView(
"Select a Section",
systemImage: "sidebar.left",
description: Text("Choose Inspect, Monitor, or Settings from the sidebar.")
)
.opacity(appModel.selectedSection == .monitor ? 1 : 0)
.allowsHitTesting(appModel.selectedSection == .monitor)
.accessibilityHidden(appModel.selectedSection != .monitor)

if appModel.selectedSection == .settings {
InspectMacSettingsView(manager: manager)
}

if appModel.selectedSection == nil {
ContentUnavailableView(
"Select a Section",
systemImage: "sidebar.left",
description: Text("Choose Inspect, Monitor, or Settings from the sidebar.")
)
}
}
}
}
2 changes: 1 addition & 1 deletion Apps/macOS/Sources/InspectMacSettingsSections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct InspectMacLiveMonitorSettingsSection: View {
systemImage: "checkmark.shield",
tint: .green
) {
Text(manager.isConfigured ? InspectionCommonStrings.yes : InspectionCommonStrings.no)
Text(manager.isConfigured ? InspectionCommonStrings.yesLabel : InspectionCommonStrings.noLabel)
.font(.body.weight(.medium))
}

Expand Down
2 changes: 1 addition & 1 deletion Apps/macOS/Sources/InspectMacTunnelProfile.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

struct InspectMacTunnelProfile: Sendable {
struct InspectMacTunnelProfile {
let localizedDescription: String
let serverAddress: String
let providerBundleIdentifier: String
Expand Down
4 changes: 2 additions & 2 deletions Apps/macOS/Sources/InspectMacVerificationSections.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import InspectKit
import InspectCore
import InspectKit
@preconcurrency import NetworkExtension
import SwiftUI

Expand Down Expand Up @@ -32,7 +32,7 @@ struct InspectMacVerificationProfileCard: View {
GridRow {
Text("Configured")
.foregroundStyle(.secondary)
Text(isConfigured ? InspectionCommonStrings.yes : InspectionCommonStrings.no)
Text(isConfigured ? InspectionCommonStrings.yesLabel : InspectionCommonStrings.noLabel)
.fontWeight(.medium)
}

Expand Down
7 changes: 4 additions & 3 deletions Apps/macOS/Sources/InspectMacWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ final class InspectMacWindowController {

private func installDockIcon() {
guard let iconURL = Bundle.main.url(forResource: "Inspect", withExtension: "icns"),
let iconImage = NSImage(contentsOf: iconURL) else {
let iconImage = NSImage(contentsOf: iconURL)
else {
return
}

Expand All @@ -79,7 +80,7 @@ final class InspectMacWindowController {
struct InspectMacWindowReader: NSViewRepresentable {
let onResolve: @MainActor (NSWindow) -> Void

func makeNSView(context: Context) -> NSView {
func makeNSView(context _: Context) -> NSView {
let view = NSView(frame: .zero)
DispatchQueue.main.async {
if let window = view.window {
Expand All @@ -89,7 +90,7 @@ struct InspectMacWindowReader: NSViewRepresentable {
return view
}

func updateNSView(_ nsView: NSView, context: Context) {
func updateNSView(_ nsView: NSView, context _: Context) {
DispatchQueue.main.async {
if let window = nsView.window {
onResolve(window)
Expand Down
10 changes: 5 additions & 5 deletions Apps/macOS/Sources/MacSystemExtensionActivator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ final class MacSystemExtensionActivator: NSObject, OSSystemExtensionRequestDeleg
}
}

func requestNeedsUserApproval(_ request: OSSystemExtensionRequest) {
func requestNeedsUserApproval(_: OSSystemExtensionRequest) {
onApprovalRequired?()
}

func request(
_ request: OSSystemExtensionRequest,
didFinishWithResult result: OSSystemExtensionRequest.Result
didFinishWithResult _: OSSystemExtensionRequest.Result
) {
finish(request: request, result: .success(()))
}
Expand All @@ -37,9 +37,9 @@ final class MacSystemExtensionActivator: NSObject, OSSystemExtensionRequestDeleg
}

func request(
_ request: OSSystemExtensionRequest,
actionForReplacingExtension existing: OSSystemExtensionProperties,
withExtension ext: OSSystemExtensionProperties
_: OSSystemExtensionRequest,
actionForReplacingExtension _: OSSystemExtensionProperties,
withExtension _: OSSystemExtensionProperties
) -> OSSystemExtensionRequest.ReplacementAction {
.replace
}
Expand Down
3 changes: 0 additions & 3 deletions Configs/LocalOverrides.xcconfig.example

This file was deleted.

1 change: 0 additions & 1 deletion Configs/Project.xcconfig

This file was deleted.

Loading
Loading