summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2025-09-23 09:04:39 +0200
committerJon Petersson <jon.petersson@mullvad.net>2025-09-25 14:46:52 +0200
commit7508f10b2bf81a369e3cee2b307a7463ce0ed834 (patch)
treec43e9af67a140063bf3f3c689e65c589c30a22fb
parent6a3c3b512a80464c114a3a41e1411d2946d955dd (diff)
downloadmullvadvpn-7508f10b2bf81a369e3cee2b307a7463ce0ed834.tar.xz
mullvadvpn-7508f10b2bf81a369e3cee2b307a7463ce0ed834.zip
Fix separators in access methods list
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/DAITA/SettingsDAITAView.swift4
-rw-r--r--ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift1
-rw-r--r--ios/MullvadVPN/View controllers/DeviceList/DeviceManagementView.swift18
-rw-r--r--ios/MullvadVPN/Views/List/MullvadList.swift36
-rw-r--r--ios/MullvadVPN/Views/RowSeparator.swift10
5 files changed, 39 insertions, 30 deletions
diff --git a/ios/MullvadVPN/Coordinators/Settings/DAITA/SettingsDAITAView.swift b/ios/MullvadVPN/Coordinators/Settings/DAITA/SettingsDAITAView.swift
index 7422b25391..2e5224a556 100644
--- a/ios/MullvadVPN/Coordinators/Settings/DAITA/SettingsDAITAView.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/DAITA/SettingsDAITAView.swift
@@ -18,7 +18,7 @@ struct SettingsDAITAView<ViewModel>: View where ViewModel: TunnelSettingsObserva
if isAutomaticRoutingActive {
DAITAMultihopNotice()
.padding(EdgeInsets(
- top: -UIMetrics.contentInsets.top,
+ top: -8,
leading: UIMetrics.contentInsets.toEdgeInsets.leading,
bottom: 8,
trailing: UIMetrics.contentInsets.toEdgeInsets.trailing
@@ -34,7 +34,7 @@ struct SettingsDAITAView<ViewModel>: View where ViewModel: TunnelSettingsObserva
text: NSLocalizedString("Enable", comment: ""),
accessibilityId: .daitaSwitch
)
- RowSeparator()
+ RowSeparator(edgeInsets: .init(top: 0, leading: 16, bottom: 0, trailing: 16))
SwitchRowView(
isOn: directOnlyIsEnabled,
disabled: !daitaIsEnabled.wrappedValue,
diff --git a/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift b/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift
index cfdabe317a..0075e18e0d 100644
--- a/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift
+++ b/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift
@@ -41,7 +41,6 @@ struct DeviceListView: View {
Spacer()
}
}
- .frame(maxWidth: .infinity, maxHeight: .infinity)
}
MullvadList(
diff --git a/ios/MullvadVPN/View controllers/DeviceList/DeviceManagementView.swift b/ios/MullvadVPN/View controllers/DeviceList/DeviceManagementView.swift
index 953fee18b8..98b7852bbb 100644
--- a/ios/MullvadVPN/View controllers/DeviceList/DeviceManagementView.swift
+++ b/ios/MullvadVPN/View controllers/DeviceList/DeviceManagementView.swift
@@ -65,10 +65,7 @@ struct DeviceManagementView: View {
"View and manage all your logged in devices. You can have up to 5 devices on one account at a time. Each device gets a name when logged in to help you tell them apart easily."
case .tooManyDevices:
if canLoginNewDevice {
- """
- You can now continue logging in on this device.
- """
-
+ "You can now continue logging in on this device."
} else {
"Please log out of at least one by removing it from the list below. You can find the corresponding device name under the device’s Account settings."
}
@@ -172,9 +169,7 @@ struct DeviceManagementView: View {
.foregroundColor(.mullvadTextPrimary)
.opacity(0.6)
.font(.mullvadTinySemiBold)
- .padding(.bottom, 16.0)
- }
- )
+ })
}
)
Spacer()
@@ -187,14 +182,7 @@ struct DeviceManagementView: View {
}
.accessibilityIdentifier(AccessibilityIdentifier.continueWithLoginButton)
.disabled(!canLoginNewDevice)
- .padding(
- EdgeInsets(
- top: UIMetrics.contentLayoutMargins.top,
- leading: UIMetrics.contentLayoutMargins.leading,
- bottom: UIMetrics.contentLayoutMargins.bottom,
- trailing: UIMetrics.contentLayoutMargins.trailing
- )
- )
+ .padding(EdgeInsets(UIMetrics.contentLayoutMargins))
}
}
.mullvadAlert(item: $deviceManagementAlert)
diff --git a/ios/MullvadVPN/Views/List/MullvadList.swift b/ios/MullvadVPN/Views/List/MullvadList.swift
index 5eb26e7995..d7ea99931d 100644
--- a/ios/MullvadVPN/Views/List/MullvadList.swift
+++ b/ios/MullvadVPN/Views/List/MullvadList.swift
@@ -40,31 +40,47 @@ struct MullvadList<Content: View, Data: RandomAccessCollection<ID>, ID: Hashable
List {
if let headerView = header?() {
headerView
- .listRowBackground(Color.clear)
- .listRowSeparator(.hidden)
- .listRowInsets(EdgeInsets(UIMetrics.contentHeadingLayoutMargins))
+ .listRowStyling(insets: EdgeInsets(UIMetrics.contentHeadingLayoutMargins))
}
+ let lastItem = data.last
ForEach(data, id: id) { item in
- content(item)
- .listRowInsets(.init())
- .listRowSeparator(.hidden)
+ VStack(spacing: 0) {
+ content(item)
+ if item != lastItem {
+ RowSeparator()
+ }
+ }
+ .listRowStyling()
}
if let footerView = footer?() {
footerView
- .listRowBackground(Color.clear)
- .listRowSeparator(.hidden)
- .listRowInsets(EdgeInsets(UIMetrics.contentFooterLayoutMargins))
+ .listRowStyling(insets: EdgeInsets(UIMetrics.contentFooterLayoutMargins))
}
}
.listStyle(.plain)
- .listRowSpacing(UIMetrics.TableView.separatorHeight)
+ .listRowSpacing(.zero)
.environment(\.defaultMinListRowHeight, 0)
}
}
}
+extension View {
+ func listRowStyling(
+ background: Color = .clear,
+ separator: Visibility = .hidden,
+ insets: EdgeInsets = .init()
+ ) -> some View {
+ apply {
+ $0
+ .listRowBackground(background)
+ .listRowSeparator(separator)
+ .listRowInsets(insets)
+ }
+ }
+}
+
#Preview {
MullvadList(
[1, 2, 3],
diff --git a/ios/MullvadVPN/Views/RowSeparator.swift b/ios/MullvadVPN/Views/RowSeparator.swift
index 40d4469a72..c8b9af7ad1 100644
--- a/ios/MullvadVPN/Views/RowSeparator.swift
+++ b/ios/MullvadVPN/Views/RowSeparator.swift
@@ -9,12 +9,18 @@
import SwiftUI
struct RowSeparator: View {
- var color = Color(.secondaryColor)
+ let color: Color
+ let edgeInsets: EdgeInsets
+
+ init(color: Color = Color(.secondaryColor), edgeInsets: EdgeInsets = .init()) {
+ self.color = color
+ self.edgeInsets = edgeInsets
+ }
var body: some View {
color
.frame(height: UIMetrics.TableView.separatorHeight)
- .padding(.leading, 16)
+ .padding(edgeInsets)
}
}