Skip to content

Commit bb3c5ae

Browse files
committed
Clean up connection view animations
1 parent b6dc7e7 commit bb3c5ae

File tree

7 files changed

+40
-188
lines changed

7 files changed

+40
-188
lines changed

ios/MullvadVPN.xcodeproj/project.pbxproj

+3-19
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
44075DFB2CDA4F7400F61139 /* UDPOverTCPObfuscationSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44075DFA2CDA4F7400F61139 /* UDPOverTCPObfuscationSettingsViewModel.swift */; };
4444
440E5AB02CDBD67D00B09614 /* StatefulPreviewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440E5AAF2CDBD67D00B09614 /* StatefulPreviewWrapper.swift */; };
4545
440E5AB42CDCF24500B09614 /* TunnelObfuscationSettingsWatchingObservableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440E5AB32CDCF24500B09614 /* TunnelObfuscationSettingsWatchingObservableObject.swift */; };
46-
4419AA892D282687001B13C9 /* DetailsContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4419AA882D282687001B13C9 /* DetailsContainer.swift */; };
4746
4419AA8B2D2826E5001B13C9 /* DetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4419AA8A2D2826E5001B13C9 /* DetailsView.swift */; };
4847
4419AA8E2D2828A4001B13C9 /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4419AA8D2D2828A4001B13C9 /* HeaderView.swift */; };
4948
4422C0712CCFF6790001A385 /* UDPOverTCPObfuscationSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4422C0702CCFF6790001A385 /* UDPOverTCPObfuscationSettingsView.swift */; };
@@ -1015,7 +1014,6 @@
10151014
F0B495762D02025200CFEC2A /* ChipContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495752D02025200CFEC2A /* ChipContainerView.swift */; };
10161015
F0B495782D02038B00CFEC2A /* ChipViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495772D02038B00CFEC2A /* ChipViewModelProtocol.swift */; };
10171016
F0B4957A2D02F49200CFEC2A /* ChipFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495792D02F41F00CFEC2A /* ChipFeature.swift */; };
1018-
F0B4957C2D03154200CFEC2A /* FeatureIndicatorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */; };
10191017
F0B894EF2BF751C500817A42 /* RelayWithLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894EE2BF751C500817A42 /* RelayWithLocation.swift */; };
10201018
F0B894F12BF751E300817A42 /* RelayWithDistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894F02BF751E300817A42 /* RelayWithDistance.swift */; };
10211019
F0B894F32BF7526700817A42 /* RelaySelector+Wireguard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894F22BF7526700817A42 /* RelaySelector+Wireguard.swift */; };
@@ -1460,7 +1458,6 @@
14601458
44075DFA2CDA4F7400F61139 /* UDPOverTCPObfuscationSettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UDPOverTCPObfuscationSettingsViewModel.swift; sourceTree = "<group>"; };
14611459
440E5AAF2CDBD67D00B09614 /* StatefulPreviewWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatefulPreviewWrapper.swift; sourceTree = "<group>"; };
14621460
440E5AB32CDCF24500B09614 /* TunnelObfuscationSettingsWatchingObservableObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelObfuscationSettingsWatchingObservableObject.swift; sourceTree = "<group>"; };
1463-
4419AA882D282687001B13C9 /* DetailsContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsContainer.swift; sourceTree = "<group>"; };
14641461
4419AA8A2D2826E5001B13C9 /* DetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsView.swift; sourceTree = "<group>"; };
14651462
4419AA8D2D2828A4001B13C9 /* HeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderView.swift; sourceTree = "<group>"; };
14661463
4422C0702CCFF6790001A385 /* UDPOverTCPObfuscationSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UDPOverTCPObfuscationSettingsView.swift; sourceTree = "<group>"; };
@@ -2283,7 +2280,6 @@
22832280
F0B495752D02025200CFEC2A /* ChipContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipContainerView.swift; sourceTree = "<group>"; };
22842281
F0B495772D02038B00CFEC2A /* ChipViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipViewModelProtocol.swift; sourceTree = "<group>"; };
22852282
F0B495792D02F41F00CFEC2A /* ChipFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipFeature.swift; sourceTree = "<group>"; };
2286-
F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureIndicatorsView.swift; sourceTree = "<group>"; };
22872283
F0B894EE2BF751C500817A42 /* RelayWithLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayWithLocation.swift; sourceTree = "<group>"; };
22882284
F0B894F02BF751E300817A42 /* RelayWithDistance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayWithDistance.swift; sourceTree = "<group>"; };
22892285
F0B894F22BF7526700817A42 /* RelaySelector+Wireguard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RelaySelector+Wireguard.swift"; sourceTree = "<group>"; };
@@ -2722,15 +2718,14 @@
27222718
4419AA862D28264D001B13C9 /* ConnectionView */ = {
27232719
isa = PBXGroup;
27242720
children = (
2725-
44E1F7572D3EA82C003A60FF /* DestinationDescriber.swift */,
2726-
F0ADF1CF2D01B50B00299F09 /* ChipView */,
2727-
7AA130972CFF364F00640DF9 /* FeatureIndicators */,
27282721
449E9A6E2D283C7400F8574A /* ButtonPanel.swift */,
2722+
F0ADF1CF2D01B50B00299F09 /* ChipView */,
27292723
7AA130982CFF365A00640DF9 /* ConnectionView.swift */,
27302724
449E9A6C2D283A2500F8574A /* ConnectionViewComponentPreview.swift */,
27312725
7A0EAEA32D06DF8200D3EB8B /* ConnectionViewViewModel.swift */,
2732-
4419AA882D282687001B13C9 /* DetailsContainer.swift */,
2726+
44E1F7572D3EA82C003A60FF /* DestinationDescriber.swift */,
27332727
4419AA8A2D2826E5001B13C9 /* DetailsView.swift */,
2728+
F0ADF1D22D01B6B400299F09 /* FeatureIndicatorsViewModel.swift */,
27342729
4419AA8D2D2828A4001B13C9 /* HeaderView.swift */,
27352730
);
27362731
path = ConnectionView;
@@ -4124,15 +4119,6 @@
41244119
path = SelectLocation;
41254120
sourceTree = "<group>";
41264121
};
4127-
7AA130972CFF364F00640DF9 /* FeatureIndicators */ = {
4128-
isa = PBXGroup;
4129-
children = (
4130-
F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */,
4131-
F0ADF1D22D01B6B400299F09 /* FeatureIndicatorsViewModel.swift */,
4132-
);
4133-
path = FeatureIndicators;
4134-
sourceTree = "<group>";
4135-
};
41364122
7AD63A422CDA661B00445268 /* Extensions */ = {
41374123
isa = PBXGroup;
41384124
children = (
@@ -6149,7 +6135,6 @@
61496135
587EB66A270EFACB00123C75 /* CharacterSet+IPAddress.swift in Sources */,
61506136
5888AD83227B11080051EB06 /* LocationCell.swift in Sources */,
61516137
5891BF1C25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift in Sources */,
6152-
4419AA892D282687001B13C9 /* DetailsContainer.swift in Sources */,
61536138
5878A26F2907E7E00096FC88 /* ProblemReportInteractor.swift in Sources */,
61546139
7AB4CCBB2B691BBB006037F5 /* IPOverrideInteractor.swift in Sources */,
61556140
7A3353912AAA014400F0A71C /* SimulatorVPNConnection.swift in Sources */,
@@ -6225,7 +6210,6 @@
62256210
586C0D782B039CC000E7CDD7 /* AccessMethodProtocolPicker.swift in Sources */,
62266211
58677710290975E9006F721F /* SettingsInteractorFactory.swift in Sources */,
62276212
7A9CCCC02A96302800DD6A34 /* ProfileVoucherCoordinator.swift in Sources */,
6228-
F0B4957C2D03154200CFEC2A /* FeatureIndicatorsView.swift in Sources */,
62296213
7A9CCCBC2A96302800DD6A34 /* ChangeLogCoordinator.swift in Sources */,
62306214
58B26E282943527300D5980C /* SystemNotificationProvider.swift in Sources */,
62316215
F0ADF1D52D01DCFD00299F09 /* ChipView.swift in Sources */,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import SwiftUI
1111

12-
struct ChipModel: Identifiable, Hashable {
12+
struct ChipModel: Identifiable {
1313
var id: String { name }
1414
let name: String
1515
}

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

+35-33
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,55 @@ struct ConnectionView: View {
2323
var body: some View {
2424
Spacer()
2525
.accessibilityIdentifier(AccessibilityIdentifier.connectionView.asString)
26+
2627
VStack(alignment: .leading, spacing: 16) {
2728
VStack(alignment: .leading, spacing: 16) {
2829
HeaderView(viewModel: connectionViewModel, isExpanded: $isExpanded)
30+
2931
if showConnectionDetailsAnimated {
30-
if isExpandedAnimatied {
31-
Divider()
32-
.background(UIColor.secondaryTextColor.color)
33-
}
34-
if isExpandedAnimatied || !indicatorsViewModel.chips.isEmpty {
35-
ScrollView {
36-
VStack(alignment: .leading, spacing: 0) {
37-
if !indicatorsViewModel.chips.isEmpty && isExpandedAnimatied {
38-
Text(LocalizedStringKey("Active features"))
39-
.font(.footnote.weight(.semibold))
40-
.foregroundStyle(UIColor.primaryTextColor.color.opacity(0.6))
41-
.padding(.bottom, isExpandedAnimatied ? 8 : 0)
42-
}
43-
ChipContainerView(viewModel: indicatorsViewModel, isExpanded: $isExpanded)
44-
if isExpandedAnimatied {
45-
DetailsView(viewModel: connectionViewModel)
46-
.padding(.top, indicatorsViewModel.chips.isEmpty ? 0 : 16)
47-
}
48-
}
49-
.sizeOfView { size in
50-
withAnimation {
51-
scrollViewHeight = size.height
52-
}
53-
}
32+
Divider()
33+
.background(UIColor.secondaryTextColor.color)
34+
.showIf(isExpandedAnimatied)
35+
36+
ScrollView {
37+
VStack(alignment: .leading, spacing: 0) {
38+
Text(LocalizedStringKey("Active features"))
39+
.font(.footnote.weight(.semibold))
40+
.foregroundStyle(UIColor.primaryTextColor.color.opacity(0.6))
41+
.padding(.bottom, isExpandedAnimatied ? 8 : 0)
42+
.showIf(!indicatorsViewModel.chips.isEmpty && isExpandedAnimatied)
43+
44+
ChipContainerView(viewModel: indicatorsViewModel, isExpanded: $isExpanded)
45+
46+
DetailsView(viewModel: connectionViewModel)
47+
.padding(.top, indicatorsViewModel.chips.isEmpty ? 0 : 16)
48+
.showIf(isExpandedAnimatied)
5449
}
55-
.frame(maxHeight: scrollViewHeight)
56-
.apply {
57-
if #available(iOS 16.4, *) {
58-
$0.scrollBounceBehavior(.basedOnSize)
59-
} else {
60-
$0
50+
.sizeOfView { size in
51+
withAnimation {
52+
scrollViewHeight = size.height
6153
}
6254
}
6355
}
56+
.frame(maxHeight: scrollViewHeight)
57+
.apply {
58+
if #available(iOS 16.4, *) {
59+
$0.scrollBounceBehavior(.basedOnSize)
60+
} else {
61+
$0
62+
}
63+
}
64+
.showIf(isExpandedAnimatied || !indicatorsViewModel.chips.isEmpty)
6465
}
6566
}
6667
.transformEffect(.identity)
68+
6769
ButtonPanel(viewModel: connectionViewModel, action: action)
6870
}
6971
.padding()
72+
.background(BlurView(style: .dark))
73+
.cornerRadius(12)
74+
.padding()
7075
.onChange(of: isExpanded) { newValue in
7176
withAnimation {
7277
isExpandedAnimatied = newValue
@@ -80,9 +85,6 @@ struct ConnectionView: View {
8085
showConnectionDetailsAnimated = newValue
8186
}
8287
}
83-
.background(BlurView(style: .dark))
84-
.cornerRadius(12)
85-
.padding()
8688
}
8789
}
8890

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

-89
This file was deleted.

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

-40
This file was deleted.

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extension ConnectionView {
1515

1616
@State var titleForCountryAndCity: LocalizedStringKey?
1717
@State var titleForServer: LocalizedStringKey?
18-
@State var showConnectionDetails = false
18+
1919
var body: some View {
2020
HStack(alignment: .top) {
2121
VStack(alignment: .leading, spacing: 0) {
@@ -66,11 +66,6 @@ extension ConnectionView {
6666
titleForServer = newValue
6767
}
6868
})
69-
.onChange(of: viewModel.showsConnectionDetails) { newValue in
70-
withAnimation {
71-
showConnectionDetails = newValue
72-
}
73-
}
7469
}
7570
}
7671
}

0 commit comments

Comments
 (0)