Commit Graph

431 Commits

Author SHA1 Message Date
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
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
a442603696 Polish bundleConfig with strong type checking 2022-07-05 08:11:31 +02:00
Davide De Rosa
ebe8ae3d29 Retain profiles order, no active on top 2022-07-04 00:32:06 +02:00
Davide De Rosa
1543eef3c1 Add convenient appId constant 2022-06-25 20:27:24 +02:00
Davide De Rosa
df0d40c556 Add launcher target
- Launch main app in background then die

- Do not launch app if already running

- Launch app binary relative to launcher location
2022-06-25 16:53:38 +02:00
Davide De Rosa
3cc82cc807 Fix case in Info keys related to launch screen 2022-06-25 16:53:38 +02:00
Davide De Rosa
7ba9879c8c Revisit constants structure
Move some stuff back to App:

- Constants, and split library-dependent

- InApp entities and constants

Flatten global constants hierarchy.
2022-06-25 14:36:28 +02:00
Davide De Rosa
9a8477225e Refactor library into domain + impl 2022-06-23 23:31:01 +02:00
Davide De Rosa
8504998bbb Reorganize app-specific shared code into AppShared 2022-06-19 14:41:26 +02:00
Davide De Rosa
85129f17af Prefix store keys with "Passepartout." domain
Also remove stale preferences from early betas after migrating
relevant ones.

Extend KeyValueStore with removeValue() for this purpose.
2022-06-19 13:33:49 +02:00
Davide De Rosa
02a9db057f Update TunnelKit
- Set explicit tunnel log path

- OpenSSL 1.1.1o
2022-06-19 13:33:49 +02:00
Davide De Rosa
bb1a35acea Set full log path relative to App Group container
Also rename from Debug.log to App.log
2022-06-19 13:33:49 +02:00
Davide De Rosa
10b4c321c8 Separate context responsibilities
- Split Core and App context

- Move .shared instantiation to extension

Context may differ by target.
2022-06-16 13:42:53 +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
77ff910adc Update and extend copyright notices 2022-06-16 13:42:21 +02:00
Davide De Rosa
b873e5e279 Strip VPNManager initialization 2022-06-02 20:52:51 +02:00
Davide De Rosa
1fd4fd4689 Fix required capabilities 2022-06-01 21:14:21 +02:00
Davide De Rosa
b768284197 Enforce .sidebar on Mac
Drops annoying side inset.
2022-05-24 09:15:27 +02:00
Davide De Rosa
f752594d3c Refactor no autocorrection into raw text style 2022-05-24 08:25:34 +02:00
Davide De Rosa
02213a7c50 Drop truncation hack 2022-05-23 10:10:02 +02:00
Davide De Rosa
83cdd460e4 Attempt beta release 2022-05-21 19:15:48 +02:00
Davide De Rosa
a2d4ed370e Revisit sidebar with per-profile VPN toggles 2022-05-21 19:15:37 +02:00
Davide De Rosa
f700993a52 Refactor global theme consistently
- Return values rather than apply modifiers

- Use .insetGrouped by default

- Reuse .insetGrouped in StyledPicker

- Enforce .sidebar on iPad
2022-05-21 19:04:35 +02:00
Davide De Rosa
f0c5ecd84f Handle configuration errors out of VPN status
On configuration error, retain information about the profile that
triggered the error. For now, present an alert, but with this
information the UI can be easily changed later.
2022-05-21 19:01:49 +02:00
Davide De Rosa
ae748dd1b3 Fix logo name 2022-05-21 18:55:40 +02:00
Davide De Rosa
46a8fb8a74 Delay presentation of imported file modal
Fixes navigation bug on iOS 14 preventing modal from dismissing
via close button.
2022-05-20 16:35:45 +02:00
Davide De Rosa
d6866e8e95 Fix iPad multitasking condition 2022-05-20 11:58:25 +02:00
Davide De Rosa
9735b9ab14 Use consistent case in assets 2022-05-19 10:33:36 +02:00
Davide De Rosa
c88dfc28c4 Simplify a few things of CopySavingButton
- Make saving handler more readable

- Drop unnecessary protocol
2022-05-18 14:10:11 +02:00
Davide De Rosa
ddce671c62 Move theme extensions to non-reusable 2022-05-18 11:33:29 +02:00
Davide De Rosa
b1d77cccbc Attempt beta release 2022-05-18 11:18:57 +02:00
Davide De Rosa
4455f66d10 Detect TestFlight on macOS
Move function to Utils.
2022-05-18 11:16:31 +02:00
Davide De Rosa
160338e62a Add credits in Mac about 2022-05-17 19:57:19 +02:00
Davide De Rosa
4c2a471b9f Attempt beta release 2022-05-17 19:34:13 +02:00
Davide De Rosa
4edecf123b Fix missing accent color in CI
Finally? Basically Xcode build settings were referring to new
color name "AccentColor", while color set in repository was
still "accentColor".

Went unnoticed because Mac filesystem is case-insensitive, which
is why Git never committed the name change in the first place.
2022-05-17 19:34:00 +02:00
Davide De Rosa
6c798c8b19 Bump build 2022-05-17 16:43:14 +02:00
Davide De Rosa
7196aeab0d Trust Ethernet on Mac 2022-05-16 11:19:33 +02:00
Davide De Rosa
f5e01f9768 Wrap/refine a few OS conditionals 2022-05-16 11:19:18 +02:00
Davide De Rosa
16d618df0e Show info menu in ProfileView on iPad/Mac
Use .navigationBarTrailing to avoid artifact on Catalyst (item
relocates when first clicked).

Rename menu files too.
2022-05-16 11:18:58 +02:00
Davide De Rosa
6fddbb8bfc Decouple menus from OrganizerView
Could move .sheet() from parent View to Menu, but no luck with
.fileImporter()
2022-05-16 11:18:58 +02:00
Davide De Rosa
d89130bc3a Reorganize profile menu into computed properties 2022-05-16 11:18:58 +02:00
Davide De Rosa
e87ad06c5d Drop old observables from profiles list
List was being reloaded e.g. on ProductManager receipt updates,
but profile in-app eligibility is not a thing anymore.
2022-05-16 10:59:12 +02:00
Davide De Rosa
137bacb542 Add contextual profile delete
Without confirmation alert though.
2022-05-15 22:24:36 +02:00
Davide De Rosa
35ec73570e Use NEHotspotNetwork to fetch current SSID
Old method did not work on Catalyst.
2022-05-15 22:24:36 +02:00
Davide De Rosa
743facca6b Improve Catalyst appearance
- Revert to more "stable" iPad idiom

- Set accent color the proper way

- Use .tint when available

- Unify navigation style by idiom

- Retain navigation bars in sidebar/detail

- Lighten sidebar appearance

- Fix Menu style (dropdown -> button)

- Use native Picker (dropdown)

- Use switch toggles rather than checkboxes

- Replace .actionSheet with .alert

- Increase minimum row height

CAVEAT: on Mac with iPad idiom, having a Section in .sidebar
produces artifacts. Header keeps changing height for no reason.
Retain Section on iPad multitasking only to not break navigation.
2022-05-15 22:24:36 +02:00
Davide De Rosa
eaaa1fe260 Move device checks to Theme
Drop unused code along the way.
2022-05-15 22:24:36 +02:00
Davide De Rosa
d558edf665 Assume test build if appType == .beta 2022-05-15 21:03:32 +02:00
Davide De Rosa
6c87e0a15b Use gray for profile subtitle 2022-05-15 21:03:32 +02:00
Davide De Rosa
683a8e7d82 Attempt beta release 2022-05-05 11:07:49 +02:00