Skip to content
Snippets Groups Projects
Commit 95e2fc12 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed an issue where the app would hang

parent 909e3e7a
Branches
Tags
No related merge requests found
......@@ -83,6 +83,8 @@ class QuasselService : LifecycleService() {
override fun disconnect(forever: Boolean) {
handler.post {
backendImplementation.disconnect(forever)
if (forever)
stopSelf()
}
}
......
......@@ -144,7 +144,6 @@ class ChatActivity : ServiceBoundActivity() {
putBoolean(Keys.Status.reconnect, false)
}
backend.value?.disconnect(true)
stopService()
setResult(Activity.RESULT_OK)
finish()
}
......
......@@ -10,13 +10,11 @@ import de.kuschku.libquassel.session.Backend
import de.kuschku.quasseldroid_ng.service.QuasselService
class BackendServiceConnection : ServiceConnection {
var bound = false
val backend = MutableLiveData<Backend?>()
var context: Context? = null
override fun onServiceDisconnected(component: ComponentName?) {
bound = false
when (component) {
ComponentName(context, QuasselService::class.java) -> {
backend.value = null
......@@ -25,7 +23,6 @@ class BackendServiceConnection : ServiceConnection {
}
override fun onServiceConnected(component: ComponentName?, binder: IBinder?) {
bound = true
when (component) {
ComponentName(context, QuasselService::class.java) ->
if (binder is QuasselService.QuasselBinder) {
......@@ -47,6 +44,6 @@ class BackendServiceConnection : ServiceConnection {
}
fun unbind() {
if (bound) context?.unbindService(this)
context?.unbindService(this)
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment