-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feat/e2ei/upgrade_cc_1.0.0-pre.6…
…' into feat/e2ei/upgrade_cc_1.0.0-pre.6
- Loading branch information
Showing
32 changed files
with
594 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: "Cherry-pick from rc to develop" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- release/candidate | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cherry-pick: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Append -cherry-pick to branch name | ||
id: extract | ||
run: | | ||
PR_BRANCH="${{ github.event.pull_request.head.ref }}" | ||
NEW_BRANCH_NAME="${PR_BRANCH}-cherry-pick" | ||
echo "New branch name: $NEW_BRANCH_NAME" | ||
echo "::set-output name=newBranchName::$NEW_BRANCH_NAME" | ||
- uses: fregante/setup-git-user@v2 | ||
|
||
- name: Cherry-pick commits | ||
run: | | ||
git fetch origin develop:develop | ||
git checkout -b ${{ steps.extract.outputs.newBranchName }} develop | ||
# Cherry-picking the last commit on the base branch | ||
git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true | ||
git add . | ||
git cherry-pick --continue || true | ||
git push origin ${{ steps.extract.outputs.newBranchName }} | ||
- name: Create PR | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
PR_BRANCH: ${{ steps.extract.outputs.newBranchName }} | ||
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }} | ||
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n ---- \n{1}', github.event.pull_request.number, github.event.pull_request.body) }}" | ||
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base develop --head $PR_BRANCH --label "cherry-pick" --assignee "$PR_ASSIGNEE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
.../kalium/logic/feature/user/screenshotCensoring/ObserveScreenshotCensoringConfigUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 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.screenshotCensoring | ||
|
||
import com.wire.kalium.logic.configuration.UserConfigRepository | ||
import com.wire.kalium.logic.feature.selfDeletingMessages.TeamSelfDeleteTimer | ||
import com.wire.kalium.logic.functional.mapRight | ||
import com.wire.kalium.logic.functional.mapToRightOr | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.combine | ||
|
||
/** | ||
* UseCase that allow us to get the configuration of screenshot censoring enabled or not | ||
*/ | ||
interface ObserveScreenshotCensoringConfigUseCase { | ||
suspend operator fun invoke(): Flow<ObserveScreenshotCensoringConfigResult> | ||
} | ||
|
||
internal class ObserveScreenshotCensoringConfigUseCaseImpl( | ||
private val userConfigRepository: UserConfigRepository, | ||
) : ObserveScreenshotCensoringConfigUseCase { | ||
|
||
override suspend fun invoke(): Flow<ObserveScreenshotCensoringConfigResult> { | ||
return combine( | ||
userConfigRepository.observeScreenshotCensoringConfig() | ||
.mapToRightOr(true), // for safety it's set to true if we can't determine it | ||
userConfigRepository.observeTeamSettingsSelfDeletingStatus() | ||
.mapRight { it.enforcedSelfDeletionTimer is TeamSelfDeleteTimer.Enforced } | ||
.mapToRightOr(true), // for safety it's set to true if we can't determine it | ||
) { screenshotCensoringEnabled, teamSelfDeletingEnforced -> | ||
when { | ||
teamSelfDeletingEnforced -> ObserveScreenshotCensoringConfigResult.Enabled.EnforcedByTeamSelfDeletingSettings | ||
screenshotCensoringEnabled -> ObserveScreenshotCensoringConfigResult.Enabled.ChosenByUser | ||
else -> ObserveScreenshotCensoringConfigResult.Disabled | ||
} | ||
} | ||
} | ||
} | ||
|
||
sealed class ObserveScreenshotCensoringConfigResult { | ||
object Disabled : ObserveScreenshotCensoringConfigResult() | ||
sealed class Enabled : ObserveScreenshotCensoringConfigResult() { | ||
object ChosenByUser : Enabled() | ||
object EnforcedByTeamSelfDeletingSettings : Enabled() | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../kalium/logic/feature/user/screenshotCensoring/PersistScreenshotCensoringConfigUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 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.screenshotCensoring | ||
|
||
import com.wire.kalium.logger.KaliumLogger.Companion.ApplicationFlow.LOCAL_STORAGE | ||
import com.wire.kalium.logic.CoreFailure | ||
import com.wire.kalium.logic.configuration.UserConfigRepository | ||
import com.wire.kalium.logic.functional.fold | ||
import com.wire.kalium.logic.kaliumLogger | ||
|
||
/** | ||
* UseCase that allow us to persist the configuration of screenshot censoring to enabled or not | ||
*/ | ||
interface PersistScreenshotCensoringConfigUseCase { | ||
suspend operator fun invoke(enabled: Boolean): PersistScreenshotCensoringConfigResult | ||
} | ||
|
||
internal class PersistScreenshotCensoringConfigUseCaseImpl( | ||
private val userConfigRepository: UserConfigRepository, | ||
) : PersistScreenshotCensoringConfigUseCase { | ||
|
||
private val logger by lazy { kaliumLogger.withFeatureId(LOCAL_STORAGE) } | ||
|
||
override suspend fun invoke(enabled: Boolean): PersistScreenshotCensoringConfigResult = | ||
userConfigRepository.setScreenshotCensoringConfig(enabled) | ||
.fold({ | ||
logger.e("Failed trying to update screenshot censoring configuration") | ||
PersistScreenshotCensoringConfigResult.Failure(it) | ||
}) { | ||
PersistScreenshotCensoringConfigResult.Success | ||
} | ||
} | ||
|
||
sealed class PersistScreenshotCensoringConfigResult { | ||
object Success : PersistScreenshotCensoringConfigResult() | ||
data class Failure(val cause: CoreFailure) : PersistScreenshotCensoringConfigResult() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -916,6 +916,7 @@ class ConversationRepositoryTest { | |
true, | ||
null, | ||
null, | ||
null, | ||
null | ||
) | ||
) | ||
|
Oops, something went wrong.