aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-26 23:16:11 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-26 23:16:11 -0600
commitfeba14e1858aaf3fad2673b362f4c6b91bad83eb (patch)
treea11b350e04e304c95a05389dadb62a273bf638fd /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client
parente369918a12347884898d7c3e9bebf92731db55d5 (diff)
downloadetbsa-trackermap-mobile-feba14e1858aaf3fad2673b362f4c6b91bad83eb.tar.gz
etbsa-trackermap-mobile-feba14e1858aaf3fad2673b362f4c6b91bad83eb.tar.bz2
etbsa-trackermap-mobile-feba14e1858aaf3fad2673b362f4c6b91bad83eb.zip
Implemented dependency injection with Swift property wrappers
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt3
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/SessionManager.kt3
18 files changed, 36 insertions, 18 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt
index c324f4c..1da9831 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Attribute
import mx.trackermap.TrackerMap.client.infrastructure.*
-class AttributesApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class AttributesApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Attributes
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt
index 7a9bd38..c666dc3 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Calendar
import mx.trackermap.TrackerMap.client.infrastructure.*
-class CalendarsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class CalendarsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Calendars
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt
index ffdb699..eb1718c 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt
@@ -11,12 +11,13 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Command
import mx.trackermap.TrackerMap.client.models.CommandType
import mx.trackermap.TrackerMap.client.infrastructure.*
-class CommandsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class CommandsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Saved Commands
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
index eff69bd..8b839aa 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
@@ -11,12 +11,13 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Device
import mx.trackermap.TrackerMap.client.models.DeviceAccumulators
import mx.trackermap.TrackerMap.client.infrastructure.*
-class DevicesApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class DevicesApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Devices
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt
index f050bbe..bff61c2 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Driver
import mx.trackermap.TrackerMap.client.infrastructure.*
-class DriversApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class DriversApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Drivers
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt
index 572fdd0..87f8dce 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Event
import mx.trackermap.TrackerMap.client.infrastructure.*
-class EventsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class EventsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
*
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt
index 25996fe..049aee9 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Geofence
import mx.trackermap.TrackerMap.client.infrastructure.*
-class GeofencesApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class GeofencesApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Geofences
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt
index 032b7fc..07b3b05 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Group
import mx.trackermap.TrackerMap.client.infrastructure.*
-class GroupsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class GroupsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Groups
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt
index 6dd10ec..e28a728 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Maintenance
import mx.trackermap.TrackerMap.client.infrastructure.*
-class MaintenanceApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class MaintenanceApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Maintenance
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt
index c27a532..f311fdb 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt
@@ -11,12 +11,13 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Notification
import mx.trackermap.TrackerMap.client.models.NotificationType
import mx.trackermap.TrackerMap.client.infrastructure.*
-class NotificationsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class NotificationsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Notifications
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt
index 0fb7651..76fd4a8 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Permission
import mx.trackermap.TrackerMap.client.infrastructure.*
-class PermissionsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class PermissionsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Unlink an Object from another Object
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt
index 3373448..6ad74cb 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Position
import mx.trackermap.TrackerMap.client.infrastructure.*
-class PositionsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class PositionsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetches a list of Positions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt
index 67bff68..64ef8ea 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt
@@ -13,6 +13,7 @@ package mx.trackermap.TrackerMap.client.apis
import io.ktor.content.*
import kotlinx.datetime.LocalDateTime
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Event
import mx.trackermap.TrackerMap.client.models.Position
import mx.trackermap.TrackerMap.client.models.Stop
@@ -21,7 +22,7 @@ import mx.trackermap.TrackerMap.client.models.ReportTrips
import mx.trackermap.TrackerMap.client.infrastructure.*
-class ReportsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class ReportsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Events within the time period for the Devices or Groups
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt
index ea7b911..5672543 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Server
import mx.trackermap.TrackerMap.client.infrastructure.*
-class ServerApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class ServerApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch Server information
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt
index 6d9dbea..a22d2d9 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt
@@ -11,10 +11,11 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.User
import mx.trackermap.TrackerMap.client.infrastructure.*
-class SessionApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class SessionApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Close the Session
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt
index 1c7c5f5..0b9c766 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt
@@ -12,11 +12,12 @@
package mx.trackermap.TrackerMap.client.apis
import kotlinx.datetime.LocalDateTime
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.Statistics
import mx.trackermap.TrackerMap.client.infrastructure.*
-class StatisticsApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class StatisticsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch server Statistics
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt
index 21e4bd3..90dd9f6 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt
@@ -11,11 +11,12 @@
*/
package mx.trackermap.TrackerMap.client.apis
+import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.models.User
import mx.trackermap.TrackerMap.client.infrastructure.*
-class UsersApi(sessionManager: SessionManager) : ApiClient(sessionManager) {
+class UsersApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable {
/**
* Fetch a list of Users
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/SessionManager.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/SessionManager.kt
index 6287b0c..caf2da1 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/SessionManager.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/SessionManager.kt
@@ -3,10 +3,11 @@ package mx.trackermap.TrackerMap.client.infrastructure
import com.russhwolf.settings.Settings
import com.russhwolf.settings.get
import com.russhwolf.settings.set
+import mx.trackermap.TrackerMap.Injectable
class SessionManager(
private val defaultBaseUrl: String
-) {
+): Injectable {
companion object {
const val SERVER_URL_KEY = "server_url"