From 1366da35eb569a9b1efdf7252adbcfbede7e32d6 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Thu, 20 Jan 2022 21:57:54 -0600 Subject: Fallback ApiClient to default URL, so pre-URL-switch-capable apps don't fail at login --- .../java/mx/trackermap/TrackerMap/android/TrackerApp.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'androidApp/src/main/java') diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/TrackerApp.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/TrackerApp.kt index 2901dbb..c21cfe1 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/TrackerApp.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/TrackerApp.kt @@ -1,6 +1,7 @@ package mx.trackermap.TrackerMap.android import android.app.Application +import androidx.preference.PreferenceManager import kotlinx.coroutines.DelicateCoroutinesApi import mx.trackermap.TrackerMap.android.details.commands.UnitCommandsViewModel import mx.trackermap.TrackerMap.android.details.information.UnitInformationViewModel @@ -29,13 +30,14 @@ open class TrackerApp : Application() { super.onCreate() val appModule = module { - factory { SessionApi() } - factory { UsersApi() } - factory { DevicesApi() } - factory { PositionsApi() } - factory { CommandsApi() } - factory { ReportsApi() } - factory { GeofencesApi() } + single { getString(R.string.default_server_url) } + factory { SessionApi(get()) } + factory { UsersApi(get()) } + factory { DevicesApi(get()) } + factory { PositionsApi(get()) } + factory { CommandsApi(get()) } + factory { ReportsApi(get()) } + factory { GeofencesApi(get()) } factory { SessionController(get(), get()) } factory { UnitsController(get(), get()) } -- cgit v1.2.3