Let DefaultNotificationDrawerManager use NotificationDisplayer instead of NotificationManagerCompat
This commit is contained in:
parent
f4f623c417
commit
04e5d684d4
17 changed files with 136 additions and 111 deletions
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright 2023, 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.test.notifications
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import coil3.ImageLoader
|
||||
import coil3.test.FakeImageLoaderEngine
|
||||
import coil3.test.intercept
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
class FakeImageLoader {
|
||||
private val coilRequests = mutableListOf<Any>()
|
||||
|
||||
private var cache: ImageLoader? = null
|
||||
|
||||
fun getImageLoader(): ImageLoader {
|
||||
return cache ?: ImageLoader.Builder(RuntimeEnvironment.getApplication())
|
||||
.components {
|
||||
val engine = FakeImageLoaderEngine.Builder()
|
||||
.intercept(
|
||||
predicate = {
|
||||
coilRequests.add(it)
|
||||
true
|
||||
},
|
||||
drawable = ColorDrawable(Color.BLUE)
|
||||
)
|
||||
.build()
|
||||
add(engine)
|
||||
}
|
||||
.build()
|
||||
.also {
|
||||
cache = it
|
||||
}
|
||||
}
|
||||
|
||||
fun getCoilRequests(): List<Any> {
|
||||
return coilRequests.toList()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.test.notifications
|
||||
|
||||
import coil3.ImageLoader
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.ui.media.ImageLoaderHolder
|
||||
|
||||
class FakeImageLoaderHolder : ImageLoaderHolder {
|
||||
private val fakeImageLoader = FakeImageLoader()
|
||||
override fun get(client: MatrixClient): ImageLoader {
|
||||
return fakeImageLoader.getImageLoader()
|
||||
}
|
||||
|
||||
override fun remove(sessionId: SessionId) {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue