Commit Graph

85 Commits

Author SHA1 Message Date
Davide De Rosa 93abaf538b Simplify redundant parts of ProfileManager
- Drop overthought activeHeader

- Drop willUpdateCurrentProfile, use observable

- Drop willUpdateActiveId, observe value publisher
2022-05-03 14:36:55 +02:00
Davide De Rosa 20be153b1a Only tweak .isLoading if profile is not ready
Result is sync and immediate otherwise.
2022-05-02 11:17:51 +02:00
Davide De Rosa 7eec20c75b Fix VPN status not restored on app launch
Notifications deemed not relevant because currentBundleIdentifier
not set unless connect/reinstate.

Assume initial relevant identifier to be the first notified.

See 7ba41a0e73
2022-05-01 22:50:40 +02:00
Davide De Rosa 87f2ebfd9e Attempt beta release 2022-05-01 20:44:17 +02:00
Davide De Rosa acbc1980f9 Ignore non-existing active profile 2022-05-01 20:40:20 +02:00
Davide De Rosa 171c1e1dd4 Omit wrapping Section on Mac 2022-05-01 19:30:56 +02:00
Davide De Rosa cfc0d4f572 Restore active profile on top
Flashing on activation was caused by VPNManager.disable() in
ProfileView+VPN, because by setting lastError to nil it would
notify a change to ProfileRow (via VPNStateView) during the
profile row activation animation. That caused the flicker.

Instead, disable VPN first, then start the animation.

Anyway, avoid clearing a nil lastError.
2022-05-01 19:19:43 +02:00
Davide De Rosa edc7cdf045 Merge List into OrganizerView
- Restore wrapping Section as it seems to fix multitasking

- Hide profiles section if empty
2022-05-01 19:19:31 +02:00
Davide De Rosa 8003b4a92d Observe currentProfile in ProfileView
ProfileView is not interested in changes in other profiles
notified by ProfileManager. Set isLoading inside
ObservableObject for observable to be self-contained.

Loses observation of profile deletion, but dismiss on removal is
actually handled by OrganizerView, not ProfileView.

Also drop unused presentationMode.
2022-05-01 19:14:34 +02:00
Davide De Rosa 7ba41a0e73 Skip irrelevant notifications for VPN protocol
Based on tunnel bundle identifier in notification.
2022-04-29 15:26:10 +02:00
Davide De Rosa 17198e53eb Fix cannot duplicate same profile more than once 2022-04-29 00:40:56 +02:00
Davide De Rosa 1afd227f02 Do not update current profile on activation 2022-04-28 22:36:31 +02:00
Davide De Rosa 2c2e794b00 Revert async loadCurrentProfile()
Make action sync, but internally async (makeProfileReady). If not
doing so, UI on launch will not be able to show active profile
immediately. WelcomeView would appear for a moment.

Observe isReloadingCurrentProfile.

See 2b1efb8fec
2022-04-28 19:00:36 +02:00
Davide De Rosa 1ef2b8c7a7 Set activeProfileId immediately
Otherwise on app launch, active profile is rendered in 2 steps.
2022-04-28 17:56:28 +02:00
Davide De Rosa 56fa161e92 Save current profile one way
Skip updating currentProfile.value when intentionally saving
current profile.
2022-04-28 17:56:28 +02:00
Davide De Rosa 2b1efb8fec Make load*Profile() async
- Handle Task in consumers

- Drop makeReady, always make loaded profile ready

- Rename misleading loadProfile() to profileEx()
2022-04-27 17:13:03 +02:00
Davide De Rosa 02b2e3194e Add duplicate to profile menu
Contextually switch current profile to duplicate.
2022-04-27 16:59:33 +02:00
Davide De Rosa 49a1f1b55c Address VPN toggle losing sync with internal state
- Update TunnelKit

- Receive TunnelKit notifications on main queue

- Bind VPN toggle to VPNManager directly (implicit animations)

- Update state on VPN didFail

- Set isEnabled = false after uninstalling VPN (not notified)
2022-04-27 15:53:31 +02:00
Davide De Rosa 03fdab4833 Duplicate profile from context menu 2022-04-26 22:39:47 +02:00
Davide De Rosa e10f33717d Test update/delete on merge provider index 2022-04-26 18:56:55 +02:00
Davide De Rosa 259a7e18ca Fix old provider server query parameter
serverId was renamed to apiId.
2022-04-26 18:49:34 +02:00
Davide De Rosa ccde6a30cf Fix issues with VPN toggle
- Move rate limit to UI only

- Keep caption constant to "Enabled"
2022-04-25 23:12:45 +02:00
Davide De Rosa 92b9c4cd9a Skip setting data count if unavailable 2022-04-25 22:59:20 +02:00
Davide De Rosa 5c0e053e7d Review requirements of DNS over TLS (DoT)
- Make DNS servers optional in TunnelKit

- Allow IP address as DoT server name
2022-04-25 22:40:09 +02:00
Davide De Rosa 10537c5a29 Fix active profile not always cleared on deletion
Was only cleared if deleted profile was current profile.
2022-04-23 10:25:31 +02:00
Davide De Rosa 8f4e4bc7c5 Skip redundant updates of current profile 2022-04-23 10:25:31 +02:00
Davide De Rosa 2432f0d97a Rewrite ProfileView as a view of currentProfile
Do not load profile in View, instead:

- Load active profile on app launch

- Load selected profile on organizer selection
2022-04-23 10:25:31 +02:00
Davide De Rosa 8838e9d130 Strip a few unnecessary publishers
- Drop unused AppManager from OrganizerView

- Do not notify ProfileManager subscribers on activeProfileId

Saved active profile is already notified by:

- Core Data
- AppManager
2022-04-23 10:25:31 +02:00
Davide De Rosa 322bdf2993 Serialize active profile immediately
Otherwise:

- Switch from former active profile A to B
- Connect to now active profile B
- Kill app
- Reopen app
- App shows connected to profile A

Because active profile was not saved immediately on switch.

Unnecessary now to also save it on background persist().
2022-04-22 10:05:28 +02:00
Davide De Rosa 18e9f7cbb5 Clear profile selection if current profile removed
Do it before ForEach rearranges NavigationLink elements, because
it may trigger undesired navigation to a deleted profile.

Restore related assertion.
2022-04-19 21:19:43 +02:00
Davide De Rosa d2c4298f2d Share same build number in API 2022-04-19 15:56:41 +02:00
Davide De Rosa f1aa192c9c Make App/Core iOS/Catalyst only
- Drop macOS target from Package.swift

- Drop @available attributes
    - UI idiom
    - Intents API
    - Swipe actions in ProviderLocationView

- Review os(iOS)
    - DebugLog, append idiom to tell Mac from iPad

- Drop redundant canImport
2022-04-19 15:56:41 +02:00
Davide De Rosa a6c7305528 Hack around missing .ethernet on Catalyst
Enum seems to be mapped correctly. Make sure matching works on
real device though.

Also noticed that @available on iOS implies availability on
Catalyst as well, making it ineffective e.g. in this case, where
mobile and ethernet network matching should be only available on
iOS and macOS respectively.
2022-04-19 15:56:41 +02:00
Davide De Rosa 5d85699ce4 Delete profile from Organizer
Swipe to delete. Address a couple things on iPad though:

1. Also check provider availability before showing view

fatalError hit on iPad when navigating from a ready provider
profile to a non-ready one. Similar to when navigating between
different VPN protocols.

2. Suppress assertion on deleted profile

Deleting current profile via swipe seems to re-render a new
NavigationLink with the deleted profile, which results in
loading a deleted profile and hitting the assertion. Not sure if
this is a programming error or a glitch in ForEach.
2022-04-19 08:38:10 +02:00
Davide De Rosa f5c87d43c2 Better observe updates explicitly after init 2022-04-18 19:51:07 +02:00
Davide De Rosa 5cafd9794d Review a bit about duplicates handling
- Read profile(withId:) without fetcher

- Refine redundant log about duplicated profiles
2022-04-16 11:27:31 +02:00
Davide De Rosa 0db3e36bf4 Make network settings consistent
- Group DNS "Enabled" and protocol into configuration

- Make DNS servers / search domains optional

- Make proxy bypass domains optional

Also refine a comment about future on-demand.
2022-04-14 07:43:44 +02:00
Davide De Rosa d5340b0457 Fix another import issue in TunnelKit 2022-04-13 22:57:00 +02:00
Davide De Rosa dfebb60796 Fix an import issue in TunnelKit 2022-04-13 22:41:12 +02:00
Davide De Rosa 2565b9f3d0 Lock network settings for builds >= 3000 2022-04-13 21:25:24 +02:00
Davide De Rosa a3202bb218 Refine again how proxy settings apply
Only set bypass domains if manual configuration.
2022-04-13 20:00:39 +02:00
Davide De Rosa ad38ca5942 Skip bypass domains for proxy configured with PAC 2022-04-13 19:45:27 +02:00
Davide De Rosa addbc181fd Make proxy configuration a 3-state
- Manual: server, port
- PAC: set PAC URL
- Disabled

BEWARE: breaking change in Profile.
2022-04-13 19:38:36 +02:00
Davide De Rosa 9055fec394 Fix on-demand rules dropped completely
Must only ignore custom rules if ineligible.
2022-04-13 19:12:16 +02:00
Davide De Rosa 2273ebd8b5 Do not log duplicates renamed if there is none 2022-04-13 11:16:38 +02:00
Davide De Rosa 3a3d2460a8 Fix migration not recovering auth-user-pass option
Was looking up new UUID, not migrated one.
2022-04-13 11:13:38 +02:00
Davide De Rosa 1532e8808b [ci skip] Address CI and ASC validation issues
- Skip tests until fixed wg-go issue

- Add golang step

- Set "Apple Development" at project level

- Set Catalyst platform for gym

- Drop TARGET env variable clashing with WireGuardKit

- Disable SwiftGen script phase

- Fix TunnelKit segfault on archive

- Xcode 13.2.1 compatibility
    Fix some issues with @MainActor
    Use #available instead of #unavailable

- Raise timeout from 10 to 15 minutes

- Update beta description

- Tunnel bundle ids cannot have periods

- CFBundleDisplayName required in tunnels
2022-04-13 10:00:29 +02:00
Davide De Rosa b62490b88b Disable tests failing due to WireGuardKit 2022-04-12 18:41:58 +02:00
Davide De Rosa e663dbff11 Fix inverse condition in current profile deletion 2022-04-12 18:09:30 +02:00
Davide De Rosa ec3cca05ef Fix TunnelKit package fetched locally 2022-04-12 15:25:38 +02:00