mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 23:58:47 +01:00
Attempt to prevent the deprecated warning/error about Provider usage.
This commit is contained in:
parent
fb05731bb9
commit
ab3f3fba68
@ -71,7 +71,7 @@ class CommonTestHelper(context: Context) {
|
||||
)
|
||||
)
|
||||
}
|
||||
matrix = TestMatrix.getInstance(context)
|
||||
matrix = TestMatrix.getInstance()
|
||||
}
|
||||
|
||||
fun createAccount(userNamePrefix: String, testParams: SessionTestParams): Session {
|
||||
|
@ -105,16 +105,9 @@ internal class TestMatrix constructor(context: Context, matrixConfiguration: Mat
|
||||
}
|
||||
}
|
||||
|
||||
fun getInstance(context: Context): TestMatrix {
|
||||
if (isInit.compareAndSet(false, true)) {
|
||||
val appContext = context.applicationContext
|
||||
if (appContext is MatrixConfiguration.Provider) {
|
||||
val matrixConfiguration = (appContext as MatrixConfiguration.Provider).providesMatrixConfiguration()
|
||||
instance = TestMatrix(appContext, matrixConfiguration)
|
||||
} else {
|
||||
throw IllegalStateException("Matrix is not initialized properly." +
|
||||
" You should call Matrix.initialize or let your application implements MatrixConfiguration.Provider.")
|
||||
}
|
||||
fun getInstance(): TestMatrix {
|
||||
if (isInit.compareAndSet(false, false)) {
|
||||
throw IllegalStateException("Matrix is not initialized properly. You should call TestMatrix.initialize first")
|
||||
}
|
||||
return instance
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user