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

Attempt at fixing lifecycle issues

parent c3fe67f4
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -37,13 +37,10 @@ class BackendServiceConnection : ServiceConnection {
private var bound: Boolean = false
private var binding: Boolean = false
override fun onServiceDisconnected(component: ComponentName?) {
when (component) {
ComponentName(context, QuasselService::class.java) -> {
bound = false
binding = false
backend.onNext(Optional.empty())
}
}
......@@ -54,7 +51,6 @@ class BackendServiceConnection : ServiceConnection {
ComponentName(context, QuasselService::class.java) ->
if (binder is QuasselBinder) {
bound = true
binding = false
backend.onNext(Optional.of(binder.backend))
}
}
......@@ -66,11 +62,8 @@ class BackendServiceConnection : ServiceConnection {
@Synchronized
fun bind(intent: Intent = QuasselService.intent(context!!), flags: Int = 0) {
if (!this.bound && !this.binding) {
this.binding = true
context?.bindService(intent, this, flags)
}
}
fun stop(intent: Intent = QuasselService.intent(context!!)) {
context?.stopService(intent)
......@@ -78,9 +71,6 @@ class BackendServiceConnection : ServiceConnection {
@Synchronized
fun unbind() {
if (this.bound && !this.binding) {
this.binding = true
context?.unbindService(this)
}
if (bound) context?.unbindService(this)
}
}
......@@ -124,9 +124,7 @@ abstract class ServiceBoundActivity : ThemedActivity(),
getBoolean(Keys.Status.reconnect, false)
}
val accountIdValid = accountId != -1L
if (!reconnect || !accountIdValid) {
if (!startedSelection) {
startActivityForResult(AccountSelectionActivity.intent(this), REQUEST_SELECT_ACCOUNT)
startedSelection = true
......@@ -145,8 +143,6 @@ abstract class ServiceBoundActivity : ThemedActivity(),
if (resultCode == Activity.RESULT_CANCELED) {
finish()
} else {
checkConnection()
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment