Skip to content

Commit

Permalink
fix(e2ei): remove E2EI shield and buttons if it's disabled on your team
Browse files Browse the repository at this point in the history
  • Loading branch information
mchenani committed Feb 13, 2024
1 parent 440e203 commit 4378cb0
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ import com.wire.kalium.logic.feature.session.token.AccessTokenRefresherImpl
import com.wire.kalium.logic.feature.team.SyncSelfTeamUseCase
import com.wire.kalium.logic.feature.team.SyncSelfTeamUseCaseImpl
import com.wire.kalium.logic.feature.team.TeamScope
import com.wire.kalium.logic.feature.user.IsE2EIEnabledUseCase
import com.wire.kalium.logic.feature.user.IsE2EIEnabledUseCaseImpl
import com.wire.kalium.logic.feature.user.IsFileSharingEnabledUseCase
import com.wire.kalium.logic.feature.user.IsFileSharingEnabledUseCaseImpl
import com.wire.kalium.logic.feature.user.IsMLSEnabledUseCase
Expand Down Expand Up @@ -1844,6 +1846,7 @@ class UserSessionScope internal constructor(
get() = MarkFileSharingChangeAsNotifiedUseCase(userConfigRepository)

val isMLSEnabled: IsMLSEnabledUseCase get() = IsMLSEnabledUseCaseImpl(featureSupport, userConfigRepository)
val isE2EIEnabled: IsE2EIEnabledUseCase get() = IsE2EIEnabledUseCaseImpl(userConfigRepository)

val observeE2EIRequired: ObserveE2EIRequiredUseCase
get() = ObserveE2EIRequiredUseCaseImpl(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

package com.wire.kalium.logic.feature.user

import com.wire.kalium.logic.configuration.UserConfigRepository
import com.wire.kalium.logic.functional.fold

/**
* Checks if the current user's team has enabled E2EI .
*/
interface IsE2EIEnabledUseCase {
/**
* @return true if E2EI is enabled, false otherwise.
*/
operator fun invoke(): Boolean
}

internal class IsE2EIEnabledUseCaseImpl(
private val userConfigRepository: UserConfigRepository
) : IsE2EIEnabledUseCase {

override operator fun invoke(): Boolean =
userConfigRepository.getE2EISettings().fold({
false
}, {
it.isRequired
})
}

0 comments on commit 4378cb0

Please sign in to comment.