Fix deleteApp loop
This commit is contained in:
parent
342f701afd
commit
857444415e
|
@ -139,9 +139,11 @@ object Distributor {
|
|||
}
|
||||
}
|
||||
|
||||
fun deleteAppFromAppToken(context: Context, appToken: String) {
|
||||
getDb(context).getConnectorToken(appToken)?.let {
|
||||
deleteApp(context, it) {}
|
||||
fun deleteAppFromSSE(context: Context, appToken: String) {
|
||||
val db = getDb(context)
|
||||
db.getConnectorToken(appToken)?.let { connectorToken ->
|
||||
sendUnregistered(context, connectorToken)
|
||||
db.unregisterApp(connectorToken)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import okhttp3.Response
|
|||
import okhttp3.sse.EventSource
|
||||
import okhttp3.sse.EventSourceListener
|
||||
import org.unifiedpush.distributor.nextpush.api.response.SSEResponse
|
||||
import org.unifiedpush.distributor.nextpush.distributor.Distributor.deleteAppFromAppToken
|
||||
import org.unifiedpush.distributor.nextpush.distributor.Distributor.deleteAppFromSSE
|
||||
import org.unifiedpush.distributor.nextpush.distributor.Distributor.sendMessage
|
||||
import org.unifiedpush.distributor.nextpush.utils.TAG
|
||||
import java.lang.Exception
|
||||
|
@ -56,7 +56,7 @@ class SSEListener(val context: Context) : EventSourceListener() {
|
|||
}
|
||||
"deleteApp" -> {
|
||||
val message = Gson().fromJson(data, SSEResponse::class.java)
|
||||
deleteAppFromAppToken(context, message.token)
|
||||
deleteAppFromSSE(context, message.token)
|
||||
}
|
||||
}
|
||||
StartService.wakeLock?.let {
|
||||
|
|
Loading…
Reference in New Issue