Skip to content

Commit 2b3da3c

Browse files
committed
Fix RelayTests
1 parent b6f8e07 commit 2b3da3c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ios/MullvadVPN/View controllers/Tunnel/ConnectionView/ConnectionView.swift

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ struct ConnectionView: View {
3838
.background(BlurView(style: .dark))
3939
.cornerRadius(12)
4040
.padding(EdgeInsets(top: 16, leading: 16, bottom: 24, trailing: 16))
41+
.onReceive(connectionViewModel.combinedState) { _ in
42+
if !connectionViewModel.showsConnectionDetails {
43+
isExpanded = false
44+
}
45+
}
4146
}
4247
}
4348

ios/MullvadVPN/View controllers/Tunnel/ConnectionView/ConnectionViewViewModel.swift

+3-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ConnectionViewViewModel: ObservableObject {
3030
@Published private(set) var tunnelStatus: TunnelStatus
3131
@Published var outgoingConnectionInfo: OutgoingConnectionInfo?
3232
@Published var showsActivityIndicator = false
33-
@Published var showsConnectionDetails = false
3433

3534
@Published var relayConstraints: RelayConstraints
3635
let destinationDescriber: DestinationDescribing
@@ -73,14 +72,15 @@ class ConnectionViewViewModel: ObservableObject {
7372

7473
func update(tunnelStatus: TunnelStatus) {
7574
self.tunnelStatus = tunnelStatus
76-
self.showsConnectionDetails = shouldShowConnectionDetails(tunnelStatus)
7775

7876
if !tunnelIsConnected {
7977
outgoingConnectionInfo = nil
8078
}
8179
}
80+
}
8281

83-
private func shouldShowConnectionDetails(_ tunnelStatus: TunnelStatus) -> Bool {
82+
extension ConnectionViewViewModel {
83+
var showsConnectionDetails: Bool {
8484
switch tunnelStatus.state {
8585
case .connecting, .reconnecting, .negotiatingEphemeralPeer,
8686
.connected, .pendingReconnect:
@@ -89,9 +89,7 @@ class ConnectionViewViewModel: ObservableObject {
8989
false
9090
}
9191
}
92-
}
9392

94-
extension ConnectionViewViewModel {
9593
var textColorForSecureLabel: UIColor {
9694
switch tunnelStatus.state {
9795
case .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .negotiatingEphemeralPeer,

0 commit comments

Comments
 (0)