Remove some unused code
This commit is contained in:
parent
dbe3d221e4
commit
e0c8f0aeb6
3 changed files with 0 additions and 23 deletions
|
@ -8,7 +8,6 @@ import androidx.lifecycle.ViewModel
|
|||
import androidx.lifecycle.viewModelScope
|
||||
import dev.jdtech.jellyfin.api.JellyfinApi
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jellyfin.sdk.api.client.exception.ApiClientException
|
||||
import java.lang.Exception
|
||||
|
||||
class AddServerViewModel(val application: Application) : ViewModel() {
|
||||
|
|
|
@ -12,7 +12,6 @@ import dev.jdtech.jellyfin.database.ServerDatabase
|
|||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jellyfin.sdk.api.client.exception.ApiClientException
|
||||
import org.jellyfin.sdk.model.api.AuthenticateUserByName
|
||||
import java.lang.Exception
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import dev.jdtech.jellyfin.database.ServerDatabaseDao
|
|||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.util.*
|
||||
|
||||
class ServerSelectViewModel(
|
||||
val database: ServerDatabaseDao,
|
||||
|
@ -19,35 +18,15 @@ class ServerSelectViewModel(
|
|||
val servers: LiveData<List<Server>>
|
||||
get() = _servers
|
||||
|
||||
init {
|
||||
val demoServer = Server(UUID.randomUUID().toString(), "Demo", "https://demo.jellyfin.org", "0", "demo", "")
|
||||
|
||||
viewModelScope.launch {
|
||||
insert(demoServer)
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteServer(server: Server) {
|
||||
viewModelScope.launch {
|
||||
delete(server)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun insert(server: Server) {
|
||||
withContext(Dispatchers.IO) {
|
||||
database.insert(server)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun delete(server: Server) {
|
||||
withContext(Dispatchers.IO) {
|
||||
database.delete(server.id)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun clearDatabase() {
|
||||
withContext(Dispatchers.IO) {
|
||||
database.clear()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue