aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/foundation/e/privacycentralapp/dummy
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp/dummy')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/dummy/CityDataSource.kt66
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/dummy/DummyDataSource.kt4
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/dummy/Extensions.kt2
3 files changed, 3 insertions, 69 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/dummy/CityDataSource.kt b/app/src/main/java/foundation/e/privacycentralapp/dummy/CityDataSource.kt
deleted file mode 100644
index 988c7f4..0000000
--- a/app/src/main/java/foundation/e/privacycentralapp/dummy/CityDataSource.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2021 E FOUNDATION
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package foundation.e.privacycentralapp.dummy
-
-import foundation.e.privacycentralapp.domain.entities.LocationMode
-import kotlin.random.Random
-
-data class City(val name: String, val latitude: Double, val longitude: Double) {
-
- fun toRandomLocation(): Location {
- return Location(LocationMode.RANDOM_LOCATION, this.latitude, this.longitude)
- }
-}
-
-object CityDataSource {
- private val BARCELONA = Pair(41.3851, 2.1734)
- private val BUDAPEST = Pair(47.4979, 19.0402)
- private val ABU_DHABI = Pair(24.4539, 54.3773)
- private val HYDERABAD = Pair(17.3850, 78.4867)
- private val QUEZON_CITY = Pair(14.6760, 121.0437)
- private val PARIS = Pair(48.8566, 2.3522)
- private val LONDON = Pair(51.5074, 0.1278)
- private val SHANGHAI = Pair(31.2304, 121.4737)
- private val MADRID = Pair(40.4168, 3.7038)
- private val LAHORE = Pair(31.5204, 74.3587)
- private val CHICAGO = Pair(41.8781, 87.6298)
-
- // LatLong Array, the order should be the same as that of R.array.cities
- private val latLongArray = arrayOf(
- BARCELONA,
- BUDAPEST,
- ABU_DHABI,
- HYDERABAD,
- QUEZON_CITY,
- PARIS,
- LONDON,
- SHANGHAI,
- MADRID,
- LAHORE,
- CHICAGO
- )
-
- fun getRandomCity(cities: Array<String>): City {
- if (cities.size != latLongArray.size) {
- throw IllegalStateException("LatLong array must have the same number of element as in cities array.")
- }
- val randomIndex = Random.nextInt(cities.size)
- val latLong = latLongArray[randomIndex]
- return City(cities[randomIndex], latLong.first, latLong.second)
- }
-}
diff --git a/app/src/main/java/foundation/e/privacycentralapp/dummy/DummyDataSource.kt b/app/src/main/java/foundation/e/privacycentralapp/dummy/DummyDataSource.kt
index 246854b..38daeab 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/dummy/DummyDataSource.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/dummy/DummyDataSource.kt
@@ -183,9 +183,9 @@ object DummyDataSource {
requireNotNull(location) { "Custom location should be null" }
_location.value = location
}
- LocationMode.CUSTOM_LOCATION -> {
+ LocationMode.SPECIFIC_LOCATION -> {
requireNotNull(location) { "Custom location should be null" }
- _location.value = location.copy(mode = LocationMode.CUSTOM_LOCATION)
+ _location.value = location.copy(mode = LocationMode.SPECIFIC_LOCATION)
}
}
return true
diff --git a/app/src/main/java/foundation/e/privacycentralapp/dummy/Extensions.kt b/app/src/main/java/foundation/e/privacycentralapp/dummy/Extensions.kt
index 04ee5bf..ab4ba72 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/dummy/Extensions.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/dummy/Extensions.kt
@@ -24,5 +24,5 @@ import foundation.e.privacycentralapp.domain.entities.LocationMode
fun LocationMode.mapToString(context: Context): String = when (this) {
LocationMode.REAL_LOCATION -> context.getString(R.string.real_location_mode)
LocationMode.RANDOM_LOCATION -> context.getString(R.string.random_location_mode)
- LocationMode.CUSTOM_LOCATION -> context.getString(R.string.fake_location_mode)
+ LocationMode.SPECIFIC_LOCATION -> context.getString(R.string.fake_location_mode)
}