From 7eba856f137637483a345c81ec6ee4a9f1f33ddc Mon Sep 17 00:00:00 2001 From: jack Date: Sat, 13 Sep 2025 01:02:20 +0200 Subject: [PATCH] Location notes: inline sheet wrapper to avoid missing file in target; force location refresh and show Matrix loader until block geohash resolves --- bitchat/Views/ContentView.swift | 48 +++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index 0205b530..a2899e25 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1221,8 +1221,52 @@ struct ContentView: View { .onDisappear { viewModel.isLocationChannelsSheetPresented = false } } .sheet(isPresented: $showLocationNotes) { - LocationNotesSheet(notesGeohash: $notesGeohash) - .environmentObject(viewModel) + Group { + if let gh = notesGeohash ?? LocationChannelManager.shared.availableChannels.first(where: { $0.level == .block })?.geohash { + LocationNotesView(geohash: gh) + .environmentObject(viewModel) + } else { + ZStack { + VStack(spacing: 0) { + HStack { + VStack(alignment: .leading, spacing: 2) { + Text("notes") + .font(.system(size: 16, weight: .bold, design: .monospaced)) + Text("acquiring location…") + .font(.system(size: 12, design: .monospaced)) + .foregroundColor(secondaryTextColor) + } + Spacer() + Button(action: { showLocationNotes = false }) { + Image(systemName: "xmark") + .font(.system(size: 13, weight: .semibold, design: .monospaced)) + .foregroundColor(textColor) + .frame(width: 32, height: 32) + } + .buttonStyle(.plain) + .accessibilityLabel("Close") + } + .frame(height: 44) + .padding(.horizontal, 12) + .background(backgroundColor.opacity(0.95)) + Spacer() + } + MatrixRainView() + .transition(.opacity) + } + .background(backgroundColor) + .foregroundColor(textColor) + .onAppear { + LocationChannelManager.shared.enableLocationChannels() + LocationChannelManager.shared.refreshChannels() + } + .onChange(of: locationManager.availableChannels) { channels in + if notesGeohash == nil, let block = channels.first(where: { $0.level == .block }) { + notesGeohash = block.geohash + } + } + } + } } .alert("heads up", isPresented: $viewModel.showScreenshotPrivacyWarning) { Button("ok", role: .cancel) {}