Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Consider team settings when registering mls device #WPB-10119 #3079

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,11 @@ class UserSessionScope internal constructor(

@OptIn(DelicateKaliumApi::class)
private val isAllowedToRegisterMLSClient: IsAllowedToRegisterMLSClientUseCase
get() = IsAllowedToRegisterMLSClientUseCaseImpl(featureSupport, mlsPublicKeysRepository)
get() = IsAllowedToRegisterMLSClientUseCaseImpl(
featureSupport,
mlsPublicKeysRepository,
userConfigRepository
)

private val syncFeatureConfigsUseCase: SyncFeatureConfigsUseCase
get() = SyncFeatureConfigsUseCaseImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@

package com.wire.kalium.logic.feature.client

import com.wire.kalium.logic.configuration.UserConfigRepository
import com.wire.kalium.logic.data.mlspublickeys.MLSPublicKeysRepository
import com.wire.kalium.logic.featureFlags.FeatureSupport
import com.wire.kalium.logic.functional.fold
import com.wire.kalium.logic.functional.isRight
import com.wire.kalium.logic.functional.right
import com.wire.kalium.util.DelicateKaliumApi

/**
Expand All @@ -39,8 +42,12 @@ interface IsAllowedToRegisterMLSClientUseCase {
internal class IsAllowedToRegisterMLSClientUseCaseImpl(
private val featureSupport: FeatureSupport,
private val mlsPublicKeysRepository: MLSPublicKeysRepository,
private val userConfigRepository: UserConfigRepository
) : IsAllowedToRegisterMLSClientUseCase {

override suspend operator fun invoke(): Boolean =
featureSupport.isMLSSupported && mlsPublicKeysRepository.getKeys().isRight()
override suspend operator fun invoke(): Boolean {
return featureSupport.isMLSSupported &&
mlsPublicKeysRepository.getKeys().isRight() &&
userConfigRepository.isMLSEnabled().fold({ false }, { isEnabled -> isEnabled })
}
}
MohamadJaara marked this conversation as resolved.
Show resolved Hide resolved
Loading