Commit Graph

236 Commits

Author SHA1 Message Date
Davide 9ca103e949
Refactor modal size to be a modifer parameter (#877)
Way more flexible.
2024-11-15 23:32:54 +01:00
Davide b08243949c
Nested ZStack modifiers in progress/empty modifiers (#876)
Merge into a single modifier because they are used together.
2024-11-15 16:33:26 +01:00
Davide 55bb2e79c9
Modernize check for TestFlight build (#875)
Closes #874
2024-11-15 15:34:47 +01:00
Davide 09e894dd60
Add explicit environment objects to TableColumn (#873)
For some reason, Table doesn't seem to inherit the environment in some
cases. Reapply environment to each TableColumn (only Theme is required).

Work around what clearly seems to be a SwiftUI bug.

Fixes #872
2024-11-15 01:47:52 +01:00
Davide 962ffdf678
Sort servers by .serverId in repository 2024-11-15 00:24:36 +01:00
Davide 6472ac0502
Revert "Sort provider servers on iOS"
This reverts commit 2b3961aef0.
2024-11-15 00:22:06 +01:00
Davide 2b3961aef0
Sort provider servers on iOS 2024-11-15 00:00:57 +01:00
Davide b52e3c779b
Clean up and rename beta receipt variables 2024-11-14 22:52:52 +01:00
Davide 5818b36cda
Copy release receipt to tunnel (#871)
Not just the provided one, because it could be the sandbox receipt.

Fixes #870 further.
2024-11-14 19:42:38 +01:00
Davide 596f5702c9
Disable migrations UI 2024-11-14 19:15:10 +01:00
Davide f6361ebf06
Fix "Purchase required" in TestFlight (#870)
- Define separate IAPManager instances for app and tunnel (different
receipt URLs)
- Copy app receipt URL over to tunnel before install/connect
- Use AppTransaction to get original build number so that
FallbackReceiptReader is also much simpler now

Fixes #869
2024-11-14 19:12:51 +01:00
Davide 341ae97f50
Put migrated on-demand last 2024-11-14 15:19:07 +01:00
Davide 615f7d47bd
Import migrated profiles (#867)
Finalize basic flow started in #866.
2024-11-14 15:11:25 +01:00
Davide 114e1abe12
Add initial migration UI (#866)
Repurpose LegacyManager as MigrationManager. Present initial migration
UI from "+" menu in app home.

Different styles:

- iOS → Section / ForEach
- macOS → Table
2024-11-14 11:02:26 +01:00
Davide 7ef780b8a4
Decouple Mac settings from AppMenu (#865)
- Rename AppMenu.Model to MacSettingsModel for global reuse in macOS app
- Fix compile errors on iOS
2024-11-13 22:35:50 +01:00
Davide 6495f51dc1
Unify macOS toggles in menu/settings (#864)
Show in both:

- Launch on login
- Keep in menu bar
2024-11-13 22:04:34 +01:00
Davide 91344c1294
Only guard remote fingerprint if local has any (#863)
Otherwise, it would never import remote profiles w/o a fingerprint.

Scenarios (must test in #570):

- No local profile → Import
- Local profile has no fingerprint → Import
- Local profile has fingerprint
  - Remote profile has no fingerprint → Skip
  - Remote profile has same fingerprint → Skip
  - Remote profile has different fingerprint → Import
2024-11-13 21:46:14 +01:00
Davide 0a51d1a1f6
Strip package dependencies (#862)
The Library package offers the PassepartoutImplementations target for
OpenVPN/OpenSSL and WireGuard/Go, but it doesn't need it itself. Only
the main app does, so move the dependency there.

On the other side, drop the potentially problematic AppUI meta target.
Move platform filters to the Xcode project.

Indirectly fixes a crash with Xcode 16 Previews on iOS (forced to use
legacy previews before):

https://forums.developer.apple.com/forums/thread/756681
2024-11-13 21:05:53 +01:00
Davide 2d698cabfe
Reuse modifier for navigation stacks with close button (#861)
Refactored:

- iOS
  - VPNProviderServerView
- macOS
  - AboutView
  - ProfileSplitView
- Both
  - ProfileCoordinator
  - VPNProviderServerCoordinator
2024-11-13 19:17:00 +01:00
Davide 1b9b9cbd5c
Import initial remote profiles (#859)
Crucial on clean install.
2024-11-13 12:11:29 +01:00
Davide 008b78cc7c
Upgrade to Xcode 16 (#858)
- Address further restrictions on actor-isolation by using `nonisolated`
on:
  - Combine subjects
  - Core Data context/controller
  - Blocks
- In previews using inline `@State`, create a custom view instead
- Use `@retroactive` in l10n extensions
- Fix compile error in WireGuardKit
2024-11-13 12:07:30 +01:00
Davide 54f4364c33
Split test jobs (#855)
Move Core Data tests out of the Library package so that we can still use
the more efficient `swift test` for most tests.

Create a PassepartoutTests target only for tests that require
`xcodebuild`, like Core Data tests.

Eventually:

- PRs only run SwiftPM tests
- Releases run ALL tests with `scan` before `gym`
2024-11-12 18:35:44 +01:00
Davide e514ade036
Add logic to migrate v2 profiles (#854)
Will add UI separately.

Fixes #642
2024-11-12 16:42:19 +01:00
Davide 83d77fafbb
Expand selected server country on iOS (#853)
Add isExpanded binding to DisclosureGroup.
2024-11-11 20:21:02 +01:00
Davide 4ac524eb01
Exclude interactive login from v2 (#852) 2024-11-11 20:10:27 +01:00
Davide 1dfb013115
Implement some CustomDebugStringConvertible
- AppFeature
- AppProduct
- ProviderID
2024-11-11 19:45:56 +01:00
Davide fb0a9262c0
Fix double reload of selected provider server (#851)
Skip initial nil filter, overlaps with initial .reloadServers() in task.

Fixes #850
2024-11-11 16:11:09 +01:00
Davide 0686650ccf
React on providers eligibility (#848)
Check .providers eligibility in tunnel to prevent from starting if
profile has an active provider module. Do not alter original profile.
2024-11-11 12:50:26 +01:00
Davide 30ccd58d4a
Wait for initial profiles (#847)
Show progress view until initial local/remote profiles are fetched. May
visually improve later.
2024-11-11 12:08:22 +01:00
Davide d6ac4cd818
Use hidden icons for stable alignment (#844)
Align SF Symbols to the text baseline, but also include all possible
icons in ProfileAttributesView to precalculate a stable height for the
HStack.
2024-11-10 20:54:00 +01:00
Davide 7719630cdd
Limit tunnel updates (#843)
- Do not observe tunnel in grid/list
- Only observe .$currentProfile for grid selection
- Move row tunnel updates to MarkerView
- Debug InstalledProfileView
2024-11-10 19:39:43 +01:00
Davide bd4aeed97a
Disable animations on installed profile view
Fixes #836
2024-11-10 19:33:47 +01:00
Davide 44468b5d1f
Fix regression about handling of Core Data duplicates (#841)
Regression in #839 due to how NSFetchedResultsController was refactored.
Duplicated entities were not excluded from mapping.

Could "crash" the app with these easy steps:

- Pick a profile
- Unshare the profile on iOS
- Unshare the profile on macOS
- Re-share the profile on iCloud on both iOS and macOS
- Save the profile simultaneously on iOS/macOS
- Assertion failure due to duplicates in
ProfileManager.reloadRemoteProfiles() → "Remote repository must not have
duplicates"
2024-11-10 18:13:59 +01:00
Davide 21340e9f56
Rewrite AppContext event handlers (#839)
Loading remote profiles before local profiles may cause duplicated NE
managers. This happened because if local profiles are empty, any remote
profile is imported regardless of their former existence in the local
store. The importer just doesn't know.

Therefore, revisit the sequence of AppContext registrations:

- First off
- Skip Tunnel prepare() because NEProfileRepository.fetch() does it
already
- NE is both Tunnel and ProfileRepository, so calling tunnel.prepare()
loads local NE profiles twice
- onLaunch() - **run this once and before anything else**
  - Read local profiles
  - Reload in-app receipt
  - Observe in-app eligibility → Triggers onEligibleFeatures()
  - Observe profile save → Triggers onSaveProfile()
  - Fetch providers index
- onForeground()
  - Read local profiles
  - Read remote profiles, and toggle CloudKit sync based on eligibility
- onEligibleFeatures()
  - Read remote profiles, and toggle CloudKit sync based on eligibility
- onSaveProfile()
  - Reconnect if necessary
2024-11-10 17:51:28 +01:00
Davide fdbed7442c
Unrestrict some features in .beta (#840)
Add these features to the .beta user level:

- .interactiveLogin
- .sharing

Fixes #662
2024-11-10 16:53:01 +01:00
Davide 3a5e3889d3
Add more view modifiers (#838)
1. ThemeProgressViewModifier to replace content with a progress view
while a condition is active
2. ThemeEmptyContentModifier to replace content with a message if an
empty condition is met
3. Replace .opacity(bool ? 1.0 : 0.0) with .opaque(bool)

Reuse:

- 1 in PaywallView and DonateView
- 2 in ProfileContainerView
2024-11-10 12:00:07 +01:00
Davide e07833b2a4
Revisit in-app eligibility for iCloud sharing (#837)
Restore .sharing feature:

- Merge "Apple TV" into "iCloud" section
  - "Enabled", disabled if ineligible for .sharing
  - "Apple TV", disabled if ineligible for .appleTV || !isShared
- Footer about TV restrictions

Paywalls:

- "Share on iCloud" if ineligible for .sharing
- "Drop TV restriction" if eligible for .sharing but not for .appleTV
  - Applies to full version products (user level 2)
  - Suggest Apple TV product

Restrictions:

- Toggle CloudKit sync on remote repository based on .sharing
eligibility
- Do not start tunnel on Apple TV if ineligible for .appleTV

Fixes:

- Incorrect zip() publishers in remote repository
- Resolve duplicates in Core Data, first profile wins sorted by
lastUpdate descending
- Reload receipt on OOB IAPManager events
2024-11-09 15:20:59 +01:00
Davide d209b0d9b0
Fix compile error on iOS for previous commit 2024-11-08 15:51:56 +01:00
Davide 7c27125dd7
Decouple library from PassepartoutKit implementations (#834)
Move the following dependencies:

- OpenVPN/OpenSSL
- WireGuard/Go

up the chain until the main App/Tunnel targets, so that UILibrary and
CommonLibrary can abstract from these unnecessary details. Instead, give
module views access to generic implementations via Registry.

Incidentally, this fixes an issue preventing TV previews from working
due to OpenSSL linkage.
2024-11-08 12:37:09 +01:00
Davide fed3a9b7d1
Drop old FIXME 2024-11-07 23:56:44 +01:00
Davide bfc0be45ae
Hide donation link in beta 2024-11-07 23:10:26 +01:00
Davide 8fbccc6d80
Add donations UI and in-app error handling (#833)
- Reuse same product views from paywall
- Handle errors in fetch products
- Hide views on fetch products error
- Disable views during purchase

Closes #830
2024-11-07 23:02:10 +01:00
Davide 2c1ccbcbfd
Finalize paywall UI (#831)
- Use StoreKit views when available
- Offer one-time purchase
- Recurring subscriptions for all features
- Restore purchases

Remove .siri (Shortcuts), now free.

Closes #819
Closes #469
2024-11-07 18:27:36 +01:00
Davide 8ef1e7fbe9
Refactor theme section and styles (#829)
Provide shortcut for section with single row. Redesign Settings
accordingly.
2024-11-07 15:50:19 +01:00
Davide 21c1bbdf0d
Fix missing profile attributes initialization (#828)
Also, log them better during remote import.
2024-11-07 13:23:47 +01:00
Davide 22a5cb9af2
Update FIXMEs 2024-11-07 12:48:10 +01:00
Davide b128b3bf13
Erase shared profiles from iCloud correctly (#827)
Do not delete CloudKit zone. Instead, delete Core Data entities and let
sync do the rest. It's also a "more standard" approach.

Deleting the zone right after the entities legitimately makes deletion
ineffective, because it probably spoils sync.
2024-11-07 12:43:24 +01:00
Davide 142efa84d0
Always read local receipt in TestFlight (#826)
The condition came from v2, but the flow was different. Drop the
condition because it would always fail in TestFlight for macOS, where
sandbox and release receipts have the same URL.
2024-11-07 11:46:41 +01:00
Davide c32dcd6565
Fine-tune important logging categories (#825)
- .App.profiles for profiles management
- .App.iap for in-app purchases
2024-11-07 11:33:20 +01:00
Davide 5949ff1508
Read receipts in a serial fashion (#824)
Deal with reentrancy issues by ensuring serial execution.
2024-11-07 11:25:40 +01:00