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