mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-24 16:51:07 +01:00
using entry point instead of manually fetching fields from application
This commit is contained in:
parent
5c994ebfdd
commit
cfe5a4d212
@ -21,6 +21,8 @@ import androidx.datastore.core.DataStore
|
||||
import androidx.datastore.preferences.core.Preferences
|
||||
import androidx.datastore.preferences.core.edit
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import dagger.hilt.EntryPoints
|
||||
import im.vector.app.core.di.SingletonEntryPoint
|
||||
import im.vector.app.features.analytics.store.AnalyticsStore
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.rules.TestWatcher
|
||||
@ -39,10 +41,11 @@ class ClearCurrentSessionRule : TestWatcher() {
|
||||
runBlocking {
|
||||
reflectAnalyticDatastore(context).edit { it.clear() }
|
||||
runCatching {
|
||||
val holder = (context.applicationContext as VectorApplication).activeSessionHolder
|
||||
holder.getSafeActiveSession()?.signOutService()?.signOut(true)
|
||||
(context.applicationContext as VectorApplication).vectorPreferences.clearPreferences()
|
||||
holder.clearActiveSession()
|
||||
val entryPoint = EntryPoints.get(context.applicationContext, SingletonEntryPoint::class.java)
|
||||
val sessionHolder = entryPoint.activeSessionHolder()
|
||||
sessionHolder.getSafeActiveSession()?.signOutService()?.signOut(true)
|
||||
entryPoint.vectorPreferences().clearPreferences()
|
||||
sessionHolder.clearActiveSession()
|
||||
}
|
||||
}
|
||||
return super.apply(base, description)
|
||||
|
Loading…
Reference in New Issue
Block a user