Merge pull request #2936 from element-hq/renovate/io.nlopez.compose.rules-detekt-0.x
Update dependency io.nlopez.compose.rules:detekt to v0.4.3
This commit is contained in:
commit
c6e8628bd9
259 changed files with 1801 additions and 1796 deletions
|
|
@ -229,31 +229,31 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
NavTarget.RoomList -> {
|
NavTarget.RoomList -> {
|
||||||
val callback = object : RoomListEntryPoint.Callback {
|
val callback = object : RoomListEntryPoint.Callback {
|
||||||
override fun onRoomClicked(roomId: RoomId) {
|
override fun onRoomClick(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSettingsClicked() {
|
override fun onSettingsClick() {
|
||||||
backstack.push(NavTarget.Settings())
|
backstack.push(NavTarget.Settings())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateRoomClicked() {
|
override fun onCreateRoomClick() {
|
||||||
backstack.push(NavTarget.CreateRoom)
|
backstack.push(NavTarget.CreateRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSessionConfirmRecoveryKeyClicked() {
|
override fun onSessionConfirmRecoveryKeyClick() {
|
||||||
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
|
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRoomSettingsClicked(roomId: RoomId) {
|
override fun onRoomSettingsClick(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Details))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Details))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportBugClicked() {
|
override fun onReportBugClick() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.onOpenBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRoomDirectorySearchClicked() {
|
override fun onRoomDirectorySearchClick() {
|
||||||
backstack.push(NavTarget.RoomDirectorySearch)
|
backstack.push(NavTarget.RoomDirectorySearch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -272,7 +272,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
coroutineScope.launch { attachRoom(roomId.toRoomIdOrAlias()) }
|
coroutineScope.launch { attachRoom(roomId.toRoomIdOrAlias()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClicked(data: PermalinkData) {
|
override fun onPermalinkClick(data: PermalinkData) {
|
||||||
when (data) {
|
when (data) {
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
// Should not happen (handled by MessagesNode)
|
// Should not happen (handled by MessagesNode)
|
||||||
|
|
@ -325,7 +325,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.onOpenBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSecureBackupClicked() {
|
override fun onSecureBackupClick() {
|
||||||
backstack.push(NavTarget.SecureBackup())
|
backstack.push(NavTarget.SecureBackup())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +363,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
NavTarget.RoomDirectorySearch -> {
|
NavTarget.RoomDirectorySearch -> {
|
||||||
roomDirectoryEntryPoint.nodeBuilder(this, buildContext)
|
roomDirectoryEntryPoint.nodeBuilder(this, buildContext)
|
||||||
.callback(object : RoomDirectoryEntryPoint.Callback {
|
.callback(object : RoomDirectoryEntryPoint.Callback {
|
||||||
override fun onResultClicked(roomDescription: RoomDescription) {
|
override fun onResultClick(roomDescription: RoomDescription) {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
NavTarget.Room(
|
NavTarget.Room(
|
||||||
roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(),
|
roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(),
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ class RoomFlowNode @AssistedInject constructor(
|
||||||
LoadingRoomNodeView(
|
LoadingRoomNodeView(
|
||||||
state = LoadingRoomState.Loading,
|
state = LoadingRoomState.Loading,
|
||||||
hasNetworkConnection = networkStatus == NetworkStatus.Online,
|
hasNetworkConnection = networkStatus == NetworkStatus.Online,
|
||||||
onBackClicked = { navigateUp() },
|
onBackClick = { navigateUp() },
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,14 +121,14 @@ class JoinedRoomFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadingNode(buildContext: BuildContext, onBackClicked: () -> Unit) = node(buildContext) { modifier ->
|
private fun loadingNode(buildContext: BuildContext, onBackClick: () -> Unit) = node(buildContext) { modifier ->
|
||||||
val loadingRoomState by loadingRoomStateStateFlow.collectAsState()
|
val loadingRoomState by loadingRoomStateStateFlow.collectAsState()
|
||||||
val networkStatus by networkMonitor.connectivity.collectAsState()
|
val networkStatus by networkMonitor.connectivity.collectAsState()
|
||||||
LoadingRoomNodeView(
|
LoadingRoomNodeView(
|
||||||
state = loadingRoomState,
|
state = loadingRoomState,
|
||||||
hasNetworkConnection = networkStatus == NetworkStatus.Online,
|
hasNetworkConnection = networkStatus == NetworkStatus.Online,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackClicked = onBackClicked
|
onBackClick = onBackClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
|
||||||
), DaggerComponentOwner {
|
), DaggerComponentOwner {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomId: RoomId)
|
fun onOpenRoom(roomId: RoomId)
|
||||||
fun onPermalinkClicked(data: PermalinkData)
|
fun onPermalinkClick(data: PermalinkData)
|
||||||
fun onForwardedToSingleRoom(roomId: RoomId)
|
fun onForwardedToSingleRoom(roomId: RoomId)
|
||||||
fun onOpenGlobalNotificationSettings()
|
fun onOpenGlobalNotificationSettings()
|
||||||
}
|
}
|
||||||
|
|
@ -144,16 +144,16 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.Messages -> {
|
is NavTarget.Messages -> {
|
||||||
val callback = object : MessagesEntryPoint.Callback {
|
val callback = object : MessagesEntryPoint.Callback {
|
||||||
override fun onRoomDetailsClicked() {
|
override fun onRoomDetailsClick() {
|
||||||
backstack.push(NavTarget.RoomDetails)
|
backstack.push(NavTarget.RoomDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClicked(userId: UserId) {
|
override fun onUserDataClick(userId: UserId) {
|
||||||
backstack.push(NavTarget.RoomMemberDetails(userId))
|
backstack.push(NavTarget.RoomMemberDetails(userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClicked(data: PermalinkData) {
|
override fun onPermalinkClick(data: PermalinkData) {
|
||||||
callbacks.forEach { it.onPermalinkClicked(data) }
|
callbacks.forEach { it.onPermalinkClick(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardedToSingleRoom(roomId: RoomId) {
|
override fun onForwardedToSingleRoom(roomId: RoomId) {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
fun LoadingRoomNodeView(
|
fun LoadingRoomNodeView(
|
||||||
state: LoadingRoomState,
|
state: LoadingRoomState,
|
||||||
hasNetworkConnection: Boolean,
|
hasNetworkConnection: Boolean,
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
|
@ -54,7 +54,7 @@ fun LoadingRoomNodeView(
|
||||||
topBar = {
|
topBar = {
|
||||||
Column {
|
Column {
|
||||||
ConnectivityIndicatorView(isOnline = hasNetworkConnection)
|
ConnectivityIndicatorView(isOnline = hasNetworkConnection)
|
||||||
LoadingRoomTopBar(onBackClicked)
|
LoadingRoomTopBar(onBackClick)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content = { padding ->
|
content = { padding ->
|
||||||
|
|
@ -83,11 +83,11 @@ fun LoadingRoomNodeView(
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun LoadingRoomTopBar(
|
private fun LoadingRoomTopBar(
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackClicked)
|
BackButton(onClick = onBackClick)
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
IconTitlePlaceholdersRowMolecule(iconSize = AvatarSize.TimelineRoom.dp)
|
IconTitlePlaceholdersRowMolecule(iconSize = AvatarSize.TimelineRoom.dp)
|
||||||
|
|
@ -101,7 +101,7 @@ private fun LoadingRoomTopBar(
|
||||||
internal fun LoadingRoomNodeViewPreview(@PreviewParameter(LoadingRoomStateProvider::class) state: LoadingRoomState) = ElementPreview {
|
internal fun LoadingRoomNodeViewPreview(@PreviewParameter(LoadingRoomStateProvider::class) state: LoadingRoomState) = ElementPreview {
|
||||||
LoadingRoomNodeView(
|
LoadingRoomNodeView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClicked = {},
|
onBackClick = {},
|
||||||
hasNetworkConnection = false
|
hasNetworkConnection = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class JoinRoomLoadedFlowNodeTest {
|
||||||
)
|
)
|
||||||
val roomFlowNodeTestHelper = roomFlowNode.parentNodeTestHelper()
|
val roomFlowNodeTestHelper = roomFlowNode.parentNodeTestHelper()
|
||||||
// WHEN
|
// WHEN
|
||||||
fakeMessagesEntryPoint.callback?.onRoomDetailsClicked()
|
fakeMessagesEntryPoint.callback?.onRoomDetailsClick()
|
||||||
// THEN
|
// THEN
|
||||||
roomFlowNodeTestHelper.assertChildHasLifecycle(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails, Lifecycle.State.CREATED)
|
roomFlowNodeTestHelper.assertChildHasLifecycle(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails, Lifecycle.State.CREATED)
|
||||||
val roomDetailsNode = roomFlowNode.childNode(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails)!!
|
val roomDetailsNode = roomFlowNode.childNode(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails)!!
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ allprojects {
|
||||||
config.from(files("$rootDir/tools/detekt/detekt.yml"))
|
config.from(files("$rootDir/tools/detekt/detekt.yml"))
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
detektPlugins("io.nlopez.compose.rules:detekt:0.3.13")
|
detektPlugins("io.nlopez.compose.rules:detekt:0.4.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
// KtLint
|
// KtLint
|
||||||
|
|
|
||||||
|
|
@ -63,15 +63,15 @@ fun AnalyticsOptInView(
|
||||||
) {
|
) {
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
||||||
fun onTermsAccepted() {
|
fun onAcceptTerms() {
|
||||||
eventSink(AnalyticsOptInEvents.EnableAnalytics(true))
|
eventSink(AnalyticsOptInEvents.EnableAnalytics(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onTermsDeclined() {
|
fun onDeclineTerms() {
|
||||||
eventSink(AnalyticsOptInEvents.EnableAnalytics(false))
|
eventSink(AnalyticsOptInEvents.EnableAnalytics(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
BackHandler(onBack = ::onTermsDeclined)
|
BackHandler(onBack = ::onDeclineTerms)
|
||||||
HeaderFooterPage(
|
HeaderFooterPage(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
|
@ -82,8 +82,8 @@ fun AnalyticsOptInView(
|
||||||
content = { AnalyticsOptInContent() },
|
content = { AnalyticsOptInContent() },
|
||||||
footer = {
|
footer = {
|
||||||
AnalyticsOptInFooter(
|
AnalyticsOptInFooter(
|
||||||
onTermsAccepted = ::onTermsAccepted,
|
onAcceptTerms = ::onAcceptTerms,
|
||||||
onTermsDeclined = ::onTermsDeclined,
|
onDeclineTerms = ::onDeclineTerms,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -165,19 +165,19 @@ private fun AnalyticsOptInContent() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AnalyticsOptInFooter(
|
private fun AnalyticsOptInFooter(
|
||||||
onTermsAccepted: () -> Unit,
|
onAcceptTerms: () -> Unit,
|
||||||
onTermsDeclined: () -> Unit,
|
onDeclineTerms: () -> Unit,
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule {
|
ButtonColumnMolecule {
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = CommonStrings.action_ok),
|
text = stringResource(id = CommonStrings.action_ok),
|
||||||
onClick = onTermsAccepted,
|
onClick = onAcceptTerms,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
TextButton(
|
TextButton(
|
||||||
text = stringResource(id = CommonStrings.action_not_now),
|
text = stringResource(id = CommonStrings.action_not_now),
|
||||||
size = ButtonSize.Medium,
|
size = ButtonSize.Medium,
|
||||||
onClick = onTermsDeclined,
|
onClick = onDeclineTerms,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ internal fun CallScreenView(
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
url = state.urlState,
|
url = state.urlState,
|
||||||
userAgent = state.userAgent,
|
userAgent = state.userAgent,
|
||||||
onPermissionsRequested = { request ->
|
onPermissionsRequest = { request ->
|
||||||
val androidPermissions = mapWebkitPermissions(request.resources)
|
val androidPermissions = mapWebkitPermissions(request.resources)
|
||||||
val callback: RequestPermissionCallback = { request.grant(it) }
|
val callback: RequestPermissionCallback = { request.grant(it) }
|
||||||
requestPermissions(androidPermissions.toTypedArray(), callback)
|
requestPermissions(androidPermissions.toTypedArray(), callback)
|
||||||
},
|
},
|
||||||
onWebViewCreated = { webView ->
|
onWebViewCreate = { webView ->
|
||||||
val interceptor = WebViewWidgetMessageInterceptor(webView)
|
val interceptor = WebViewWidgetMessageInterceptor(webView)
|
||||||
state.eventSink(CallScreenEvents.SetupMessageChannels(interceptor))
|
state.eventSink(CallScreenEvents.SetupMessageChannels(interceptor))
|
||||||
}
|
}
|
||||||
|
|
@ -98,8 +98,8 @@ internal fun CallScreenView(
|
||||||
private fun CallWebView(
|
private fun CallWebView(
|
||||||
url: AsyncData<String>,
|
url: AsyncData<String>,
|
||||||
userAgent: String,
|
userAgent: String,
|
||||||
onPermissionsRequested: (PermissionRequest) -> Unit,
|
onPermissionsRequest: (PermissionRequest) -> Unit,
|
||||||
onWebViewCreated: (WebView) -> Unit,
|
onWebViewCreate: (WebView) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
if (LocalInspectionMode.current) {
|
if (LocalInspectionMode.current) {
|
||||||
|
|
@ -111,8 +111,8 @@ private fun CallWebView(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
factory = { context ->
|
factory = { context ->
|
||||||
WebView(context).apply {
|
WebView(context).apply {
|
||||||
onWebViewCreated(this)
|
onWebViewCreate(this)
|
||||||
setup(userAgent, onPermissionsRequested)
|
setup(userAgent, onPermissionsRequest)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update = { webView ->
|
update = { webView ->
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ class AddPeopleNode @AssistedInject constructor(
|
||||||
AddPeopleView(
|
AddPeopleView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
onNextPressed = this::onContinue,
|
onNextClick = this::onContinue,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun AddPeopleView(
|
fun AddPeopleView(
|
||||||
state: UserListState,
|
state: UserListState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onNextPressed: () -> Unit,
|
onNextClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
|
@ -51,14 +51,14 @@ fun AddPeopleView(
|
||||||
topBar = {
|
topBar = {
|
||||||
AddPeopleViewTopBar(
|
AddPeopleViewTopBar(
|
||||||
hasSelectedUsers = state.selectedUsers.isNotEmpty(),
|
hasSelectedUsers = state.selectedUsers.isNotEmpty(),
|
||||||
onBackPressed = {
|
onBackClick = {
|
||||||
if (state.isSearchActive) {
|
if (state.isSearchActive) {
|
||||||
state.eventSink(UserListEvents.OnSearchActiveChanged(false))
|
state.eventSink(UserListEvents.OnSearchActiveChanged(false))
|
||||||
} else {
|
} else {
|
||||||
onBackPressed()
|
onBackClick()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNextPressed = onNextPressed,
|
onNextClick = onNextClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -69,8 +69,8 @@ fun AddPeopleView(
|
||||||
.consumeWindowInsets(padding),
|
.consumeWindowInsets(padding),
|
||||||
state = state,
|
state = state,
|
||||||
showBackButton = false,
|
showBackButton = false,
|
||||||
onUserSelected = {},
|
onSelectUser = {},
|
||||||
onUserDeselected = {},
|
onDeselectUser = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,8 +79,8 @@ fun AddPeopleView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun AddPeopleViewTopBar(
|
private fun AddPeopleViewTopBar(
|
||||||
hasSelectedUsers: Boolean,
|
hasSelectedUsers: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onNextPressed: () -> Unit,
|
onNextClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
|
|
@ -89,12 +89,12 @@ private fun AddPeopleViewTopBar(
|
||||||
style = ElementTheme.typography.aliasScreenTitle
|
style = ElementTheme.typography.aliasScreenTitle
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = { BackButton(onClick = onBackPressed) },
|
navigationIcon = { BackButton(onClick = onBackClick) },
|
||||||
actions = {
|
actions = {
|
||||||
val textActionResId = if (hasSelectedUsers) CommonStrings.action_next else CommonStrings.action_skip
|
val textActionResId = if (hasSelectedUsers) CommonStrings.action_next else CommonStrings.action_skip
|
||||||
TextButton(
|
TextButton(
|
||||||
text = stringResource(id = textActionResId),
|
text = stringResource(id = textActionResId),
|
||||||
onClick = onNextPressed,
|
onClick = onNextClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -105,7 +105,7 @@ private fun AddPeopleViewTopBar(
|
||||||
internal fun AddPeopleViewPreview(@PreviewParameter(AddPeopleUserListStateProvider::class) state: UserListState) = ElementPreview {
|
internal fun AddPeopleViewPreview(@PreviewParameter(AddPeopleUserListStateProvider::class) state: UserListState) = ElementPreview {
|
||||||
AddPeopleView(
|
AddPeopleView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
onNextPressed = {},
|
onNextClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
@Composable
|
@Composable
|
||||||
fun RoomPrivacyOption(
|
fun RoomPrivacyOption(
|
||||||
roomPrivacyItem: RoomPrivacyItem,
|
roomPrivacyItem: RoomPrivacyItem,
|
||||||
onOptionSelected: (RoomPrivacyItem) -> Unit,
|
onOptionClick: (RoomPrivacyItem) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
isSelected: Boolean = false,
|
isSelected: Boolean = false,
|
||||||
) {
|
) {
|
||||||
|
|
@ -50,7 +50,7 @@ fun RoomPrivacyOption(
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.selectable(
|
.selectable(
|
||||||
selected = isSelected,
|
selected = isSelected,
|
||||||
onClick = { onOptionSelected(roomPrivacyItem) },
|
onClick = { onOptionClick(roomPrivacyItem) },
|
||||||
role = Role.RadioButton,
|
role = Role.RadioButton,
|
||||||
)
|
)
|
||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
|
|
@ -98,12 +98,12 @@ internal fun RoomPrivacyOptionPreview() = ElementPreview {
|
||||||
Column {
|
Column {
|
||||||
RoomPrivacyOption(
|
RoomPrivacyOption(
|
||||||
roomPrivacyItem = aRoomPrivacyItem,
|
roomPrivacyItem = aRoomPrivacyItem,
|
||||||
onOptionSelected = {},
|
onOptionClick = {},
|
||||||
isSelected = true,
|
isSelected = true,
|
||||||
)
|
)
|
||||||
RoomPrivacyOption(
|
RoomPrivacyOption(
|
||||||
roomPrivacyItem = aRoomPrivacyItem,
|
roomPrivacyItem = aRoomPrivacyItem,
|
||||||
onOptionSelected = {},
|
onOptionClick = {},
|
||||||
isSelected = false,
|
isSelected = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,11 @@ fun SearchUserBar(
|
||||||
showLoader: Boolean,
|
showLoader: Boolean,
|
||||||
selectedUsers: ImmutableList<MatrixUser>,
|
selectedUsers: ImmutableList<MatrixUser>,
|
||||||
active: Boolean,
|
active: Boolean,
|
||||||
isMultiSelectionEnabled: Boolean,
|
isMultiSelectionEnable: Boolean,
|
||||||
onActiveChanged: (Boolean) -> Unit,
|
onActiveChange: (Boolean) -> Unit,
|
||||||
onTextChanged: (String) -> Unit,
|
onTextChange: (String) -> Unit,
|
||||||
onUserSelected: (MatrixUser) -> Unit,
|
onUserSelect: (MatrixUser) -> Unit,
|
||||||
onUserDeselected: (MatrixUser) -> Unit,
|
onUserDeselect: (MatrixUser) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
showBackButton: Boolean = true,
|
showBackButton: Boolean = true,
|
||||||
placeHolderTitle: String = stringResource(CommonStrings.common_search_for_someone),
|
placeHolderTitle: String = stringResource(CommonStrings.common_search_for_someone),
|
||||||
|
|
@ -66,14 +66,14 @@ fun SearchUserBar(
|
||||||
|
|
||||||
SearchBar(
|
SearchBar(
|
||||||
query = query,
|
query = query,
|
||||||
onQueryChange = onTextChanged,
|
onQueryChange = onTextChange,
|
||||||
active = active,
|
active = active,
|
||||||
onActiveChange = onActiveChanged,
|
onActiveChange = onActiveChange,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
placeHolderTitle = placeHolderTitle,
|
placeHolderTitle = placeHolderTitle,
|
||||||
showBackButton = showBackButton,
|
showBackButton = showBackButton,
|
||||||
contentPrefix = {
|
contentPrefix = {
|
||||||
if (isMultiSelectionEnabled && active && selectedUsers.isNotEmpty()) {
|
if (isMultiSelectionEnable && active && selectedUsers.isNotEmpty()) {
|
||||||
// We want the selected users to behave a bit like a top bar - when the list below is scrolled, the colour
|
// We want the selected users to behave a bit like a top bar - when the list below is scrolled, the colour
|
||||||
// should change to indicate elevation.
|
// should change to indicate elevation.
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ fun SearchUserBar(
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(16.dp),
|
||||||
selectedUsers = selectedUsers,
|
selectedUsers = selectedUsers,
|
||||||
autoScroll = true,
|
autoScroll = true,
|
||||||
onUserRemoved = onUserDeselected,
|
onUserRemove = onUserDeselect,
|
||||||
modifier = Modifier.background(appBarContainerColor)
|
modifier = Modifier.background(appBarContainerColor)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ fun SearchUserBar(
|
||||||
resultState = state,
|
resultState = state,
|
||||||
resultHandler = { users ->
|
resultHandler = { users ->
|
||||||
LazyColumn(state = columnState) {
|
LazyColumn(state = columnState) {
|
||||||
if (isMultiSelectionEnabled) {
|
if (isMultiSelectionEnable) {
|
||||||
itemsIndexed(users) { index, searchResult ->
|
itemsIndexed(users) { index, searchResult ->
|
||||||
SearchMultipleUsersResultItem(
|
SearchMultipleUsersResultItem(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
|
@ -117,9 +117,9 @@ fun SearchUserBar(
|
||||||
isUserSelected = selectedUsers.contains(searchResult.matrixUser),
|
isUserSelected = selectedUsers.contains(searchResult.matrixUser),
|
||||||
onCheckedChange = { checked ->
|
onCheckedChange = { checked ->
|
||||||
if (checked) {
|
if (checked) {
|
||||||
onUserSelected(searchResult.matrixUser)
|
onUserSelect(searchResult.matrixUser)
|
||||||
} else {
|
} else {
|
||||||
onUserDeselected(searchResult.matrixUser)
|
onUserDeselect(searchResult.matrixUser)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -132,7 +132,7 @@ fun SearchUserBar(
|
||||||
SearchSingleUserResultItem(
|
SearchSingleUserResultItem(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
searchResult = searchResult,
|
searchResult = searchResult,
|
||||||
onClick = { onUserSelected(searchResult.matrixUser) }
|
onClick = { onUserSelect(searchResult.matrixUser) }
|
||||||
)
|
)
|
||||||
if (index < users.lastIndex) {
|
if (index < users.lastIndex) {
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun UserListView(
|
fun UserListView(
|
||||||
state: UserListState,
|
state: UserListState,
|
||||||
onUserSelected: (MatrixUser) -> Unit,
|
onSelectUser: (MatrixUser) -> Unit,
|
||||||
onUserDeselected: (MatrixUser) -> Unit,
|
onDeselectUser: (MatrixUser) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
showBackButton: Boolean = true,
|
showBackButton: Boolean = true,
|
||||||
) {
|
) {
|
||||||
|
|
@ -59,17 +59,17 @@ fun UserListView(
|
||||||
selectedUsers = state.selectedUsers,
|
selectedUsers = state.selectedUsers,
|
||||||
active = state.isSearchActive,
|
active = state.isSearchActive,
|
||||||
showLoader = state.showSearchLoader,
|
showLoader = state.showSearchLoader,
|
||||||
isMultiSelectionEnabled = state.isMultiSelectionEnabled,
|
isMultiSelectionEnable = state.isMultiSelectionEnabled,
|
||||||
showBackButton = showBackButton,
|
showBackButton = showBackButton,
|
||||||
onActiveChanged = { state.eventSink(UserListEvents.OnSearchActiveChanged(it)) },
|
onActiveChange = { state.eventSink(UserListEvents.OnSearchActiveChanged(it)) },
|
||||||
onTextChanged = { state.eventSink(UserListEvents.UpdateSearchQuery(it)) },
|
onTextChange = { state.eventSink(UserListEvents.UpdateSearchQuery(it)) },
|
||||||
onUserSelected = {
|
onUserSelect = {
|
||||||
state.eventSink(UserListEvents.AddToSelection(it))
|
state.eventSink(UserListEvents.AddToSelection(it))
|
||||||
onUserSelected(it)
|
onSelectUser(it)
|
||||||
},
|
},
|
||||||
onUserDeselected = {
|
onUserDeselect = {
|
||||||
state.eventSink(UserListEvents.RemoveFromSelection(it))
|
state.eventSink(UserListEvents.RemoveFromSelection(it))
|
||||||
onUserDeselected(it)
|
onDeselectUser(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -78,9 +78,9 @@ fun UserListView(
|
||||||
contentPadding = PaddingValues(16.dp),
|
contentPadding = PaddingValues(16.dp),
|
||||||
selectedUsers = state.selectedUsers,
|
selectedUsers = state.selectedUsers,
|
||||||
autoScroll = true,
|
autoScroll = true,
|
||||||
onUserRemoved = {
|
onUserRemove = {
|
||||||
state.eventSink(UserListEvents.RemoveFromSelection(it))
|
state.eventSink(UserListEvents.RemoveFromSelection(it))
|
||||||
onUserDeselected(it)
|
onDeselectUser(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -102,10 +102,10 @@ fun UserListView(
|
||||||
onCheckedChange = {
|
onCheckedChange = {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
state.eventSink(UserListEvents.RemoveFromSelection(recentDirectRoom.matrixUser))
|
state.eventSink(UserListEvents.RemoveFromSelection(recentDirectRoom.matrixUser))
|
||||||
onUserDeselected(recentDirectRoom.matrixUser)
|
onDeselectUser(recentDirectRoom.matrixUser)
|
||||||
} else {
|
} else {
|
||||||
state.eventSink(UserListEvents.AddToSelection(recentDirectRoom.matrixUser))
|
state.eventSink(UserListEvents.AddToSelection(recentDirectRoom.matrixUser))
|
||||||
onUserSelected(recentDirectRoom.matrixUser)
|
onSelectUser(recentDirectRoom.matrixUser)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data = CheckableUserRowData.Resolved(
|
data = CheckableUserRowData.Resolved(
|
||||||
|
|
@ -129,7 +129,7 @@ fun UserListView(
|
||||||
internal fun UserListViewPreview(@PreviewParameter(UserListStateProvider::class) state: UserListState) = ElementPreview {
|
internal fun UserListViewPreview(@PreviewParameter(UserListStateProvider::class) state: UserListState) = ElementPreview {
|
||||||
UserListView(
|
UserListView(
|
||||||
state = state,
|
state = state,
|
||||||
onUserSelected = {},
|
onSelectUser = {},
|
||||||
onUserDeselected = {},
|
onDeselectUser = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class ConfigureRoomNode @AssistedInject constructor(
|
||||||
fun onCreateRoomSuccess(roomId: RoomId)
|
fun onCreateRoomSuccess(roomId: RoomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRoomCreated(roomId: RoomId) {
|
private fun onCreateRoomSuccess(roomId: RoomId) {
|
||||||
plugins<Callback>().forEach { it.onCreateRoomSuccess(roomId) }
|
plugins<Callback>().forEach { it.onCreateRoomSuccess(roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,8 +60,8 @@ class ConfigureRoomNode @AssistedInject constructor(
|
||||||
ConfigureRoomView(
|
ConfigureRoomView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
onRoomCreated = this::onRoomCreated,
|
onCreateRoomSuccess = this::onCreateRoomSuccess,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun ConfigureRoomView(
|
fun ConfigureRoomView(
|
||||||
state: ConfigureRoomState,
|
state: ConfigureRoomState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onRoomCreated: (RoomId) -> Unit,
|
onCreateRoomSuccess: (RoomId) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
val isAvatarActionsSheetVisible = remember { mutableStateOf(false) }
|
val isAvatarActionsSheetVisible = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
fun onAvatarClicked() {
|
fun onAvatarClick() {
|
||||||
focusManager.clearFocus()
|
focusManager.clearFocus()
|
||||||
isAvatarActionsSheetVisible.value = true
|
isAvatarActionsSheetVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
@ -82,8 +82,8 @@ fun ConfigureRoomView(
|
||||||
topBar = {
|
topBar = {
|
||||||
ConfigureRoomToolbar(
|
ConfigureRoomToolbar(
|
||||||
isNextActionEnabled = state.isCreateButtonEnabled,
|
isNextActionEnabled = state.isCreateButtonEnabled,
|
||||||
onBackPressed = onBackPressed,
|
onBackClick = onBackClick,
|
||||||
onNextPressed = {
|
onNextClick = {
|
||||||
focusManager.clearFocus()
|
focusManager.clearFocus()
|
||||||
state.eventSink(ConfigureRoomEvents.CreateRoom(state.config))
|
state.eventSink(ConfigureRoomEvents.CreateRoom(state.config))
|
||||||
},
|
},
|
||||||
|
|
@ -102,20 +102,20 @@ fun ConfigureRoomView(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
avatarUri = state.config.avatarUri,
|
avatarUri = state.config.avatarUri,
|
||||||
roomName = state.config.roomName.orEmpty(),
|
roomName = state.config.roomName.orEmpty(),
|
||||||
onAvatarClick = ::onAvatarClicked,
|
onAvatarClick = ::onAvatarClick,
|
||||||
onRoomNameChanged = { state.eventSink(ConfigureRoomEvents.RoomNameChanged(it)) },
|
onChangeRoomName = { state.eventSink(ConfigureRoomEvents.RoomNameChanged(it)) },
|
||||||
)
|
)
|
||||||
RoomTopic(
|
RoomTopic(
|
||||||
modifier = Modifier.padding(horizontal = 16.dp),
|
modifier = Modifier.padding(horizontal = 16.dp),
|
||||||
topic = state.config.topic.orEmpty(),
|
topic = state.config.topic.orEmpty(),
|
||||||
onTopicChanged = { state.eventSink(ConfigureRoomEvents.TopicChanged(it)) },
|
onTopicChange = { state.eventSink(ConfigureRoomEvents.TopicChanged(it)) },
|
||||||
)
|
)
|
||||||
if (state.config.invites.isNotEmpty()) {
|
if (state.config.invites.isNotEmpty()) {
|
||||||
SelectedUsersRowList(
|
SelectedUsersRowList(
|
||||||
modifier = Modifier.padding(bottom = 16.dp),
|
modifier = Modifier.padding(bottom = 16.dp),
|
||||||
contentPadding = PaddingValues(horizontal = 24.dp),
|
contentPadding = PaddingValues(horizontal = 24.dp),
|
||||||
selectedUsers = state.config.invites,
|
selectedUsers = state.config.invites,
|
||||||
onUserRemoved = {
|
onUserRemove = {
|
||||||
focusManager.clearFocus()
|
focusManager.clearFocus()
|
||||||
state.eventSink(ConfigureRoomEvents.RemoveFromSelection(it))
|
state.eventSink(ConfigureRoomEvents.RemoveFromSelection(it))
|
||||||
},
|
},
|
||||||
|
|
@ -124,7 +124,7 @@ fun ConfigureRoomView(
|
||||||
RoomPrivacyOptions(
|
RoomPrivacyOptions(
|
||||||
modifier = Modifier.padding(bottom = 40.dp),
|
modifier = Modifier.padding(bottom = 40.dp),
|
||||||
selected = state.config.privacy,
|
selected = state.config.privacy,
|
||||||
onOptionSelected = {
|
onOptionClick = {
|
||||||
focusManager.clearFocus()
|
focusManager.clearFocus()
|
||||||
state.eventSink(ConfigureRoomEvents.RoomPrivacyChanged(it.privacy))
|
state.eventSink(ConfigureRoomEvents.RoomPrivacyChanged(it.privacy))
|
||||||
},
|
},
|
||||||
|
|
@ -136,7 +136,7 @@ fun ConfigureRoomView(
|
||||||
actions = state.avatarActions,
|
actions = state.avatarActions,
|
||||||
isVisible = isAvatarActionsSheetVisible.value,
|
isVisible = isAvatarActionsSheetVisible.value,
|
||||||
onDismiss = { isAvatarActionsSheetVisible.value = false },
|
onDismiss = { isAvatarActionsSheetVisible.value = false },
|
||||||
onActionSelected = { state.eventSink(ConfigureRoomEvents.HandleAvatarAction(it)) }
|
onSelectAction = { state.eventSink(ConfigureRoomEvents.HandleAvatarAction(it)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
AsyncActionView(
|
AsyncActionView(
|
||||||
|
|
@ -146,7 +146,7 @@ fun ConfigureRoomView(
|
||||||
progressText = stringResource(CommonStrings.common_creating_room),
|
progressText = stringResource(CommonStrings.common_creating_room),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onSuccess = { onRoomCreated(it) },
|
onSuccess = { onCreateRoomSuccess(it) },
|
||||||
errorMessage = { stringResource(R.string.screen_create_room_error_creating_room) },
|
errorMessage = { stringResource(R.string.screen_create_room_error_creating_room) },
|
||||||
onRetry = { state.eventSink(ConfigureRoomEvents.CreateRoom(state.config)) },
|
onRetry = { state.eventSink(ConfigureRoomEvents.CreateRoom(state.config)) },
|
||||||
onErrorDismiss = { state.eventSink(ConfigureRoomEvents.CancelCreateRoom) },
|
onErrorDismiss = { state.eventSink(ConfigureRoomEvents.CancelCreateRoom) },
|
||||||
|
|
@ -161,8 +161,8 @@ fun ConfigureRoomView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun ConfigureRoomToolbar(
|
private fun ConfigureRoomToolbar(
|
||||||
isNextActionEnabled: Boolean,
|
isNextActionEnabled: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onNextPressed: () -> Unit,
|
onNextClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
|
|
@ -171,12 +171,12 @@ private fun ConfigureRoomToolbar(
|
||||||
style = ElementTheme.typography.aliasScreenTitle,
|
style = ElementTheme.typography.aliasScreenTitle,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = { BackButton(onClick = onBackPressed) },
|
navigationIcon = { BackButton(onClick = onBackClick) },
|
||||||
actions = {
|
actions = {
|
||||||
TextButton(
|
TextButton(
|
||||||
text = stringResource(CommonStrings.action_create),
|
text = stringResource(CommonStrings.action_create),
|
||||||
enabled = isNextActionEnabled,
|
enabled = isNextActionEnabled,
|
||||||
onClick = onNextPressed,
|
onClick = onNextClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -187,7 +187,7 @@ private fun RoomNameWithAvatar(
|
||||||
avatarUri: Uri?,
|
avatarUri: Uri?,
|
||||||
roomName: String,
|
roomName: String,
|
||||||
onAvatarClick: () -> Unit,
|
onAvatarClick: () -> Unit,
|
||||||
onRoomNameChanged: (String) -> Unit,
|
onChangeRoomName: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -205,7 +205,7 @@ private fun RoomNameWithAvatar(
|
||||||
value = roomName,
|
value = roomName,
|
||||||
placeholder = stringResource(CommonStrings.common_room_name_placeholder),
|
placeholder = stringResource(CommonStrings.common_room_name_placeholder),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
onValueChange = onRoomNameChanged,
|
onValueChange = onChangeRoomName,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -213,7 +213,7 @@ private fun RoomNameWithAvatar(
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoomTopic(
|
private fun RoomTopic(
|
||||||
topic: String,
|
topic: String,
|
||||||
onTopicChanged: (String) -> Unit,
|
onTopicChange: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
LabelledTextField(
|
LabelledTextField(
|
||||||
|
|
@ -221,7 +221,7 @@ private fun RoomTopic(
|
||||||
label = stringResource(R.string.screen_create_room_topic_label),
|
label = stringResource(R.string.screen_create_room_topic_label),
|
||||||
value = topic,
|
value = topic,
|
||||||
placeholder = stringResource(CommonStrings.common_topic_placeholder),
|
placeholder = stringResource(CommonStrings.common_topic_placeholder),
|
||||||
onValueChange = onTopicChanged,
|
onValueChange = onTopicChange,
|
||||||
maxLines = 3,
|
maxLines = 3,
|
||||||
keyboardOptions = KeyboardOptions(
|
keyboardOptions = KeyboardOptions(
|
||||||
capitalization = KeyboardCapitalization.Sentences,
|
capitalization = KeyboardCapitalization.Sentences,
|
||||||
|
|
@ -232,7 +232,7 @@ private fun RoomTopic(
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoomPrivacyOptions(
|
private fun RoomPrivacyOptions(
|
||||||
selected: RoomPrivacy?,
|
selected: RoomPrivacy?,
|
||||||
onOptionSelected: (RoomPrivacyItem) -> Unit,
|
onOptionClick: (RoomPrivacyItem) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val items = roomPrivacyItems()
|
val items = roomPrivacyItems()
|
||||||
|
|
@ -241,7 +241,7 @@ private fun RoomPrivacyOptions(
|
||||||
RoomPrivacyOption(
|
RoomPrivacyOption(
|
||||||
roomPrivacyItem = item,
|
roomPrivacyItem = item,
|
||||||
isSelected = selected == item.privacy,
|
isSelected = selected == item.privacy,
|
||||||
onOptionSelected = onOptionSelected,
|
onOptionClick = onOptionClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -252,7 +252,7 @@ private fun RoomPrivacyOptions(
|
||||||
internal fun ConfigureRoomViewPreview(@PreviewParameter(ConfigureRoomStateProvider::class) state: ConfigureRoomState) = ElementPreview {
|
internal fun ConfigureRoomViewPreview(@PreviewParameter(ConfigureRoomStateProvider::class) state: ConfigureRoomState) = ElementPreview {
|
||||||
ConfigureRoomView(
|
ConfigureRoomView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
onRoomCreated = {},
|
onCreateRoomSuccess = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,10 @@ class CreateRoomRootNode @AssistedInject constructor(
|
||||||
CreateRoomRootView(
|
CreateRoomRootView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onClosePressed = this::navigateUp,
|
onCloseClick = this::navigateUp,
|
||||||
onNewRoomClicked = ::onCreateNewRoom,
|
onNewRoomClick = ::onCreateNewRoom,
|
||||||
onOpenDM = ::onStartChatSuccess,
|
onOpenDM = ::onStartChatSuccess,
|
||||||
onInviteFriendsClicked = { invitePeople(activity) }
|
onInviteFriendsClick = { invitePeople(activity) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,17 +59,17 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
@Composable
|
@Composable
|
||||||
fun CreateRoomRootView(
|
fun CreateRoomRootView(
|
||||||
state: CreateRoomRootState,
|
state: CreateRoomRootState,
|
||||||
onClosePressed: () -> Unit,
|
onCloseClick: () -> Unit,
|
||||||
onNewRoomClicked: () -> Unit,
|
onNewRoomClick: () -> Unit,
|
||||||
onOpenDM: (RoomId) -> Unit,
|
onOpenDM: (RoomId) -> Unit,
|
||||||
onInviteFriendsClicked: () -> Unit,
|
onInviteFriendsClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = modifier.fillMaxWidth(),
|
||||||
topBar = {
|
topBar = {
|
||||||
if (!state.userListState.isSearchActive) {
|
if (!state.userListState.isSearchActive) {
|
||||||
CreateRoomRootViewTopBar(onClosePressed = onClosePressed)
|
CreateRoomRootViewTopBar(onCloseClick = onCloseClick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
|
|
@ -86,18 +86,18 @@ fun CreateRoomRootView(
|
||||||
state = state.userListState.copy(
|
state = state.userListState.copy(
|
||||||
recentDirectRooms = persistentListOf(),
|
recentDirectRooms = persistentListOf(),
|
||||||
),
|
),
|
||||||
onUserSelected = {
|
onSelectUser = {
|
||||||
state.eventSink(CreateRoomRootEvents.StartDM(it))
|
state.eventSink(CreateRoomRootEvents.StartDM(it))
|
||||||
},
|
},
|
||||||
onUserDeselected = { },
|
onDeselectUser = { },
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!state.userListState.isSearchActive) {
|
if (!state.userListState.isSearchActive) {
|
||||||
CreateRoomActionButtonsList(
|
CreateRoomActionButtonsList(
|
||||||
state = state,
|
state = state,
|
||||||
onNewRoomClicked = onNewRoomClicked,
|
onNewRoomClick = onNewRoomClick,
|
||||||
onInvitePeopleClicked = onInviteFriendsClicked,
|
onInvitePeopleClick = onInviteFriendsClick,
|
||||||
onDmClicked = onOpenDM,
|
onDmClick = onOpenDM,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ fun CreateRoomRootView(
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun CreateRoomRootViewTopBar(
|
private fun CreateRoomRootViewTopBar(
|
||||||
onClosePressed: () -> Unit,
|
onCloseClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
|
|
@ -137,7 +137,7 @@ private fun CreateRoomRootViewTopBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(
|
BackButton(
|
||||||
imageVector = CompoundIcons.Close(),
|
imageVector = CompoundIcons.Close(),
|
||||||
onClick = onClosePressed,
|
onClick = onCloseClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -146,23 +146,23 @@ private fun CreateRoomRootViewTopBar(
|
||||||
@Composable
|
@Composable
|
||||||
private fun CreateRoomActionButtonsList(
|
private fun CreateRoomActionButtonsList(
|
||||||
state: CreateRoomRootState,
|
state: CreateRoomRootState,
|
||||||
onNewRoomClicked: () -> Unit,
|
onNewRoomClick: () -> Unit,
|
||||||
onInvitePeopleClicked: () -> Unit,
|
onInvitePeopleClick: () -> Unit,
|
||||||
onDmClicked: (RoomId) -> Unit,
|
onDmClick: (RoomId) -> Unit,
|
||||||
) {
|
) {
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
item {
|
item {
|
||||||
CreateRoomActionButton(
|
CreateRoomActionButton(
|
||||||
iconRes = CompoundDrawables.ic_compound_plus,
|
iconRes = CompoundDrawables.ic_compound_plus,
|
||||||
text = stringResource(id = R.string.screen_create_room_action_create_room),
|
text = stringResource(id = R.string.screen_create_room_action_create_room),
|
||||||
onClick = onNewRoomClicked,
|
onClick = onNewRoomClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
item {
|
item {
|
||||||
CreateRoomActionButton(
|
CreateRoomActionButton(
|
||||||
iconRes = CompoundDrawables.ic_compound_share_android,
|
iconRes = CompoundDrawables.ic_compound_share_android,
|
||||||
text = stringResource(id = CommonStrings.action_invite_friends_to_app, state.applicationName),
|
text = stringResource(id = CommonStrings.action_invite_friends_to_app, state.applicationName),
|
||||||
onClick = onInvitePeopleClicked,
|
onClick = onInvitePeopleClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (state.userListState.recentDirectRooms.isNotEmpty()) {
|
if (state.userListState.recentDirectRooms.isNotEmpty()) {
|
||||||
|
|
@ -177,7 +177,7 @@ private fun CreateRoomActionButtonsList(
|
||||||
MatrixUserRow(
|
MatrixUserRow(
|
||||||
modifier = Modifier.clickable(
|
modifier = Modifier.clickable(
|
||||||
onClick = {
|
onClick = {
|
||||||
onDmClicked(recentDirectRoom.roomId)
|
onDmClick(recentDirectRoom.roomId)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
matrixUser = recentDirectRoom.matrixUser,
|
matrixUser = recentDirectRoom.matrixUser,
|
||||||
|
|
@ -222,9 +222,9 @@ internal fun CreateRoomRootViewPreview(@PreviewParameter(CreateRoomRootStateProv
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
CreateRoomRootView(
|
CreateRoomRootView(
|
||||||
state = state,
|
state = state,
|
||||||
onClosePressed = {},
|
onCloseClick = {},
|
||||||
onNewRoomClicked = {},
|
onNewRoomClick = {},
|
||||||
onOpenDM = {},
|
onOpenDM = {},
|
||||||
onInviteFriendsClicked = {},
|
onInviteFriendsClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class AddPeopleViewTest {
|
||||||
aUserListState(
|
aUserListState(
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onBackPressed = it
|
onBackClick = it
|
||||||
)
|
)
|
||||||
rule.pressBack()
|
rule.pressBack()
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +75,7 @@ class AddPeopleViewTest {
|
||||||
aUserListState(
|
aUserListState(
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onNextPressed = it
|
onNextClick = it
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_skip)
|
rule.clickOn(CommonStrings.action_skip)
|
||||||
}
|
}
|
||||||
|
|
@ -85,14 +85,14 @@ class AddPeopleViewTest {
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setAddPeopleView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setAddPeopleView(
|
||||||
state: UserListState,
|
state: UserListState,
|
||||||
onBackPressed: () -> Unit = EnsureNeverCalled(),
|
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onNextPressed: () -> Unit = EnsureNeverCalled(),
|
onNextClick: () -> Unit = EnsureNeverCalled(),
|
||||||
) {
|
) {
|
||||||
setContent {
|
setContent {
|
||||||
AddPeopleView(
|
AddPeopleView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = onBackPressed,
|
onBackClick = onBackClick,
|
||||||
onNextPressed = onNextPressed,
|
onNextClick = onNextClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class CreateRoomRootViewTest {
|
||||||
aCreateRoomRootState(
|
aCreateRoomRootState(
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onClosePressed = it
|
onCloseClick = it
|
||||||
)
|
)
|
||||||
rule.pressBack()
|
rule.pressBack()
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +68,7 @@ class CreateRoomRootViewTest {
|
||||||
aCreateRoomRootState(
|
aCreateRoomRootState(
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onNewRoomClicked = it
|
onNewRoomClick = it
|
||||||
)
|
)
|
||||||
rule.clickOn(R.string.screen_create_room_action_create_room)
|
rule.clickOn(R.string.screen_create_room_action_create_room)
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ class CreateRoomRootViewTest {
|
||||||
applicationName = "test",
|
applicationName = "test",
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onInviteFriendsClicked = it
|
onInviteFriendsClick = it
|
||||||
)
|
)
|
||||||
val text = rule.activity.getString(CommonStrings.action_invite_friends_to_app, "test")
|
val text = rule.activity.getString(CommonStrings.action_invite_friends_to_app, "test")
|
||||||
rule.onNodeWithText(text).performClick()
|
rule.onNodeWithText(text).performClick()
|
||||||
|
|
@ -114,18 +114,18 @@ class CreateRoomRootViewTest {
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setCreateRoomRootView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setCreateRoomRootView(
|
||||||
state: CreateRoomRootState,
|
state: CreateRoomRootState,
|
||||||
onClosePressed: () -> Unit = EnsureNeverCalled(),
|
onCloseClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onNewRoomClicked: () -> Unit = EnsureNeverCalled(),
|
onNewRoomClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onOpenDM: (RoomId) -> Unit = EnsureNeverCalledWithParam(),
|
onOpenDM: (RoomId) -> Unit = EnsureNeverCalledWithParam(),
|
||||||
onInviteFriendsClicked: () -> Unit = EnsureNeverCalled(),
|
onInviteFriendsClick: () -> Unit = EnsureNeverCalled(),
|
||||||
) {
|
) {
|
||||||
setContent {
|
setContent {
|
||||||
CreateRoomRootView(
|
CreateRoomRootView(
|
||||||
state = state,
|
state = state,
|
||||||
onClosePressed = onClosePressed,
|
onCloseClick = onCloseClick,
|
||||||
onNewRoomClicked = onNewRoomClicked,
|
onNewRoomClick = onNewRoomClick,
|
||||||
onOpenDM = onOpenDM,
|
onOpenDM = onOpenDM,
|
||||||
onInviteFriendsClicked = onInviteFriendsClicked,
|
onInviteFriendsClick = onInviteFriendsClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,18 @@ class WelcomeNode @AssistedInject constructor(
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onContinueClicked()
|
fun onContinueClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onContinueClicked() {
|
private fun onContinueClick() {
|
||||||
plugins.filterIsInstance<Callback>().forEach { it.onContinueClicked() }
|
plugins.filterIsInstance<Callback>().forEach { it.onContinueClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
WelcomeView(
|
WelcomeView(
|
||||||
applicationName = buildMeta.applicationName,
|
applicationName = buildMeta.applicationName,
|
||||||
onContinueClicked = ::onContinueClicked,
|
onContinueClick = ::onContinueClick,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ import kotlinx.collections.immutable.persistentListOf
|
||||||
fun WelcomeView(
|
fun WelcomeView(
|
||||||
applicationName: String,
|
applicationName: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onContinueClicked: () -> Unit,
|
onContinueClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
BackHandler(onBack = onContinueClicked)
|
BackHandler(onBack = onContinueClick)
|
||||||
OnBoardingPage(
|
OnBoardingPage(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.systemBarsPadding()
|
.systemBarsPadding()
|
||||||
|
|
@ -90,7 +90,7 @@ fun WelcomeView(
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(CommonStrings.action_continue),
|
text = stringResource(CommonStrings.action_continue),
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
onClick = onContinueClicked
|
onClick = onContinueClick
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
Spacer(modifier = Modifier.height(32.dp))
|
||||||
}
|
}
|
||||||
|
|
@ -113,6 +113,6 @@ private fun listItems() = persistentListOf(
|
||||||
@Composable
|
@Composable
|
||||||
internal fun WelcomeViewPreview() {
|
internal fun WelcomeViewPreview() {
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
WelcomeView(applicationName = "Element X", onContinueClicked = {})
|
WelcomeView(applicationName = "Element X", onContinueClick = {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ interface AcceptDeclineInviteView {
|
||||||
@Composable
|
@Composable
|
||||||
fun Render(
|
fun Render(
|
||||||
state: AcceptDeclineInviteState,
|
state: AcceptDeclineInviteState,
|
||||||
onInviteAccepted: (RoomId) -> Unit,
|
onAcceptInvite: (RoomId) -> Unit,
|
||||||
onInviteDeclined: (RoomId) -> Unit,
|
onDeclineInvite: (RoomId) -> Unit,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,21 +36,21 @@ import kotlin.jvm.optionals.getOrNull
|
||||||
@Composable
|
@Composable
|
||||||
fun AcceptDeclineInviteView(
|
fun AcceptDeclineInviteView(
|
||||||
state: AcceptDeclineInviteState,
|
state: AcceptDeclineInviteState,
|
||||||
onInviteAccepted: (RoomId) -> Unit,
|
onAcceptInvite: (RoomId) -> Unit,
|
||||||
onInviteDeclined: (RoomId) -> Unit,
|
onDeclineInvite: (RoomId) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
AsyncActionView(
|
AsyncActionView(
|
||||||
async = state.acceptAction,
|
async = state.acceptAction,
|
||||||
onSuccess = onInviteAccepted,
|
onSuccess = onAcceptInvite,
|
||||||
onErrorDismiss = {
|
onErrorDismiss = {
|
||||||
state.eventSink(InternalAcceptDeclineInviteEvents.DismissAcceptError)
|
state.eventSink(InternalAcceptDeclineInviteEvents.DismissAcceptError)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
AsyncActionView(
|
AsyncActionView(
|
||||||
async = state.declineAction,
|
async = state.declineAction,
|
||||||
onSuccess = onInviteDeclined,
|
onSuccess = onDeclineInvite,
|
||||||
onErrorDismiss = {
|
onErrorDismiss = {
|
||||||
state.eventSink(InternalAcceptDeclineInviteEvents.DismissDeclineError)
|
state.eventSink(InternalAcceptDeclineInviteEvents.DismissDeclineError)
|
||||||
},
|
},
|
||||||
|
|
@ -59,10 +59,10 @@ fun AcceptDeclineInviteView(
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
DeclineConfirmationDialog(
|
DeclineConfirmationDialog(
|
||||||
invite = invite,
|
invite = invite,
|
||||||
onConfirmClicked = {
|
onConfirmClick = {
|
||||||
state.eventSink(InternalAcceptDeclineInviteEvents.ConfirmDeclineInvite)
|
state.eventSink(InternalAcceptDeclineInviteEvents.ConfirmDeclineInvite)
|
||||||
},
|
},
|
||||||
onDismissClicked = {
|
onDismissClick = {
|
||||||
state.eventSink(InternalAcceptDeclineInviteEvents.CancelDeclineInvite)
|
state.eventSink(InternalAcceptDeclineInviteEvents.CancelDeclineInvite)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -75,8 +75,8 @@ fun AcceptDeclineInviteView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun DeclineConfirmationDialog(
|
private fun DeclineConfirmationDialog(
|
||||||
invite: InviteData,
|
invite: InviteData,
|
||||||
onConfirmClicked: () -> Unit,
|
onConfirmClick: () -> Unit,
|
||||||
onDismissClicked: () -> Unit,
|
onDismissClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val contentResource = if (invite.isDirect) {
|
val contentResource = if (invite.isDirect) {
|
||||||
|
|
@ -97,8 +97,8 @@ private fun DeclineConfirmationDialog(
|
||||||
title = stringResource(titleResource),
|
title = stringResource(titleResource),
|
||||||
submitText = stringResource(CommonStrings.action_decline),
|
submitText = stringResource(CommonStrings.action_decline),
|
||||||
cancelText = stringResource(CommonStrings.action_cancel),
|
cancelText = stringResource(CommonStrings.action_cancel),
|
||||||
onSubmitClicked = onConfirmClicked,
|
onSubmitClick = onConfirmClick,
|
||||||
onDismiss = onDismissClicked,
|
onDismiss = onDismissClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ internal fun AcceptDeclineInviteViewPreview(@PreviewParameter(AcceptDeclineInvit
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
AcceptDeclineInviteView(
|
AcceptDeclineInviteView(
|
||||||
state = state,
|
state = state,
|
||||||
onInviteAccepted = {},
|
onAcceptInvite = {},
|
||||||
onInviteDeclined = {},
|
onDeclineInvite = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,14 @@ class AcceptDeclineInviteViewWrapper @Inject constructor() : AcceptDeclineInvite
|
||||||
@Composable
|
@Composable
|
||||||
override fun Render(
|
override fun Render(
|
||||||
state: AcceptDeclineInviteState,
|
state: AcceptDeclineInviteState,
|
||||||
onInviteAccepted: (RoomId) -> Unit,
|
onAcceptInvite: (RoomId) -> Unit,
|
||||||
onInviteDeclined: (RoomId) -> Unit,
|
onDeclineInvite: (RoomId) -> Unit,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
) {
|
) {
|
||||||
AcceptDeclineInviteView(
|
AcceptDeclineInviteView(
|
||||||
state = state,
|
state = state,
|
||||||
onInviteAccepted = onInviteAccepted,
|
onAcceptInvite = onAcceptInvite,
|
||||||
onInviteDeclined = onInviteDeclined,
|
onDeclineInvite = onDeclineInvite,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,15 @@ class JoinRoomNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
JoinRoomView(
|
JoinRoomView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onJoinSuccess = ::navigateUp,
|
onJoinSuccess = ::navigateUp,
|
||||||
onKnockSuccess = ::navigateUp,
|
onKnockSuccess = ::navigateUp,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
acceptDeclineInviteView.Render(
|
acceptDeclineInviteView.Render(
|
||||||
state = state.acceptDeclineInviteState,
|
state = state.acceptDeclineInviteState,
|
||||||
onInviteAccepted = {},
|
onAcceptInvite = {},
|
||||||
onInviteDeclined = { navigateUp() },
|
onDeclineInvite = { navigateUp() },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun JoinRoomView(
|
fun JoinRoomView(
|
||||||
state: JoinRoomState,
|
state: JoinRoomState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onJoinSuccess: () -> Unit,
|
onJoinSuccess: () -> Unit,
|
||||||
onKnockSuccess: () -> Unit,
|
onKnockSuccess: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|
@ -78,7 +78,7 @@ fun JoinRoomView(
|
||||||
containerColor = Color.Transparent,
|
containerColor = Color.Transparent,
|
||||||
paddingValues = PaddingValues(16.dp),
|
paddingValues = PaddingValues(16.dp),
|
||||||
topBar = {
|
topBar = {
|
||||||
JoinRoomTopBar(onBackClicked = onBackPressed)
|
JoinRoomTopBar(onBackClick = onBackClick)
|
||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
JoinRoomContent(
|
JoinRoomContent(
|
||||||
|
|
@ -104,7 +104,7 @@ fun JoinRoomView(
|
||||||
onRetry = {
|
onRetry = {
|
||||||
state.eventSink(JoinRoomEvents.RetryFetchingContent)
|
state.eventSink(JoinRoomEvents.RetryFetchingContent)
|
||||||
},
|
},
|
||||||
onGoBack = onBackPressed,
|
onGoBack = onBackClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -312,11 +312,11 @@ private fun JoinRoomContent(
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun JoinRoomTopBar(
|
private fun JoinRoomTopBar(
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackClicked)
|
BackButton(onClick = onBackClick)
|
||||||
},
|
},
|
||||||
title = {},
|
title = {},
|
||||||
)
|
)
|
||||||
|
|
@ -327,7 +327,7 @@ private fun JoinRoomTopBar(
|
||||||
internal fun JoinRoomViewPreview(@PreviewParameter(JoinRoomStateProvider::class) state: JoinRoomState) = ElementPreview {
|
internal fun JoinRoomViewPreview(@PreviewParameter(JoinRoomStateProvider::class) state: JoinRoomState) = ElementPreview {
|
||||||
JoinRoomView(
|
JoinRoomView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = { },
|
onBackClick = { },
|
||||||
onJoinSuccess = { },
|
onJoinSuccess = { },
|
||||||
onKnockSuccess = { },
|
onKnockSuccess = { },
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class JoinRoomViewTest {
|
||||||
aJoinRoomState(
|
aJoinRoomState(
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onBackPressed = it
|
onBackClick = it
|
||||||
)
|
)
|
||||||
rule.pressBack()
|
rule.pressBack()
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ class JoinRoomViewTest {
|
||||||
contentState = aLoadedContentState(roomType = RoomType.Space),
|
contentState = aLoadedContentState(roomType = RoomType.Space),
|
||||||
eventSink = eventsRecorder,
|
eventSink = eventsRecorder,
|
||||||
),
|
),
|
||||||
onBackPressed = it
|
onBackClick = it
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_go_back)
|
rule.clickOn(CommonStrings.action_go_back)
|
||||||
}
|
}
|
||||||
|
|
@ -176,14 +176,14 @@ class JoinRoomViewTest {
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setJoinRoomView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setJoinRoomView(
|
||||||
state: JoinRoomState,
|
state: JoinRoomState,
|
||||||
onBackPressed: () -> Unit = EnsureNeverCalled(),
|
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onJoinSuccess: () -> Unit = EnsureNeverCalled(),
|
onJoinSuccess: () -> Unit = EnsureNeverCalled(),
|
||||||
onKnockSuccess: () -> Unit = EnsureNeverCalled(),
|
onKnockSuccess: () -> Unit = EnsureNeverCalled(),
|
||||||
) {
|
) {
|
||||||
setContent {
|
setContent {
|
||||||
JoinRoomView(
|
JoinRoomView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = onBackPressed,
|
onBackClick = onBackClick,
|
||||||
onJoinSuccess = onJoinSuccess,
|
onJoinSuccess = onJoinSuccess,
|
||||||
onKnockSuccess = onKnockSuccess,
|
onKnockSuccess = onKnockSuccess,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ private fun LeaveRoomConfirmationDialog(
|
||||||
title = stringResource(if (isDm) CommonStrings.action_leave_conversation else CommonStrings.action_leave_room),
|
title = stringResource(if (isDm) CommonStrings.action_leave_conversation else CommonStrings.action_leave_room),
|
||||||
content = stringResource(text),
|
content = stringResource(text),
|
||||||
submitText = stringResource(CommonStrings.action_leave),
|
submitText = stringResource(CommonStrings.action_leave),
|
||||||
onSubmitClicked = { eventSink(LeaveRoomEvent.LeaveRoom(roomId)) },
|
onSubmitClick = { eventSink(LeaveRoomEvent.LeaveRoom(roomId)) },
|
||||||
onDismiss = { eventSink(LeaveRoomEvent.HideConfirmation) },
|
onDismiss = { eventSink(LeaveRoomEvent.HideConfirmation) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ internal fun PermissionDeniedDialog(
|
||||||
) {
|
) {
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
content = stringResource(CommonStrings.error_missing_location_auth_android, appName),
|
content = stringResource(CommonStrings.error_missing_location_auth_android, appName),
|
||||||
onSubmitClicked = onContinue,
|
onSubmitClick = onContinue,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
submitText = stringResource(CommonStrings.action_continue),
|
submitText = stringResource(CommonStrings.action_continue),
|
||||||
cancelText = stringResource(CommonStrings.action_cancel),
|
cancelText = stringResource(CommonStrings.action_cancel),
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ internal fun PermissionRationaleDialog(
|
||||||
) {
|
) {
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
content = stringResource(CommonStrings.error_missing_location_rationale_android, appName),
|
content = stringResource(CommonStrings.error_missing_location_rationale_android, appName),
|
||||||
onSubmitClicked = onContinue,
|
onSubmitClick = onContinue,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
submitText = stringResource(CommonStrings.action_continue),
|
submitText = stringResource(CommonStrings.action_continue),
|
||||||
cancelText = stringResource(CommonStrings.action_cancel),
|
cancelText = stringResource(CommonStrings.action_cancel),
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class ShowLocationNode @AssistedInject constructor(
|
||||||
ShowLocationView(
|
ShowLocationView(
|
||||||
state = presenter.present(),
|
state = presenter.present(),
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = ::navigateUp
|
onBackClick = ::navigateUp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ import kotlinx.collections.immutable.toImmutableMap
|
||||||
@Composable
|
@Composable
|
||||||
fun ShowLocationView(
|
fun ShowLocationView(
|
||||||
state: ShowLocationState,
|
state: ShowLocationState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
when (state.permissionDialog) {
|
when (state.permissionDialog) {
|
||||||
|
|
@ -121,7 +121,7 @@ fun ShowLocationView(
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(
|
BackButton(
|
||||||
onClick = onBackPressed,
|
onClick = onBackClick,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
|
|
@ -194,7 +194,7 @@ fun ShowLocationView(
|
||||||
internal fun ShowLocationViewPreview(@PreviewParameter(ShowLocationStateProvider::class) state: ShowLocationState) = ElementPreview {
|
internal fun ShowLocationViewPreview(@PreviewParameter(ShowLocationStateProvider::class) state: ShowLocationState) = ElementPreview {
|
||||||
ShowLocationView(
|
ShowLocationView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class ShowLocationViewTest {
|
||||||
state = aShowLocationState(
|
state = aShowLocationState(
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = callback,
|
onBackClick = callback,
|
||||||
)
|
)
|
||||||
rule.pressBack()
|
rule.pressBack()
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class ShowLocationViewTest {
|
||||||
aShowLocationState(
|
aShowLocationState(
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
val shareContentDescription = rule.activity.getString(CommonStrings.action_share)
|
val shareContentDescription = rule.activity.getString(CommonStrings.action_share)
|
||||||
rule.onNodeWithContentDescription(shareContentDescription).performClick()
|
rule.onNodeWithContentDescription(shareContentDescription).performClick()
|
||||||
|
|
@ -76,7 +76,7 @@ class ShowLocationViewTest {
|
||||||
aShowLocationState(
|
aShowLocationState(
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
rule.onNodeWithTag(TestTags.floatingActionButton.value).performClick()
|
rule.onNodeWithTag(TestTags.floatingActionButton.value).performClick()
|
||||||
eventsRecorder.assertSingle(ShowLocationEvents.TrackMyLocation(true))
|
eventsRecorder.assertSingle(ShowLocationEvents.TrackMyLocation(true))
|
||||||
|
|
@ -90,7 +90,7 @@ class ShowLocationViewTest {
|
||||||
permissionDialog = ShowLocationState.Dialog.PermissionDenied,
|
permissionDialog = ShowLocationState.Dialog.PermissionDenied,
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_continue)
|
rule.clickOn(CommonStrings.action_continue)
|
||||||
eventsRecorder.assertSingle(ShowLocationEvents.OpenAppSettings)
|
eventsRecorder.assertSingle(ShowLocationEvents.OpenAppSettings)
|
||||||
|
|
@ -104,7 +104,7 @@ class ShowLocationViewTest {
|
||||||
permissionDialog = ShowLocationState.Dialog.PermissionDenied,
|
permissionDialog = ShowLocationState.Dialog.PermissionDenied,
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_cancel)
|
rule.clickOn(CommonStrings.action_cancel)
|
||||||
eventsRecorder.assertSingle(ShowLocationEvents.DismissDialog)
|
eventsRecorder.assertSingle(ShowLocationEvents.DismissDialog)
|
||||||
|
|
@ -118,7 +118,7 @@ class ShowLocationViewTest {
|
||||||
permissionDialog = ShowLocationState.Dialog.PermissionRationale,
|
permissionDialog = ShowLocationState.Dialog.PermissionRationale,
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_continue)
|
rule.clickOn(CommonStrings.action_continue)
|
||||||
eventsRecorder.assertSingle(ShowLocationEvents.RequestPermissions)
|
eventsRecorder.assertSingle(ShowLocationEvents.RequestPermissions)
|
||||||
|
|
@ -132,7 +132,7 @@ class ShowLocationViewTest {
|
||||||
permissionDialog = ShowLocationState.Dialog.PermissionRationale,
|
permissionDialog = ShowLocationState.Dialog.PermissionRationale,
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackPressed = EnsureNeverCalled(),
|
onBackClick = EnsureNeverCalled(),
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.action_cancel)
|
rule.clickOn(CommonStrings.action_cancel)
|
||||||
eventsRecorder.assertSingle(ShowLocationEvents.DismissDialog)
|
eventsRecorder.assertSingle(ShowLocationEvents.DismissDialog)
|
||||||
|
|
@ -141,14 +141,14 @@ class ShowLocationViewTest {
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setShowLocationView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setShowLocationView(
|
||||||
state: ShowLocationState,
|
state: ShowLocationState,
|
||||||
onBackPressed: () -> Unit = EnsureNeverCalled(),
|
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||||
) {
|
) {
|
||||||
setContent {
|
setContent {
|
||||||
// Simulate a LocalInspectionMode for MapboxMap
|
// Simulate a LocalInspectionMode for MapboxMap
|
||||||
CompositionLocalProvider(LocalInspectionMode provides true) {
|
CompositionLocalProvider(LocalInspectionMode provides true) {
|
||||||
ShowLocationView(
|
ShowLocationView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = onBackPressed,
|
onBackClick = onBackClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ class LockScreenSettingsFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
NavTarget.Settings -> {
|
NavTarget.Settings -> {
|
||||||
val callback = object : LockScreenSettingsNode.Callback {
|
val callback = object : LockScreenSettingsNode.Callback {
|
||||||
override fun onChangePinClicked() {
|
override fun onChangePinClick() {
|
||||||
backstack.push(NavTarget.SetupPin)
|
backstack.push(NavTarget.SetupPin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,11 @@ class LockScreenSettingsNode @AssistedInject constructor(
|
||||||
private val presenter: LockScreenSettingsPresenter,
|
private val presenter: LockScreenSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onChangePinClicked()
|
fun onChangePinClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onChangePinClicked() {
|
private fun onChangePinClick() {
|
||||||
plugins<Callback>().forEach { it.onChangePinClicked() }
|
plugins<Callback>().forEach { it.onChangePinClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -46,8 +46,8 @@ class LockScreenSettingsNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
LockScreenSettingsView(
|
LockScreenSettingsView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
onChangePinClicked = this::onChangePinClicked,
|
onChangePinClick = this::onChangePinClick,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,19 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
fun LockScreenSettingsView(
|
fun LockScreenSettingsView(
|
||||||
state: LockScreenSettingsState,
|
state: LockScreenSettingsState,
|
||||||
onChangePinClicked: () -> Unit,
|
onChangePinClick: () -> Unit,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
PreferencePage(
|
PreferencePage(
|
||||||
title = stringResource(id = io.element.android.libraries.ui.strings.R.string.common_screen_lock),
|
title = stringResource(id = io.element.android.libraries.ui.strings.R.string.common_screen_lock),
|
||||||
onBackPressed = onBackPressed,
|
onBackClick = onBackClick,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(showTopDivider = false) {
|
PreferenceCategory(showTopDivider = false) {
|
||||||
PreferenceText(
|
PreferenceText(
|
||||||
title = stringResource(id = R.string.screen_app_lock_settings_change_pin),
|
title = stringResource(id = R.string.screen_app_lock_settings_change_pin),
|
||||||
onClick = onChangePinClicked
|
onClick = onChangePinClick
|
||||||
)
|
)
|
||||||
PreferenceDivider()
|
PreferenceDivider()
|
||||||
if (state.showRemovePinOption) {
|
if (state.showRemovePinOption) {
|
||||||
|
|
@ -74,7 +74,7 @@ fun LockScreenSettingsView(
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
title = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_title),
|
title = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_title),
|
||||||
content = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_message),
|
content = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_message),
|
||||||
onSubmitClicked = {
|
onSubmitClick = {
|
||||||
state.eventSink(LockScreenSettingsEvents.ConfirmRemovePin)
|
state.eventSink(LockScreenSettingsEvents.ConfirmRemovePin)
|
||||||
},
|
},
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
|
|
@ -92,8 +92,8 @@ internal fun LockScreenSettingsViewPreview(
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
LockScreenSettingsView(
|
LockScreenSettingsView(
|
||||||
state = state,
|
state = state,
|
||||||
onChangePinClicked = {},
|
onChangePinClick = {},
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ fun SetupBiometricView(
|
||||||
},
|
},
|
||||||
footer = {
|
footer = {
|
||||||
SetupBiometricFooter(
|
SetupBiometricFooter(
|
||||||
onAllowClicked = { state.eventSink(SetupBiometricEvents.AllowBiometric) },
|
onAllowClick = { state.eventSink(SetupBiometricEvents.AllowBiometric) },
|
||||||
onSkipClicked = { state.eventSink(SetupBiometricEvents.UsePin) }
|
onSkipClick = { state.eventSink(SetupBiometricEvents.UsePin) }
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -68,18 +68,18 @@ private fun SetupBiometricHeader() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SetupBiometricFooter(
|
private fun SetupBiometricFooter(
|
||||||
onAllowClicked: () -> Unit,
|
onAllowClick: () -> Unit,
|
||||||
onSkipClicked: () -> Unit,
|
onSkipClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule {
|
ButtonColumnMolecule {
|
||||||
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_allow_title, biometricAuth),
|
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_allow_title, biometricAuth),
|
||||||
onClick = onAllowClicked
|
onClick = onAllowClick
|
||||||
)
|
)
|
||||||
TextButton(
|
TextButton(
|
||||||
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_skip),
|
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_skip),
|
||||||
onClick = onSkipClicked
|
onClick = onSkipClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class SetupPinNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
SetupPinView(
|
SetupPinView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClicked = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
||||||
@Composable
|
@Composable
|
||||||
fun SetupPinView(
|
fun SetupPinView(
|
||||||
state: SetupPinState,
|
state: SetupPinState,
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
|
@ -60,7 +60,7 @@ fun SetupPinView(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackClicked)
|
BackButton(onClick = onBackClick)
|
||||||
},
|
},
|
||||||
title = {}
|
title = {}
|
||||||
)
|
)
|
||||||
|
|
@ -154,7 +154,7 @@ internal fun SetupPinViewPreview(@PreviewParameter(SetupPinStateProvider::class)
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
SetupPinView(
|
SetupPinView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClicked = {},
|
onBackClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ private fun SignOutPrompt(
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
title = stringResource(id = R.string.screen_app_lock_signout_alert_title),
|
title = stringResource(id = R.string.screen_app_lock_signout_alert_title),
|
||||||
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
||||||
onSubmitClicked = onSignOut,
|
onSubmitClick = onSignOut,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class LoginFlowNode @AssistedInject constructor(
|
||||||
backstack.singleTop(NavTarget.ConfirmAccountProvider)
|
backstack.singleTop(NavTarget.ConfirmAccountProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOtherClicked() {
|
override fun onOtherClick() {
|
||||||
backstack.push(NavTarget.SearchAccountProvider)
|
backstack.push(NavTarget.SearchAccountProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ class LoginFlowNode @AssistedInject constructor(
|
||||||
loginFormState = navTarget.loginFormState,
|
loginFormState = navTarget.loginFormState,
|
||||||
)
|
)
|
||||||
val callback = object : WaitListNode.Callback {
|
val callback = object : WaitListNode.Callback {
|
||||||
override fun onCancelClicked() {
|
override fun onCancelClick() {
|
||||||
navigateUp()
|
navigateUp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
fun ChangeServerView(
|
fun ChangeServerView(
|
||||||
state: ChangeServerState,
|
state: ChangeServerState,
|
||||||
onLearnMoreClicked: () -> Unit,
|
onLearnMoreClick: () -> Unit,
|
||||||
onDone: () -> Unit,
|
onSuccess: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
@ -53,8 +53,8 @@ fun ChangeServerView(
|
||||||
is ChangeServerError.SlidingSyncAlert -> {
|
is ChangeServerError.SlidingSyncAlert -> {
|
||||||
SlidingSyncNotSupportedDialog(
|
SlidingSyncNotSupportedDialog(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onLearnMoreClicked = {
|
onLearnMoreClick = {
|
||||||
onLearnMoreClicked()
|
onLearnMoreClick()
|
||||||
eventSink.invoke(ChangeServerEvents.ClearError)
|
eventSink.invoke(ChangeServerEvents.ClearError)
|
||||||
},
|
},
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
|
|
@ -66,9 +66,9 @@ fun ChangeServerView(
|
||||||
}
|
}
|
||||||
is AsyncData.Loading -> ProgressDialog()
|
is AsyncData.Loading -> ProgressDialog()
|
||||||
is AsyncData.Success -> {
|
is AsyncData.Success -> {
|
||||||
val latestOnDone by rememberUpdatedState(onDone)
|
val latestOnSuccess by rememberUpdatedState(onSuccess)
|
||||||
LaunchedEffect(state.changeServerAction) {
|
LaunchedEffect(state.changeServerAction) {
|
||||||
latestOnDone()
|
latestOnSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AsyncData.Uninitialized -> Unit
|
AsyncData.Uninitialized -> Unit
|
||||||
|
|
@ -80,7 +80,7 @@ fun ChangeServerView(
|
||||||
internal fun ChangeServerViewPreview(@PreviewParameter(ChangeServerStateProvider::class) state: ChangeServerState) = ElementPreview {
|
internal fun ChangeServerViewPreview(@PreviewParameter(ChangeServerStateProvider::class) state: ChangeServerState) = ElementPreview {
|
||||||
ChangeServerView(
|
ChangeServerView(
|
||||||
state = state,
|
state = state,
|
||||||
onLearnMoreClicked = {},
|
onLearnMoreClick = {},
|
||||||
onDone = {},
|
onSuccess = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun SlidingSyncNotSupportedDialog(
|
internal fun SlidingSyncNotSupportedDialog(
|
||||||
onLearnMoreClicked: () -> Unit,
|
onLearnMoreClick: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -35,8 +35,8 @@ internal fun SlidingSyncNotSupportedDialog(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
submitText = stringResource(CommonStrings.action_learn_more),
|
submitText = stringResource(CommonStrings.action_learn_more),
|
||||||
onSubmitClicked = onLearnMoreClicked,
|
onSubmitClick = onLearnMoreClick,
|
||||||
onCancelClicked = onDismiss,
|
onCancelClick = onDismiss,
|
||||||
title = stringResource(CommonStrings.dialog_title_error),
|
title = stringResource(CommonStrings.dialog_title_error),
|
||||||
content = stringResource(R.string.screen_change_server_error_no_sliding_sync_message),
|
content = stringResource(R.string.screen_change_server_error_no_sliding_sync_message),
|
||||||
)
|
)
|
||||||
|
|
@ -46,7 +46,7 @@ internal fun SlidingSyncNotSupportedDialog(
|
||||||
@Composable
|
@Composable
|
||||||
internal fun SlidingSyncNotSupportedDialogPreview() = ElementPreview {
|
internal fun SlidingSyncNotSupportedDialogPreview() = ElementPreview {
|
||||||
SlidingSyncNotSupportedDialog(
|
SlidingSyncNotSupportedDialog(
|
||||||
onLearnMoreClicked = {},
|
onLearnMoreClick = {},
|
||||||
onDismiss = {},
|
onDismiss = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@ class ChangeAccountProviderNode @AssistedInject constructor(
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun onOtherClicked()
|
fun onOtherClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onDone() {
|
private fun onDone() {
|
||||||
plugins<Callback>().forEach { it.onDone() }
|
plugins<Callback>().forEach { it.onDone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOtherClicked() {
|
private fun onOtherClick() {
|
||||||
plugins<Callback>().forEach { it.onOtherClicked() }
|
plugins<Callback>().forEach { it.onOtherClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -55,10 +55,10 @@ class ChangeAccountProviderNode @AssistedInject constructor(
|
||||||
ChangeAccountProviderView(
|
ChangeAccountProviderView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
onLearnMoreClick = { openLearnMorePage(context) },
|
||||||
onDone = ::onDone,
|
onSuccess = ::onDone,
|
||||||
onOtherProviderClicked = ::onOtherClicked,
|
onOtherProviderClick = ::onOtherClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
||||||
@Composable
|
@Composable
|
||||||
fun ChangeAccountProviderView(
|
fun ChangeAccountProviderView(
|
||||||
state: ChangeAccountProviderState,
|
state: ChangeAccountProviderState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onLearnMoreClicked: () -> Unit,
|
onLearnMoreClick: () -> Unit,
|
||||||
onDone: () -> Unit,
|
onSuccess: () -> Unit,
|
||||||
onOtherProviderClicked: () -> Unit,
|
onOtherProviderClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
|
@ -66,7 +66,7 @@ fun ChangeAccountProviderView(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
navigationIcon = { BackButton(onClick = onBackPressed) }
|
navigationIcon = { BackButton(onClick = onBackClick) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -111,14 +111,14 @@ fun ChangeAccountProviderView(
|
||||||
url = "",
|
url = "",
|
||||||
title = stringResource(id = R.string.screen_change_account_provider_other),
|
title = stringResource(id = R.string.screen_change_account_provider_other),
|
||||||
),
|
),
|
||||||
onClick = onOtherProviderClicked
|
onClick = onOtherProviderClick
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(32.dp))
|
Spacer(Modifier.height(32.dp))
|
||||||
}
|
}
|
||||||
ChangeServerView(
|
ChangeServerView(
|
||||||
state = state.changeServerState,
|
state = state.changeServerState,
|
||||||
onLearnMoreClicked = onLearnMoreClicked,
|
onLearnMoreClick = onLearnMoreClick,
|
||||||
onDone = onDone,
|
onSuccess = onSuccess,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -129,9 +129,9 @@ fun ChangeAccountProviderView(
|
||||||
internal fun ChangeAccountProviderViewPreview(@PreviewParameter(ChangeAccountProviderStateProvider::class) state: ChangeAccountProviderState) = ElementPreview {
|
internal fun ChangeAccountProviderViewPreview(@PreviewParameter(ChangeAccountProviderStateProvider::class) state: ChangeAccountProviderState) = ElementPreview {
|
||||||
ChangeAccountProviderView(
|
ChangeAccountProviderView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = { },
|
onBackClick = { },
|
||||||
onLearnMoreClicked = { },
|
onLearnMoreClick = { },
|
||||||
onDone = { },
|
onSuccess = { },
|
||||||
onOtherProviderClicked = { },
|
onOtherProviderClick = { },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ class ConfirmAccountProviderNode @AssistedInject constructor(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onOidcDetails = ::onOidcDetails,
|
onOidcDetails = ::onOidcDetails,
|
||||||
onLoginPasswordNeeded = ::onLoginPasswordNeeded,
|
onNeedLoginPassword = ::onLoginPasswordNeeded,
|
||||||
onChange = ::onChangeAccountProvider,
|
onChange = ::onChangeAccountProvider,
|
||||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
onLearnMoreClick = { openLearnMorePage(context) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
fun ConfirmAccountProviderView(
|
fun ConfirmAccountProviderView(
|
||||||
state: ConfirmAccountProviderState,
|
state: ConfirmAccountProviderState,
|
||||||
onOidcDetails: (OidcDetails) -> Unit,
|
onOidcDetails: (OidcDetails) -> Unit,
|
||||||
onLoginPasswordNeeded: () -> Unit,
|
onNeedLoginPassword: () -> Unit,
|
||||||
onLearnMoreClicked: () -> Unit,
|
onLearnMoreClick: () -> Unit,
|
||||||
onChange: () -> Unit,
|
onChange: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -118,8 +118,8 @@ fun ConfirmAccountProviderView(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is ChangeServerError.SlidingSyncAlert -> {
|
is ChangeServerError.SlidingSyncAlert -> {
|
||||||
SlidingSyncNotSupportedDialog(onLearnMoreClicked = {
|
SlidingSyncNotSupportedDialog(onLearnMoreClick = {
|
||||||
onLearnMoreClicked()
|
onLearnMoreClick()
|
||||||
eventSink(ConfirmAccountProviderEvents.ClearError)
|
eventSink(ConfirmAccountProviderEvents.ClearError)
|
||||||
}, onDismiss = {
|
}, onDismiss = {
|
||||||
eventSink(ConfirmAccountProviderEvents.ClearError)
|
eventSink(ConfirmAccountProviderEvents.ClearError)
|
||||||
|
|
@ -131,7 +131,7 @@ fun ConfirmAccountProviderView(
|
||||||
is AsyncData.Success -> {
|
is AsyncData.Success -> {
|
||||||
when (val loginFlowState = state.loginFlow.data) {
|
when (val loginFlowState = state.loginFlow.data) {
|
||||||
is LoginFlow.OidcFlow -> onOidcDetails(loginFlowState.oidcDetails)
|
is LoginFlow.OidcFlow -> onOidcDetails(loginFlowState.oidcDetails)
|
||||||
LoginFlow.PasswordLogin -> onLoginPasswordNeeded()
|
LoginFlow.PasswordLogin -> onNeedLoginPassword()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AsyncData.Uninitialized -> Unit
|
AsyncData.Uninitialized -> Unit
|
||||||
|
|
@ -147,8 +147,8 @@ internal fun ConfirmAccountProviderViewPreview(
|
||||||
ConfirmAccountProviderView(
|
ConfirmAccountProviderView(
|
||||||
state = state,
|
state = state,
|
||||||
onOidcDetails = {},
|
onOidcDetails = {},
|
||||||
onLoginPasswordNeeded = {},
|
onNeedLoginPassword = {},
|
||||||
onLearnMoreClicked = {},
|
onLearnMoreClick = {},
|
||||||
onChange = {},
|
onChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class LoginPasswordNode @AssistedInject constructor(
|
||||||
LoginPasswordView(
|
LoginPasswordView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onWaitListError = ::onWaitListError,
|
onWaitListError = ::onWaitListError,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginPasswordView(
|
fun LoginPasswordView(
|
||||||
state: LoginPasswordState,
|
state: LoginPasswordState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onWaitListError: (LoginFormState) -> Unit,
|
onWaitListError: (LoginFormState) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -103,7 +103,7 @@ fun LoginPasswordView(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
navigationIcon = { BackButton(onClick = onBackPressed) },
|
navigationIcon = { BackButton(onClick = onBackClick) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -310,7 +310,7 @@ private fun LoginErrorDialog(error: Throwable, onDismiss: () -> Unit) {
|
||||||
internal fun LoginPasswordViewPreview(@PreviewParameter(LoginPasswordStateProvider::class) state: LoginPasswordState) = ElementPreview {
|
internal fun LoginPasswordViewPreview(@PreviewParameter(LoginPasswordStateProvider::class) state: LoginPasswordState) = ElementPreview {
|
||||||
LoginPasswordView(
|
LoginPasswordView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
onWaitListError = {},
|
onWaitListError = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ class SearchAccountProviderNode @AssistedInject constructor(
|
||||||
SearchAccountProviderView(
|
SearchAccountProviderView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onBackPressed = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
onLearnMoreClick = { openLearnMorePage(context) },
|
||||||
onDone = ::onDone,
|
onSuccess = ::onDone,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,9 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun SearchAccountProviderView(
|
fun SearchAccountProviderView(
|
||||||
state: SearchAccountProviderState,
|
state: SearchAccountProviderState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onLearnMoreClicked: () -> Unit,
|
onLearnMoreClick: () -> Unit,
|
||||||
onDone: () -> Unit,
|
onSuccess: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
@ -88,7 +88,7 @@ fun SearchAccountProviderView(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {},
|
title = {},
|
||||||
navigationIcon = { BackButton(onClick = onBackPressed) }
|
navigationIcon = { BackButton(onClick = onBackClick) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { padding ->
|
) { padding ->
|
||||||
|
|
@ -188,8 +188,8 @@ fun SearchAccountProviderView(
|
||||||
}
|
}
|
||||||
ChangeServerView(
|
ChangeServerView(
|
||||||
state = state.changeServerState,
|
state = state.changeServerState,
|
||||||
onLearnMoreClicked = onLearnMoreClicked,
|
onLearnMoreClick = onLearnMoreClick,
|
||||||
onDone = onDone,
|
onSuccess = onSuccess,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -214,8 +214,8 @@ private fun HomeserverData.toAccountProvider(): AccountProvider {
|
||||||
internal fun SearchAccountProviderViewPreview(@PreviewParameter(SearchAccountProviderStateProvider::class) state: SearchAccountProviderState) = ElementPreview {
|
internal fun SearchAccountProviderViewPreview(@PreviewParameter(SearchAccountProviderStateProvider::class) state: SearchAccountProviderState) = ElementPreview {
|
||||||
SearchAccountProviderView(
|
SearchAccountProviderView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
onLearnMoreClicked = {},
|
onLearnMoreClick = {},
|
||||||
onDone = {},
|
onSuccess = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ class WaitListNode @AssistedInject constructor(
|
||||||
private val presenter = presenterFactory.create(inputs.loginFormState)
|
private val presenter = presenterFactory.create(inputs.loginFormState)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onCancelClicked()
|
fun onCancelClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCancelClicked() {
|
private fun onCancelClick() {
|
||||||
plugins<Callback>().forEach { it.onCancelClicked() }
|
plugins<Callback>().forEach { it.onCancelClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -54,7 +54,7 @@ class WaitListNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
WaitListView(
|
WaitListView(
|
||||||
state = state,
|
state = state,
|
||||||
onCancelClicked = ::onCancelClicked,
|
onCancelClick = ::onCancelClick,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun WaitListView(
|
fun WaitListView(
|
||||||
state: WaitListState,
|
state: WaitListState,
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
OnLifecycleEvent { _, event ->
|
OnLifecycleEvent { _, event ->
|
||||||
|
|
@ -57,7 +57,7 @@ fun WaitListView(
|
||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WaitListContent(state, onCancelClicked, modifier)
|
WaitListContent(state, onCancelClick, modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -81,7 +81,7 @@ private fun WaitListError(state: WaitListState) {
|
||||||
@Composable
|
@Composable
|
||||||
private fun WaitListContent(
|
private fun WaitListContent(
|
||||||
state: WaitListState,
|
state: WaitListState,
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
|
|
@ -109,7 +109,7 @@ private fun WaitListContent(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
) {
|
) {
|
||||||
OverallContent(state, onCancelClicked)
|
OverallContent(state, onCancelClick)
|
||||||
}
|
}
|
||||||
WaitListError(state)
|
WaitListError(state)
|
||||||
}
|
}
|
||||||
|
|
@ -118,14 +118,14 @@ private fun WaitListContent(
|
||||||
@Composable
|
@Composable
|
||||||
private fun OverallContent(
|
private fun OverallContent(
|
||||||
state: WaitListState,
|
state: WaitListState,
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
if (state.loginAction !is AsyncData.Success) {
|
if (state.loginAction !is AsyncData.Success) {
|
||||||
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.textOnSolidPrimary) {
|
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.textOnSolidPrimary) {
|
||||||
TextButton(
|
TextButton(
|
||||||
text = stringResource(CommonStrings.action_cancel),
|
text = stringResource(CommonStrings.action_cancel),
|
||||||
onClick = onCancelClicked,
|
onClick = onCancelClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -147,6 +147,6 @@ private fun OverallContent(
|
||||||
internal fun WaitListViewPreview(@PreviewParameter(WaitListStateProvider::class) state: WaitListState) = ElementPreview {
|
internal fun WaitListViewPreview(@PreviewParameter(WaitListStateProvider::class) state: WaitListState) = ElementPreview {
|
||||||
WaitListView(
|
WaitListView(
|
||||||
state = state,
|
state = state,
|
||||||
onCancelClicked = {},
|
onCancelClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ interface LogoutEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onChangeRecoveryKeyClicked()
|
fun onChangeRecoveryKeyClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ class LogoutNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: LogoutPresenter,
|
private val presenter: LogoutPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
private fun onChangeRecoveryKeyClicked() {
|
private fun onChangeRecoveryKeyClick() {
|
||||||
plugins<LogoutEntryPoint.Callback>().forEach { it.onChangeRecoveryKeyClicked() }
|
plugins<LogoutEntryPoint.Callback>().forEach { it.onChangeRecoveryKeyClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSuccessLogout(activity: Activity, url: String?) {
|
private fun onSuccessLogout(activity: Activity, url: String?) {
|
||||||
|
|
@ -55,9 +55,9 @@ class LogoutNode @AssistedInject constructor(
|
||||||
val activity = LocalContext.current as Activity
|
val activity = LocalContext.current as Activity
|
||||||
LogoutView(
|
LogoutView(
|
||||||
state = state,
|
state = state,
|
||||||
onChangeRecoveryKeyClicked = ::onChangeRecoveryKeyClicked,
|
onChangeRecoveryKeyClick = ::onChangeRecoveryKeyClick,
|
||||||
onSuccessLogout = { onSuccessLogout(activity, it) },
|
onSuccessLogout = { onSuccessLogout(activity, it) },
|
||||||
onBackClicked = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,37 +51,38 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun LogoutView(
|
fun LogoutView(
|
||||||
state: LogoutState,
|
state: LogoutState,
|
||||||
onChangeRecoveryKeyClicked: () -> Unit,
|
onChangeRecoveryKeyClick: () -> Unit,
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onSuccessLogout: (logoutUrlResult: String?) -> Unit,
|
onSuccessLogout: (logoutUrlResult: String?) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
||||||
FlowStepPage(
|
FlowStepPage(
|
||||||
onBackClicked = onBackClicked,
|
onBackClick = onBackClick,
|
||||||
title = title(state),
|
title = title(state),
|
||||||
subTitle = subtitle(state),
|
subTitle = subtitle(state),
|
||||||
iconVector = CompoundIcons.KeySolid(),
|
iconVector = CompoundIcons.KeySolid(),
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
content = { Content(state) },
|
|
||||||
buttons = {
|
buttons = {
|
||||||
Buttons(
|
Buttons(
|
||||||
state = state,
|
state = state,
|
||||||
onChangeRecoveryKeyClicked = onChangeRecoveryKeyClicked,
|
onChangeRecoveryKeyClick = onChangeRecoveryKeyClick,
|
||||||
onLogoutClicked = {
|
onLogoutClick = {
|
||||||
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
) {
|
||||||
|
Content(state)
|
||||||
|
}
|
||||||
|
|
||||||
LogoutActionDialog(
|
LogoutActionDialog(
|
||||||
state.logoutAction,
|
state.logoutAction,
|
||||||
onConfirmClicked = {
|
onConfirmClick = {
|
||||||
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
||||||
},
|
},
|
||||||
onForceLogoutClicked = {
|
onForceLogoutClick = {
|
||||||
eventSink(LogoutEvents.Logout(ignoreSdkError = true))
|
eventSink(LogoutEvents.Logout(ignoreSdkError = true))
|
||||||
},
|
},
|
||||||
onDismissDialog = {
|
onDismissDialog = {
|
||||||
|
|
@ -124,15 +125,15 @@ private fun subtitle(state: LogoutState): String? {
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColumnScope.Buttons(
|
private fun ColumnScope.Buttons(
|
||||||
state: LogoutState,
|
state: LogoutState,
|
||||||
onLogoutClicked: () -> Unit,
|
onLogoutClick: () -> Unit,
|
||||||
onChangeRecoveryKeyClicked: () -> Unit,
|
onChangeRecoveryKeyClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val logoutAction = state.logoutAction
|
val logoutAction = state.logoutAction
|
||||||
if (state.isLastDevice) {
|
if (state.isLastDevice) {
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
text = stringResource(id = CommonStrings.common_settings),
|
text = stringResource(id = CommonStrings.common_settings),
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
onClick = onChangeRecoveryKeyClicked,
|
onClick = onChangeRecoveryKeyClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val signOutSubmitRes = when {
|
val signOutSubmitRes = when {
|
||||||
|
|
@ -147,7 +148,7 @@ private fun ColumnScope.Buttons(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.testTag(TestTags.signOut),
|
.testTag(TestTags.signOut),
|
||||||
onClick = onLogoutClicked,
|
onClick = onLogoutClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,8 +184,8 @@ internal fun LogoutViewPreview(
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
LogoutView(
|
LogoutView(
|
||||||
state,
|
state,
|
||||||
onChangeRecoveryKeyClicked = {},
|
onChangeRecoveryKeyClick = {},
|
||||||
onSuccessLogout = {},
|
onSuccessLogout = {},
|
||||||
onBackClicked = {},
|
onBackClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ class DefaultDirectLogoutView @Inject constructor() : DirectLogoutView {
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
LogoutActionDialog(
|
LogoutActionDialog(
|
||||||
state.logoutAction,
|
state.logoutAction,
|
||||||
onConfirmClicked = {
|
onConfirmClick = {
|
||||||
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = false))
|
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = false))
|
||||||
},
|
},
|
||||||
onForceLogoutClicked = {
|
onForceLogoutClick = {
|
||||||
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = true))
|
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = true))
|
||||||
},
|
},
|
||||||
onDismissDialog = {
|
onDismissDialog = {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun LogoutActionDialog(
|
fun LogoutActionDialog(
|
||||||
state: AsyncAction<String?>,
|
state: AsyncAction<String?>,
|
||||||
onConfirmClicked: () -> Unit,
|
onConfirmClick: () -> Unit,
|
||||||
onForceLogoutClicked: () -> Unit,
|
onForceLogoutClick: () -> Unit,
|
||||||
onDismissDialog: () -> Unit,
|
onDismissDialog: () -> Unit,
|
||||||
onSuccessLogout: (String?) -> Unit,
|
onSuccessLogout: (String?) -> Unit,
|
||||||
) {
|
) {
|
||||||
|
|
@ -40,7 +40,7 @@ fun LogoutActionDialog(
|
||||||
Unit
|
Unit
|
||||||
AsyncAction.Confirming ->
|
AsyncAction.Confirming ->
|
||||||
LogoutConfirmationDialog(
|
LogoutConfirmationDialog(
|
||||||
onSubmitClicked = onConfirmClicked,
|
onSubmitClick = onConfirmClick,
|
||||||
onDismiss = onDismissDialog
|
onDismiss = onDismissDialog
|
||||||
)
|
)
|
||||||
is AsyncAction.Loading ->
|
is AsyncAction.Loading ->
|
||||||
|
|
@ -50,7 +50,7 @@ fun LogoutActionDialog(
|
||||||
title = stringResource(id = CommonStrings.dialog_title_error),
|
title = stringResource(id = CommonStrings.dialog_title_error),
|
||||||
content = stringResource(id = CommonStrings.error_unknown),
|
content = stringResource(id = CommonStrings.error_unknown),
|
||||||
retryText = stringResource(id = CommonStrings.action_signout_anyway),
|
retryText = stringResource(id = CommonStrings.action_signout_anyway),
|
||||||
onRetry = onForceLogoutClicked,
|
onRetry = onForceLogoutClick,
|
||||||
onDismiss = onDismissDialog,
|
onDismiss = onDismissDialog,
|
||||||
)
|
)
|
||||||
is AsyncAction.Success -> {
|
is AsyncAction.Success -> {
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LogoutConfirmationDialog(
|
fun LogoutConfirmationDialog(
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClick: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
) {
|
) {
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
title = stringResource(id = CommonStrings.action_signout),
|
title = stringResource(id = CommonStrings.action_signout),
|
||||||
content = stringResource(id = R.string.screen_signout_confirmation_dialog_content),
|
content = stringResource(id = R.string.screen_signout_confirmation_dialog_content),
|
||||||
submitText = stringResource(id = CommonStrings.action_signout),
|
submitText = stringResource(id = CommonStrings.action_signout),
|
||||||
onSubmitClicked = onSubmitClicked,
|
onSubmitClick = onSubmitClick,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class LogoutViewTest {
|
||||||
aLogoutState(
|
aLogoutState(
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onBackClicked = callback,
|
onBackClick = callback,
|
||||||
)
|
)
|
||||||
rule.pressBack()
|
rule.pressBack()
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ class LogoutViewTest {
|
||||||
isLastDevice = true,
|
isLastDevice = true,
|
||||||
eventSink = eventsRecorder
|
eventSink = eventsRecorder
|
||||||
),
|
),
|
||||||
onChangeRecoveryKeyClicked = callback,
|
onChangeRecoveryKeyClick = callback,
|
||||||
)
|
)
|
||||||
rule.clickOn(CommonStrings.common_settings)
|
rule.clickOn(CommonStrings.common_settings)
|
||||||
}
|
}
|
||||||
|
|
@ -138,15 +138,15 @@ class LogoutViewTest {
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setLogoutView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setLogoutView(
|
||||||
state: LogoutState,
|
state: LogoutState,
|
||||||
onChangeRecoveryKeyClicked: () -> Unit = EnsureNeverCalled(),
|
onChangeRecoveryKeyClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onBackClicked: () -> Unit = EnsureNeverCalled(),
|
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||||
onSuccessLogout: (logoutUrlResult: String?) -> Unit = EnsureNeverCalledWithParam()
|
onSuccessLogout: (logoutUrlResult: String?) -> Unit = EnsureNeverCalledWithParam()
|
||||||
) {
|
) {
|
||||||
setContent {
|
setContent {
|
||||||
LogoutView(
|
LogoutView(
|
||||||
state = state,
|
state = state,
|
||||||
onChangeRecoveryKeyClicked = onChangeRecoveryKeyClicked,
|
onChangeRecoveryKeyClick = onChangeRecoveryKeyClick,
|
||||||
onBackClicked = onBackClicked,
|
onBackClick = onBackClick,
|
||||||
onSuccessLogout = onSuccessLogout,
|
onSuccessLogout = onSuccessLogout,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ interface MessagesEntryPoint : FeatureEntryPoint {
|
||||||
)
|
)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onRoomDetailsClicked()
|
fun onRoomDetailsClick()
|
||||||
fun onUserDataClicked(userId: UserId)
|
fun onUserDataClick(userId: UserId)
|
||||||
fun onPermalinkClicked(data: PermalinkData)
|
fun onPermalinkClick(data: PermalinkData)
|
||||||
fun onForwardedToSingleRoom(roomId: RoomId)
|
fun onForwardedToSingleRoom(roomId: RoomId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ import kotlin.math.roundToInt
|
||||||
* @param modifier The modifier for the layout.
|
* @param modifier The modifier for the layout.
|
||||||
* @param sheetContentKey The key for the sheet content. If the key changes, the sheet will be remeasured.
|
* @param sheetContentKey The key for the sheet content. If the key changes, the sheet will be remeasured.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("ContentTrailingLambda")
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
internal fun ExpandableBottomSheetScaffold(
|
internal fun ExpandableBottomSheetScaffold(
|
||||||
|
|
|
||||||
|
|
@ -139,31 +139,31 @@ class MessagesFlowNode @AssistedInject constructor(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.Messages -> {
|
is NavTarget.Messages -> {
|
||||||
val callback = object : MessagesNode.Callback {
|
val callback = object : MessagesNode.Callback {
|
||||||
override fun onRoomDetailsClicked() {
|
override fun onRoomDetailsClick() {
|
||||||
callback?.onRoomDetailsClicked()
|
callback?.onRoomDetailsClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEventClicked(event: TimelineItem.Event): Boolean {
|
override fun onEventClick(event: TimelineItem.Event): Boolean {
|
||||||
return processEventClicked(event)
|
return processEventClick(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
override fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
||||||
backstack.push(NavTarget.AttachmentPreview(attachments.first()))
|
backstack.push(NavTarget.AttachmentPreview(attachments.first()))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClicked(userId: UserId) {
|
override fun onUserDataClick(userId: UserId) {
|
||||||
callback?.onUserDataClicked(userId)
|
callback?.onUserDataClick(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClicked(data: PermalinkData) {
|
override fun onPermalinkClick(data: PermalinkData) {
|
||||||
callback?.onPermalinkClicked(data)
|
callback?.onPermalinkClick(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClicked(eventId: EventId) {
|
override fun onForwardEventClick(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId))
|
backstack.push(NavTarget.ForwardEvent(eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,19 +171,19 @@ class MessagesFlowNode @AssistedInject constructor(
|
||||||
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSendLocationClicked() {
|
override fun onSendLocationClick() {
|
||||||
backstack.push(NavTarget.SendLocation)
|
backstack.push(NavTarget.SendLocation)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreatePollClicked() {
|
override fun onCreatePollClick() {
|
||||||
backstack.push(NavTarget.CreatePoll)
|
backstack.push(NavTarget.CreatePoll)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClicked(eventId: EventId) {
|
override fun onEditPollClick(eventId: EventId) {
|
||||||
backstack.push(NavTarget.EditPoll(eventId))
|
backstack.push(NavTarget.EditPoll(eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onJoinCallClicked(roomId: RoomId) {
|
override fun onJoinCallClick(roomId: RoomId) {
|
||||||
val inputs = CallType.RoomCall(
|
val inputs = CallType.RoomCall(
|
||||||
sessionId = matrixClient.sessionId,
|
sessionId = matrixClient.sessionId,
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
|
|
@ -250,7 +250,7 @@ class MessagesFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processEventClicked(event: TimelineItem.Event): Boolean {
|
private fun processEventClick(event: TimelineItem.Event): Boolean {
|
||||||
return when (event.content) {
|
return when (event.content) {
|
||||||
is TimelineItemImageContent -> {
|
is TimelineItemImageContent -> {
|
||||||
val navTarget = NavTarget.MediaViewer(
|
val navTarget = NavTarget.MediaViewer(
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ import io.element.android.libraries.matrix.api.core.UserId
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
|
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
|
||||||
|
|
||||||
interface MessagesNavigator {
|
interface MessagesNavigator {
|
||||||
fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClicked(eventId: EventId)
|
fun onForwardEventClick(eventId: EventId)
|
||||||
fun onReportContentClicked(eventId: EventId, senderId: UserId)
|
fun onReportContentClick(eventId: EventId, senderId: UserId)
|
||||||
fun onEditPollClicked(eventId: EventId)
|
fun onEditPollClick(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,18 +82,18 @@ class MessagesNode @AssistedInject constructor(
|
||||||
private val inputs = inputs<Inputs>()
|
private val inputs = inputs<Inputs>()
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onRoomDetailsClicked()
|
fun onRoomDetailsClick()
|
||||||
fun onEventClicked(event: TimelineItem.Event): Boolean
|
fun onEventClick(event: TimelineItem.Event): Boolean
|
||||||
fun onPreviewAttachments(attachments: ImmutableList<Attachment>)
|
fun onPreviewAttachments(attachments: ImmutableList<Attachment>)
|
||||||
fun onUserDataClicked(userId: UserId)
|
fun onUserDataClick(userId: UserId)
|
||||||
fun onPermalinkClicked(data: PermalinkData)
|
fun onPermalinkClick(data: PermalinkData)
|
||||||
fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClicked(eventId: EventId)
|
fun onForwardEventClick(eventId: EventId)
|
||||||
fun onReportMessage(eventId: EventId, senderId: UserId)
|
fun onReportMessage(eventId: EventId, senderId: UserId)
|
||||||
fun onSendLocationClicked()
|
fun onSendLocationClick()
|
||||||
fun onCreatePollClicked()
|
fun onCreatePollClick()
|
||||||
fun onEditPollClicked(eventId: EventId)
|
fun onEditPollClick(eventId: EventId)
|
||||||
fun onJoinCallClicked(roomId: RoomId)
|
fun onJoinCallClick(roomId: RoomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
|
|
@ -109,23 +109,23 @@ class MessagesNode @AssistedInject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRoomDetailsClicked() {
|
private fun onRoomDetailsClick() {
|
||||||
callback?.onRoomDetailsClicked()
|
callback?.onRoomDetailsClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onEventClicked(event: TimelineItem.Event): Boolean {
|
private fun onEventClick(event: TimelineItem.Event): Boolean {
|
||||||
return callback?.onEventClicked(event).orFalse()
|
return callback?.onEventClick(event).orFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
private fun onPreviewAttachments(attachments: ImmutableList<Attachment>) {
|
||||||
callback?.onPreviewAttachments(attachments)
|
callback?.onPreviewAttachments(attachments)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUserDataClicked(userId: UserId) {
|
private fun onUserDataClick(userId: UserId) {
|
||||||
callback?.onUserDataClicked(userId)
|
callback?.onUserDataClick(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLinkClicked(
|
private fun onLinkClick(
|
||||||
context: Context,
|
context: Context,
|
||||||
url: String,
|
url: String,
|
||||||
eventSink: (TimelineEvents) -> Unit,
|
eventSink: (TimelineEvents) -> Unit,
|
||||||
|
|
@ -134,10 +134,10 @@ class MessagesNode @AssistedInject constructor(
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
// Open the room member profile, it will fallback to
|
// Open the room member profile, it will fallback to
|
||||||
// the user profile if the user is not in the room
|
// the user profile if the user is not in the room
|
||||||
callback?.onUserDataClicked(permalink.userId)
|
callback?.onUserDataClick(permalink.userId)
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
handleRoomLinkClicked(permalink, eventSink)
|
handleRoomLinkClick(permalink, eventSink)
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink,
|
is PermalinkData.FallbackLink,
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
|
|
@ -146,7 +146,7 @@ class MessagesNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleRoomLinkClicked(roomLink: PermalinkData.RoomLink, eventSink: (TimelineEvents) -> Unit) {
|
private fun handleRoomLinkClick(roomLink: PermalinkData.RoomLink, eventSink: (TimelineEvents) -> Unit) {
|
||||||
if (room.matches(roomLink.roomIdOrAlias)) {
|
if (room.matches(roomLink.roomIdOrAlias)) {
|
||||||
val eventId = roomLink.eventId
|
val eventId = roomLink.eventId
|
||||||
if (eventId != null) {
|
if (eventId != null) {
|
||||||
|
|
@ -156,36 +156,36 @@ class MessagesNode @AssistedInject constructor(
|
||||||
context.toast("Already viewing this room!")
|
context.toast("Already viewing this room!")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callback?.onPermalinkClicked(roomLink)
|
callback?.onPermalinkClick(roomLink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClicked(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
callback?.onShowEventDebugInfoClicked(eventId, debugInfo)
|
callback?.onShowEventDebugInfoClick(eventId, debugInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClicked(eventId: EventId) {
|
override fun onForwardEventClick(eventId: EventId) {
|
||||||
callback?.onForwardEventClicked(eventId)
|
callback?.onForwardEventClick(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportContentClicked(eventId: EventId, senderId: UserId) {
|
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
||||||
callback?.onReportMessage(eventId, senderId)
|
callback?.onReportMessage(eventId, senderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClicked(eventId: EventId) {
|
override fun onEditPollClick(eventId: EventId) {
|
||||||
callback?.onEditPollClicked(eventId)
|
callback?.onEditPollClick(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSendLocationClicked() {
|
private fun onSendLocationClick() {
|
||||||
callback?.onSendLocationClicked()
|
callback?.onSendLocationClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreatePollClicked() {
|
private fun onCreatePollClick() {
|
||||||
callback?.onCreatePollClicked()
|
callback?.onCreatePollClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onJoinCallClicked() {
|
private fun onJoinCallClick() {
|
||||||
callback?.onJoinCallClicked(room.roomId)
|
callback?.onJoinCallClick(room.roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -197,15 +197,15 @@ class MessagesNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
MessagesView(
|
MessagesView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
onRoomDetailsClicked = this::onRoomDetailsClicked,
|
onRoomDetailsClick = this::onRoomDetailsClick,
|
||||||
onEventClicked = this::onEventClicked,
|
onEventClick = this::onEventClick,
|
||||||
onPreviewAttachments = this::onPreviewAttachments,
|
onPreviewAttachments = this::onPreviewAttachments,
|
||||||
onUserDataClicked = this::onUserDataClicked,
|
onUserDataClick = this::onUserDataClick,
|
||||||
onLinkClicked = { onLinkClicked(context, it, state.timelineState.eventSink) },
|
onLinkClick = { onLinkClick(context, it, state.timelineState.eventSink) },
|
||||||
onSendLocationClicked = this::onSendLocationClicked,
|
onSendLocationClick = this::onSendLocationClick,
|
||||||
onCreatePollClicked = this::onCreatePollClicked,
|
onCreatePollClick = this::onCreatePollClick,
|
||||||
onJoinCallClicked = this::onJoinCallClicked,
|
onJoinCallClick = this::onJoinCallClick,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ class MessagesPresenter @AssistedInject constructor(
|
||||||
when (targetEvent.content) {
|
when (targetEvent.content) {
|
||||||
is TimelineItemPollContent -> {
|
is TimelineItemPollContent -> {
|
||||||
if (targetEvent.eventId == null) return
|
if (targetEvent.eventId == null) return
|
||||||
navigator.onEditPollClicked(targetEvent.eventId)
|
navigator.onEditPollClick(targetEvent.eventId)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val composerMode = MessageComposerMode.Edit(
|
val composerMode = MessageComposerMode.Edit(
|
||||||
|
|
@ -407,24 +407,24 @@ class MessagesPresenter @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleShowDebugInfoAction(event: TimelineItem.Event) {
|
private fun handleShowDebugInfoAction(event: TimelineItem.Event) {
|
||||||
navigator.onShowEventDebugInfoClicked(event.eventId, event.debugInfo)
|
navigator.onShowEventDebugInfoClick(event.eventId, event.debugInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleForwardAction(event: TimelineItem.Event) {
|
private fun handleForwardAction(event: TimelineItem.Event) {
|
||||||
if (event.eventId == null) return
|
if (event.eventId == null) return
|
||||||
navigator.onForwardEventClicked(event.eventId)
|
navigator.onForwardEventClick(event.eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleReportAction(event: TimelineItem.Event) {
|
private fun handleReportAction(event: TimelineItem.Event) {
|
||||||
if (event.eventId == null) return
|
if (event.eventId == null) return
|
||||||
navigator.onReportContentClicked(event.eventId, event.senderId)
|
navigator.onReportContentClick(event.eventId, event.senderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleEndPollAction(
|
private fun handleEndPollAction(
|
||||||
event: TimelineItem.Event,
|
event: TimelineItem.Event,
|
||||||
timelineState: TimelineState,
|
timelineState: TimelineState,
|
||||||
) {
|
) {
|
||||||
event.eventId?.let { timelineState.eventSink(TimelineEvents.PollEndClicked(it)) }
|
event.eventId?.let { timelineState.eventSink(TimelineEvents.EndPoll(it)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun handleCopyLink(event: TimelineItem.Event) {
|
private suspend fun handleCopyLink(event: TimelineItem.Event) {
|
||||||
|
|
|
||||||
|
|
@ -115,15 +115,15 @@ import androidx.compose.material3.Button as Material3Button
|
||||||
@Composable
|
@Composable
|
||||||
fun MessagesView(
|
fun MessagesView(
|
||||||
state: MessagesState,
|
state: MessagesState,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onRoomDetailsClicked: () -> Unit,
|
onRoomDetailsClick: () -> Unit,
|
||||||
onEventClicked: (event: TimelineItem.Event) -> Boolean,
|
onEventClick: (event: TimelineItem.Event) -> Boolean,
|
||||||
onUserDataClicked: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onPreviewAttachments: (ImmutableList<Attachment>) -> Unit,
|
onPreviewAttachments: (ImmutableList<Attachment>) -> Unit,
|
||||||
onSendLocationClicked: () -> Unit,
|
onSendLocationClick: () -> Unit,
|
||||||
onCreatePollClicked: () -> Unit,
|
onCreatePollClick: () -> Unit,
|
||||||
onJoinCallClicked: () -> Unit,
|
onJoinCallClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
forceJumpToBottomVisibility: Boolean = false
|
forceJumpToBottomVisibility: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
|
@ -144,15 +144,15 @@ fun MessagesView(
|
||||||
// This is needed because the composer is inside an AndroidView that can't be affected by the FocusManager in Compose
|
// This is needed because the composer is inside an AndroidView that can't be affected by the FocusManager in Compose
|
||||||
val localView = LocalView.current
|
val localView = LocalView.current
|
||||||
|
|
||||||
fun onMessageClicked(event: TimelineItem.Event) {
|
fun onMessageClick(event: TimelineItem.Event) {
|
||||||
Timber.v("OnMessageClicked= ${event.id}")
|
Timber.v("onMessageClick= ${event.id}")
|
||||||
val hideKeyboard = onEventClicked(event)
|
val hideKeyboard = onEventClick(event)
|
||||||
if (hideKeyboard) {
|
if (hideKeyboard) {
|
||||||
localView.hideKeyboard()
|
localView.hideKeyboard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onMessageLongClicked(event: TimelineItem.Event) {
|
fun onMessageLongClick(event: TimelineItem.Event) {
|
||||||
Timber.v("OnMessageLongClicked= ${event.id}")
|
Timber.v("OnMessageLongClicked= ${event.id}")
|
||||||
localView.hideKeyboard()
|
localView.hideKeyboard()
|
||||||
state.actionListState.eventSink(
|
state.actionListState.eventSink(
|
||||||
|
|
@ -170,17 +170,17 @@ fun MessagesView(
|
||||||
state.eventSink(MessagesEvents.HandleAction(action, event))
|
state.eventSink(MessagesEvents.HandleAction(action, event))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onEmojiReactionClicked(emoji: String, event: TimelineItem.Event) {
|
fun onEmojiReactionClick(emoji: String, event: TimelineItem.Event) {
|
||||||
if (event.eventId == null) return
|
if (event.eventId == null) return
|
||||||
state.eventSink(MessagesEvents.ToggleReaction(emoji, event.eventId))
|
state.eventSink(MessagesEvents.ToggleReaction(emoji, event.eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onEmojiReactionLongClicked(emoji: String, event: TimelineItem.Event) {
|
fun onEmojiReactionLongClick(emoji: String, event: TimelineItem.Event) {
|
||||||
if (event.eventId == null) return
|
if (event.eventId == null) return
|
||||||
state.reactionSummaryState.eventSink(ReactionSummaryEvents.ShowReactionSummary(event.eventId, event.reactionsState.reactions, emoji))
|
state.reactionSummaryState.eventSink(ReactionSummaryEvents.ShowReactionSummary(event.eventId, event.reactionsState.reactions, emoji))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onMoreReactionsClicked(event: TimelineItem.Event) {
|
fun onMoreReactionsClick(event: TimelineItem.Event) {
|
||||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,14 +194,14 @@ fun MessagesView(
|
||||||
roomName = state.roomName.dataOrNull(),
|
roomName = state.roomName.dataOrNull(),
|
||||||
roomAvatar = state.roomAvatar.dataOrNull(),
|
roomAvatar = state.roomAvatar.dataOrNull(),
|
||||||
callState = state.callState,
|
callState = state.callState,
|
||||||
onBackPressed = {
|
onBackClick = {
|
||||||
// Since the textfield is now based on an Android view, this is no longer done automatically.
|
// Since the textfield is now based on an Android view, this is no longer done automatically.
|
||||||
// We need to hide the keyboard when navigating out of this screen.
|
// We need to hide the keyboard when navigating out of this screen.
|
||||||
localView.hideKeyboard()
|
localView.hideKeyboard()
|
||||||
onBackPressed()
|
onBackClick()
|
||||||
},
|
},
|
||||||
onRoomDetailsClicked = onRoomDetailsClicked,
|
onRoomDetailsClick = onRoomDetailsClick,
|
||||||
onJoinCallClicked = onJoinCallClicked,
|
onJoinCallClick = onJoinCallClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -211,23 +211,23 @@ fun MessagesView(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
.consumeWindowInsets(padding),
|
.consumeWindowInsets(padding),
|
||||||
onMessageClicked = ::onMessageClicked,
|
onMessageClick = ::onMessageClick,
|
||||||
onMessageLongClicked = ::onMessageLongClicked,
|
onMessageLongClick = ::onMessageLongClick,
|
||||||
onUserDataClicked = onUserDataClicked,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onTimestampClicked = { event ->
|
onTimestampClick = { event ->
|
||||||
if (event.localSendState is LocalEventSendState.SendingFailed) {
|
if (event.localSendState is LocalEventSendState.SendingFailed) {
|
||||||
state.retrySendMenuState.eventSink(RetrySendMenuEvents.EventSelected(event))
|
state.retrySendMenuState.eventSink(RetrySendMenuEvents.EventSelected(event))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onReactionClicked = ::onEmojiReactionClicked,
|
onReactionClick = ::onEmojiReactionClick,
|
||||||
onReactionLongClicked = ::onEmojiReactionLongClicked,
|
onReactionLongClick = ::onEmojiReactionLongClick,
|
||||||
onMoreReactionsClicked = ::onMoreReactionsClicked,
|
onMoreReactionsClick = ::onMoreReactionsClick,
|
||||||
onReadReceiptClick = { event ->
|
onReadReceiptClick = { event ->
|
||||||
state.readReceiptBottomSheetState.eventSink(ReadReceiptBottomSheetEvents.EventSelected(event))
|
state.readReceiptBottomSheetState.eventSink(ReadReceiptBottomSheetEvents.EventSelected(event))
|
||||||
},
|
},
|
||||||
onSendLocationClicked = onSendLocationClicked,
|
onSendLocationClick = onSendLocationClick,
|
||||||
onCreatePollClicked = onCreatePollClicked,
|
onCreatePollClick = onCreatePollClick,
|
||||||
onSwipeToReply = { targetEvent ->
|
onSwipeToReply = { targetEvent ->
|
||||||
state.eventSink(MessagesEvents.HandleAction(TimelineItemAction.Reply, targetEvent))
|
state.eventSink(MessagesEvents.HandleAction(TimelineItemAction.Reply, targetEvent))
|
||||||
},
|
},
|
||||||
|
|
@ -244,17 +244,17 @@ fun MessagesView(
|
||||||
|
|
||||||
ActionListView(
|
ActionListView(
|
||||||
state = state.actionListState,
|
state = state.actionListState,
|
||||||
onActionSelected = ::onActionSelected,
|
onSelectAction = ::onActionSelected,
|
||||||
onCustomReactionClicked = { event ->
|
onCustomReactionClick = { event ->
|
||||||
if (event.eventId == null) return@ActionListView
|
if (event.eventId == null) return@ActionListView
|
||||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||||
},
|
},
|
||||||
onEmojiReactionClicked = ::onEmojiReactionClicked,
|
onEmojiReactionClick = ::onEmojiReactionClick,
|
||||||
)
|
)
|
||||||
|
|
||||||
CustomReactionBottomSheet(
|
CustomReactionBottomSheet(
|
||||||
state = state.customReactionState,
|
state = state.customReactionState,
|
||||||
onEmojiSelected = { eventId, emoji ->
|
onSelectEmoji = { eventId, emoji ->
|
||||||
state.eventSink(MessagesEvents.ToggleReaction(emoji.unicode, eventId))
|
state.eventSink(MessagesEvents.ToggleReaction(emoji.unicode, eventId))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -263,7 +263,7 @@ fun MessagesView(
|
||||||
RetrySendMessageMenu(state = state.retrySendMenuState)
|
RetrySendMessageMenu(state = state.retrySendMenuState)
|
||||||
ReadReceiptBottomSheet(
|
ReadReceiptBottomSheet(
|
||||||
state = state.readReceiptBottomSheetState,
|
state = state.readReceiptBottomSheetState,
|
||||||
onUserDataClicked = onUserDataClicked,
|
onUserDataClick = onUserDataClick,
|
||||||
)
|
)
|
||||||
ReinviteDialog(state = state)
|
ReinviteDialog(state = state)
|
||||||
}
|
}
|
||||||
|
|
@ -276,7 +276,7 @@ private fun ReinviteDialog(state: MessagesState) {
|
||||||
content = stringResource(id = R.string.screen_room_invite_again_alert_message),
|
content = stringResource(id = R.string.screen_room_invite_again_alert_message),
|
||||||
cancelText = stringResource(id = CommonStrings.action_cancel),
|
cancelText = stringResource(id = CommonStrings.action_cancel),
|
||||||
submitText = stringResource(id = CommonStrings.action_invite),
|
submitText = stringResource(id = CommonStrings.action_invite),
|
||||||
onSubmitClicked = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Invite)) },
|
onSubmitClick = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Invite)) },
|
||||||
onDismiss = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Cancel)) }
|
onDismiss = { state.eventSink(MessagesEvents.InviteDialogDismissed(InviteDialogAction.Cancel)) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -313,17 +313,17 @@ private fun AttachmentStateView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun MessagesViewContent(
|
private fun MessagesViewContent(
|
||||||
state: MessagesState,
|
state: MessagesState,
|
||||||
onMessageClicked: (TimelineItem.Event) -> Unit,
|
onMessageClick: (TimelineItem.Event) -> Unit,
|
||||||
onUserDataClicked: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onReactionClicked: (key: String, TimelineItem.Event) -> Unit,
|
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onReactionLongClicked: (key: String, TimelineItem.Event) -> Unit,
|
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClicked: (TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||||
onMessageLongClicked: (TimelineItem.Event) -> Unit,
|
onMessageLongClick: (TimelineItem.Event) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onSendLocationClicked: () -> Unit,
|
onSendLocationClick: () -> Unit,
|
||||||
onCreatePollClicked: () -> Unit,
|
onCreatePollClick: () -> Unit,
|
||||||
forceJumpToBottomVisibility: Boolean,
|
forceJumpToBottomVisibility: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||||
|
|
@ -336,8 +336,8 @@ private fun MessagesViewContent(
|
||||||
) {
|
) {
|
||||||
AttachmentsBottomSheet(
|
AttachmentsBottomSheet(
|
||||||
state = state.composerState,
|
state = state.composerState,
|
||||||
onSendLocationClicked = onSendLocationClicked,
|
onSendLocationClick = onSendLocationClick,
|
||||||
onCreatePollClicked = onCreatePollClicked,
|
onCreatePollClick = onCreatePollClick,
|
||||||
enableTextFormatting = state.enableTextFormatting,
|
enableTextFormatting = state.enableTextFormatting,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -384,15 +384,15 @@ private fun MessagesViewContent(
|
||||||
TimelineView(
|
TimelineView(
|
||||||
state = state.timelineState,
|
state = state.timelineState,
|
||||||
typingNotificationState = state.typingNotificationState,
|
typingNotificationState = state.typingNotificationState,
|
||||||
onUserDataClicked = onUserDataClicked,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onMessageClicked = onMessageClicked,
|
onMessageClick = onMessageClick,
|
||||||
onMessageLongClicked = onMessageLongClicked,
|
onMessageLongClick = onMessageLongClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
onSwipeToReply = onSwipeToReply,
|
onSwipeToReply = onSwipeToReply,
|
||||||
onReactionClicked = onReactionClicked,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClicked = onReactionLongClicked,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClicked = onMoreReactionsClicked,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
onReadReceiptClick = onReadReceiptClick,
|
onReadReceiptClick = onReadReceiptClick,
|
||||||
modifier = Modifier.padding(paddingValues),
|
modifier = Modifier.padding(paddingValues),
|
||||||
forceJumpToBottomVisibility = forceJumpToBottomVisibility,
|
forceJumpToBottomVisibility = forceJumpToBottomVisibility,
|
||||||
|
|
@ -431,7 +431,7 @@ private fun MessagesViewComposerBottomSheetContents(
|
||||||
roomName = state.roomName.dataOrNull(),
|
roomName = state.roomName.dataOrNull(),
|
||||||
roomAvatarData = state.roomAvatar.dataOrNull(),
|
roomAvatarData = state.roomAvatar.dataOrNull(),
|
||||||
memberSuggestions = state.composerState.memberSuggestions,
|
memberSuggestions = state.composerState.memberSuggestions,
|
||||||
onSuggestionSelected = {
|
onSelectSuggestion = {
|
||||||
state.composerState.eventSink(MessageComposerEvents.InsertMention(it))
|
state.composerState.eventSink(MessageComposerEvents.InsertMention(it))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -454,16 +454,16 @@ private fun MessagesViewTopBar(
|
||||||
roomName: String?,
|
roomName: String?,
|
||||||
roomAvatar: AvatarData?,
|
roomAvatar: AvatarData?,
|
||||||
callState: RoomCallState,
|
callState: RoomCallState,
|
||||||
onRoomDetailsClicked: () -> Unit,
|
onRoomDetailsClick: () -> Unit,
|
||||||
onJoinCallClicked: () -> Unit,
|
onJoinCallClick: () -> Unit,
|
||||||
onBackPressed: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackPressed)
|
BackButton(onClick = onBackClick)
|
||||||
},
|
},
|
||||||
title = {
|
title = {
|
||||||
val titleModifier = Modifier.clickable { onRoomDetailsClicked() }
|
val titleModifier = Modifier.clickable { onRoomDetailsClick() }
|
||||||
if (roomName != null && roomAvatar != null) {
|
if (roomName != null && roomAvatar != null) {
|
||||||
RoomAvatarAndNameRow(
|
RoomAvatarAndNameRow(
|
||||||
roomName = roomName,
|
roomName = roomName,
|
||||||
|
|
@ -479,9 +479,9 @@ private fun MessagesViewTopBar(
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
if (callState == RoomCallState.ONGOING) {
|
if (callState == RoomCallState.ONGOING) {
|
||||||
JoinCallMenuItem(onJoinCallClicked = onJoinCallClicked)
|
JoinCallMenuItem(onJoinCallClick = onJoinCallClick)
|
||||||
} else {
|
} else {
|
||||||
IconButton(onClick = onJoinCallClicked, enabled = callState != RoomCallState.DISABLED) {
|
IconButton(onClick = onJoinCallClick, enabled = callState != RoomCallState.DISABLED) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = CompoundIcons.VideoCallSolid(),
|
imageVector = CompoundIcons.VideoCallSolid(),
|
||||||
contentDescription = stringResource(CommonStrings.a11y_start_call),
|
contentDescription = stringResource(CommonStrings.a11y_start_call),
|
||||||
|
|
@ -496,10 +496,10 @@ private fun MessagesViewTopBar(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun JoinCallMenuItem(
|
private fun JoinCallMenuItem(
|
||||||
onJoinCallClicked: () -> Unit,
|
onJoinCallClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Material3Button(
|
Material3Button(
|
||||||
onClick = onJoinCallClicked,
|
onClick = onJoinCallClick,
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
contentColor = ElementTheme.colors.bgCanvasDefault,
|
contentColor = ElementTheme.colors.bgCanvasDefault,
|
||||||
containerColor = ElementTheme.colors.iconAccentTertiary
|
containerColor = ElementTheme.colors.iconAccentTertiary
|
||||||
|
|
@ -567,15 +567,15 @@ private fun CantSendMessageBanner() {
|
||||||
internal fun MessagesViewPreview(@PreviewParameter(MessagesStateProvider::class) state: MessagesState) = ElementPreview {
|
internal fun MessagesViewPreview(@PreviewParameter(MessagesStateProvider::class) state: MessagesState) = ElementPreview {
|
||||||
MessagesView(
|
MessagesView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackPressed = {},
|
onBackClick = {},
|
||||||
onRoomDetailsClicked = {},
|
onRoomDetailsClick = {},
|
||||||
onEventClicked = { false },
|
onEventClick = { false },
|
||||||
onPreviewAttachments = {},
|
onPreviewAttachments = {},
|
||||||
onUserDataClicked = {},
|
onUserDataClick = {},
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
onSendLocationClicked = {},
|
onSendLocationClick = {},
|
||||||
onCreatePollClicked = {},
|
onCreatePollClick = {},
|
||||||
onJoinCallClicked = {},
|
onJoinCallClick = {},
|
||||||
forceJumpToBottomVisibility = true,
|
forceJumpToBottomVisibility = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,38 +94,38 @@ import kotlinx.collections.immutable.ImmutableList
|
||||||
@Composable
|
@Composable
|
||||||
fun ActionListView(
|
fun ActionListView(
|
||||||
state: ActionListState,
|
state: ActionListState,
|
||||||
onActionSelected: (action: TimelineItemAction, TimelineItem.Event) -> Unit,
|
onSelectAction: (action: TimelineItemAction, TimelineItem.Event) -> Unit,
|
||||||
onEmojiReactionClicked: (String, TimelineItem.Event) -> Unit,
|
onEmojiReactionClick: (String, TimelineItem.Event) -> Unit,
|
||||||
onCustomReactionClicked: (TimelineItem.Event) -> Unit,
|
onCustomReactionClick: (TimelineItem.Event) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val sheetState = rememberModalBottomSheetState()
|
val sheetState = rememberModalBottomSheetState()
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val targetItem = (state.target as? ActionListState.Target.Success)?.event
|
val targetItem = (state.target as? ActionListState.Target.Success)?.event
|
||||||
|
|
||||||
fun onItemActionClicked(
|
fun onItemActionClick(
|
||||||
itemAction: TimelineItemAction
|
itemAction: TimelineItemAction
|
||||||
) {
|
) {
|
||||||
if (targetItem == null) return
|
if (targetItem == null) return
|
||||||
sheetState.hide(coroutineScope) {
|
sheetState.hide(coroutineScope) {
|
||||||
state.eventSink(ActionListEvents.Clear)
|
state.eventSink(ActionListEvents.Clear)
|
||||||
onActionSelected(itemAction, targetItem)
|
onSelectAction(itemAction, targetItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onEmojiReactionClicked(emoji: String) {
|
fun onEmojiReactionClick(emoji: String) {
|
||||||
if (targetItem == null) return
|
if (targetItem == null) return
|
||||||
sheetState.hide(coroutineScope) {
|
sheetState.hide(coroutineScope) {
|
||||||
state.eventSink(ActionListEvents.Clear)
|
state.eventSink(ActionListEvents.Clear)
|
||||||
onEmojiReactionClicked(emoji, targetItem)
|
onEmojiReactionClick(emoji, targetItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onCustomReactionClicked() {
|
fun onCustomReactionClick() {
|
||||||
if (targetItem == null) return
|
if (targetItem == null) return
|
||||||
sheetState.hide(coroutineScope) {
|
sheetState.hide(coroutineScope) {
|
||||||
state.eventSink(ActionListEvents.Clear)
|
state.eventSink(ActionListEvents.Clear)
|
||||||
onCustomReactionClicked(targetItem)
|
onCustomReactionClick(targetItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,9 +141,9 @@ fun ActionListView(
|
||||||
) {
|
) {
|
||||||
SheetContent(
|
SheetContent(
|
||||||
state = state,
|
state = state,
|
||||||
onActionClicked = ::onItemActionClicked,
|
onActionClick = ::onItemActionClick,
|
||||||
onEmojiReactionClicked = ::onEmojiReactionClicked,
|
onEmojiReactionClick = ::onEmojiReactionClick,
|
||||||
onCustomReactionClicked = ::onCustomReactionClicked,
|
onCustomReactionClick = ::onCustomReactionClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.navigationBarsPadding()
|
.navigationBarsPadding()
|
||||||
.imePadding()
|
.imePadding()
|
||||||
|
|
@ -155,9 +155,9 @@ fun ActionListView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun SheetContent(
|
private fun SheetContent(
|
||||||
state: ActionListState,
|
state: ActionListState,
|
||||||
onActionClicked: (TimelineItemAction) -> Unit,
|
onActionClick: (TimelineItemAction) -> Unit,
|
||||||
onEmojiReactionClicked: (String) -> Unit,
|
onEmojiReactionClick: (String) -> Unit,
|
||||||
onCustomReactionClicked: () -> Unit,
|
onCustomReactionClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
when (val target = state.target) {
|
when (val target = state.target) {
|
||||||
|
|
@ -188,8 +188,8 @@ private fun SheetContent(
|
||||||
item {
|
item {
|
||||||
EmojiReactionsRow(
|
EmojiReactionsRow(
|
||||||
highlightedEmojis = target.event.reactionsState.highlightedKeys,
|
highlightedEmojis = target.event.reactionsState.highlightedKeys,
|
||||||
onEmojiReactionClicked = onEmojiReactionClicked,
|
onEmojiReactionClick = onEmojiReactionClick,
|
||||||
onCustomReactionClicked = onCustomReactionClicked,
|
onCustomReactionClick = onCustomReactionClick,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
|
|
@ -200,7 +200,7 @@ private fun SheetContent(
|
||||||
) { action ->
|
) { action ->
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
onActionClicked(action)
|
onActionClick(action)
|
||||||
},
|
},
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
Text(text = stringResource(id = action.titleRes))
|
Text(text = stringResource(id = action.titleRes))
|
||||||
|
|
@ -292,8 +292,8 @@ private val emojiRippleRadius = 24.dp
|
||||||
@Composable
|
@Composable
|
||||||
private fun EmojiReactionsRow(
|
private fun EmojiReactionsRow(
|
||||||
highlightedEmojis: ImmutableList<String>,
|
highlightedEmojis: ImmutableList<String>,
|
||||||
onEmojiReactionClicked: (String) -> Unit,
|
onEmojiReactionClick: (String) -> Unit,
|
||||||
onCustomReactionClicked: () -> Unit,
|
onCustomReactionClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -310,7 +310,7 @@ private fun EmojiReactionsRow(
|
||||||
)
|
)
|
||||||
for (emoji in defaultEmojis) {
|
for (emoji in defaultEmojis) {
|
||||||
val isHighlighted = highlightedEmojis.contains(emoji)
|
val isHighlighted = highlightedEmojis.contains(emoji)
|
||||||
EmojiButton(emoji, isHighlighted, onEmojiReactionClicked)
|
EmojiButton(emoji, isHighlighted, onEmojiReactionClick)
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -325,7 +325,7 @@ private fun EmojiReactionsRow(
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
.clickable(
|
.clickable(
|
||||||
enabled = true,
|
enabled = true,
|
||||||
onClick = onCustomReactionClicked,
|
onClick = onCustomReactionClick,
|
||||||
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
||||||
interactionSource = remember { MutableInteractionSource() }
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
)
|
)
|
||||||
|
|
@ -338,7 +338,7 @@ private fun EmojiReactionsRow(
|
||||||
private fun EmojiButton(
|
private fun EmojiButton(
|
||||||
emoji: String,
|
emoji: String,
|
||||||
isHighlighted: Boolean,
|
isHighlighted: Boolean,
|
||||||
onClicked: (String) -> Unit,
|
onClick: (String) -> Unit,
|
||||||
) {
|
) {
|
||||||
val backgroundColor = if (isHighlighted) {
|
val backgroundColor = if (isHighlighted) {
|
||||||
ElementTheme.colors.bgActionPrimaryRest
|
ElementTheme.colors.bgActionPrimaryRest
|
||||||
|
|
@ -365,7 +365,7 @@ private fun EmojiButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clickable(
|
.clickable(
|
||||||
enabled = true,
|
enabled = true,
|
||||||
onClick = { onClicked(emoji) },
|
onClick = { onClick(emoji) },
|
||||||
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
indication = rememberRipple(bounded = false, radius = emojiRippleRadius),
|
||||||
interactionSource = remember { MutableInteractionSource() }
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
)
|
)
|
||||||
|
|
@ -380,8 +380,8 @@ internal fun SheetContentPreview(
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
SheetContent(
|
SheetContent(
|
||||||
state = state,
|
state = state,
|
||||||
onActionClicked = {},
|
onActionClick = {},
|
||||||
onEmojiReactionClicked = {},
|
onEmojiReactionClick = {},
|
||||||
onCustomReactionClicked = {},
|
onCustomReactionClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,22 +73,22 @@ fun AttachmentsPreviewView(
|
||||||
Scaffold(modifier) {
|
Scaffold(modifier) {
|
||||||
AttachmentPreviewContent(
|
AttachmentPreviewContent(
|
||||||
attachment = state.attachment,
|
attachment = state.attachment,
|
||||||
onSendClicked = ::postSendAttachment,
|
onSendClick = ::postSendAttachment,
|
||||||
onDismiss = onDismiss
|
onDismiss = onDismiss
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
AttachmentSendStateView(
|
AttachmentSendStateView(
|
||||||
sendActionState = state.sendActionState,
|
sendActionState = state.sendActionState,
|
||||||
onDismissClicked = ::postClearSendState,
|
onDismissClick = ::postClearSendState,
|
||||||
onRetryClicked = ::postSendAttachment
|
onRetryClick = ::postSendAttachment
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AttachmentSendStateView(
|
private fun AttachmentSendStateView(
|
||||||
sendActionState: SendActionState,
|
sendActionState: SendActionState,
|
||||||
onDismissClicked: () -> Unit,
|
onDismissClick: () -> Unit,
|
||||||
onRetryClicked: () -> Unit
|
onRetryClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
when (sendActionState) {
|
when (sendActionState) {
|
||||||
is SendActionState.Sending -> {
|
is SendActionState.Sending -> {
|
||||||
|
|
@ -99,14 +99,14 @@ private fun AttachmentSendStateView(
|
||||||
},
|
},
|
||||||
text = stringResource(id = CommonStrings.common_sending),
|
text = stringResource(id = CommonStrings.common_sending),
|
||||||
isCancellable = true,
|
isCancellable = true,
|
||||||
onDismissRequest = onDismissClicked,
|
onDismissRequest = onDismissClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is SendActionState.Failure -> {
|
is SendActionState.Failure -> {
|
||||||
RetryDialog(
|
RetryDialog(
|
||||||
content = stringResource(sendAttachmentError(sendActionState.error)),
|
content = stringResource(sendAttachmentError(sendActionState.error)),
|
||||||
onDismiss = onDismissClicked,
|
onDismiss = onDismissClick,
|
||||||
onRetry = onRetryClicked
|
onRetry = onRetryClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else -> Unit
|
else -> Unit
|
||||||
|
|
@ -116,7 +116,7 @@ private fun AttachmentSendStateView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun AttachmentPreviewContent(
|
private fun AttachmentPreviewContent(
|
||||||
attachment: Attachment,
|
attachment: Attachment,
|
||||||
onSendClicked: () -> Unit,
|
onSendClick: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
|
|
@ -146,8 +146,8 @@ private fun AttachmentPreviewContent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AttachmentsPreviewBottomActions(
|
AttachmentsPreviewBottomActions(
|
||||||
onCancelClicked = onDismiss,
|
onCancelClick = onDismiss,
|
||||||
onSendClicked = onSendClicked,
|
onSendClick = onSendClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(Color.Black.copy(alpha = 0.7f))
|
.background(Color.Black.copy(alpha = 0.7f))
|
||||||
|
|
@ -159,13 +159,13 @@ private fun AttachmentPreviewContent(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AttachmentsPreviewBottomActions(
|
private fun AttachmentsPreviewBottomActions(
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClick: () -> Unit,
|
||||||
onSendClicked: () -> Unit,
|
onSendClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
ButtonRowMolecule(modifier = modifier) {
|
ButtonRowMolecule(modifier = modifier) {
|
||||||
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClicked)
|
TextButton(stringResource(id = CommonStrings.action_cancel), onClick = onCancelClick)
|
||||||
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClicked)
|
TextButton(stringResource(id = CommonStrings.action_send), onClick = onSendClick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,12 +94,12 @@ class ForwardMessagesNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
ForwardMessagesView(
|
ForwardMessagesView(
|
||||||
state = state,
|
state = state,
|
||||||
onForwardingSucceeded = ::onSucceeded,
|
onForwardSuccess = ::onForwardSuccess,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSucceeded(roomIds: ImmutableList<RoomId>) {
|
private fun onForwardSuccess(roomIds: ImmutableList<RoomId>) {
|
||||||
navigateUp()
|
navigateUp()
|
||||||
if (roomIds.size == 1) {
|
if (roomIds.size == 1) {
|
||||||
val targetRoomId = roomIds.first()
|
val targetRoomId = roomIds.first()
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ import kotlinx.collections.immutable.ImmutableList
|
||||||
@Composable
|
@Composable
|
||||||
fun ForwardMessagesView(
|
fun ForwardMessagesView(
|
||||||
state: ForwardMessagesState,
|
state: ForwardMessagesState,
|
||||||
onForwardingSucceeded: (ImmutableList<RoomId>) -> Unit,
|
onForwardSuccess: (ImmutableList<RoomId>) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
if (state.forwardingSucceeded != null) {
|
if (state.forwardingSucceeded != null) {
|
||||||
onForwardingSucceeded(state.forwardingSucceeded)
|
onForwardSuccess(state.forwardingSucceeded)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,6 +64,6 @@ private fun ForwardingErrorDialog(onDismiss: () -> Unit, modifier: Modifier = Mo
|
||||||
internal fun ForwardMessagesViewPreview(@PreviewParameter(ForwardMessagesStateProvider::class) state: ForwardMessagesState) = ElementPreview {
|
internal fun ForwardMessagesViewPreview(@PreviewParameter(ForwardMessagesStateProvider::class) state: ForwardMessagesState) = ElementPreview {
|
||||||
ForwardMessagesView(
|
ForwardMessagesView(
|
||||||
state = state,
|
state = state,
|
||||||
onForwardingSucceeded = {}
|
onForwardSuccess = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ fun MentionSuggestionsPickerView(
|
||||||
roomName: String?,
|
roomName: String?,
|
||||||
roomAvatarData: AvatarData?,
|
roomAvatarData: AvatarData?,
|
||||||
memberSuggestions: ImmutableList<ResolvedMentionSuggestion>,
|
memberSuggestions: ImmutableList<ResolvedMentionSuggestion>,
|
||||||
onSuggestionSelected: (ResolvedMentionSuggestion) -> Unit,
|
onSelectSuggestion: (ResolvedMentionSuggestion) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
|
|
@ -74,7 +74,7 @@ fun MentionSuggestionsPickerView(
|
||||||
roomId = roomId.value,
|
roomId = roomId.value,
|
||||||
roomName = roomName,
|
roomName = roomName,
|
||||||
roomAvatar = roomAvatarData,
|
roomAvatar = roomAvatarData,
|
||||||
onSuggestionSelected = onSuggestionSelected,
|
onSelectSuggestion = onSelectSuggestion,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
HorizontalDivider(modifier = Modifier.fillMaxWidth())
|
HorizontalDivider(modifier = Modifier.fillMaxWidth())
|
||||||
|
|
@ -89,10 +89,10 @@ private fun RoomMemberSuggestionItemView(
|
||||||
roomId: String,
|
roomId: String,
|
||||||
roomName: String?,
|
roomName: String?,
|
||||||
roomAvatar: AvatarData?,
|
roomAvatar: AvatarData?,
|
||||||
onSuggestionSelected: (ResolvedMentionSuggestion) -> Unit,
|
onSelectSuggestion: (ResolvedMentionSuggestion) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Row(modifier = modifier.clickable { onSuggestionSelected(memberSuggestion) }, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
Row(modifier = modifier.clickable { onSelectSuggestion(memberSuggestion) }, horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
val avatarSize = AvatarSize.TimelineRoom
|
val avatarSize = AvatarSize.TimelineRoom
|
||||||
val avatarData = when (memberSuggestion) {
|
val avatarData = when (memberSuggestion) {
|
||||||
is ResolvedMentionSuggestion.AtRoom -> roomAvatar?.copy(size = avatarSize) ?: AvatarData(roomId, roomName, null, avatarSize)
|
is ResolvedMentionSuggestion.AtRoom -> roomAvatar?.copy(size = avatarSize) ?: AvatarData(roomId, roomName, null, avatarSize)
|
||||||
|
|
@ -164,7 +164,7 @@ internal fun MentionSuggestionsPickerViewPreview() {
|
||||||
ResolvedMentionSuggestion.Member(roomMember),
|
ResolvedMentionSuggestion.Member(roomMember),
|
||||||
ResolvedMentionSuggestion.Member(roomMember.copy(userId = UserId("@bob:server.org"), displayName = "Bob")),
|
ResolvedMentionSuggestion.Member(roomMember.copy(userId = UserId("@bob:server.org"), displayName = "Bob")),
|
||||||
),
|
),
|
||||||
onSuggestionSelected = {}
|
onSelectSuggestion = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
@Composable
|
@Composable
|
||||||
internal fun AttachmentsBottomSheet(
|
internal fun AttachmentsBottomSheet(
|
||||||
state: MessageComposerState,
|
state: MessageComposerState,
|
||||||
onSendLocationClicked: () -> Unit,
|
onSendLocationClick: () -> Unit,
|
||||||
onCreatePollClicked: () -> Unit,
|
onCreatePollClick: () -> Unit,
|
||||||
enableTextFormatting: Boolean,
|
enableTextFormatting: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -87,8 +87,8 @@ internal fun AttachmentsBottomSheet(
|
||||||
AttachmentSourcePickerMenu(
|
AttachmentSourcePickerMenu(
|
||||||
state = state,
|
state = state,
|
||||||
enableTextFormatting = enableTextFormatting,
|
enableTextFormatting = enableTextFormatting,
|
||||||
onSendLocationClicked = onSendLocationClicked,
|
onSendLocationClick = onSendLocationClick,
|
||||||
onCreatePollClicked = onCreatePollClicked,
|
onCreatePollClick = onCreatePollClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -97,8 +97,8 @@ internal fun AttachmentsBottomSheet(
|
||||||
@Composable
|
@Composable
|
||||||
private fun AttachmentSourcePickerMenu(
|
private fun AttachmentSourcePickerMenu(
|
||||||
state: MessageComposerState,
|
state: MessageComposerState,
|
||||||
onSendLocationClicked: () -> Unit,
|
onSendLocationClick: () -> Unit,
|
||||||
onCreatePollClicked: () -> Unit,
|
onCreatePollClick: () -> Unit,
|
||||||
enableTextFormatting: Boolean,
|
enableTextFormatting: Boolean,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
|
@ -134,7 +134,7 @@ private fun AttachmentSourcePickerMenu(
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
state.eventSink(MessageComposerEvents.PickAttachmentSource.Location)
|
state.eventSink(MessageComposerEvents.PickAttachmentSource.Location)
|
||||||
onSendLocationClicked()
|
onSendLocationClick()
|
||||||
},
|
},
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.LocationPin())),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.LocationPin())),
|
||||||
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_location)) },
|
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_location)) },
|
||||||
|
|
@ -145,7 +145,7 @@ private fun AttachmentSourcePickerMenu(
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
state.eventSink(MessageComposerEvents.PickAttachmentSource.Poll)
|
state.eventSink(MessageComposerEvents.PickAttachmentSource.Poll)
|
||||||
onCreatePollClicked()
|
onCreatePollClick()
|
||||||
},
|
},
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())),
|
||||||
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_poll)) },
|
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_poll)) },
|
||||||
|
|
@ -170,8 +170,8 @@ internal fun AttachmentSourcePickerMenuPreview() = ElementPreview {
|
||||||
state = aMessageComposerState(
|
state = aMessageComposerState(
|
||||||
canShareLocation = true,
|
canShareLocation = true,
|
||||||
),
|
),
|
||||||
onSendLocationClicked = {},
|
onSendLocationClick = {},
|
||||||
onCreatePollClicked = {},
|
onCreatePollClick = {},
|
||||||
enableTextFormatting = true,
|
enableTextFormatting = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,11 +121,11 @@ internal fun MessageComposerView(
|
||||||
onVoicePlayerEvent = onVoicePlayerEvent,
|
onVoicePlayerEvent = onVoicePlayerEvent,
|
||||||
onSendVoiceMessage = onSendVoiceMessage,
|
onSendVoiceMessage = onSendVoiceMessage,
|
||||||
onDeleteVoiceMessage = onDeleteVoiceMessage,
|
onDeleteVoiceMessage = onDeleteVoiceMessage,
|
||||||
onSuggestionReceived = ::onSuggestionReceived,
|
onReceiveSuggestion = ::onSuggestionReceived,
|
||||||
onError = ::onError,
|
onError = ::onError,
|
||||||
onTyping = ::onTyping,
|
onTyping = ::onTyping,
|
||||||
currentUserId = state.currentUserId,
|
currentUserId = state.currentUserId,
|
||||||
onRichContentSelected = ::sendUri,
|
onSelectRichContent = ::sendUri,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class ReportMessageNode @AssistedInject constructor(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
ReportMessageView(
|
ReportMessageView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClicked = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun ReportMessageView(
|
fun ReportMessageView(
|
||||||
state: ReportMessageState,
|
state: ReportMessageState,
|
||||||
onBackClicked: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
|
|
@ -66,7 +66,7 @@ fun ReportMessageView(
|
||||||
AsyncActionView(
|
AsyncActionView(
|
||||||
async = state.result,
|
async = state.result,
|
||||||
progressDialog = {},
|
progressDialog = {},
|
||||||
onSuccess = { onBackClicked() },
|
onSuccess = { onBackClick() },
|
||||||
errorMessage = { stringResource(CommonStrings.error_unknown) },
|
errorMessage = { stringResource(CommonStrings.error_unknown) },
|
||||||
onErrorDismiss = { state.eventSink(ReportMessageEvents.ClearError) }
|
onErrorDismiss = { state.eventSink(ReportMessageEvents.ClearError) }
|
||||||
)
|
)
|
||||||
|
|
@ -81,7 +81,7 @@ fun ReportMessageView(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackClicked)
|
BackButton(onClick = onBackClick)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
@ -160,7 +160,7 @@ fun ReportMessageView(
|
||||||
@Composable
|
@Composable
|
||||||
internal fun ReportMessageViewPreview(@PreviewParameter(ReportMessageStateProvider::class) state: ReportMessageState) = ElementPreview {
|
internal fun ReportMessageViewPreview(@PreviewParameter(ReportMessageStateProvider::class) state: ReportMessageState) = ElementPreview {
|
||||||
ReportMessageView(
|
ReportMessageView(
|
||||||
onBackClicked = {},
|
onBackClick = {},
|
||||||
state = state,
|
state = state,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,16 @@ sealed interface TimelineEvents {
|
||||||
*/
|
*/
|
||||||
sealed interface TimelineItemPollEvents : EventFromTimelineItem
|
sealed interface TimelineItemPollEvents : EventFromTimelineItem
|
||||||
|
|
||||||
data class PollAnswerSelected(
|
data class SelectPollAnswer(
|
||||||
val pollStartId: EventId,
|
val pollStartId: EventId,
|
||||||
val answerId: String
|
val answerId: String
|
||||||
) : TimelineItemPollEvents
|
) : TimelineItemPollEvents
|
||||||
|
|
||||||
data class PollEndClicked(
|
data class EndPoll(
|
||||||
val pollStartId: EventId,
|
val pollStartId: EventId,
|
||||||
) : TimelineItemPollEvents
|
) : TimelineItemPollEvents
|
||||||
|
|
||||||
data class PollEditClicked(
|
data class EditPoll(
|
||||||
val pollStartId: EventId,
|
val pollStartId: EventId,
|
||||||
) : TimelineItemPollEvents
|
) : TimelineItemPollEvents
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,19 +122,19 @@ class TimelinePresenter @AssistedInject constructor(
|
||||||
newEventState.value = NewEventState.None
|
newEventState.value = NewEventState.None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is TimelineEvents.PollAnswerSelected -> appScope.launch {
|
is TimelineEvents.SelectPollAnswer -> appScope.launch {
|
||||||
sendPollResponseAction.execute(
|
sendPollResponseAction.execute(
|
||||||
pollStartId = event.pollStartId,
|
pollStartId = event.pollStartId,
|
||||||
answerId = event.answerId
|
answerId = event.answerId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is TimelineEvents.PollEndClicked -> appScope.launch {
|
is TimelineEvents.EndPoll -> appScope.launch {
|
||||||
endPollAction.execute(
|
endPollAction.execute(
|
||||||
pollStartId = event.pollStartId,
|
pollStartId = event.pollStartId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is TimelineEvents.PollEditClicked -> {
|
is TimelineEvents.EditPoll -> {
|
||||||
navigator.onEditPollClicked(event.pollStartId)
|
navigator.onEditPollClick(event.pollStartId)
|
||||||
}
|
}
|
||||||
is TimelineEvents.FocusOnEvent -> localScope.launch {
|
is TimelineEvents.FocusOnEvent -> localScope.launch {
|
||||||
focusedEventId.value = event.eventId
|
focusedEventId.value = event.eventId
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,15 @@ import kotlin.math.abs
|
||||||
fun TimelineView(
|
fun TimelineView(
|
||||||
state: TimelineState,
|
state: TimelineState,
|
||||||
typingNotificationState: TypingNotificationState,
|
typingNotificationState: TypingNotificationState,
|
||||||
onUserDataClicked: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onMessageClicked: (TimelineItem.Event) -> Unit,
|
onMessageClick: (TimelineItem.Event) -> Unit,
|
||||||
onMessageLongClicked: (TimelineItem.Event) -> Unit,
|
onMessageLongClick: (TimelineItem.Event) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||||
onReactionClicked: (emoji: String, TimelineItem.Event) -> Unit,
|
onReactionClick: (emoji: String, TimelineItem.Event) -> Unit,
|
||||||
onReactionLongClicked: (emoji: String, TimelineItem.Event) -> Unit,
|
onReactionLongClick: (emoji: String, TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClicked: (TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
forceJumpToBottomVisibility: Boolean = false
|
forceJumpToBottomVisibility: Boolean = false
|
||||||
|
|
@ -96,7 +96,7 @@ fun TimelineView(
|
||||||
state.eventSink(TimelineEvents.ClearFocusRequestState)
|
state.eventSink(TimelineEvents.ClearFocusRequestState)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onScrollFinishedAt(firstVisibleIndex: Int) {
|
fun onScrollFinishAt(firstVisibleIndex: Int) {
|
||||||
state.eventSink(TimelineEvents.OnScrollFinished(firstVisibleIndex))
|
state.eventSink(TimelineEvents.OnScrollFinished(firstVisibleIndex))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ fun TimelineView(
|
||||||
accessibilityManager.isTouchExplorationEnabled.not()
|
accessibilityManager.isTouchExplorationEnabled.not()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun inReplyToClicked(eventId: EventId) {
|
fun inReplyToClick(eventId: EventId) {
|
||||||
state.eventSink(TimelineEvents.FocusOnEvent(eventId))
|
state.eventSink(TimelineEvents.FocusOnEvent(eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,16 +138,16 @@ fun TimelineView(
|
||||||
isLastOutgoingMessage = (timelineItem as? TimelineItem.Event)?.isMine == true &&
|
isLastOutgoingMessage = (timelineItem as? TimelineItem.Event)?.isMine == true &&
|
||||||
state.timelineItems.first().identifier() == timelineItem.identifier(),
|
state.timelineItems.first().identifier() == timelineItem.identifier(),
|
||||||
focusedEventId = state.focusedEventId,
|
focusedEventId = state.focusedEventId,
|
||||||
onClick = onMessageClicked,
|
onClick = onMessageClick,
|
||||||
onLongClick = onMessageLongClicked,
|
onLongClick = onMessageLongClick,
|
||||||
onUserDataClick = onUserDataClicked,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
inReplyToClick = ::inReplyToClicked,
|
inReplyToClick = ::inReplyToClick,
|
||||||
onReactionClick = onReactionClicked,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClicked,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClicked,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
onReadReceiptClick = onReadReceiptClick,
|
onReadReceiptClick = onReadReceiptClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
eventSink = state.eventSink,
|
eventSink = state.eventSink,
|
||||||
onSwipeToReply = onSwipeToReply,
|
onSwipeToReply = onSwipeToReply,
|
||||||
)
|
)
|
||||||
|
|
@ -166,7 +166,7 @@ fun TimelineView(
|
||||||
newEventState = state.newEventState,
|
newEventState = state.newEventState,
|
||||||
isLive = state.isLive,
|
isLive = state.isLive,
|
||||||
focusRequestState = state.focusRequestState,
|
focusRequestState = state.focusRequestState,
|
||||||
onScrollFinishedAt = ::onScrollFinishedAt,
|
onScrollFinishAt = ::onScrollFinishAt,
|
||||||
onClearFocusRequestState = ::clearFocusRequestState,
|
onClearFocusRequestState = ::clearFocusRequestState,
|
||||||
onJumpToLive = { state.eventSink(TimelineEvents.JumpToLive) },
|
onJumpToLive = { state.eventSink(TimelineEvents.JumpToLive) },
|
||||||
)
|
)
|
||||||
|
|
@ -183,7 +183,7 @@ private fun BoxScope.TimelineScrollHelper(
|
||||||
forceJumpToBottomVisibility: Boolean,
|
forceJumpToBottomVisibility: Boolean,
|
||||||
focusRequestState: FocusRequestState,
|
focusRequestState: FocusRequestState,
|
||||||
onClearFocusRequestState: () -> Unit,
|
onClearFocusRequestState: () -> Unit,
|
||||||
onScrollFinishedAt: (Int) -> Unit,
|
onScrollFinishAt: (Int) -> Unit,
|
||||||
onJumpToLive: () -> Unit,
|
onJumpToLive: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
@ -231,11 +231,11 @@ private fun BoxScope.TimelineScrollHelper(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val latestOnScrollFinishedAt by rememberUpdatedState(onScrollFinishedAt)
|
val latestOnScrollFinishAt by rememberUpdatedState(onScrollFinishAt)
|
||||||
LaunchedEffect(isScrollFinished, hasAnyEvent) {
|
LaunchedEffect(isScrollFinished, hasAnyEvent) {
|
||||||
if (isScrollFinished && hasAnyEvent) {
|
if (isScrollFinished && hasAnyEvent) {
|
||||||
// Notify the parent composable about the first visible item index when scrolling finishes
|
// Notify the parent composable about the first visible item index when scrolling finishes
|
||||||
latestOnScrollFinishedAt(lazyListState.firstVisibleItemIndex)
|
latestOnScrollFinishAt(lazyListState.firstVisibleItemIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,15 +295,15 @@ internal fun TimelineViewPreview(
|
||||||
focusedEventIndex = 0,
|
focusedEventIndex = 0,
|
||||||
),
|
),
|
||||||
typingNotificationState = aTypingNotificationState(),
|
typingNotificationState = aTypingNotificationState(),
|
||||||
onUserDataClicked = {},
|
onUserDataClick = {},
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
onMessageClicked = {},
|
onMessageClick = {},
|
||||||
onMessageLongClicked = {},
|
onMessageLongClick = {},
|
||||||
onTimestampClicked = {},
|
onTimestampClick = {},
|
||||||
onSwipeToReply = {},
|
onSwipeToReply = {},
|
||||||
onReactionClicked = { _, _ -> },
|
onReactionClick = { _, _ -> },
|
||||||
onReactionLongClicked = { _, _ -> },
|
onReactionLongClick = { _, _ -> },
|
||||||
onMoreReactionsClicked = {},
|
onMoreReactionsClick = {},
|
||||||
onReadReceiptClick = {},
|
onReadReceiptClick = {},
|
||||||
forceJumpToBottomVisibility = true,
|
forceJumpToBottomVisibility = true,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,13 @@ internal fun ATimelineItemEventRow(
|
||||||
onClick = {},
|
onClick = {},
|
||||||
onLongClick = {},
|
onLongClick = {},
|
||||||
onUserDataClick = {},
|
onUserDataClick = {},
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
inReplyToClick = {},
|
inReplyToClick = {},
|
||||||
onReactionClick = { _, _ -> },
|
onReactionClick = { _, _ -> },
|
||||||
onReactionLongClick = { _, _ -> },
|
onReactionLongClick = { _, _ -> },
|
||||||
onMoreReactionsClick = {},
|
onMoreReactionsClick = {},
|
||||||
onReadReceiptClick = {},
|
onReadReceiptClick = {},
|
||||||
onSwipeToReply = {},
|
onSwipeToReply = {},
|
||||||
onTimestampClicked = {},
|
onTimestampClick = {},
|
||||||
eventSink = {},
|
eventSink = {},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -127,10 +127,10 @@ fun TimelineItemEventRow(
|
||||||
isHighlighted: Boolean,
|
isHighlighted: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onLongClick: () -> Unit,
|
onLongClick: () -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
inReplyToClick: (EventId) -> Unit,
|
inReplyToClick: (EventId) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onReactionClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
onReactionClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
||||||
onReactionLongClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
onReactionLongClick: (emoji: String, eventId: TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClick: (eventId: TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (eventId: TimelineItem.Event) -> Unit,
|
||||||
|
|
@ -142,11 +142,11 @@ fun TimelineItemEventRow(
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
val interactionSource = remember { MutableInteractionSource() }
|
val interactionSource = remember { MutableInteractionSource() }
|
||||||
|
|
||||||
fun onUserDataClicked() {
|
fun onUserDataClick() {
|
||||||
onUserDataClick(event.senderId)
|
onUserDataClick(event.senderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun inReplyToClicked() {
|
fun inReplyToClick() {
|
||||||
val inReplyToEventId = event.inReplyTo?.eventId() ?: return
|
val inReplyToEventId = event.inReplyTo?.eventId() ?: return
|
||||||
inReplyToClick(inReplyToEventId)
|
inReplyToClick(inReplyToEventId)
|
||||||
}
|
}
|
||||||
|
|
@ -190,13 +190,13 @@ fun TimelineItemEventRow(
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
inReplyToClicked = ::inReplyToClicked,
|
inReplyToClick = ::inReplyToClick,
|
||||||
onUserDataClicked = ::onUserDataClicked,
|
onUserDataClick = ::onUserDataClick,
|
||||||
onReactionClicked = { emoji -> onReactionClick(emoji, event) },
|
onReactionClick = { emoji -> onReactionClick(emoji, event) },
|
||||||
onReactionLongClicked = { emoji -> onReactionLongClick(emoji, event) },
|
onReactionLongClick = { emoji -> onReactionLongClick(emoji, event) },
|
||||||
onMoreReactionsClicked = { onMoreReactionsClick(event) },
|
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -209,13 +209,13 @@ fun TimelineItemEventRow(
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
inReplyToClicked = ::inReplyToClicked,
|
inReplyToClick = ::inReplyToClick,
|
||||||
onUserDataClicked = ::onUserDataClicked,
|
onUserDataClick = ::onUserDataClick,
|
||||||
onReactionClicked = { emoji -> onReactionClick(emoji, event) },
|
onReactionClick = { emoji -> onReactionClick(emoji, event) },
|
||||||
onReactionLongClicked = { emoji -> onReactionLongClick(emoji, event) },
|
onReactionLongClick = { emoji -> onReactionLongClick(emoji, event) },
|
||||||
onMoreReactionsClicked = { onMoreReactionsClick(event) },
|
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +227,7 @@ fun TimelineItemEventRow(
|
||||||
receipts = event.readReceiptState.receipts,
|
receipts = event.readReceiptState.receipts,
|
||||||
),
|
),
|
||||||
renderReadReceipts = renderReadReceipts,
|
renderReadReceipts = renderReadReceipts,
|
||||||
onReadReceiptsClicked = { onReadReceiptClick(event) },
|
onReadReceiptsClick = { onReadReceiptClick(event) },
|
||||||
modifier = Modifier.padding(top = 4.dp),
|
modifier = Modifier.padding(top = 4.dp),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -265,13 +265,13 @@ private fun TimelineItemEventRowContent(
|
||||||
interactionSource: MutableInteractionSource,
|
interactionSource: MutableInteractionSource,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onLongClick: () -> Unit,
|
onLongClick: () -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
inReplyToClicked: () -> Unit,
|
inReplyToClick: () -> Unit,
|
||||||
onUserDataClicked: () -> Unit,
|
onUserDataClick: () -> Unit,
|
||||||
onReactionClicked: (emoji: String) -> Unit,
|
onReactionClick: (emoji: String) -> Unit,
|
||||||
onReactionLongClicked: (emoji: String) -> Unit,
|
onReactionLongClick: (emoji: String) -> Unit,
|
||||||
onMoreReactionsClicked: (event: TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (event: TimelineItem.Event) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
|
@ -306,7 +306,7 @@ private fun TimelineItemEventRowContent(
|
||||||
}
|
}
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
.zIndex(1f)
|
.zIndex(1f)
|
||||||
.clickable(onClick = onUserDataClicked)
|
.clickable(onClick = onUserDataClick)
|
||||||
// This is redundant when using talkback
|
// This is redundant when using talkback
|
||||||
.clearAndSetSemantics {
|
.clearAndSetSemantics {
|
||||||
invisibleToUser()
|
invisibleToUser()
|
||||||
|
|
@ -336,11 +336,11 @@ private fun TimelineItemEventRowContent(
|
||||||
MessageEventBubbleContent(
|
MessageEventBubbleContent(
|
||||||
event = event,
|
event = event,
|
||||||
onMessageLongClick = onLongClick,
|
onMessageLongClick = onLongClick,
|
||||||
inReplyToClick = inReplyToClicked,
|
inReplyToClick = inReplyToClick,
|
||||||
onTimestampClicked = {
|
onTimestampClick = {
|
||||||
onTimestampClicked(event)
|
onTimestampClick(event)
|
||||||
},
|
},
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -351,9 +351,9 @@ private fun TimelineItemEventRowContent(
|
||||||
reactionsState = event.reactionsState,
|
reactionsState = event.reactionsState,
|
||||||
userCanSendReaction = timelineRoomInfo.userHasPermissionToSendReaction,
|
userCanSendReaction = timelineRoomInfo.userHasPermissionToSendReaction,
|
||||||
isOutgoing = event.isMine,
|
isOutgoing = event.isMine,
|
||||||
onReactionClicked = onReactionClicked,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClicked = onReactionLongClicked,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClicked = { onMoreReactionsClicked(event) },
|
onMoreReactionsClick = { onMoreReactionsClick(event) },
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.constrainAs(reactions) {
|
.constrainAs(reactions) {
|
||||||
top.linkTo(message.bottom, margin = (-4).dp)
|
top.linkTo(message.bottom, margin = (-4).dp)
|
||||||
|
|
@ -419,8 +419,8 @@ private fun MessageEventBubbleContent(
|
||||||
event: TimelineItem.Event,
|
event: TimelineItem.Event,
|
||||||
onMessageLongClick: () -> Unit,
|
onMessageLongClick: () -> Unit,
|
||||||
inReplyToClick: () -> Unit,
|
inReplyToClick: () -> Unit,
|
||||||
onTimestampClicked: () -> Unit,
|
onTimestampClick: () -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||||
@SuppressLint("ModifierParameter")
|
@SuppressLint("ModifierParameter")
|
||||||
// need to rename this modifier to prevent linter false positives
|
// need to rename this modifier to prevent linter false positives
|
||||||
|
|
@ -460,7 +460,7 @@ private fun MessageEventBubbleContent(
|
||||||
timestampPosition: TimestampPosition,
|
timestampPosition: TimestampPosition,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
canShrinkContent: Boolean = false,
|
canShrinkContent: Boolean = false,
|
||||||
content: @Composable (onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit) -> Unit,
|
content: @Composable (onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit) -> Unit,
|
||||||
) {
|
) {
|
||||||
when (timestampPosition) {
|
when (timestampPosition) {
|
||||||
TimestampPosition.Overlay ->
|
TimestampPosition.Overlay ->
|
||||||
|
|
@ -468,7 +468,7 @@ private fun MessageEventBubbleContent(
|
||||||
content {}
|
content {}
|
||||||
TimelineEventTimestampView(
|
TimelineEventTimestampView(
|
||||||
event = event,
|
event = event,
|
||||||
onClick = onTimestampClicked,
|
onClick = onTimestampClick,
|
||||||
onLongClick = ::onTimestampLongClick,
|
onLongClick = ::onTimestampLongClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
// Outer padding
|
// Outer padding
|
||||||
|
|
@ -486,11 +486,11 @@ private fun MessageEventBubbleContent(
|
||||||
spacing = (-4).dp,
|
spacing = (-4).dp,
|
||||||
overlayOffset = DpOffset(0.dp, -1.dp),
|
overlayOffset = DpOffset(0.dp, -1.dp),
|
||||||
shrinkContent = canShrinkContent,
|
shrinkContent = canShrinkContent,
|
||||||
content = { content(this::onContentLayoutChanged) },
|
content = { content(this::onContentLayoutChange) },
|
||||||
overlay = {
|
overlay = {
|
||||||
TimelineEventTimestampView(
|
TimelineEventTimestampView(
|
||||||
event = event,
|
event = event,
|
||||||
onClick = onTimestampClicked,
|
onClick = onTimestampClick,
|
||||||
onLongClick = ::onTimestampLongClick,
|
onLongClick = ::onTimestampLongClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||||
|
|
@ -502,7 +502,7 @@ private fun MessageEventBubbleContent(
|
||||||
content {}
|
content {}
|
||||||
TimelineEventTimestampView(
|
TimelineEventTimestampView(
|
||||||
event = event,
|
event = event,
|
||||||
onClick = onTimestampClicked,
|
onClick = onTimestampClick,
|
||||||
onLongClick = ::onTimestampLongClick,
|
onLongClick = ::onTimestampLongClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.End)
|
.align(Alignment.End)
|
||||||
|
|
@ -553,12 +553,12 @@ private fun MessageEventBubbleContent(
|
||||||
timestampPosition = timestampPosition,
|
timestampPosition = timestampPosition,
|
||||||
canShrinkContent = canShrinkContent,
|
canShrinkContent = canShrinkContent,
|
||||||
modifier = timestampLayoutModifier,
|
modifier = timestampLayoutModifier,
|
||||||
) { onContentLayoutChanged ->
|
) { onContentLayoutChange ->
|
||||||
TimelineItemEventContentView(
|
TimelineItemEventContentView(
|
||||||
content = event.content,
|
content = event.content,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = contentModifier
|
modifier = contentModifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ fun TimelineItemGroupedEventsRow(
|
||||||
onLongClick: (TimelineItem.Event) -> Unit,
|
onLongClick: (TimelineItem.Event) -> Unit,
|
||||||
inReplyToClick: (EventId) -> Unit,
|
inReplyToClick: (EventId) -> Unit,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||||
|
|
@ -75,8 +75,8 @@ fun TimelineItemGroupedEventsRow(
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
inReplyToClick = inReplyToClick,
|
inReplyToClick = inReplyToClick,
|
||||||
onUserDataClick = onUserDataClick,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
onReactionClick = onReactionClick,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClick,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClick,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
|
|
@ -99,8 +99,8 @@ private fun TimelineItemGroupedEventsRowContent(
|
||||||
onLongClick: (TimelineItem.Event) -> Unit,
|
onLongClick: (TimelineItem.Event) -> Unit,
|
||||||
inReplyToClick: (EventId) -> Unit,
|
inReplyToClick: (EventId) -> Unit,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
onReactionClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||||
|
|
@ -132,8 +132,8 @@ private fun TimelineItemGroupedEventsRowContent(
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
inReplyToClick = inReplyToClick,
|
inReplyToClick = inReplyToClick,
|
||||||
onUserDataClick = onUserDataClick,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
onReactionClick = onReactionClick,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClick,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClick,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
|
|
@ -151,7 +151,7 @@ private fun TimelineItemGroupedEventsRowContent(
|
||||||
receipts = timelineItem.aggregatedReadReceipts,
|
receipts = timelineItem.aggregatedReadReceipts,
|
||||||
),
|
),
|
||||||
renderReadReceipts = true,
|
renderReadReceipts = true,
|
||||||
onReadReceiptsClicked = onExpandGroupClick
|
onReadReceiptsClick = onExpandGroupClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,8 +173,8 @@ internal fun TimelineItemGroupedEventsRowContentExpandedPreview() = ElementPrevi
|
||||||
onLongClick = {},
|
onLongClick = {},
|
||||||
inReplyToClick = {},
|
inReplyToClick = {},
|
||||||
onUserDataClick = {},
|
onUserDataClick = {},
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
onTimestampClicked = {},
|
onTimestampClick = {},
|
||||||
onReactionClick = { _, _ -> },
|
onReactionClick = { _, _ -> },
|
||||||
onReactionLongClick = { _, _ -> },
|
onReactionLongClick = { _, _ -> },
|
||||||
onMoreReactionsClick = {},
|
onMoreReactionsClick = {},
|
||||||
|
|
@ -198,8 +198,8 @@ internal fun TimelineItemGroupedEventsRowContentCollapsePreview() = ElementPrevi
|
||||||
onLongClick = {},
|
onLongClick = {},
|
||||||
inReplyToClick = {},
|
inReplyToClick = {},
|
||||||
onUserDataClick = {},
|
onUserDataClick = {},
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
onTimestampClicked = {},
|
onTimestampClick = {},
|
||||||
onReactionClick = { _, _ -> },
|
onReactionClick = { _, _ -> },
|
||||||
onReactionLongClick = { _, _ -> },
|
onReactionLongClick = { _, _ -> },
|
||||||
onMoreReactionsClick = {},
|
onMoreReactionsClick = {},
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ fun TimelineItemReactionsView(
|
||||||
reactionsState: TimelineItemReactions,
|
reactionsState: TimelineItemReactions,
|
||||||
isOutgoing: Boolean,
|
isOutgoing: Boolean,
|
||||||
userCanSendReaction: Boolean,
|
userCanSendReaction: Boolean,
|
||||||
onReactionClicked: (emoji: String) -> Unit,
|
onReactionClick: (emoji: String) -> Unit,
|
||||||
onReactionLongClicked: (emoji: String) -> Unit,
|
onReactionLongClick: (emoji: String) -> Unit,
|
||||||
onMoreReactionsClicked: () -> Unit,
|
onMoreReactionsClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
var expanded: Boolean by rememberSaveable { mutableStateOf(false) }
|
var expanded: Boolean by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
@ -54,9 +54,9 @@ fun TimelineItemReactionsView(
|
||||||
userCanSendReaction = userCanSendReaction,
|
userCanSendReaction = userCanSendReaction,
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
isOutgoing = isOutgoing,
|
isOutgoing = isOutgoing,
|
||||||
onReactionClick = onReactionClicked,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClicked,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClicked,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
onToggleExpandClick = { expanded = !expanded },
|
onToggleExpandClick = { expanded = !expanded },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -179,8 +179,8 @@ private fun ContentToPreview(
|
||||||
),
|
),
|
||||||
userCanSendReaction = true,
|
userCanSendReaction = true,
|
||||||
isOutgoing = isOutgoing,
|
isOutgoing = isOutgoing,
|
||||||
onReactionClicked = {},
|
onReactionClick = {},
|
||||||
onReactionLongClicked = {},
|
onReactionLongClick = {},
|
||||||
onMoreReactionsClicked = {},
|
onMoreReactionsClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ internal fun TimelineItemRow(
|
||||||
isLastOutgoingMessage: Boolean,
|
isLastOutgoingMessage: Boolean,
|
||||||
focusedEventId: EventId?,
|
focusedEventId: EventId?,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
onClick: (TimelineItem.Event) -> Unit,
|
onClick: (TimelineItem.Event) -> Unit,
|
||||||
onLongClick: (TimelineItem.Event) -> Unit,
|
onLongClick: (TimelineItem.Event) -> Unit,
|
||||||
inReplyToClick: (EventId) -> Unit,
|
inReplyToClick: (EventId) -> Unit,
|
||||||
|
|
@ -53,7 +53,7 @@ internal fun TimelineItemRow(
|
||||||
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
onReactionLongClick: (key: String, TimelineItem.Event) -> Unit,
|
||||||
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
onMoreReactionsClick: (TimelineItem.Event) -> Unit,
|
||||||
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
onReadReceiptClick: (TimelineItem.Event) -> Unit,
|
||||||
onTimestampClicked: (TimelineItem.Event) -> Unit,
|
onTimestampClick: (TimelineItem.Event) -> Unit,
|
||||||
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
onSwipeToReply: (TimelineItem.Event) -> Unit,
|
||||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
|
|
@ -99,13 +99,13 @@ internal fun TimelineItemRow(
|
||||||
onClick = { onClick(timelineItem) },
|
onClick = { onClick(timelineItem) },
|
||||||
onLongClick = { onLongClick(timelineItem) },
|
onLongClick = { onLongClick(timelineItem) },
|
||||||
onUserDataClick = onUserDataClick,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
inReplyToClick = inReplyToClick,
|
inReplyToClick = inReplyToClick,
|
||||||
onReactionClick = onReactionClick,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClick,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClick,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
onReadReceiptClick = onReadReceiptClick,
|
onReadReceiptClick = onReadReceiptClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
onSwipeToReply = { onSwipeToReply(timelineItem) },
|
onSwipeToReply = { onSwipeToReply(timelineItem) },
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
)
|
)
|
||||||
|
|
@ -122,8 +122,8 @@ internal fun TimelineItemRow(
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
inReplyToClick = inReplyToClick,
|
inReplyToClick = inReplyToClick,
|
||||||
onUserDataClick = onUserDataClick,
|
onUserDataClick = onUserDataClick,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onTimestampClicked = onTimestampClicked,
|
onTimestampClick = onTimestampClick,
|
||||||
onReactionClick = onReactionClick,
|
onReactionClick = onReactionClick,
|
||||||
onReactionLongClick = onReactionLongClick,
|
onReactionLongClick = onReactionLongClick,
|
||||||
onMoreReactionsClick = onMoreReactionsClick,
|
onMoreReactionsClick = onMoreReactionsClick,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ fun TimelineItemStateEventRow(
|
||||||
) {
|
) {
|
||||||
TimelineItemEventContentView(
|
TimelineItemEventContentView(
|
||||||
content = event.content,
|
content = event.content,
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
eventSink = eventSink,
|
eventSink = eventSink,
|
||||||
modifier = Modifier.defaultTimelineContentPadding()
|
modifier = Modifier.defaultTimelineContentPadding()
|
||||||
)
|
)
|
||||||
|
|
@ -92,7 +92,7 @@ fun TimelineItemStateEventRow(
|
||||||
receipts = event.readReceiptState.receipts,
|
receipts = event.readReceiptState.receipts,
|
||||||
),
|
),
|
||||||
renderReadReceipts = renderReadReceipts,
|
renderReadReceipts = renderReadReceipts,
|
||||||
onReadReceiptsClicked = { onReadReceiptsClick(event) },
|
onReadReceiptsClick = { onReadReceiptsClick(event) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import io.element.android.libraries.matrix.api.core.EventId
|
||||||
@Composable
|
@Composable
|
||||||
fun CustomReactionBottomSheet(
|
fun CustomReactionBottomSheet(
|
||||||
state: CustomReactionState,
|
state: CustomReactionState,
|
||||||
onEmojiSelected: (EventId, Emoji) -> Unit,
|
onSelectEmoji: (EventId, Emoji) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val sheetState = rememberModalBottomSheetState()
|
val sheetState = rememberModalBottomSheetState()
|
||||||
|
|
@ -46,7 +46,7 @@ fun CustomReactionBottomSheet(
|
||||||
if (target?.event?.eventId == null) return
|
if (target?.event?.eventId == null) return
|
||||||
sheetState.hide(coroutineScope) {
|
sheetState.hide(coroutineScope) {
|
||||||
state.eventSink(CustomReactionEvents.DismissCustomReactionSheet)
|
state.eventSink(CustomReactionEvents.DismissCustomReactionSheet)
|
||||||
onEmojiSelected(target.event.eventId, emoji)
|
onSelectEmoji(target.event.eventId, emoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ fun CustomReactionBottomSheet(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
) {
|
) {
|
||||||
EmojiPicker(
|
EmojiPicker(
|
||||||
onEmojiSelected = ::onEmojiSelectedDismiss,
|
onSelectEmoji = ::onEmojiSelectedDismiss,
|
||||||
emojibaseStore = target.emojibaseStore,
|
emojibaseStore = target.emojibaseStore,
|
||||||
selectedEmojis = state.selectedEmoji,
|
selectedEmojis = state.selectedEmoji,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
fun EmojiItem(
|
fun EmojiItem(
|
||||||
item: Emoji,
|
item: Emoji,
|
||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
onEmojiSelected: (Emoji) -> Unit,
|
onSelectEmoji: (Emoji) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
emojiSize: TextUnit = 20.sp,
|
emojiSize: TextUnit = 20.sp,
|
||||||
) {
|
) {
|
||||||
|
|
@ -69,7 +69,7 @@ fun EmojiItem(
|
||||||
.background(backgroundColor, CircleShape)
|
.background(backgroundColor, CircleShape)
|
||||||
.clickable(
|
.clickable(
|
||||||
enabled = true,
|
enabled = true,
|
||||||
onClick = { onEmojiSelected(item) },
|
onClick = { onSelectEmoji(item) },
|
||||||
indication = rememberRipple(bounded = false, radius = emojiSize.toDp() / 2 + 10.dp),
|
indication = rememberRipple(bounded = false, radius = emojiSize.toDp() / 2 + 10.dp),
|
||||||
interactionSource = remember { MutableInteractionSource() }
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
)
|
)
|
||||||
|
|
@ -102,7 +102,7 @@ internal fun EmojiItemPreview() = ElementPreview {
|
||||||
skins = null
|
skins = null
|
||||||
),
|
),
|
||||||
isSelected = isSelected,
|
isSelected = isSelected,
|
||||||
onEmojiSelected = {},
|
onSelectEmoji = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ import kotlinx.coroutines.launch
|
||||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun EmojiPicker(
|
fun EmojiPicker(
|
||||||
onEmojiSelected: (Emoji) -> Unit,
|
onSelectEmoji: (Emoji) -> Unit,
|
||||||
emojibaseStore: EmojibaseStore,
|
emojibaseStore: EmojibaseStore,
|
||||||
selectedEmojis: ImmutableSet<String>,
|
selectedEmojis: ImmutableSet<String>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|
@ -99,7 +99,7 @@ fun EmojiPicker(
|
||||||
modifier = Modifier.aspectRatio(1f),
|
modifier = Modifier.aspectRatio(1f),
|
||||||
item = item,
|
item = item,
|
||||||
isSelected = selectedEmojis.contains(item.unicode),
|
isSelected = selectedEmojis.contains(item.unicode),
|
||||||
onEmojiSelected = onEmojiSelected,
|
onSelectEmoji = onSelectEmoji,
|
||||||
emojiSize = 32.dp.toSp(),
|
emojiSize = 32.dp.toSp(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ fun EmojiPicker(
|
||||||
@Composable
|
@Composable
|
||||||
internal fun EmojiPickerPreview() = ElementPreview {
|
internal fun EmojiPickerPreview() = ElementPreview {
|
||||||
EmojiPicker(
|
EmojiPicker(
|
||||||
onEmojiSelected = {},
|
onSelectEmoji = {},
|
||||||
emojibaseStore = EmojibaseDatasource().load(LocalContext.current),
|
emojibaseStore = EmojibaseDatasource().load(LocalContext.current),
|
||||||
selectedEmojis = persistentSetOf("😀", "😄", "😃"),
|
selectedEmojis = persistentSetOf("😀", "😄", "😃"),
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemAudioView(
|
fun TimelineItemAudioView(
|
||||||
content: TimelineItemAudioContent,
|
content: TimelineItemAudioContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val iconSize = 32.dp
|
val iconSize = 32.dp
|
||||||
|
|
@ -85,7 +85,7 @@ fun TimelineItemAudioView(
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
extraWidth = iconSize + spacing
|
extraWidth = iconSize + spacing
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -99,6 +99,6 @@ internal fun TimelineItemAudioViewPreview(@PreviewParameter(TimelineItemAudioCon
|
||||||
ElementPreview {
|
ElementPreview {
|
||||||
TimelineItemAudioView(
|
TimelineItemAudioView(
|
||||||
content,
|
content,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemEncryptedView(
|
fun TimelineItemEncryptedView(
|
||||||
content: TimelineItemEncryptedContent,
|
content: TimelineItemEncryptedContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val isMembershipUtd = (content.data as? UnableToDecryptContent.Data.MegolmV1AesSha2)?.utdCause == UtdCause.Membership
|
val isMembershipUtd = (content.data as? UnableToDecryptContent.Data.MegolmV1AesSha2)?.utdCause == UtdCause.Membership
|
||||||
|
|
@ -46,7 +46,7 @@ fun TimelineItemEncryptedView(
|
||||||
text = stringResource(id = textId),
|
text = stringResource(id = textId),
|
||||||
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
||||||
iconResourceId = iconId,
|
iconResourceId = iconId,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +58,6 @@ internal fun TimelineItemEncryptedViewPreview(
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
TimelineItemEncryptedView(
|
TimelineItemEncryptedView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,32 +43,32 @@ import io.element.android.libraries.architecture.Presenter
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemEventContentView(
|
fun TimelineItemEventContentView(
|
||||||
content: TimelineItemEventContent,
|
content: TimelineItemEventContent,
|
||||||
onLinkClicked: (url: String) -> Unit,
|
onLinkClick: (url: String) -> Unit,
|
||||||
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
eventSink: (TimelineEvents.EventFromTimelineItem) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit = {},
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit = {},
|
||||||
) {
|
) {
|
||||||
val presenterFactories = LocalTimelineItemPresenterFactories.current
|
val presenterFactories = LocalTimelineItemPresenterFactories.current
|
||||||
when (content) {
|
when (content) {
|
||||||
is TimelineItemEncryptedContent -> TimelineItemEncryptedView(
|
is TimelineItemEncryptedContent -> TimelineItemEncryptedView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemRedactedContent -> TimelineItemRedactedView(
|
is TimelineItemRedactedContent -> TimelineItemRedactedView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemTextBasedContent -> TimelineItemTextView(
|
is TimelineItemTextBasedContent -> TimelineItemTextView(
|
||||||
content = content,
|
content = content,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onLinkClicked = onLinkClicked,
|
onLinkClick = onLinkClick,
|
||||||
onContentLayoutChanged = onContentLayoutChanged
|
onContentLayoutChange = onContentLayoutChange
|
||||||
)
|
)
|
||||||
is TimelineItemUnknownContent -> TimelineItemUnknownView(
|
is TimelineItemUnknownContent -> TimelineItemUnknownView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemLocationContent -> TimelineItemLocationView(
|
is TimelineItemLocationContent -> TimelineItemLocationView(
|
||||||
|
|
@ -77,7 +77,7 @@ fun TimelineItemEventContentView(
|
||||||
)
|
)
|
||||||
is TimelineItemImageContent -> TimelineItemImageView(
|
is TimelineItemImageContent -> TimelineItemImageView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
is TimelineItemStickerContent -> TimelineItemStickerView(
|
is TimelineItemStickerContent -> TimelineItemStickerView(
|
||||||
|
|
@ -86,17 +86,17 @@ fun TimelineItemEventContentView(
|
||||||
)
|
)
|
||||||
is TimelineItemVideoContent -> TimelineItemVideoView(
|
is TimelineItemVideoContent -> TimelineItemVideoView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemFileContent -> TimelineItemFileView(
|
is TimelineItemFileContent -> TimelineItemFileView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemAudioContent -> TimelineItemAudioView(
|
is TimelineItemAudioContent -> TimelineItemAudioView(
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
is TimelineItemLegacyCallInviteContent -> TimelineItemLegacyCallInviteView(modifier = modifier)
|
is TimelineItemLegacyCallInviteContent -> TimelineItemLegacyCallInviteView(modifier = modifier)
|
||||||
|
|
@ -114,7 +114,7 @@ fun TimelineItemEventContentView(
|
||||||
TimelineItemVoiceView(
|
TimelineItemVoiceView(
|
||||||
state = presenter.present(),
|
state = presenter.present(),
|
||||||
content = content,
|
content = content,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemFileView(
|
fun TimelineItemFileView(
|
||||||
content: TimelineItemFileContent,
|
content: TimelineItemFileContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val iconSize = 32.dp
|
val iconSize = 32.dp
|
||||||
|
|
@ -86,7 +86,7 @@ fun TimelineItemFileView(
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
extraWidth = iconSize + spacing
|
extraWidth = iconSize + spacing
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -99,6 +99,6 @@ fun TimelineItemFileView(
|
||||||
internal fun TimelineItemFileViewPreview(@PreviewParameter(TimelineItemFileContentProvider::class) content: TimelineItemFileContent) = ElementPreview {
|
internal fun TimelineItemFileViewPreview(@PreviewParameter(TimelineItemFileContentProvider::class) content: TimelineItemFileContent) = ElementPreview {
|
||||||
TimelineItemFileView(
|
TimelineItemFileView(
|
||||||
content,
|
content,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemImageView(
|
fun TimelineItemImageView(
|
||||||
content: TimelineItemImageContent,
|
content: TimelineItemImageContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val description = stringResource(CommonStrings.common_image)
|
val description = stringResource(CommonStrings.common_image)
|
||||||
|
|
@ -115,7 +115,7 @@ fun TimelineItemImageView(
|
||||||
text = caption,
|
text = caption,
|
||||||
style = ElementRichTextEditorStyle.textStyle(),
|
style = ElementRichTextEditorStyle.textStyle(),
|
||||||
releaseOnDetach = false,
|
releaseOnDetach = false,
|
||||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,12 @@ fun TimelineItemInformativeView(
|
||||||
text: String,
|
text: String,
|
||||||
iconDescription: String,
|
iconDescription: String,
|
||||||
@DrawableRes iconResourceId: Int,
|
@DrawableRes iconResourceId: Int,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier.onSizeChanged { size ->
|
modifier = modifier.onSizeChanged { size ->
|
||||||
onContentLayoutChanged(
|
onContentLayoutChange(
|
||||||
ContentAvoidingLayoutData(
|
ContentAvoidingLayoutData(
|
||||||
contentWidth = size.width,
|
contentWidth = size.width,
|
||||||
contentHeight = size.height,
|
contentHeight = size.height,
|
||||||
|
|
@ -78,6 +78,6 @@ internal fun TimelineItemInformativeViewPreview() = ElementPreview {
|
||||||
text = "Info",
|
text = "Info",
|
||||||
iconDescription = "",
|
iconDescription = "",
|
||||||
iconResourceId = CompoundDrawables.ic_compound_delete,
|
iconResourceId = CompoundDrawables.ic_compound_delete,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,16 @@ fun TimelineItemPollView(
|
||||||
eventSink: (TimelineEvents.TimelineItemPollEvents) -> Unit,
|
eventSink: (TimelineEvents.TimelineItemPollEvents) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
fun onAnswerSelected(pollStartId: EventId, answerId: String) {
|
fun onSelectAnswer(pollStartId: EventId, answerId: String) {
|
||||||
eventSink(TimelineEvents.PollAnswerSelected(pollStartId, answerId))
|
eventSink(TimelineEvents.SelectPollAnswer(pollStartId, answerId))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onPollEnd(pollStartId: EventId) {
|
fun onEndPoll(pollStartId: EventId) {
|
||||||
eventSink(TimelineEvents.PollEndClicked(pollStartId))
|
eventSink(TimelineEvents.EndPoll(pollStartId))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onPollEdit(pollStartId: EventId) {
|
fun onEditPoll(pollStartId: EventId) {
|
||||||
eventSink(TimelineEvents.PollEditClicked(pollStartId))
|
eventSink(TimelineEvents.EditPoll(pollStartId))
|
||||||
}
|
}
|
||||||
|
|
||||||
PollContentView(
|
PollContentView(
|
||||||
|
|
@ -54,9 +54,9 @@ fun TimelineItemPollView(
|
||||||
isPollEnded = content.isEnded,
|
isPollEnded = content.isEnded,
|
||||||
isPollEditable = content.isEditable,
|
isPollEditable = content.isEditable,
|
||||||
isMine = content.isMine,
|
isMine = content.isMine,
|
||||||
onAnswerSelected = ::onAnswerSelected,
|
onSelectAnswer = ::onSelectAnswer,
|
||||||
onPollEdit = ::onPollEdit,
|
onEditPoll = ::onEditPoll,
|
||||||
onPollEnd = ::onPollEnd,
|
onEndPoll = ::onEndPoll,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemRedactedView(
|
fun TimelineItemRedactedView(
|
||||||
@Suppress("UNUSED_PARAMETER") content: TimelineItemRedactedContent,
|
@Suppress("UNUSED_PARAMETER") content: TimelineItemRedactedContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
TimelineItemInformativeView(
|
TimelineItemInformativeView(
|
||||||
text = stringResource(id = CommonStrings.common_message_removed),
|
text = stringResource(id = CommonStrings.common_message_removed),
|
||||||
iconDescription = stringResource(id = CommonStrings.common_message_removed),
|
iconDescription = stringResource(id = CommonStrings.common_message_removed),
|
||||||
iconResourceId = CompoundDrawables.ic_compound_delete,
|
iconResourceId = CompoundDrawables.ic_compound_delete,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +46,6 @@ fun TimelineItemRedactedView(
|
||||||
internal fun TimelineItemRedactedViewPreview() = ElementPreview {
|
internal fun TimelineItemRedactedViewPreview() = ElementPreview {
|
||||||
TimelineItemRedactedView(
|
TimelineItemRedactedView(
|
||||||
TimelineItemRedactedContent,
|
TimelineItemRedactedContent,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemTextView(
|
fun TimelineItemTextView(
|
||||||
content: TimelineItemTextBasedContent,
|
content: TimelineItemTextBasedContent,
|
||||||
onLinkClicked: (String) -> Unit,
|
onLinkClick: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit = {},
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit = {},
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalContentColor provides ElementTheme.colors.textPrimary,
|
LocalContentColor provides ElementTheme.colors.textPrimary,
|
||||||
|
|
@ -53,9 +53,9 @@ fun TimelineItemTextView(
|
||||||
Box(modifier.semantics { contentDescription = body.toString() }) {
|
Box(modifier.semantics { contentDescription = body.toString() }) {
|
||||||
EditorStyledText(
|
EditorStyledText(
|
||||||
text = body,
|
text = body,
|
||||||
onLinkClickedListener = onLinkClicked,
|
onLinkClickedListener = onLinkClick,
|
||||||
style = ElementRichTextEditorStyle.textStyle(),
|
style = ElementRichTextEditorStyle.textStyle(),
|
||||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||||
releaseOnDetach = false,
|
releaseOnDetach = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +69,6 @@ internal fun TimelineItemTextViewPreview(
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
TimelineItemTextView(
|
TimelineItemTextView(
|
||||||
content = content,
|
content = content,
|
||||||
onLinkClicked = {},
|
onLinkClick = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemUnknownView(
|
fun TimelineItemUnknownView(
|
||||||
@Suppress("UNUSED_PARAMETER") content: TimelineItemUnknownContent,
|
@Suppress("UNUSED_PARAMETER") content: TimelineItemUnknownContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
TimelineItemInformativeView(
|
TimelineItemInformativeView(
|
||||||
text = stringResource(id = CommonStrings.common_unsupported_event),
|
text = stringResource(id = CommonStrings.common_unsupported_event),
|
||||||
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
iconDescription = stringResource(id = CommonStrings.dialog_title_warning),
|
||||||
iconResourceId = CompoundDrawables.ic_compound_info_solid,
|
iconResourceId = CompoundDrawables.ic_compound_info_solid,
|
||||||
onContentLayoutChanged = onContentLayoutChanged,
|
onContentLayoutChange = onContentLayoutChange,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +46,6 @@ fun TimelineItemUnknownView(
|
||||||
internal fun TimelineItemUnknownViewPreview() = ElementPreview {
|
internal fun TimelineItemUnknownViewPreview() = ElementPreview {
|
||||||
TimelineItemUnknownView(
|
TimelineItemUnknownView(
|
||||||
content = TimelineItemUnknownContent,
|
content = TimelineItemUnknownContent,
|
||||||
onContentLayoutChanged = {},
|
onContentLayoutChange = {},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ import io.element.android.wysiwyg.compose.EditorStyledText
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemVideoView(
|
fun TimelineItemVideoView(
|
||||||
content: TimelineItemVideoContent,
|
content: TimelineItemVideoContent,
|
||||||
onContentLayoutChanged: (ContentAvoidingLayoutData) -> Unit,
|
onContentLayoutChange: (ContentAvoidingLayoutData) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val description = stringResource(CommonStrings.common_image)
|
val description = stringResource(CommonStrings.common_image)
|
||||||
|
|
@ -131,7 +131,7 @@ fun TimelineItemVideoView(
|
||||||
text = caption,
|
text = caption,
|
||||||
style = ElementRichTextEditorStyle.textStyle(),
|
style = ElementRichTextEditorStyle.textStyle(),
|
||||||
releaseOnDetach = false,
|
releaseOnDetach = false,
|
||||||
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChanged = onContentLayoutChanged),
|
onTextLayout = ContentAvoidingLayout.measureLegacyLastTextLine(onContentLayoutChange = onContentLayoutChange),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue