Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ struct AntennaHorizonsPage: View {
return content
}()
}
.overlay {
if let adding {
DrawingOverlay(text: Text(adding.total == 0 ? "Drawing the map…" : "Adding to the map… \(adding.added) / \(adding.total)"))
}
}
VStack(alignment: .leading, spacing: 8) {
Text("US cell positions (MCC 310–314)").font(.headline)
Text(error ?? (rows.isEmpty ? "Loading OpenCellID data…" : "\(circles.count) / \(rows.count) circles"))
.accessibilityIdentifier("antenna-circle-count")
if let adding {
Text("Adding to the map… \(adding.added) / \(adding.total)")
// total is 0 when nothing new is added: a filter that only hides cells, or the camera moving.
Text(adding.total == 0 ? "Drawing the map…" : "Adding to the map… \(adding.added) / \(adding.total)")
.accessibilityIdentifier("antenna-add-progress")
}
HStack { Button("US overview") { moveCamera(39, -98, 4) }; Button("Alaska") { moveCamera(64, -150, 5) } }
Expand Down Expand Up @@ -219,3 +225,34 @@ private struct CarrierToggle: View {
.accessibilityIdentifier(icon)
}
}

/// Over the map while circles are added or their tiles drawn (between onAddStart and
/// onAddEnd). Shown after 150 ms, as the web and Android samples' overlays are, so that a
/// short redraw does not flash; it does not take touches, so the map can still be moved
/// while it draws.
private struct DrawingOverlay: View {
let text: Text
@State private var visible = false

var body: some View {
ZStack {
if visible {
Color(red: 0x0F / 255, green: 0x17 / 255, blue: 0x2A / 255).opacity(0.2)
VStack(spacing: 10) {
ProgressView()
text.font(.callout)
}
.padding(.horizontal, 20).padding(.vertical, 16)
.background(Color(UIColor.secondarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
.accessibilityElement(children: .combine)
.accessibilityIdentifier("antenna-drawing-overlay")
}
}
.allowsHitTesting(false)
.task {
try? await Task.sleep(nanoseconds: 150_000_000)
visible = true
}
}
}