Disclose details about selected provider server configuration (#980)
Like in v2.
This commit is contained in:
parent
d8f5caa2f7
commit
0fd544348f
|
@ -41,7 +41,7 @@
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
|
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "4d9cb52344de9c4a075389966a706574af936c08"
|
"revision" : "d033e4431a24c7a7559464ef27036af9994647f2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ let package = Package(
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.12.0"),
|
// .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(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", from: "0.9.1"),
|
||||||
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"),
|
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"),
|
||||||
|
|
|
@ -32,7 +32,7 @@ extension OpenVPNView {
|
||||||
|
|
||||||
let configuration: OpenVPN.Configuration.Builder
|
let configuration: OpenVPN.Configuration.Builder
|
||||||
|
|
||||||
let credentialsRoute: any Hashable
|
let credentialsRoute: (any Hashable)?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
moduleSection(for: accountRows, header: Strings.Global.Nouns.account)
|
moduleSection(for: accountRows, header: Strings.Global.Nouns.account)
|
||||||
|
@ -63,6 +63,9 @@ extension OpenVPNView {
|
||||||
|
|
||||||
private extension OpenVPNView.ConfigurationView {
|
private extension OpenVPNView.ConfigurationView {
|
||||||
var accountRows: [ModuleRow]? {
|
var accountRows: [ModuleRow]? {
|
||||||
|
guard let credentialsRoute else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
guard configuration.authUserPass == true else {
|
guard configuration.authUserPass == true else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,14 +106,25 @@ private extension OpenVPNView {
|
||||||
credentialsRoute: Subroute.credentials
|
credentialsRoute: Subroute.credentials
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
importButton
|
emptyConfigurationView
|
||||||
.modifier(providerModifier)
|
.modifier(providerModifier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@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 {
|
var importButton: some View {
|
||||||
if draft.wrappedValue.providerId == nil {
|
|
||||||
Button(Strings.Modules.General.Rows.importFromFile.withTrailingDots) {
|
Button(Strings.Modules.General.Rows.importFromFile.withTrailingDots) {
|
||||||
isImporting = true
|
isImporting = true
|
||||||
}
|
}
|
||||||
|
@ -138,7 +149,6 @@ private extension OpenVPNView {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var providerModifier: some ViewModifier {
|
var providerModifier: some ViewModifier {
|
||||||
VPNProviderContentModifier(
|
VPNProviderContentModifier(
|
||||||
|
@ -207,6 +217,8 @@ private extension OpenVPNView {
|
||||||
enum Subroute: Hashable {
|
enum Subroute: Hashable {
|
||||||
case providerServer
|
case providerServer
|
||||||
|
|
||||||
|
case providerConfiguration(OpenVPN.Configuration)
|
||||||
|
|
||||||
case credentials
|
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:
|
case .credentials:
|
||||||
Form {
|
Form {
|
||||||
OpenVPNCredentialsView(
|
OpenVPNCredentialsView(
|
||||||
|
|
|
@ -117,7 +117,9 @@ private extension ProviderContentModifier {
|
||||||
paywallReason: $paywallReason
|
paywallReason: $paywallReason
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension ProviderContentModifier {
|
||||||
var supportedProviders: [Provider] {
|
var supportedProviders: [Provider] {
|
||||||
providerManager
|
providerManager
|
||||||
.providers
|
.providers
|
||||||
|
@ -139,9 +141,7 @@ private extension ProviderContentModifier {
|
||||||
}
|
}
|
||||||
return Strings.Views.Providers.lastUpdated(lastUpdate.localizedDescription(style: .timestamp))
|
return Strings.Views.Providers.lastUpdated(lastUpdate.localizedDescription(style: .timestamp))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private extension ProviderContentModifier {
|
|
||||||
func loadCurrentProvider() {
|
func loadCurrentProvider() {
|
||||||
Task {
|
Task {
|
||||||
await refreshIndex()
|
await refreshIndex()
|
||||||
|
|
|
@ -238,6 +238,8 @@ public enum Strings {
|
||||||
public static let certificate = Strings.tr("Localizable", "global.nouns.certificate", fallback: "Certificate")
|
public static let certificate = Strings.tr("Localizable", "global.nouns.certificate", fallback: "Certificate")
|
||||||
/// Compression
|
/// Compression
|
||||||
public static let compression = Strings.tr("Localizable", "global.nouns.compression", fallback: "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
|
/// Connection
|
||||||
public static let connection = Strings.tr("Localizable", "global.nouns.connection", fallback: "Connection")
|
public static let connection = Strings.tr("Localizable", "global.nouns.connection", fallback: "Connection")
|
||||||
/// Country
|
/// Country
|
||||||
|
|
|
@ -259,6 +259,7 @@
|
||||||
"global.nouns.category" = "Category";
|
"global.nouns.category" = "Category";
|
||||||
"global.nouns.certificate" = "Certificate";
|
"global.nouns.certificate" = "Certificate";
|
||||||
"global.nouns.compression" = "Compression";
|
"global.nouns.compression" = "Compression";
|
||||||
|
"global.nouns.configuration" = "Configuration";
|
||||||
"global.nouns.connection" = "Connection";
|
"global.nouns.connection" = "Connection";
|
||||||
"global.nouns.country" = "Country";
|
"global.nouns.country" = "Country";
|
||||||
"global.nouns.default" = "Default";
|
"global.nouns.default" = "Default";
|
||||||
|
|
Loading…
Reference in New Issue