Skip to content

Location based snooze#1365

Merged
Futsch1 merged 24 commits intomainfrom
locationBasedSnooze
Apr 27, 2026
Merged

Location based snooze#1365
Futsch1 merged 24 commits intomainfrom
locationBasedSnooze

Conversation

@Futsch1
Copy link
Copy Markdown
Owner

@Futsch1 Futsch1 commented Apr 26, 2026

Closes #1079

Futsch1 and others added 22 commits April 19, 2026 20:05
Documents the support classes, DI module, manifest permissions, and
Gradle changes needed to implement "snooze until home" via the Android
Geofencing API. User will wire in the UI integration separately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds test file specifications for HomeLocationStoreTest,
GeofenceRegistrarTest, LocationSnoozeProcessorTest, and
GeofenceBroadcastReceiverTest following the existing Robolectric+Mockito
pattern. Also clarifies that GeofencingClient testability is already
covered by DI constructor injection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces the infrastructure for "snooze until home" via the Android
Geofencing API:

- HomeLocation / HomeLocationStore: persist home coordinates and pending
  snoozed reminders in SharedPreferences as JSON
- GeofenceRegistrar: register/unregister the home geofence via the
  injected GeofencingClient and GoogleApiAvailability (fully mockable)
- LocationSnoozeProcessor: re-fires snoozed reminders on geofence entry
  by exploiting AlarmProcessor's immediate-broadcast short-circuit
- GeofenceBroadcastReceiver: Hilt-injected receiver for OS geofence events
- LocationModule: Hilt bindings for GeofencingClient, GoogleApiAvailability,
  and Gson
- Unit tests for all four classes (Robolectric + Mockito)
- Manifest: ACCESS_FINE/COARSE/BACKGROUND_LOCATION permissions +
  receiver declaration
- Gradle: play-services-location 21.3.0 dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ReminderNotificationData and HomeLocationStore now use List<Int> /
MutableList<Int> instead of IntArray. Updated all test call sites to use
listOf / mutableListOf accordingly and replaced contentEquals checks with
assertEquals for list comparison.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a "Location-based snooze" toggle to the notification settings screen.
Tapping ON checks Play Services availability and that a home location is
set, then walks the user through the two-step location permission flow
(fine → background on API 29+). Permissions denied or geofence
registration failure reverts the switch. Toggling OFF unregisters the
geofence. onResume reverts the switch if location permissions were revoked
from system settings.

Also: expose GeofenceRegistrar.hasRequiredPermissions() as internal,
add LOCATION_SNOOZE_ENABLED constant to PreferencesDataSource, add
five new string resources.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown
Contributor

qltysh Bot commented Apr 26, 2026

All good ✅

Comment thread app/src/main/java/com/futsch1/medtimer/preferences/SnoozeSettingsFragment.kt Outdated
Comment thread app/src/main/java/com/futsch1/medtimer/preferences/SnoozeSettingsFragment.kt Outdated
Comment thread docs/location-snooze-plan.md
@Futsch1 Futsch1 merged commit a60b648 into main Apr 27, 2026
13 checks passed
@Futsch1 Futsch1 deleted the locationBasedSnooze branch April 27, 2026 14:44
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.

Location-based snooze (Remind me at Home/Work)

1 participant