Close MatrixClient after usage
This commit is contained in:
parent
b9276aa60b
commit
dae0cae8bb
2 changed files with 10 additions and 9 deletions
|
|
@ -77,10 +77,9 @@ class PushersManager @Inject constructor(
|
||||||
sessionStore.getAllSessions().toUserList().forEach { userId ->
|
sessionStore.getAllSessions().toUserList().forEach { userId ->
|
||||||
val userDataStore = userPushStoreFactory.create(userId)
|
val userDataStore = userPushStoreFactory.create(userId)
|
||||||
if (userDataStore.isFirebase()) {
|
if (userDataStore.isFirebase()) {
|
||||||
val client = matrixAuthenticationService.restoreSession(SessionId(userId)).getOrNull()
|
matrixAuthenticationService.restoreSession(SessionId(userId)).getOrNull()?.use { client ->
|
||||||
client ?: return@forEach
|
registerPusher(client, firebaseToken, PushConfig.pusher_http_url)
|
||||||
registerPusher(client, firebaseToken, PushConfig.pusher_http_url)
|
}
|
||||||
// TODO EAx Close sessions
|
|
||||||
} else {
|
} else {
|
||||||
Timber.d("This session is not using Firebase pusher")
|
Timber.d("This session is not using Firebase pusher")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,11 +141,13 @@ class PushHandler @Inject constructor(
|
||||||
// Restore session
|
// Restore session
|
||||||
val session = matrixAuthenticationService.restoreSession(SessionId(userId)).getOrNull() ?: return
|
val session = matrixAuthenticationService.restoreSession(SessionId(userId)).getOrNull() ?: return
|
||||||
// TODO EAx, no need for a session?
|
// TODO EAx, no need for a session?
|
||||||
val notificationData = session.notificationService().getNotification(
|
val notificationData = session.use {
|
||||||
userId = userId,
|
it.notificationService().getNotification(
|
||||||
roomId = pushData.roomId,
|
userId = userId,
|
||||||
eventId = pushData.eventId,
|
roomId = pushData.roomId,
|
||||||
)
|
eventId = pushData.eventId,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO Remove
|
// TODO Remove
|
||||||
Timber.w("Notification: $notificationData")
|
Timber.w("Notification: $notificationData")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue