Moving recently created use cases inside v2 package

This commit is contained in:
Maxime NATUREL 2022-09-05 16:01:22 +02:00
parent 712d39b9dd
commit 39a0b3b1ba
9 changed files with 13 additions and 13 deletions

View File

@ -34,6 +34,7 @@ import im.vector.app.core.resources.StringProvider
import im.vector.app.core.utils.PublishDataSource
import im.vector.app.features.auth.ReAuthActivity
import im.vector.app.features.login.ReAuthHelper
import im.vector.app.features.settings.devices.v2.GetEncryptionTrustLevelForDeviceUseCase
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
import im.vector.lib.core.utils.flow.throttleFirst
import kotlinx.coroutines.Dispatchers

View File

@ -17,7 +17,6 @@
package im.vector.app.features.settings.devices.v2
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.features.settings.devices.GetEncryptionTrustLevelForDeviceUseCase
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
import javax.inject.Inject

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import im.vector.app.features.settings.devices.v2.CurrentSessionCrossSigningInfo
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import org.matrix.android.sdk.api.session.crypto.crosssigning.DeviceTrustLevel
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel

View File

@ -19,8 +19,8 @@ package im.vector.app.features.settings.devices.v2.overview
import androidx.lifecycle.asFlow
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.GetCurrentSessionCrossSigningInfoUseCase
import im.vector.app.features.settings.devices.GetEncryptionTrustLevelForDeviceUseCase
import im.vector.app.features.settings.devices.v2.GetCurrentSessionCrossSigningInfoUseCase
import im.vector.app.features.settings.devices.v2.GetEncryptionTrustLevelForDeviceUseCase
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
@ -29,6 +29,7 @@ import org.matrix.android.sdk.api.util.Optional
import org.matrix.android.sdk.api.util.toOptional
import javax.inject.Inject
// TODO update unit tests
class GetDeviceFullInfoUseCase @Inject constructor(
private val activeSessionHolder: ActiveSessionHolder,
private val getCurrentSessionCrossSigningInfoUseCase: GetCurrentSessionCrossSigningInfoUseCase,
@ -38,11 +39,11 @@ class GetDeviceFullInfoUseCase @Inject constructor(
fun execute(deviceId: String): Flow<Optional<DeviceFullInfo>> {
return activeSessionHolder.getSafeActiveSession()?.let { session ->
val currentSessionCrossSigningInfo = getCurrentSessionCrossSigningInfoUseCase.execute()
combine(
getCurrentSessionCrossSigningInfoUseCase.execute(),
session.cryptoService().getMyDevicesInfoLive(deviceId).asFlow(),
session.cryptoService().getLiveCryptoDeviceInfoWithId(deviceId).asFlow()
) { deviceInfo, cryptoDeviceInfo ->
) { currentSessionCrossSigningInfo, deviceInfo, cryptoDeviceInfo ->
val info = deviceInfo.getOrNull()
val cryptoInfo = cryptoDeviceInfo.getOrNull()
val fullInfo = if (info != null && cryptoInfo != null) {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import im.vector.app.features.settings.devices.v2.CurrentSessionCrossSigningInfo
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
@ -91,7 +90,7 @@ class GetEncryptionTrustLevelForDeviceUseCaseTest {
}
private fun givenCurrentSessionCrossSigningInfo(
deviceId: String?,
deviceId: String,
isCrossSigningInitialized: Boolean,
isCrossSigningVerified: Boolean
): CurrentSessionCrossSigningInfo {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package im.vector.app.features.settings.devices
package im.vector.app.features.settings.devices.v2
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test