@@ -47,7 +47,7 @@ class LocationService(private val context: Context) {
|
||||
*/
|
||||
suspend fun mockLocation(latitude: Double, longitude: Double): Boolean {
|
||||
return try {
|
||||
val preferences = context.getSharedPreferences("mock_location", Context.MODE_PRIVATE)
|
||||
val preferences = context.getSharedPreferences("google_provider", Context.MODE_PRIVATE)
|
||||
preferences.edit()
|
||||
.putString("latitude", latitude.toString())
|
||||
.putString("longitude", longitude.toString())
|
||||
@@ -66,12 +66,12 @@ class LocationService(private val context: Context) {
|
||||
* Obtiene la ubicación simulada guardada
|
||||
*/
|
||||
fun getMockedLocation(): Location? {
|
||||
val preferences = context.getSharedPreferences("mock_location", Context.MODE_PRIVATE)
|
||||
val preferences = context.getSharedPreferences("google_provider", Context.MODE_PRIVATE)
|
||||
val latStr = preferences.getString("latitude", null)
|
||||
val lngStr = preferences.getString("longitude", null)
|
||||
|
||||
return if (latStr != null && lngStr != null) {
|
||||
Location("mock_provider").apply {
|
||||
Location("google_provider").apply {
|
||||
latitude = latStr.toDouble()
|
||||
longitude = lngStr.toDouble()
|
||||
time = preferences.getLong("timestamp", System.currentTimeMillis())
|
||||
@@ -90,7 +90,7 @@ class LocationService(private val context: Context) {
|
||||
val offsetLat = (random.nextDouble() - 0.5) * 2 * (radiusKm / 111.0) // 1 grado lat ≈ 111 km
|
||||
val offsetLng = (random.nextDouble() - 0.5) * 2 * (radiusKm / (111.0 * kotlin.math.cos(Math.toRadians(baseLatitude))))
|
||||
|
||||
return Location("random_provider").apply {
|
||||
return Location("google_provider").apply {
|
||||
latitude = baseLatitude + offsetLat
|
||||
longitude = baseLongitude + offsetLng
|
||||
time = System.currentTimeMillis()
|
||||
@@ -103,31 +103,31 @@ class LocationService(private val context: Context) {
|
||||
*/
|
||||
fun getPopularLocations(): List<Pair<String, Location>> {
|
||||
return listOf(
|
||||
"Madrid" to Location("predefined").apply {
|
||||
"Madrid" to Location("google_provider").apply {
|
||||
latitude = 40.4168
|
||||
longitude = -3.7038
|
||||
time = System.currentTimeMillis()
|
||||
accuracy = 10.0f
|
||||
},
|
||||
"Barcelona" to Location("predefined").apply {
|
||||
"Barcelona" to Location("google_provider").apply {
|
||||
latitude = 41.3851
|
||||
longitude = 2.1734
|
||||
time = System.currentTimeMillis()
|
||||
accuracy = 10.0f
|
||||
},
|
||||
"Valencia" to Location("predefined").apply {
|
||||
"Valencia" to Location("google_provider").apply {
|
||||
latitude = 39.4699
|
||||
longitude = -0.3763
|
||||
time = System.currentTimeMillis()
|
||||
accuracy = 10.0f
|
||||
},
|
||||
"Sevilla" to Location("predefined").apply {
|
||||
"Sevilla" to Location("google_provider").apply {
|
||||
latitude = 37.3886
|
||||
longitude = -5.9823
|
||||
time = System.currentTimeMillis()
|
||||
accuracy = 10.0f
|
||||
},
|
||||
"Bilbao" to Location("predefined").apply {
|
||||
"Bilbao" to Location("google_provider").apply {
|
||||
latitude = 43.2627
|
||||
longitude = -2.9253
|
||||
time = System.currentTimeMillis()
|
||||
|
||||
Referencia en una nueva incidencia
Block a user