Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into show_e2ei_certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine committed Oct 13, 2023
2 parents 28589cf + d3d6bf7 commit 12db711
Show file tree
Hide file tree
Showing 34 changed files with 437 additions and 134 deletions.
20 changes: 16 additions & 4 deletions AR-builder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,15 @@ pipeline {
withGradle() {
sh './gradlew runUnitTests'
}

publishHTML(allowMissing: true, alwaysLinkToLastBuild: true, keepAll: true, reportDir: "app/build/reports/tests/test${params.FLAVOR}${params.BUILD_TYPE}UnitTest/", reportFiles: 'index.html', reportName: 'Unit Test Report', reportTitles: 'Unit Test')
zip archive: true, defaultExcludes: false, dir: "app/build/reports/tests/test${params.FLAVOR}${params.BUILD_TYPE}UnitTest/", overwrite: true, glob: "", zipFile: "unit-tests-android.zip"

script {
commitHash = sh(
script: 'git rev-parse HEAD | xargs echo -n',
returnStdout: true
)
}
zip archive: true, defaultExcludes: false, dir: "app/build/reports/tests/test${params.FLAVOR}${params.BUILD_TYPE}UnitTest/", overwrite: true, glob: "", zipFile: "unit-tests-android_${commitHash}.zip"
}
}

Expand Down Expand Up @@ -305,9 +311,15 @@ pipeline {
withGradle() {
sh './gradlew runAcceptanceTests'
}

publishHTML(allowMissing: true, alwaysLinkToLastBuild: true, keepAll: true, reportDir: "app/build/reports/androidTests/connected/debug/flavors/${params.FLAVOR.toLowerCase()}", reportFiles: 'index.html', reportName: 'Acceptance Test Report', reportTitles: 'Acceptance Test')
zip archive: true, defaultExcludes: false, dir: "app/build/reports/androidTests/connected/debug/flavors/${params.FLAVOR.toLowerCase()}", overwrite: true, glob: "", zipFile: "integration-tests-android.zip"

script {
commitHash = sh(
script: 'git rev-parse HEAD | xargs echo -n',
returnStdout: true
)
}
zip archive: true, defaultExcludes: false, dir: "app/build/reports/androidTests/connected/debug/flavors/${params.FLAVOR.toLowerCase()}", overwrite: true, glob: "", zipFile: "integration-tests-android_${commitHash}.zip"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.conversation.AddMemberToConversationUseCase
import com.wire.kalium.logic.feature.conversation.AddServiceToConversationUseCase
import com.wire.kalium.logic.feature.conversation.ClearConversationContentUseCase
import com.wire.kalium.logic.feature.conversation.ClearUsersTypingEventsUseCase
import com.wire.kalium.logic.feature.conversation.ConversationScope
import com.wire.kalium.logic.feature.conversation.CreateGroupConversationUseCase
import com.wire.kalium.logic.feature.conversation.GetConversationUnreadEventsCountUseCase
Expand All @@ -42,6 +43,7 @@ import com.wire.kalium.logic.feature.conversation.ObserveUsersTypingUseCase
import com.wire.kalium.logic.feature.conversation.RefreshConversationsWithoutMetadataUseCase
import com.wire.kalium.logic.feature.conversation.RemoveMemberFromConversationUseCase
import com.wire.kalium.logic.feature.conversation.RenameConversationUseCase
import com.wire.kalium.logic.feature.conversation.SendTypingEventUseCase
import com.wire.kalium.logic.feature.conversation.UpdateConversationAccessRoleUseCase
import com.wire.kalium.logic.feature.conversation.UpdateConversationArchivedStatusUseCase
import com.wire.kalium.logic.feature.conversation.UpdateConversationMemberRoleUseCase
Expand Down Expand Up @@ -241,4 +243,13 @@ class ConversationModule {
@Provides
fun provideObserveUsersTypingUseCase(conversationScope: ConversationScope): ObserveUsersTypingUseCase =
conversationScope.observeUsersTyping

@ViewModelScoped
@Provides
fun provideSendTypingEventUseCase(conversationScope: ConversationScope): SendTypingEventUseCase = conversationScope.sendTypingEvent

@ViewModelScoped
@Provides
fun provideClearTypingEventsUseCase(conversationScope: ConversationScope): ClearUsersTypingEventsUseCase =
conversationScope.clearUsersTypingEvents
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class UIParticipantMapper @Inject constructor(
unavailable = unavailable,
isDeleted = (user is OtherUser && user.deleted),
botService = (user as? OtherUser)?.botService,
isDefederated = (user is OtherUser && user.defederated)
isDefederated = (user is OtherUser && user.defederated),
isProteusVerified = (user is OtherUser && user.isProteusVerified),
)
}

Expand All @@ -69,7 +70,8 @@ class UIParticipantMapper @Inject constructor(
unavailable = !userSummary.isUserDeleted && userSummary.userName.orEmpty().isEmpty(),
isDeleted = userSummary.isUserDeleted,
isSelf = isSelfUser,
isDefederated = false
isDefederated = false,
isProteusVerified = false
)
}

Expand All @@ -84,7 +86,8 @@ class UIParticipantMapper @Inject constructor(
isDeleted = userSummary.isUserDeleted,
isSelf = false,
readReceiptDate = date,
isDefederated = false
isDefederated = false,
isProteusVerified = false
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class MigrationMapper @Inject constructor() {
availabilityStatus = mapUserAvailabilityStatus(scalaUserData.availability),
botService = botService,
deleted = scalaUserData.deleted,
defederated = false
defederated = false,
isProteusVerified = false
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
package com.wire.android.ui.authentication.devices

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
Expand All @@ -49,14 +47,14 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.wire.android.BuildConfig
import com.wire.android.R
import com.wire.android.ui.authentication.devices.model.Device
import com.wire.android.ui.authentication.devices.model.lastActiveDescription
import com.wire.android.ui.common.ProteusVerifiedIcon
import com.wire.android.ui.common.button.WireSecondaryButton
import com.wire.android.ui.common.button.getMinTouchMargins
import com.wire.android.ui.common.button.wireSecondaryButtonColors
Expand Down Expand Up @@ -185,7 +183,7 @@ private fun DeviceItemTexts(
)
if (shouldShowVerifyLabel) {
Spacer(modifier = Modifier.width(MaterialTheme.wireDimensions.spacing8x))
VerifyLabel(device.isVerified, Modifier.wrapContentWidth())
if (device.isVerifiedProteus) ProteusVerifiedIcon(Modifier.wrapContentWidth())
}
}

Expand Down Expand Up @@ -249,35 +247,12 @@ private fun DeviceItemTexts(
)
}

@Composable
fun VerifyLabel(isVerified: Boolean, modifier: Modifier = Modifier) {
Box(
modifier = modifier.border(
width = MaterialTheme.wireDimensions.spacing1x,
shape = RoundedCornerShape(MaterialTheme.wireDimensions.spacing4x),
color = if (isVerified) MaterialTheme.wireColorScheme.primary else MaterialTheme.wireColorScheme.secondaryText,
)
) {
Text(
text = stringResource(id = if (isVerified) R.string.label_client_verified else R.string.label_client_unverified),
color = if (isVerified) MaterialTheme.wireColorScheme.primary else MaterialTheme.wireColorScheme.secondaryText,
style = MaterialTheme.wireTypography.label03,
textAlign = TextAlign.Center,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier
.wrapContentWidth()
.padding(horizontal = MaterialTheme.wireDimensions.spacing4x, vertical = MaterialTheme.wireDimensions.spacing2x)
)
}
}

@PreviewMultipleThemes
@Composable
fun PreviewDeviceItem() {
WireTheme {
DeviceItem(
device = Device(name = UIText.DynamicString("name")),
device = Device(name = UIText.DynamicString("name"), isVerifiedProteus = true),
placeholder = false,
shouldShowVerifyLabel = true,
background = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data class Device(
val registrationTime: String? = null,
val lastActiveInWholeWeeks: Int? = null,
val isValid: Boolean = true,
val isVerified: Boolean = false,
val isVerifiedProteus: Boolean = false,
val mlsPublicKeys: Map<String, String>? = null
) {
constructor(client: Client) : this(
Expand All @@ -47,7 +47,7 @@ data class Device(
registrationTime = client.registrationTime?.toIsoDateTimeString(),
lastActiveInWholeWeeks = client.lastActiveInWholeWeeks(),
isValid = client.isValid,
isVerified = client.isVerified,
isVerifiedProteus = client.isVerified,
mlsPublicKeys = client.mlsPublicKeys
)
}
Expand Down
35 changes: 35 additions & 0 deletions app/src/main/kotlin/com/wire/android/ui/common/VerifiedIcons.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.wire.android.R

@Composable
fun ProteusVerifiedIcon(modifier: Modifier = Modifier) {
Image(
modifier = modifier.padding(start = dimensions().spacing4x),
painter = painterResource(id = R.drawable.ic_certificate_valid_proteus),
contentDescription = stringResource(R.string.label_client_verified)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,36 @@ fun WireCenterAlignedTopAppBar(
actions: @Composable RowScope.() -> Unit = {},
modifier: Modifier = Modifier,
bottomContent: @Composable ColumnScope.() -> Unit = {}
) {
WireCenterAlignedTopAppBar(
titleContent = {
WireTopAppBarTitle(
title = title,
style = titleStyle,
maxLines = maxLines
)
},
subtitleContent = subtitleContent,
onNavigationPressed = onNavigationPressed,
navigationIconType = navigationIconType,
elevation = elevation,
actions = actions,
modifier = modifier,
bottomContent = bottomContent
)
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WireCenterAlignedTopAppBar(
titleContent: @Composable ColumnScope.() -> Unit,
subtitleContent: @Composable ColumnScope.() -> Unit = {},
onNavigationPressed: () -> Unit = {},
navigationIconType: NavigationIconType? = NavigationIconType.Back,
elevation: Dp = MaterialTheme.wireDimensions.topBarShadowElevation,
actions: @Composable RowScope.() -> Unit = {},
modifier: Modifier = Modifier,
bottomContent: @Composable ColumnScope.() -> Unit = {}
) {
Surface(
modifier = modifier,
Expand All @@ -62,11 +92,7 @@ fun WireCenterAlignedTopAppBar(
CenterAlignedTopAppBar(
title = {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
WireTopAppBarTitle(
title = title,
style = titleStyle,
maxLines = maxLines
)
titleContent()
subtitleContent()
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import com.wire.android.util.ui.UIText
import com.wire.android.util.ui.openDownloadFolder
import com.wire.kalium.logic.NetworkFailure
import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.conversation.Conversation.TypingIndicatorMode
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.call.usecase.ConferenceCallingResult
Expand Down Expand Up @@ -318,6 +319,7 @@ fun ConversationScreen(
}
},
onBackButtonClick = {
messageComposerViewModel.sendTypingEvent(TypingIndicatorMode.STOPPED)
focusManager.clearFocus(true)
navigator.navigateBack()
},
Expand Down Expand Up @@ -347,6 +349,7 @@ fun ConversationScreen(
}
}
},
onTypingEvent = messageComposerViewModel::sendTypingEvent
)
DeleteMessageDialog(
state = messageComposerViewModel.deleteMessageDialogsState,
Expand Down Expand Up @@ -506,6 +509,7 @@ private fun ConversationScreen(
conversationScreenState: ConversationScreenState,
messageComposerStateHolder: MessageComposerStateHolder,
onLinkClick: (String) -> Unit,
onTypingEvent: (TypingIndicatorMode) -> Unit
) {
val context = LocalContext.current
val snackbarHostState = LocalSnackbarHostState.current
Expand Down Expand Up @@ -609,7 +613,8 @@ private fun ConversationScreen(
onClearMentionSearchResult = onClearMentionSearchResult,
tempWritableImageUri = tempWritableImageUri,
tempWritableVideoUri = tempWritableVideoUri,
onLinkClick = onLinkClick
onLinkClick = onLinkClick,
onTypingEvent = onTypingEvent
)
}
}
Expand Down Expand Up @@ -652,6 +657,7 @@ private fun ConversationScreenContent(
tempWritableImageUri: Uri?,
tempWritableVideoUri: Uri?,
onLinkClick: (String) -> Unit,
onTypingEvent: (TypingIndicatorMode) -> Unit
) {
val lazyPagingMessages = messages.collectAsLazyPagingItems()

Expand Down Expand Up @@ -690,6 +696,7 @@ private fun ConversationScreenContent(
onSendMessageBundle = onSendMessage,
tempWritableVideoUri = tempWritableVideoUri,
tempWritableImageUri = tempWritableImageUri,
onTypingEvent = onTypingEvent
)

// TODO: uncomment when we have the "scroll to bottom" button implemented
Expand Down Expand Up @@ -895,6 +902,7 @@ fun PreviewConversationScreen() {
onClearMentionSearchResult = {},
conversationScreenState = conversationScreenState,
messageComposerStateHolder = messageComposerStateHolder,
onLinkClick = { _ -> }
onLinkClick = { _ -> },
onTypingEvent = {}
)
}
Loading

0 comments on commit 12db711

Please sign in to comment.