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
7e1866818e
commit
c8bd362397
442 changed files with 1091 additions and 1081 deletions
|
|
@ -40,4 +40,3 @@ class DefaultSendPollResponseAction @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,5 +83,4 @@ class PollHistoryFlowNode @AssistedInject constructor(
|
|||
override fun View(modifier: Modifier) {
|
||||
BackstackView()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ class PollHistoryPresenter @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return PollHistoryState(
|
||||
isLoading = isLoading,
|
||||
hasMoreToLoad = paginationState.hasMoreToLoadBackwards,
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,3 @@ class PollHistoryItemsFactory @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class PollFormStateSaverTest {
|
|||
companion object {
|
||||
val CanSaveScope = SaverScope { true }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test save and restore`() {
|
||||
val state = PollFormState(
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ class PollFormStateTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun aValidPollFormState(): PollFormState {
|
||||
return PollFormState.Empty.copy(
|
||||
question = "question",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue