Fix "Arrow is redundant when parameter list is empty"
And other issues that ktlint now reports
This commit is contained in:
parent
e22ecb68c3
commit
8bfb86683d
10 changed files with 41 additions and 29 deletions
|
|
@ -87,8 +87,10 @@ class HomeFlowNode(
|
||||||
analyticsService.screen(MobileScreen(screenName = MobileScreen.ScreenName.Home))
|
analyticsService.screen(MobileScreen(screenName = MobileScreen.ScreenName.Home))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
whenChildAttached { commonLifecycle: Lifecycle,
|
whenChildAttached {
|
||||||
changeRoomMemberRolesNode: ChangeRoomMemberRolesEntryPoint.NodeProxy ->
|
commonLifecycle: Lifecycle,
|
||||||
|
changeRoomMemberRolesNode: ChangeRoomMemberRolesEntryPoint.NodeProxy,
|
||||||
|
->
|
||||||
commonLifecycle.coroutineScope.launch {
|
commonLifecycle.coroutineScope.launch {
|
||||||
changeRoomMemberRolesNode.waitForRoleChanged()
|
changeRoomMemberRolesNode.waitForRoleChanged()
|
||||||
withContext(NonCancellable) {
|
withContext(NonCancellable) {
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@ class DefaultDeclineInviteTest {
|
||||||
private val notificationCleaner =
|
private val notificationCleaner =
|
||||||
FakeNotificationCleaner(clearMembershipNotificationForRoomLambda = clearMembershipNotificationForRoomLambda)
|
FakeNotificationCleaner(clearMembershipNotificationForRoomLambda = clearMembershipNotificationForRoomLambda)
|
||||||
|
|
||||||
private val successLeaveRoomLambda = lambdaRecorder<Result<Unit>> { -> Result.success(Unit) }
|
private val successLeaveRoomLambda = lambdaRecorder<Result<Unit>> { Result.success(Unit) }
|
||||||
private val successIgnoreUserLambda =
|
private val successIgnoreUserLambda =
|
||||||
lambdaRecorder<UserId, Result<Unit>> { _ -> Result.success(Unit) }
|
lambdaRecorder<UserId, Result<Unit>> { _ -> Result.success(Unit) }
|
||||||
private val successReportRoomLambda =
|
private val successReportRoomLambda =
|
||||||
lambdaRecorder<String?, Result<Unit>> { _ -> Result.success(Unit) }
|
lambdaRecorder<String?, Result<Unit>> { _ -> Result.success(Unit) }
|
||||||
|
|
||||||
private val failureLeaveRoomLambda =
|
private val failureLeaveRoomLambda =
|
||||||
lambdaRecorder<Result<Unit>> { -> Result.failure(Exception("Leave room error")) }
|
lambdaRecorder<Result<Unit>> { Result.failure(Exception("Leave room error")) }
|
||||||
private val failureIgnoreUserLambda =
|
private val failureIgnoreUserLambda =
|
||||||
lambdaRecorder<UserId, Result<Unit>> { _ -> Result.failure(Exception("Ignore user error")) }
|
lambdaRecorder<UserId, Result<Unit>> { _ -> Result.failure(Exception("Ignore user error")) }
|
||||||
private val failureReportRoomLambda =
|
private val failureReportRoomLambda =
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ import org.junit.Test
|
||||||
|
|
||||||
class DefaultReportRoomTest {
|
class DefaultReportRoomTest {
|
||||||
private val roomId = A_ROOM_ID
|
private val roomId = A_ROOM_ID
|
||||||
private val successLeaveRoomLambda = lambdaRecorder<Result<Unit>> { -> Result.success(Unit) }
|
private val successLeaveRoomLambda = lambdaRecorder<Result<Unit>> { Result.success(Unit) }
|
||||||
private val successReportRoomLambda =
|
private val successReportRoomLambda =
|
||||||
lambdaRecorder<String?, Result<Unit>> { _ -> Result.success(Unit) }
|
lambdaRecorder<String?, Result<Unit>> { _ -> Result.success(Unit) }
|
||||||
|
|
||||||
private val failureLeaveRoomLambda =
|
private val failureLeaveRoomLambda =
|
||||||
lambdaRecorder<Result<Unit>> { -> Result.failure(Exception("Leave room error")) }
|
lambdaRecorder<Result<Unit>> { Result.failure(Exception("Leave room error")) }
|
||||||
private val failureReportRoomLambda =
|
private val failureReportRoomLambda =
|
||||||
lambdaRecorder<String?, Result<Unit>> { _ -> Result.failure(Exception("Report room error")) }
|
lambdaRecorder<String?, Result<Unit>> { _ -> Result.failure(Exception("Report room error")) }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,11 @@ class RoomDetailsFlowNode(
|
||||||
|
|
||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
super.onBuilt()
|
super.onBuilt()
|
||||||
whenChildrenAttached { commonLifecycle: Lifecycle,
|
whenChildrenAttached {
|
||||||
roomDetailsNode: RoomDetailsNode,
|
commonLifecycle: Lifecycle,
|
||||||
changeRoomMemberRolesNode: ChangeRoomMemberRolesEntryPoint.NodeProxy ->
|
roomDetailsNode: RoomDetailsNode,
|
||||||
|
changeRoomMemberRolesNode: ChangeRoomMemberRolesEntryPoint.NodeProxy,
|
||||||
|
->
|
||||||
commonLifecycle.coroutineScope.launch {
|
commonLifecycle.coroutineScope.launch {
|
||||||
changeRoomMemberRolesNode.waitForRoleChanged()
|
changeRoomMemberRolesNode.waitForRoleChanged()
|
||||||
withContext(NonCancellable) {
|
withContext(NonCancellable) {
|
||||||
|
|
|
||||||
|
|
@ -105,9 +105,7 @@ class RoomDirectoryPresenterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `present - emit load more event`() = runTest {
|
fun `present - emit load more event`() = runTest {
|
||||||
val loadMoreLambda = lambdaRecorder { ->
|
val loadMoreLambda = lambdaRecorder<Result<Unit>> { Result.success(Unit) }
|
||||||
Result.success(Unit)
|
|
||||||
}
|
|
||||||
val roomDirectoryList = FakeRoomDirectoryList(loadMoreLambda = loadMoreLambda)
|
val roomDirectoryList = FakeRoomDirectoryList(loadMoreLambda = loadMoreLambda)
|
||||||
val roomDirectoryService = FakeRoomDirectoryService { roomDirectoryList }
|
val roomDirectoryService = FakeRoomDirectoryService { roomDirectoryList }
|
||||||
val presenter = createRoomDirectoryPresenter(roomDirectoryService = roomDirectoryService)
|
val presenter = createRoomDirectoryPresenter(roomDirectoryService = roomDirectoryService)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import kotlinx.collections.immutable.toPersistentList
|
||||||
object WaveFormSamples {
|
object WaveFormSamples {
|
||||||
val allRangeWaveForm = List(100) { it.toFloat() / 100 }.toImmutableList()
|
val allRangeWaveForm = List(100) { it.toFloat() / 100 }.toImmutableList()
|
||||||
|
|
||||||
|
@Suppress("ktlint:standard:argument-list-wrapping")
|
||||||
val realisticWaveForm = persistentListOf(
|
val realisticWaveForm = persistentListOf(
|
||||||
0.000f, 0.000f, 0.000f, 0.003f, 0.354f,
|
0.000f, 0.000f, 0.000f, 0.003f, 0.354f,
|
||||||
0.353f, 0.365f, 0.790f, 0.787f, 0.167f,
|
0.353f, 0.365f, 0.790f, 0.787f, 0.167f,
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,7 @@ public fun MapLibreMap(
|
||||||
uiSettings: MapUiSettings = DefaultMapUiSettings,
|
uiSettings: MapUiSettings = DefaultMapUiSettings,
|
||||||
symbolManagerSettings: MapSymbolManagerSettings = DefaultMapSymbolManagerSettings,
|
symbolManagerSettings: MapSymbolManagerSettings = DefaultMapSymbolManagerSettings,
|
||||||
locationSettings: MapLocationSettings = DefaultMapLocationSettings,
|
locationSettings: MapLocationSettings = DefaultMapLocationSettings,
|
||||||
content: (
|
content: (@Composable @MapLibreMapComposable () -> Unit)? = null,
|
||||||
@Composable @MapLibreMapComposable
|
|
||||||
() -> Unit
|
|
||||||
)? = null,
|
|
||||||
) {
|
) {
|
||||||
// When in preview, early return a Box with the received modifier preserving layout
|
// When in preview, early return a Box with the received modifier preserving layout
|
||||||
if (LocalInspectionMode.current) {
|
if (LocalInspectionMode.current) {
|
||||||
|
|
|
||||||
|
|
@ -207,10 +207,12 @@ class RustTimeline(
|
||||||
backwardPaginationStatus,
|
backwardPaginationStatus,
|
||||||
forwardPaginationStatus,
|
forwardPaginationStatus,
|
||||||
joinedRoom.roomInfoFlow.map { it.creators to it.isDm }.distinctUntilChanged(),
|
joinedRoom.roomInfoFlow.map { it.creators to it.isDm }.distinctUntilChanged(),
|
||||||
) { timelineItems,
|
) {
|
||||||
|
timelineItems,
|
||||||
backwardPaginationStatus,
|
backwardPaginationStatus,
|
||||||
forwardPaginationStatus,
|
forwardPaginationStatus,
|
||||||
(roomCreators, isDm) ->
|
(roomCreators, isDm),
|
||||||
|
->
|
||||||
withContext(dispatcher) {
|
withContext(dispatcher) {
|
||||||
timelineItems
|
timelineItems
|
||||||
.let { items ->
|
.let { items ->
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class FakeNotificationCreator(
|
||||||
var createFallbackNotificationResult: LambdaOneParamRecorder<FallbackNotifiableEvent, Notification> = lambdaRecorder { _ -> A_NOTIFICATION },
|
var createFallbackNotificationResult: LambdaOneParamRecorder<FallbackNotifiableEvent, Notification> = lambdaRecorder { _ -> A_NOTIFICATION },
|
||||||
var createSummaryListNotificationResult: LambdaFourParamsRecorder<MatrixUser, String, Boolean, Long, Notification> =
|
var createSummaryListNotificationResult: LambdaFourParamsRecorder<MatrixUser, String, Boolean, Long, Notification> =
|
||||||
lambdaRecorder { _, _, _, _ -> A_NOTIFICATION },
|
lambdaRecorder { _, _, _, _ -> A_NOTIFICATION },
|
||||||
var createDiagnosticNotificationResult: LambdaNoParamRecorder<Notification> = lambdaRecorder { -> A_NOTIFICATION },
|
var createDiagnosticNotificationResult: LambdaNoParamRecorder<Notification> = lambdaRecorder<Notification> { A_NOTIFICATION },
|
||||||
) : NotificationCreator {
|
) : NotificationCreator {
|
||||||
override suspend fun createMessagesListNotification(
|
override suspend fun createMessagesListNotification(
|
||||||
roomInfo: RoomEventGroupInfo,
|
roomInfo: RoomEventGroupInfo,
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
assertThat(player1.prepare().isSuccess).isTrue()
|
assertThat(player1.prepare().isSuccess).isTrue()
|
||||||
matchReadyState(1_000L)
|
matchReadyState(1_000L)
|
||||||
player1.play()
|
player1.play()
|
||||||
awaitItem().let { // it plays until the end.
|
awaitItem().let {
|
||||||
|
// it plays until the end.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isTrue()
|
assertThat(it.isEnded).isTrue()
|
||||||
|
|
@ -127,14 +128,16 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
player2.state.test {
|
player2.state.test {
|
||||||
matchInitialState()
|
matchInitialState()
|
||||||
assertThat(player2.prepare().isSuccess).isTrue()
|
assertThat(player2.prepare().isSuccess).isTrue()
|
||||||
awaitItem().let { // Additional spurious state due to MediaPlayer owner change.
|
awaitItem().let {
|
||||||
|
// Additional spurious state due to MediaPlayer owner change.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isTrue()
|
assertThat(it.isEnded).isTrue()
|
||||||
assertThat(it.currentPosition).isEqualTo(1000)
|
assertThat(it.currentPosition).isEqualTo(1000)
|
||||||
assertThat(it.duration).isEqualTo(1000)
|
assertThat(it.duration).isEqualTo(1000)
|
||||||
}
|
}
|
||||||
awaitItem().let { // Additional spurious state due to MediaPlayer owner change.
|
awaitItem().let {
|
||||||
|
// Additional spurious state due to MediaPlayer owner change.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isFalse()
|
assertThat(it.isEnded).isFalse()
|
||||||
|
|
@ -143,7 +146,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
}
|
}
|
||||||
matchReadyState(1_000L)
|
matchReadyState(1_000L)
|
||||||
player2.play()
|
player2.play()
|
||||||
awaitItem().let { // it plays until the end.
|
awaitItem().let {
|
||||||
|
// it plays until the end.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isTrue()
|
assertThat(it.isEnded).isTrue()
|
||||||
|
|
@ -154,7 +158,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
|
|
||||||
// Play player1 again.
|
// Play player1 again.
|
||||||
player1.state.test {
|
player1.state.test {
|
||||||
awaitItem().let { // Last previous state/
|
awaitItem().let {
|
||||||
|
// Last previous state/
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isTrue()
|
assertThat(it.isEnded).isTrue()
|
||||||
|
|
@ -162,7 +167,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
assertThat(it.duration).isEqualTo(1000)
|
assertThat(it.duration).isEqualTo(1000)
|
||||||
}
|
}
|
||||||
assertThat(player1.prepare().isSuccess).isTrue()
|
assertThat(player1.prepare().isSuccess).isTrue()
|
||||||
awaitItem().let { // Additional spurious state due to MediaPlayer owner change.
|
awaitItem().let {
|
||||||
|
// Additional spurious state due to MediaPlayer owner change.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isFalse()
|
assertThat(it.isEnded).isFalse()
|
||||||
|
|
@ -171,7 +177,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
}
|
}
|
||||||
matchReadyState(1_000L)
|
matchReadyState(1_000L)
|
||||||
player1.play()
|
player1.play()
|
||||||
awaitItem().let { // it played again until the end.
|
awaitItem().let {
|
||||||
|
// it played again until the end.
|
||||||
assertThat(it.isReady).isFalse()
|
assertThat(it.isReady).isFalse()
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
assertThat(it.isEnded).isTrue()
|
assertThat(it.isEnded).isTrue()
|
||||||
|
|
@ -189,7 +196,8 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
assertThat(player.prepare().isSuccess).isTrue()
|
assertThat(player.prepare().isSuccess).isTrue()
|
||||||
matchReadyState()
|
matchReadyState()
|
||||||
player.play()
|
player.play()
|
||||||
skipItems(1) // skip play state
|
// skip play state
|
||||||
|
skipItems(1)
|
||||||
player.pause()
|
player.pause()
|
||||||
awaitItem().let {
|
awaitItem().let {
|
||||||
assertThat(it.isPlaying).isFalse()
|
assertThat(it.isPlaying).isFalse()
|
||||||
|
|
@ -206,9 +214,11 @@ class DefaultVoiceMessagePlayerTest {
|
||||||
assertThat(player.prepare().isSuccess).isTrue()
|
assertThat(player.prepare().isSuccess).isTrue()
|
||||||
matchReadyState()
|
matchReadyState()
|
||||||
player.play()
|
player.play()
|
||||||
skipItems(1) // skip play state
|
// skip play state
|
||||||
|
skipItems(1)
|
||||||
player.pause()
|
player.pause()
|
||||||
skipItems(1) // skip pause state
|
// skip pause state
|
||||||
|
skipItems(1)
|
||||||
player.play()
|
player.play()
|
||||||
awaitItem().let {
|
awaitItem().let {
|
||||||
assertThat(it.isPlaying).isTrue()
|
assertThat(it.isPlaying).isTrue()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue