Use server info repo in ViewModel

This commit is contained in:
Kirill Kamakin
2022-10-29 19:19:20 +02:00
parent cda22215ec
commit b2ff374cef
3 changed files with 10 additions and 3 deletions

View File

@@ -7,5 +7,7 @@ interface ServerInfoRepo {
suspend fun requireUrl(): String
suspend fun getVersion(): ServerVersion
suspend fun storeBaseURL(baseURL: String, version: String)
}

View File

@@ -44,4 +44,9 @@ class ServerInfoRepoImpl @Inject constructor(
version.startsWith("v1") -> ServerVersion.V1
else -> throw NetworkError.NotMealie(IllegalStateException("Server version is unknown: $version"))
}
override suspend fun storeBaseURL(baseURL: String, version: String) {
logger.v { "storeBaseURL() called with: baseURL = $baseURL, version = $version" }
serverInfoStorage.storeBaseURL(baseURL, version)
}
}