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