Improve logs.
This commit is contained in:
parent
0c0f7dff40
commit
2696348d46
1 changed files with 7 additions and 3 deletions
|
|
@ -16,12 +16,14 @@
|
||||||
|
|
||||||
package io.element.android.libraries.push.impl
|
package io.element.android.libraries.push.impl
|
||||||
|
|
||||||
|
import io.element.android.libraries.core.log.logger.LoggerTag
|
||||||
import io.element.android.libraries.matrix.api.MatrixClient
|
import io.element.android.libraries.matrix.api.MatrixClient
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
import io.element.android.libraries.matrix.api.core.SessionId
|
import io.element.android.libraries.matrix.api.core.SessionId
|
||||||
import io.element.android.libraries.matrix.api.pusher.SetHttpPusherData
|
import io.element.android.libraries.matrix.api.pusher.SetHttpPusherData
|
||||||
import io.element.android.libraries.push.impl.clientsecret.PushClientSecret
|
import io.element.android.libraries.push.impl.clientsecret.PushClientSecret
|
||||||
import io.element.android.libraries.push.impl.config.PushConfig
|
import io.element.android.libraries.push.impl.config.PushConfig
|
||||||
|
import io.element.android.libraries.push.impl.log.pushLoggerTag
|
||||||
import io.element.android.libraries.push.impl.pushgateway.PushGatewayNotifyRequest
|
import io.element.android.libraries.push.impl.pushgateway.PushGatewayNotifyRequest
|
||||||
import io.element.android.libraries.push.impl.userpushstore.UserPushStoreFactory
|
import io.element.android.libraries.push.impl.userpushstore.UserPushStoreFactory
|
||||||
import io.element.android.libraries.push.impl.userpushstore.isFirebase
|
import io.element.android.libraries.push.impl.userpushstore.isFirebase
|
||||||
|
|
@ -33,6 +35,8 @@ import javax.inject.Inject
|
||||||
|
|
||||||
internal const val DEFAULT_PUSHER_FILE_TAG = "mobile"
|
internal const val DEFAULT_PUSHER_FILE_TAG = "mobile"
|
||||||
|
|
||||||
|
private val loggerTag = LoggerTag("PushersManager", pushLoggerTag)
|
||||||
|
|
||||||
// TODO EAx Communicate with the SDK
|
// TODO EAx Communicate with the SDK
|
||||||
class PushersManager @Inject constructor(
|
class PushersManager @Inject constructor(
|
||||||
private val unifiedPushHelper: UnifiedPushHelper,
|
private val unifiedPushHelper: UnifiedPushHelper,
|
||||||
|
|
@ -81,7 +85,7 @@ class PushersManager @Inject constructor(
|
||||||
registerPusher(client, firebaseToken, PushConfig.pusher_http_url)
|
registerPusher(client, firebaseToken, PushConfig.pusher_http_url)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Timber.d("This session is not using Firebase pusher")
|
Timber.tag(loggerTag.value).d("This session is not using Firebase pusher")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +96,7 @@ class PushersManager @Inject constructor(
|
||||||
suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
||||||
val userDataStore = userPushStoreFactory.create(matrixClient.sessionId.value)
|
val userDataStore = userPushStoreFactory.create(matrixClient.sessionId.value)
|
||||||
if (userDataStore.getCurrentRegisteredPushKey() == pushKey) {
|
if (userDataStore.getCurrentRegisteredPushKey() == pushKey) {
|
||||||
Timber.d("Unnecessary to register again the same pusher")
|
Timber.tag(loggerTag.value).d("Unnecessary to register again the same pusher")
|
||||||
} else {
|
} else {
|
||||||
// Register the pusher to the server
|
// Register the pusher to the server
|
||||||
matrixClient.pushersService().setHttpPusher(
|
matrixClient.pushersService().setHttpPusher(
|
||||||
|
|
@ -102,7 +106,7 @@ class PushersManager @Inject constructor(
|
||||||
userDataStore.setCurrentRegisteredPushKey(pushKey)
|
userDataStore.setCurrentRegisteredPushKey(pushKey)
|
||||||
},
|
},
|
||||||
{ throwable ->
|
{ throwable ->
|
||||||
Timber.e(throwable, "Unable to register the pusher")
|
Timber.tag(loggerTag.value).e(throwable, "Unable to register the pusher")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue