Skip to content

Commit

Permalink
Merge develop into feat/user_verification_status_proteus
Browse files Browse the repository at this point in the history
  • Loading branch information
borichellow committed Oct 5, 2023
2 parents 6702176 + 2553247 commit 845f3fd
Show file tree
Hide file tree
Showing 38 changed files with 681 additions and 298 deletions.
112 changes: 93 additions & 19 deletions .github/workflows/cherry-pick-rc-to-develop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# GitHub Action: Cherry-pick from `release/candidate` to `TARGET_BRANCH`
#
# This action automates the process of cherry-picking merged PRs from `release/candidate` branch to `TARGET_BRANCH`.
# It is triggered whenever a pull request is merged into `release/candidate`.
#
# The action performs the following steps:
# 1. Checkout the merged PR.
# 2. If changes are made outside the specified submodule or no submodule is specified, the action proceeds.
# 3. If a submodule name is provided in the `SUBMODULE_NAME` environment variable:
# a. The action creates a temporary branch.
# b. Updates the submodule to its latest version from `develop`.
# c. Commits the submodule updates.
# 4. Squashes the commit with the commit message of the merged PR (if a submodule was updated).
# 5. Cherry-picks the squashed (or original if no squashing occurred) commit to a new branch based on `develop`.
# 6. If any conflicts arise during the cherry-pick, they are committed.
# 7. The branch with the cherry-picked changes is pushed.
# 8. A new pull request is created against `develop` with the cherry-picked changes.
#
# Note: Ensure you add a "cherry-pick" label to your project. This label is required for the creation of cherry-picked PRs.
# If needed, you can also set the `TARGET_BRANCH` environment variable to specify a different target branch for the cherry-pick.
# By default, it's set to `develop`.

name: "Cherry-pick from rc to develop"

on:
Expand All @@ -7,6 +29,11 @@ on:
types:
- closed

env:

TARGET_BRANCH: develop
SUBMODULE_NAME: kalium

jobs:
cherry-pick:
runs-on: ubuntu-latest
Expand All @@ -20,6 +47,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Append -cherry-pick to branch name
id: extract
Expand All @@ -29,40 +57,86 @@ jobs:
echo "New branch name: $NEW_BRANCH_NAME"
echo "newBranchName=$NEW_BRANCH_NAME" >> $GITHUB_ENV
- name: Check if changes only in kalium submodule
- name: Check for changes excluding submodule
id: check_changes
run: |
NUM_CHANGES=$(git diff origin/develop --name-only | grep -v '^kalium/' | wc -l)
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
# If SUBMODULE_NAME is set
NUM_CHANGES=$(git diff origin/${{ env.TARGET_BRANCH }} --name-only | grep -v "^${{ env.SUBMODULE_NAME }}/" | wc -l)
else
# If SUBMODULE_NAME is not set
NUM_CHANGES=$(git diff origin/${{ env.TARGET_BRANCH }} --name-only | wc -l)
fi
if [ "$NUM_CHANGES" -gt 0 ]; then
echo "::set-output name=shouldCherryPick::true"
echo "shouldCherryPick=true" >> $GITHUB_ENV
else
echo "No changes outside of kalium submodule, skipping cherry-pick"
echo "::set-output name=shouldCherryPick::false"
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
echo "No changes outside of ${{ env.SUBMODULE_NAME }} submodule, skipping cherry-pick"
else
echo "No changes detected, skipping cherry-pick"
fi
echo "shouldCherryPick=false" >> $GITHUB_ENV
fi
- uses: fregante/setup-git-user@v2

- name: Update submodule
if: env.SUBMODULE_NAME && env.shouldCherryPick == 'true'
run: |
set -x
# Create a temporary branch and get the last commit message
git checkout -b temp-branch-for-cherry-pick
LAST_COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.event.pull_request.merge_commit_sha }})
cd ${{ env.SUBMODULE_NAME }}
git checkout ${{ env.TARGET_BRANCH }}
git pull origin ${{ env.TARGET_BRANCH }}
cd ..
git add ${{ env.SUBMODULE_NAME }}
git commit -m "Update submodule ${{ env.SUBMODULE_NAME }} to latest from ${{ env.TARGET_BRANCH }}"
echo "lastCommitMessage=LAST_COMMIT_MESSAGE" >> $GITHUB_ENV
- name: Get Cherry-pick commit
id: get-cherry
if: env.shouldCherryPick == 'true'
run: |
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
# If SUBMODULE_NAME is set
git reset --soft HEAD~2
git commit -m "${{ env.lastCommitMessage }}"
fi
# Get the SHA of the current commit (either squashed or not based on the condition above)
CHERRY_PICK_COMMIT=$(git rev-parse HEAD)
echo "cherryPickCommit=$CHERRY_PICK_COMMIT" >> $GITHUB_ENV
- name: Cherry-pick commits
id: cherry
if: steps.check_changes.outputs.shouldCherryPick == 'true'
id: commit-cherry-pick
if: env.shouldCherryPick == 'true'
run: |
git fetch origin develop:develop
git checkout -b ${{ env.newBranchName }} develop
# Cherry-picking the last commit on the base branch
OUTPUT=$(git cherry-pick ${{ github.event.pull_request.merge_commit_sha }} --strategy-option theirs || true)
CONFLICTS=$(echo "$OUTPUT" | grep 'CONFLICT' || echo "")
if [ -n "$CONFLICTS" ]; then
git add .
git cherry-pick --continue || true
# Checkout the desired branch and cherry-pick the commit
git checkout ${{ env.TARGET_BRANCH }}
git checkout -b ${{ env.newBranchName }}
OUTPUT=$(git cherry-pick ${{ env.cherryPickCommit }} || true)
# Handle conflicts
CONFLICTED_FILES=$(git diff --name-only --diff-filter=U)
if [[ "$OUTPUT" == *"CONFLICT"* ]]; then
# Commit the remaining conflicts
git commit -am "Commit with unresolved merge conflicts outside of ${{ env.SUBMODULE_NAME }}"
fi
# Push branch and remove temp
git push origin ${{ env.newBranchName }} || (echo "Failed to push to origin" && exit 1)
echo "conflicts=$CONFLICTS" >> $GITHUB_ENV
echo "conflictedFiles=$CONFLICTED_FILES" >> $GITHUB_ENV
if [[ -n "${{ env.SUBMODULE_NAME }}" ]]; then
git branch -D temp-branch-for-cherry-pick
fi
- name: Create PR
if: steps.check_changes.outputs.shouldCherryPick == 'true'
if: env.shouldCherryPick == 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BRANCH: ${{ env.newBranchName }}
PR_ASSIGNEE: ${{ github.event.pull_request.user.login }}
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n{1}\n\n{2}', github.event.pull_request.number, env.conflicts, 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"
PR_BODY: "${{ format('Cherry pick from the original PR: \n- #{0}\n\n---- \n\n ⚠️ Conflicts during cherry-pick:\n{1}\n\n{2}', github.event.pull_request.number, env.conflictedFiles, github.event.pull_request.body) }}"
run: gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base ${{ env.TARGET_BRANCH }} --head "$PR_BRANCH" --label "cherry-pick" --assignee "$PR_ASSIGNEE"
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ sealed class HomeDestination(
data object Archive : HomeDestination(
title = R.string.archive_screen_title,
icon = R.drawable.ic_archive,
isSearchable = true,
direction = ArchiveScreenDestination
)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import com.wire.android.ui.destinations.WelcomeScreenDestination
import com.wire.android.ui.home.E2EIRequiredDialog
import com.wire.android.ui.home.E2EISnoozeDialog
import com.wire.android.ui.home.sync.FeatureFlagNotificationViewModel
import com.wire.android.ui.snackbar.LocalSnackbarHostState
import com.wire.android.ui.common.snackbar.LocalSnackbarHostState
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.CurrentScreenManager
import com.wire.android.util.LocalSyncStateObserver
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.android.ui.common.dialogs

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.wire.android.R
import com.wire.android.ui.common.VisibilityState
import com.wire.android.ui.common.WireDialog
import com.wire.android.ui.common.WireDialogButtonProperties
import com.wire.android.ui.common.WireDialogButtonType
import com.wire.android.ui.common.visbility.VisibilityState
import com.wire.android.ui.home.conversationslist.model.DialogState

@Composable
fun ArchiveConversationDialog(onArchiveButtonClicked: (DialogState) -> Unit, dialogState: VisibilityState<DialogState>) {
VisibilityState(dialogState) {
WireDialog(
title = stringResource(R.string.dialog_archive_conversation_title),
text = stringResource(R.string.dialog_archive_conversation_description),
onDismiss = dialogState::dismiss,
optionButton1Properties = WireDialogButtonProperties(
onClick = { onArchiveButtonClicked(it) },
text = stringResource(R.string.dialog_archive_conversation_option),
type = WireDialogButtonType.Primary,
),
dismissButtonProperties = WireDialogButtonProperties(
onClick = dialogState::dismiss,
text = stringResource(R.string.label_cancel),
type = WireDialogButtonType.Secondary,
),
buttonsHorizontalAlignment = true
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
*/
package com.wire.android.ui.common.scaffold

import SwipeableSnackbar
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material3.FabPosition
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.wire.android.ui.common.snackbar.SwipeDismissSnackbarHost
import com.wire.android.ui.snackbar.LocalSnackbarHostState
import com.wire.android.ui.common.snackbar.LocalSnackbarHostState

/**
* A custom scaffold that automatically applies system UI insets and IME (Input Method Editor)
Expand Down Expand Up @@ -68,12 +69,21 @@ fun WireScaffold(
topBar = topBar,
bottomBar = bottomBar,
snackbarHost = {
SwipeDismissSnackbarHost(hostState = LocalSnackbarHostState.current)
SnackbarHost(
hostState = LocalSnackbarHostState.current,
snackbar = { data ->
SwipeableSnackbar(
hostState = LocalSnackbarHostState.current,
data = data,
onDismiss = { data.dismiss() }
)
}
)
},
floatingActionButton,
floatingActionButtonPosition,
containerColor,
contentColor,
floatingActionButton = floatingActionButton,
floatingActionButtonPosition = floatingActionButtonPosition,
containerColor = containerColor,
contentColor = contentColor,
contentWindowInsets = WindowInsets(0, 0, 0, 0),
content = content
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* 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.android.ui.snackbar
package com.wire.android.ui.common.snackbar

import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.staticCompositionLocalOf
Expand Down

This file was deleted.

Loading

0 comments on commit 845f3fd

Please sign in to comment.