Skip to content

Commit

Permalink
chore: replace deprecated functions (#2931)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine authored Apr 25, 2024
1 parent aefe51b commit de5104b
Show file tree
Hide file tree
Showing 27 changed files with 72 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import com.wire.kalium.logic.data.user.OtherUser
import com.wire.kalium.logic.data.user.SelfUser
import com.wire.kalium.logic.data.user.User
import com.wire.kalium.logic.data.user.UserId
import java.util.Locale
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds

Expand Down Expand Up @@ -82,7 +83,7 @@ class SystemMessageContentMapper @Inject constructor(
return UIMessageContent.SystemMessage.ConversationMessageCreated(
author = authorName,
isAuthorSelfUser = sender is SelfUser,
date.formatFullDateShortTime().orDefault(date).toUpperCase()
date.formatFullDateShortTime().orDefault(date).uppercase(Locale.getDefault())
)
}

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 @@ -254,7 +254,7 @@ class WireActivity : AppCompatActivity() {
}

DisposableEffect(navController) {
val updateScreenSettingsListener = NavController.OnDestinationChangedListener { _, navDestination, _ ->
val updateScreenSettingsListener = NavController.OnDestinationChangedListener { _, _, _ ->
currentKeyboardController?.hide()
}
navController.addOnDestinationChangedListener(updateScreenSettingsListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -73,7 +73,7 @@ private fun ProxyContent(
Column(
modifier = Modifier
) {
Divider(color = MaterialTheme.wireColorScheme.divider, thickness = Dp.Hairline)
HorizontalDivider(thickness = Dp.Hairline, color = MaterialTheme.wireColorScheme.divider)
Text(
text = stringResource(R.string.label_proxy_credentials),
style = MaterialTheme.wireTypography.title03.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ fun LoginSSOScreen(
// TODO: replace with retrieved ServerConfig from sso login
onLoginButtonClick = loginSSOViewModel::login,
ssoLoginResult = ssoLoginResult,
serverTitle = loginSSOViewModel.serverConfig.title,
onCustomServerDialogDismiss = loginSSOViewModel::onCustomServerDialogDismiss,
onCustomServerDialogConfirm = loginSSOViewModel::onCustomServerDialogConfirm
)
Expand All @@ -105,8 +104,7 @@ private fun LoginSSOContent(
onLoginButtonClick: () -> Unit,
onCustomServerDialogDismiss: () -> Unit,
onCustomServerDialogConfirm: () -> Unit,
ssoLoginResult: DeepLinkResult.SSOLogin?,
serverTitle: String
ssoLoginResult: DeepLinkResult.SSOLogin?
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -188,6 +186,6 @@ private fun LoginButton(modifier: Modifier, loading: Boolean, enabled: Boolean,
@Composable
fun PreviewLoginSSOScreen() {
WireTheme {
LoginSSOContent(rememberScrollState(), LoginState(), {}, {}, {}, {}, {}, {}, null, "Test Server")
LoginSSOContent(rememberScrollState(), LoginState(), {}, {}, {}, {}, {}, {}, null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ExpandMore
import androidx.compose.material3.Divider
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand Down Expand Up @@ -185,7 +185,7 @@ private fun MenuPopUp(
)

List(items.size) { index ->
Divider(
HorizontalDivider(
color = colorsScheme().divider
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
Expand Down Expand Up @@ -85,7 +85,7 @@ private fun SecurityClassificationBanner(
) {
if (state != SecurityClassificationType.NONE) {
Column(modifier = modifier) {
Divider(color = getDividerColorFor(state))
HorizontalDivider(color = getDividerColorFor(state))
Row(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
Expand All @@ -106,7 +106,7 @@ private fun SecurityClassificationBanner(
style = MaterialTheme.wireTypography.label03
)
}
Divider(color = getDividerColorFor(state))
HorizontalDivider(color = getDividerColorFor(state))
}
}
}
Expand Down Expand Up @@ -165,11 +165,11 @@ fun PreviewClassifiedIndicator() {
SecurityClassificationBanner(
state = SecurityClassificationType.NONE
)
Divider()
HorizontalDivider()
SecurityClassificationBanner(
state = SecurityClassificationType.NOT_CLASSIFIED
)
Divider()
HorizontalDivider()
SecurityClassificationBanner(
state = SecurityClassificationType.CLASSIFIED
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class HandleDraggableBottomSheetDialog : AppCompatDialog {
}
}
)
bottomSheet!!.setOnTouchListener { _, event -> // Consume the event and prevent it from falling through
bottomSheet!!.setOnTouchListener { _, _ -> // Consume the event and prevent it from falling through
true
}
return container
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/wire/android/ui/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fun HomeScreen(
val lifecycleOwner = LocalLifecycleOwner.current

DisposableEffect(lifecycleOwner) {
val observer = LifecycleEventObserver { source, event ->
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
appSyncViewModel.startSyncingAppConfig()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -220,7 +220,7 @@ private fun GroupNameItem(
onLongClick = { /* not handled */ }),
arrowType = if (!canBeChanged) ArrowType.NONE else ArrowType.CENTER_ALIGNED
)
Divider(color = MaterialTheme.wireColorScheme.divider, thickness = Dp.Hairline)
HorizontalDivider(thickness = Dp.Hairline, color = MaterialTheme.wireColorScheme.divider)
}

@Composable
Expand All @@ -230,7 +230,7 @@ private fun ProtocolDetails(label: UIText, text: UIText) {
title = text.asString(),
arrowType = ArrowType.NONE
)
Divider(color = MaterialTheme.wireColorScheme.divider, thickness = Dp.Hairline)
HorizontalDivider(thickness = Dp.Hairline, color = MaterialTheme.wireColorScheme.divider)
}

@Composable
Expand Down Expand Up @@ -289,7 +289,7 @@ fun GroupOptionWithSwitch(
},
arrowType = ArrowType.NONE
)
Divider(color = MaterialTheme.wireColorScheme.divider, thickness = Dp.Hairline)
HorizontalDivider(thickness = Dp.Hairline, color = MaterialTheme.wireColorScheme.divider)
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.wire.android.ui.home.conversations.details.participants

import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -34,6 +35,7 @@ import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand Down Expand Up @@ -71,7 +73,7 @@ fun GroupConversationParticipants(
) {
val groupParticipants = groupParticipantsState.data.allParticipants
MLSProgressIndicator(
progress = (groupParticipants)
mlsProgress = (groupParticipants)
.filter { it.supportedProtocolList.contains(SupportedProtocol.MLS) }
.size / (groupParticipantsState.data.allCount).toFloat(),
modifier = Modifier
Expand All @@ -87,11 +89,13 @@ fun GroupConversationParticipants(

@Composable
fun MLSProgressIndicator(
progress: Float,
mlsProgress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.wireColorScheme.primary,
trackColor: Color = MaterialTheme.wireColorScheme.uncheckedColor
) {
val progress by animateFloatAsState(targetValue = mlsProgress)

Box(
modifier = modifier
.fillMaxWidth()
Expand All @@ -100,16 +104,16 @@ fun MLSProgressIndicator(
contentAlignment = Alignment.Center
) {
LinearProgressIndicator(
progress = progress,
progress = { progress },
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(),
color = color,
trackColor = trackColor
trackColor = trackColor,
)
Text(
style = MaterialTheme.typography.labelLarge,
text = "${SupportedProtocol.MLS.name} (${String.format("%.2f", progress * 100)}%)",
text = "${SupportedProtocol.MLS.name} (${String.format("%.2f", mlsProgress * 100)}%)",
textAlign = TextAlign.Center,
color = MaterialTheme.wireColorScheme.onPrimary,
modifier = Modifier.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ fun ConversationRouterHomeBridge(
callHistory = callHistory,
onCallItemClick = onOpenConversation,
onEditConversationItem = onEditConversationItem,
onOpenUserProfile = onOpenUserProfile,
openConversationNotificationsSettings = onEditNotifications
onOpenUserProfile = onOpenUserProfile
)

ConversationItemType.MENTIONS ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ fun CallsScreenContent(
callHistory: List<ConversationItem> = emptyList(),
onCallItemClick: (ConversationId) -> Unit,
onEditConversationItem: (ConversationItem) -> Unit,
onOpenUserProfile: (UserId) -> Unit,
openConversationNotificationsSettings: (ConversationItem) -> Unit,
onOpenUserProfile: (UserId) -> Unit
) {
val lazyListState = rememberLazyListState()

Expand All @@ -72,8 +71,7 @@ fun CallsScreenContent(
callHistory = callHistory,
onCallItemClick = onCallItemClick,
onEditConversationItem = onEditConversationItem,
onOpenUserProfile = onOpenUserProfile,
openConversationNotificationsSettings = openConversationNotificationsSettings,
onOpenUserProfile = onOpenUserProfile
)
}

Expand All @@ -84,8 +82,7 @@ fun CallContent(
callHistory: List<ConversationItem>,
onCallItemClick: (ConversationId) -> Unit,
onEditConversationItem: (ConversationItem) -> Unit,
onOpenUserProfile: (UserId) -> Unit,
openConversationNotificationsSettings: (ConversationItem) -> Unit
onOpenUserProfile: (UserId) -> Unit
) {
val context = LocalContext.current
LazyColumn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand Down Expand Up @@ -66,7 +66,7 @@ fun ConversationList(
* it so it wants to keep this dummy top item as the first one on list and show all other items below it.
*/
item("empty-top-header") {
Divider(
HorizontalDivider(
thickness = Dp.Hairline,
color = Color.Transparent
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ fun MentionScreenContent(
onMentionItemClick = onMentionItemClick,
onEditConversationItem = onEditConversationItem,
onOpenUserProfile = onOpenUserProfile,
openConversationNotificationsSettings = openConversationNotificationsSettings,
)
}

Expand All @@ -85,7 +84,6 @@ private fun MentionContent(
onMentionItemClick: (ConversationId) -> Unit,
onEditConversationItem: (ConversationItem) -> Unit,
onOpenUserProfile: (UserId) -> Unit,
openConversationNotificationsSettings: (ConversationItem) -> Unit,
) {
val context = LocalContext.current
LazyColumn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import androidx.compose.ui.layout.ContentScale
import com.wire.android.model.ImageAsset

@Composable
fun ZoomableImage(imageAsset: ImageAsset.Remote, contentDescription: String, imageScale: Float = 1.0f) {
fun ZoomableImage(imageAsset: ImageAsset.Remote, contentDescription: String) {
var offsetX by remember { mutableStateOf(0f) }
var offsetY by remember { mutableStateOf(0f) }
var zoom by remember { mutableStateOf(1f) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -161,7 +161,7 @@ fun AttachmentAndAdditionalOptionsMenuItems(
modifier: Modifier = Modifier
) {
Column(modifier.wrapContentSize()) {
Divider(color = MaterialTheme.wireColorScheme.outline)
HorizontalDivider(color = MaterialTheme.wireColorScheme.outline)
MessageComposeActions(
isEditing = isEditing,
selectedOption = selectedOption,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private fun calculateMaxHeight(
val baseHeightInt = with(density) { defaultMaxHeightDropdownMenu.toPx().toInt() }

var sum = with(density) { DropdownMenuVerticalPadding.toPx().toInt() } * TWO
for ((i, itemSize) in itemHeights.toSortedMap()) {
for ((_, itemSize) in itemHeights.toSortedMap()) {
sum += itemSize
if (sum >= baseHeightInt) {
return with(density) { (sum - itemSize / TWO).toDp() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package com.wire.android.ui.home.messagecomposer

import androidx.compose.foundation.background
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -38,7 +38,9 @@ fun MembersMentionList(
onMentionPicked: (Contact) -> Unit,
modifier: Modifier
) {
if (membersToMention.isNotEmpty()) Divider()
if (membersToMention.isNotEmpty()) {
HorizontalDivider()
}
LazyColumn(
modifier = modifier.background(colorsScheme().background),
reverseLayout = true
Expand All @@ -55,9 +57,9 @@ fun MembersMentionList(
searchQuery = searchQuery,
modifier = Modifier
)
Divider(
color = MaterialTheme.wireColorScheme.divider,
thickness = Dp.Hairline
HorizontalDivider(
thickness = Dp.Hairline,
color = MaterialTheme.wireColorScheme.divider
)
}
}
Expand Down
Loading

0 comments on commit de5104b

Please sign in to comment.