Skip to content

Commit

Permalink
Merge branch 'develop' into feat/filter-folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas committed Dec 6, 2024
2 parents 3e11aa6 + 3038c25 commit aaef282
Show file tree
Hide file tree
Showing 240 changed files with 3,660 additions and 2,087 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gradle-run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
script: ./gradlew runAcceptanceTests
env:
GITHUB_USER: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: actions/checkout@v4

- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@v4
uses: dawidd6/action-download-artifact@v7
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pipeline {
error("Could not find any apk at provided location!")
} else {
def lastModifiedFileName = files[-1].name
build job: 'android_reloaded_smoke', parameters: [string(name: 'AppBuildNumber', value: "artifacts/megazord/android/reloaded/staging/compat/$BRANCH_NAME/${lastModifiedFileName}"), string(name: 'TAGS', value: '@smoke'), string(name: 'Branch', value: 'android_dev')]
build job: 'android_reloaded_smoke', parameters: [string(name: 'AppBuildNumber', value: "artifacts/megazord/android/reloaded/staging/compat/$BRANCH_NAME/${lastModifiedFileName}"), string(name: 'TAGS', value: '@smoke'), string(name: 'Branch', value: 'main')]
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ private fun getFlavorsSettings(): NormalizedFlavorSettings =

android {
defaultConfig {
ndk {
abiFilters.apply {
add("armeabi-v7a")
add("arm64-v8a")
add("x86_64")
}
}

val datadogApiKeyKey = "DATADOG_CLIENT_TOKEN"
val datadogApiKey: String? = System.getenv(datadogApiKeyKey) ?: project.getLocalProperty(datadogApiKeyKey, null)
buildConfigField("String", datadogApiKeyKey, datadogApiKey?.let { "\"$it\"" } ?: "null")
Expand Down Expand Up @@ -115,6 +123,10 @@ android {
getByName("androidTest") {
java.srcDirs("src/androidTest/kotlin")
}
create("screenshotTest") {
java.srcDirs("src/screenshotTest/kotlin")
res.srcDirs("src/main/res")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import com.wire.android.ui.common.snackbar.LocalSnackbarHostState
import com.wire.android.ui.theme.DefaultWireFixedColorScheme
import com.wire.android.ui.theme.WireColorScheme
import com.wire.android.ui.theme.WireColorSchemeTypes
import com.wire.android.ui.theme.WireDimensions
import com.wire.android.ui.theme.WireDimensionsTypes
import com.wire.android.ui.theme.WireFixedColorScheme
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.WireTypography
import com.wire.android.ui.theme.WireTypographyTypes

@Composable
fun WireTestTheme(
wireColorScheme: WireColorScheme = WireColorSchemeTypes.currentTheme,
wireFixedColorScheme: WireFixedColorScheme = DefaultWireFixedColorScheme,
wireTypography: WireTypography = WireTypographyTypes.currentScreenSize,
wireDimensions: WireDimensions = WireDimensionsTypes.currentScreenSize.currentOrientation,
content: @Composable () -> Unit
Expand All @@ -41,6 +44,7 @@ fun WireTestTheme(
CompositionLocalProvider(LocalSnackbarHostState provides snackbarHostState) {
WireTheme(
wireColorScheme,
wireFixedColorScheme,
wireTypography,
wireDimensions,
content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.wire.android.di.KaliumCoreLogic
import com.wire.kalium.logic.CoreLogic
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.search.FederatedSearchParser
import com.wire.kalium.logic.feature.search.IsFederationSearchAllowedUseCase
import com.wire.kalium.logic.feature.search.SearchByHandleUseCase
import com.wire.kalium.logic.feature.search.SearchScope
import com.wire.kalium.logic.feature.search.SearchUsersUseCase
Expand Down Expand Up @@ -53,4 +54,9 @@ class SearchModule {
@ViewModelScoped
@Provides
fun provideFederatedSearchParser(searchScope: SearchScope): FederatedSearchParser = searchScope.federatedSearchParser

@ViewModelScoped
@Provides
fun provideIsFederationSearchAllowedUseCase(searchScope: SearchScope): IsFederationSearchAllowedUseCase =
searchScope.isFederationSearchAllowedUseCase
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.wire.kalium.logic.feature.e2ei.usecase.GetUserE2eiCertificatesUseCase
import com.wire.kalium.logic.feature.e2ei.usecase.IsOtherUserE2EIVerifiedUseCase
import com.wire.kalium.logic.feature.e2ei.usecase.ObserveCertificateRevocationForSelfClientUseCase
import com.wire.kalium.logic.feature.featureConfig.FeatureFlagsSyncWorker
import com.wire.kalium.logic.feature.personaltoteamaccount.CanMigrateFromPersonalToTeamUseCase
import com.wire.kalium.logic.feature.publicuser.GetAllContactsUseCase
import com.wire.kalium.logic.feature.publicuser.GetKnownUserUseCase
import com.wire.kalium.logic.feature.publicuser.RefreshUsersWithoutMetadataUseCase
Expand Down Expand Up @@ -240,6 +241,11 @@ class UserModule {
fun provideFeatureFlagsSyncWorker(userScope: UserScope): FeatureFlagsSyncWorker =
userScope.featureFlagsSyncWorker

@ViewModelScoped
@Provides
fun provideIsPersonalToTeamAccountSupportedByBackendUseCase(userScope: UserScope): CanMigrateFromPersonalToTeamUseCase =
userScope.isPersonalToTeamAccountSupportedByBackend

@ViewModelScoped
@Provides
fun provideObserveCertificateRevocationForSelfClientUseCase(userScope: UserScope): ObserveCertificateRevocationForSelfClientUseCase =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class AccountSwitchUseCase @Inject constructor(
LogoutReason.SELF_SOFT_LOGOUT, LogoutReason.SELF_HARD_LOGOUT -> {
deleteSession(invalidAccount.userId)
}
LogoutReason.MIGRATION_TO_CC_FAILED,
LogoutReason.DELETED_ACCOUNT,
LogoutReason.REMOVED_CLIENT,
LogoutReason.SESSION_EXPIRED -> deleteSession(invalidAccount.userId)
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/kotlin/com/wire/android/mapper/ContactMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.wire.android.ui.home.conversationslist.model.Membership
import com.wire.android.ui.home.newconversation.model.Contact
import com.wire.android.ui.userprofile.common.UsernameMapper
import com.wire.android.util.EMPTY
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.publicuser.model.UserSearchDetails
import com.wire.kalium.logic.data.service.ServiceDetails
import com.wire.kalium.logic.data.user.ConnectionState
Expand All @@ -36,7 +35,6 @@ import javax.inject.Inject
class ContactMapper
@Inject constructor(
private val userTypeMapper: UserTypeMapper,
private val wireSessionImageLoader: WireSessionImageLoader,
) {

fun fromOtherUser(otherUser: OtherUser): Contact {
Expand All @@ -48,7 +46,7 @@ class ContactMapper
handle = handle.orEmpty(),
label = UsernameMapper.fromOtherUser(otherUser),
avatarData = UserAvatarData(
asset = previewPicture?.let { ImageAsset.UserAvatarAsset(wireSessionImageLoader, it) },
asset = previewPicture?.let { ImageAsset.UserAvatarAsset(it) },
connectionState = connectionStatus,
nameBasedAvatar = NameBasedAvatar(fullName = name, accentColor = otherUser.accentId)
),
Expand All @@ -67,7 +65,7 @@ class ContactMapper
handle = String.EMPTY,
label = String.EMPTY,
avatarData = UserAvatarData(
asset = previewAssetId?.let { ImageAsset.UserAvatarAsset(wireSessionImageLoader, it) },
asset = previewAssetId?.let { ImageAsset.UserAvatarAsset(it) },
membership = Membership.Service
),
membership = Membership.Service,
Expand All @@ -85,7 +83,7 @@ class ContactMapper
handle = handle.orEmpty(),
label = mapUserHandle(user),
avatarData = UserAvatarData(
asset = previewAssetId?.let { ImageAsset.UserAvatarAsset(wireSessionImageLoader, it) },
asset = previewAssetId?.let { ImageAsset.UserAvatarAsset(it) },
nameBasedAvatar = NameBasedAvatar(fullName = name, accentColor = -1)
),
membership = userTypeMapper.toMembership(type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ import com.wire.android.ui.home.conversationslist.model.BlockState
import com.wire.android.ui.home.conversationslist.model.ConversationInfo
import com.wire.android.ui.home.conversationslist.model.ConversationItem
import com.wire.android.ui.home.conversationslist.showLegalHoldIndicator
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.conversation.ConversationDetails.Connection
import com.wire.kalium.logic.data.conversation.ConversationDetails.Group
import com.wire.kalium.logic.data.conversation.ConversationDetails.OneOne
import com.wire.kalium.logic.data.conversation.ConversationDetails.Self
import com.wire.kalium.logic.data.conversation.ConversationDetailsWithEvents
import com.wire.kalium.logic.data.conversation.MutedConversationStatus
import com.wire.kalium.logic.data.conversation.UnreadEventCount
import com.wire.kalium.logic.data.id.TeamId
import com.wire.kalium.logic.data.message.UnreadEventType
import com.wire.kalium.logic.data.user.ConnectionState
import com.wire.kalium.logic.data.user.UserAvailabilityStatus

@Suppress("LongMethod")
fun ConversationDetailsWithEvents.toConversationItem(
wireSessionImageLoader: WireSessionImageLoader,
userTypeMapper: UserTypeMapper,
searchQuery: String,
selfUserTeamId: TeamId?
): ConversationItem = when (val conversationDetails = this.conversationDetails) {
is Group -> {
ConversationItem.GroupConversation(
Expand All @@ -56,7 +56,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
unreadEventCount = unreadEventCount
),
hasOnGoingCall = conversationDetails.hasOngoingCall && conversationDetails.isSelfUserMember,
isSelfUserCreator = conversationDetails.isSelfUserCreator,
isFromTheSameTeam = conversationDetails.conversation.teamId == selfUserTeamId,
isSelfUserMember = conversationDetails.isSelfUserMember,
teamId = conversationDetails.conversation.teamId,
selfMemberRole = conversationDetails.selfRole,
Expand All @@ -72,7 +72,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
is OneOne -> {
ConversationItem.PrivateConversation(
userAvatarData = UserAvatarData(
asset = conversationDetails.otherUser.previewPicture?.let { UserAvatarAsset(wireSessionImageLoader, it) },
asset = conversationDetails.otherUser.previewPicture?.let { UserAvatarAsset(it) },
availabilityStatus = conversationDetails.otherUser.availabilityStatus,
connectionState = conversationDetails.otherUser.connectionStatus,
nameBasedAvatar = NameBasedAvatar(conversationDetails.otherUser.name, conversationDetails.otherUser.accentId)
Expand Down Expand Up @@ -109,7 +109,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
is Connection -> {
ConversationItem.ConnectionConversation(
userAvatarData = UserAvatarData(
asset = conversationDetails.otherUser?.previewPicture?.let { UserAvatarAsset(wireSessionImageLoader, it) },
asset = conversationDetails.otherUser?.previewPicture?.let { UserAvatarAsset(it) },
availabilityStatus = conversationDetails.otherUser?.availabilityStatus ?: UserAvailabilityStatus.NONE,
nameBasedAvatar = NameBasedAvatar(conversationDetails.otherUser?.name, conversationDetails.otherUser?.accentId ?: -1)
),
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/kotlin/com/wire/android/mapper/MessageMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import com.wire.android.ui.home.conversationslist.model.Membership
import com.wire.android.ui.theme.Accent
import com.wire.android.util.time.ISOFormatter
import com.wire.android.util.ui.UIText
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.message.DeliveryStatus
import com.wire.kalium.logic.data.message.Message
import com.wire.kalium.logic.data.message.MessageContent
Expand All @@ -52,8 +51,6 @@ class MessageMapper @Inject constructor(
private val userTypeMapper: UserTypeMapper,
private val messageContentMapper: MessageContentMapper,
private val isoFormatter: ISOFormatter,
// TODO(qol): a message mapper should not depend on a UI related component
private val wireSessionImageLoader: WireSessionImageLoader
) {

fun memberIdList(messages: List<Message>): List<UserId> = messages.flatMap { message ->
Expand Down Expand Up @@ -200,7 +197,7 @@ class MessageMapper @Inject constructor(
}

private fun getUserAvatarData(sender: User?) = UserAvatarData(
asset = sender?.previewAsset(wireSessionImageLoader),
asset = sender?.previewAsset(),
availabilityStatus = sender?.availabilityStatus ?: UserAvailabilityStatus.NONE,
membership = sender?.userType?.let { userTypeMapper.toMembership(it) } ?: Membership.None,
connectionState = getConnectionState(sender),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ package com.wire.android.mapper

import com.wire.android.ui.home.conversations.avatar
import com.wire.android.ui.userprofile.self.model.OtherAccount
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.team.Team
import com.wire.kalium.logic.data.user.SelfUser
import javax.inject.Inject

class OtherAccountMapper @Inject constructor(
private val wireSessionImageLoader: WireSessionImageLoader
) {
fun toOtherAccount(selfUser: SelfUser, team: Team?): OtherAccount = OtherAccount(
class OtherAccountMapper @Inject constructor() {
fun toOtherAccount(selfUser: SelfUser): OtherAccount = OtherAccount(
id = selfUser.id,
fullName = selfUser.name ?: "",
avatarData = selfUser.avatar(wireSessionImageLoader, selfUser.connectionStatus),
teamName = team?.name
avatarData = selfUser.avatar(selfUser.connectionStatus),
handle = selfUser.handle
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.wire.android.ui.home.conversations.model.UIMessageContent
import com.wire.android.ui.home.conversations.model.UIQuotedMessage
import com.wire.android.util.time.ISOFormatter
import com.wire.android.util.ui.UIText
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.asset.AttachmentType
import com.wire.kalium.logic.data.asset.isDisplayableImageMimeType
import com.wire.kalium.logic.data.id.ConversationId
Expand All @@ -50,7 +49,6 @@ import javax.inject.Inject
@Suppress("TooManyFunctions")
class RegularMessageMapper @Inject constructor(
private val messageResourceProvider: MessageResourceProvider,
private val wireSessionImageLoader: WireSessionImageLoader,
private val isoFormatter: ISOFormatter,
) {

Expand Down Expand Up @@ -207,7 +205,6 @@ class RegularMessageMapper @Inject constructor(
is MessageContent.QuotedMessageDetails.Asset -> when (AttachmentType.fromMimeTypeString(quotedContent.assetMimeType)) {
AttachmentType.IMAGE -> UIQuotedMessage.UIQuotedData.DisplayableImage(
ImageAsset.PrivateAsset(
wireSessionImageLoader,
conversationId,
it.messageId,
it.isQuotingSelfUser
Expand Down Expand Up @@ -249,7 +246,6 @@ class RegularMessageMapper @Inject constructor(
UIMessageContent.ImageMessage(
assetId = AssetId(remoteData.assetId, remoteData.assetDomain.orEmpty()),
asset = ImageAsset.PrivateAsset(
wireSessionImageLoader,
message.conversationId,
message.id,
sender is SelfUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class SystemMessageContentMapper @Inject constructor(

private fun mapTeamMemberRemovedMessage(
content: MessageContent.TeamMemberRemoved
): UIMessageContent.SystemMessage = UIMessageContent.SystemMessage.TeamMemberRemoved_Legacy(content)
): UIMessageContent.SystemMessage = UIMessageContent.SystemMessage.TeamMemberRemoved_Legacy(content.userName)

private fun mapConversationRenamedMessage(
senderUserId: UserId,
Expand All @@ -197,7 +197,7 @@ class SystemMessageContentMapper @Inject constructor(
user = sender,
type = SelfNameType.ResourceTitleCase
)
return UIMessageContent.SystemMessage.RenamedConversation(authorName, content)
return UIMessageContent.SystemMessage.RenamedConversation(authorName, content.conversationName)
}

fun mapMemberChangeMessage(
Expand Down Expand Up @@ -271,7 +271,7 @@ class SystemMessageContentMapper @Inject constructor(
UIMessageContent.SystemMessage.HistoryLost

private fun mapMLSWrongEpochWarning(): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.MLSWrongEpochWarning()
UIMessageContent.SystemMessage.MLSWrongEpochWarning

private fun mapConversationHistoryListProtocolChanged(): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.HistoryLostProtocolChanged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ package com.wire.android.mapper

import com.wire.android.model.ImageAsset
import com.wire.android.ui.calling.model.UICallParticipant
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.call.Participant
import javax.inject.Inject

class UICallParticipantMapper @Inject constructor(
private val wireSessionImageLoader: WireSessionImageLoader,
private val userTypeMapper: UserTypeMapper,
) {
fun toUICallParticipant(participant: Participant) = UICallParticipant(
Expand All @@ -36,7 +34,7 @@ class UICallParticipantMapper @Inject constructor(
isSpeaking = participant.isSpeaking,
isCameraOn = participant.isCameraOn,
isSharingScreen = participant.isSharingScreen,
avatar = participant.avatarAssetId?.let { ImageAsset.UserAvatarAsset(wireSessionImageLoader, it) },
avatar = participant.avatarAssetId?.let { ImageAsset.UserAvatarAsset(it) },
membership = userTypeMapper.toMembership(participant.userType),
hasEstablishedAudio = participant.hasEstablishedAudio,
accentId = participant.accentId
Expand Down
Loading

0 comments on commit aaef282

Please sign in to comment.