aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-17 01:02:36 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-17 01:02:36 -0600
commit70d21d0dab61fc2b30f64721279b27a2c8a01d7a (patch)
treedb5c7b3f53e020193dafbead813899b00573e782 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap
parent70af8a0fffe32033230d8f7a4d23f098d4b742bb (diff)
parent6858de4bf2ba110abc29078194135d971ce71aa5 (diff)
downloadetbsa-trackermap-mobile-70d21d0dab61fc2b30f64721279b27a2c8a01d7a.tar.gz
etbsa-trackermap-mobile-70d21d0dab61fc2b30f64721279b27a2c8a01d7a.tar.bz2
etbsa-trackermap-mobile-70d21d0dab61fc2b30f64721279b27a2c8a01d7a.zip
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
 Conflicts:  androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt  androidApp/src/main/res/values/map_layers.xml
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt26
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt2
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt2
3 files changed, 28 insertions, 2 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt
index 64381d9..ff0489e 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/MapLayer.kt
@@ -5,4 +5,28 @@ data class MapLayer(
val minZoom: Int,
val maxZoom: Int,
val attribution: String
-) \ No newline at end of file
+) {
+ enum class Type {
+ STREETS,
+ SATELLITE
+ }
+
+ companion object {
+ val layers = mapOf(
+ Type.STREETS to MapLayer(
+ url = "https://a.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
+ minZoom = 1,
+ maxZoom = 23,
+ attribution = "&#169; OpenStreetMap France | &#169; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
+ ),
+ Type.SATELLITE to MapLayer(
+ url = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
+ minZoom = 1,
+ maxZoom = 20,
+ attribution = "Tiles &#169; Esri &#8212; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
+ )
+ )
+
+ val defaultLayer = layers[Type.STREETS]!!
+ }
+} \ No newline at end of file
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt
index 237f1a3..2ce4dc6 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/SessionController.kt
@@ -95,7 +95,7 @@ class SessionController(
if (tokens == "null" || !tokens.contains(token)) {
if (tokens == "null") {
attributes["notificationTokens"] = JsonPrimitive(token)
- } else if (tokens.contains(token)) {
+ } else if (!tokens.contains(token)) {
attributes["notificationTokens"] = JsonPrimitive("$tokens,$token")
}
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt
index b1a6444..d4d69fa 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/MapCalculus.kt
@@ -32,6 +32,8 @@ class MapCalculus {
20 -> 533.182395965
21 -> 266.5911979825
22 -> 133.29559899125
+ 23 -> 66.647799495625
+ 24 -> 33.3238997478125
else -> null
}
}