Moving use case to check if event is redacted into a dedicated package

This commit is contained in:
Maxime NATUREL 2022-07-18 14:53:44 +02:00
parent 99fc4b4a21
commit 2121ec5739
3 changed files with 10 additions and 10 deletions

View File

@ -24,7 +24,7 @@ import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.services.VectorAndroidService
import im.vector.app.features.location.live.CheckIfLiveLocationShareIsRedactedUseCase
import im.vector.app.features.redaction.CheckIfEventIsRedactedUseCase
import im.vector.app.features.location.live.GetLiveLocationShareSummaryUseCase
import im.vector.app.features.notifications.NotificationUtils
import im.vector.app.features.session.coroutineScope
@ -56,7 +56,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca
@Inject lateinit var locationTracker: LocationTracker
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
@Inject lateinit var getLiveLocationShareSummaryUseCase: GetLiveLocationShareSummaryUseCase
@Inject lateinit var checkIfLiveLocationShareIsRedactedUseCase: CheckIfLiveLocationShareIsRedactedUseCase
@Inject lateinit var checkIfEventIsRedactedUseCase: CheckIfEventIsRedactedUseCase
private val binder = LocalBinder()
@ -214,7 +214,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca
}
private suspend fun isLiveRedacted(roomId: String, beaconEventId: String): Boolean {
return checkIfLiveLocationShareIsRedactedUseCase.execute(roomId = roomId, eventId = beaconEventId)
return checkIfEventIsRedactedUseCase.execute(roomId = roomId, eventId = beaconEventId)
}
private fun launchWithActiveSession(block: suspend CoroutineScope.(Session) -> Unit) =

View File

@ -14,13 +14,13 @@
* limitations under the License.
*/
package im.vector.app.features.location.live
package im.vector.app.features.redaction
import org.matrix.android.sdk.api.session.Session
import timber.log.Timber
import javax.inject.Inject
class CheckIfLiveLocationShareIsRedactedUseCase @Inject constructor(
class CheckIfEventIsRedactedUseCase @Inject constructor(
private val session: Session,
) {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.location.live
package im.vector.app.features.redaction
import im.vector.app.test.fakes.FakeSession
import kotlinx.coroutines.test.runTest
@ -26,11 +26,11 @@ import org.matrix.android.sdk.api.session.events.model.UnsignedData
private const val A_ROOM_ID = "room_id"
private const val AN_EVENT_ID = "event_id"
class CheckIfLiveLocationShareIsRedactedUseCaseTest {
class CheckIfEventIsRedactedUseCaseTest {
private val fakeSession = FakeSession()
private val checkIfLiveLocationShareIsRedactedUseCase = CheckIfLiveLocationShareIsRedactedUseCase(
private val checkIfEventIsRedactedUseCase = CheckIfEventIsRedactedUseCase(
session = fakeSession
)
@ -42,7 +42,7 @@ class CheckIfLiveLocationShareIsRedactedUseCaseTest {
fakeSession.eventService()
.givenGetEventReturns(event)
val result = checkIfLiveLocationShareIsRedactedUseCase.execute(A_ROOM_ID, AN_EVENT_ID)
val result = checkIfEventIsRedactedUseCase.execute(A_ROOM_ID, AN_EVENT_ID)
result shouldBeEqualTo true
}
@ -53,7 +53,7 @@ class CheckIfLiveLocationShareIsRedactedUseCaseTest {
fakeSession.eventService()
.givenGetEventReturns(event)
val result = checkIfLiveLocationShareIsRedactedUseCase.execute(A_ROOM_ID, AN_EVENT_ID)
val result = checkIfEventIsRedactedUseCase.execute(A_ROOM_ID, AN_EVENT_ID)
result shouldBeEqualTo false
}