Moving use case to check if event is redacted into a dedicated package
This commit is contained in:
parent
99fc4b4a21
commit
2121ec5739
@ -24,7 +24,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.services.VectorAndroidService
|
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.location.live.GetLiveLocationShareSummaryUseCase
|
||||||
import im.vector.app.features.notifications.NotificationUtils
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
import im.vector.app.features.session.coroutineScope
|
import im.vector.app.features.session.coroutineScope
|
||||||
@ -56,7 +56,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca
|
|||||||
@Inject lateinit var locationTracker: LocationTracker
|
@Inject lateinit var locationTracker: LocationTracker
|
||||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||||
@Inject lateinit var getLiveLocationShareSummaryUseCase: GetLiveLocationShareSummaryUseCase
|
@Inject lateinit var getLiveLocationShareSummaryUseCase: GetLiveLocationShareSummaryUseCase
|
||||||
@Inject lateinit var checkIfLiveLocationShareIsRedactedUseCase: CheckIfLiveLocationShareIsRedactedUseCase
|
@Inject lateinit var checkIfEventIsRedactedUseCase: CheckIfEventIsRedactedUseCase
|
||||||
|
|
||||||
private val binder = LocalBinder()
|
private val binder = LocalBinder()
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class LocationSharingAndroidService : VectorAndroidService(), LocationTracker.Ca
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun isLiveRedacted(roomId: String, beaconEventId: String): Boolean {
|
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) =
|
private fun launchWithActiveSession(block: suspend CoroutineScope.(Session) -> Unit) =
|
||||||
|
|||||||
@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* 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 org.matrix.android.sdk.api.session.Session
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class CheckIfLiveLocationShareIsRedactedUseCase @Inject constructor(
|
class CheckIfEventIsRedactedUseCase @Inject constructor(
|
||||||
private val session: Session,
|
private val session: Session,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* 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 im.vector.app.test.fakes.FakeSession
|
||||||
import kotlinx.coroutines.test.runTest
|
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 A_ROOM_ID = "room_id"
|
||||||
private const val AN_EVENT_ID = "event_id"
|
private const val AN_EVENT_ID = "event_id"
|
||||||
|
|
||||||
class CheckIfLiveLocationShareIsRedactedUseCaseTest {
|
class CheckIfEventIsRedactedUseCaseTest {
|
||||||
|
|
||||||
private val fakeSession = FakeSession()
|
private val fakeSession = FakeSession()
|
||||||
|
|
||||||
private val checkIfLiveLocationShareIsRedactedUseCase = CheckIfLiveLocationShareIsRedactedUseCase(
|
private val checkIfEventIsRedactedUseCase = CheckIfEventIsRedactedUseCase(
|
||||||
session = fakeSession
|
session = fakeSession
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class CheckIfLiveLocationShareIsRedactedUseCaseTest {
|
|||||||
fakeSession.eventService()
|
fakeSession.eventService()
|
||||||
.givenGetEventReturns(event)
|
.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
|
result shouldBeEqualTo true
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ class CheckIfLiveLocationShareIsRedactedUseCaseTest {
|
|||||||
fakeSession.eventService()
|
fakeSession.eventService()
|
||||||
.givenGetEventReturns(event)
|
.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
|
result shouldBeEqualTo false
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user