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:
renovate[bot] 2024-01-10 16:22:24 +01:00 committed by GitHub
parent 7e1866818e
commit c8bd362397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
442 changed files with 1091 additions and 1081 deletions

View file

@ -40,4 +40,3 @@ class DefaultSendPollResponseAction @Inject constructor(
}
}
}

View file

@ -18,10 +18,12 @@ package io.element.android.features.poll.impl.create
internal sealed class CreatePollException : Exception() {
data class GetPollFailed(
override val message: String?, override val cause: Throwable?
override val message: String?,
override val cause: Throwable?
) : CreatePollException()
data class SavePollFailed(
override val message: String?, override val cause: Throwable?
override val message: String?,
override val cause: Throwable?
) : CreatePollException()
}

View file

@ -144,7 +144,7 @@ class CreatePollPresenter @AssistedInject constructor(
poll = poll.withNewAnswer()
}
is CreatePollEvents.RemoveAnswer -> {
poll= poll.withAnswerRemoved(event.index)
poll = poll.withAnswerRemoved(event.index)
}
is CreatePollEvents.SetAnswer -> {
poll = poll.withAnswerChanged(event.index, event.text)
@ -243,4 +243,3 @@ fun PollFormState.toUiAnswers(): ImmutableList<Answer> {
)
}.toImmutableList()
}

View file

@ -83,5 +83,4 @@ class PollHistoryFlowNode @AssistedInject constructor(
override fun View(modifier: Modifier) {
BackstackView()
}
}

View file

@ -87,7 +87,6 @@ class PollHistoryPresenter @Inject constructor(
}
}
return PollHistoryState(
isLoading = isLoading,
hasMoreToLoad = paginationState.hasMoreToLoadBackwards,

View file

@ -68,7 +68,6 @@ fun PollHistoryView(
goBack: () -> Unit,
modifier: Modifier = Modifier,
) {
fun onLoadMore() {
state.eventSink(PollHistoryEvents.LoadMore)
}
@ -133,7 +132,6 @@ fun PollHistoryView(
onLoadMore = ::onLoadMore,
modifier = Modifier.fillMaxSize(),
)
}
}
}

View file

@ -63,4 +63,3 @@ class PollHistoryItemsFactory @Inject constructor(
}
}
}

View file

@ -25,6 +25,7 @@ class PollFormStateSaverTest {
companion object {
val CanSaveScope = SaverScope { true }
}
@Test
fun `test save and restore`() {
val state = PollFormState(

View file

@ -134,7 +134,6 @@ class PollFormStateTest {
}
}
private fun aValidPollFormState(): PollFormState {
return PollFormState.Empty.copy(
question = "question",

View file

@ -63,7 +63,8 @@ class PollContentStateFactoryTest {
fun `Disclosed poll - not ended, some votes, including one from current user`() = runTest {
val votes = MY_USER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(votes = votes)
eventTimelineItem,
aPollContent(votes = votes)
)
val expectedState = aPollContentState(
answerItems = listOf(
@ -92,7 +93,8 @@ class PollContentStateFactoryTest {
fun `Disclosed poll - ended, some votes, including one from current user (winner)`() = runTest {
val votes = MY_USER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(votes = votes, endTime = 1UL)
eventTimelineItem,
aPollContent(votes = votes, endTime = 1UL)
)
val expectedState = aPollContentState(
answerItems = listOf(
@ -110,7 +112,8 @@ class PollContentStateFactoryTest {
fun `Disclosed poll - ended, some votes, including one from current user (not winner) and two winning votes`() = runTest {
val votes = OTHER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(votes = votes, endTime = 1UL)
eventTimelineItem,
aPollContent(votes = votes, endTime = 1UL)
)
val expectedState = aPollContentState(
answerItems = listOf(
@ -139,7 +142,8 @@ class PollContentStateFactoryTest {
fun `Undisclosed poll - not ended, some votes, including one from current user`() = runTest {
val votes = MY_USER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(PollKind.Undisclosed, votes = votes)
eventTimelineItem,
aPollContent(PollKind.Undisclosed, votes = votes)
)
val expectedState = aPollContentState(
pollKind = PollKind.Undisclosed,
@ -171,7 +175,8 @@ class PollContentStateFactoryTest {
fun `Undisclosed poll - ended, some votes, including one from current user (winner)`() = runTest {
val votes = MY_USER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(PollKind.Undisclosed, votes = votes, endTime = 1UL)
eventTimelineItem,
aPollContent(PollKind.Undisclosed, votes = votes, endTime = 1UL)
)
val expectedState = aPollContentState(
pollKind = PollKind.Undisclosed,
@ -190,7 +195,8 @@ class PollContentStateFactoryTest {
fun `Undisclosed poll - ended, some votes, including one from current user (not winner) and two winning votes`() = runTest {
val votes = OTHER_WINNING_VOTES.mapKeys { it.key.id }.toImmutableMap()
val state = factory.create(
eventTimelineItem, aPollContent(PollKind.Undisclosed, votes = votes, endTime = 1UL)
eventTimelineItem,
aPollContent(PollKind.Undisclosed, votes = votes, endTime = 1UL)
)
val expectedState = aPollContentState(
pollKind = PollKind.Undisclosed,