Add function getServerById to shared module and format code

This commit is contained in:
2020-11-30 12:00:36 +01:00
parent 56c98db0b8
commit 48ee2c3c89
6 changed files with 9 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ object AndroidServerApi {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val serverID = sharedPreferences.getString("school", "0")?.toInt() ?: 0
val server = ServerAPI.Companion.Servers.values()[serverID]
val server = ServerAPI.getServer(serverID)
return instance ?: synchronized(this) {
instance ?: ServerAPI(ServerAPI.createServer(server)).also { instance = it }