mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Moving recently created use cases inside v2 package
This commit is contained in:
parent
712d39b9dd
commit
39a0b3b1ba
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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) {
|
||||
|
@ -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
|
@ -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 {
|
@ -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
|
Loading…
Reference in New Issue
Block a user