Add default implementation to SessionListener
This commit is contained in:
committed by
Benoit Marty
parent
44e125dbc7
commit
66d8e6210d
@@ -33,7 +33,6 @@ class DefaultSeenInvitesStore(
|
||||
) : SeenInvitesStore {
|
||||
init {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
if (sessionId.value == userId) {
|
||||
clear()
|
||||
|
||||
@@ -77,8 +77,6 @@ class DefaultLockScreenService(
|
||||
*/
|
||||
private fun observeSessionsState() {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
// TODO handle multi session at some point
|
||||
pinCodeManager.deletePinCode()
|
||||
|
||||
@@ -35,8 +35,6 @@ class DefaultImageLoaderHolder(
|
||||
|
||||
private fun observeSessions() {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
remove(SessionId(userId))
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ class DefaultSessionPreferencesStoreFactory(
|
||||
|
||||
init {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
val sessionPreferences = cache.remove(SessionId(userId))
|
||||
sessionPreferences?.clear()
|
||||
|
||||
@@ -108,10 +108,6 @@ class DefaultPushService(
|
||||
sessionObserver.addListener(this)
|
||||
}
|
||||
|
||||
override suspend fun onSessionCreated(userId: String) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
/**
|
||||
* The session has been deleted.
|
||||
* In this case, this is not necessary to unregister the pusher from the homeserver,
|
||||
|
||||
@@ -59,8 +59,6 @@ class DefaultNotificationConversationService(
|
||||
|
||||
init {
|
||||
sessionObserver.addListener(object : SessionListener {
|
||||
override suspend fun onSessionCreated(userId: String) = Unit
|
||||
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
onSessionLogOut(SessionId(userId))
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
package io.element.android.libraries.sessionstorage.api.observer
|
||||
|
||||
interface SessionListener {
|
||||
suspend fun onSessionCreated(userId: String)
|
||||
suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean)
|
||||
suspend fun onSessionCreated(userId: String) = Unit
|
||||
suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) = Unit
|
||||
}
|
||||
|
||||
@@ -75,10 +75,6 @@ class DefaultAnalyticsService(
|
||||
analyticsStore.setAnalyticsId(analyticsId)
|
||||
}
|
||||
|
||||
override suspend fun onSessionCreated(userId: String) {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
override suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {
|
||||
// Delete the store when the last session is deleted
|
||||
if (sessionStore.getAllSessions().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user