Skip to content

Commit

Permalink
Merge branch 'release/candidate' into fix/update-api-version-on-startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Dec 3, 2024
2 parents ceabecb + ec33458 commit 4733df0
Show file tree
Hide file tree
Showing 95 changed files with 1,091 additions and 692 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
8 changes: 8 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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
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 @@ -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,7 +26,6 @@ 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
Expand All @@ -40,7 +39,6 @@ import com.wire.kalium.logic.data.user.UserAvailabilityStatus

@Suppress("LongMethod")
fun ConversationDetailsWithEvents.toConversationItem(
wireSessionImageLoader: WireSessionImageLoader,
userTypeMapper: UserTypeMapper,
searchQuery: String,
): ConversationItem = when (val conversationDetails = this.conversationDetails) {
Expand Down Expand Up @@ -71,7 +69,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 @@ -107,7 +105,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,15 @@ 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
) {
class OtherAccountMapper @Inject constructor() {
fun toOtherAccount(selfUser: SelfUser, team: Team?): OtherAccount = OtherAccount(
id = selfUser.id,
fullName = selfUser.name ?: "",
avatarData = selfUser.avatar(wireSessionImageLoader, selfUser.connectionStatus),
avatarData = selfUser.avatar(selfUser.connectionStatus),
teamName = team?.name
)
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package com.wire.android.mapper
import com.wire.android.ui.home.conversations.avatar
import com.wire.android.ui.home.conversations.details.participants.model.UIParticipant
import com.wire.android.ui.home.conversations.previewAsset
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.message.UserSummary
import com.wire.kalium.logic.data.message.reaction.MessageReaction
import com.wire.kalium.logic.data.message.receipt.DetailedReceipt
Expand All @@ -33,7 +32,6 @@ import javax.inject.Inject

class UIParticipantMapper @Inject constructor(
private val userTypeMapper: UserTypeMapper,
private val wireSessionImageLoader: WireSessionImageLoader
) {
fun toUIParticipant(user: User, isMLSVerified: Boolean = false): UIParticipant = with(user) {
val (userType, connectionState, unavailable) = when (this) {
Expand All @@ -45,7 +43,7 @@ class UIParticipantMapper @Inject constructor(
id = id,
name = name.orEmpty(),
handle = handle.orEmpty(),
avatarData = avatar(wireSessionImageLoader, connectionState),
avatarData = avatar(connectionState),
isSelf = user is SelfUser,
isService = userType == UserType.SERVICE,
membership = userTypeMapper.toMembership(userType),
Expand All @@ -67,7 +65,7 @@ class UIParticipantMapper @Inject constructor(
id = userSummary.userId,
name = userSummary.userName.orEmpty(),
handle = userSummary.userHandle.orEmpty(),
avatarData = userSummary.previewAsset(wireSessionImageLoader),
avatarData = userSummary.previewAsset(),
membership = userTypeMapper.toMembership(userSummary.userType),
unavailable = !userSummary.isUserDeleted && userSummary.userName.orEmpty().isEmpty(),
isDeleted = userSummary.isUserDeleted,
Expand All @@ -83,7 +81,7 @@ class UIParticipantMapper @Inject constructor(
id = userSummary.userId,
name = userSummary.userName.orEmpty(),
handle = userSummary.userHandle.orEmpty(),
avatarData = userSummary.previewAsset(wireSessionImageLoader),
avatarData = userSummary.previewAsset(),
membership = userTypeMapper.toMembership(userSummary.userType),
unavailable = !userSummary.isUserDeleted && userSummary.userName.orEmpty().isEmpty(),
isDeleted = userSummary.isUserDeleted,
Expand All @@ -100,7 +98,7 @@ class UIParticipantMapper @Inject constructor(
id = userSummary.userId,
name = userSummary.userName.orEmpty(),
handle = userSummary.userHandle.orEmpty(),
avatarData = previewAsset(wireSessionImageLoader),
avatarData = previewAsset(),
membership = userTypeMapper.toMembership(userSummary.userType),
unavailable = !userSummary.isUserDeleted && userSummary.userName.orEmpty().isEmpty(),
isDeleted = userSummary.isUserDeleted,
Expand Down
Loading

0 comments on commit 4733df0

Please sign in to comment.