Cleanup and fix test compilation

This commit is contained in:
Benoit Marty 2021-01-20 16:32:41 +01:00
parent 4709002429
commit c75eb050df
5 changed files with 6 additions and 7 deletions

View file

@ -378,7 +378,9 @@ class CommonTestHelper(context: Context) {
fun Iterable<Session>.signOutAndClose() = forEach { signOutAndClose(it) }
fun signOutAndClose(session: Session) {
doSync<Unit>(60_000) { session.signOut(true, it) }
runBlockingTest(timeout = 60_000) {
session.signOut(true)
}
// no need signout will close
// session.close()
}

View file

@ -66,8 +66,8 @@ class TimelineForwardPaginationTest : InstrumentedTest {
numberOfMessagesToSend)
// Alice clear the cache
commonTestHelper.doSync<Unit> {
aliceSession.clearCache(it)
commonTestHelper.runBlockingTest {
aliceSession.clearCache()
}
// And restarts the sync

View file

@ -20,7 +20,6 @@ import androidx.annotation.MainThread
import dagger.Lazy
import io.realm.RealmConfiguration
import okhttp3.OkHttpClient
import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.api.failure.GlobalError
import org.matrix.android.sdk.api.pushrules.PushRuleService

View file

@ -175,12 +175,10 @@ class MainActivity : VectorBaseActivity<FragmentLoadingBinding>(), UnlockedActiv
emptyViewModel.viewModelScope.launch {
try {
session.clearCache()
Timber.e("CACHE success")
doLocalCleanup(clearPreferences = false)
session.startSyncing(applicationContext)
startNextActivityAndFinish()
} catch (failure: Throwable) {
Timber.e("CACHE failure")
displayError(failure)
}
}

View file

@ -151,7 +151,7 @@ class LinkHandlerActivity : VectorBaseActivity<ActivityProgressBinding>() {
private fun safeSignout(uri: Uri) {
val session = sessionHolder.getSafeActiveSession()
if(session == null) {
if (session == null) {
// Should not happen
startLoginActivity(uri)
} else {