mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-16 13:26:27 -05:00
## Summary This PR aims to fix a couple of bugs I noticed while testing the new watch folders feature in the latest Test Flight build: 1) Changing the folder name, icon, and icon after it was created did not work. 2) When adding a folder, the folder name should be a placeholder, not a pre-filled field. 3) When switching between a folder and the root view, the items should not resize after rendering (see the last item here): https://github.com/user-attachments/assets/262cb313-f307-455f-ba21-7a189a3f7589 Note: I could not reproduce the resizing bug in the simulator, and haven't been able to get Xcode to let me build to my devices locally. Would you be up for trying to reproduce it/verify my fix on your end? ## Link to pull request in Documentation repository N/A
56 lines
1.7 KiB
Swift
56 lines
1.7 KiB
Swift
import SFSafeSymbols
|
|
import Shared
|
|
import SwiftUI
|
|
|
|
struct WatchFolderContentView: View {
|
|
let folderId: String
|
|
@ObservedObject var viewModel: WatchHomeViewModel
|
|
let onBack: () -> Void
|
|
|
|
private var folder: MagicItem? {
|
|
viewModel.watchConfig.items.first(where: { $0.type == .folder && $0.id == folderId })
|
|
}
|
|
|
|
var body: some View {
|
|
List {
|
|
header
|
|
ForEach(folder?.items ?? [], id: \.serverUniqueId) { item in
|
|
WatchMagicViewRow(
|
|
item: item,
|
|
itemInfo: viewModel.info(for: item)
|
|
)
|
|
}
|
|
}
|
|
.id(viewModel.configVersion)
|
|
.ignoresSafeArea([.all], edges: .top)
|
|
.navigationTitle("")
|
|
.navigationBarBackButtonHidden(true)
|
|
.modify { view in
|
|
if #available(watchOS 11.0, *) {
|
|
view.toolbarVisibility(.hidden, for: .navigationBar)
|
|
} else if #available(watchOS 9.0, *) {
|
|
view.toolbar(.hidden, for: .navigationBar)
|
|
} else {
|
|
view.navigationBarHidden(true)
|
|
}
|
|
}
|
|
}
|
|
|
|
private var header: some View {
|
|
HStack {
|
|
Button {
|
|
onBack()
|
|
} label: {
|
|
Image(systemSymbol: .chevronLeft)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.circularGlassOrLegacyBackground()
|
|
Text(folder?.displayText ?? L10n.Watch.Configuration.Folder.defaultName)
|
|
.font(.headline)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
}
|
|
.listRowBackground(Color.clear)
|
|
.padding(.top, DesignSystem.Spaces.one)
|
|
}
|
|
}
|