Merge branch 'develop' into feature/bma/sxcludePreviewFromCodeCoverage

This commit is contained in:
Benoit Marty 2024-01-11 16:02:58 +01:00 committed by GitHub
commit 92d8e4f55b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
952 changed files with 1476 additions and 2027 deletions

View file

@ -52,7 +52,6 @@ class ConfigureRoomFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
private val component by lazy {
parent!!.bindings<CreateRoomComponent.ParentBindings>().createRoomComponentBuilder().build()
}

View file

@ -33,7 +33,6 @@ import javax.inject.Inject
class CreateRoomDataStore @Inject constructor(
val selectedUserListDataStore: UserListDataStore,
) {
private val createRoomConfigFlow: MutableStateFlow<CreateRoomConfig> = MutableStateFlow(CreateRoomConfig())
private var cachedAvatarUri: Uri? = null
set(value) {

View file

@ -50,7 +50,6 @@ class CreateRoomFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
sealed interface NavTarget : Parcelable {
@Parcelize
data object Root : NavTarget

View file

@ -27,13 +27,10 @@ import javax.inject.Inject
@ContributesBinding(AppScope::class)
class DefaultCreateRoomEntryPoint @Inject constructor() : CreateRoomEntryPoint {
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): CreateRoomEntryPoint.NodeBuilder {
val plugins = ArrayList<Plugin>()
return object : CreateRoomEntryPoint.NodeBuilder {
override fun callback(callback: CreateRoomEntryPoint.Callback): CreateRoomEntryPoint.NodeBuilder {
plugins += callback
return this

View file

@ -35,7 +35,6 @@ class DefaultStartDMAction @Inject constructor(
private val matrixClient: MatrixClient,
private val analyticsService: AnalyticsService,
) : StartDMAction {
override suspend fun execute(userId: UserId, actionState: MutableState<AsyncAction<RoomId>>) {
actionState.value = AsyncAction.Loading
when (val result = matrixClient.startDM(userId)) {

View file

@ -33,7 +33,6 @@ class AddPeopleNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
private val presenter: AddPeoplePresenter,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onContinue()
}

View file

@ -31,7 +31,6 @@ class AddPeoplePresenter @Inject constructor(
userRepository: UserRepository,
dataStore: CreateRoomDataStore,
) : Presenter<UserListState> {
private val userListPresenter = userListPresenterFactory.create(
UserListPresenterArgs(
selectionMode = SelectionMode.Multiple,
@ -45,4 +44,3 @@ class AddPeoplePresenter @Inject constructor(
return userListPresenter.present()
}
}

View file

@ -37,11 +37,13 @@ open class AddPeopleUserListStateProvider : PreviewParameterProvider<UserListSta
selectionMode = SelectionMode.Multiple,
),
aUserListState().copy(
searchResults = SearchBarResultState.Results(aMatrixUserList()
.mapIndexed { index, matrixUser ->
UserSearchResult(matrixUser, index % 2 == 0)
}
.toImmutableList()),
searchResults = SearchBarResultState.Results(
aMatrixUserList()
.mapIndexed { index, matrixUser ->
UserSearchResult(matrixUser, index % 2 == 0)
}
.toImmutableList()
),
selectedUsers = aListOfSelectedUsers(),
isSearchActive = true,
selectionMode = SelectionMode.Multiple,

View file

@ -29,14 +29,14 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.createroom.impl.configureroom.RoomPrivacyItem
import io.element.android.features.createroom.impl.configureroom.roomPrivacyItems
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.RadioButton
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.compound.theme.ElementTheme
@Composable
fun RoomPrivacyOption(
@ -85,7 +85,8 @@ fun RoomPrivacyOption(
.align(Alignment.CenterVertically)
.size(48.dp),
selected = isSelected,
onClick = null // null recommended for accessibility with screenreaders
// null recommended for accessibility with screenreaders
onClick = null
)
}
}

View file

@ -38,7 +38,6 @@ class ConfigureRoomNode @AssistedInject constructor(
private val presenter: ConfigureRoomPresenter,
private val analyticsService: AnalyticsService,
) : Node(buildContext, plugins = plugins) {
init {
lifecycle.subscribe(
onResume = {

View file

@ -57,7 +57,6 @@ class ConfigureRoomPresenter @Inject constructor(
private val analyticsService: AnalyticsService,
permissionsPresenterFactory: PermissionsPresenter.Factory,
) : Presenter<ConfigureRoomState> {
private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA)
private var pendingPermissionRequest = false

View file

@ -19,8 +19,8 @@ package io.element.android.features.createroom.impl.configureroom
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import io.element.android.libraries.designsystem.icons.CompoundDrawables
import io.element.android.features.createroom.impl.R
import io.element.android.libraries.designsystem.icons.CompoundDrawables
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList

View file

@ -26,7 +26,6 @@ import io.element.android.libraries.di.SingleIn
@SingleIn(CreateRoomScope::class)
@MergeSubcomponent(CreateRoomScope::class)
interface CreateRoomComponent : NodeFactoriesBindings {
@Subcomponent.Builder
interface Builder {
fun build(): CreateRoomComponent

View file

@ -42,7 +42,6 @@ class CreateRoomRootNode @AssistedInject constructor(
private val analyticsService: AnalyticsService,
private val inviteFriendsUseCase: InviteFriendsUseCase,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onCreateNewRoom()
fun onStartChatSuccess(roomId: RoomId)

View file

@ -41,7 +41,6 @@ class CreateRoomRootPresenter @Inject constructor(
private val startDMAction: StartDMAction,
private val buildMeta: BuildMeta,
) : Presenter<CreateRoomRootState> {
private val presenter = presenterFactory.create(
UserListPresenterArgs(
selectionMode = SelectionMode.Single,

View file

@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.root
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.features.createroom.impl.userlist.aUserListState
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
import io.element.android.libraries.matrix.ui.components.aMatrixUser
import io.element.android.libraries.usersearch.api.UserSearchResult

View file

@ -106,7 +106,7 @@ fun CreateRoomRootView(
onRetry = {
state.userListState.selectedUsers.firstOrNull()
?.let { state.eventSink(CreateRoomRootEvents.StartDM(it)) }
// Cancel start DM if there is no more selected user (should not happen)
// Cancel start DM if there is no more selected user (should not happen)
?: state.eventSink(CreateRoomRootEvents.CancelStartDM)
},
onErrorDismiss = { state.eventSink(CreateRoomRootEvents.CancelStartDM) },

View file

@ -42,7 +42,6 @@ class DefaultUserListPresenter @AssistedInject constructor(
@Assisted val userRepository: UserRepository,
@Assisted val userListDataStore: UserListDataStore,
) : UserListPresenter {
@AssistedFactory
@ContributesBinding(SessionScope::class)
interface DefaultUserListFactory : UserListPresenter.Factory {

View file

@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import javax.inject.Inject
class UserListDataStore @Inject constructor() {
private val selectedUsers: MutableStateFlow<List<MatrixUser>> = MutableStateFlow(emptyList())
fun selectUser(user: MatrixUser) {

View file

@ -20,7 +20,6 @@ import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.usersearch.api.UserRepository
interface UserListPresenter : Presenter<UserListState> {
interface Factory {
fun create(
args: UserListPresenterArgs,

View file

@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class DefaultStartDMActionTests {
@Test
fun `when dm is found, assert state is updated with given room id`() = runTest {
val matrixClient = FakeMatrixClient().apply {

View file

@ -31,7 +31,6 @@ import org.junit.Rule
import org.junit.Test
class AddPeoplePresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -57,4 +56,3 @@ class AddPeoplePresenterTests {
}
}
}

View file

@ -62,7 +62,6 @@ private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
@RunWith(RobolectricTestRunner::class)
class ConfigureRoomPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -316,4 +315,3 @@ class ConfigureRoomPresenterTests {
}
}
}

View file

@ -38,7 +38,6 @@ import org.junit.Rule
import org.junit.Test
class CreateRoomRootPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -80,7 +79,6 @@ class CreateRoomRootPresenterTests {
awaitItem().also { state ->
assertThat(state.startDmAction).isEqualTo(startDMSuccessResult)
}
}
}

View file

@ -33,7 +33,6 @@ import org.junit.Rule
import org.junit.Test
class DefaultUserListPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()

View file

@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.userlist
import androidx.compose.runtime.Composable
class FakeUserListPresenter : UserListPresenter {
private var state = aUserListState()
fun givenState(state: UserListState) {

View file

@ -21,7 +21,6 @@ import io.element.android.libraries.usersearch.api.UserRepository
class FakeUserListPresenterFactory(
private val fakeUserListPresenter: FakeUserListPresenter = FakeUserListPresenter()
) : UserListPresenter.Factory {
override fun create(
args: UserListPresenterArgs,
userRepository: UserRepository,