Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0 * Run `./gradlew ktlintFormat` and fix some issues manually. * Fix other issues reproted by Ktlint * Limit false positives, KtLint removes unnecessary curly brace in String templates. * Remove useless Unit * Minor improvements over ktlint changes * Restore `AlertDialogContent` behaviour * Update screenshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
675cc525cf
commit
7e9cda3aa9
442 changed files with 1091 additions and 1081 deletions
|
|
@ -36,4 +36,3 @@ fun Context.isScreenReaderEnabled(): Boolean {
|
|||
it.isEnabled && it.isTouchExplorationEnabled
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ fun PackageManager.getApplicationInfoCompat(packageName: String, flags: Int): Ap
|
|||
packageName,
|
||||
PackageManager.ApplicationInfoFlags.of(flags.toLong())
|
||||
)
|
||||
else -> @Suppress("DEPRECATION") getApplicationInfo(packageName, flags)
|
||||
else -> getApplicationInfo(packageName, flags)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ fun String.hash() = try {
|
|||
val digest = MessageDigest.getInstance("SHA-512")
|
||||
digest.update(toByteArray())
|
||||
digest.digest()
|
||||
.joinToString("") { String.format(Locale.ROOT, "%02X", it) }
|
||||
.lowercase(Locale.ROOT)
|
||||
.joinToString("") { String.format(Locale.ROOT, "%02X", it) }
|
||||
.lowercase(Locale.ROOT)
|
||||
} catch (exc: Exception) {
|
||||
// Should not happen, but just in case
|
||||
hashCode().toString()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.androidutils.filesize
|
||||
package io.element.android.libraries.androidutils.filesize
|
||||
|
||||
import android.os.Build
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import io.element.android.libraries.architecture.overlay.operation.Hide
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class HideOverlayBackPressHandler<NavTarget : Any>
|
||||
: BaseBackPressHandlerStrategy<NavTarget, BackStack.State>() {
|
||||
class HideOverlayBackPressHandler<NavTarget : Any> :
|
||||
BaseBackPressHandlerStrategy<NavTarget, BackStack.State>() {
|
||||
|
||||
override val canHandleBackPressFlow: Flow<Boolean> by lazy {
|
||||
navModel.elements.map(::areThereElements)
|
||||
|
|
|
|||
|
|
@ -50,5 +50,4 @@ class AESEncryptionDecryptionServiceTest {
|
|||
encryptionDecryptionService.decrypt(decryptionKey, encryptionResult)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import dagger.Provides
|
|||
import io.element.android.libraries.di.AppScope
|
||||
import kotlinx.datetime.Clock
|
||||
import kotlinx.datetime.TimeZone
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
@Module
|
||||
@ContributesTo(AppScope::class)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ import io.element.android.libraries.androidutils.system.startSharePlainTextInten
|
|||
import io.element.android.libraries.core.meta.BuildMeta
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import io.element.android.services.toolbox.api.strings.StringProvider
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import io.element.android.libraries.androidutils.R as AndroidUtilsR
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
class InviteFriendsUseCase @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ import io.element.android.libraries.designsystem.R
|
|||
import io.element.android.libraries.designsystem.modifiers.blurCompat
|
||||
import io.element.android.libraries.designsystem.modifiers.blurredShapeShadow
|
||||
import io.element.android.libraries.designsystem.modifiers.canUseBlurMaskFilter
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
||||
@Composable
|
||||
fun ElementLogoAtom(
|
||||
|
|
@ -49,7 +49,6 @@ fun ElementLogoAtom(
|
|||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
) {
|
||||
val blur = if (darkTheme) 160.dp else 24.dp
|
||||
//box-shadow: 0px 6.075949668884277px 24.30379867553711px 0px #1B1D2280;
|
||||
val shadowColor = if (darkTheme) size.shadowColorDark else size.shadowColorLight
|
||||
val logoShadowColor = if (darkTheme) size.logoShadowColorDark else size.logoShadowColorLight
|
||||
val backgroundColor = if (darkTheme) Color.White.copy(alpha = 0.2f) else Color.White.copy(alpha = 0.4f)
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.theme.placeholderBackground
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.placeholderBackground
|
||||
|
||||
@Composable
|
||||
fun PlaceholderAtom(
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun RedIndicatorAtom(
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
/**
|
||||
* RoundedIconAtom is an atom which displays an icon inside a rounded container.
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.theme.unreadIndicator
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.unreadIndicator
|
||||
|
||||
@Composable
|
||||
fun UnreadIndicatorAtom(
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Button
|
||||
import io.element.android.libraries.designsystem.theme.components.OutlinedButton
|
||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import androidx.compose.foundation.layout.RowScope
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
|||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.atomic.molecules.InfoListItemMolecule
|
||||
import io.element.android.libraries.designsystem.atomic.molecules.InfoListItemPosition
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Scaffold
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
/**
|
||||
* @param modifier Classical modifier.
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.R
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.R
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
|
||||
/**
|
||||
* Page for onboarding screens, with content and optional footer.
|
||||
|
|
|
|||
|
|
@ -22,4 +22,3 @@ data class AvatarColors(
|
|||
val background: Color,
|
||||
val foreground: Color,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -184,4 +184,3 @@ private fun ContentToPreview() {
|
|||
interactionSource = remember { MutableInteractionSource() },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.OutlinedTextField
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun LabelledOutlinedTextField(
|
||||
|
|
@ -83,4 +83,3 @@ internal fun LabelledOutlinedTextFieldPreview() = ElementPreview {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.designsystem.theme.components.TextField
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun LabelledTextField(
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.R
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.R
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
|
||||
@Composable
|
||||
fun PinIcon(
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ import androidx.compose.ui.tooling.preview.Preview
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import io.element.android.libraries.designsystem.theme.components.DialogPreview
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
||||
import io.element.android.libraries.designsystem.theme.components.DialogPreview
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.designsystem.theme.components.TextButton
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Button
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.airbnb.android.showkase.annotation.ShowkaseComposable
|
||||
import io.element.android.libraries.designsystem.components.list.CheckboxListItem
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.DialogPreview
|
||||
import io.element.android.libraries.designsystem.theme.components.ListSupportingText
|
||||
import io.element.android.libraries.designsystem.theme.components.SimpleAlertDialogContent
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.dp
|
||||
import com.airbnb.android.showkase.annotation.ShowkaseComposable
|
||||
import io.element.android.libraries.designsystem.components.list.RadioButtonListItem
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.DialogPreview
|
||||
import io.element.android.libraries.designsystem.theme.components.ListSupportingText
|
||||
import io.element.android.libraries.designsystem.theme.components.SimpleAlertDialogContent
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ internal fun SingleSelectionListItemCustomFormattertPreview() {
|
|||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
supportingText = "Supporting text",
|
||||
onSelectionChanged = {},
|
||||
resultFormatter = { "Selected index: $it"},
|
||||
resultFormatter = { "Selected index: $it" },
|
||||
selected = 1,
|
||||
displayResultInTrailingContent = true,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.OutlinedTextField
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun TextFieldListItem(
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ fun WaveformPlaybackView(
|
|||
requestDisallowInterceptTouchEvent.invoke(true)
|
||||
seekProgress.value = e.x / waveformWidthPx
|
||||
true
|
||||
} else false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
if (e.x in 0F..waveformWidthPx) {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.icons.CompoundDrawables
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.icons.CompoundDrawables
|
||||
|
||||
@Composable
|
||||
fun PreferenceCategory(
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ package io.element.android.libraries.designsystem.components.preferences
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.HorizontalDivider
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun PreferenceDivider(
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ internal class OtherIconListPreviewProvider : PreviewParameterProvider<IconChunk
|
|||
get() {
|
||||
val chunks = iconsOther.chunked(36)
|
||||
return chunks.mapIndexed { index, chunk ->
|
||||
IconChunk(index = index+1, total = chunks.size, icons = chunk.toPersistentList())
|
||||
IconChunk(index = index + 1, total = chunks.size, icons = chunk.toPersistentList())
|
||||
}
|
||||
.asSequence()
|
||||
}
|
||||
|
|
@ -76,7 +76,8 @@ internal fun IconsCompoundPreview(@PreviewParameter(CompoundIconListPreviewProvi
|
|||
iconNameTransform = { name ->
|
||||
name.removePrefix("ic_compound_")
|
||||
.replace("_", " ")
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@PreviewsDayNight
|
||||
|
|
@ -88,7 +89,8 @@ internal fun IconsOtherPreview(@PreviewParameter(OtherIconListPreviewProvider::c
|
|||
iconNameTransform = { name ->
|
||||
name.removePrefix("ic_")
|
||||
.replace("_", " ")
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -78,10 +78,11 @@ fun Modifier.circularReveal(
|
|||
val path = Path()
|
||||
val center = revealFrom.mapTo(size)
|
||||
val radius = calculateRadius(revealFrom, size)
|
||||
val scrimColor = if (showScrim)
|
||||
val scrimColor = if (showScrim) {
|
||||
Color.Gray
|
||||
else
|
||||
} else {
|
||||
Color.Transparent
|
||||
}
|
||||
|
||||
path.addOval(Rect(center, radius * transitionProgress.value))
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ package io.element.android.libraries.designsystem.preview
|
|||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||
|
||||
@Composable
|
||||
@Suppress("ModifierMissing")
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
||||
/**
|
||||
* Horizontal ruler is a debug composable that displays a horizontal ruler.
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
||||
/**
|
||||
* Vertical ruler is a debug composable that displays a vertical ruler.
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.layout.Layout
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.ButtonSize
|
||||
import io.element.android.libraries.designsystem.theme.components.OutlinedButton
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ import androidx.compose.ui.platform.LocalDensity
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.preview.WithFontScale
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
/**
|
||||
* Return the maximum value between the receiver value and the value with fontScale applied.
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ val SemanticColors.pinDigitBg
|
|||
}
|
||||
|
||||
val SemanticColors.currentUserMentionPillText
|
||||
get() = if (isLight) {
|
||||
get() = if (isLight) {
|
||||
// We want LightDesignTokens.colorGreen1100
|
||||
Color(0xff005c45)
|
||||
} else {
|
||||
|
|
@ -118,7 +118,7 @@ val SemanticColors.currentUserMentionPillText
|
|||
}
|
||||
|
||||
val SemanticColors.currentUserMentionPillBackground
|
||||
get() = if (isLight) {
|
||||
get() = if (isLight) {
|
||||
// We want LightDesignTokens.colorGreenAlpha400
|
||||
Color(0x3b07b661)
|
||||
} else {
|
||||
|
|
@ -130,7 +130,7 @@ val SemanticColors.mentionPillText
|
|||
get() = textPrimary
|
||||
|
||||
val SemanticColors.mentionPillBackground
|
||||
get() = if (isLight) {
|
||||
get() = if (isLight) {
|
||||
// We want LightDesignTokens.colorGray400
|
||||
Color(0x1f052e61)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -232,10 +232,11 @@ internal fun AlertDialogContent(
|
|||
// Align the title to the center when an icon is present.
|
||||
Modifier
|
||||
.then(
|
||||
if (applyPaddingToContents)
|
||||
if (applyPaddingToContents) {
|
||||
Modifier
|
||||
else
|
||||
} else {
|
||||
Modifier.padding(DialogContentDefaults.externalHorizontalPadding)
|
||||
}
|
||||
)
|
||||
.padding(DialogContentDefaults.titlePadding)
|
||||
.align(
|
||||
|
|
@ -364,8 +365,10 @@ private fun AlertDialogFlowRow(
|
|||
val mainAxisPositions = IntArray(childrenMainAxisSizes.size) { 0 }
|
||||
with(arrangement) {
|
||||
arrange(
|
||||
mainAxisLayoutSize, childrenMainAxisSizes,
|
||||
layoutDirection, mainAxisPositions
|
||||
mainAxisLayoutSize,
|
||||
childrenMainAxisSizes,
|
||||
layoutDirection,
|
||||
mainAxisPositions
|
||||
)
|
||||
}
|
||||
placeables.forEachIndexed { j, placeable ->
|
||||
|
|
@ -444,7 +447,8 @@ internal fun DialogWithTitleIconAndOkButtonPreview() {
|
|||
)
|
||||
},
|
||||
title = "Dialog Title",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made. Learn more",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
)
|
||||
|
|
@ -460,7 +464,8 @@ internal fun DialogWithTitleAndOkButtonPreview() {
|
|||
DialogPreview {
|
||||
SimpleAlertDialogContent(
|
||||
title = "Dialog Title",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made. Learn more",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
)
|
||||
|
|
@ -475,7 +480,8 @@ internal fun DialogWithOnlyMessageAndOkButtonPreview() {
|
|||
ElementThemedPreview(showBackground = false) {
|
||||
DialogPreview {
|
||||
SimpleAlertDialogContent(
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information, or prompt for a decision to be made. Learn more",
|
||||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
@Composable
|
||||
fun BottomSheetDragHandle(
|
||||
|
|
@ -68,7 +68,6 @@ fun BottomSheetDragHandle(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun BottomSheetDragHandlePreview() = ElementPreview {
|
||||
|
|
|
|||
|
|
@ -147,25 +147,29 @@ private fun ButtonInternal(
|
|||
val contentPadding = when (size) {
|
||||
ButtonSize.Medium -> when (style) {
|
||||
ButtonStyle.Filled,
|
||||
ButtonStyle.Outlined -> if (hasStartDrawable)
|
||||
ButtonStyle.Outlined -> if (hasStartDrawable) {
|
||||
PaddingValues(start = 16.dp, top = 10.dp, end = 24.dp, bottom = 10.dp)
|
||||
else
|
||||
} else {
|
||||
PaddingValues(start = 24.dp, top = 10.dp, end = 24.dp, bottom = 10.dp)
|
||||
ButtonStyle.Text -> if (hasStartDrawable)
|
||||
}
|
||||
ButtonStyle.Text -> if (hasStartDrawable) {
|
||||
PaddingValues(start = 12.dp, top = 10.dp, end = 16.dp, bottom = 10.dp)
|
||||
else
|
||||
} else {
|
||||
PaddingValues(start = 12.dp, top = 10.dp, end = 12.dp, bottom = 10.dp)
|
||||
}
|
||||
}
|
||||
ButtonSize.Large -> when (style) {
|
||||
ButtonStyle.Filled,
|
||||
ButtonStyle.Outlined -> if (hasStartDrawable)
|
||||
ButtonStyle.Outlined -> if (hasStartDrawable) {
|
||||
PaddingValues(start = 24.dp, top = 13.dp, end = 32.dp, bottom = 13.dp)
|
||||
else
|
||||
} else {
|
||||
PaddingValues(start = 32.dp, top = 13.dp, end = 32.dp, bottom = 13.dp)
|
||||
ButtonStyle.Text -> if (hasStartDrawable)
|
||||
}
|
||||
ButtonStyle.Text -> if (hasStartDrawable) {
|
||||
PaddingValues(start = 12.dp, top = 13.dp, end = 16.dp, bottom = 13.dp)
|
||||
else
|
||||
} else {
|
||||
PaddingValues(start = 16.dp, top = 13.dp, end = 16.dp, bottom = 13.dp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,12 +183,13 @@ private fun ButtonInternal(
|
|||
ButtonStyle.Filled -> null
|
||||
ButtonStyle.Outlined -> BorderStroke(
|
||||
width = 1.dp,
|
||||
color = if (destructive)
|
||||
color = if (destructive) {
|
||||
ElementTheme.colors.borderCriticalPrimary.copy(
|
||||
alpha = if (enabled) 1f else 0.5f
|
||||
)
|
||||
else
|
||||
} else {
|
||||
ElementTheme.colors.borderInteractiveSecondary
|
||||
}
|
||||
)
|
||||
ButtonStyle.Text -> null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.state.ToggleableState
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
// Designs in https://www.figma.com/file/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?type=design&mode=design&t=qb99xBP5mwwCtGkN-1
|
||||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ internal fun CircularProgressIndicatorPreview() = ElementThemedPreview(vertical
|
|||
private fun ContentToPreview() {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
// Indeterminate progress
|
||||
CircularProgressIndicator(
|
||||
)
|
||||
CircularProgressIndicator()
|
||||
// Fixed progress
|
||||
CircularProgressIndicator(
|
||||
progress = { 0.90F }
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ internal fun LinearProgressIndicatorPreview() = ElementThemedPreview(vertical =
|
|||
private fun ContentToPreview() {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
// Indeterminate progress
|
||||
LinearProgressIndicator(
|
||||
)
|
||||
LinearProgressIndicator()
|
||||
// Fixed progress
|
||||
LinearProgressIndicator(
|
||||
progress = { 0.90F }
|
||||
|
|
|
|||
|
|
@ -119,9 +119,13 @@ fun ListItem(
|
|||
|
||||
androidx.compose.material3.ListItem(
|
||||
headlineContent = decoratedHeadlineContent,
|
||||
modifier = if (onClick != null) Modifier
|
||||
.clickable(enabled = enabled, onClick = onClick)
|
||||
.then(modifier) else modifier,
|
||||
modifier = if (onClick != null) {
|
||||
Modifier
|
||||
.clickable(enabled = enabled, onClick = onClick)
|
||||
.then(modifier)
|
||||
} else {
|
||||
modifier
|
||||
},
|
||||
overlineContent = null,
|
||||
supportingContent = decoratedSupportingContent,
|
||||
leadingContent = decoratedLeadingContent,
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
// Designs: https://www.figma.com/file/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?type=design&node-id=425%3A24208&mode=design&t=G5hCfkLB6GgXDuWe-1
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ import androidx.compose.ui.graphics.Shape
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.preview.sheetStateForPreview
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
|
|
|||
|
|
@ -117,9 +117,12 @@ private fun ContentToPreview() {
|
|||
displayHandle = true,
|
||||
sheetState = ModalBottomSheetState(ModalBottomSheetValue.Expanded, density = LocalDensity.current),
|
||||
sheetContent = {
|
||||
Text(text = "Sheet Content", modifier = Modifier
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 20.dp)
|
||||
.background(color = Color.Green))
|
||||
Text(
|
||||
text = "Sheet Content",
|
||||
modifier = Modifier
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 20.dp)
|
||||
.background(color = Color.Green)
|
||||
)
|
||||
}
|
||||
) {
|
||||
Text(text = "Content", modifier = Modifier.background(color = Color.Red))
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import androidx.compose.runtime.setValue
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
|
||||
// Designs in https://www.figma.com/file/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?type=design&node-id=425%3A24202&mode=design&t=qb99xBP5mwwCtGkN-1
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import androidx.compose.material3.Switch as Material3Switch
|
||||
|
||||
// Designs in https://www.figma.com/file/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?type=design&node-id=425%3A24203&mode=design&t=qb99xBP5mwwCtGkN-1
|
||||
|
|
|
|||
|
|
@ -498,10 +498,10 @@ internal fun rememberSheetState(
|
|||
initialValue: SheetValue = SheetValue.Hidden,
|
||||
skipHiddenState: Boolean = false,
|
||||
): CustomSheetState {
|
||||
|
||||
val density = LocalDensity.current
|
||||
return rememberSaveable(
|
||||
skipPartiallyExpanded, confirmValueChange,
|
||||
skipPartiallyExpanded,
|
||||
confirmValueChange,
|
||||
saver = CustomSheetState.Saver(
|
||||
skipPartiallyExpanded = skipPartiallyExpanded,
|
||||
confirmValueChange = confirmValueChange,
|
||||
|
|
|
|||
|
|
@ -35,15 +35,17 @@ import kotlinx.coroutines.CancellationException
|
|||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Stable
|
||||
@ExperimentalMaterial3Api
|
||||
class CustomSheetState @Deprecated(
|
||||
class CustomSheetState
|
||||
@Deprecated(
|
||||
message = "This constructor is deprecated. " +
|
||||
"Please use the constructor that provides a [Density]",
|
||||
"Please use the constructor that provides a [Density]",
|
||||
replaceWith = ReplaceWith(
|
||||
"SheetState(" +
|
||||
"skipPartiallyExpanded, LocalDensity.current, initialValue, " +
|
||||
"confirmValueChange, skipHiddenState)"
|
||||
"skipPartiallyExpanded, LocalDensity.current, initialValue, " +
|
||||
"confirmValueChange, skipHiddenState)"
|
||||
)
|
||||
) constructor(
|
||||
)
|
||||
constructor(
|
||||
internal val skipPartiallyExpanded: Boolean,
|
||||
initialValue: SheetValue = Hidden,
|
||||
confirmValueChange: (SheetValue) -> Boolean = { true },
|
||||
|
|
@ -77,11 +79,12 @@ class CustomSheetState @Deprecated(
|
|||
) : this(skipPartiallyExpanded, initialValue, confirmValueChange, skipHiddenState) {
|
||||
this.density = density
|
||||
}
|
||||
|
||||
init {
|
||||
if (skipPartiallyExpanded) {
|
||||
require(initialValue != PartiallyExpanded) {
|
||||
"The initial value must not be set to PartiallyExpanded if skipPartiallyExpanded " +
|
||||
"is set to true."
|
||||
"is set to true."
|
||||
}
|
||||
}
|
||||
if (skipHiddenState) {
|
||||
|
|
@ -168,7 +171,7 @@ class CustomSheetState @Deprecated(
|
|||
suspend fun partialExpand() {
|
||||
check(!skipPartiallyExpanded) {
|
||||
"Attempted to animate to partial expanded when skipPartiallyExpanded was enabled. Set" +
|
||||
" skipPartiallyExpanded to false to use this function."
|
||||
" skipPartiallyExpanded to false to use this function."
|
||||
}
|
||||
animateTo(PartiallyExpanded)
|
||||
}
|
||||
|
|
@ -194,7 +197,7 @@ class CustomSheetState @Deprecated(
|
|||
suspend fun hide() {
|
||||
check(!skipHiddenState) {
|
||||
"Attempted to animate to hidden when skipHiddenState was enabled. Set skipHiddenState" +
|
||||
" to false to use this function."
|
||||
" to false to use this function."
|
||||
}
|
||||
animateTo(Hidden)
|
||||
}
|
||||
|
|
@ -254,7 +257,7 @@ class CustomSheetState @Deprecated(
|
|||
internal var density: Density? = null
|
||||
private fun requireDensity() = requireNotNull(density) {
|
||||
"SheetState did not have a density attached. Are you using SheetState with " +
|
||||
"BottomSheetScaffold or ModalBottomSheet component?"
|
||||
"BottomSheetScaffold or ModalBottomSheet component?"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
@ -278,7 +281,7 @@ class CustomSheetState @Deprecated(
|
|||
*/
|
||||
@Deprecated(
|
||||
message = "This function is deprecated. Please use the overload where Density is" +
|
||||
" provided.",
|
||||
" provided.",
|
||||
replaceWith = ReplaceWith(
|
||||
"Saver(skipPartiallyExpanded, confirmValueChange, LocalDensity.current)"
|
||||
)
|
||||
|
|
@ -290,7 +293,7 @@ class CustomSheetState @Deprecated(
|
|||
) = Saver<CustomSheetState, SheetValue>(
|
||||
save = { it.currentValue },
|
||||
restore = { savedValue ->
|
||||
CustomSheetState(skipPartiallyExpanded, savedValue, confirmValueChange)
|
||||
CustomSheetState(skipPartiallyExpanded, savedValue, confirmValueChange)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.rememberDatePickerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.element.android.libraries.designsystem.theme.components.AlertDialogContent
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.AlertDialogContent
|
||||
|
||||
@Preview(group = PreviewGroup.DateTimePickers)
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import androidx.compose.material3.TimePickerLayoutType
|
|||
import androidx.compose.material3.rememberTimePickerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import io.element.android.libraries.designsystem.theme.components.AlertDialogContent
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.AlertDialogContent
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Preview(widthDp = 600, group = PreviewGroup.DateTimePickers)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ fun SnackbarHost(hostState: SnackbarHostState, modifier: Modifier = Modifier) {
|
|||
IconSource.Vector(CompoundIcons.Close),
|
||||
data::dismiss
|
||||
)
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,5 +87,4 @@ class SnackbarDispatcherTests {
|
|||
assertThat(awaitItem()).isNull()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,43 +72,43 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
|
|||
val isOutgoing = event.isOwn
|
||||
val senderDisplayName = (event.senderProfile as? ProfileTimelineDetails.Ready)?.displayName ?: event.sender.value
|
||||
return when (val content = event.content) {
|
||||
is MessageContent -> processMessageContents(content, senderDisplayName, isDmRoom)
|
||||
RedactedContent -> {
|
||||
val message = sp.getString(CommonStrings.common_message_removed)
|
||||
if (!isDmRoom) {
|
||||
prefix(message, senderDisplayName)
|
||||
} else {
|
||||
message
|
||||
}
|
||||
is MessageContent -> processMessageContents(content, senderDisplayName, isDmRoom)
|
||||
RedactedContent -> {
|
||||
val message = sp.getString(CommonStrings.common_message_removed)
|
||||
if (!isDmRoom) {
|
||||
prefix(message, senderDisplayName)
|
||||
} else {
|
||||
message
|
||||
}
|
||||
is StickerContent -> {
|
||||
content.body
|
||||
}
|
||||
is StickerContent -> {
|
||||
content.body
|
||||
}
|
||||
is UnableToDecryptContent -> {
|
||||
val message = sp.getString(CommonStrings.common_waiting_for_decryption_key)
|
||||
if (!isDmRoom) {
|
||||
prefix(message, senderDisplayName)
|
||||
} else {
|
||||
message
|
||||
}
|
||||
is UnableToDecryptContent -> {
|
||||
val message = sp.getString(CommonStrings.common_waiting_for_decryption_key)
|
||||
if (!isDmRoom) {
|
||||
prefix(message, senderDisplayName)
|
||||
} else {
|
||||
message
|
||||
}
|
||||
}
|
||||
is RoomMembershipContent -> {
|
||||
roomMembershipContentFormatter.format(content, senderDisplayName, isOutgoing)
|
||||
}
|
||||
is ProfileChangeContent -> {
|
||||
profileChangeContentFormatter.format(content, senderDisplayName, isOutgoing)
|
||||
}
|
||||
is StateContent -> {
|
||||
stateContentFormatter.format(content, senderDisplayName, isOutgoing, RenderingMode.RoomList)
|
||||
}
|
||||
is PollContent -> {
|
||||
val message = sp.getString(CommonStrings.common_poll_summary, content.question)
|
||||
prefixIfNeeded(message, senderDisplayName, isDmRoom)
|
||||
}
|
||||
is FailedToParseMessageLikeContent, is FailedToParseStateContent, is UnknownContent -> {
|
||||
prefixIfNeeded(sp.getString(CommonStrings.common_unsupported_event), senderDisplayName, isDmRoom)
|
||||
}
|
||||
}?.take(MAX_SAFE_LENGTH)
|
||||
}
|
||||
is RoomMembershipContent -> {
|
||||
roomMembershipContentFormatter.format(content, senderDisplayName, isOutgoing)
|
||||
}
|
||||
is ProfileChangeContent -> {
|
||||
profileChangeContentFormatter.format(content, senderDisplayName, isOutgoing)
|
||||
}
|
||||
is StateContent -> {
|
||||
stateContentFormatter.format(content, senderDisplayName, isOutgoing, RenderingMode.RoomList)
|
||||
}
|
||||
is PollContent -> {
|
||||
val message = sp.getString(CommonStrings.common_poll_summary, content.question)
|
||||
prefixIfNeeded(message, senderDisplayName, isDmRoom)
|
||||
}
|
||||
is FailedToParseMessageLikeContent, is FailedToParseStateContent, is UnknownContent -> {
|
||||
prefixIfNeeded(sp.getString(CommonStrings.common_unsupported_event), senderDisplayName, isDmRoom)
|
||||
}
|
||||
}?.take(MAX_SAFE_LENGTH)
|
||||
}
|
||||
|
||||
private fun processMessageContents(messageContent: MessageContent, senderDisplayName: String, isDmRoom: Boolean): CharSequence? {
|
||||
|
|
|
|||
|
|
@ -28,4 +28,3 @@ interface FeatureFlagProvider {
|
|||
const val LOW_PRIORITY = 0
|
||||
const val MEDIUM_PRIORITY = 1
|
||||
const val HIGH_PRIORITY = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import dagger.Provides
|
|||
import dagger.multibindings.ElementsIntoSet
|
||||
import io.element.android.libraries.core.meta.BuildType
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.featureflag.impl.StaticFeatureFlagProvider
|
||||
import io.element.android.libraries.featureflag.impl.FeatureFlagProvider
|
||||
import io.element.android.libraries.featureflag.impl.PreferencesFeatureFlagProvider
|
||||
import io.element.android.libraries.featureflag.impl.StaticFeatureFlagProvider
|
||||
|
||||
@Module
|
||||
@ContributesTo(AppScope::class)
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import io.element.android.libraries.designsystem.components.preferences.PreferenceCheckbox
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.featureflag.ui.model.FeatureUiModel
|
||||
import io.element.android.libraries.featureflag.ui.model.aFeatureUiModelList
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("MatchingDeclarationName")
|
||||
|
||||
package io.element.android.libraries.maplibre.compose
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import android.content.res.Configuration
|
|||
import android.os.Bundle
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Composition
|
||||
import androidx.compose.runtime.CompositionContext
|
||||
|
|
@ -81,7 +81,10 @@ public fun MapboxMap(
|
|||
uiSettings: MapUiSettings = DefaultMapUiSettings,
|
||||
symbolManagerSettings: MapSymbolManagerSettings = DefaultMapSymbolManagerSettings,
|
||||
locationSettings: MapLocationSettings = DefaultMapLocationSettings,
|
||||
content: (@Composable @MapboxMapComposable () -> Unit)? = null,
|
||||
content: (
|
||||
@Composable @MapboxMapComposable
|
||||
() -> Unit
|
||||
)? = null,
|
||||
) {
|
||||
// When in preview, early return a Box with the received modifier preserving layout
|
||||
if (LocalInspectionMode.current) {
|
||||
|
|
@ -158,7 +161,8 @@ private suspend inline fun CompositionContext.newComposition(
|
|||
val style = map.awaitStyle(context, styleUri, images)
|
||||
val symbolManager = SymbolManager(mapView, map, style)
|
||||
return Composition(
|
||||
MapApplier(map, style, symbolManager), this
|
||||
MapApplier(map, style, symbolManager),
|
||||
this
|
||||
).apply {
|
||||
setContent(content)
|
||||
}
|
||||
|
|
@ -234,7 +238,7 @@ private fun MapView.lifecycleObserver(previousState: MutableState<Lifecycle.Even
|
|||
Lifecycle.Event.ON_PAUSE -> this.onPause()
|
||||
Lifecycle.Event.ON_STOP -> this.onStop()
|
||||
Lifecycle.Event.ON_DESTROY -> {
|
||||
//handled in onDispose
|
||||
// handled in onDispose
|
||||
}
|
||||
Lifecycle.Event.ON_ANY -> error("ON_ANY should never be used")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,4 @@ data class MatrixHomeServerDetails(
|
|||
val url: String,
|
||||
val supportsPasswordLogin: Boolean,
|
||||
val supportsOidcLogin: Boolean,
|
||||
): Parcelable
|
||||
) : Parcelable
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ value class SpaceId(val value: String) : Serializable {
|
|||
if (BuildConfig.DEBUG && !MatrixPatterns.isSpaceId(value)) {
|
||||
error(
|
||||
"`$value` is not a valid space id.\n" +
|
||||
"Space ids are the same as room ids.\n" +
|
||||
"Example space id: `!space_id:domain`."
|
||||
"Space ids are the same as room ids.\n" +
|
||||
"Example space id: `!space_id:domain`."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ value class ThreadId(val value: String) : Serializable {
|
|||
if (BuildConfig.DEBUG && !MatrixPatterns.isThreadId(value)) {
|
||||
error(
|
||||
"`$value` is not a valid thread id.\n" +
|
||||
"Thread ids are the same as event ids.\n" +
|
||||
"Example thread id: `\$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg`."
|
||||
"Thread ids are the same as event ids.\n" +
|
||||
"Example thread id: `\$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg`."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ enum class BackupState {
|
|||
RESUMING,
|
||||
ENABLED,
|
||||
DOWNLOADING,
|
||||
DISABLING;
|
||||
DISABLING
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ interface NotificationSettingsService {
|
|||
/**
|
||||
* State of the current room notification settings flow ([MatrixRoomNotificationSettingsState.Unknown] if not started).
|
||||
*/
|
||||
val notificationSettingsChangeFlow : SharedFlow<Unit>
|
||||
val notificationSettingsChangeFlow: SharedFlow<Unit>
|
||||
suspend fun getRoomNotificationSettings(roomId: RoomId, isEncrypted: Boolean, isOneToOne: Boolean): Result<RoomNotificationSettings>
|
||||
suspend fun getDefaultRoomNotificationMode(isEncrypted: Boolean, isOneToOne: Boolean): Result<RoomNotificationMode>
|
||||
suspend fun setDefaultRoomNotificationMode(isEncrypted: Boolean, mode: RoomNotificationMode, isOneToOne: Boolean): Result<Unit>
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ object PermalinkParser {
|
|||
val splitNameValue = it.split("=")
|
||||
if (splitNameValue.size == 2) {
|
||||
Pair(splitNameValue[0], URLDecoder.decode(splitNameValue[1], "UTF-8"))
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.getViaParameters(): List<String> {
|
||||
|
|
|
|||
|
|
@ -35,5 +35,3 @@ fun MatrixRoomMembersState.roomMembers(): List<RoomMember>? {
|
|||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
|||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
|
||||
sealed interface Mention {
|
||||
data class User(val userId: UserId): Mention
|
||||
data object AtRoom: Mention
|
||||
data class Room(val roomId: RoomId?, val roomAlias: String?): Mention
|
||||
data class User(val userId: UserId) : Mention
|
||||
data object AtRoom : Mention
|
||||
data class Room(val roomId: RoomId?, val roomAlias: String?) : Mention
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ enum class StateEventType {
|
|||
ROOM_TOMBSTONE,
|
||||
ROOM_TOPIC,
|
||||
SPACE_CHILD,
|
||||
SPACE_PARENT;
|
||||
SPACE_PARENT
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,3 @@ suspend fun MatrixRoom.canSendMessage(type: MessageEventType): Result<Boolean> =
|
|||
* Shortcut for calling [MatrixRoom.canUserRedact] with our own user.
|
||||
*/
|
||||
suspend fun MatrixRoom.canRedact(): Result<Boolean> = canUserRedact(sessionId)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,4 +30,3 @@ sealed interface MatrixTimelineItem {
|
|||
data class Virtual(val uniqueId: String, val virtual: VirtualTimelineItem) : MatrixTimelineItem
|
||||
data object Other : MatrixTimelineItem
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ package io.element.android.libraries.matrix.api.timeline
|
|||
enum class ReceiptType {
|
||||
READ,
|
||||
READ_PRIVATE,
|
||||
FULLY_READ;
|
||||
FULLY_READ
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@ object EventType {
|
|||
|
||||
fun isCallEvent(type: String): Boolean {
|
||||
return type == CALL_INVITE ||
|
||||
type == CALL_CANDIDATES ||
|
||||
type == CALL_ANSWER ||
|
||||
type == CALL_HANGUP ||
|
||||
type == CALL_SELECT_ANSWER ||
|
||||
type == CALL_NEGOTIATE ||
|
||||
type == CALL_REJECT ||
|
||||
type == CALL_REPLACES
|
||||
type == CALL_CANDIDATES ||
|
||||
type == CALL_ANSWER ||
|
||||
type == CALL_HANGUP ||
|
||||
type == CALL_SELECT_ANSWER ||
|
||||
type == CALL_NEGOTIATE ||
|
||||
type == CALL_REJECT ||
|
||||
type == CALL_REPLACES
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ enum class MembershipChange {
|
|||
KNOCK_ACCEPTED,
|
||||
KNOCK_RETRACTED,
|
||||
KNOCK_DENIED,
|
||||
NOT_IMPLEMENTED;
|
||||
NOT_IMPLEMENTED
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,3 @@ data class ReactionSender(
|
|||
val senderId: UserId,
|
||||
val timestamp: Long
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@
|
|||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
enum class TimelineItemEventOrigin {
|
||||
LOCAL, SYNC, PAGINATION;
|
||||
LOCAL, SYNC, PAGINATION
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,5 +44,4 @@ class AuthErrorCodeTest {
|
|||
val error = AuthenticationException.Generic("Some other error")
|
||||
assertThat(error.errorCode).isEqualTo(AuthErrorCode.UNKNOWN)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,5 +54,4 @@ class MatrixToConverterTest {
|
|||
val url = Uri.parse("https://element.io/")
|
||||
assertThat(MatrixToConverter.convert(url)).isNull()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ class PermalinkDataTest {
|
|||
@Test
|
||||
fun `getRoomId() returns value when isRoomAlias is false`() {
|
||||
val permalinkData = PermalinkData.RoomLink(
|
||||
roomIdOrAlias = "!abcdef123456:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = null,
|
||||
viaParameters = persistentListOf(),
|
||||
roomIdOrAlias = "!abcdef123456:matrix.org",
|
||||
isRoomAlias = false,
|
||||
eventId = null,
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
assertThat(permalinkData.getRoomId()).isNotNull()
|
||||
assertThat(permalinkData.getRoomAlias()).isNull()
|
||||
|
|
@ -45,5 +45,4 @@ class PermalinkDataTest {
|
|||
assertThat(permalinkData.getRoomId()).isNull()
|
||||
assertThat(permalinkData.getRoomAlias()).isNotNull()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ class PermalinkParserTest {
|
|||
fun `parsing a valid user url returns a user link`() {
|
||||
val url = "https://app.element.io/#/user/@test:matrix.org"
|
||||
assertThat(PermalinkParser.parse(url)).isEqualTo(
|
||||
PermalinkData.UserLink(
|
||||
userId = "@test:matrix.org"
|
||||
)
|
||||
PermalinkData.UserLink(
|
||||
userId = "@test:matrix.org"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -115,12 +115,12 @@ class PermalinkParserTest {
|
|||
fun `parsing a valid room alias url returns a room link`() {
|
||||
val url = "https://app.element.io/#/room/#element-android:matrix.org"
|
||||
assertThat(PermalinkParser.parse(url)).isEqualTo(
|
||||
PermalinkData.RoomLink(
|
||||
roomIdOrAlias = "#element-android:matrix.org",
|
||||
isRoomAlias = true,
|
||||
eventId = null,
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
PermalinkData.RoomLink(
|
||||
roomIdOrAlias = "#element-android:matrix.org",
|
||||
isRoomAlias = true,
|
||||
eventId = null,
|
||||
viaParameters = persistentListOf(),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class RustMatrixClient(
|
|||
override val sessionId: UserId = UserId(client.userId())
|
||||
private val innerRoomListService = syncService.roomListService()
|
||||
private val sessionDispatcher = dispatchers.io.limitedParallelism(64)
|
||||
private val sessionCoroutineScope = appCoroutineScope.childScope(dispatchers.main, "Session-${sessionId}")
|
||||
private val sessionCoroutineScope = appCoroutineScope.childScope(dispatchers.main, "Session-$sessionId")
|
||||
private val rustSyncService = RustSyncService(syncService, sessionCoroutineScope)
|
||||
private val verificationService = RustSessionVerificationService(rustSyncService, sessionCoroutineScope)
|
||||
private val pushersService = RustPushersService(
|
||||
|
|
@ -137,7 +137,7 @@ class RustMatrixClient(
|
|||
Timber.w("didReceiveAuthError(isSoftLogout=$isSoftLogout)")
|
||||
if (isLoggingOut.getAndSet(true).not()) {
|
||||
Timber.v("didReceiveAuthError -> do the cleanup")
|
||||
//TODO handle isSoftLogout parameter.
|
||||
// TODO handle isSoftLogout parameter.
|
||||
appCoroutineScope.launch {
|
||||
val existingData = sessionStore.getSession(client.userId())
|
||||
if (existingData != null) {
|
||||
|
|
@ -204,7 +204,7 @@ class RustMatrixClient(
|
|||
// Check if already in memory...
|
||||
var cachedPairOfRoom = pairOfRoom(roomId)
|
||||
if (cachedPairOfRoom == null) {
|
||||
//... otherwise, lets wait for the SS to load all rooms and check again.
|
||||
// ... otherwise, lets wait for the SS to load all rooms and check again.
|
||||
roomListService.allRooms.awaitLoaded()
|
||||
cachedPairOfRoom = pairOfRoom(roomId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class MediaUploadHandlerImpl(
|
|||
runCatching {
|
||||
sendAttachmentJoinHandle.join()
|
||||
}
|
||||
.also { cleanUpFiles() }
|
||||
.also { cleanUpFiles() }
|
||||
|
||||
override fun cancel() {
|
||||
sendAttachmentJoinHandle.cancel()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class MatrixRoomInfoMapper(
|
|||
canonicalAlias = it.canonicalAlias,
|
||||
alternativeAliases = it.alternativeAliases.toImmutableList(),
|
||||
currentUserMembership = it.membership.map(),
|
||||
latestEvent = it.latestEvent?.use (timelineItemMapper::map),
|
||||
latestEvent = it.latestEvent?.use(timelineItemMapper::map),
|
||||
inviter = it.inviter?.use(RoomMemberMapper::map),
|
||||
activeMembersCount = it.activeMembersCount.toLong(),
|
||||
invitedMembersCount = it.invitedMembersCount.toLong(),
|
||||
|
|
@ -57,13 +57,13 @@ class MatrixRoomInfoMapper(
|
|||
}
|
||||
}
|
||||
|
||||
fun RustMembership.map(): CurrentUserMembership = when(this) {
|
||||
fun RustMembership.map(): CurrentUserMembership = when (this) {
|
||||
RustMembership.INVITED -> CurrentUserMembership.INVITED
|
||||
RustMembership.JOINED -> CurrentUserMembership.JOINED
|
||||
RustMembership.LEFT -> CurrentUserMembership.LEFT
|
||||
}
|
||||
|
||||
fun RustRoomNotificationMode.map(): RoomNotificationMode = when(this) {
|
||||
fun RustRoomNotificationMode.map(): RoomNotificationMode = when (this) {
|
||||
RustRoomNotificationMode.ALL_MESSAGES -> RoomNotificationMode.ALL_MESSAGES
|
||||
RustRoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY
|
||||
RustRoomNotificationMode.MUTE -> RoomNotificationMode.MUTE
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class RustMatrixRoom(
|
|||
// Create a dispatcher for all room methods...
|
||||
private val roomDispatcher = coroutineDispatchers.io.limitedParallelism(32)
|
||||
|
||||
//...except getMember methods as it could quickly fill the roomDispatcher...
|
||||
// ...except getMember methods as it could quickly fill the roomDispatcher...
|
||||
private val roomMembersDispatcher = coroutineDispatchers.io.limitedParallelism(8)
|
||||
|
||||
private val roomCoroutineScope = sessionCoroutineScope.childScope(coroutineDispatchers.main, "RoomScope-$roomId")
|
||||
|
|
|
|||
|
|
@ -135,4 +135,3 @@ private fun DynamicRoomList.Filter.toRustFilter(): RoomListEntriesDynamicFilterK
|
|||
DynamicRoomList.Filter.AllNonLeft -> RoomListEntriesDynamicFilterKind.AllNonLeft
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,4 +45,3 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ class RustMatrixTimeline(
|
|||
|
||||
private fun List<MatrixTimelineItem>.hasEncryptionHistoryBanner(): Boolean {
|
||||
val firstItem = firstOrNull()
|
||||
return firstItem is MatrixTimelineItem.Virtual
|
||||
&& firstItem.virtual is VirtualTimelineItem.EncryptedHistoryBanner
|
||||
return firstItem is MatrixTimelineItem.Virtual &&
|
||||
firstItem.virtual is VirtualTimelineItem.EncryptedHistoryBanner
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ private fun List<Reaction>?.map(): ImmutableList<EventReaction> {
|
|||
|
||||
private fun Map<String, RustReceipt>.map(): ImmutableList<Receipt> {
|
||||
return map {
|
||||
Receipt(
|
||||
userId = UserId(it.key),
|
||||
timestamp = it.value.timestamp?.toLong() ?: 0
|
||||
)
|
||||
}
|
||||
Receipt(
|
||||
userId = UserId(it.key),
|
||||
timestamp = it.value.timestamp?.toLong() ?: 0
|
||||
)
|
||||
}
|
||||
.sortedByDescending { it.timestamp }
|
||||
.toImmutableList()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ private fun RustMembershipChange.map(): MembershipChange {
|
|||
}
|
||||
}
|
||||
|
||||
//TODO extract state events?
|
||||
// TODO extract state events?
|
||||
private fun RustOtherState.map(): OtherState {
|
||||
return when (this) {
|
||||
is RustOtherState.Custom -> OtherState.Custom(eventType)
|
||||
|
|
|
|||
|
|
@ -37,4 +37,3 @@ data class LogEventLocation(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class RustWidgetDriver(
|
|||
widgetSettings: MatrixWidgetSettings,
|
||||
private val room: Room,
|
||||
private val widgetCapabilitiesProvider: WidgetCapabilitiesProvider,
|
||||
): MatrixWidgetDriver {
|
||||
) : MatrixWidgetDriver {
|
||||
|
||||
// It's important to have extra capacity here to make sure we don't drop any messages
|
||||
override val incomingMessages = MutableSharedFlow<String>(extraBufferCapacity = 10)
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ class AuthenticationExceptionMappingTest {
|
|||
@Test
|
||||
fun `mapping specific exceptions map to their kotlin counterparts`() {
|
||||
assertThat(RustAuthenticationException.ClientMissing("Client missing").mapAuthenticationException())
|
||||
.isException<AuthenticationException.ClientMissing>("Client missing")
|
||||
.isException<AuthenticationException.ClientMissing>("Client missing")
|
||||
|
||||
assertThat(RustAuthenticationException.Generic("Generic").mapAuthenticationException()).isException<AuthenticationException.Generic>("Generic")
|
||||
|
||||
assertThat(RustAuthenticationException.InvalidServerName("Invalid server name").mapAuthenticationException())
|
||||
.isException<AuthenticationException.InvalidServerName>("Invalid server name")
|
||||
.isException<AuthenticationException.InvalidServerName>("Invalid server name")
|
||||
|
||||
assertThat(RustAuthenticationException.SessionMissing("Session missing").mapAuthenticationException())
|
||||
.isException<AuthenticationException.SessionMissing>("Session missing")
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue