Disclose details about selected provider server configuration (#980)

Like in v2.
This commit is contained in:
Davide 2024-12-04 20:50:51 +01:00 committed by GitHub
parent d8f5caa2f7
commit 0fd544348f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 60 additions and 31 deletions

View File

@ -41,7 +41,7 @@
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
"state" : {
"revision" : "4d9cb52344de9c4a075389966a706574af936c08"
"revision" : "d033e4431a24c7a7559464ef27036af9994647f2"
}
},
{

View File

@ -52,7 +52,7 @@ let package = Package(
],
dependencies: [
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.12.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "4d9cb52344de9c4a075389966a706574af936c08"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "d033e4431a24c7a7559464ef27036af9994647f2"),
// .package(path: "../../passepartoutkit-source"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.9.1"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"),

View File

@ -32,7 +32,7 @@ extension OpenVPNView {
let configuration: OpenVPN.Configuration.Builder
let credentialsRoute: any Hashable
let credentialsRoute: (any Hashable)?
var body: some View {
moduleSection(for: accountRows, header: Strings.Global.Nouns.account)
@ -63,6 +63,9 @@ extension OpenVPNView {
private extension OpenVPNView.ConfigurationView {
var accountRows: [ModuleRow]? {
guard let credentialsRoute else {
return nil
}
guard configuration.authUserPass == true else {
return nil
}

View File

@ -106,14 +106,25 @@ private extension OpenVPNView {
credentialsRoute: Subroute.credentials
)
} else {
importButton
emptyConfigurationView
.modifier(providerModifier)
}
}
@ViewBuilder
var emptyConfigurationView: some View {
if draft.wrappedValue.providerSelection == nil {
importButton
} else if let configuration = try? draft.wrappedValue.providerSelection?.configuration() {
providerConfigurationLink(with: configuration)
}
}
func providerConfigurationLink(with configuration: OpenVPN.Configuration) -> some View {
NavigationLink(Strings.Global.Nouns.configuration, value: Subroute.providerConfiguration(configuration))
}
var importButton: some View {
if draft.wrappedValue.providerId == nil {
Button(Strings.Modules.General.Rows.importFromFile.withTrailingDots) {
isImporting = true
}
@ -138,7 +149,6 @@ private extension OpenVPNView {
}
)
}
}
var providerModifier: some ViewModifier {
VPNProviderContentModifier(
@ -207,6 +217,8 @@ private extension OpenVPNView {
enum Subroute: Hashable {
case providerServer
case providerConfiguration(OpenVPN.Configuration)
case credentials
}
@ -224,6 +236,17 @@ private extension OpenVPNView {
)
}
case .providerConfiguration(let configuration):
Form {
ConfigurationView(
isServerPushed: false,
configuration: configuration.builder(),
credentialsRoute: nil
)
}
.themeForm()
.navigationTitle(Strings.Global.Nouns.configuration)
case .credentials:
Form {
OpenVPNCredentialsView(

View File

@ -117,7 +117,9 @@ private extension ProviderContentModifier {
paywallReason: $paywallReason
)
}
}
private extension ProviderContentModifier {
var supportedProviders: [Provider] {
providerManager
.providers
@ -139,9 +141,7 @@ private extension ProviderContentModifier {
}
return Strings.Views.Providers.lastUpdated(lastUpdate.localizedDescription(style: .timestamp))
}
}
private extension ProviderContentModifier {
func loadCurrentProvider() {
Task {
await refreshIndex()

View File

@ -238,6 +238,8 @@ public enum Strings {
public static let certificate = Strings.tr("Localizable", "global.nouns.certificate", fallback: "Certificate")
/// Compression
public static let compression = Strings.tr("Localizable", "global.nouns.compression", fallback: "Compression")
/// Configuration
public static let configuration = Strings.tr("Localizable", "global.nouns.configuration", fallback: "Configuration")
/// Connection
public static let connection = Strings.tr("Localizable", "global.nouns.connection", fallback: "Connection")
/// Country

View File

@ -259,6 +259,7 @@
"global.nouns.category" = "Category";
"global.nouns.certificate" = "Certificate";
"global.nouns.compression" = "Compression";
"global.nouns.configuration" = "Configuration";
"global.nouns.connection" = "Connection";
"global.nouns.country" = "Country";
"global.nouns.default" = "Default";