From 8dd539a71b7cea279cd83811aeb26adc8594a875 Mon Sep 17 00:00:00 2001 From: gievano Date: Wed, 26 Aug 2026 01:20:50 +0700 Subject: [PATCH] fix: fill display grid gap by merging tool tiles into tweak rows Tools now flow into the last half-empty tweak row instead of starting their own group, so an odd tweak count no longer leaves a hole mid-grid. CarPlay Wallpaper is ordered before RDARFix so it lands beside Pulse Width Modulation; dead row helpers removed. --- WorkPlot/Views/HomeView.swift | 55 ++++------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/WorkPlot/Views/HomeView.swift b/WorkPlot/Views/HomeView.swift index a59de70..9a4cdae 100644 --- a/WorkPlot/Views/HomeView.swift +++ b/WorkPlot/Views/HomeView.swift @@ -174,10 +174,13 @@ struct HomeView: View { private func categorySection(_ cat: TweakCategory) -> some View { let tweaks = store.tweaks.filter { $0.category == cat && $0.id != "product-type" && matchesSearch($0.title) } let tools = toolDefs.filter { $0.category == cat && $0.id != "respring" && matchesSearch($0.title) } + // Tools flow into the last half-empty tweak row instead of starting + // their own group, so an odd tweak count leaves no gap mid-catalog. + let cells = tweaks.map { FlatCell.tweak($0) } + tools.map { FlatCell.tool($0) } return VStack(alignment: .leading, spacing: 14) { SectionHeader(cat.rawValue) HStack { - Text("\(tweaks.count + tools.count) available") + Text("\(cells.count) available") .font(.caption) .foregroundStyle(.secondary) Spacer() @@ -186,40 +189,7 @@ struct HomeView: View { // configuration panel can sit directly under the row holding the // tile that opened it, instead of after the whole catalog. VStack(alignment: .leading, spacing: 12) { - catalogRows(tweaks: tweaks, tools: tools) - } - } - } - - /// Shared row rendering for both the flat "All" list and a per-category - /// section: tweak rows (with inline config panel) followed by tool rows. - @ViewBuilder - private func catalogRows(tweaks: [Tweak], tools: [ToolDef]) -> some View { - ForEach(Array(tweakRows(tweaks).enumerated()), id: \.offset) { _, row in - HStack(alignment: .top, spacing: 12) { - ForEach(row) { tweak in - Button { toggle(tweak) } label: { - TweakCatalogTile(tweak: tweak, isConfiguring: configurationID == tweak.id) - } - .buttonStyle(.plain) - .accessibilityHint(tweak.isEnabled ? "Disables this capability" : "Enables this capability") - } - // Keeps a lone trailing tile at half width. - if row.count == 1 { Color.clear.frame(maxWidth: .infinity) } - } - if let tweak = configuringTweak, - row.contains(where: { $0.id == tweak.id }), - let detail = tweak.detail { - InlineTweakConfiguration(tweak: tweak, detail: detail) - .transition(.opacity.combined(with: .move(edge: .top))) - } - } - ForEach(Array(toolRows(tools).enumerated()), id: \.offset) { _, row in - HStack(alignment: .top, spacing: 12) { - ForEach(row) { tool in - toolCatalogTile(tool) - } - if row.count == 1 { Color.clear.frame(maxWidth: .infinity) } + flatRows(cells) } } } @@ -241,8 +211,8 @@ struct HomeView: View { private var toolDefs: [ToolDef] { [ - ToolDef(id: "rdarfix", title: "RDARFix", subtitle: "Edit resolusi layar lewat canvas exploit", symbol: "wand.and.stars", category: .display, destination: { AnyView(RDARFixView()) }), ToolDef(id: "carplay", title: "CarPlay Wallpaper", subtitle: "Ganti wallpaper layar CarPlay", symbol: "car", category: .display, destination: { AnyView(CarPlayWallpaperView()) }), + ToolDef(id: "rdarfix", title: "RDARFix", subtitle: "Edit resolusi layar lewat canvas exploit", symbol: "wand.and.stars", category: .display, destination: { AnyView(RDARFixView()) }), ToolDef(id: "respring", title: "Respring", subtitle: "Restart SpringBoard tanpa reboot", symbol: "arrow.clockwise", category: .system, action: { RespringHelper.shared.trigger() }), ToolDef(id: "devicespoof", title: "Device Spoof", subtitle: "Spoof identitas perangkat", symbol: "iphone.and.arrow.forward", category: .system, destination: { AnyView(DeviceSpoofingView()) }), ToolDef(id: "gestalteditor", title: "Gestalt Field Editor", subtitle: "Edit cache MobileGestalt", symbol: "slider.horizontal.3", category: .gestalt, destination: { AnyView(GestaltFieldEditorView()) }), @@ -275,19 +245,6 @@ struct HomeView: View { .accessibilityHint("Restart SpringBoard") } - /// Split a list into rows of two, matching the old grid. - private func tweakRows(_ tweaks: [Tweak]) -> [[Tweak]] { - stride(from: 0, to: tweaks.count, by: 2).map { start in - Array(tweaks[start.. [[ToolDef]] { - stride(from: 0, to: tools.count, by: 2).map { start in - Array(tools[start..