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
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,8 @@ class QuasselService : LifecycleService() { ...@@ -83,6 +83,8 @@ class QuasselService : LifecycleService() {
override fun disconnect(forever: Boolean) { override fun disconnect(forever: Boolean) {
handler.post { handler.post {
backendImplementation.disconnect(forever) backendImplementation.disconnect(forever)
if (forever)
stopSelf()
} }
} }
......
...@@ -144,7 +144,6 @@ class ChatActivity : ServiceBoundActivity() { ...@@ -144,7 +144,6 @@ class ChatActivity : ServiceBoundActivity() {
putBoolean(Keys.Status.reconnect, false) putBoolean(Keys.Status.reconnect, false)
} }
backend.value?.disconnect(true) backend.value?.disconnect(true)
stopService()
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
finish() finish()
} }
......
...@@ -10,13 +10,11 @@ import de.kuschku.libquassel.session.Backend ...@@ -10,13 +10,11 @@ import de.kuschku.libquassel.session.Backend
import de.kuschku.quasseldroid_ng.service.QuasselService import de.kuschku.quasseldroid_ng.service.QuasselService
class BackendServiceConnection : ServiceConnection { class BackendServiceConnection : ServiceConnection {
var bound = false
val backend = MutableLiveData<Backend?>() val backend = MutableLiveData<Backend?>()
var context: Context? = null var context: Context? = null
override fun onServiceDisconnected(component: ComponentName?) { override fun onServiceDisconnected(component: ComponentName?) {
bound = false
when (component) { when (component) {
ComponentName(context, QuasselService::class.java) -> { ComponentName(context, QuasselService::class.java) -> {
backend.value = null backend.value = null
...@@ -25,7 +23,6 @@ class BackendServiceConnection : ServiceConnection { ...@@ -25,7 +23,6 @@ class BackendServiceConnection : ServiceConnection {
} }
override fun onServiceConnected(component: ComponentName?, binder: IBinder?) { override fun onServiceConnected(component: ComponentName?, binder: IBinder?) {
bound = true
when (component) { when (component) {
ComponentName(context, QuasselService::class.java) -> ComponentName(context, QuasselService::class.java) ->
if (binder is QuasselService.QuasselBinder) { if (binder is QuasselService.QuasselBinder) {
...@@ -47,6 +44,6 @@ class BackendServiceConnection : ServiceConnection { ...@@ -47,6 +44,6 @@ class BackendServiceConnection : ServiceConnection {
} }
fun unbind() { 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