Commit Graph

7 Commits

Author SHA1 Message Date
Davide De Rosa 4c4b3ee0c9 Revert to concrete-only managers
Abstraction was overcomplicated. Strategy pattern is enough.
2022-09-03 12:47:40 +02:00
Davide De Rosa 9a8477225e Refactor library into domain + impl 2022-06-23 23:31:01 +02:00
Davide De Rosa 14b42fbea5 Persist managers state to generic key-value store
Move all persisted state out of AppManager to where it really
belongs. To do that, inject a shared KeyValueStore object into
managers that need to persist part of their state in a strongly
typed manner.

Below are persisted states:

- PersistenceManager
    - persistenceAuthor

- ProfileManager
    - activeProfileId

- UpgradeManager (formerly AppManager)
    - didMigrateToV2 (migrate former value)

- VPNManager
    - tunnelLogFormat
    - masksPrivateData

A similar approach is used for app-specific preferences, by using
a strongly typed enum (AppPreference) together with SwiftUI
@AppStorage property wrapper.

Worth moving logging logic into a specific LogManager.

Finally, drop any former view dependency on AppManager, as states
are now accessed through specific managers.
2022-06-16 13:42:37 +02:00
Davide De Rosa a2d4ed370e Revisit sidebar with per-profile VPN toggles 2022-05-21 19:15:37 +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 f4714dec58 Fix VPN toggle enabling despite errors 2022-04-26 19:02:12 +02:00
Davide De Rosa 1ff19b331f Move VPNToggle to standalone view 2022-04-26 10:40:46 +02:00