Commit Graph

2959 Commits

Author SHA1 Message Date
Davide 93a15cd766
Review incorrect behavior in preferences (#989)
- Save/rollback was done outside of MOC
- Use different contexts for module/provider preferences
  - Save providers → also saves modules
  - Discard modules → also discards providers
- Use background context because it's not automatically merged (can
rollback)
- Expose ModulePreferences in OpenVPNView as StateObject
- Rework Blacklist to a more reusable ObservableList
- Reapply #988
2024-12-09 08:44:13 +01:00
Davide c72a69829b
Fix compile error on TV 2024-12-09 07:59:37 +01:00
Davide 70200b17ea
Bump version 2024-12-09 02:07:36 +01:00
Davide fae0200995
Exclude OpenVPN endpoints (#987)
Exclude endpoints from OpenVPN modules and providers with the generic
Blacklist<T> observable. Eventually, rebuild the Profile in
PacketTunnelProvider (via DefaultTunnelProcessor) with the applied
exclusions from preferences.

Revisit approach to preferences:

- Module preferences
  - Tied to the module and therefore to the parent profile
- Load/save in ProfileEditor on request (rather than on
ProfileEditor.load)
- Provider preferences
  - Shared globally across profiles
  - Load/save in module view if needed

For more consistency with Core Data:

- Revert to observables for both module and provider preferences
- Treat excluded endpoints as relationships rather than a serialized
Array
- Add/remove single relationships over bulk delete + re-add
- Do not map the relationships, Blacklist only needs exists/add/remove:
  - isExcludedEndpoint
  - addExcludedEndpoint
  - removeExcludedEndpoint

Some clean-up:

- Move the importer logic to OpenVPNView.ImportModifier
- Move the preview data to OpenVPN.Configuration.Builder.forPreviews
- Drop objectWillChange.send() on .repository didSet to avoid potential
recursion during SwiftUI updates

Closes #971
2024-12-09 02:00:55 +01:00
Davide 5f20d791c2
Show module UUID in DEBUG 2024-12-09 01:01:01 +01:00
Davide 52bda60b05
Fix missing animations in profiles list (#986)
The list was not animating e.g. on iCloud updates. Move
.themeAnimation() from ProfileContainerView (ContainerModifier) to
ProfileListView/ProfileGridView.
2024-12-09 00:53:46 +01:00
Davide f1a0ecadfa
Unobserve ProfileEditor 2024-12-09 00:25:54 +01:00
Davide e2402007c9
Select preset matching current filter (#985)
E.g. Mullvad was not selecting "Custom DNS".
2024-12-09 00:25:09 +01:00
Davide edaa151911
Fix compile errors from #984 2024-12-08 19:02:31 +01:00
Davide f7013a98a9
Separate App/Tunnel responsibilities (#984)
Sort out the increasing mess coming from:

- AppContext*
- Dependencies
- Shared*

by doing the following:

- Keep in the "Shared" folder only the entities actually shared by
App/Tunnel
  - Create TunnelContext
  - Move AppContext and related to the App/Context folder
  - Move TunnelContext and related to the Tunnel/Context folder
- Delete Shared+* extensions, use AppContext/TunnelContext singletons
from the app
- Create a Dependencies factory singleton to create entities in a single
place
  - Split extensions by domain
- Make it clear with `func` vs `var` when a dependency method returns a
new instance
2024-12-08 18:56:39 +01:00
Davide aac04c4008
Move processor implementations to concrete objects (#983)
Formerly via blocks, now with final classes.

App:

- ProfileProcessor
- AppTunnelProcessor
- Implemented by DefaultAppProcessor in app
- Implemented by MockAppProcessor in UILibrary (for previews)

Tunnel:

- PacketTunnelProcessor
- Implemented by DefaultTunnelProcessor
2024-12-08 16:24:23 +01:00
Davide a4ebea1f95
Handle load/save preferences inside ProfileEditor (#982)
Simplify preferences model by doing a bulk load/save together with
load/save Profile. ModulePreferences is now a struct rather than an
ObservableObject, because it doesn't need ad hoc observation. It's just
a binding to ProfileEditor.preferences

Fix:

- Disable CloudKit in tunnel singleton of PreferencesManager
(.sharedForTunnel)

Additionally:

- Replace MainActor in PreferencesManager with Sendable (immutable)
- Replace MainActor from ProviderPreferencesRepository with Sendable
(syncs on NSManagedObjectContext)
- Drop ModuleMetadata for good
2024-12-08 16:05:23 +01:00
Davide 14847b2de5
Fix missing test targets 2024-12-06 15:52:25 +01:00
Davide 365aa50e7a
Bump version 2024-12-06 15:34:01 +01:00
Davide d4eed89e9f
Allow "Routing" module in beta 2024-12-06 15:31:01 +01:00
Davide 36b8024e5b
Fix deadlock regression in DNS resolution 2024-12-06 15:25:45 +01:00
Davide e663f48bc3
Update library
- Make userInfo AnyHashable
- Prepare for profile processing in tunnel
2024-12-06 11:25:54 +01:00
Davide dfae6afcb4
Store complex preferences to Core Data (#981)
Replace favorites entities with a PreferencesManager, that returns
observables for:

- Module preferences (by module UUID)
- Provider preferences (by ProviderID)

Automate preferences availability in:

- Module views (empty for now)
- VPN server view (favorites)

Synchronize preferences by making this a CloudKit container. Preferences
are also available in the Tunnel by storing the container in the App
Group.
2024-12-06 11:24:51 +01:00
Davide f8655b09af
Move error handler to AppCoordinator 2024-12-06 10:29:50 +01:00
Davide 0fd544348f
Disclose details about selected provider server configuration (#980)
Like in v2.
2024-12-04 20:50:51 +01:00
Davide d8f5caa2f7
Improve "Purchased" view (#979)
- Show eligible features first
- Render ineligible features as secondary
2024-12-04 17:38:13 +01:00
Davide 4ef47dfd77
Bump version 2024-12-04 14:21:29 +01:00
Davide 79bb6e6bdb
Update library again
- Drop -Type suffixes from associated types
- Rename to IdentifiableConfiguration
2024-12-04 13:47:26 +01:00
Davide 355974292e
Update library with provider entities (#978) 2024-12-04 12:40:47 +01:00
Davide d4543b49ac
Update library with Provider.Metadata renaming 2024-12-04 09:26:10 +01:00
Davide d53a01864b
Fix unfriendly message on import OpenVPN
Fixes #977
2024-12-04 09:11:16 +01:00
Davide 0aaef04a25
Refactor with provider customizations (#976)
Update library with new API.
2024-12-03 20:28:33 +01:00
Davide 2d93fa64c6
Embrace simplifications in PassepartoutProviders (#975)
Update library with the new domain reorganization.
2024-12-03 16:18:05 +01:00
Davide 7611f6f7d2
Fix a tunnel crash during DNS resolution 2024-12-02 18:59:18 +01:00
Davide d6ebf4bc18
Fix .lifetime not being credited all features 2024-12-02 12:08:30 +01:00
Davide 3540e1cb1a
Redesign confusing paywall (#973)
- Split suggested product and full version
- Hide sections with no products
- Hide full features if no full products
- Fail if no purchasable products
2024-12-02 10:40:25 +01:00
Davide d885ad2a3d
Add template for import tests 2024-12-02 09:25:19 +01:00
Davide bcd7dff4d5
Bump version 2024-12-02 00:23:23 +01:00
Davide 2447db19e2
Fix compile error on TV 2024-12-02 00:23:13 +01:00
Davide c50862ff6f
Bump version 2024-12-02 00:16:16 +01:00
Davide abd1d5bb9b
Enable animations in OpenVPN credentials 2024-12-02 00:11:52 +01:00
Davide a2544b33ac
Hide OpenVPN password if provider does not require it (#970) 2024-12-02 00:01:35 +01:00
Davide 14ce23f25b
Improve confusing footer modifiers (#969)
There was duplication and a ugly `#if os(macOS)` with some footers
explicitly rendered on macOS with .themeFooter() (now .themeSubtitle()).

Move this logic to the .themeSection() modifiers by adding a
`forcesFooter` parameter. When true, a fake footer is added on macOS as
the last row of a section.
2024-12-01 23:23:51 +01:00
Davide 0a1886fe31
Handle all connection attempts in AppCoordinator (#968)
Let the AppCoordinator take care of the connection requirements via
modals:

- onInteractiveLogin() - now presented on AppError
- onProviderEntityRequired()
- onPurchaseRequired()
- Any other connection error

Subviews must not use tunnel.connect(), rather they route connection
requests via the ConnectionFlow callbacks. In particular, migrate to the
AppCoordinator the connection logic from:

- TunnelToggleButton.perform()
- ProviderEntitySelector.onSelect()

onInteractiveLogin() and onPurchaseRequired() are now handled
internally, while onProviderEntityRequired() is kept public because it's
how subviews may present the entity selector.

Extras:

- Avoid modals overlap with a 500ms delay
- Shrink interactive login size on macOS
2024-12-01 22:34:41 +01:00
Davide f87cc1da0b
Fix OpenVPN/WireGuard import error messages (#967)
OpenVPN parser was indirectly swallowing WireGuard errors.
2024-12-01 21:33:58 +01:00
Davide 725168b652
Show guidance regardless of OTP method 2024-11-30 16:15:04 +01:00
Davide 1a25102ec3
Add guidance for OpenVPN provider credentials (#966)
Some providers require specific credentials for OpenVPN, different from
account credentials. Update the API index with this information to show
an information footer and possibly a link to the OpenVPN credentials.

Also, fix the OTP footer not appearing on macOS.
2024-11-29 15:25:22 +01:00
Davide 8c305688cc
Always use setLater for paywall
Fixes #951
2024-11-29 00:13:00 +01:00
Davide d8f5aed665
Update release notes on bump (#965)
Refine symlink scripts too.
2024-11-29 00:10:22 +01:00
Davide 63496725c8
Transparent logo in version screen (#963)
Looks better on macOS and allows gradient on tvOS.
2024-11-28 22:59:37 +01:00
Davide e761979134
Extend ProfileManager events (#964)
Especially for flaky tests:

- Do objectWillChange.send() _before_ performing the change
- Send more events to .didChange to be more deterministic about test
expectations
2024-11-28 22:56:12 +01:00
Davide ed413a748e
Update SwiftLint/SwiftGen YAML 2024-11-28 19:54:50 +01:00
Davide 3a511b9474
Drop empty folder 2024-11-28 18:50:58 +01:00
Davide 7af703c164
Move app library to the root (#962)
Makes it easier to search among app files and library files.
2024-11-28 17:45:18 +01:00
Davide 2a467e0c7e
Separate AppContext for previews and UI testing (#961)
Clarify the use of contexts:

- **Production** (.shared)
- **Previews** (.mock → .forPreviews)
  - ONLY use it in UILibrary for, well, previews
  - This context has dumb profiles with UUIDs as names
  - Registry is fake
- **UI Tests** (.forUITesting)
  - Add new context for UI testing
  - Selected based on command line arguments
  - This context has mock data tuned for decent screenshots
  - Registry is real

Share the same InAppProcessor in .shared and .forTesting contexts
because the app behavior was inconsistent regarding e.g. in-app
purchases.
2024-11-28 17:31:17 +01:00