Commit Graph

17 Commits

Author SHA1 Message Date
Davide De Rosa 92ffc382cb Reconnect VPN without disabling it
Retain on-demand flag to avoid leaks during reconnection.
2022-08-05 07:40:43 +02:00
Davide De Rosa 1c64253a1f Fix inverted profile lastUpdate logic
- Least recent was set last in the headers dictionary, thus
overwriting most recent (ascending = false)

- Mapping full profiles directly to array was generating
duplicates, use a dictionary to keep ID unicity
2022-08-04 23:36:09 +02:00
Davide De Rosa b183dece8c Fix logic to activate first created profile
Broken in dec7fb9030

VPN was lost when app was sent to background. Current (and active)
profile was persisted with nil isActive and instead of ignoring
profile activation, isActive was falling back to
allHeaders.isEmpty (false), erroneously deactivating the profile
and disconnecting the VPN.
2022-08-04 23:33:17 +02:00
Davide De Rosa 9195d426e4 Attempt beta release 2022-07-18 08:03:24 +02:00
Davide De Rosa 9458c4f3a3 Fix server description and sorting
- Name (countries, area)
- Index
- Tags

Also use short description in menu (without country prefix).
2022-07-16 17:39:42 +02:00
Davide De Rosa 48d8173871 Drop return in single line functions 2022-07-16 17:39:42 +02:00
Davide De Rosa dec7fb9030 Activate first created profile 2022-07-16 17:39:42 +02:00
Davide De Rosa 58e375ec41 Attach @MainActor where needed
Some methods were updating UI from non-main thread.
2022-07-16 17:39:42 +02:00
Davide De Rosa 3f4b55a003 Implement Mac bundle with system menu
Use bundle as a means to provide Mac APIs to Catalyst app.

In order to cross the @objc wall set by the Mac Bundle mechanism,
Swift structures cannot be used directly and must be bridged
through ObjC facades.

Create NSMenu in MVVM style and install it on app launch. Make
sure to do it in AppDelegate.applicationDidFinishLaunching(),
because doing it as early as in PassepartoutApp.init() would
crash Mac code.

Use .representedObject to own view models.

With menu in place, app can be sent to background when main window
is closed. Requires multiple documents support for app not to die
instantly.
2022-07-16 17:39:42 +02:00
Davide De Rosa 7d5f3e63c8 Add 'didUpdate' subjects in managers
objectWillChange may not work outside SwiftUI.

- ProfileManager.didUpdateProfiles

- ProviderManager.didUpdateProviders
2022-07-15 08:59:29 +02:00
Davide De Rosa 7771b50b56 Add ProfileManager methods to return full profiles 2022-07-14 17:07:30 +02:00
Davide De Rosa 9d9dc2b2f6 Rename activeProfileId publisher for consistency 2022-07-14 17:07:30 +02:00
Davide De Rosa cbf00cef73 Fix Core Data fault due to missing headers lastUpdate 2022-07-14 17:07:30 +02:00
Davide De Rosa 0a2d1e9d37 Mitigate fatalError() in properties, fail gracefully
Do not trigger fatalError() on properties too much because
SwiftUI may read them at any unpredictable time.
2022-07-08 20:01:53 +02:00
Davide De Rosa 3e8a49c970 Remove store value when set value is nil
Fixes crash on removing active profile when current, due to setting
nil activeProfileId in UserDefaults.
2022-07-05 08:04:58 +02:00
Davide De Rosa 0ff831f021 Fix target in test workflow 2022-06-25 20:27:24 +02:00
Davide De Rosa 9a8477225e Refactor library into domain + impl 2022-06-23 23:31:01 +02:00