From 8d45a42320e1678f275ee2770e930bc65f24c7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 4 Dec 2025 19:59:46 +0800 Subject: [PATCH] Fix reordering in non-edit mode on iOS 26 --- .../Dashboard/Cards/ProfilePickerSheet.swift | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/ApplicationLibrary/Views/Dashboard/Cards/ProfilePickerSheet.swift b/ApplicationLibrary/Views/Dashboard/Cards/ProfilePickerSheet.swift index 6a3f2bf..a9fc8aa 100644 --- a/ApplicationLibrary/Views/Dashboard/Cards/ProfilePickerSheet.swift +++ b/ApplicationLibrary/Views/Dashboard/Cards/ProfilePickerSheet.swift @@ -51,7 +51,7 @@ struct ProfilePickerSheet: View { #if os(iOS) @available(iOS 26, *) private var iOSBody: some View { - listContent + iOSListContent .toolbar { ToolbarItem(placement: .primaryAction) { EditButton() @@ -67,6 +67,49 @@ struct ProfilePickerSheet: View { .alert($alert) } + @available(iOS 26, *) + @ViewBuilder + private var iOSListContent: some View { + if editMode.isEditing { + iOSEditingList + } else { + iOSNormalList + } + } + + @available(iOS 26, *) + private var iOSEditingList: some View { + listContent + } + + @available(iOS 26, *) + private var iOSNormalList: some View { + List { + ForEach(profileList, id: \.id) { profile in + ProfilePickerRow( + profile: profile, + isSelected: profile.id == selectedProfileID, + alert: $alert, + onSelect: { + selectedProfileID = profile.id + dismiss() + }, + onEdit: { + profileToEdit = profile.origin + }, + onUpdate: { + await updateProfile(profile) + } + ) + .environmentObject(environments) + .listRowBackground(Color.clear) + .listRowSeparator(.hidden) + .listRowInsets(EdgeInsets(top: 2, leading: 16, bottom: 2, trailing: 16)) + } + } + .listStyle(.plain) + } + private var legacyIOSBody: some View { legacyListContent .toolbar {