Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move module destinations to standalone entities #1166

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

keeshux
Copy link
Member

@keeshux keeshux commented Feb 12, 2025

Decouple destinations from the module view so that one can navigate to them from any point of the app. Affects only OpenVPN for now.

Preparation for "profile shortcuts".

@keeshux keeshux self-assigned this Feb 12, 2025
@keeshux keeshux added refactoring Improves software architecture OpenVPN labels Feb 12, 2025
@keeshux keeshux added this to the 3.1.0 / UX milestone Feb 12, 2025
@keeshux keeshux merged commit 5059423 into master Feb 12, 2025
@keeshux keeshux deleted the refactoring/module-destination branch February 12, 2025 10:03
keeshux added a commit that referenced this pull request Feb 12, 2025
Some useful shortcuts can be replicated in the main profile screen.

Requirements:

- Modules implementing `ModuleDestinationProviding` return a
`navigationDestination()` to navigate to module-specific routes (e.g.
OpenVPN credentials). This was done in #1166
- In order to navigate to the module routes from the main
`ProfileCoordinator` view, it must have a `navigationDestination()`
attached for each of the modules, without knowing the concrete route
types

Here is how this is accomplished in a generic fashion:

1. `ProfileEditor.navigationDestinations()` iterates over each
`ModuleDestinationProviding` to return a list of
`navigationDestination()`, [implemented as a
`ViewModifier`](https://github.com/passepartoutvpn/passepartout/pull/1167/files#diff-11dfcbc4f6c173b133fe8eb4c54710f2ac7161cd38126735c655a8c56a62b8c0R29)
2. With this in place, module routes can be pushed with a
`NavigationLink` from the main profile view
3. Lastly, in the profile view, we add a section for each module
implementing `ModuleShortcutsProviding`, where the module may return a
list of convenient shortcuts, e.g. in the form of the `NavigationLink`
in 2

Start with some OpenVPN entries:

- Provider server
- Credentials (if needed)

Some refactoring was necessary:

- Load ModulePreferences in the module destinations via
ModulePreferencesModifier, rather than in the module view (may revisit
later)
- Due to the above, move "Remote endpoints" from "Configuration" to a
separate destination (also less messy)
- Group complex module views (OpenVPN/WireGuard) into folders
- Reuse `ProviderServerRow` for consistency across modules/shortcuts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenVPN refactoring Improves software architecture
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant