mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 16:25:23 +00:00
Add plus-minus feature to location notes (± 1 grid) (#821)
Expands location notes coverage to include 8 neighboring geohash cells, creating a 3×3 grid around the user's current building-level location. Changes: - Add Geohash.neighbors() method to calculate 8 surrounding cells - Update LocationNotesManager to subscribe to center + neighbors (9 cells total) - Add NostrFilter.geohashNotes([String]) overload for multi-cell subscriptions - Display '± 1' indicator in LocationNotesView header Coverage: - Single cell: ~38m × 19m - 3×3 grid: ~114m × 57m total area - Better discovery of nearby activity Behavior: - Subscribe: Fetches notes from all 9 cells (single efficient subscription) - Post: Still uses center geohash only (correct privacy-preserving behavior) - UI: Shows 'geohash ± 1' to indicate expanded coverage Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -906,6 +906,16 @@ struct NostrFilter: Encodable {
|
||||
filter.limit = limit
|
||||
return filter
|
||||
}
|
||||
|
||||
// For location notes with neighbors: subscribe to multiple geohashes (center + neighbors)
|
||||
static func geohashNotes(_ geohashes: [String], since: Date? = nil, limit: Int = 200) -> NostrFilter {
|
||||
var filter = NostrFilter()
|
||||
filter.kinds = [1]
|
||||
filter.since = since?.timeIntervalSince1970.toInt()
|
||||
filter.tagFilters = ["g": geohashes]
|
||||
filter.limit = limit
|
||||
return filter
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamic coding key for tag filters
|
||||
|
||||
Reference in New Issue
Block a user