Commit Graph

304 Commits

Author SHA1 Message Date
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
Davide 962361cb9f
Automate screenshots via UI tests (#960)
Ready for screenshots generation, except for the tests themselves and
the TV target.

- More customizations while UI testing
  - Act as full version user in IAPManager
  - Override layout with default to .grid if isBigDevice
  - Show module names in profile list/grid
- Improve mock Profile/ProfileManager
  - Meaningful profile names
  - iCloud/TV icons
  - Initial modules
- Improve XCTest extensions
  - Screenshot destination (attachment/temporary)
  - Screenshot target (window/sheet)
  - Print saved temporary URL at the end (may help with CI)
  - Append device name to screenshot filename
- Tests
- Refactor actions with the [Page Object
pattern](https://swiftwithmajid.com/2021/03/24/ui-testing-using-page-object-pattern-in-swift/)
  - Perform iPad screenshots in landscape
  - Split simple flow tests and screenshots
  - Add "Connect to" test

Closes #681
2024-11-28 15:51:03 +01:00
Davide f6c93fc2f7
Use provider description as profile name 2024-11-28 11:14:23 +01:00
Davide 42c0d7e932
Customize user level from bundle 2024-11-28 02:19:44 +01:00
Davide 581673c617
Add target for UI tests (#959)
Create UITesting target with:

- AppCommandLine/AppEnvironment: strongly typed refactoring of PP_*
environment values
- AccessibilityInfo: identifies and locates elements for UI testing

Make the app behave differently when launched with `.uiTesting`, and
expose the flag to SwiftUI via `.environment(\.isUITesting)` to:

- Use the mock AppContext
- Skip onboarding

Add PassepartoutUITests target with two screenshot tests:

- Connected screen
- Profile modal
2024-11-28 01:30:26 +01:00
Davide 8f778faa5d
Inform about use of profile name in Shortcuts (#954)
Now that Siri is superseded by the more general Shortcuts automations,
add an informational footer below the "Name" field of the profile
editor.
2024-11-27 15:30:15 +01:00
Davide b4caa26a47
Improve layout of installed profile (#953)
When none, fill the whitespace with an informational placeholder.
2024-11-27 14:49:23 +01:00
Davide eac1e028b2
Add version view in About/Settings (#952)
Restored from v2. Refactor LogoView for reuse.
2024-11-27 13:24:44 +01:00
Davide 14aae4e02a
Define common PreferenceProtocol 2024-11-27 09:40:32 +01:00
Davide b3c90b6802
Drop animations on reload servers on iOS 2024-11-27 01:22:54 +01:00
Davide 4fcac3c95a
Fix modals not re-appearing in iOS 16
- Paywall
- Error handler

Expose setLater/enableLater.
2024-11-27 01:22:53 +01:00
Davide a92c2c2c64
Fix profile menus
- Omit duplicate/delete from current profile
- Replace .infoButton with .installedProfile if current
- Drop dots from direct actions
- Disable trailing dots on iOS/tvOS
- Disable "Connect to" if ineligible (decouple to own view)
2024-11-27 01:20:42 +01:00
Davide 91f4e510c4
Split app and UI domains (#949)
CommonLibrary had some undesired knowledge of UI. Split AppPreference
and UIPreference. Then move some more stuff from AppUI* to UILibrary.

WARNING: this forgets existing UI preferences (e.g. favorite servers).
2024-11-26 21:21:49 +01:00
Davide d8753f21da
Different styles for profile menu based on context (#947)
Hide "Duplicate" and "Delete" from the info button menu because they are
disruptive actions, misclick is likely.
2024-11-26 20:10:03 +01:00
Davide e0f16cbb3e
Mitigate overlap of sheet/alert during onboarding 2024-11-26 19:19:15 +01:00
Davide b34019e4eb
Add provider profile from toolbar (#946)
Create profile with a provider module and an on-demand module (disabled)
to speed up initial provider selection and configuration. Supports
OpenVPN for now.

Fixes #899
2024-11-26 19:14:56 +01:00
Davide 2dad04f241
Do not present server selector if ineligible (#945)
Verification was only performed for interactive login, not for provider
server selection. Do that before a connection attempt, so that the
paywall always appears first.
2024-11-26 18:44:23 +01:00
Davide 7d8055f044
Do not dismiss abruptly on "Donate" error 2024-11-26 17:28:49 +01:00
Davide b455701daa
Improve appearance of "Purchased"
- Animate load
- Handle load errors
2024-11-26 17:28:19 +01:00
Davide b9f3500f31
Fix regressions in L&F (#944)
- Text appearance on iOS/macOS (broken by #943)
- Visual ambiguity in "Purchased" when no feature is eligible
- "Purchased" must be a form on macOS
2024-11-26 16:50:37 +01:00
Davide 80d40c3161
Improve TV settings screen (#943)
- Show detail side by side rather than navigate
- Fix scrolling in purchased view
2024-11-26 15:55:04 +01:00
Davide 8ec6f90077
Connect on provider server selection (#941)
Unless profile is current and active, in which case AppContext does it
under the hood.
2024-11-26 10:30:30 +01:00
Davide 1c1d2502c3
Show quick profile menu rather than just edit (#940)
"Edit" is a less frequent action than "Select provider server". Offer a
common place for quick actions.

One step towards #933
2024-11-26 09:42:47 +01:00
Davide 19da40d3f8
Simplify VPNProviderServerView components (#939)
Merge former ContainerView into main view and define platform-specific
subviews:

- ContainerView (composition of content + filters)
- ContentView
- FiltersView
2024-11-26 09:20:00 +01:00
Davide b357d985ed
Add "Refresh infrastructure" in server lists (#938)
Refactoring:

- Split Providers and VPN views
- Rename VPNProviderServerView subviews
- Reuse RefreshInfrastructureButton

Closes #929
2024-11-26 01:04:58 +01:00
Davide 8b043d8a4f
Refactor provider server views
- Rename ServersView to ContainerView
- Rename ServersSubview to ContentView
- Split parent extensions and content
- Move container handlers to methods suggesting logic
- Drop dup previews
2024-11-26 00:18:08 +01:00
Davide ca54d8f41a
Perform onboarding steps on upgrade (#936)
Store the current step in a linear list of onboarding steps that can
increase with each app upgrade.

Fixes #930 
Fixes #931 
Fixes #932
2024-11-25 21:55:31 +01:00
Davide 7f7e591616
Add view in "About" about purchased products (#935)
Closes #897
2024-11-25 19:17:18 +01:00
Davide 07b4e786c3
Localize WireGuard errors (#934)
Fixes #894
2024-11-25 11:34:31 +01:00
Davide 7e49493d75
Improve provider servers responsiveness on iOS (#927)
Pre-compute servers by country code.

Fixes #898
2024-11-25 10:18:10 +01:00
Davide fa293656f4
Fix missing beta check on tvOS (#925)
Reuse the same receipt trick from iOS.

Also, fix a regression in IAPManager.fetchLevelIfNeeded() from #903,
where a guard after an await was dropped leading to reentrancy issues.
2024-11-24 21:19:43 +01:00
Davide 2aa91eedb0
Simplify paywall entities (#923)
- PaywallView is the paywall content
- PaywallModifier attaches paywall with optional confirmation
- PurchaseRequiredButton presents paywall explicitly
- PaywallReason is the compound input

Refactoring:

- PurchaseRequiredButton takes a custom view
- PurchaseAlertModifier was merged into PaywallModifier
- PurchaseButtonModifier was merged into PurchaseRequiredButton
- Modal options were packed into a single struct

Confirmation alert presented on:

- Connect to ineligible profile (AppCoordinator)
- Save ineligible profile (ProfileCoordinator)
2024-11-24 20:01:30 +01:00
Davide cb530d8a65
Handle TV requirements on connection (#922)
Fixes #913
2024-11-24 01:01:04 +01:00
Davide bad9e8b58e
Add TV settings tab (#921)
Includes:

- Credits
- Donations
- Diagnostics
- Version

Had to:

- Wrap tab view into a NavigationStack for full-screen navigation
- Take out navigation titles of about subviews
- Customize donations view layout with modifier
- Fix credits and debug log to support scrolling

Closes #914
2024-11-23 23:01:11 +01:00
Davide f13a292b4b
Refactor String identifiers (#920)
- Group all views under "views.*"
- Split global strings into actions and nouns
- Use underscores
- Clean up unused

Fixes #835
2024-11-23 20:31:22 +01:00
Davide 3e2823c2e0
Suppress module name
Uneditable with #909, must hide potentially existing name.
2024-11-23 20:11:10 +01:00
Davide 2a46173169
Move more views to UILibrary (#919)
- Move about subviews to UILibrary
- Refactor about to single coordinator + platform views
- Refactor debug log to single view + content views
- Take out debug log routes from about routes
- Rename Settings* to Preferences*
- Reuse empty modifier in debug log
- Fix a visual bug in .themeTrailingValue() (extra Spacer)

Preparation for #914
2024-11-23 19:26:33 +01:00
Davide a301806ac7
Share migrated TV profiles (#918)
Fixes #912
2024-11-23 13:33:02 +01:00
Davide 3d092d6802
Revert marker width from #917 2024-11-23 13:30:29 +01:00
Davide 13118a5e2e
Improve profiles layout on small devices (#917)
- Smaller iCloud/TV icons
- Smaller marker width
- Less spacing before info button
2024-11-22 17:05:46 +01:00
Davide bd237c4a6f
Fix layout of multiline modules (#916)
- Align to .leading in multi-line
- Wrap profile rows into top/bottom spacers to adjust to tallest cell in
grid

See #915
2024-11-22 13:44:06 +01:00
Davide fb0d1abc8a
Add header to Mac menu profiles list 2024-11-22 13:09:22 +01:00
Davide 4b4fca8344
Replace active modules count with a description (#915)
To get access to modules, try to avoid full Profile objects. Instead,
replace the coupled ProfileHeader occurrences with a new intermediary
ProfilePreview everywhere.

This way, a ProfileProcessor can inject the localized modules
descriptions from above with the preview() method.
2024-11-22 12:52:51 +01:00
Davide a2f246454d
List other modules in TV active profile (#911)
Non-VPN profiles would otherwise be very shallow.
2024-11-22 10:56:37 +01:00
Davide 9b366dcaa0
Minor UI fixes (#910)
Update library with some more meaningful names for Profile accessors.

Refactor a few things about TV here and there.
2024-11-22 10:05:46 +01:00
Davide 366dc62231
Drop "Name" field from modules (#909)
Will rather add a "Notes" field to profiles. Module names feel
overwhelming.
2024-11-22 10:05:08 +01:00
Davide 72f6a1b1a1
Fix condition for #906
Was never disabling sharing for shared profiles.
2024-11-22 02:43:54 +01:00
Davide 0bff571d14
Polish TV profile view (#908)
- Layout with some profile details
- Add colors with adjusted brightness
- Add iOS/macOS instructions
- Add pending/sleeping markers
- Add previews
2024-11-22 02:20:41 +01:00
Davide 14398f5f20
Fix shared profile not updated on provider server selection (#906)
First, rename `force` parameter of ProfileManager.save() to `isLocal`,
because it's meant to be used when saving local profiles. In such
scenario, a profile that is also remotely shared _must_ be re-saved to
the remote repository.

This was not being done when selecting a provider server, and it could
be noticed because the other devices would only receive the iCloud
update after editing the profile and re-doing a manual "Save". Only at
that point would the new profile be re-shared on iCloud.
2024-11-22 00:46:58 +01:00
Davide 3d2a543a54
Fetch products from scratch each time (#905)
Do not risk getting products that may have been removed from sale.
2024-11-21 22:58:24 +01:00