Skip to content

Spotlight Location Notifications#309

Open
3TTemi wants to merge 5 commits into
masterfrom
3TTemi/location-notifications
Open

Spotlight Location Notifications#309
3TTemi wants to merge 5 commits into
masterfrom
3TTemi/location-notifications

Conversation

@3TTemi

@3TTemi 3TTemi commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

This pull request adds location-based spotlight notifications using native geofencing.

  • Backend SpotlightModule with service, controller, and WebSocket gateway for full CRUD and notification delivery
  • Multi-layer anti-spam: daily cap (1/day), per-spotlight cooldown (configurable, default 7 days), time window filtering (Eastern Time), and completion-aware filtering (skips users who already completed linked challenge/event)
  • Dedicated HTTP POST endpoint (spotlight/notify) for background geofence callbacks (cannot use WebSocket from background isolate)
  • Server-side proximity verification using distance calculation (extracted to shared geo.util.ts)
  • New Prisma models: LocationSpotlight and SpotlightNotificationLog
  • Flutter SpotlightService — fetches active spotlights via WebSocket every 15 min, registers OS-level geofences via native_geofence, works with app closed
  • Android/iOS native geofencing permissions and manifest setup
  • Admin UI Spotlights.tsx — full CRUD for managing spotlights with geographic coords, radius, time windows, date ranges, and optional challenge/event linking

Test Plan

  • Unit tests for anti-spam rules in the servers `SpotlightService'
  • Manual testing for closed and open app: create a spotlight in admin, walk into geofence radius, verify notification fires on device

Notes

  • Geofence callbacks run in a separate OS background process (Dart isolate) that cannot access WebSocket state — this is why notifications use a dedicated HTTP endpoint instead of the WebSocket gateway
  • The native_geofence Flutter plugin requires "Always Allow" location permission for background geofencing
  • Anti-spam cooldown and time windows use Eastern Time (America/New_York)

@dti-github-bot

dti-github-bot commented Apr 13, 2026

Copy link
Copy Markdown
Member

[diff-counting] Significant lines: 3433. This diff might be too big! Developer leads are invited to review the code.

@3TTemi 3TTemi force-pushed the 3TTemi/location-notifications branch from 690cd6a to edb57a4 Compare April 13, 2026 21:17
@3TTemi 3TTemi changed the title 3 t temi/location notifications Spotlight Location Notifications Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants