mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Moving recently created use cases inside v2 package
This commit is contained in:
parent
3a73e72b16
commit
fa1ef06952
9 changed files with 13 additions and 13 deletions
|
@ -34,6 +34,7 @@ import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.utils.PublishDataSource
|
import im.vector.app.core.utils.PublishDataSource
|
||||||
import im.vector.app.features.auth.ReAuthActivity
|
import im.vector.app.features.auth.ReAuthActivity
|
||||||
import im.vector.app.features.login.ReAuthHelper
|
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.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
||||||
import im.vector.lib.core.utils.flow.throttleFirst
|
import im.vector.lib.core.utils.flow.throttleFirst
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package im.vector.app.features.settings.devices.v2
|
package im.vector.app.features.settings.devices.v2
|
||||||
|
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
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 im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* 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 org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* 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 im.vector.app.features.settings.devices.v2.CurrentSessionCrossSigningInfo
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
|
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* 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.crosssigning.DeviceTrustLevel
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
|
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
|
|
@ -19,8 +19,8 @@ package im.vector.app.features.settings.devices.v2.overview
|
||||||
import androidx.lifecycle.asFlow
|
import androidx.lifecycle.asFlow
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
|
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
|
||||||
import im.vector.app.features.settings.devices.GetCurrentSessionCrossSigningInfoUseCase
|
import im.vector.app.features.settings.devices.v2.GetCurrentSessionCrossSigningInfoUseCase
|
||||||
import im.vector.app.features.settings.devices.GetEncryptionTrustLevelForDeviceUseCase
|
import im.vector.app.features.settings.devices.v2.GetEncryptionTrustLevelForDeviceUseCase
|
||||||
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.combine
|
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 org.matrix.android.sdk.api.util.toOptional
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
// TODO update unit tests
|
||||||
class GetDeviceFullInfoUseCase @Inject constructor(
|
class GetDeviceFullInfoUseCase @Inject constructor(
|
||||||
private val activeSessionHolder: ActiveSessionHolder,
|
private val activeSessionHolder: ActiveSessionHolder,
|
||||||
private val getCurrentSessionCrossSigningInfoUseCase: GetCurrentSessionCrossSigningInfoUseCase,
|
private val getCurrentSessionCrossSigningInfoUseCase: GetCurrentSessionCrossSigningInfoUseCase,
|
||||||
|
@ -38,11 +39,11 @@ class GetDeviceFullInfoUseCase @Inject constructor(
|
||||||
|
|
||||||
fun execute(deviceId: String): Flow<Optional<DeviceFullInfo>> {
|
fun execute(deviceId: String): Flow<Optional<DeviceFullInfo>> {
|
||||||
return activeSessionHolder.getSafeActiveSession()?.let { session ->
|
return activeSessionHolder.getSafeActiveSession()?.let { session ->
|
||||||
val currentSessionCrossSigningInfo = getCurrentSessionCrossSigningInfoUseCase.execute()
|
|
||||||
combine(
|
combine(
|
||||||
|
getCurrentSessionCrossSigningInfoUseCase.execute(),
|
||||||
session.cryptoService().getMyDevicesInfoLive(deviceId).asFlow(),
|
session.cryptoService().getMyDevicesInfoLive(deviceId).asFlow(),
|
||||||
session.cryptoService().getLiveCryptoDeviceInfoWithId(deviceId).asFlow()
|
session.cryptoService().getLiveCryptoDeviceInfoWithId(deviceId).asFlow()
|
||||||
) { deviceInfo, cryptoDeviceInfo ->
|
) { currentSessionCrossSigningInfo, deviceInfo, cryptoDeviceInfo ->
|
||||||
val info = deviceInfo.getOrNull()
|
val info = deviceInfo.getOrNull()
|
||||||
val cryptoInfo = cryptoDeviceInfo.getOrNull()
|
val cryptoInfo = cryptoDeviceInfo.getOrNull()
|
||||||
val fullInfo = if (info != null && cryptoInfo != null) {
|
val fullInfo = if (info != null && cryptoInfo != null) {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* 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.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Test
|
import org.junit.Test
|
|
@ -14,9 +14,8 @@
|
||||||
* limitations under the License.
|
* 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.every
|
||||||
import io.mockk.mockk
|
import io.mockk.mockk
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
|
@ -91,7 +90,7 @@ class GetEncryptionTrustLevelForDeviceUseCaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun givenCurrentSessionCrossSigningInfo(
|
private fun givenCurrentSessionCrossSigningInfo(
|
||||||
deviceId: String?,
|
deviceId: String,
|
||||||
isCrossSigningInitialized: Boolean,
|
isCrossSigningInitialized: Boolean,
|
||||||
isCrossSigningVerified: Boolean
|
isCrossSigningVerified: Boolean
|
||||||
): CurrentSessionCrossSigningInfo {
|
): CurrentSessionCrossSigningInfo {
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* 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.amshove.kluent.shouldBeEqualTo
|
||||||
import org.junit.Test
|
import org.junit.Test
|
Loading…
Reference in a new issue