Rename fun in Callback for clarity.
This commit is contained in:
parent
45b5783b23
commit
09a18ad7ca
104 changed files with 658 additions and 664 deletions
|
|
@ -56,8 +56,8 @@ class LoggedInAppScopeFlowNode(
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
), DependencyInjectionGraphOwner {
|
), DependencyInjectionGraphOwner {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenBugReport()
|
fun navigateToBugReport()
|
||||||
fun onAddAccount()
|
fun navigateToAddAccount()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
|
|
@ -81,12 +81,12 @@ class LoggedInAppScopeFlowNode(
|
||||||
|
|
||||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||||
val callback = object : LoggedInFlowNode.Callback {
|
val callback = object : LoggedInFlowNode.Callback {
|
||||||
override fun onOpenBugReport() {
|
override fun navigateToBugReport() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAddAccount() {
|
override fun navigateToAddAccount() {
|
||||||
plugins<Callback>().forEach { it.onAddAccount() }
|
plugins<Callback>().forEach { it.navigateToAddAccount() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return createNode<LoggedInFlowNode>(buildContext, listOf(callback))
|
return createNode<LoggedInFlowNode>(buildContext, listOf(callback))
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,8 @@ class LoggedInFlowNode(
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenBugReport()
|
fun navigateToBugReport()
|
||||||
fun onAddAccount()
|
fun navigateToAddAccount()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val loggedInFlowProcessor = LoggedInEventProcessor(
|
private val loggedInFlowProcessor = LoggedInEventProcessor(
|
||||||
|
|
@ -282,7 +282,7 @@ class LoggedInFlowNode(
|
||||||
data object Ftue : NavTarget
|
data object Ftue : NavTarget
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object RoomDirectorySearch : NavTarget
|
data object RoomDirectory : NavTarget
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class IncomingShare(val intent: Intent) : NavTarget
|
data class IncomingShare(val intent: Intent) : NavTarget
|
||||||
|
|
@ -304,32 +304,32 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.Home -> {
|
NavTarget.Home -> {
|
||||||
val callback = object : HomeEntryPoint.Callback {
|
val callback = object : HomeEntryPoint.Callback {
|
||||||
override fun onRoomClick(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSettingsClick() {
|
override fun navigateToSettings() {
|
||||||
backstack.push(NavTarget.Settings())
|
backstack.push(NavTarget.Settings())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartChatClick() {
|
override fun navigateToCreateRoom() {
|
||||||
backstack.push(NavTarget.CreateRoom)
|
backstack.push(NavTarget.CreateRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSetUpRecoveryClick() {
|
override fun navigateToSetUpRecovery() {
|
||||||
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.Root))
|
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.Root))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSessionConfirmRecoveryKeyClick() {
|
override fun navigateToEnterRecoveryKey() {
|
||||||
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
|
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRoomSettingsClick(roomId: RoomId) {
|
override fun navigateToRoomSettings(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Details))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Details))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportBugClick() {
|
override fun navigateToBugReport() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
homeEntryPoint
|
homeEntryPoint
|
||||||
|
|
@ -339,11 +339,11 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.Room -> {
|
is NavTarget.Room -> {
|
||||||
val joinedRoomCallback = object : JoinedRoomLoadedFlowNode.Callback {
|
val joinedRoomCallback = object : JoinedRoomLoadedFlowNode.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId, serverNames: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, serverNames: List<String>) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), serverNames))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), serverNames))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
||||||
when (data) {
|
when (data) {
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
// Should not happen (handled by MessagesNode)
|
// Should not happen (handled by MessagesNode)
|
||||||
|
|
@ -369,7 +369,7 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenGlobalNotificationSettings() {
|
override fun navigateToGlobalNotificationSettings() {
|
||||||
backstack.push(NavTarget.Settings(PreferencesEntryPoint.InitialTarget.NotificationSettings))
|
backstack.push(NavTarget.Settings(PreferencesEntryPoint.InitialTarget.NotificationSettings))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,7 +384,7 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.UserProfile -> {
|
is NavTarget.UserProfile -> {
|
||||||
val callback = object : UserProfileEntryPoint.Callback {
|
val callback = object : UserProfileEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -395,23 +395,23 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.Settings -> {
|
is NavTarget.Settings -> {
|
||||||
val callback = object : PreferencesEntryPoint.Callback {
|
val callback = object : PreferencesEntryPoint.Callback {
|
||||||
override fun onAddAccount() {
|
override fun navigateToAddAccount() {
|
||||||
plugins<Callback>().forEach { it.onAddAccount() }
|
plugins<Callback>().forEach { it.navigateToAddAccount() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenBugReport() {
|
override fun navigateToBugReport() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSecureBackupClick() {
|
override fun navigateToSecureBackup() {
|
||||||
backstack.push(NavTarget.SecureBackup())
|
backstack.push(NavTarget.SecureBackup())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenRoomNotificationSettings(roomId: RoomId) {
|
override fun navigateToRoomNotificationSettings(roomId: RoomId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.NotificationSettings))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.NotificationSettings))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun navigateTo(roomId: RoomId, eventId: EventId) {
|
override fun navigateToEvent(roomId: RoomId, eventId: EventId) {
|
||||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Root(eventId)))
|
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Root(eventId)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -423,12 +423,12 @@ class LoggedInFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.CreateRoom -> {
|
NavTarget.CreateRoom -> {
|
||||||
val callback = object : StartChatEntryPoint.Callback {
|
val callback = object : StartChatEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
||||||
backstack.replace(NavTarget.Room(roomIdOrAlias = roomIdOrAlias, serverNames = serverNames))
|
backstack.replace(NavTarget.Room(roomIdOrAlias = roomIdOrAlias, serverNames = serverNames))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenRoomDirectory() {
|
override fun navigateToRoomDirectory() {
|
||||||
backstack.push(NavTarget.RoomDirectorySearch)
|
backstack.push(NavTarget.RoomDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,10 +450,10 @@ class LoggedInFlowNode(
|
||||||
NavTarget.Ftue -> {
|
NavTarget.Ftue -> {
|
||||||
ftueEntryPoint.createNode(this, buildContext)
|
ftueEntryPoint.createNode(this, buildContext)
|
||||||
}
|
}
|
||||||
NavTarget.RoomDirectorySearch -> {
|
NavTarget.RoomDirectory -> {
|
||||||
roomDirectoryEntryPoint.nodeBuilder(this, buildContext)
|
roomDirectoryEntryPoint.nodeBuilder(this, buildContext)
|
||||||
.callback(object : RoomDirectoryEntryPoint.Callback {
|
.callback(object : RoomDirectoryEntryPoint.Callback {
|
||||||
override fun onResultClick(roomDescription: RoomDescription) {
|
override fun navigateToRoom(roomDescription: RoomDescription) {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
NavTarget.Room(
|
NavTarget.Room(
|
||||||
roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(),
|
roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(),
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class NotLoggedInFlowNode(
|
||||||
) : NodeInputs
|
) : NodeInputs
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenBugReport()
|
fun navigateToBugReport()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inputs = inputs<Params>()
|
private val inputs = inputs<Params>()
|
||||||
|
|
@ -78,8 +78,8 @@ class NotLoggedInFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : LoginEntryPoint.Callback {
|
val callback = object : LoginEntryPoint.Callback {
|
||||||
override fun onReportProblem() {
|
override fun navigateToBugReport() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loginEntryPoint
|
loginEntryPoint
|
||||||
|
|
|
||||||
|
|
@ -227,11 +227,11 @@ class RootFlowNode(
|
||||||
}
|
}
|
||||||
val inputs = LoggedInAppScopeFlowNode.Inputs(matrixClient)
|
val inputs = LoggedInAppScopeFlowNode.Inputs(matrixClient)
|
||||||
val callback = object : LoggedInAppScopeFlowNode.Callback {
|
val callback = object : LoggedInAppScopeFlowNode.Callback {
|
||||||
override fun onOpenBugReport() {
|
override fun navigateToBugReport() {
|
||||||
backstack.push(NavTarget.BugReport)
|
backstack.push(NavTarget.BugReport)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAddAccount() {
|
override fun navigateToAddAccount() {
|
||||||
backstack.push(NavTarget.NotLoggedInFlow(null))
|
backstack.push(NavTarget.NotLoggedInFlow(null))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -239,7 +239,7 @@ class RootFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.NotLoggedInFlow -> {
|
is NavTarget.NotLoggedInFlow -> {
|
||||||
val callback = object : NotLoggedInFlowNode.Callback {
|
val callback = object : NotLoggedInFlowNode.Callback {
|
||||||
override fun onOpenBugReport() {
|
override fun navigateToBugReport() {
|
||||||
backstack.push(NavTarget.BugReport)
|
backstack.push(NavTarget.BugReport)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +266,7 @@ class RootFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.AccountSelect -> {
|
is NavTarget.AccountSelect -> {
|
||||||
val callback: AccountSelectEntryPoint.Callback = object : AccountSelectEntryPoint.Callback {
|
val callback: AccountSelectEntryPoint.Callback = object : AccountSelectEntryPoint.Callback {
|
||||||
override fun onSelectAccount(sessionId: SessionId) {
|
override fun onAccountSelected(sessionId: SessionId) {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
if (sessionId == navTarget.currentSessionId) {
|
if (sessionId == navTarget.currentSessionId) {
|
||||||
// Ensure that the account selection Node is removed from the backstack
|
// Ensure that the account selection Node is removed from the backstack
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ class JoinedRoomLoadedFlowNode(
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
), DependencyInjectionGraphOwner {
|
), DependencyInjectionGraphOwner {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomId: RoomId, serverNames: List<String>)
|
fun navigateToRoom(roomId: RoomId, serverNames: List<String>)
|
||||||
fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
||||||
fun onOpenGlobalNotificationSettings()
|
fun navigateToGlobalNotificationSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Inputs(
|
data class Inputs(
|
||||||
|
|
@ -123,19 +123,19 @@ class JoinedRoomLoadedFlowNode(
|
||||||
|
|
||||||
private fun createRoomDetailsNode(buildContext: BuildContext, initialTarget: RoomDetailsEntryPoint.InitialTarget): Node {
|
private fun createRoomDetailsNode(buildContext: BuildContext, initialTarget: RoomDetailsEntryPoint.InitialTarget): Node {
|
||||||
val callback = object : RoomDetailsEntryPoint.Callback {
|
val callback = object : RoomDetailsEntryPoint.Callback {
|
||||||
override fun onOpenGlobalNotificationSettings() {
|
override fun navigateToGlobalNotificationSettings() {
|
||||||
callbacks.forEach { it.onOpenGlobalNotificationSettings() }
|
callbacks.forEach { it.navigateToGlobalNotificationSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenRoom(roomId: RoomId, serverNames: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, serverNames: List<String>) {
|
||||||
callbacks.forEach { it.onOpenRoom(roomId, serverNames) }
|
callbacks.forEach { it.navigateToRoom(roomId, serverNames) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
||||||
callbacks.forEach { it.onPermalinkClick(data, pushToBackstack) }
|
callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun forwardEvent(eventId: EventId) {
|
override fun startForwardEventFlow(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId))
|
backstack.push(NavTarget.ForwardEvent(eventId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ class JoinedRoomLoadedFlowNode(
|
||||||
override fun onDone(roomIds: List<RoomId>) {
|
override fun onDone(roomIds: List<RoomId>) {
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
roomIds.singleOrNull()?.let { roomId ->
|
roomIds.singleOrNull()?.let { roomId ->
|
||||||
callbacks.forEach { it.onOpenRoom(roomId, emptyList()) }
|
callbacks.forEach { it.navigateToRoom(roomId, emptyList()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -186,15 +186,15 @@ class JoinedRoomLoadedFlowNode(
|
||||||
|
|
||||||
private fun createSpaceNode(buildContext: BuildContext): Node {
|
private fun createSpaceNode(buildContext: BuildContext): Node {
|
||||||
val callback = object : SpaceEntryPoint.Callback {
|
val callback = object : SpaceEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId, viaParameters: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, viaParameters: List<String>) {
|
||||||
callbacks.forEach { it.onOpenRoom(roomId, viaParameters) }
|
callbacks.forEach { it.navigateToRoom(roomId, viaParameters) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenDetails() {
|
override fun navigateToRoomDetails() {
|
||||||
backstack.push(NavTarget.RoomDetails)
|
backstack.push(NavTarget.RoomDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenMemberList() {
|
override fun navigateToRoomMemberList() {
|
||||||
backstack.push(NavTarget.RoomMemberList)
|
backstack.push(NavTarget.RoomMemberList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -209,24 +209,24 @@ class JoinedRoomLoadedFlowNode(
|
||||||
navTarget: NavTarget.Messages,
|
navTarget: NavTarget.Messages,
|
||||||
): Node {
|
): Node {
|
||||||
val callback = object : MessagesEntryPoint.Callback {
|
val callback = object : MessagesEntryPoint.Callback {
|
||||||
override fun onRoomDetailsClick() {
|
override fun navigateToRoomDetails() {
|
||||||
backstack.push(NavTarget.RoomDetails)
|
backstack.push(NavTarget.RoomDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClick(userId: UserId) {
|
override fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
backstack.push(NavTarget.RoomMemberDetails(userId))
|
backstack.push(NavTarget.RoomMemberDetails(userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
||||||
callbacks.forEach { it.onPermalinkClick(data, pushToBackstack) }
|
callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun forwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId))
|
backstack.push(NavTarget.ForwardEvent(eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openRoom(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
callbacks.forEach { it.onOpenRoom(roomId, emptyList()) }
|
callbacks.forEach { it.navigateToRoom(roomId, emptyList()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val params = MessagesEntryPoint.Params(
|
val params = MessagesEntryPoint.Params(
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ class JoinedRoomLoadedFlowNodeTest {
|
||||||
)
|
)
|
||||||
val roomFlowNodeTestHelper = roomFlowNode.parentNodeTestHelper()
|
val roomFlowNodeTestHelper = roomFlowNode.parentNodeTestHelper()
|
||||||
// WHEN
|
// WHEN
|
||||||
fakeMessagesEntryPoint.callback?.onRoomDetailsClick()
|
fakeMessagesEntryPoint.callback?.navigateToRoomDetails()
|
||||||
// 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)!!
|
||||||
|
|
|
||||||
|
|
@ -82,23 +82,22 @@ class FtueSessionVerificationFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.Root -> {
|
is NavTarget.Root -> {
|
||||||
val callback = object : ChooseSelfVerificationModeNode.Callback {
|
val callback = object : ChooseSelfVerificationModeNode.Callback {
|
||||||
override fun onUseAnotherDevice() {
|
override fun navigateToUseAnotherDevice() {
|
||||||
backstack.push(NavTarget.UseAnotherDevice)
|
backstack.push(NavTarget.UseAnotherDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUseRecoveryKey() {
|
override fun navigateToUseRecoveryKey() {
|
||||||
backstack.push(NavTarget.EnterRecoveryKey)
|
backstack.push(NavTarget.EnterRecoveryKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResetKey() {
|
override fun navigateToResetKey() {
|
||||||
backstack.push(NavTarget.ResetIdentity)
|
backstack.push(NavTarget.ResetIdentity)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLearnMoreAboutEncryption() {
|
override fun navigateToLearnMoreAboutEncryption() {
|
||||||
learnMoreUrl.value = LearnMoreConfig.DEVICE_VERIFICATION_URL
|
learnMoreUrl.value = LearnMoreConfig.DEVICE_VERIFICATION_URL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createNode<ChooseSelfVerificationModeNode>(buildContext, plugins = listOf(callback))
|
createNode<ChooseSelfVerificationModeNode>(buildContext, plugins = listOf(callback))
|
||||||
}
|
}
|
||||||
is NavTarget.UseAnotherDevice -> {
|
is NavTarget.UseAnotherDevice -> {
|
||||||
|
|
@ -116,7 +115,7 @@ class FtueSessionVerificationFlowNode(
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLearnMoreAboutEncryption() {
|
override fun navigateToLearnMoreAboutEncryption() {
|
||||||
// Note that this callback is never called. The "Learn more" link is not displayed
|
// Note that this callback is never called. The "Learn more" link is not displayed
|
||||||
// for the self session interactive verification.
|
// for the self session interactive verification.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,10 @@ class ChooseSelfVerificationModeNode(
|
||||||
private val directLogoutView: DirectLogoutView,
|
private val directLogoutView: DirectLogoutView,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onUseAnotherDevice()
|
fun navigateToUseAnotherDevice()
|
||||||
fun onUseRecoveryKey()
|
fun navigateToUseRecoveryKey()
|
||||||
fun onResetKey()
|
fun navigateToResetKey()
|
||||||
fun onLearnMoreAboutEncryption()
|
fun navigateToLearnMoreAboutEncryption()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callback = plugins<Callback>().first()
|
private val callback = plugins<Callback>().first()
|
||||||
|
|
@ -43,10 +43,10 @@ class ChooseSelfVerificationModeNode(
|
||||||
|
|
||||||
ChooseSelfVerificationModeView(
|
ChooseSelfVerificationModeView(
|
||||||
state = state,
|
state = state,
|
||||||
onUseAnotherDevice = callback::onUseAnotherDevice,
|
onUseAnotherDevice = callback::navigateToUseAnotherDevice,
|
||||||
onUseRecoveryKey = callback::onUseRecoveryKey,
|
onUseRecoveryKey = callback::navigateToUseRecoveryKey,
|
||||||
onResetKey = callback::onResetKey,
|
onResetKey = callback::navigateToResetKey,
|
||||||
onLearnMore = callback::onLearnMoreAboutEncryption,
|
onLearnMore = callback::navigateToLearnMoreAboutEncryption,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ interface HomeEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onRoomClick(roomId: RoomId)
|
fun navigateToRoom(roomId: RoomId)
|
||||||
fun onStartChatClick()
|
fun navigateToCreateRoom()
|
||||||
fun onSettingsClick()
|
fun navigateToSettings()
|
||||||
fun onSetUpRecoveryClick()
|
fun navigateToSetUpRecovery()
|
||||||
fun onSessionConfirmRecoveryKeyClick()
|
fun navigateToEnterRecoveryKey()
|
||||||
fun onRoomSettingsClick(roomId: RoomId)
|
fun navigateToRoomSettings(roomId: RoomId)
|
||||||
fun onReportBugClick()
|
fun navigateToBugReport()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,27 +116,27 @@ class HomeFlowNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRoomClick(roomId: RoomId) {
|
private fun onRoomClick(roomId: RoomId) {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onRoomClick(roomId) }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToRoom(roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenSettings() {
|
private fun onOpenSettings() {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onSettingsClick() }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onStartChatClick() {
|
private fun onStartChatClick() {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onStartChatClick() }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToCreateRoom() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSetUpRecoveryClick() {
|
private fun onSetUpRecoveryClick() {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onSetUpRecoveryClick() }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToSetUpRecovery() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSessionConfirmRecoveryKeyClick() {
|
private fun onSessionConfirmRecoveryKeyClick() {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onSessionConfirmRecoveryKeyClick() }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToEnterRecoveryKey() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRoomSettingsClick(roomId: RoomId) {
|
private fun onRoomSettingsClick(roomId: RoomId) {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onRoomSettingsClick(roomId) }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToRoomSettings(roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onReportRoomClick(roomId: RoomId) {
|
private fun onReportRoomClick(roomId: RoomId) {
|
||||||
|
|
@ -153,7 +153,7 @@ class HomeFlowNode(
|
||||||
inviteFriendsUseCase.execute(activity)
|
inviteFriendsUseCase.execute(activity)
|
||||||
}
|
}
|
||||||
RoomListMenuAction.ReportBug -> {
|
RoomListMenuAction.ReportBug -> {
|
||||||
plugins<HomeEntryPoint.Callback>().forEach { it.onReportBugClick() }
|
plugins<HomeEntryPoint.Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@ class DefaultHomeEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : HomeEntryPoint.Callback {
|
val callback = object : HomeEntryPoint.Callback {
|
||||||
override fun onRoomClick(roomId: RoomId) = lambdaError()
|
override fun navigateToRoom(roomId: RoomId) = lambdaError()
|
||||||
override fun onStartChatClick() = lambdaError()
|
override fun navigateToCreateRoom() = lambdaError()
|
||||||
override fun onSettingsClick() = lambdaError()
|
override fun navigateToSettings() = lambdaError()
|
||||||
override fun onSetUpRecoveryClick() = lambdaError()
|
override fun navigateToSetUpRecovery() = lambdaError()
|
||||||
override fun onSessionConfirmRecoveryKeyClick() = lambdaError()
|
override fun navigateToEnterRecoveryKey() = lambdaError()
|
||||||
override fun onRoomSettingsClick(roomId: RoomId) = lambdaError()
|
override fun navigateToRoomSettings(roomId: RoomId) = lambdaError()
|
||||||
override fun onReportBugClick() = lambdaError()
|
override fun navigateToBugReport() = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class DependenciesFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.LicensesList -> {
|
is NavTarget.LicensesList -> {
|
||||||
val callback = object : DependencyLicensesListNode.Callback {
|
val callback = object : DependencyLicensesListNode.Callback {
|
||||||
override fun onOpenLicense(license: DependencyLicenseItem) {
|
override fun navigateToLicense(license: DependencyLicenseItem) {
|
||||||
backstack.push(NavTarget.LicenseDetails(license))
|
backstack.push(NavTarget.LicenseDetails(license))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@ class DependencyLicensesListNode(
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenLicense(license: DependencyLicenseItem)
|
fun navigateToLicense(license: DependencyLicenseItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenLicense(license: DependencyLicenseItem) {
|
private fun onOpenLicense(license: DependencyLicenseItem) {
|
||||||
plugins<Callback>()
|
plugins<Callback>()
|
||||||
.forEach { it.onOpenLicense(license) }
|
.forEach { it.navigateToLicense(license) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class LockScreenSettingsFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.Settings -> {
|
NavTarget.Settings -> {
|
||||||
val callback = object : LockScreenSettingsNode.Callback {
|
val callback = object : LockScreenSettingsNode.Callback {
|
||||||
override fun onChangePinClick() {
|
override fun navigateToSetupPin() {
|
||||||
backstack.push(NavTarget.SetupPin)
|
backstack.push(NavTarget.SetupPin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@ class LockScreenSettingsNode(
|
||||||
private val presenter: LockScreenSettingsPresenter,
|
private val presenter: LockScreenSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onChangePinClick()
|
fun navigateToSetupPin()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onChangePinClick() {
|
private fun onChangePinClick() {
|
||||||
plugins<Callback>().forEach { it.onChangePinClick() }
|
plugins<Callback>().forEach { it.navigateToSetupPin() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ interface LoginEntryPoint : FeatureEntryPoint {
|
||||||
)
|
)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onReportProblem()
|
fun navigateToBugReport()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
||||||
|
|
|
||||||
|
|
@ -126,13 +126,13 @@ class LoginFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.OnBoarding -> {
|
NavTarget.OnBoarding -> {
|
||||||
val callback = object : OnBoardingNode.Callback {
|
val callback = object : OnBoardingNode.Callback {
|
||||||
override fun onSignUp() {
|
override fun navigateToSignUpFlow() {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
NavTarget.ConfirmAccountProvider(isAccountCreation = true)
|
NavTarget.ConfirmAccountProvider(isAccountCreation = true)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSignIn(mustChooseAccountProvider: Boolean) {
|
override fun navigateToSignInFlow(mustChooseAccountProvider: Boolean) {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
if (mustChooseAccountProvider) {
|
if (mustChooseAccountProvider) {
|
||||||
NavTarget.ChooseAccountProvider
|
NavTarget.ChooseAccountProvider
|
||||||
|
|
@ -142,23 +142,23 @@ class LoginFlowNode(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSignInWithQrCode() {
|
override fun navigateToQrCode() {
|
||||||
backstack.push(NavTarget.QrCode)
|
backstack.push(NavTarget.QrCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportProblem() {
|
override fun navigateToBugReport() {
|
||||||
plugins<LoginEntryPoint.Callback>().forEach { it.onReportProblem() }
|
plugins<LoginEntryPoint.Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOidcDetails(oidcDetails: OidcDetails) {
|
override fun navigateToOidc(oidcDetails: OidcDetails) {
|
||||||
navigateToMas(oidcDetails)
|
navigateToMas(oidcDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateAccountContinue(url: String) {
|
override fun navigateToCreateAccount(url: String) {
|
||||||
backstack.push(NavTarget.CreateAccount(url))
|
backstack.push(NavTarget.CreateAccount(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLoginPasswordNeeded() {
|
override fun navigateToLoginPassword() {
|
||||||
backstack.push(NavTarget.LoginPassword)
|
backstack.push(NavTarget.LoginPassword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -171,15 +171,15 @@ class LoginFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.ChooseAccountProvider -> {
|
NavTarget.ChooseAccountProvider -> {
|
||||||
val callback = object : ChooseAccountProviderNode.Callback {
|
val callback = object : ChooseAccountProviderNode.Callback {
|
||||||
override fun onOidcDetails(oidcDetails: OidcDetails) {
|
override fun navigateToOidc(oidcDetails: OidcDetails) {
|
||||||
navigateToMas(oidcDetails)
|
navigateToMas(oidcDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateAccountContinue(url: String) {
|
override fun navigateToCreateAccount(url: String) {
|
||||||
backstack.push(NavTarget.CreateAccount(url))
|
backstack.push(NavTarget.CreateAccount(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLoginPasswordNeeded() {
|
override fun navigateToLoginPassword() {
|
||||||
backstack.push(NavTarget.LoginPassword)
|
backstack.push(NavTarget.LoginPassword)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,19 +193,19 @@ class LoginFlowNode(
|
||||||
isAccountCreation = navTarget.isAccountCreation,
|
isAccountCreation = navTarget.isAccountCreation,
|
||||||
)
|
)
|
||||||
val callback = object : ConfirmAccountProviderNode.Callback {
|
val callback = object : ConfirmAccountProviderNode.Callback {
|
||||||
override fun onOidcDetails(oidcDetails: OidcDetails) {
|
override fun navigateToOidc(oidcDetails: OidcDetails) {
|
||||||
navigateToMas(oidcDetails)
|
navigateToMas(oidcDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateAccountContinue(url: String) {
|
override fun navigateToCreateAccount(url: String) {
|
||||||
backstack.push(NavTarget.CreateAccount(url))
|
backstack.push(NavTarget.CreateAccount(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLoginPasswordNeeded() {
|
override fun navigateToLoginPassword() {
|
||||||
backstack.push(NavTarget.LoginPassword)
|
backstack.push(NavTarget.LoginPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChangeAccountProvider() {
|
override fun navigateToChangeAccountProvider() {
|
||||||
backstack.push(NavTarget.ChangeAccountProvider)
|
backstack.push(NavTarget.ChangeAccountProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +221,7 @@ class LoginFlowNode(
|
||||||
backstack.singleTop(confirmAccountProvider)
|
backstack.singleTop(confirmAccountProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOtherClick() {
|
override fun navigateToSearchAccountProvider() {
|
||||||
backstack.push(NavTarget.SearchAccountProvider)
|
backstack.push(NavTarget.SearchAccountProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,11 +147,11 @@ class QrCodeLoginFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.Initial -> {
|
is NavTarget.Initial -> {
|
||||||
val callback = object : QrCodeIntroNode.Callback {
|
val callback = object : QrCodeIntroNode.Callback {
|
||||||
override fun onCancelClicked() {
|
override fun cancel() {
|
||||||
navigateUp()
|
navigateUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onContinue() {
|
override fun navigateToQrCodeScan() {
|
||||||
backstack.push(NavTarget.QrCodeScan)
|
backstack.push(NavTarget.QrCodeScan)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,11 +159,11 @@ class QrCodeLoginFlowNode(
|
||||||
}
|
}
|
||||||
is NavTarget.QrCodeScan -> {
|
is NavTarget.QrCodeScan -> {
|
||||||
val callback = object : QrCodeScanNode.Callback {
|
val callback = object : QrCodeScanNode.Callback {
|
||||||
override fun onScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) {
|
override fun handleScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) {
|
||||||
lifecycleScope.startAuthentication(qrCodeLoginData)
|
lifecycleScope.startAuthentication(qrCodeLoginData)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCancelClicked() {
|
override fun cancel() {
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class ChangeAccountProviderNode(
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun onOtherClick()
|
fun navigateToSearchAccountProvider()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onDone() {
|
private fun onDone() {
|
||||||
|
|
@ -37,7 +37,7 @@ class ChangeAccountProviderNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOtherClick() {
|
private fun onOtherClick() {
|
||||||
plugins<Callback>().forEach { it.onOtherClick() }
|
plugins<Callback>().forEach { it.navigateToSearchAccountProvider() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -29,21 +29,21 @@ class ChooseAccountProviderNode(
|
||||||
private val presenter: ChooseAccountProviderPresenter,
|
private val presenter: ChooseAccountProviderPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onLoginPasswordNeeded()
|
fun navigateToLoginPassword()
|
||||||
fun onOidcDetails(oidcDetails: OidcDetails)
|
fun navigateToOidc(oidcDetails: OidcDetails)
|
||||||
fun onCreateAccountContinue(url: String)
|
fun navigateToCreateAccount(url: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOidcDetails(oidcDetails: OidcDetails) {
|
private fun onOidcDetails(oidcDetails: OidcDetails) {
|
||||||
plugins<Callback>().forEach { it.onOidcDetails(oidcDetails) }
|
plugins<Callback>().forEach { it.navigateToOidc(oidcDetails) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLoginPasswordNeeded() {
|
private fun onLoginPasswordNeeded() {
|
||||||
plugins<Callback>().forEach { it.onLoginPasswordNeeded() }
|
plugins<Callback>().forEach { it.navigateToLoginPassword() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreateAccountContinue(url: String) {
|
private fun onCreateAccountContinue(url: String) {
|
||||||
plugins<Callback>().forEach { it.onCreateAccountContinue(url) }
|
plugins<Callback>().forEach { it.navigateToCreateAccount(url) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -42,26 +42,26 @@ class ConfirmAccountProviderNode(
|
||||||
)
|
)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onLoginPasswordNeeded()
|
fun navigateToLoginPassword()
|
||||||
fun onOidcDetails(oidcDetails: OidcDetails)
|
fun navigateToOidc(oidcDetails: OidcDetails)
|
||||||
fun onCreateAccountContinue(url: String)
|
fun navigateToCreateAccount(url: String)
|
||||||
fun onChangeAccountProvider()
|
fun navigateToChangeAccountProvider()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOidcDetails(data: OidcDetails) {
|
private fun onOidcDetails(data: OidcDetails) {
|
||||||
plugins<Callback>().forEach { it.onOidcDetails(data) }
|
plugins<Callback>().forEach { it.navigateToOidc(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLoginPasswordNeeded() {
|
private fun onLoginPasswordNeeded() {
|
||||||
plugins<Callback>().forEach { it.onLoginPasswordNeeded() }
|
plugins<Callback>().forEach { it.navigateToLoginPassword() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreateAccountContinue(url: String) {
|
private fun onCreateAccountContinue(url: String) {
|
||||||
plugins<Callback>().forEach { it.onCreateAccountContinue(url) }
|
plugins<Callback>().forEach { it.navigateToCreateAccount(url) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onChangeAccountProvider() {
|
private fun onChangeAccountProvider() {
|
||||||
plugins<Callback>().forEach { it.onChangeAccountProvider() }
|
plugins<Callback>().forEach { it.navigateToChangeAccountProvider() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ class OnBoardingNode(
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onSignUp()
|
fun navigateToSignUpFlow()
|
||||||
fun onSignIn(mustChooseAccountProvider: Boolean)
|
fun navigateToSignInFlow(mustChooseAccountProvider: Boolean)
|
||||||
fun onSignInWithQrCode()
|
fun navigateToQrCode()
|
||||||
fun onReportProblem()
|
fun navigateToBugReport()
|
||||||
fun onLoginPasswordNeeded()
|
fun navigateToLoginPassword()
|
||||||
fun onOidcDetails(oidcDetails: OidcDetails)
|
fun navigateToOidc(oidcDetails: OidcDetails)
|
||||||
fun onCreateAccountContinue(url: String)
|
fun navigateToCreateAccount(url: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Params(
|
data class Params(
|
||||||
|
|
@ -55,31 +55,31 @@ class OnBoardingNode(
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun onSignIn(mustChooseAccountProvider: Boolean) {
|
private fun onSignIn(mustChooseAccountProvider: Boolean) {
|
||||||
plugins<Callback>().forEach { it.onSignIn(mustChooseAccountProvider) }
|
plugins<Callback>().forEach { it.navigateToSignInFlow(mustChooseAccountProvider) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSignUp() {
|
private fun onSignUp() {
|
||||||
plugins<Callback>().forEach { it.onSignUp() }
|
plugins<Callback>().forEach { it.navigateToSignUpFlow() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSignInWithQrCode() {
|
private fun onSignInWithQrCode() {
|
||||||
plugins<Callback>().forEach { it.onSignInWithQrCode() }
|
plugins<Callback>().forEach { it.navigateToQrCode() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onReportProblem() {
|
private fun onReportProblem() {
|
||||||
plugins<Callback>().forEach { it.onReportProblem() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOidcDetails(data: OidcDetails) {
|
private fun onOidcDetails(data: OidcDetails) {
|
||||||
plugins<Callback>().forEach { it.onOidcDetails(data) }
|
plugins<Callback>().forEach { it.navigateToOidc(data) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLoginPasswordNeeded() {
|
private fun onLoginPasswordNeeded() {
|
||||||
plugins<Callback>().forEach { it.onLoginPasswordNeeded() }
|
plugins<Callback>().forEach { it.navigateToLoginPassword() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreateAccountContinue(url: String) {
|
private fun onCreateAccountContinue(url: String) {
|
||||||
plugins<Callback>().forEach { it.onCreateAccountContinue(url) }
|
plugins<Callback>().forEach { it.navigateToCreateAccount(url) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,16 @@ class QrCodeIntroNode(
|
||||||
private val presenter: QrCodeIntroPresenter,
|
private val presenter: QrCodeIntroPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onCancelClicked()
|
fun cancel()
|
||||||
fun onContinue()
|
fun navigateToQrCodeScan()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCancelClicked() {
|
private fun onCancelClicked() {
|
||||||
plugins<Callback>().forEach { it.onCancelClicked() }
|
plugins<Callback>().forEach { it.cancel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onContinue() {
|
private fun onContinue() {
|
||||||
plugins<Callback>().forEach { it.onContinue() }
|
plugins<Callback>().forEach { it.navigateToQrCodeScan() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,16 @@ class QrCodeScanNode(
|
||||||
private val presenter: QrCodeScanPresenter,
|
private val presenter: QrCodeScanPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onScannedCode(qrCodeLoginData: MatrixQrCodeLoginData)
|
fun handleScannedCode(qrCodeLoginData: MatrixQrCodeLoginData)
|
||||||
fun onCancelClicked()
|
fun cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onQrCodeDataReady(qrCodeLoginData: MatrixQrCodeLoginData) {
|
private fun onQrCodeDataReady(qrCodeLoginData: MatrixQrCodeLoginData) {
|
||||||
plugins<Callback>().forEach { it.onScannedCode(qrCodeLoginData) }
|
plugins<Callback>().forEach { it.handleScannedCode(qrCodeLoginData) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCancelClicked() {
|
private fun onCancelClicked() {
|
||||||
plugins<Callback>().forEach { it.onCancelClicked() }
|
plugins<Callback>().forEach { it.cancel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class DefaultLoginEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : LoginEntryPoint.Callback {
|
val callback = object : LoginEntryPoint.Callback {
|
||||||
override fun onReportProblem() = lambdaError()
|
override fun navigateToBugReport() = lambdaError()
|
||||||
}
|
}
|
||||||
val params = LoginEntryPoint.Params(
|
val params = LoginEntryPoint.Params(
|
||||||
accountProvider = "ac",
|
accountProvider = "ac",
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ interface LogoutEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onChangeRecoveryKeyClick()
|
fun navigateToSecureBackup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class LogoutNode(
|
||||||
private val presenter: LogoutPresenter,
|
private val presenter: LogoutPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
private fun onChangeRecoveryKeyClick() {
|
private fun onChangeRecoveryKeyClick() {
|
||||||
plugins<LogoutEntryPoint.Callback>().forEach { it.onChangeRecoveryKeyClick() }
|
plugins<LogoutEntryPoint.Callback>().forEach { it.navigateToSecureBackup() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class DefaultLogoutEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : LogoutEntryPoint.Callback {
|
val callback = object : LogoutEntryPoint.Callback {
|
||||||
override fun onChangeRecoveryKeyClick() = lambdaError()
|
override fun navigateToSecureBackup() = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ interface MessagesEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onRoomDetailsClick()
|
fun navigateToRoomDetails()
|
||||||
fun onUserDataClick(userId: UserId)
|
fun navigateToRoomMemberDetails(userId: UserId)
|
||||||
fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
||||||
fun forwardEvent(eventId: EventId)
|
fun forwardEvent(eventId: EventId)
|
||||||
fun openRoom(roomId: RoomId)
|
fun navigateToRoom(roomId: RoomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Params(val initialTarget: InitialTarget) : NodeInputs
|
data class Params(val initialTarget: InitialTarget) : NodeInputs
|
||||||
|
|
|
||||||
|
|
@ -220,18 +220,18 @@ class MessagesFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
is NavTarget.Messages -> {
|
is NavTarget.Messages -> {
|
||||||
val callback = object : MessagesNode.Callback {
|
val callback = object : MessagesNode.Callback {
|
||||||
override fun onRoomDetailsClick() {
|
override fun navigateToRoomDetails() {
|
||||||
callbacks.forEach { it.onRoomDetailsClick() }
|
callbacks.forEach { it.navigateToRoomDetails() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
override fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
||||||
return processEventClick(
|
return processEventClick(
|
||||||
timelineMode = timelineMode,
|
timelineMode = timelineMode,
|
||||||
event = event,
|
event = event,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
override fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
NavTarget.AttachmentPreview(
|
NavTarget.AttachmentPreview(
|
||||||
attachment = attachments.first(),
|
attachment = attachments.first(),
|
||||||
|
|
@ -241,39 +241,39 @@ class MessagesFlowNode(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClick(userId: UserId) {
|
override fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
callbacks.forEach { it.onUserDataClick(userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData) {
|
override fun handlePermalinkClick(data: PermalinkData) {
|
||||||
callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = true) }
|
callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack = true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId, fromPinnedEvents = false))
|
backstack.push(NavTarget.ForwardEvent(eventId, fromPinnedEvents = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportMessage(eventId: EventId, senderId: UserId) {
|
override fun navigateToReportMessage(eventId: EventId, senderId: UserId) {
|
||||||
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSendLocationClick() {
|
override fun navigateToSendLocation() {
|
||||||
backstack.push(NavTarget.SendLocation(Timeline.Mode.Live))
|
backstack.push(NavTarget.SendLocation(Timeline.Mode.Live))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreatePollClick() {
|
override fun navigateToCreatePoll() {
|
||||||
backstack.push(NavTarget.CreatePoll(Timeline.Mode.Live))
|
backstack.push(NavTarget.CreatePoll(Timeline.Mode.Live))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClick(eventId: EventId) {
|
override fun navigateToEditPoll(eventId: EventId) {
|
||||||
backstack.push(NavTarget.EditPoll(Timeline.Mode.Live, eventId))
|
backstack.push(NavTarget.EditPoll(Timeline.Mode.Live, eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onJoinCallClick(roomId: RoomId) {
|
override fun navigateToRoomCall(roomId: RoomId) {
|
||||||
val callType = CallType.RoomCall(
|
val callType = CallType.RoomCall(
|
||||||
sessionId = sessionId,
|
sessionId = sessionId,
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
|
|
@ -282,15 +282,15 @@ class MessagesFlowNode(
|
||||||
elementCallEntryPoint.startCall(callType)
|
elementCallEntryPoint.startCall(callType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewAllPinnedEvents() {
|
override fun navigateToPinnedMessagesList() {
|
||||||
backstack.push(NavTarget.PinnedMessagesList)
|
backstack.push(NavTarget.PinnedMessagesList)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewKnockRequests() {
|
override fun navigateToKnockRequestsList() {
|
||||||
backstack.push(NavTarget.KnockRequestsList)
|
backstack.push(NavTarget.KnockRequestsList)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
||||||
backstack.push(NavTarget.Thread(threadRootId, focusedEventId))
|
backstack.push(NavTarget.Thread(threadRootId, focusedEventId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -311,13 +311,13 @@ class MessagesFlowNode(
|
||||||
overlay.hide()
|
overlay.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
viewInTimeline(eventId)
|
this@MessagesFlowNode.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
// Need to go to the parent because of the overlay
|
// Need to go to the parent because of the overlay
|
||||||
forwardEvent(eventId)
|
callbacks.forEach { it.forwardEvent(eventId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mediaViewerEntryPoint.nodeBuilder(this, buildContext)
|
mediaViewerEntryPoint.nodeBuilder(this, buildContext)
|
||||||
|
|
@ -352,7 +352,7 @@ class MessagesFlowNode(
|
||||||
override fun onDone(roomIds: List<RoomId>) {
|
override fun onDone(roomIds: List<RoomId>) {
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
roomIds.singleOrNull()?.let { roomId ->
|
roomIds.singleOrNull()?.let { roomId ->
|
||||||
callbacks.forEach { it.openRoom(roomId) }
|
callbacks.forEach { it.navigateToRoom(roomId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -392,30 +392,30 @@ class MessagesFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.PinnedMessagesList -> {
|
NavTarget.PinnedMessagesList -> {
|
||||||
val callback = object : PinnedMessagesListNode.Callback {
|
val callback = object : PinnedMessagesListNode.Callback {
|
||||||
override fun onEventClick(event: TimelineItem.Event) {
|
override fun handleEventClick(event: TimelineItem.Event) {
|
||||||
processEventClick(
|
processEventClick(
|
||||||
timelineMode = Timeline.Mode.PinnedEvents,
|
timelineMode = Timeline.Mode.PinnedEvents,
|
||||||
event = event,
|
event = event,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClick(userId: UserId) {
|
override fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
callbacks.forEach { it.onUserDataClick(userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimelineClick(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
viewInTimeline(eventId)
|
this@MessagesFlowNode.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRoomPermalinkClick(data: PermalinkData.RoomLink) {
|
override fun handlePermalinkClick(data: PermalinkData.RoomLink) {
|
||||||
callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = !room.matches(data.roomIdOrAlias)) }
|
callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack = !room.matches(data.roomIdOrAlias)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun handleForwardEventClick(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId = eventId, fromPinnedEvents = true))
|
backstack.push(NavTarget.ForwardEvent(eventId = eventId, fromPinnedEvents = true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -430,14 +430,14 @@ class MessagesFlowNode(
|
||||||
focusedEventId = navTarget.focusedEventId,
|
focusedEventId = navTarget.focusedEventId,
|
||||||
)
|
)
|
||||||
val callback = object : ThreadedMessagesNode.Callback {
|
val callback = object : ThreadedMessagesNode.Callback {
|
||||||
override fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
override fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
||||||
return processEventClick(
|
return processEventClick(
|
||||||
timelineMode = timelineMode,
|
timelineMode = timelineMode,
|
||||||
event = event,
|
event = event,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
override fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
||||||
backstack.push(
|
backstack.push(
|
||||||
NavTarget.AttachmentPreview(
|
NavTarget.AttachmentPreview(
|
||||||
attachment = attachments.first(),
|
attachment = attachments.first(),
|
||||||
|
|
@ -447,39 +447,39 @@ class MessagesFlowNode(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUserDataClick(userId: UserId) {
|
override fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
callbacks.forEach { it.onUserDataClick(userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData) {
|
override fun handlePermalinkClick(data: PermalinkData) {
|
||||||
callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = true) }
|
callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack = true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
backstack.push(NavTarget.EventDebugInfo(eventId, debugInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun handleForwardEventClick(eventId: EventId) {
|
||||||
backstack.push(NavTarget.ForwardEvent(eventId, fromPinnedEvents = false))
|
backstack.push(NavTarget.ForwardEvent(eventId, fromPinnedEvents = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportMessage(eventId: EventId, senderId: UserId) {
|
override fun navigateToReportMessage(eventId: EventId, senderId: UserId) {
|
||||||
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
backstack.push(NavTarget.ReportMessage(eventId, senderId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSendLocationClick() {
|
override fun navigateToSendLocation() {
|
||||||
backstack.push(NavTarget.SendLocation(Timeline.Mode.Thread(navTarget.threadRootId)))
|
backstack.push(NavTarget.SendLocation(Timeline.Mode.Thread(navTarget.threadRootId)))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreatePollClick() {
|
override fun navigateToCreatePoll() {
|
||||||
backstack.push(NavTarget.CreatePoll(Timeline.Mode.Thread(navTarget.threadRootId)))
|
backstack.push(NavTarget.CreatePoll(Timeline.Mode.Thread(navTarget.threadRootId)))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClick(eventId: EventId) {
|
override fun navigateToEditPoll(eventId: EventId) {
|
||||||
backstack.push(NavTarget.EditPoll(Timeline.Mode.Thread(navTarget.threadRootId), eventId))
|
backstack.push(NavTarget.EditPoll(Timeline.Mode.Thread(navTarget.threadRootId), eventId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onJoinCallClick(roomId: RoomId) {
|
override fun navigateToRoomCall(roomId: RoomId) {
|
||||||
val callType = CallType.RoomCall(
|
val callType = CallType.RoomCall(
|
||||||
sessionId = sessionId,
|
sessionId = sessionId,
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
|
|
@ -488,7 +488,7 @@ class MessagesFlowNode(
|
||||||
elementCallEntryPoint.startCall(callType)
|
elementCallEntryPoint.startCall(callType)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
||||||
backstack.push(NavTarget.Thread(threadRootId, focusedEventId))
|
backstack.push(NavTarget.Thread(threadRootId, focusedEventId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -502,11 +502,7 @@ class MessagesFlowNode(
|
||||||
roomIdOrAlias = room.roomId.toRoomIdOrAlias(),
|
roomIdOrAlias = room.roomId.toRoomIdOrAlias(),
|
||||||
eventId = eventId,
|
eventId = eventId,
|
||||||
)
|
)
|
||||||
callbacks.forEach { it.onPermalinkClick(permalinkData, pushToBackstack = false) }
|
callbacks.forEach { it.handlePermalinkClick(permalinkData, pushToBackstack = false) }
|
||||||
}
|
|
||||||
|
|
||||||
private fun forwardEvent(eventId: EventId) {
|
|
||||||
callbacks.forEach { it.forwardEvent(eventId) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processEventClick(
|
private fun processEventClick(
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@ import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugIn
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
|
||||||
interface MessagesNavigator {
|
interface MessagesNavigator {
|
||||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClick(eventId: EventId)
|
fun forwardEvent(eventId: EventId)
|
||||||
fun onReportContentClick(eventId: EventId, senderId: UserId)
|
fun navigateToReportMessage(eventId: EventId, senderId: UserId)
|
||||||
fun onEditPollClick(eventId: EventId)
|
fun navigateToEditPoll(eventId: EventId)
|
||||||
fun onPreviewAttachment(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
||||||
fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>)
|
fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>)
|
||||||
fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
||||||
fun onNavigateUp()
|
fun onNavigateUp()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,21 +114,21 @@ class MessagesNode(
|
||||||
)
|
)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean
|
fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean
|
||||||
fun onPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
||||||
fun onUserDataClick(userId: UserId)
|
fun navigateToRoomMemberDetails(userId: UserId)
|
||||||
fun onPermalinkClick(data: PermalinkData)
|
fun handlePermalinkClick(data: PermalinkData)
|
||||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClick(eventId: EventId)
|
fun forwardEvent(eventId: EventId)
|
||||||
fun onReportMessage(eventId: EventId, senderId: UserId)
|
fun navigateToReportMessage(eventId: EventId, senderId: UserId)
|
||||||
fun onSendLocationClick()
|
fun navigateToSendLocation()
|
||||||
fun onCreatePollClick()
|
fun navigateToCreatePoll()
|
||||||
fun onEditPollClick(eventId: EventId)
|
fun navigateToEditPoll(eventId: EventId)
|
||||||
fun onJoinCallClick(roomId: RoomId)
|
fun navigateToRoomCall(roomId: RoomId)
|
||||||
fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
||||||
fun onRoomDetailsClick()
|
fun navigateToRoomDetails()
|
||||||
fun onViewAllPinnedEvents()
|
fun navigateToPinnedMessagesList()
|
||||||
fun onViewKnockRequests()
|
fun navigateToKnockRequestsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
|
|
@ -143,16 +143,16 @@ class MessagesNode(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRoomDetailsClick() {
|
private fun navigateToRoomDetails() {
|
||||||
callbacks.forEach { it.onRoomDetailsClick() }
|
callbacks.forEach { it.navigateToRoomDetails() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onViewAllPinnedMessagesClick() {
|
private fun navigateToPinnedMessagesList() {
|
||||||
callbacks.forEach { it.onViewAllPinnedEvents() }
|
callbacks.forEach { it.navigateToPinnedMessagesList() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onViewKnockRequestsClick() {
|
private fun navigateToKnockRequestsList() {
|
||||||
callbacks.forEach { it.onViewKnockRequests() }
|
callbacks.forEach { it.navigateToKnockRequestsList() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
private fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean {
|
||||||
|
|
@ -160,13 +160,13 @@ class MessagesNode(
|
||||||
// - if callbacks is empty, it will return true and we want to return false.
|
// - if callbacks is empty, it will return true and we want to return false.
|
||||||
// - if a callback returns false, the other callback will not be invoked.
|
// - if a callback returns false, the other callback will not be invoked.
|
||||||
return callbacks.takeIf { it.isNotEmpty() }
|
return callbacks.takeIf { it.isNotEmpty() }
|
||||||
?.map { it.onEventClick(timelineMode, event) }
|
?.map { it.handleEventClick(timelineMode, event) }
|
||||||
?.all { it }
|
?.all { it }
|
||||||
.orFalse()
|
.orFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUserDataClick(userId: UserId) {
|
private fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
callbacks.forEach { it.onUserDataClick(userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLinkClick(
|
private fun onLinkClick(
|
||||||
|
|
@ -180,7 +180,7 @@ class MessagesNode(
|
||||||
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
|
||||||
callbacks.forEach { it.onUserDataClick(permalink.userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(permalink.userId) }
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
handleRoomLinkClick(permalink, eventSink)
|
handleRoomLinkClick(permalink, eventSink)
|
||||||
|
|
@ -211,53 +211,53 @@ class MessagesNode(
|
||||||
displaySameRoomToast()
|
displaySameRoomToast()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callbacks.forEach { it.onPermalinkClick(roomLink) }
|
callbacks.forEach { it.handlePermalinkClick(roomLink) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) }
|
callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
callbacks.forEach { it.onForwardEventClick(eventId) }
|
callbacks.forEach { it.forwardEvent(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
override fun navigateToReportMessage(eventId: EventId, senderId: UserId) {
|
||||||
callbacks.forEach { it.onReportMessage(eventId, senderId) }
|
callbacks.forEach { it.navigateToReportMessage(eventId, senderId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClick(eventId: EventId) {
|
override fun navigateToEditPoll(eventId: EventId) {
|
||||||
callbacks.forEach { it.onEditPollClick(eventId) }
|
callbacks.forEach { it.navigateToEditPoll(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachment(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
override fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
||||||
callbacks.forEach { it.onPreviewAttachments(attachments, inReplyToEventId) }
|
callbacks.forEach { it.navigateToPreviewAttachments(attachments, inReplyToEventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
||||||
if (roomId == room.roomId) {
|
if (roomId == room.roomId) {
|
||||||
displaySameRoomToast()
|
displaySameRoomToast()
|
||||||
} else {
|
} else {
|
||||||
val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias(), eventId, viaParameters = serverNames.toImmutableList())
|
val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias(), eventId, viaParameters = serverNames.toImmutableList())
|
||||||
callbacks.forEach { it.onPermalinkClick(permalinkData) }
|
callbacks.forEach { it.handlePermalinkClick(permalinkData) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
||||||
callbacks.forEach { it.onOpenThread(threadRootId, focusedEventId) }
|
callbacks.forEach { it.navigateToThread(threadRootId, focusedEventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSendLocationClick() {
|
private fun navigateToSendLocation() {
|
||||||
callbacks.forEach { it.onSendLocationClick() }
|
callbacks.forEach { it.navigateToSendLocation() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreatePollClick() {
|
private fun navigateToCreatePoll() {
|
||||||
callbacks.forEach { it.onCreatePollClick() }
|
callbacks.forEach { it.navigateToCreatePoll() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onJoinCallClick() {
|
private fun navigateToRoomCall() {
|
||||||
callbacks.forEach { it.onJoinCallClick(room.roomId) }
|
callbacks.forEach { it.navigateToRoomCall(room.roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displaySameRoomToast() {
|
private fun displaySameRoomToast() {
|
||||||
|
|
@ -288,7 +288,7 @@ class MessagesNode(
|
||||||
MessagesView(
|
MessagesView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = { state.eventSink(MessagesEvents.MarkAsFullyReadAndExit) },
|
onBackClick = { state.eventSink(MessagesEvents.MarkAsFullyReadAndExit) },
|
||||||
onRoomDetailsClick = this::onRoomDetailsClick,
|
onRoomDetailsClick = ::navigateToRoomDetails,
|
||||||
onEventContentClick = { isLive, event ->
|
onEventContentClick = { isLive, event ->
|
||||||
if (isLive) {
|
if (isLive) {
|
||||||
onEventClick(timelineController.mainTimelineMode(), event)
|
onEventClick(timelineController.mainTimelineMode(), event)
|
||||||
|
|
@ -301,7 +301,7 @@ class MessagesNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserDataClick = this::onUserDataClick,
|
onUserDataClick = ::navigateToRoomMemberDetails,
|
||||||
onLinkClick = { url, customTab ->
|
onLinkClick = { url, customTab ->
|
||||||
onLinkClick(
|
onLinkClick(
|
||||||
activity = activity,
|
activity = activity,
|
||||||
|
|
@ -311,15 +311,15 @@ class MessagesNode(
|
||||||
customTab = customTab,
|
customTab = customTab,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onSendLocationClick = this::onSendLocationClick,
|
onSendLocationClick = ::navigateToSendLocation,
|
||||||
onCreatePollClick = this::onCreatePollClick,
|
onCreatePollClick = ::navigateToCreatePoll,
|
||||||
onJoinCallClick = this::onJoinCallClick,
|
onJoinCallClick = ::navigateToRoomCall,
|
||||||
onViewAllPinnedMessagesClick = this::onViewAllPinnedMessagesClick,
|
onViewAllPinnedMessagesClick = ::navigateToPinnedMessagesList,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
knockRequestsBannerView = {
|
knockRequestsBannerView = {
|
||||||
knockRequestsBannerRenderer.View(
|
knockRequestsBannerRenderer.View(
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
onViewRequestsClick = this::onViewKnockRequestsClick
|
onViewRequestsClick = ::navigateToKnockRequestsList,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -327,7 +327,7 @@ class MessagesNode(
|
||||||
state = state.roomMemberModerationState,
|
state = state.roomMemberModerationState,
|
||||||
onSelectAction = { action, target ->
|
onSelectAction = { action, target ->
|
||||||
when (action) {
|
when (action) {
|
||||||
is ModerationAction.DisplayProfile -> onUserDataClick(target.userId)
|
is ModerationAction.DisplayProfile -> navigateToRoomMemberDetails(target.userId)
|
||||||
else -> state.roomMemberModerationState.eventSink(RoomMemberModerationEvents.ProcessAction(action, target))
|
else -> state.roomMemberModerationState.eventSink(RoomMemberModerationEvents.ProcessAction(action, target))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ class MessagesPresenter(
|
||||||
is TimelineItemThreadInfo.ThreadResponse -> targetEvent.threadInfo.threadRootId
|
is TimelineItemThreadInfo.ThreadResponse -> targetEvent.threadInfo.threadRootId
|
||||||
is TimelineItemThreadInfo.ThreadRoot, null -> targetEvent.eventId?.toThreadId()
|
is TimelineItemThreadInfo.ThreadRoot, null -> targetEvent.eventId?.toThreadId()
|
||||||
} ?: return@launch
|
} ?: return@launch
|
||||||
navigator.onOpenThread(threadId, null)
|
navigator.navigateToThread(threadId, null)
|
||||||
} else {
|
} else {
|
||||||
handleActionReply(targetEvent, composerState, timelineProtectionState)
|
handleActionReply(targetEvent, composerState, timelineProtectionState)
|
||||||
}
|
}
|
||||||
|
|
@ -463,7 +463,7 @@ class MessagesPresenter(
|
||||||
when (targetEvent.content) {
|
when (targetEvent.content) {
|
||||||
is TimelineItemPollContent -> {
|
is TimelineItemPollContent -> {
|
||||||
if (targetEvent.eventId == null) return
|
if (targetEvent.eventId == null) return
|
||||||
navigator.onEditPollClick(targetEvent.eventId)
|
navigator.navigateToEditPoll(targetEvent.eventId)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val composerMode = MessageComposerMode.Edit(
|
val composerMode = MessageComposerMode.Edit(
|
||||||
|
|
@ -528,17 +528,17 @@ class MessagesPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleShowDebugInfoAction(event: TimelineItem.Event) {
|
private fun handleShowDebugInfoAction(event: TimelineItem.Event) {
|
||||||
navigator.onShowEventDebugInfoClick(event.eventId, event.debugInfo)
|
navigator.navigateToEventDebugInfo(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.onForwardEventClick(event.eventId)
|
navigator.forwardEvent(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.onReportContentClick(event.eventId, event.senderId)
|
navigator.navigateToReportMessage(event.eventId, event.senderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleEndPollAction(
|
private fun handleEndPollAction(
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,7 @@ class MessageComposerPresenter(
|
||||||
)
|
)
|
||||||
val mediaAttachment = Attachment.Media(localMedia)
|
val mediaAttachment = Attachment.Media(localMedia)
|
||||||
val inReplyToEventId = (messageComposerContext.composerMode as? MessageComposerMode.Reply)?.eventId
|
val inReplyToEventId = (messageComposerContext.composerMode as? MessageComposerMode.Reply)?.eventId
|
||||||
navigator.onPreviewAttachment(persistentListOf(mediaAttachment), inReplyToEventId)
|
navigator.navigateToPreviewAttachments(persistentListOf(mediaAttachment), inReplyToEventId)
|
||||||
|
|
||||||
// Reset composer since the attachment will be sent in a separate flow
|
// Reset composer since the attachment will be sent in a separate flow
|
||||||
messageComposerContext.composerMode = MessageComposerMode.Normal
|
messageComposerContext.composerMode = MessageComposerMode.Normal
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import io.element.android.libraries.matrix.api.core.EventId
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
|
import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo
|
||||||
|
|
||||||
interface PinnedMessagesListNavigator {
|
interface PinnedMessagesListNavigator {
|
||||||
fun onViewInTimelineClick(eventId: EventId)
|
fun viewInTimeline(eventId: EventId)
|
||||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClick(eventId: EventId)
|
fun forwardEvent(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ class PinnedMessagesListNode(
|
||||||
private val permalinkParser: PermalinkParser,
|
private val permalinkParser: PermalinkParser,
|
||||||
) : Node(buildContext, plugins = plugins), PinnedMessagesListNavigator {
|
) : Node(buildContext, plugins = plugins), PinnedMessagesListNavigator {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onEventClick(event: TimelineItem.Event)
|
fun handleEventClick(event: TimelineItem.Event)
|
||||||
fun onUserDataClick(userId: UserId)
|
fun navigateToRoomMemberDetails(userId: UserId)
|
||||||
fun onViewInTimelineClick(eventId: EventId)
|
fun viewInTimeline(eventId: EventId)
|
||||||
fun onRoomPermalinkClick(data: PermalinkData.RoomLink)
|
fun handlePermalinkClick(data: PermalinkData.RoomLink)
|
||||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClick(eventId: EventId)
|
fun handleForwardEventClick(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val presenter = presenterFactory.create(
|
private val presenter = presenterFactory.create(
|
||||||
|
|
@ -65,12 +65,12 @@ class PinnedMessagesListNode(
|
||||||
)
|
)
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
||||||
private fun onEventClick(event: TimelineItem.Event) {
|
private fun handleEventClick(event: TimelineItem.Event) {
|
||||||
return callbacks.forEach { it.onEventClick(event) }
|
return callbacks.forEach { it.handleEventClick(event) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUserDataClick(user: MatrixUser) {
|
private fun navigateToRoomMemberDetails(user: MatrixUser) {
|
||||||
callbacks.forEach { it.onUserDataClick(user.userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(user.userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLinkClick(context: Context, url: String) {
|
private fun onLinkClick(context: Context, url: String) {
|
||||||
|
|
@ -78,10 +78,10 @@ class PinnedMessagesListNode(
|
||||||
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
|
||||||
callbacks.forEach { it.onUserDataClick(permalink.userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(permalink.userId) }
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
callbacks.forEach { it.onRoomPermalinkClick(permalink) }
|
callbacks.forEach { it.handlePermalinkClick(permalink) }
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink,
|
is PermalinkData.FallbackLink,
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
|
|
@ -90,16 +90,16 @@ class PinnedMessagesListNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimelineClick(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
callbacks.forEach { it.onViewInTimelineClick(eventId) }
|
callbacks.forEach { it.viewInTimeline(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) }
|
callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
callbacks.forEach { it.onForwardEventClick(eventId) }
|
callbacks.forEach { it.handleForwardEventClick(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -113,8 +113,8 @@ class PinnedMessagesListNode(
|
||||||
PinnedMessagesListView(
|
PinnedMessagesListView(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onEventClick = ::onEventClick,
|
onEventClick = ::handleEventClick,
|
||||||
onUserDataClick = ::onUserDataClick,
|
onUserDataClick = ::navigateToRoomMemberDetails,
|
||||||
onLinkClick = { link -> onLinkClick(context, link.url) },
|
onLinkClick = { link -> onLinkClick(context, link.url) },
|
||||||
onLinkLongClick = {
|
onLinkLongClick = {
|
||||||
view.performHapticFeedback(
|
view.performHapticFeedback(
|
||||||
|
|
|
||||||
|
|
@ -153,18 +153,18 @@ class PinnedMessagesListPresenter(
|
||||||
) = launch {
|
) = launch {
|
||||||
when (action) {
|
when (action) {
|
||||||
TimelineItemAction.ViewSource -> {
|
TimelineItemAction.ViewSource -> {
|
||||||
navigator.onShowEventDebugInfoClick(targetEvent.eventId, targetEvent.debugInfo)
|
navigator.navigateToEventDebugInfo(targetEvent.eventId, targetEvent.debugInfo)
|
||||||
}
|
}
|
||||||
TimelineItemAction.Forward -> {
|
TimelineItemAction.Forward -> {
|
||||||
targetEvent.eventId?.let { eventId ->
|
targetEvent.eventId?.let { eventId ->
|
||||||
navigator.onForwardEventClick(eventId)
|
navigator.forwardEvent(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TimelineItemAction.Unpin -> handleUnpinAction(targetEvent)
|
TimelineItemAction.Unpin -> handleUnpinAction(targetEvent)
|
||||||
TimelineItemAction.ViewInTimeline -> {
|
TimelineItemAction.ViewInTimeline -> {
|
||||||
targetEvent.eventId?.let { eventId ->
|
targetEvent.eventId?.let { eventId ->
|
||||||
analyticsService.captureInteraction(Interaction.Name.PinnedMessageListViewTimeline)
|
analyticsService.captureInteraction(Interaction.Name.PinnedMessageListViewTimeline)
|
||||||
navigator.onViewInTimelineClick(eventId)
|
navigator.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> Unit
|
else -> Unit
|
||||||
|
|
|
||||||
|
|
@ -113,18 +113,18 @@ class ThreadedMessagesNode(
|
||||||
)
|
)
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean
|
fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean
|
||||||
fun onPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?)
|
||||||
fun onUserDataClick(userId: UserId)
|
fun navigateToRoomMemberDetails(userId: UserId)
|
||||||
fun onPermalinkClick(data: PermalinkData)
|
fun handlePermalinkClick(data: PermalinkData)
|
||||||
fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo)
|
||||||
fun onForwardEventClick(eventId: EventId)
|
fun handleForwardEventClick(eventId: EventId)
|
||||||
fun onReportMessage(eventId: EventId, senderId: UserId)
|
fun navigateToReportMessage(eventId: EventId, senderId: UserId)
|
||||||
fun onSendLocationClick()
|
fun navigateToSendLocation()
|
||||||
fun onCreatePollClick()
|
fun navigateToCreatePoll()
|
||||||
fun onEditPollClick(eventId: EventId)
|
fun navigateToEditPoll(eventId: EventId)
|
||||||
fun onJoinCallClick(roomId: RoomId)
|
fun navigateToRoomCall(roomId: RoomId)
|
||||||
fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
|
|
@ -150,13 +150,13 @@ class ThreadedMessagesNode(
|
||||||
// - if callbacks is empty, it will return true and we want to return false.
|
// - if callbacks is empty, it will return true and we want to return false.
|
||||||
// - if a callback returns false, the other callback will not be invoked.
|
// - if a callback returns false, the other callback will not be invoked.
|
||||||
return callbacks.takeIf { it.isNotEmpty() }
|
return callbacks.takeIf { it.isNotEmpty() }
|
||||||
?.map { it.onEventClick(timelineMode, event) }
|
?.map { it.handleEventClick(timelineMode, event) }
|
||||||
?.all { it }
|
?.all { it }
|
||||||
.orFalse()
|
.orFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUserDataClick(userId: UserId) {
|
private fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
callbacks.forEach { it.onUserDataClick(userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(userId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLinkClick(
|
private fun onLinkClick(
|
||||||
|
|
@ -170,7 +170,7 @@ class ThreadedMessagesNode(
|
||||||
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
|
||||||
callbacks.forEach { it.onUserDataClick(permalink.userId) }
|
callbacks.forEach { it.navigateToRoomMemberDetails(permalink.userId) }
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
handleRoomLinkClick(permalink, eventSink)
|
handleRoomLinkClick(permalink, eventSink)
|
||||||
|
|
@ -204,51 +204,51 @@ class ThreadedMessagesNode(
|
||||||
navigateUp()
|
navigateUp()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callbacks.forEach { it.onPermalinkClick(roomLink) }
|
callbacks.forEach { it.handlePermalinkClick(roomLink) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) }
|
callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
callbacks.forEach { it.onForwardEventClick(eventId) }
|
callbacks.forEach { it.handleForwardEventClick(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
override fun navigateToReportMessage(eventId: EventId, senderId: UserId) {
|
||||||
callbacks.forEach { it.onReportMessage(eventId, senderId) }
|
callbacks.forEach { it.navigateToReportMessage(eventId, senderId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClick(eventId: EventId) {
|
override fun navigateToEditPoll(eventId: EventId) {
|
||||||
callbacks.forEach { it.onEditPollClick(eventId) }
|
callbacks.forEach { it.navigateToEditPoll(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachment(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
override fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
||||||
callbacks.forEach { it.onPreviewAttachments(attachments, inReplyToEventId) }
|
callbacks.forEach { it.navigateToPreviewAttachments(attachments, inReplyToEventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
||||||
val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias(), eventId, viaParameters = serverNames.toImmutableList())
|
val permalinkData = PermalinkData.RoomLink(roomId.toRoomIdOrAlias(), eventId, viaParameters = serverNames.toImmutableList())
|
||||||
callbacks.forEach { it.onPermalinkClick(permalinkData) }
|
callbacks.forEach { it.handlePermalinkClick(permalinkData) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
||||||
callbacks.forEach { it.onOpenThread(threadRootId, focusedEventId) }
|
callbacks.forEach { it.navigateToThread(threadRootId, focusedEventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateUp() = navigateUp()
|
override fun onNavigateUp() = navigateUp()
|
||||||
|
|
||||||
private fun onSendLocationClick() {
|
private fun navigateToSendLocation() {
|
||||||
callbacks.forEach { it.onSendLocationClick() }
|
callbacks.forEach { it.navigateToSendLocation() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onCreatePollClick() {
|
private fun navigateToCreatePoll() {
|
||||||
callbacks.forEach { it.onCreatePollClick() }
|
callbacks.forEach { it.navigateToCreatePoll() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onJoinCallClick() {
|
private fun navigateToRoomCall() {
|
||||||
callbacks.forEach { it.onJoinCallClick(room.roomId) }
|
callbacks.forEach { it.navigateToRoomCall(room.roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -281,7 +281,7 @@ class ThreadedMessagesNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserDataClick = this::onUserDataClick,
|
onUserDataClick = this::navigateToRoomMemberDetails,
|
||||||
onLinkClick = { url, customTab ->
|
onLinkClick = { url, customTab ->
|
||||||
onLinkClick(
|
onLinkClick(
|
||||||
activity = activity,
|
activity = activity,
|
||||||
|
|
@ -291,9 +291,9 @@ class ThreadedMessagesNode(
|
||||||
customTab = customTab,
|
customTab = customTab,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onSendLocationClick = this::onSendLocationClick,
|
onSendLocationClick = this::navigateToSendLocation,
|
||||||
onCreatePollClick = this::onCreatePollClick,
|
onCreatePollClick = this::navigateToCreatePoll,
|
||||||
onJoinCallClick = this::onJoinCallClick,
|
onJoinCallClick = this::navigateToRoomCall,
|
||||||
onViewAllPinnedMessagesClick = {},
|
onViewAllPinnedMessagesClick = {},
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
knockRequestsBannerView = {},
|
knockRequestsBannerView = {},
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ class TimelinePresenter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is TimelineEvents.EditPoll -> {
|
is TimelineEvents.EditPoll -> {
|
||||||
navigator.onEditPollClick(event.pollStartId)
|
navigator.navigateToEditPoll(event.pollStartId)
|
||||||
}
|
}
|
||||||
is TimelineEvents.FocusOnEvent -> sessionCoroutineScope.launch {
|
is TimelineEvents.FocusOnEvent -> sessionCoroutineScope.launch {
|
||||||
focusRequestState.value = FocusRequestState.Requested(event.eventId, event.debounce)
|
focusRequestState.value = FocusRequestState.Requested(event.eventId, event.debounce)
|
||||||
|
|
@ -210,10 +210,10 @@ class TimelinePresenter(
|
||||||
is TimelineEvents.NavigateToPredecessorOrSuccessorRoom -> {
|
is TimelineEvents.NavigateToPredecessorOrSuccessorRoom -> {
|
||||||
// Navigate to the predecessor or successor room
|
// Navigate to the predecessor or successor room
|
||||||
val serverNames = calculateServerNamesForRoom(room)
|
val serverNames = calculateServerNamesForRoom(room)
|
||||||
navigator.onNavigateToRoom(event.roomId, null, serverNames)
|
navigator.navigateToRoom(event.roomId, null, serverNames)
|
||||||
}
|
}
|
||||||
is TimelineEvents.OpenThread -> {
|
is TimelineEvents.OpenThread -> {
|
||||||
navigator.onOpenThread(
|
navigator.navigateToThread(
|
||||||
threadRootId = event.threadRootEventId,
|
threadRootId = event.threadRootEventId,
|
||||||
focusedEventId = event.focusedEvent,
|
focusedEventId = event.focusedEvent,
|
||||||
)
|
)
|
||||||
|
|
@ -314,7 +314,7 @@ class TimelinePresenter(
|
||||||
if (timelineController.mainTimelineMode() is Timeline.Mode.Thread && threadId == null) {
|
if (timelineController.mainTimelineMode() is Timeline.Mode.Thread && threadId == null) {
|
||||||
// We are in a thread timeline, and the event isn't part of a thread, we need to navigate back to the room
|
// We are in a thread timeline, and the event isn't part of a thread, we need to navigate back to the room
|
||||||
focusRequestState.value = FocusRequestState.None
|
focusRequestState.value = FocusRequestState.None
|
||||||
navigator.onNavigateToRoom(room.roomId, eventId, calculateServerNamesForRoom(room))
|
navigator.navigateToRoom(room.roomId, eventId, calculateServerNamesForRoom(room))
|
||||||
} else {
|
} else {
|
||||||
Timber.tag(tag).d("Focusing on event $eventId - thread $threadId")
|
Timber.tag(tag).d("Focusing on event $eventId - thread $threadId")
|
||||||
timelineController.focusOnEvent(eventId, threadId)
|
timelineController.focusOnEvent(eventId, threadId)
|
||||||
|
|
@ -331,7 +331,7 @@ class TimelinePresenter(
|
||||||
} else {
|
} else {
|
||||||
focusRequestState.value = FocusRequestState.Success(eventId = result.threadId.asEventId())
|
focusRequestState.value = FocusRequestState.Success(eventId = result.threadId.asEventId())
|
||||||
// It's part of a thread we're not in, let's open it in another timeline
|
// It's part of a thread we're not in, let's open it in another timeline
|
||||||
navigator.onOpenThread(result.threadId, eventId)
|
navigator.navigateToThread(result.threadId, eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,11 @@ class DefaultMessagesEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : MessagesEntryPoint.Callback {
|
val callback = object : MessagesEntryPoint.Callback {
|
||||||
override fun onRoomDetailsClick() = lambdaError()
|
override fun navigateToRoomDetails() = lambdaError()
|
||||||
override fun onUserDataClick(userId: UserId) = lambdaError()
|
override fun navigateToRoomMemberDetails(userId: UserId) = lambdaError()
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError()
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError()
|
||||||
override fun forwardEvent(eventId: EventId) = lambdaError()
|
override fun forwardEvent(eventId: EventId) = lambdaError()
|
||||||
override fun openRoom(roomId: RoomId) = lambdaError()
|
override fun navigateToRoom(roomId: RoomId) = lambdaError()
|
||||||
}
|
}
|
||||||
val initialTarget = MessagesEntryPoint.InitialTarget.Messages(focusedEventId = AN_EVENT_ID)
|
val initialTarget = MessagesEntryPoint.InitialTarget.Messages(focusedEventId = AN_EVENT_ID)
|
||||||
val params = MessagesEntryPoint.Params(initialTarget)
|
val params = MessagesEntryPoint.Params(initialTarget)
|
||||||
|
|
|
||||||
|
|
@ -26,31 +26,31 @@ class FakeMessagesNavigator(
|
||||||
private val onOpenThreadLambda: (threadRootId: ThreadId, focusedEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
private val onOpenThreadLambda: (threadRootId: ThreadId, focusedEventId: EventId?) -> Unit = { _, _ -> lambdaError() },
|
||||||
private val onNavigateUpLambda: () -> Unit = { lambdaError() },
|
private val onNavigateUpLambda: () -> Unit = { lambdaError() },
|
||||||
) : MessagesNavigator {
|
) : MessagesNavigator {
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
onShowEventDebugInfoClickLambda(eventId, debugInfo)
|
onShowEventDebugInfoClickLambda(eventId, debugInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
onForwardEventClickLambda(eventId)
|
onForwardEventClickLambda(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onReportContentClick(eventId: EventId, senderId: UserId) {
|
override fun navigateToReportMessage(eventId: EventId, senderId: UserId) {
|
||||||
onReportContentClickLambda(eventId, senderId)
|
onReportContentClickLambda(eventId, senderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEditPollClick(eventId: EventId) {
|
override fun navigateToEditPoll(eventId: EventId) {
|
||||||
onEditPollClickLambda(eventId)
|
onEditPollClickLambda(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewAttachment(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
override fun navigateToPreviewAttachments(attachments: ImmutableList<Attachment>, inReplyToEventId: EventId?) {
|
||||||
onPreviewAttachmentLambda(attachments, inReplyToEventId)
|
onPreviewAttachmentLambda(attachments, inReplyToEventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List<String>) {
|
||||||
onNavigateToRoomLambda(roomId, eventId, serverNames)
|
onNavigateToRoomLambda(roomId, eventId, serverNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) {
|
||||||
onOpenThreadLambda(threadRootId, focusedEventId)
|
onOpenThreadLambda(threadRootId, focusedEventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,17 @@ import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugIn
|
||||||
|
|
||||||
class FakePinnedMessagesListNavigator : PinnedMessagesListNavigator {
|
class FakePinnedMessagesListNavigator : PinnedMessagesListNavigator {
|
||||||
var onViewInTimelineClickLambda: ((EventId) -> Unit)? = null
|
var onViewInTimelineClickLambda: ((EventId) -> Unit)? = null
|
||||||
override fun onViewInTimelineClick(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
onViewInTimelineClickLambda?.invoke(eventId)
|
onViewInTimelineClickLambda?.invoke(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
var onShowEventDebugInfoClickLambda: ((EventId?, TimelineItemDebugInfo) -> Unit)? = null
|
var onShowEventDebugInfoClickLambda: ((EventId?, TimelineItemDebugInfo) -> Unit)? = null
|
||||||
override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) {
|
||||||
onShowEventDebugInfoClickLambda?.invoke(eventId, debugInfo)
|
onShowEventDebugInfoClickLambda?.invoke(eventId, debugInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
var onForwardEventClickLambda: ((EventId) -> Unit)? = null
|
var onForwardEventClickLambda: ((EventId) -> Unit)? = null
|
||||||
override fun onForwardEventClick(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
onForwardEventClickLambda?.invoke(eventId)
|
onForwardEventClickLambda?.invoke(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class PollHistoryFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : PollHistoryNode.Callback {
|
val callback = object : PollHistoryNode.Callback {
|
||||||
override fun onEditPoll(pollStartEventId: EventId) {
|
override fun navigateToEditPoll(pollStartEventId: EventId) {
|
||||||
backstack.push(NavTarget.EditPoll(pollStartEventId))
|
backstack.push(NavTarget.EditPoll(pollStartEventId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ class PollHistoryNode(
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onEditPoll(pollStartEventId: EventId)
|
fun navigateToEditPoll(pollStartEventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onEditPoll(pollStartEventId: EventId) {
|
private fun onEditPoll(pollStartEventId: EventId) {
|
||||||
plugins<Callback>().forEach { it.onEditPoll(pollStartEventId) }
|
plugins<Callback>().forEach { it.navigateToEditPoll(pollStartEventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ interface PreferencesEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onAddAccount()
|
fun navigateToAddAccount()
|
||||||
fun onOpenBugReport()
|
fun navigateToBugReport()
|
||||||
fun onSecureBackupClick()
|
fun navigateToSecureBackup()
|
||||||
fun onOpenRoomNotificationSettings(roomId: RoomId)
|
fun navigateToRoomNotificationSettings(roomId: RoomId)
|
||||||
fun navigateTo(roomId: RoomId, eventId: EventId)
|
fun navigateToEvent(roomId: RoomId, eventId: EventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,59 +120,59 @@ class PreferencesFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : PreferencesRootNode.Callback {
|
val callback = object : PreferencesRootNode.Callback {
|
||||||
override fun onAddAccount() {
|
override fun navigateToAddAccount() {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.onAddAccount() }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToAddAccount() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenBugReport() {
|
override fun navigateToBugReport() {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.onOpenBugReport() }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSecureBackupClick() {
|
override fun navigateToSecureBackup() {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.onSecureBackupClick() }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToSecureBackup() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAnalytics() {
|
override fun navigateToAnalyticsSettings() {
|
||||||
backstack.push(NavTarget.AnalyticsSettings)
|
backstack.push(NavTarget.AnalyticsSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAbout() {
|
override fun navigateToAbout() {
|
||||||
backstack.push(NavTarget.About)
|
backstack.push(NavTarget.About)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenDeveloperSettings() {
|
override fun navigateToDeveloperSettings() {
|
||||||
backstack.push(NavTarget.DeveloperSettings)
|
backstack.push(NavTarget.DeveloperSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenNotificationSettings() {
|
override fun navigateToNotificationSettings() {
|
||||||
backstack.push(NavTarget.NotificationSettings)
|
backstack.push(NavTarget.NotificationSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenLockScreenSettings() {
|
override fun navigateToLockScreenSettings() {
|
||||||
backstack.push(NavTarget.LockScreenSettings)
|
backstack.push(NavTarget.LockScreenSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAdvancedSettings() {
|
override fun navigateToAdvancedSettings() {
|
||||||
backstack.push(NavTarget.AdvancedSettings)
|
backstack.push(NavTarget.AdvancedSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenLabs() {
|
override fun navigateToLabs() {
|
||||||
backstack.push(NavTarget.Labs)
|
backstack.push(NavTarget.Labs)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenUserProfile(matrixUser: MatrixUser) {
|
override fun navigateToUserProfile(matrixUser: MatrixUser) {
|
||||||
backstack.push(NavTarget.UserProfile(matrixUser))
|
backstack.push(NavTarget.UserProfile(matrixUser))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenBlockedUsers() {
|
override fun navigateToBlockedUsers() {
|
||||||
backstack.push(NavTarget.BlockedUsers)
|
backstack.push(NavTarget.BlockedUsers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSignOutClick() {
|
override fun startSignOutFlow() {
|
||||||
backstack.push(NavTarget.SignOut)
|
backstack.push(NavTarget.SignOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAccountDeactivation() {
|
override fun startAccountDeactivationFlow() {
|
||||||
backstack.push(NavTarget.AccountDeactivation)
|
backstack.push(NavTarget.AccountDeactivation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.DeveloperSettings -> {
|
NavTarget.DeveloperSettings -> {
|
||||||
val developerSettingsCallback = object : DeveloperSettingsNode.Callback {
|
val developerSettingsCallback = object : DeveloperSettingsNode.Callback {
|
||||||
override fun onPushHistoryClick() {
|
override fun navigateToPushHistory() {
|
||||||
backstack.push(NavTarget.PushHistory)
|
backstack.push(NavTarget.PushHistory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +191,7 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.About -> {
|
NavTarget.About -> {
|
||||||
val callback = object : AboutNode.Callback {
|
val callback = object : AboutNode.Callback {
|
||||||
override fun openOssLicenses() {
|
override fun navigateToOssLicenses() {
|
||||||
backstack.push(NavTarget.OssLicenses)
|
backstack.push(NavTarget.OssLicenses)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -202,11 +202,11 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.NotificationSettings -> {
|
NavTarget.NotificationSettings -> {
|
||||||
val notificationSettingsCallback = object : NotificationSettingsNode.Callback {
|
val notificationSettingsCallback = object : NotificationSettingsNode.Callback {
|
||||||
override fun editDefaultNotificationMode(isOneToOne: Boolean) {
|
override fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean) {
|
||||||
backstack.push(NavTarget.EditDefaultNotificationSetting(isOneToOne))
|
backstack.push(NavTarget.EditDefaultNotificationSetting(isOneToOne))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTroubleshootNotificationsClick() {
|
override fun navigateToTroubleshootNotifications() {
|
||||||
backstack.push(NavTarget.TroubleshootNotifications)
|
backstack.push(NavTarget.TroubleshootNotifications)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +223,7 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openIgnoredUsers() {
|
override fun navigateToBlockedUsers() {
|
||||||
backstack.push(NavTarget.BlockedUsers)
|
backstack.push(NavTarget.BlockedUsers)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -240,16 +240,16 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun navigateTo(roomId: RoomId, eventId: EventId) {
|
override fun navigateToEvent(roomId: RoomId, eventId: EventId) {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateTo(roomId, eventId) }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToEvent(roomId, eventId) }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
is NavTarget.EditDefaultNotificationSetting -> {
|
is NavTarget.EditDefaultNotificationSetting -> {
|
||||||
val callback = object : EditDefaultNotificationSettingNode.Callback {
|
val callback = object : EditDefaultNotificationSettingNode.Callback {
|
||||||
override fun openRoomNotificationSettings(roomId: RoomId) {
|
override fun navigateToRoomNotificationSettings(roomId: RoomId) {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.onOpenRoomNotificationSettings(roomId) }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToRoomNotificationSettings(roomId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val input = EditDefaultNotificationSettingNode.Inputs(navTarget.isOneToOne)
|
val input = EditDefaultNotificationSettingNode.Inputs(navTarget.isOneToOne)
|
||||||
|
|
@ -270,8 +270,8 @@ class PreferencesFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.SignOut -> {
|
NavTarget.SignOut -> {
|
||||||
val callBack: LogoutEntryPoint.Callback = object : LogoutEntryPoint.Callback {
|
val callBack: LogoutEntryPoint.Callback = object : LogoutEntryPoint.Callback {
|
||||||
override fun onChangeRecoveryKeyClick() {
|
override fun navigateToSecureBackup() {
|
||||||
plugins<PreferencesEntryPoint.Callback>().forEach { it.onSecureBackupClick() }
|
plugins<PreferencesEntryPoint.Callback>().forEach { it.navigateToSecureBackup() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logoutEntryPoint.nodeBuilder(this, buildContext)
|
logoutEntryPoint.nodeBuilder(this, buildContext)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class AboutNode(
|
||||||
private val presenter: AboutPresenter,
|
private val presenter: AboutPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun openOssLicenses()
|
fun navigateToOssLicenses()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onElementLegalClick(
|
private fun onElementLegalClick(
|
||||||
|
|
@ -52,7 +52,7 @@ class AboutNode(
|
||||||
onElementLegalClick(activity, isDark, elementLegal)
|
onElementLegalClick(activity, isDark, elementLegal)
|
||||||
},
|
},
|
||||||
onOpenSourceLicensesClick = {
|
onOpenSourceLicensesClick = {
|
||||||
plugins.filterIsInstance<Callback>().forEach { it.openOssLicenses() }
|
plugins.filterIsInstance<Callback>().forEach { it.navigateToOssLicenses() }
|
||||||
},
|
},
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ class DeveloperSettingsNode(
|
||||||
private val presenter: DeveloperSettingsPresenter,
|
private val presenter: DeveloperSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onPushHistoryClick()
|
fun navigateToPushHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
||||||
private fun onPushHistoryClick() {
|
private fun navigateToPushHistory() {
|
||||||
callbacks.forEach { it.onPushHistoryClick() }
|
callbacks.forEach { it.navigateToPushHistory() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -51,7 +51,7 @@ class DeveloperSettingsNode(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onOpenShowkase = ::openShowkase,
|
onOpenShowkase = ::openShowkase,
|
||||||
onPushHistoryClick = ::onPushHistoryClick,
|
onPushHistoryClick = ::navigateToPushHistory,
|
||||||
onBackClick = ::navigateUp
|
onBackClick = ::navigateUp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,18 @@ class NotificationSettingsNode(
|
||||||
private val presenter: NotificationSettingsPresenter,
|
private val presenter: NotificationSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun editDefaultNotificationMode(isOneToOne: Boolean)
|
fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean)
|
||||||
fun onTroubleshootNotificationsClick()
|
fun navigateToTroubleshootNotifications()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
||||||
private fun openEditDefault(isOneToOne: Boolean) {
|
private fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean) {
|
||||||
callbacks.forEach { it.editDefaultNotificationMode(isOneToOne) }
|
callbacks.forEach { it.navigateToEditDefaultNotificationSetting(isOneToOne) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onTroubleshootNotificationsClick() {
|
private fun navigateToTroubleshootNotifications() {
|
||||||
callbacks.forEach { it.onTroubleshootNotificationsClick() }
|
callbacks.forEach { it.navigateToTroubleshootNotifications() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -45,9 +45,9 @@ class NotificationSettingsNode(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
NotificationSettingsView(
|
NotificationSettingsView(
|
||||||
state = state,
|
state = state,
|
||||||
onOpenEditDefault = { openEditDefault(isOneToOne = it) },
|
onOpenEditDefault = ::navigateToEditDefaultNotificationSetting,
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onTroubleshootNotificationsClick = ::onTroubleshootNotificationsClick,
|
onTroubleshootNotificationsClick = ::navigateToTroubleshootNotifications,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class EditDefaultNotificationSettingNode(
|
||||||
presenterFactory: EditDefaultNotificationSettingPresenter.Factory
|
presenterFactory: EditDefaultNotificationSettingPresenter.Factory
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun openRoomNotificationSettings(roomId: RoomId)
|
fun navigateToRoomNotificationSettings(roomId: RoomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Inputs(
|
data class Inputs(
|
||||||
|
|
@ -40,8 +40,8 @@ class EditDefaultNotificationSettingNode(
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
private val presenter = presenterFactory.create(inputs.isOneToOne)
|
private val presenter = presenterFactory.create(inputs.isOneToOne)
|
||||||
|
|
||||||
private fun openRoomNotificationSettings(roomId: RoomId) {
|
private fun navigateToRoomNotificationSettings(roomId: RoomId) {
|
||||||
callbacks.forEach { it.openRoomNotificationSettings(roomId) }
|
callbacks.forEach { it.navigateToRoomNotificationSettings(roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -49,7 +49,7 @@ class EditDefaultNotificationSettingNode(
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
EditDefaultNotificationSettingView(
|
EditDefaultNotificationSettingView(
|
||||||
state = state,
|
state = state,
|
||||||
openRoomNotificationSettings = { openRoomNotificationSettings(it) },
|
openRoomNotificationSettings = { navigateToRoomNotificationSettings(it) },
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -34,52 +34,52 @@ class PreferencesRootNode(
|
||||||
private val directLogoutView: DirectLogoutView,
|
private val directLogoutView: DirectLogoutView,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onAddAccount()
|
fun navigateToAddAccount()
|
||||||
fun onOpenBugReport()
|
fun navigateToBugReport()
|
||||||
fun onSecureBackupClick()
|
fun navigateToSecureBackup()
|
||||||
fun onOpenAnalytics()
|
fun navigateToAnalyticsSettings()
|
||||||
fun onOpenAbout()
|
fun navigateToAbout()
|
||||||
fun onOpenDeveloperSettings()
|
fun navigateToDeveloperSettings()
|
||||||
fun onOpenNotificationSettings()
|
fun navigateToNotificationSettings()
|
||||||
fun onOpenLockScreenSettings()
|
fun navigateToLockScreenSettings()
|
||||||
fun onOpenAdvancedSettings()
|
fun navigateToAdvancedSettings()
|
||||||
fun onOpenLabs()
|
fun navigateToLabs()
|
||||||
fun onOpenUserProfile(matrixUser: MatrixUser)
|
fun navigateToUserProfile(matrixUser: MatrixUser)
|
||||||
fun onOpenBlockedUsers()
|
fun navigateToBlockedUsers()
|
||||||
fun onSignOutClick()
|
fun startSignOutFlow()
|
||||||
fun onOpenAccountDeactivation()
|
fun startAccountDeactivationFlow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onAddAccount() {
|
private fun onAddAccount() {
|
||||||
plugins<Callback>().forEach { it.onAddAccount() }
|
plugins<Callback>().forEach { it.navigateToAddAccount() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenBugReport() {
|
private fun onOpenBugReport() {
|
||||||
plugins<Callback>().forEach { it.onOpenBugReport() }
|
plugins<Callback>().forEach { it.navigateToBugReport() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSecureBackupClick() {
|
private fun onSecureBackupClick() {
|
||||||
plugins<Callback>().forEach { it.onSecureBackupClick() }
|
plugins<Callback>().forEach { it.navigateToSecureBackup() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenDeveloperSettings() {
|
private fun onOpenDeveloperSettings() {
|
||||||
plugins<Callback>().forEach { it.onOpenDeveloperSettings() }
|
plugins<Callback>().forEach { it.navigateToDeveloperSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenAdvancedSettings() {
|
private fun onOpenAdvancedSettings() {
|
||||||
plugins<Callback>().forEach { it.onOpenAdvancedSettings() }
|
plugins<Callback>().forEach { it.navigateToAdvancedSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenLabs() {
|
private fun onOpenLabs() {
|
||||||
plugins<Callback>().forEach { it.onOpenLabs() }
|
plugins<Callback>().forEach { it.navigateToLabs() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenAnalytics() {
|
private fun onOpenAnalytics() {
|
||||||
plugins<Callback>().forEach { it.onOpenAnalytics() }
|
plugins<Callback>().forEach { it.navigateToAnalyticsSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenAbout() {
|
private fun onOpenAbout() {
|
||||||
plugins<Callback>().forEach { it.onOpenAbout() }
|
plugins<Callback>().forEach { it.navigateToAbout() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onManageAccountClick(
|
private fun onManageAccountClick(
|
||||||
|
|
@ -97,27 +97,27 @@ class PreferencesRootNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenNotificationSettings() {
|
private fun onOpenNotificationSettings() {
|
||||||
plugins<Callback>().forEach { it.onOpenNotificationSettings() }
|
plugins<Callback>().forEach { it.navigateToNotificationSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenLockScreenSettings() {
|
private fun onOpenLockScreenSettings() {
|
||||||
plugins<Callback>().forEach { it.onOpenLockScreenSettings() }
|
plugins<Callback>().forEach { it.navigateToLockScreenSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenUserProfile(matrixUser: MatrixUser) {
|
private fun onOpenUserProfile(matrixUser: MatrixUser) {
|
||||||
plugins<Callback>().forEach { it.onOpenUserProfile(matrixUser) }
|
plugins<Callback>().forEach { it.navigateToUserProfile(matrixUser) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenBlockedUsers() {
|
private fun onOpenBlockedUsers() {
|
||||||
plugins<Callback>().forEach { it.onOpenBlockedUsers() }
|
plugins<Callback>().forEach { it.navigateToBlockedUsers() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSignOutClick() {
|
private fun onSignOutClick() {
|
||||||
plugins<Callback>().forEach { it.onSignOutClick() }
|
plugins<Callback>().forEach { it.startSignOutFlow() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOpenAccountDeactivation() {
|
private fun onOpenAccountDeactivation() {
|
||||||
plugins<Callback>().forEach { it.onOpenAccountDeactivation() }
|
plugins<Callback>().forEach { it.startAccountDeactivationFlow() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ class DefaultPreferencesEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : PreferencesEntryPoint.Callback {
|
val callback = object : PreferencesEntryPoint.Callback {
|
||||||
override fun onAddAccount() = lambdaError()
|
override fun navigateToAddAccount() = lambdaError()
|
||||||
override fun onOpenBugReport() = lambdaError()
|
override fun navigateToBugReport() = lambdaError()
|
||||||
override fun onSecureBackupClick() = lambdaError()
|
override fun navigateToSecureBackup() = lambdaError()
|
||||||
override fun onOpenRoomNotificationSettings(roomId: RoomId) = lambdaError()
|
override fun navigateToRoomNotificationSettings(roomId: RoomId) = lambdaError()
|
||||||
override fun navigateTo(roomId: RoomId, eventId: EventId) = lambdaError()
|
override fun navigateToEvent(roomId: RoomId, eventId: EventId) = lambdaError()
|
||||||
}
|
}
|
||||||
val params = PreferencesEntryPoint.Params(
|
val params = PreferencesEntryPoint.Params(
|
||||||
initialElement = PreferencesEntryPoint.InitialTarget.NotificationSettings,
|
initialElement = PreferencesEntryPoint.InitialTarget.NotificationSettings,
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class BugReportFlowNode(
|
||||||
this@BugReportFlowNode.onDone()
|
this@BugReportFlowNode.onDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewLogs(basePath: String) {
|
override fun navigateToViewLogs(basePath: String) {
|
||||||
backstack.push(NavTarget.ViewLogs(rootPath = basePath))
|
backstack.push(NavTarget.ViewLogs(rootPath = basePath))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ class BugReportNode(
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun onViewLogs(basePath: String)
|
fun navigateToViewLogs(basePath: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onViewLogs(basePath: String) {
|
private fun onViewLogs(basePath: String) {
|
||||||
plugins<Callback>().forEach { it.onViewLogs(basePath) }
|
plugins<Callback>().forEach { it.navigateToViewLogs(basePath) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onDone() {
|
private fun onDone() {
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint {
|
||||||
data class Params(val initialElement: InitialTarget) : NodeInputs
|
data class Params(val initialElement: InitialTarget) : NodeInputs
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenGlobalNotificationSettings()
|
fun navigateToGlobalNotificationSettings()
|
||||||
fun onOpenRoom(roomId: RoomId, serverNames: List<String>)
|
fun navigateToRoom(roomId: RoomId, serverNames: List<String>)
|
||||||
fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
||||||
fun forwardEvent(eventId: EventId)
|
fun startForwardEventFlow(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
|
|
|
||||||
|
|
@ -167,55 +167,55 @@ class RoomDetailsFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.RoomDetails -> {
|
NavTarget.RoomDetails -> {
|
||||||
val roomDetailsCallback = object : RoomDetailsNode.Callback {
|
val roomDetailsCallback = object : RoomDetailsNode.Callback {
|
||||||
override fun openRoomMemberList() {
|
override fun navigateToRoomMemberList() {
|
||||||
backstack.push(NavTarget.RoomMemberList)
|
backstack.push(NavTarget.RoomMemberList)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun editRoomDetails() {
|
override fun navigateToRoomDetailsEdit() {
|
||||||
backstack.push(NavTarget.RoomDetailsEdit)
|
backstack.push(NavTarget.RoomDetailsEdit)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openInviteMembers() {
|
override fun navigateToInviteMembers() {
|
||||||
backstack.push(NavTarget.InviteMembers)
|
backstack.push(NavTarget.InviteMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openRoomNotificationSettings() {
|
override fun navigateToRoomNotificationSettings() {
|
||||||
backstack.push(NavTarget.RoomNotificationSettings(showUserDefinedSettingStyle = false))
|
backstack.push(NavTarget.RoomNotificationSettings(showUserDefinedSettingStyle = false))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openAvatarPreview(name: String, url: String) {
|
override fun navigateToAvatarPreview(name: String, url: String) {
|
||||||
overlay.show(NavTarget.AvatarPreview(name, url))
|
overlay.show(NavTarget.AvatarPreview(name, url))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openPollHistory() {
|
override fun navigateToPollHistory() {
|
||||||
backstack.push(NavTarget.PollHistory)
|
backstack.push(NavTarget.PollHistory)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openMediaGallery() {
|
override fun navigateToMediaGallery() {
|
||||||
backstack.push(NavTarget.MediaGallery)
|
backstack.push(NavTarget.MediaGallery)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openAdminSettings() {
|
override fun navigateToAdminSettings() {
|
||||||
backstack.push(NavTarget.AdminSettings)
|
backstack.push(NavTarget.AdminSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openPinnedMessagesList() {
|
override fun navigateToPinnedMessagesList() {
|
||||||
backstack.push(NavTarget.PinnedMessagesList)
|
backstack.push(NavTarget.PinnedMessagesList)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openKnockRequestsList() {
|
override fun navigateToKnockRequestsList() {
|
||||||
backstack.push(NavTarget.KnockRequestsList)
|
backstack.push(NavTarget.KnockRequestsList)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openSecurityAndPrivacy() {
|
override fun navigateToSecurityAndPrivacy() {
|
||||||
backstack.push(NavTarget.SecurityAndPrivacy)
|
backstack.push(NavTarget.SecurityAndPrivacy)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openDmUserProfile(userId: UserId) {
|
override fun navigateToRoomMemberDetails(userId: UserId) {
|
||||||
backstack.push(NavTarget.RoomMemberDetails(userId))
|
backstack.push(NavTarget.RoomMemberDetails(userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onJoinCall() {
|
override fun navigateToRoomCall() {
|
||||||
val inputs = CallType.RoomCall(
|
val inputs = CallType.RoomCall(
|
||||||
sessionId = room.sessionId,
|
sessionId = room.sessionId,
|
||||||
roomId = room.roomId,
|
roomId = room.roomId,
|
||||||
|
|
@ -224,11 +224,11 @@ class RoomDetailsFlowNode(
|
||||||
elementCallEntryPoint.startCall(inputs)
|
elementCallEntryPoint.startCall(inputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openReportRoom() {
|
override fun navigateToReportRoom() {
|
||||||
backstack.push(NavTarget.ReportRoom)
|
backstack.push(NavTarget.ReportRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSelectNewOwnersWhenLeaving() {
|
override fun navigateToSelectNewOwnersWhenLeaving() {
|
||||||
backstack.push(NavTarget.SelectNewOwnersWhenLeaving)
|
backstack.push(NavTarget.SelectNewOwnersWhenLeaving)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -237,11 +237,11 @@ class RoomDetailsFlowNode(
|
||||||
|
|
||||||
NavTarget.RoomMemberList -> {
|
NavTarget.RoomMemberList -> {
|
||||||
val roomMemberListCallback = object : RoomMemberListNode.Callback {
|
val roomMemberListCallback = object : RoomMemberListNode.Callback {
|
||||||
override fun openRoomMemberDetails(roomMemberId: UserId) {
|
override fun navigateToRoomMemberDetails(roomMemberId: UserId) {
|
||||||
backstack.push(NavTarget.RoomMemberDetails(roomMemberId))
|
backstack.push(NavTarget.RoomMemberDetails(roomMemberId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openInviteMembers() {
|
override fun navigateToInviteMembers() {
|
||||||
backstack.push(NavTarget.InviteMembers)
|
backstack.push(NavTarget.InviteMembers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -259,8 +259,8 @@ class RoomDetailsFlowNode(
|
||||||
is NavTarget.RoomNotificationSettings -> {
|
is NavTarget.RoomNotificationSettings -> {
|
||||||
val input = RoomNotificationSettingsNode.RoomNotificationSettingInput(navTarget.showUserDefinedSettingStyle)
|
val input = RoomNotificationSettingsNode.RoomNotificationSettingInput(navTarget.showUserDefinedSettingStyle)
|
||||||
val callback = object : RoomNotificationSettingsNode.Callback {
|
val callback = object : RoomNotificationSettingsNode.Callback {
|
||||||
override fun openGlobalNotificationSettings() {
|
override fun navigateToGlobalNotificationSettings() {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onOpenGlobalNotificationSettings() }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.navigateToGlobalNotificationSettings() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createNode<RoomNotificationSettingsNode>(buildContext, listOf(input, callback))
|
createNode<RoomNotificationSettingsNode>(buildContext, listOf(input, callback))
|
||||||
|
|
@ -268,19 +268,19 @@ class RoomDetailsFlowNode(
|
||||||
|
|
||||||
is NavTarget.RoomMemberDetails -> {
|
is NavTarget.RoomMemberDetails -> {
|
||||||
val callback = object : UserProfileNodeHelper.Callback {
|
val callback = object : UserProfileNodeHelper.Callback {
|
||||||
override fun openAvatarPreview(username: String, avatarUrl: String) {
|
override fun navigateToAvatarPreview(username: String, avatarUrl: String) {
|
||||||
overlay.show(NavTarget.AvatarPreview(username, avatarUrl))
|
overlay.show(NavTarget.AvatarPreview(username, avatarUrl))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartDM(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onOpenRoom(roomId, emptyList()) }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.navigateToRoom(roomId, emptyList()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartCall(dmRoomId: RoomId) {
|
override fun startCall(dmRoomId: RoomId) {
|
||||||
elementCallEntryPoint.startCall(CallType.RoomCall(roomId = dmRoomId, sessionId = room.sessionId))
|
elementCallEntryPoint.startCall(CallType.RoomCall(roomId = dmRoomId, sessionId = room.sessionId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onVerifyUser(userId: UserId) {
|
override fun startVerifyUserFlow(userId: UserId) {
|
||||||
backstack.push(NavTarget.VerifyUser(userId))
|
backstack.push(NavTarget.VerifyUser(userId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,11 +293,11 @@ class RoomDetailsFlowNode(
|
||||||
overlay.hide()
|
overlay.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
// Cannot happen
|
// Cannot happen
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
// Cannot happen
|
// Cannot happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -318,18 +318,18 @@ class RoomDetailsFlowNode(
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
val permalinkData = PermalinkData.RoomLink(
|
val permalinkData = PermalinkData.RoomLink(
|
||||||
roomIdOrAlias = room.roomId.toRoomIdOrAlias(),
|
roomIdOrAlias = room.roomId.toRoomIdOrAlias(),
|
||||||
eventId = eventId,
|
eventId = eventId,
|
||||||
)
|
)
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach {
|
plugins<RoomDetailsEntryPoint.Callback>().forEach {
|
||||||
it.onPermalinkClick(permalinkData, pushToBackstack = false)
|
it.handlePermalinkClick(permalinkData, pushToBackstack = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun forwardEvent(eventId: EventId) {
|
override fun forward(eventId: EventId) {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.forwardEvent(eventId) }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.startForwardEventFlow(eventId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mediaGalleryEntryPoint.nodeBuilder(this, buildContext)
|
mediaGalleryEntryPoint.nodeBuilder(this, buildContext)
|
||||||
|
|
@ -345,20 +345,20 @@ class RoomDetailsFlowNode(
|
||||||
MessagesEntryPoint.InitialTarget.PinnedMessages
|
MessagesEntryPoint.InitialTarget.PinnedMessages
|
||||||
)
|
)
|
||||||
val callback = object : MessagesEntryPoint.Callback {
|
val callback = object : MessagesEntryPoint.Callback {
|
||||||
override fun onRoomDetailsClick() = Unit
|
override fun navigateToRoomDetails() = Unit
|
||||||
|
|
||||||
override fun onUserDataClick(userId: UserId) = Unit
|
override fun navigateToRoomMemberDetails(userId: UserId) = Unit
|
||||||
|
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onPermalinkClick(data, pushToBackstack) }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.handlePermalinkClick(data, pushToBackstack) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun forwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.forwardEvent(eventId) }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.startForwardEventFlow(eventId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openRoom(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onOpenRoom(roomId, emptyList()) }
|
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.navigateToRoom(roomId, emptyList()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return messagesEntryPoint.nodeBuilder(this, buildContext)
|
return messagesEntryPoint.nodeBuilder(this, buildContext)
|
||||||
|
|
@ -388,7 +388,7 @@ class RoomDetailsFlowNode(
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLearnMoreAboutEncryption() {
|
override fun navigateToLearnMoreAboutEncryption() {
|
||||||
learnMoreUrl.value = LearnMoreConfig.ENCRYPTION_URL
|
learnMoreUrl.value = LearnMoreConfig.ENCRYPTION_URL
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -46,21 +46,21 @@ class RoomDetailsNode(
|
||||||
private val leaveRoomRenderer: LeaveRoomRenderer,
|
private val leaveRoomRenderer: LeaveRoomRenderer,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun openRoomMemberList()
|
fun navigateToRoomMemberList()
|
||||||
fun openInviteMembers()
|
fun navigateToInviteMembers()
|
||||||
fun editRoomDetails()
|
fun navigateToRoomDetailsEdit()
|
||||||
fun openRoomNotificationSettings()
|
fun navigateToRoomNotificationSettings()
|
||||||
fun openAvatarPreview(name: String, url: String)
|
fun navigateToAvatarPreview(name: String, url: String)
|
||||||
fun openPollHistory()
|
fun navigateToPollHistory()
|
||||||
fun openMediaGallery()
|
fun navigateToMediaGallery()
|
||||||
fun openAdminSettings()
|
fun navigateToAdminSettings()
|
||||||
fun openPinnedMessagesList()
|
fun navigateToPinnedMessagesList()
|
||||||
fun openKnockRequestsList()
|
fun navigateToKnockRequestsList()
|
||||||
fun openSecurityAndPrivacy()
|
fun navigateToSecurityAndPrivacy()
|
||||||
fun openDmUserProfile(userId: UserId)
|
fun navigateToRoomMemberDetails(userId: UserId)
|
||||||
fun onJoinCall()
|
fun navigateToRoomCall()
|
||||||
fun openReportRoom()
|
fun navigateToReportRoom()
|
||||||
fun onSelectNewOwnersWhenLeaving()
|
fun navigateToSelectNewOwnersWhenLeaving()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callback = plugins<Callback>().first()
|
private val callback = plugins<Callback>().first()
|
||||||
|
|
@ -74,27 +74,27 @@ class RoomDetailsNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openRoomMemberList() {
|
private fun openRoomMemberList() {
|
||||||
callback.openRoomMemberList()
|
callback.navigateToRoomMemberList()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openRoomNotificationSettings() {
|
private fun openRoomNotificationSettings() {
|
||||||
callback.openRoomNotificationSettings()
|
callback.navigateToRoomNotificationSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun invitePeople() {
|
private fun invitePeople() {
|
||||||
callback.openInviteMembers()
|
callback.navigateToInviteMembers()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openPollHistory() {
|
private fun openPollHistory() {
|
||||||
callback.openPollHistory()
|
callback.navigateToPollHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openMediaGallery() {
|
private fun openMediaGallery() {
|
||||||
callback.openMediaGallery()
|
callback.navigateToMediaGallery()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onJoinCall() {
|
private fun onJoinCall() {
|
||||||
callback.onJoinCall()
|
callback.navigateToRoomCall()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CoroutineScope.onShareRoom(context: Context) = launch {
|
private fun CoroutineScope.onShareRoom(context: Context) = launch {
|
||||||
|
|
@ -113,39 +113,39 @@ class RoomDetailsNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onEditRoomDetails() {
|
private fun onEditRoomDetails() {
|
||||||
callback.editRoomDetails()
|
callback.navigateToRoomDetailsEdit()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openAvatarPreview(name: String, url: String) {
|
private fun openAvatarPreview(name: String, url: String) {
|
||||||
callback.openAvatarPreview(name, url)
|
callback.navigateToAvatarPreview(name, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openAdminSettings() {
|
private fun openAdminSettings() {
|
||||||
callback.openAdminSettings()
|
callback.navigateToAdminSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openPinnedMessages() {
|
private fun openPinnedMessages() {
|
||||||
callback.openPinnedMessagesList()
|
callback.navigateToPinnedMessagesList()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openKnockRequestsLists() {
|
private fun openKnockRequestsLists() {
|
||||||
callback.openKnockRequestsList()
|
callback.navigateToKnockRequestsList()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openSecurityAndPrivacy() {
|
private fun openSecurityAndPrivacy() {
|
||||||
callback.openSecurityAndPrivacy()
|
callback.navigateToSecurityAndPrivacy()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onProfileClick(userId: UserId) {
|
private fun onProfileClick(userId: UserId) {
|
||||||
callback.openDmUserProfile(userId)
|
callback.navigateToRoomMemberDetails(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onReportRoomClick() {
|
private fun onReportRoomClick() {
|
||||||
callback.openReportRoom()
|
callback.navigateToReportRoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSelectNewOwnersWhenLeaving() {
|
private fun onSelectNewOwnersWhenLeaving() {
|
||||||
return callback.onSelectNewOwnersWhenLeaving()
|
return callback.navigateToSelectNewOwnersWhenLeaving()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val stateFlow = launchMolecule { presenter.present() }
|
private val stateFlow = launchMolecule { presenter.present() }
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ class RoomMemberListNode(
|
||||||
private val roomMemberModerationRenderer: RoomMemberModerationRenderer,
|
private val roomMemberModerationRenderer: RoomMemberModerationRenderer,
|
||||||
) : Node(buildContext, plugins = plugins), RoomMemberListNavigator {
|
) : Node(buildContext, plugins = plugins), RoomMemberListNavigator {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun openRoomMemberDetails(roomMemberId: UserId)
|
fun navigateToRoomMemberDetails(roomMemberId: UserId)
|
||||||
fun openInviteMembers()
|
fun navigateToInviteMembers()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
@ -51,13 +51,13 @@ class RoomMemberListNode(
|
||||||
|
|
||||||
override fun openRoomMemberDetails(roomMemberId: UserId) {
|
override fun openRoomMemberDetails(roomMemberId: UserId) {
|
||||||
callbacks.forEach {
|
callbacks.forEach {
|
||||||
it.openRoomMemberDetails(roomMemberId)
|
it.navigateToRoomMemberDetails(roomMemberId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openInviteMembers() {
|
override fun openInviteMembers() {
|
||||||
callbacks.forEach {
|
callbacks.forEach {
|
||||||
it.openInviteMembers()
|
it.navigateToInviteMembers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,12 @@ class RoomMemberDetailsNode(
|
||||||
userProfileNodeHelper.onShareUser(context, permalinkBuilder)
|
userProfileNodeHelper.onShareUser(context, permalinkBuilder)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onStartDM(roomId: RoomId) {
|
fun navigateToRoom(roomId: RoomId) {
|
||||||
callback.onStartDM(roomId)
|
callback.navigateToRoom(roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onStartCall(roomId: RoomId) {
|
fun onStartCall(roomId: RoomId) {
|
||||||
callback.onStartCall(roomId)
|
callback.startCall(roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
|
@ -77,10 +77,10 @@ class RoomMemberDetailsNode(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
goBack = this::navigateUp,
|
goBack = this::navigateUp,
|
||||||
onShareUser = ::onShareUser,
|
onShareUser = ::onShareUser,
|
||||||
onOpenDm = ::onStartDM,
|
onOpenDm = ::navigateToRoom,
|
||||||
onStartCall = ::onStartCall,
|
onStartCall = ::onStartCall,
|
||||||
openAvatarPreview = callback::openAvatarPreview,
|
openAvatarPreview = callback::navigateToAvatarPreview,
|
||||||
onVerifyClick = callback::onVerifyUser,
|
onVerifyClick = callback::startVerifyUserFlow,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@ class RoomNotificationSettingsNode(
|
||||||
val showUserDefinedSettingStyle: Boolean
|
val showUserDefinedSettingStyle: Boolean
|
||||||
) : NodeInputs
|
) : NodeInputs
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun openGlobalNotificationSettings()
|
fun navigateToGlobalNotificationSettings()
|
||||||
}
|
}
|
||||||
private val inputs = inputs<RoomNotificationSettingInput>()
|
private val inputs = inputs<RoomNotificationSettingInput>()
|
||||||
private val callbacks = plugins<Callback>()
|
private val callbacks = plugins<Callback>()
|
||||||
|
|
||||||
private fun openGlobalNotificationSettings() {
|
private fun navigateToGlobalNotificationSettings() {
|
||||||
callbacks.forEach { it.openGlobalNotificationSettings() }
|
callbacks.forEach { it.navigateToGlobalNotificationSettings() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val presenter = presenterFactory.create(inputs.showUserDefinedSettingStyle)
|
private val presenter = presenterFactory.create(inputs.showUserDefinedSettingStyle)
|
||||||
|
|
@ -59,7 +59,7 @@ class RoomNotificationSettingsNode(
|
||||||
RoomNotificationSettingsView(
|
RoomNotificationSettingsView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onShowGlobalNotifications = this::openGlobalNotificationSettings,
|
onShowGlobalNotifications = this::navigateToGlobalNotificationSettings,
|
||||||
onBackClick = this::navigateUp,
|
onBackClick = this::navigateUp,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,10 +94,10 @@ class DefaultRoomDetailsEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : RoomDetailsEntryPoint.Callback {
|
val callback = object : RoomDetailsEntryPoint.Callback {
|
||||||
override fun onOpenGlobalNotificationSettings() = lambdaError()
|
override fun navigateToGlobalNotificationSettings() = lambdaError()
|
||||||
override fun onOpenRoom(roomId: RoomId, serverNames: List<String>) = lambdaError()
|
override fun navigateToRoom(roomId: RoomId, serverNames: List<String>) = lambdaError()
|
||||||
override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError()
|
override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError()
|
||||||
override fun forwardEvent(eventId: EventId) = lambdaError()
|
override fun startForwardEventFlow(eventId: EventId) = lambdaError()
|
||||||
}
|
}
|
||||||
val params = RoomDetailsEntryPoint.Params(
|
val params = RoomDetailsEntryPoint.Params(
|
||||||
initialElement = RoomDetailsEntryPoint.InitialTarget.RoomDetails,
|
initialElement = RoomDetailsEntryPoint.InitialTarget.RoomDetails,
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ interface RoomDirectoryEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onResultClick(roomDescription: RoomDescription)
|
fun navigateToRoom(roomDescription: RoomDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class RoomDirectoryNode(
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
private fun onResultClick(roomDescription: RoomDescription) {
|
private fun onResultClick(roomDescription: RoomDescription) {
|
||||||
plugins<RoomDirectoryEntryPoint.Callback>().forEach {
|
plugins<RoomDirectoryEntryPoint.Callback>().forEach {
|
||||||
it.onResultClick(roomDescription)
|
it.navigateToRoom(roomDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class DefaultRoomDirectoryEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : RoomDirectoryEntryPoint.Callback {
|
val callback = object : RoomDirectoryEntryPoint.Callback {
|
||||||
override fun onResultClick(roomDescription: RoomDescription) = lambdaError()
|
override fun navigateToRoom(roomDescription: RoomDescription) = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
|
|
||||||
|
|
@ -77,19 +77,19 @@ class SecureBackupFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : SecureBackupRootNode.Callback {
|
val callback = object : SecureBackupRootNode.Callback {
|
||||||
override fun onSetupClick() {
|
override fun navigateToSetup() {
|
||||||
backstack.push(NavTarget.Setup)
|
backstack.push(NavTarget.Setup)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChangeClick() {
|
override fun navigateToChange() {
|
||||||
backstack.push(NavTarget.Change)
|
backstack.push(NavTarget.Change)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDisableClick() {
|
override fun navigateToDisable() {
|
||||||
backstack.push(NavTarget.Disable)
|
backstack.push(NavTarget.Disable)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onConfirmRecoveryKeyClick() {
|
override fun navigateToEnterRecoveryKey() {
|
||||||
backstack.push(NavTarget.EnterRecoveryKey)
|
backstack.push(NavTarget.EnterRecoveryKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,26 +32,26 @@ class SecureBackupRootNode(
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onSetupClick()
|
fun navigateToSetup()
|
||||||
fun onChangeClick()
|
fun navigateToChange()
|
||||||
fun onDisableClick()
|
fun navigateToDisable()
|
||||||
fun onConfirmRecoveryKeyClick()
|
fun navigateToEnterRecoveryKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSetupClick() {
|
private fun onSetupClick() {
|
||||||
plugins<Callback>().forEach { it.onSetupClick() }
|
plugins<Callback>().forEach { it.navigateToSetup() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onChangeClick() {
|
private fun onChangeClick() {
|
||||||
plugins<Callback>().forEach { it.onChangeClick() }
|
plugins<Callback>().forEach { it.navigateToChange() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onDisableClick() {
|
private fun onDisableClick() {
|
||||||
plugins<Callback>().forEach { it.onDisableClick() }
|
plugins<Callback>().forEach { it.navigateToDisable() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onConfirmRecoveryKeyClick() {
|
private fun onConfirmRecoveryKeyClick() {
|
||||||
plugins<Callback>().forEach { it.onConfirmRecoveryKeyClick() }
|
plugins<Callback>().forEach { it.navigateToEnterRecoveryKey() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLearnMoreClick(uriHandler: UriHandler) {
|
private fun onLearnMoreClick(uriHandler: UriHandler) {
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@ interface SpaceEntryPoint : FeatureEntryPoint {
|
||||||
) : NodeInputs
|
) : NodeInputs
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomId: RoomId, viaParameters: List<String>)
|
fun navigateToRoom(roomId: RoomId, viaParameters: List<String>)
|
||||||
fun onOpenDetails()
|
fun navigateToRoomDetails()
|
||||||
|
fun navigateToRoomMemberList()
|
||||||
fun onOpenMemberList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,19 +80,19 @@ class SpaceFlowNode(
|
||||||
}
|
}
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : SpaceNode.Callback {
|
val callback = object : SpaceNode.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId, viaParameters: List<String>) {
|
override fun navigateToRoom(roomId: RoomId, viaParameters: List<String>) {
|
||||||
callback.onOpenRoom(roomId, viaParameters)
|
callback.navigateToRoom(roomId, viaParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenDetails() {
|
override fun navigateToRoomDetails() {
|
||||||
callback.onOpenDetails()
|
callback.navigateToRoomDetails()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenMemberList() {
|
override fun onOpenMemberList() {
|
||||||
callback.onOpenMemberList()
|
callback.navigateToRoomMemberList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLeaveSpace() {
|
override fun startLeaveSpaceFlow() {
|
||||||
backstack.push(NavTarget.Leave)
|
backstack.push(NavTarget.Leave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,10 @@ class SpaceNode(
|
||||||
private val acceptDeclineInviteView: AcceptDeclineInviteView,
|
private val acceptDeclineInviteView: AcceptDeclineInviteView,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomId: RoomId, viaParameters: List<String>)
|
fun navigateToRoom(roomId: RoomId, viaParameters: List<String>)
|
||||||
fun onOpenDetails()
|
fun navigateToRoomDetails()
|
||||||
|
|
||||||
fun onOpenMemberList()
|
fun onOpenMemberList()
|
||||||
fun onLeaveSpace()
|
fun startLeaveSpaceFlow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val callback = plugins.filterIsInstance<Callback>().single()
|
private val callback = plugins.filterIsInstance<Callback>().single()
|
||||||
|
|
@ -74,13 +73,13 @@ class SpaceNode(
|
||||||
state = state,
|
state = state,
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
onLeaveSpaceClick = {
|
onLeaveSpaceClick = {
|
||||||
callback.onLeaveSpace()
|
callback.startLeaveSpaceFlow()
|
||||||
},
|
},
|
||||||
onRoomClick = { spaceRoom ->
|
onRoomClick = { spaceRoom ->
|
||||||
callback.onOpenRoom(spaceRoom.roomId, spaceRoom.via)
|
callback.navigateToRoom(spaceRoom.roomId, spaceRoom.via)
|
||||||
},
|
},
|
||||||
onDetailsClick = {
|
onDetailsClick = {
|
||||||
callback.onOpenDetails()
|
callback.navigateToRoomDetails()
|
||||||
},
|
},
|
||||||
onShareSpace = {
|
onShareSpace = {
|
||||||
onShareRoom(context)
|
onShareRoom(context)
|
||||||
|
|
@ -92,7 +91,7 @@ class SpaceNode(
|
||||||
acceptDeclineInviteView.Render(
|
acceptDeclineInviteView.Render(
|
||||||
state = state.acceptDeclineInviteState,
|
state = state.acceptDeclineInviteState,
|
||||||
onAcceptInviteSuccess = { roomId ->
|
onAcceptInviteSuccess = { roomId ->
|
||||||
callback.onOpenRoom(roomId, emptyList())
|
callback.navigateToRoom(roomId, emptyList())
|
||||||
},
|
},
|
||||||
onDeclineInviteSuccess = { roomId ->
|
onDeclineInviteSuccess = { roomId ->
|
||||||
// No action needed
|
// No action needed
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@ class DefaultSpaceEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : SpaceEntryPoint.Callback {
|
val callback = object : SpaceEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId, viaParameters: List<String>) = lambdaError()
|
override fun navigateToRoom(roomId: RoomId, viaParameters: List<String>) = lambdaError()
|
||||||
override fun onOpenDetails() = lambdaError()
|
override fun navigateToRoomDetails() = lambdaError()
|
||||||
override fun onOpenMemberList() = lambdaError()
|
override fun navigateToRoomMemberList() = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.inputs(nodeInputs)
|
.inputs(nodeInputs)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ interface StartChatEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||||
fun onOpenRoomDirectory()
|
fun navigateToRoomDirectory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import io.element.android.libraries.architecture.overlay.operation.show
|
||||||
import io.element.android.libraries.matrix.api.core.RoomIdOrAlias
|
import io.element.android.libraries.matrix.api.core.RoomIdOrAlias
|
||||||
|
|
||||||
interface StartChatNavigator : Plugin {
|
interface StartChatNavigator : Plugin {
|
||||||
fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>)
|
||||||
fun onCreateNewRoom()
|
fun onCreateNewRoom()
|
||||||
fun onShowJoinRoomByAddress()
|
fun onShowJoinRoomByAddress()
|
||||||
fun onDismissJoinRoomByAddress()
|
fun onDismissJoinRoomByAddress()
|
||||||
|
|
@ -30,7 +30,8 @@ class DefaultStartChatNavigator(
|
||||||
private val openRoom: (RoomIdOrAlias, List<String>) -> Unit,
|
private val openRoom: (RoomIdOrAlias, List<String>) -> Unit,
|
||||||
private val openRoomDirectory: () -> Unit,
|
private val openRoomDirectory: () -> Unit,
|
||||||
) : StartChatNavigator {
|
) : StartChatNavigator {
|
||||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = openRoom(roomIdOrAlias, serverNames)
|
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) =
|
||||||
|
openRoom(roomIdOrAlias, serverNames)
|
||||||
|
|
||||||
override fun onOpenRoomDirectory() = openRoomDirectory()
|
override fun onOpenRoomDirectory() = openRoomDirectory()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@ class StartChatFlowNode(
|
||||||
backstack = backstack,
|
backstack = backstack,
|
||||||
overlay = overlay,
|
overlay = overlay,
|
||||||
openRoom = { roomIdOrAlias, viaServers ->
|
openRoom = { roomIdOrAlias, viaServers ->
|
||||||
plugins<StartChatEntryPoint.Callback>().forEach { it.onOpenRoom(roomIdOrAlias, viaServers) }
|
plugins<StartChatEntryPoint.Callback>().forEach { it.onRoomCreated(roomIdOrAlias, viaServers) }
|
||||||
},
|
},
|
||||||
openRoomDirectory = {
|
openRoomDirectory = {
|
||||||
plugins<StartChatEntryPoint.Callback>().forEach { it.onOpenRoomDirectory() }
|
plugins<StartChatEntryPoint.Callback>().forEach { it.navigateToRoomDirectory() }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ class StartChatFlowNode(
|
||||||
NavTarget.NewRoom -> {
|
NavTarget.NewRoom -> {
|
||||||
val callback = object : CreateRoomEntryPoint.Callback {
|
val callback = object : CreateRoomEntryPoint.Callback {
|
||||||
override fun onRoomCreated(roomId: RoomId) {
|
override fun onRoomCreated(roomId: RoomId) {
|
||||||
navigator.onOpenRoom(roomId.toRoomIdOrAlias(), emptyList())
|
navigator.onRoomCreated(roomId.toRoomIdOrAlias(), emptyList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createRoomEntryPoint.nodeBuilder(parentNode = this, buildContext = buildContext)
|
createRoomEntryPoint.nodeBuilder(parentNode = this, buildContext = buildContext)
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class JoinRoomByAddressPresenter(
|
||||||
|
|
||||||
private fun onRoomFound(state: RoomAddressState.RoomFound) {
|
private fun onRoomFound(state: RoomAddressState.RoomFound) {
|
||||||
navigator.onDismissJoinRoomByAddress()
|
navigator.onDismissJoinRoomByAddress()
|
||||||
navigator.onOpenRoom(
|
navigator.onRoomCreated(
|
||||||
roomIdOrAlias = state.resolved.roomId.toRoomIdOrAlias(),
|
roomIdOrAlias = state.resolved.roomId.toRoomIdOrAlias(),
|
||||||
serverNames = state.resolved.servers
|
serverNames = state.resolved.servers
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class StartChatNode(
|
||||||
onCloseClick = this::navigateUp,
|
onCloseClick = this::navigateUp,
|
||||||
onNewRoomClick = navigator::onCreateNewRoom,
|
onNewRoomClick = navigator::onCreateNewRoom,
|
||||||
onOpenDM = {
|
onOpenDM = {
|
||||||
navigator.onOpenRoom(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList())
|
navigator.onRoomCreated(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList())
|
||||||
},
|
},
|
||||||
onJoinByAddressClick = navigator::onShowJoinRoomByAddress,
|
onJoinByAddressClick = navigator::onShowJoinRoomByAddress,
|
||||||
onInviteFriendsClick = { invitePeople(activity) },
|
onInviteFriendsClick = { invitePeople(activity) },
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ class DefaultStartChatEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : StartChatEntryPoint.Callback {
|
val callback = object : StartChatEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = lambdaError()
|
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) = lambdaError()
|
||||||
override fun onOpenRoomDirectory() = lambdaError()
|
override fun navigateToRoomDirectory() = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class FakeStartChatNavigator(
|
||||||
private val dismissJoinRoomByAddressLambda: () -> Unit = {},
|
private val dismissJoinRoomByAddressLambda: () -> Unit = {},
|
||||||
private val openRoomDirectoryLambda: () -> Unit = {},
|
private val openRoomDirectoryLambda: () -> Unit = {},
|
||||||
) : StartChatNavigator {
|
) : StartChatNavigator {
|
||||||
override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List<String>) {
|
||||||
openRoomLambda(roomIdOrAlias, serverNames)
|
openRoomLambda(roomIdOrAlias, serverNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ interface UserProfileEntryPoint : FeatureEntryPoint {
|
||||||
data class Params(val userId: UserId) : NodeInputs
|
data class Params(val userId: UserId) : NodeInputs
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onOpenRoom(roomId: RoomId)
|
fun navigateToRoom(roomId: RoomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
|
|
|
||||||
|
|
@ -73,19 +73,19 @@ class UserProfileFlowNode(
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.Root -> {
|
NavTarget.Root -> {
|
||||||
val callback = object : UserProfileNodeHelper.Callback {
|
val callback = object : UserProfileNodeHelper.Callback {
|
||||||
override fun openAvatarPreview(username: String, avatarUrl: String) {
|
override fun navigateToAvatarPreview(username: String, avatarUrl: String) {
|
||||||
backstack.push(NavTarget.AvatarPreview(username, avatarUrl))
|
backstack.push(NavTarget.AvatarPreview(username, avatarUrl))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartDM(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
plugins<UserProfileEntryPoint.Callback>().forEach { it.onOpenRoom(roomId) }
|
plugins<UserProfileEntryPoint.Callback>().forEach { it.navigateToRoom(roomId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartCall(dmRoomId: RoomId) {
|
override fun startCall(dmRoomId: RoomId) {
|
||||||
elementCallEntryPoint.startCall(CallType.RoomCall(sessionId = sessionId, roomId = dmRoomId))
|
elementCallEntryPoint.startCall(CallType.RoomCall(sessionId = sessionId, roomId = dmRoomId))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onVerifyUser(userId: UserId) {
|
override fun startVerifyUserFlow(userId: UserId) {
|
||||||
backstack.push(NavTarget.VerifyUser(userId))
|
backstack.push(NavTarget.VerifyUser(userId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,11 +98,11 @@ class UserProfileFlowNode(
|
||||||
backstack.pop()
|
backstack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
// Cannot happen
|
// Cannot happen
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
// Cannot happen
|
// Cannot happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class UserProfileNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onStartDM(roomId: RoomId) {
|
fun onStartDM(roomId: RoomId) {
|
||||||
callback.onStartDM(roomId)
|
callback.navigateToRoom(roomId)
|
||||||
}
|
}
|
||||||
|
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
|
@ -74,9 +74,9 @@ class UserProfileNode(
|
||||||
goBack = this::navigateUp,
|
goBack = this::navigateUp,
|
||||||
onShareUser = ::onShareUser,
|
onShareUser = ::onShareUser,
|
||||||
onOpenDm = ::onStartDM,
|
onOpenDm = ::onStartDM,
|
||||||
onStartCall = callback::onStartCall,
|
onStartCall = callback::startCall,
|
||||||
openAvatarPreview = callback::openAvatarPreview,
|
openAvatarPreview = callback::navigateToAvatarPreview,
|
||||||
onVerifyClick = callback::onVerifyUser,
|
onVerifyClick = callback::startVerifyUserFlow,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class DefaultUserProfileEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : UserProfileEntryPoint.Callback {
|
val callback = object : UserProfileEntryPoint.Callback {
|
||||||
override fun onOpenRoom(roomId: RoomId) {
|
override fun navigateToRoom(roomId: RoomId) {
|
||||||
lambdaError()
|
lambdaError()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ class UserProfileNodeHelper(
|
||||||
private val userId: UserId,
|
private val userId: UserId,
|
||||||
) {
|
) {
|
||||||
interface Callback : NodeInputs {
|
interface Callback : NodeInputs {
|
||||||
fun openAvatarPreview(username: String, avatarUrl: String)
|
fun navigateToAvatarPreview(username: String, avatarUrl: String)
|
||||||
fun onStartDM(roomId: RoomId)
|
fun navigateToRoom(roomId: RoomId)
|
||||||
fun onStartCall(dmRoomId: RoomId)
|
fun startCall(dmRoomId: RoomId)
|
||||||
fun onVerifyUser(userId: UserId)
|
fun startVerifyUserFlow(userId: UserId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onShareUser(
|
fun onShareUser(
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ interface OutgoingVerificationEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onLearnMoreAboutEncryption()
|
fun navigateToLearnMoreAboutEncryption()
|
||||||
fun onBack()
|
fun onBack()
|
||||||
fun onDone()
|
fun onDone()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class OutgoingVerificationNode(
|
||||||
OutgoingVerificationView(
|
OutgoingVerificationView(
|
||||||
state = state,
|
state = state,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
onLearnMoreClick = callback::onLearnMoreAboutEncryption,
|
onLearnMoreClick = callback::navigateToLearnMoreAboutEncryption,
|
||||||
onFinish = callback::onDone,
|
onFinish = callback::onDone,
|
||||||
onBack = callback::onBack,
|
onBack = callback::onBack,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class DefaultOutgoingVerificationEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : OutgoingVerificationEntryPoint.Callback {
|
val callback = object : OutgoingVerificationEntryPoint.Callback {
|
||||||
override fun onLearnMoreAboutEncryption() = lambdaError()
|
override fun navigateToLearnMoreAboutEncryption() = lambdaError()
|
||||||
override fun onBack() = lambdaError()
|
override fun onBack() = lambdaError()
|
||||||
override fun onDone() = lambdaError()
|
override fun onDone() = lambdaError()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class ViewFolderNode(
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onBackClick()
|
fun onBackClick()
|
||||||
fun onNavigateTo(item: Item)
|
fun navigateToItem(item: Item)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inputs: Inputs = inputs()
|
private val inputs: Inputs = inputs()
|
||||||
|
|
@ -50,7 +50,7 @@ class ViewFolderNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onNavigateTo(item: Item) {
|
private fun onNavigateTo(item: Item) {
|
||||||
plugins<Callback>().forEach { it.onNavigateTo(item) }
|
plugins<Callback>().forEach { it.navigateToItem(item) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ class ViewFolderFlowNode(
|
||||||
onDone()
|
onDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNavigateTo(item: Item) {
|
override fun navigateToItem(item: Item) {
|
||||||
when (item) {
|
when (item) {
|
||||||
Item.Parent -> {
|
Item.Parent -> {
|
||||||
// Should not happen when in Root since parent is not accessible from root (canGoUp set to false)
|
// Should not happen when in Root since parent is not accessible from root (canGoUp set to false)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ interface AccountSelectEntryPoint : FeatureEntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onSelectAccount(sessionId: SessionId)
|
fun onAccountSelected(sessionId: SessionId)
|
||||||
fun onCancel()
|
fun onCancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ class AccountSelectNode(
|
||||||
callbacks.forEach { it.onCancel() }
|
callbacks.forEach { it.onCancel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSelectAccount(sessionId: SessionId) {
|
private fun onAccountSelected(sessionId: SessionId) {
|
||||||
callbacks.forEach { it.onSelectAccount(sessionId) }
|
callbacks.forEach { it.onAccountSelected(sessionId) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -42,7 +42,7 @@ class AccountSelectNode(
|
||||||
AccountSelectView(
|
AccountSelectView(
|
||||||
state = state,
|
state = state,
|
||||||
onDismiss = ::onDismiss,
|
onDismiss = ::onDismiss,
|
||||||
onSelectAccount = ::onSelectAccount,
|
onSelectAccount = ::onAccountSelected,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class DefaultAccountSelectEntryPointTest {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val callback = object : AccountSelectEntryPoint.Callback {
|
val callback = object : AccountSelectEntryPoint.Callback {
|
||||||
override fun onSelectAccount(sessionId: SessionId) = lambdaError()
|
override fun onAccountSelected(sessionId: SessionId) = lambdaError()
|
||||||
override fun onCancel() = lambdaError()
|
override fun onCancel() = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ interface MediaGalleryEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onBackClick()
|
fun onBackClick()
|
||||||
fun onViewInTimeline(eventId: EventId)
|
fun viewInTimeline(eventId: EventId)
|
||||||
fun forwardEvent(eventId: EventId)
|
fun forward(eventId: EventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ interface MediaViewerEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun onViewInTimeline(eventId: EventId)
|
fun viewInTimeline(eventId: EventId)
|
||||||
fun onForwardEvent(eventId: EventId)
|
fun forwardEvent(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Params(
|
data class Params(
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ class MediaGalleryNode(
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onBackClick()
|
fun onBackClick()
|
||||||
fun onItemClick(item: MediaItem.Event)
|
fun showItem(item: MediaItem.Event)
|
||||||
fun onViewInTimeline(eventId: EventId)
|
fun viewInTimeline(eventId: EventId)
|
||||||
fun onForward(eventId: EventId)
|
fun forward(eventId: EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onBackClick() {
|
private fun onBackClick() {
|
||||||
|
|
@ -51,19 +51,19 @@ class MediaGalleryNode(
|
||||||
|
|
||||||
override fun onViewInTimelineClick(eventId: EventId) {
|
override fun onViewInTimelineClick(eventId: EventId) {
|
||||||
plugins<Callback>().forEach {
|
plugins<Callback>().forEach {
|
||||||
it.onViewInTimeline(eventId)
|
it.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardClick(eventId: EventId) {
|
override fun onForwardClick(eventId: EventId) {
|
||||||
plugins<Callback>().forEach {
|
plugins<Callback>().forEach {
|
||||||
it.onForward(eventId)
|
it.forward(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onItemClick(item: MediaItem.Event) {
|
private fun onItemClick(item: MediaItem.Event) {
|
||||||
plugins<Callback>().forEach {
|
plugins<Callback>().forEach {
|
||||||
it.onItemClick(item)
|
it.showItem(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,13 +78,13 @@ class MediaGalleryFlowNode(
|
||||||
|
|
||||||
private fun onViewInTimeline(eventId: EventId) {
|
private fun onViewInTimeline(eventId: EventId) {
|
||||||
plugins<MediaGalleryEntryPoint.Callback>().forEach {
|
plugins<MediaGalleryEntryPoint.Callback>().forEach {
|
||||||
it.onViewInTimeline(eventId)
|
it.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun forwardEvent(eventId: EventId) {
|
private fun forwardEvent(eventId: EventId) {
|
||||||
plugins<MediaGalleryEntryPoint.Callback>().forEach {
|
plugins<MediaGalleryEntryPoint.Callback>().forEach {
|
||||||
it.forwardEvent(eventId)
|
it.forward(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,15 +96,15 @@ class MediaGalleryFlowNode(
|
||||||
this@MediaGalleryFlowNode.onBackClick()
|
this@MediaGalleryFlowNode.onBackClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
this@MediaGalleryFlowNode.onViewInTimeline(eventId)
|
this@MediaGalleryFlowNode.onViewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForward(eventId: EventId) {
|
override fun forward(eventId: EventId) {
|
||||||
forwardEvent(eventId)
|
forwardEvent(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClick(item: MediaItem.Event) {
|
override fun showItem(item: MediaItem.Event) {
|
||||||
val mode = when (item) {
|
val mode = when (item) {
|
||||||
is MediaItem.Audio,
|
is MediaItem.Audio,
|
||||||
is MediaItem.Voice,
|
is MediaItem.Voice,
|
||||||
|
|
@ -131,13 +131,13 @@ class MediaGalleryFlowNode(
|
||||||
overlay.hide()
|
overlay.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewInTimeline(eventId: EventId) {
|
override fun viewInTimeline(eventId: EventId) {
|
||||||
this@MediaGalleryFlowNode.onViewInTimeline(eventId)
|
this@MediaGalleryFlowNode.onViewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardEvent(eventId: EventId) {
|
override fun forwardEvent(eventId: EventId) {
|
||||||
// Need to go to the parent because of the overlay
|
// Need to go to the parent because of the overlay
|
||||||
forwardEvent(eventId)
|
this@MediaGalleryFlowNode.forwardEvent(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mediaViewerEntryPoint.nodeBuilder(this, buildContext)
|
mediaViewerEntryPoint.nodeBuilder(this, buildContext)
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ class MediaViewerNode(
|
||||||
|
|
||||||
override fun onViewInTimelineClick(eventId: EventId) {
|
override fun onViewInTimelineClick(eventId: EventId) {
|
||||||
plugins<MediaViewerEntryPoint.Callback>().forEach {
|
plugins<MediaViewerEntryPoint.Callback>().forEach {
|
||||||
it.onViewInTimeline(eventId)
|
it.viewInTimeline(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onForwardClick(eventId: EventId) {
|
override fun onForwardClick(eventId: EventId) {
|
||||||
plugins<MediaViewerEntryPoint.Callback>().forEach {
|
plugins<MediaViewerEntryPoint.Callback>().forEach {
|
||||||
it.onForwardEvent(eventId)
|
it.forwardEvent(eventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ class DefaultMediaGalleryEntryPointTest {
|
||||||
}
|
}
|
||||||
val callback = object : MediaGalleryEntryPoint.Callback {
|
val callback = object : MediaGalleryEntryPoint.Callback {
|
||||||
override fun onBackClick() = lambdaError()
|
override fun onBackClick() = lambdaError()
|
||||||
override fun onViewInTimeline(eventId: EventId) = lambdaError()
|
override fun viewInTimeline(eventId: EventId) = lambdaError()
|
||||||
override fun forwardEvent(eventId: EventId) = lambdaError()
|
override fun forward(eventId: EventId) = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.callback(callback)
|
.callback(callback)
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ class DefaultMediaViewerEntryPointTest {
|
||||||
}
|
}
|
||||||
val callback = object : MediaViewerEntryPoint.Callback {
|
val callback = object : MediaViewerEntryPoint.Callback {
|
||||||
override fun onDone() = lambdaError()
|
override fun onDone() = lambdaError()
|
||||||
override fun onViewInTimeline(eventId: EventId) = lambdaError()
|
override fun viewInTimeline(eventId: EventId) = lambdaError()
|
||||||
override fun onForwardEvent(eventId: EventId) = lambdaError()
|
override fun forwardEvent(eventId: EventId) = lambdaError()
|
||||||
}
|
}
|
||||||
val params = createMediaViewerEntryPointParams()
|
val params = createMediaViewerEntryPointParams()
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
|
|
@ -115,8 +115,8 @@ class DefaultMediaViewerEntryPointTest {
|
||||||
}
|
}
|
||||||
val callback = object : MediaViewerEntryPoint.Callback {
|
val callback = object : MediaViewerEntryPoint.Callback {
|
||||||
override fun onDone() = lambdaError()
|
override fun onDone() = lambdaError()
|
||||||
override fun onViewInTimeline(eventId: EventId) = lambdaError()
|
override fun viewInTimeline(eventId: EventId) = lambdaError()
|
||||||
override fun onForwardEvent(eventId: EventId) = lambdaError()
|
override fun forwardEvent(eventId: EventId) = lambdaError()
|
||||||
}
|
}
|
||||||
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null))
|
||||||
.avatar(
|
.avatar(
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class RoomSelectNode(
|
||||||
callbacks.forEach { it.onCancel() }
|
callbacks.forEach { it.onCancel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSubmit(roomIds: List<RoomId>) {
|
private fun onRoomSelected(roomIds: List<RoomId>) {
|
||||||
callbacks.forEach { it.onRoomSelected(roomIds) }
|
callbacks.forEach { it.onRoomSelected(roomIds) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ class RoomSelectNode(
|
||||||
RoomSelectView(
|
RoomSelectView(
|
||||||
state = state,
|
state = state,
|
||||||
onDismiss = ::onDismiss,
|
onDismiss = ::onDismiss,
|
||||||
onSubmit = ::onSubmit,
|
onSubmit = ::onRoomSelected,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ interface NotificationTroubleShootEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun openIgnoredUsers()
|
fun navigateToBlockedUsers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,6 @@ interface PushHistoryEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onDone()
|
fun onDone()
|
||||||
fun navigateTo(roomId: RoomId, eventId: EventId)
|
fun navigateToEvent(roomId: RoomId, eventId: EventId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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