aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-20 20:43:14 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-20 20:43:14 -0600
commit7da841d2de9ac0526c3863e85d7d603facabb95c (patch)
tree57f9ad1386fe89d622f4c219d1dc25d0637f5860 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure
parentd3fbda46d35ef58deb8c8965a2c6f937f204d980 (diff)
downloadetbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.tar.gz
etbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.tar.bz2
etbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.zip
Implemented feature to switch to different Traccar servers by URL and removed annoying auto-generated redundant qualifiers
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt
index 606fef0..88aaa26 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt
@@ -17,9 +17,10 @@ import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.util.*
import mx.trackermap.TrackerMap.client.apis.ACCESS_TOKEN_KEY
+import mx.trackermap.TrackerMap.client.apis.SERVER_URL_KEY
import kotlinx.serialization.json.Json as KotlinJson
-open class ApiClient(val baseUrl: String) {
+open class ApiClient() {
companion object {
protected const val ApiContentType = "Content-Type"
protected const val ApiAccept = "Accept"
@@ -58,10 +59,12 @@ open class ApiClient(val baseUrl: String) {
)
}
+ var baseUrl: String = ""
var token: String = ""
init {
val settings = Settings()
+ baseUrl = settings.getString(SERVER_URL_KEY, "")
token = settings.getString(ACCESS_TOKEN_KEY, "")
}