Fix moar ktlint issues
This commit is contained in:
parent
5d086ad82d
commit
d01c70a4fd
27 changed files with 69 additions and 53 deletions
|
|
@ -85,7 +85,8 @@ fun RoomPrivacyOption(
|
|||
.align(Alignment.CenterVertically)
|
||||
.size(48.dp),
|
||||
selected = isSelected,
|
||||
onClick = null // null recommended for accessibility with screenreaders
|
||||
// null recommended for accessibility with screenreaders
|
||||
onClick = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class OidcUrlParser @Inject constructor() {
|
|||
* `io.element:/callback?state=IFF1UETGye2ZA8pO&code=y6X1GZeqA3xxOWcTeShgv8nkgFJXyzWB`
|
||||
*/
|
||||
fun parse(url: String): OidcAction? {
|
||||
if (url.startsWith(OidcConfig.redirectUri).not()) return null
|
||||
if (url.startsWith(OidcConfig.REDIRECT_URI).not()) return null
|
||||
if (url.contains("error=access_denied")) return OidcAction.GoBack
|
||||
if (url.contains("code=")) return OidcAction.Success(url)
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@ private fun HomeserverData.toAccountProvider(): AccountProvider {
|
|||
return AccountProvider(
|
||||
url = homeserverUrl,
|
||||
subtitle = if (isMatrixOrg) stringResource(id = R.string.screen_change_account_provider_matrix_org_subtitle) else null,
|
||||
isPublic = isMatrixOrg, // There is no need to know for other servers right now
|
||||
// There is no need to know for other servers right now
|
||||
isPublic = isMatrixOrg,
|
||||
isMatrixOrg = isMatrixOrg,
|
||||
isValid = isWellknownValid,
|
||||
supportSlidingSync = supportSlidingSync,
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ class OidcUrlParserTest {
|
|||
@Test
|
||||
fun `test cancel url`() {
|
||||
val sut = OidcUrlParser()
|
||||
val aCancelUrl = OidcConfig.redirectUri + "?error=access_denied&state=IFF1UETGye2ZA8pO"
|
||||
val aCancelUrl = OidcConfig.REDIRECT_URI + "?error=access_denied&state=IFF1UETGye2ZA8pO"
|
||||
assertThat(sut.parse(aCancelUrl)).isEqualTo(OidcAction.GoBack)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test success url`() {
|
||||
val sut = OidcUrlParser()
|
||||
val aSuccessUrl = OidcConfig.redirectUri + "?state=IFF1UETGye2ZA8pO&code=y6X1GZeqA3xxOWcTeShgv8nkgFJXyzWB"
|
||||
val aSuccessUrl = OidcConfig.REDIRECT_URI + "?state=IFF1UETGye2ZA8pO&code=y6X1GZeqA3xxOWcTeShgv8nkgFJXyzWB"
|
||||
assertThat(sut.parse(aSuccessUrl)).isEqualTo(OidcAction.Success(aSuccessUrl))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test unknown url`() {
|
||||
val sut = OidcUrlParser()
|
||||
val anUnknownUrl = OidcConfig.redirectUri + "?state=IFF1UETGye2ZA8pO&goat=y6X1GZeqA3xxOWcTeShgv8nkgFJXyzWB"
|
||||
val anUnknownUrl = OidcConfig.REDIRECT_URI + "?state=IFF1UETGye2ZA8pO&goat=y6X1GZeqA3xxOWcTeShgv8nkgFJXyzWB"
|
||||
Assert.assertThrows(IllegalStateException::class.java) {
|
||||
assertThat(sut.parse(anUnknownUrl))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ internal fun ExpandableBottomSheetScaffold(
|
|||
contentOverflows = contentHeight > maxHeight
|
||||
|
||||
val peekHeight = min(
|
||||
maxHeight, // prevent the sheet from expanding beyond the screen
|
||||
// prevent the sheet from expanding beyond the screen
|
||||
maxHeight,
|
||||
contentHeight
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -416,8 +416,9 @@ private fun MessageEventBubbleContent(
|
|||
onMentionClicked: (Mention) -> Unit,
|
||||
eventSink: (TimelineEvents) -> Unit,
|
||||
@SuppressLint("ModifierParameter")
|
||||
// need to rename this modifier to prevent linter false positives
|
||||
@Suppress("ModifierNaming")
|
||||
bubbleModifier: Modifier = Modifier, // need to rename this modifier to prevent linter false positives
|
||||
bubbleModifier: Modifier = Modifier,
|
||||
) {
|
||||
// Long clicks are not not automatically propagated from a `clickable`
|
||||
// to its `combinedClickable` parent so we do it manually
|
||||
|
|
@ -462,10 +463,12 @@ private fun MessageEventBubbleContent(
|
|||
onClick = onTimestampClicked,
|
||||
onLongClick = ::onTimestampLongClick,
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 4.dp, vertical = 4.dp) // Outer padding
|
||||
// Outer padding
|
||||
.padding(horizontal = 4.dp, vertical = 4.dp)
|
||||
.background(ElementTheme.colors.bgSubtleSecondary, RoundedCornerShape(10.0.dp))
|
||||
.align(Alignment.BottomEnd)
|
||||
.padding(horizontal = 4.dp, vertical = 2.dp) // Inner padding
|
||||
// Inner padding
|
||||
.padding(horizontal = 4.dp, vertical = 2.dp)
|
||||
)
|
||||
}
|
||||
TimestampPosition.Aligned ->
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ fun EventDebugInfoView(
|
|||
.fillMaxWidth()
|
||||
.padding(padding) // Window insets
|
||||
.consumeWindowInsets(padding)
|
||||
.padding(horizontal = 16.dp) // Internal padding
|
||||
// Internal padding
|
||||
.padding(horizontal = 16.dp)
|
||||
) {
|
||||
item {
|
||||
Column(Modifier.padding(vertical = 10.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@
|
|||
package io.element.android.features.onboarding.impl
|
||||
|
||||
object OnBoardingConfig {
|
||||
const val canLoginWithQrCode = false
|
||||
const val canCreateAccount = false
|
||||
const val CAN_LOGIN_WITH_QR_CODE = false
|
||||
const val CAN_CREATE_ACCOUNT = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class OnBoardingPresenter @Inject constructor(
|
|||
override fun present(): OnBoardingState {
|
||||
return OnBoardingState(
|
||||
isDebugBuild = buildMeta.buildType != BuildType.RELEASE,
|
||||
canLoginWithQrCode = OnBoardingConfig.canLoginWithQrCode,
|
||||
canCreateAccount = OnBoardingConfig.canCreateAccount,
|
||||
canLoginWithQrCode = OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE,
|
||||
canCreateAccount = OnBoardingConfig.CAN_CREATE_ACCOUNT,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ private fun CrashDetectionContent(
|
|||
) {
|
||||
ConfirmationDialog(
|
||||
title = stringResource(id = CommonStrings.action_report_bug),
|
||||
content = stringResource(id = R.string.crash_detection_dialog_content, /* TODO App name */ "Element"),
|
||||
// TODO: Replace with app name
|
||||
content = stringResource(id = R.string.crash_detection_dialog_content, "Element"),
|
||||
submitText = stringResource(id = CommonStrings.action_yes),
|
||||
cancelText = stringResource(id = CommonStrings.action_no),
|
||||
onCancelClicked = onNoClicked,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ internal fun BlockUserSection(state: RoomMemberDetailsState, modifier: Modifier
|
|||
val event = when (state.isBlocked.prevData) {
|
||||
true -> RoomMemberDetailsEvents.UnblockUser(needsConfirmation = false)
|
||||
false -> RoomMemberDetailsEvents.BlockUser(needsConfirmation = false)
|
||||
null -> /*Should not happen */ RoomMemberDetailsEvents.ClearBlockUserError
|
||||
// null case Should not happen
|
||||
null -> RoomMemberDetailsEvents.ClearBlockUserError
|
||||
}
|
||||
state.eventSink(event)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -140,11 +140,11 @@ class SecureBackupSetupPresenterTest {
|
|||
)
|
||||
)
|
||||
val createdState = awaitItem()
|
||||
assertThat(createdState.setupState).isEqualTo(SetupState.Created(FakeEncryptionService.fakeRecoveryKey))
|
||||
assertThat(createdState.setupState).isEqualTo(SetupState.Created(FakeEncryptionService.FAKE_RECOVERY_KEY))
|
||||
assertThat(createdState.recoveryKeyViewState).isEqualTo(
|
||||
RecoveryKeyViewState(
|
||||
recoveryKeyUserStory = RecoveryKeyUserStory.Change,
|
||||
formattedRecoveryKey = FakeEncryptionService.fakeRecoveryKey,
|
||||
formattedRecoveryKey = FakeEncryptionService.FAKE_RECOVERY_KEY,
|
||||
inProgress = false,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ class RecoveryKeyVisualTransformationTest {
|
|||
|
||||
@Test
|
||||
fun `RecoveryKeyOffsetMapping computes correct transformedToOriginal values`() {
|
||||
val sut = RecoveryKeyVisualTransformation.RecoveryKeyOffsetMapping("" /* Not used by transformedToOriginal */)
|
||||
// text parameter is not used by transformedToOriginal
|
||||
val sut = RecoveryKeyVisualTransformation.RecoveryKeyOffsetMapping("")
|
||||
assertThat(sut.transformedToOriginal(0)).isEqualTo(0)
|
||||
assertThat(sut.transformedToOriginal(1)).isEqualTo(1)
|
||||
assertThat(sut.transformedToOriginal(2)).isEqualTo(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue