Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mls epic #1953

Merged
merged 9 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ class UseCaseModule {
fun provideUpdateApiVersionsUseCase(@KaliumCoreLogic coreLogic: CoreLogic) =
coreLogic.getGlobalScope().updateApiVersions

@ViewModelScoped
@Provides
fun provideDisableEventProcessing(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
coreLogic.getSessionScope(currentAccount).debug.disableEventProcessing

@ViewModelScoped
@Provides
fun provideCurrentSessionFlowUseCase(@KaliumCoreLogic coreLogic: CoreLogic) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
is MessageContent.NewConversationReceiptMode -> mapNewConversationReceiptMode(content)
is MessageContent.ConversationReceiptModeChanged -> mapConversationReceiptModeChanged(message.senderUserId, content, members)
is MessageContent.HistoryLost -> mapConversationHistoryLost()
is MessageContent.HistoryLostProtocolChanged -> mapConversationHistoryListProtocolChanged()
is MessageContent.ConversationMessageTimerChanged -> mapConversationTimerChanged(message.senderUserId, content, members)
is MessageContent.ConversationCreated -> mapConversationCreated(message.senderUserId, message.date, members)
is MessageContent.MLSWrongEpochWarning -> mapMLSWrongEpochWarning()
Expand All @@ -68,6 +69,7 @@
is MessageContent.ConversationVerifiedMLS -> mapConversationVerified(Conversation.Protocol.MLS)
is MessageContent.ConversationVerifiedProteus -> mapConversationVerified(Conversation.Protocol.PROTEUS)
is MessageContent.FederationStopped -> mapFederationMessage(content)
is MessageContent.ConversationProtocolChanged -> mapConversationProtocolChanged(content)

Check warning on line 72 in app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt#L72

Added line #L72 was not covered by tests
}

private fun mapConversationCreated(senderUserId: UserId, date: String, userList: List<User>): UIMessageContent.SystemMessage {
Expand Down Expand Up @@ -108,6 +110,12 @@
}
}

private fun mapConversationProtocolChanged(
content: MessageContent.ConversationProtocolChanged
): UIMessageContent.SystemMessage {
return UIMessageContent.SystemMessage.ConversationProtocolChanged(content.protocol)

Check warning on line 116 in app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt#L116

Added line #L116 was not covered by tests
}

private fun mapResetSession(
senderUserId: UserId,
userList: List<User>
Expand Down Expand Up @@ -236,11 +244,14 @@
is MessageContent.FederationStopped.Removed -> UIMessageContent.SystemMessage.FederationStopped(listOf(content.domain))
}

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

Check warning on line 248 in app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt#L248

Added line #L248 was not covered by tests
private fun mapMLSWrongEpochWarning(): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.MLSWrongEpochWarning()

Check warning on line 250 in app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt#L250

Added line #L250 was not covered by tests
private fun mapConversationHistoryListProtocolChanged(): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.HistoryLostProtocolChanged

Check warning on line 252 in app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt#L252

Added line #L252 was not covered by tests
private fun mapConversationDegraded(protocol: Conversation.Protocol): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.ConversationDegraded(protocol)

private fun mapConversationVerified(protocol: Conversation.Protocol): UIMessageContent.SystemMessage =
UIMessageContent.SystemMessage.ConversationVerified(protocol)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
botService = (user as? OtherUser)?.botService,
isDefederated = (user is OtherUser && user.defederated),
isProteusVerified = (user is OtherUser && user.isProteusVerified),
supportedProtocolList = supportedProtocols.orEmpty().toList()
)
}

Expand All @@ -71,7 +72,8 @@
isDeleted = userSummary.isUserDeleted,
isSelf = isSelfUser,
isDefederated = false,
isProteusVerified = false
isProteusVerified = false,
supportedProtocolList = listOf()

Check warning on line 76 in app/src/main/kotlin/com/wire/android/mapper/UIParticipantMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/UIParticipantMapper.kt#L75-L76

Added lines #L75 - L76 were not covered by tests
)
}

Expand All @@ -87,7 +89,8 @@
isSelf = false,
readReceiptDate = date,
isDefederated = false,
isProteusVerified = false
isProteusVerified = false,
supportedProtocolList = listOf()

Check warning on line 93 in app/src/main/kotlin/com/wire/android/mapper/UIParticipantMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/mapper/UIParticipantMapper.kt#L92-L93

Added lines #L92 - L93 were not covered by tests
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.wire.kalium.logic.data.user.OtherUser
import com.wire.kalium.logic.data.user.SelfUser
import com.wire.kalium.logic.data.user.SsoId
import com.wire.kalium.logic.data.user.SupportedProtocol
import com.wire.kalium.logic.data.user.UserAvailabilityStatus
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.data.user.type.UserType
Expand Down Expand Up @@ -203,7 +204,8 @@
connectionStatus = ConnectionState.ACCEPTED,
previewPicture = scalaUserData.pictureAssetId?.let { toQualifiedId(it, scalaUserData.domain, selfuser) },
completePicture = scalaUserData.pictureAssetId?.let { toQualifiedId(it, scalaUserData.domain, selfuser) },
availabilityStatus = mapUserAvailabilityStatus(scalaUserData.availability)
availabilityStatus = mapUserAvailabilityStatus(scalaUserData.availability),
supportedProtocols = setOf(SupportedProtocol.PROTEUS)

Check warning on line 208 in app/src/main/kotlin/com/wire/android/migration/MigrationMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/migration/MigrationMapper.kt#L207-L208

Added lines #L207 - L208 were not covered by tests
)
} else {
val botService =
Expand Down Expand Up @@ -232,7 +234,8 @@
botService = botService,
deleted = scalaUserData.deleted,
defederated = false,
isProteusVerified = false
isProteusVerified = false,
supportedProtocols = setOf(SupportedProtocol.PROTEUS)

Check warning on line 238 in app/src/main/kotlin/com/wire/android/migration/MigrationMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/migration/MigrationMapper.kt#L237-L238

Added lines #L237 - L238 were not covered by tests
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.wire.android.R
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.util.ui.PreviewMultipleThemes

/**
* Outlined box with a text inside.
Expand All @@ -46,17 +47,24 @@ import com.wire.android.ui.theme.wireColorScheme
@Composable
fun StatusBox(
statusText: String,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
textColor: Color = MaterialTheme.wireColorScheme.labelText,
badgeColor: Color = MaterialTheme.wireColorScheme.surface,
withBorder: Boolean = true,
) {
Box(
modifier = modifier
.wrapContentSize()
.clip(RoundedCornerShape(size = dimensions().spacing4x))
.background(colorsScheme().surface)
.background(badgeColor)
.border(
BorderStroke(
width = 1.dp,
color = MaterialTheme.wireColorScheme.divider
color = if (withBorder) {
MaterialTheme.wireColorScheme.divider
} else {
badgeColor
}
),
shape = RoundedCornerShape(size = dimensions().spacing4x),
)
Expand All @@ -68,7 +76,7 @@ fun StatusBox(
) {
Text(
text = statusText,
style = typography().label03.copy(color = MaterialTheme.wireColorScheme.labelText)
style = typography().label03.copy(color = textColor)
)
}
}
Expand All @@ -81,8 +89,28 @@ fun DeletedLabel(modifier: Modifier = Modifier) {
)
}

@Preview
@Composable
fun ProtocolLabel(
protocolName: String,
modifier: Modifier = Modifier
) {
StatusBox(
statusText = protocolName,
modifier = modifier,
textColor = MaterialTheme.wireColorScheme.onPrimary,
badgeColor = MaterialTheme.wireColorScheme.primary,
withBorder = false
)
}

@PreviewMultipleThemes
@Composable
fun PreviewDeletedLabel() {
DeletedLabel()
}

@PreviewMultipleThemes
@Composable
fun PreviewProtocolLabel() {
ProtocolLabel("MLS")
}