mirror of
https://github.com/torlando-tech/columba.git
synced 2025-12-22 05:37:07 +00:00
feat: send immediate location update when precision setting changes
When the user changes their location precision setting, immediately send an update to all active sharing recipients with the new precision rather than waiting for the next scheduled update. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -180,6 +180,34 @@ class LocationSharingManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an immediate location update to all active sharing recipients.
|
||||
*
|
||||
* Call this when settings change (e.g., precision) to immediately notify
|
||||
* recipients of the new settings rather than waiting for the next scheduled update.
|
||||
*/
|
||||
@SuppressLint("MissingPermission")
|
||||
fun sendImmediateUpdate() {
|
||||
if (_activeSessions.value.isEmpty()) {
|
||||
Log.d(TAG, "No active sessions, skipping immediate update")
|
||||
return
|
||||
}
|
||||
|
||||
// Use last known location if available, otherwise get current location
|
||||
if (lastLocation != null) {
|
||||
Log.d(TAG, "Sending immediate update with cached location")
|
||||
sendLocationToRecipients(lastLocation!!)
|
||||
} else {
|
||||
fusedLocationClient.lastLocation.addOnSuccessListener { location ->
|
||||
location?.let {
|
||||
Log.d(TAG, "Sending immediate update with fresh location")
|
||||
lastLocation = it
|
||||
sendLocationToRecipients(it)
|
||||
} ?: Log.w(TAG, "No location available for immediate update")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop sharing with a specific contact.
|
||||
*
|
||||
|
||||
@@ -1204,6 +1204,8 @@ class SettingsViewModel
|
||||
viewModelScope.launch {
|
||||
settingsRepository.saveLocationPrecisionRadius(radiusMeters)
|
||||
Log.d(TAG, "Location precision radius set to: ${radiusMeters}m")
|
||||
// Send immediate update to all active sharing recipients with new precision
|
||||
locationSharingManager.sendImmediateUpdate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user