Always use applicationContext for Api

This commit is contained in:
sim 2023-08-31 01:38:33 +02:00
parent d293129df5
commit ded36d2e6e
1 changed files with 3 additions and 2 deletions

View File

@ -20,9 +20,10 @@ import org.unifiedpush.distributor.nextpush.api.response.ApiResponse
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.atomic.AtomicReference
class Api(val context: Context) { class Api(context: Context) {
private val TAG = Api::class.java.simpleName private val TAG = Api::class.java.simpleName
private val context = context.applicationContext
private val baseUrl: String private val baseUrl: String
get() = getAccount(context)?.url ?: "http://0.0.0.0/" get() = getAccount(context)?.url ?: "http://0.0.0.0/"
@ -94,7 +95,7 @@ class Api(val context: Context) {
syncSource.set( syncSource.set(
EventSources.createFactory(client).newEventSource( EventSources.createFactory(client).newEventSource(
request, request,
SSEListener(context.applicationContext) SSEListener(context)
) )
) )
Log.d(TAG, "cSync done.") Log.d(TAG, "cSync done.")