Merge branch 'develop' into dla/feature/connect_sdk_to_global_notifications_ui
This commit is contained in:
commit
62dedbb320
58 changed files with 130 additions and 155 deletions
|
|
@ -37,8 +37,7 @@ import org.junit.Rule
|
|||
import org.junit.Test
|
||||
|
||||
class RootPresenterTest {
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ import org.junit.Test
|
|||
|
||||
class LoggedInPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
1
changelog.d/1297.bugfix
Normal file
1
changelog.d/1297.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix top padding in room list when app is opened in offline mode.
|
||||
|
|
@ -31,8 +31,7 @@ import org.junit.Test
|
|||
|
||||
class AnalyticsOptInPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ import org.junit.Test
|
|||
|
||||
class AnalyticsPreferencesPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ import org.junit.Test
|
|||
|
||||
class AddPeoplePresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private lateinit var presenter: AddPeoplePresenter
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
|
|||
@RunWith(RobolectricTestRunner::class)
|
||||
class ConfigureRoomPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private lateinit var presenter: ConfigureRoomPresenter
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ import org.junit.Test
|
|||
|
||||
class CreateRoomRootPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private lateinit var userRepository: FakeUserRepository
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ import org.junit.Test
|
|||
|
||||
class DefaultUserListPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val userRepository = FakeUserRepository()
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ import org.junit.Test
|
|||
|
||||
class MigrationScreenPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ import org.junit.Test
|
|||
|
||||
class NotificationsOptInPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private var isFinished = false
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ import org.junit.Rule
|
|||
import org.junit.Test
|
||||
|
||||
class InviteListPresenterTests {
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ import org.junit.Test
|
|||
|
||||
class LeaveRoomPresenterImplTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ import org.junit.Test
|
|||
|
||||
class SendLocationPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val permissionsPresenterFake = PermissionsPresenterFake()
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
|
||||
class ShowLocationPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val permissionsPresenterFake = PermissionsPresenterFake()
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ import org.junit.Test
|
|||
|
||||
class ChangeServerPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
|
||||
class OidcPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ import org.junit.Test
|
|||
|
||||
class ChangeAccountProviderPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ import org.junit.Test
|
|||
|
||||
class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.junit.Test
|
|||
|
||||
class LoginPasswordPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.junit.Test
|
|||
|
||||
class SearchAccountProviderPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ import org.junit.Test
|
|||
|
||||
class WaitListPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ import org.junit.Test
|
|||
|
||||
class LogoutPreferencePresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ import kotlin.time.Duration.Companion.milliseconds
|
|||
|
||||
class MessagesPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val mockMediaUrl: Uri = mockk("localMediaUri")
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ import org.junit.Test
|
|||
|
||||
class ActionListPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ import org.junit.Test
|
|||
|
||||
class AttachmentsPreviewPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val mediaPreProcessor = FakeMediaPreProcessor()
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ import org.junit.Test
|
|||
|
||||
class ForwardMessagesPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ private val TESTED_MEDIA_INFO = aFileInfo()
|
|||
|
||||
class MediaViewerPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
|
||||
class ReportMessagePresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -69,8 +69,7 @@ import java.io.File
|
|||
|
||||
class MessageComposerPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val pickerProvider = FakePickerProvider().apply {
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ import java.util.Date
|
|||
|
||||
class TimelinePresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ import org.junit.Test
|
|||
|
||||
class CustomReactionPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val presenter = CustomReactionPresenter(emojibaseProvider = FakeEmojibaseProvider())
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ import org.junit.Test
|
|||
|
||||
class ReactionSummaryPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val aggregatedReaction = anAggregatedReaction(userId = A_USER_ID, key = "👍", isHighlighted = true)
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ import org.junit.Test
|
|||
|
||||
class RetrySendMenuPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private val room = FakeMatrixRoom()
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ fun ConnectivityIndicatorContainer(
|
|||
} else {
|
||||
WindowInsets.statusBars.asPaddingValues().calculateTopPadding() + 6.dp
|
||||
}
|
||||
val target = remember(isOnline) { if (isOnline) 0.dp else statusBarTopPadding }
|
||||
val target = remember(isIndicatorVisible.targetState, statusBarTopPadding) {
|
||||
if (!isIndicatorVisible.targetState) 0.dp else statusBarTopPadding
|
||||
}
|
||||
val animationStateOffset by animateDpAsState(
|
||||
targetValue = target,
|
||||
animationSpec = spring(
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ import org.junit.Test
|
|||
|
||||
class OnBoardingPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package io.element.android.features.poll.impl.create
|
|||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -25,6 +26,7 @@ import androidx.compose.foundation.layout.imePadding
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
|
|
@ -32,6 +34,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
|
|
@ -61,6 +64,8 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
|||
import io.element.android.libraries.matrix.api.poll.PollKind
|
||||
import io.element.android.libraries.theme.ElementTheme
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
|
@ -68,6 +73,8 @@ fun CreatePollView(
|
|||
state: CreatePollState,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
val navBack = { state.eventSink(CreatePollEvents.ConfirmNavBack) }
|
||||
BackHandler(onBack = navBack)
|
||||
if (state.showConfirmation) ConfirmationDialog(
|
||||
|
|
@ -76,6 +83,7 @@ fun CreatePollView(
|
|||
onDismiss = { state.eventSink(CreatePollEvents.HideConfirmation) }
|
||||
)
|
||||
val questionFocusRequester = remember { FocusRequester() }
|
||||
val answerFocusRequester = remember { FocusRequester() }
|
||||
LaunchedEffect(Unit) {
|
||||
questionFocusRequester.requestFocus()
|
||||
}
|
||||
|
|
@ -102,40 +110,43 @@ fun CreatePollView(
|
|||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
val lazyListState = rememberLazyListState()
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.consumeWindowInsets(paddingValues)
|
||||
.imePadding()
|
||||
.fillMaxSize(),
|
||||
state = lazyListState,
|
||||
) {
|
||||
item {
|
||||
Text(
|
||||
text = stringResource(id = R.string.screen_create_poll_question_desc),
|
||||
modifier = Modifier.padding(start = 32.dp),
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
)
|
||||
}
|
||||
item {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
OutlinedTextField(
|
||||
value = state.question,
|
||||
onValueChange = {
|
||||
state.eventSink(CreatePollEvents.SetQuestion(it))
|
||||
},
|
||||
modifier = Modifier
|
||||
.focusRequester(questionFocusRequester)
|
||||
.fillMaxWidth(),
|
||||
placeholder = {
|
||||
Text(text = stringResource(id = R.string.screen_create_poll_question_hint))
|
||||
},
|
||||
keyboardOptions = keyboardOptions,
|
||||
)
|
||||
}
|
||||
)
|
||||
Column {
|
||||
Text(
|
||||
text = stringResource(id = R.string.screen_create_poll_question_desc),
|
||||
modifier = Modifier.padding(start = 32.dp),
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
OutlinedTextField(
|
||||
value = state.question,
|
||||
onValueChange = {
|
||||
state.eventSink(CreatePollEvents.SetQuestion(it))
|
||||
},
|
||||
modifier = Modifier
|
||||
.focusRequester(questionFocusRequester)
|
||||
.fillMaxWidth(),
|
||||
placeholder = {
|
||||
Text(text = stringResource(id = R.string.screen_create_poll_question_hint))
|
||||
},
|
||||
keyboardOptions = keyboardOptions,
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
itemsIndexed(state.answers) { index, answer ->
|
||||
val isLastItem = index == state.answers.size - 1
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
OutlinedTextField(
|
||||
|
|
@ -143,7 +154,9 @@ fun CreatePollView(
|
|||
onValueChange = {
|
||||
state.eventSink(CreatePollEvents.SetAnswer(index, it))
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
modifier = Modifier
|
||||
.then(if (isLastItem) Modifier.focusRequester(answerFocusRequester) else Modifier)
|
||||
.fillMaxWidth(),
|
||||
placeholder = {
|
||||
Text(text = stringResource(id = R.string.screen_create_poll_answer_hint, index + 1))
|
||||
},
|
||||
|
|
@ -170,22 +183,28 @@ fun CreatePollView(
|
|||
iconSource = IconSource.Vector(Icons.Default.Add),
|
||||
),
|
||||
style = ListItemStyle.Primary,
|
||||
onClick = { state.eventSink(CreatePollEvents.AddAnswer) },
|
||||
onClick = {
|
||||
state.eventSink(CreatePollEvents.AddAnswer)
|
||||
coroutineScope.launch(Dispatchers.Main) {
|
||||
lazyListState.animateScrollToItem(state.answers.size + 1)
|
||||
answerFocusRequester.requestFocus()
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
item {
|
||||
HorizontalDivider()
|
||||
}
|
||||
item {
|
||||
ListItem(
|
||||
headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) },
|
||||
supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) },
|
||||
trailingContent = ListItemContent.Switch(
|
||||
checked = state.pollKind == PollKind.Undisclosed,
|
||||
onChange = { state.eventSink(CreatePollEvents.SetPollKind(if (it) PollKind.Undisclosed else PollKind.Disclosed)) },
|
||||
),
|
||||
)
|
||||
Column {
|
||||
HorizontalDivider()
|
||||
ListItem(
|
||||
headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) },
|
||||
supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) },
|
||||
trailingContent = ListItemContent.Switch(
|
||||
checked = state.pollKind == PollKind.Undisclosed,
|
||||
onChange = { state.eventSink(CreatePollEvents.SetPollKind(if (it) PollKind.Undisclosed else PollKind.Disclosed)) },
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
|
||||
class CreatePollPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private var navUpInvocationsCount = 0
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ import org.junit.Test
|
|||
|
||||
class AboutPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ import org.junit.Test
|
|||
|
||||
class AnalyticsSettingsPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
|
||||
class DeveloperSettingsPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ import org.junit.Test
|
|||
|
||||
class ConfigureTracingPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.junit.Test
|
|||
|
||||
class PreferencesRootPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ const val A_LONG_DESCRIPTION = "I have seen a bug!"
|
|||
|
||||
class BugReportPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ import org.junit.Test
|
|||
|
||||
class CrashDetectionPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.junit.Test
|
|||
|
||||
class RageshakeDetectionPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ import org.junit.Test
|
|||
|
||||
class RageshakePreferencesPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ import kotlin.time.Duration.Companion.milliseconds
|
|||
@ExperimentalCoroutinesApi
|
||||
class RoomDetailsPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
private fun aRoomDetailsPresenter(
|
||||
room: MatrixRoom,
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ import java.io.File
|
|||
@ExperimentalCoroutinesApi
|
||||
class RoomDetailsEditPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
private lateinit var fakePickerProvider: FakePickerProvider
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ import org.junit.Test
|
|||
|
||||
internal class RoomInviteMembersPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ import org.junit.Test
|
|||
@ExperimentalCoroutinesApi
|
||||
class RoomMemberListPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ import org.junit.Test
|
|||
@ExperimentalCoroutinesApi
|
||||
class RoomMemberDetailsPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ import org.junit.Test
|
|||
|
||||
class RoomListPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ import org.junit.Test
|
|||
@ExperimentalCoroutinesApi
|
||||
class VerifySelfSessionPresenterTests {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@ fun Modifier.avatarBloom(
|
|||
blurSize = blurSize,
|
||||
offset = offset,
|
||||
clipToSize = clipToSize,
|
||||
bottomSoftEdgeColor = bottomSoftEdgeColor,
|
||||
bottomSoftEdgeHeight = bottomSoftEdgeHeight,
|
||||
bottomSoftEdgeAlpha = bottomSoftEdgeAlpha,
|
||||
alpha = alpha,
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ const val A_PERMISSION = "A_PERMISSION"
|
|||
|
||||
class DefaultPermissionsPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ import org.junit.Test
|
|||
|
||||
class NoopPermissionsPresenterTest {
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -32,17 +32,22 @@ import kotlin.time.Duration.Companion.seconds
|
|||
* Applying this test rule ensures that the slow initialisation is not done
|
||||
* inside runTest which has a short default timeout.
|
||||
*/
|
||||
class WarmUpRule: TestRule {
|
||||
override fun apply(base: Statement, description: Description): Statement = object: Statement() {
|
||||
override fun evaluate() {
|
||||
runTest(timeout = 60.seconds) {
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
// Do nothing
|
||||
}.test {
|
||||
awaitItem() // Await a Unit composition
|
||||
}
|
||||
}
|
||||
base.evaluate()
|
||||
class WarmUpRule : TestRule {
|
||||
companion object {
|
||||
init {
|
||||
warmUpMolecule()
|
||||
}
|
||||
}
|
||||
|
||||
override fun apply(base: Statement, description: Description): Statement = base
|
||||
}
|
||||
|
||||
private fun warmUpMolecule() {
|
||||
runTest(timeout = 60.seconds) {
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
// Do nothing
|
||||
}.test {
|
||||
awaitItem() // Await a Unit composition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue