Skip to content

Commit ef641fd

Browse files
Fix tvOS bundle ID and update VPN integration docs
1 parent eae4811 commit ef641fd

10 files changed

Lines changed: 29 additions & 20 deletions

ADRs/0002-swiftui-feature-modules-as-swift-packages.md renamed to ADRs/0003-swiftui-feature-modules-as-swift-packages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-0002: SwiftUI Feature Modules as Swift Packages
1+
# ADR-0003: SwiftUI Feature Modules as Swift Packages
22

33
**Status:** Accepted
44
**Date:** 2026-03-13
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0003: Development with feature flags
1+
# 0004: Development with feature flags
22

33
Date: 2026-03-20
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0004: Replace KMP PIAAccount with a native Swift implementation
1+
# 0005: Replace KMP PIAAccount with a native Swift implementation
22

33
Date: 2026-03-30
44

ADRs/0005-replace-csi-sdk-with-internal-implementation.md renamed to ADRs/0006-replace-csi-sdk-with-internal-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0004: Replace CSI SDK with internal implementation
1+
# 0006: Replace CSI SDK with internal implementation
22

33
Date: 2026-04-02
44

ADRs/0006-ios-coordinator-navigation-pattern.md renamed to ADRs/0007-ios-coordinator-navigation-pattern.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0005: iOS Navigation Architecture — Coordinator Pattern
1+
# 0007: iOS Navigation Architecture — Coordinator Pattern
22

33
Date: 2026-06-05
44

@@ -245,4 +245,4 @@ Adoption is incremental. No existing screen needs to change until it is wrapped
245245

246246
- `PIA VPN/Core/RootCoordinator.swift` — existing root coordinator; starting point for `AppCoordinator` evolution
247247
- `PIA VPN/UI/` — existing ViewControllers; candidates for closure output adoption per flow
248-
- [ADR 0002](0002-swiftui-feature-modules-as-swift-packages.md) — SwiftUI feature modules as Swift packages (complementary to coordinator-owned SwiftUI flows)
248+
- [ADR 0003](0003-swiftui-feature-modules-as-swift-packages.md) — SwiftUI feature modules as Swift packages (complementary to coordinator-owned SwiftUI flows)

ADRs/0005-integrate-kape-platform-sdk-vpn-engine.md renamed to ADRs/0008-integrate-kape-platform-sdk-vpn-engine.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0005: Integrate the Kape Platform SDK VPN engine
1+
# 0008: Integrate the Kape Platform SDK VPN engine
22

33
Date: 2026-06-25
44

@@ -61,7 +61,7 @@ The same sources are built by two platform targets — `PlatformSDK-Tunnel-iOS`
6161
`PlatformSDK-Tunnel-tvOS.appex`. The app-side profile
6262
`KapePlatformSDKTunnelProfile: NetworkExtensionProfile` (in `PIALibrary`) configures it.
6363

64-
**App ↔ extension IPC — bidirectional shared state plus a provider message.** State flows in
64+
**App ↔ extension IPC — bidirectional shared state plus provider messages.** State flows in
6565
both directions through `PIATunnelSharedState` (a namespace whose payload is a nested `State`),
6666
persisted as `pia_platformsdk_state.json` in the shared app group (on tvOS under
6767
`Library/Caches`). Every write posts a Darwin notification so the other side observes the change
@@ -83,6 +83,11 @@ rather than polling.
8383
`PIAPacketTunnelRequest.switchLocation` message via `sendProviderMessage()`; the extension
8484
re-resolves its endpoints from shared state in place. This replaced an earlier client-side
8585
server-switch marker.
86+
- **Provider message (`dataUsage`).** The app queries the active session's cumulative byte counters
87+
with `PIAPacketTunnelRequest.dataUsage`. The extension reads them from the SDK session controller
88+
and returns a `PIADataUsage`-compatible JSON payload, which `KapePlatformSDKTunnelProfile` maps to
89+
PIALibrary's existing `Usage` model. The profile also exposes the Network Extension connection's
90+
`connectedDate`, preserving the existing dashboard duration and usage features.
8691

8792
**Three protocol modes, automatic by default.** Protocol selection is mapped through
8893
`KapePlatformSDKVPNType`, which centralises the persisted identifiers — `"PIA"` (OpenVPN),

ADRs/0007-unidirectional-mvi-architecture.md renamed to ADRs/0009-unidirectional-mvi-architecture.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0007: Unidirectional Data Flow (MVI) Architecture
1+
# 0009: Unidirectional Data Flow (MVI) Architecture
22

33
Date: 2026-07-07
44

@@ -8,7 +8,7 @@ PIA iOS adopts a **lightweight, hand-rolled unidirectional data flow (MVI) archi
88

99
### Starting position
1010

11-
The navigation layer is already governed by ADR 0006 (Coordinator pattern). The codebase has more SwiftUI Views than ViewControllers and has a developed reactive substrate with `ObservableObject` and `@Published` in use. However, PIA shares a class of state and testability problems that unidirectional data flow is designed to solve.
11+
The navigation layer is already governed by ADR 0007 (Coordinator pattern). The codebase has more SwiftUI Views than ViewControllers and has a developed reactive substrate with `ObservableObject` and `@Published` in use. However, PIA shares a class of state and testability problems that unidirectional data flow is designed to solve.
1212

1313
### Current pain points
1414

@@ -114,9 +114,9 @@ extension VPNFeatureDependencies {
114114
}
115115
```
116116

117-
### Relationship to ADR 0006 (Coordinator pattern)
117+
### Relationship to ADR 0007 (Coordinator pattern)
118118

119-
ADR 0006 defines the navigation layer. This ADR defines the state and business logic layer. A coordinator starts a feature by creating its `Store` and handing it to the feature view — the two are complementary.
119+
ADR 0007 defines the navigation layer. This ADR defines the state and business logic layer. A coordinator starts a feature by creating its `Store` and handing it to the feature view — the two are complementary.
120120

121121
### Shared Apple-platform standard
122122

@@ -154,7 +154,7 @@ The `State` / `Action` / `Reducer` / `Dependencies` layer is UI-agnostic. Featur
154154

155155
## References
156156

157-
- ADR 0006 — iOS Coordinator navigation pattern; the complementary navigation layer.
157+
- ADR 0007 — iOS Coordinator navigation pattern; the complementary navigation layer.
158158
- `LocalPackages/PIALibrary/Sources/PIALibrary/VPN/DefaultVPNProvider.swift` — primary first migration target.
159159
- `LocalPackages/PIALibrary/Sources/PIALibrary/Account/DefaultAccountProvider.swift` — second migration target.
160160
- [pointfreeco/swift-composable-architecture](https://github.com/pointfreeco/swift-composable-architecture) — the reference framework this pattern mirrors; the intended upgrade path if the hand-rolled design is outgrown.

LocalPackages/PIALocalizations/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Swift Package containing all localizable strings for the PIA VPN iOS and tvOS ap
44

55
## Overview
66

7-
This package is the single source of truth for all user-facing strings, per [ADR-0002](../../ADRs/0002-swiftui-feature-modules-as-swift-packages.md). Feature packages and the main app targets do not bundle their own `.strings` files.
7+
This package is the single source of truth for all user-facing strings, per [ADR-0003](../../ADRs/0003-swiftui-feature-modules-as-swift-packages.md). Feature packages and the main app targets do not bundle their own `.strings` files.
88

99
The `L10n` enum is generated by SwiftGen from `Localizable.strings` and provides type-safe access to all strings at compile time.
1010

LocalPackages/PIAVPN/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ class PacketTunnelProvider: PIAPacketTunnelProvider, @unchecked Sendable {}
3333

3434
- **WireGuard, OpenVPN, and Automatic.** `PIAPacketTunnelProvider` registers both a WireGuard and an
3535
OpenVPN `ConnectionController`; `PIAEndpointRepository` emits configurations per the selected
36-
protocol (`wireGuard`, `openVPN`, or `automatic` — WireGuard first, then OpenVPN), and the session
37-
controller routes each configuration to the matching controller by type.
36+
protocol. Automatic mode uses a protocol-major pecking order — WireGuard, OpenVPN-UDP, then
37+
OpenVPN-TCP — with a fixed number of fastest-first distinct endpoints per step. The order dictates
38+
the transport, port, and OpenVPN crypto rather than using the saved OpenVPN settings.
3839
- **No app-side manager.** PIA's app side keeps using `KapePlatformSDKTunnelProfile` and
3940
`PIATunnelSharedState` (in `PIALibrary`); this package is the extension-side engine glue only.
40-
- The app ↔ extension hand-off (selected location / DIP server, cached server list, protocol,
41-
latencies, DNS, MTU, token) flows through `PIATunnelSharedState` (file-based shared state in the
42-
App Group), read here by `PIAEndpointRepository` / `PIAPacketTunnelProvider`.
41+
- **Persistent shared state.** Connection inputs (selected location / DIP server, cached server list,
42+
protocol, latencies, DNS, MTU, token) and extension write-back (`activeConnection`, `tunnelStatus`)
43+
flow through `PIATunnelSharedState`, a file-based snapshot in the App Group.
44+
- **Live provider messages.** `PIAPacketTunnelRequest.switchLocation` asks the running session to
45+
re-resolve endpoints after the app changes shared state. `PIAPacketTunnelRequest.dataUsage` queries
46+
the SDK's cumulative byte counters and returns a `PIADataUsage`-compatible response to the app.
4347

4448
## Custom DNS
4549

PIA VPN.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2957,7 +2957,7 @@
29572957
MARKETING_VERSION = 1.0;
29582958
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
29592959
MTL_FAST_MATH = YES;
2960-
PRODUCT_BUNDLE_IDENTIFIER = "com.privateinternetaccess.ios.PIA-VPN";
2960+
PRODUCT_BUNDLE_IDENTIFIER = "$(APP_BUNDLE_IDENTIFIER)";
29612961
PRODUCT_NAME = "$(TARGET_NAME)";
29622962
SDKROOT = appletvos;
29632963
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";

0 commit comments

Comments
 (0)