parent
3f60dee9a2
commit
4b1f6e547b
|
@ -32,7 +32,7 @@
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit",
|
"location" : "git@github.com:passepartoutvpn/passepartoutkit",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "fd4fe153c17a33d43a2e75d58512194ac3588eba"
|
"revision" : "1277fe7386441dd303673aa867ef9a05fe2aa9f5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ let package = Package(
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit", from: "0.7.0"),
|
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit", from: "0.7.0"),
|
||||||
.package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "fd4fe153c17a33d43a2e75d58512194ac3588eba"),
|
.package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "1277fe7386441dd303673aa867ef9a05fe2aa9f5"),
|
||||||
// .package(path: "../../../passepartoutkit"),
|
// .package(path: "../../../passepartoutkit"),
|
||||||
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", from: "0.6.0"),
|
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", from: "0.6.0"),
|
||||||
// .package(path: "../../../passepartoutkit-openvpn-openssl"),
|
// .package(path: "../../../passepartoutkit-openvpn-openssl"),
|
||||||
|
|
|
@ -410,6 +410,12 @@ public enum Strings {
|
||||||
public static let name = Strings.tr("Localizable", "placeholders.profile.name", fallback: "My profile")
|
public static let name = Strings.tr("Localizable", "placeholders.profile.name", fallback: "My profile")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public enum Ui {
|
||||||
|
public enum ConnectionStatus {
|
||||||
|
/// (on-demand)
|
||||||
|
public static let onDemandSuffix = Strings.tr("Localizable", "ui.connection_status.on_demand_suffix", fallback: " (on-demand)")
|
||||||
|
}
|
||||||
|
}
|
||||||
public enum Views {
|
public enum Views {
|
||||||
public enum About {
|
public enum About {
|
||||||
/// About
|
/// About
|
||||||
|
|
|
@ -204,6 +204,10 @@
|
||||||
"modules.wireguard.preshared_key" = "Pre-shared key";
|
"modules.wireguard.preshared_key" = "Pre-shared key";
|
||||||
"modules.wireguard.allowed_ips" = "Allowed IPs";
|
"modules.wireguard.allowed_ips" = "Allowed IPs";
|
||||||
|
|
||||||
|
// MARK: - Components
|
||||||
|
|
||||||
|
"ui.connection_status.on_demand_suffix" = " (on-demand)";
|
||||||
|
|
||||||
// MARK: - Alerts
|
// MARK: - Alerts
|
||||||
|
|
||||||
"alerts.iap.restricted.title" = "Restricted";
|
"alerts.iap.restricted.title" = "Restricted";
|
||||||
|
|
|
@ -58,9 +58,46 @@ private extension ConnectionStatusView {
|
||||||
return "↓\(down) ↑\(up)"
|
return "↓\(down) ↑\(up)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case .inactive:
|
||||||
|
var desc = status.localizedDescription
|
||||||
|
if tunnel.currentProfile?.onDemand ?? false {
|
||||||
|
desc += Strings.Ui.ConnectionStatus.onDemandSuffix
|
||||||
|
}
|
||||||
|
return desc
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return status.localizedDescription
|
return status.localizedDescription
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Preview("Connected") {
|
||||||
|
ConnectionStatusView(tunnel: .mock)
|
||||||
|
.task {
|
||||||
|
try? await Tunnel.mock.connect(with: .mock, processor: IAPManager.mock)
|
||||||
|
}
|
||||||
|
.frame(width: 100, height: 100)
|
||||||
|
.environmentObject(Theme())
|
||||||
|
.environmentObject(ConnectionObserver.mock)
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("On-Demand") {
|
||||||
|
var builder = Profile.Builder()
|
||||||
|
var onDemand = OnDemandModule.Builder()
|
||||||
|
onDemand.isEnabled = true
|
||||||
|
builder.modules = [onDemand.tryBuild()]
|
||||||
|
let profile: Profile
|
||||||
|
do {
|
||||||
|
profile = try builder.tryBuild()
|
||||||
|
} catch {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return ConnectionStatusView(tunnel: .mock)
|
||||||
|
.task {
|
||||||
|
try? await Tunnel.mock.connect(with: profile, processor: IAPManager.mock)
|
||||||
|
}
|
||||||
|
.frame(width: 100, height: 100)
|
||||||
|
.environmentObject(Theme())
|
||||||
|
.environmentObject(ConnectionObserver.mock)
|
||||||
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ private extension TunnelToggleButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
var canConnect: Bool {
|
var canConnect: Bool {
|
||||||
!isInstalled || tunnel.status == .inactive
|
!isInstalled || (tunnel.status == .inactive && tunnel.currentProfile?.onDemand != true)
|
||||||
}
|
}
|
||||||
|
|
||||||
var color: Color {
|
var color: Color {
|
||||||
|
|
Loading…
Reference in New Issue