From 09a18ad7ca8787968c1ece9f7b2360417d40e403 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 29 Oct 2025 10:30:30 +0100 Subject: [PATCH] Rename fun in Callback for clarity. --- .../appnav/LoggedInAppScopeFlowNode.kt | 12 +- .../android/appnav/LoggedInFlowNode.kt | 54 ++++----- .../android/appnav/NotLoggedInFlowNode.kt | 6 +- .../io/element/android/appnav/RootFlowNode.kt | 8 +- .../room/joined/JoinedRoomLoadedFlowNode.kt | 42 +++---- .../appnav/JoinedRoomLoadedFlowNodeTest.kt | 2 +- .../FtueSessionVerificationFlowNode.kt | 11 +- .../ChooseSelfVerificationModeNode.kt | 16 +-- .../features/home/api/HomeEntryPoint.kt | 14 +-- .../features/home/impl/HomeFlowNode.kt | 14 +-- .../home/impl/DefaultHomeEntryPointTest.kt | 14 +-- .../licenses/impl/DependenciesFlowNode.kt | 2 +- .../impl/list/DependencyLicensesListNode.kt | 4 +- .../settings/LockScreenSettingsFlowNode.kt | 2 +- .../impl/settings/LockScreenSettingsNode.kt | 4 +- .../features/login/api/LoginEntryPoint.kt | 2 +- .../features/login/impl/LoginFlowNode.kt | 32 +++--- .../login/impl/qrcode/QrCodeLoginFlowNode.kt | 8 +- .../ChangeAccountProviderNode.kt | 4 +- .../ChooseAccountProviderNode.kt | 12 +- .../ConfirmAccountProviderNode.kt | 16 +-- .../impl/screens/onboarding/OnBoardingNode.kt | 28 ++--- .../screens/qrcode/intro/QrCodeIntroNode.kt | 8 +- .../screens/qrcode/scan/QrCodeScanNode.kt | 8 +- .../login/impl/DefaultLoginEntryPointTest.kt | 2 +- .../features/logout/api/LogoutEntryPoint.kt | 2 +- .../features/logout/impl/LogoutNode.kt | 2 +- .../impl/DefaultLogoutEntryPointTest.kt | 2 +- .../messages/api/MessagesEntryPoint.kt | 8 +- .../messages/impl/MessagesFlowNode.kt | 98 ++++++++-------- .../messages/impl/MessagesNavigator.kt | 14 +-- .../features/messages/impl/MessagesNode.kt | 108 +++++++++--------- .../messages/impl/MessagesPresenter.kt | 10 +- .../MessageComposerPresenter.kt | 2 +- .../list/PinnedMessagesListNavigator.kt | 6 +- .../pinned/list/PinnedMessagesListNode.kt | 40 +++---- .../list/PinnedMessagesListPresenter.kt | 6 +- .../impl/threads/ThreadedMessagesNode.kt | 82 ++++++------- .../impl/timeline/TimelinePresenter.kt | 10 +- .../impl/DefaultMessagesEntryPointTest.kt | 8 +- .../messages/impl/FakeMessagesNavigator.kt | 14 +-- .../list/FakePinnedMessagesListNavigator.kt | 6 +- .../poll/impl/history/PollHistoryFlowNode.kt | 2 +- .../poll/impl/history/PollHistoryNode.kt | 4 +- .../preferences/api/PreferencesEntryPoint.kt | 10 +- .../preferences/impl/PreferencesFlowNode.kt | 56 ++++----- .../preferences/impl/about/AboutNode.kt | 4 +- .../impl/developer/DeveloperSettingsNode.kt | 8 +- .../notifications/NotificationSettingsNode.kt | 16 +-- .../EditDefaultNotificationSettingNode.kt | 8 +- .../impl/root/PreferencesRootNode.kt | 56 ++++----- .../impl/DefaultPreferencesEntryPointTest.kt | 10 +- .../impl/bugreport/BugReportFlowNode.kt | 2 +- .../rageshake/impl/bugreport/BugReportNode.kt | 4 +- .../roomdetails/api/RoomDetailsEntryPoint.kt | 8 +- .../roomdetails/impl/RoomDetailsFlowNode.kt | 76 ++++++------ .../roomdetails/impl/RoomDetailsNode.kt | 60 +++++----- .../impl/members/RoomMemberListNode.kt | 8 +- .../members/details/RoomMemberDetailsNode.kt | 12 +- .../RoomNotificationSettingsNode.kt | 8 +- .../impl/DefaultRoomDetailsEntryPointTest.kt | 8 +- .../api/RoomDirectoryEntryPoint.kt | 2 +- .../impl/root/RoomDirectoryNode.kt | 2 +- .../DefaultRoomDirectoryEntryPointTest.kt | 2 +- .../securebackup/impl/SecureBackupFlowNode.kt | 8 +- .../impl/root/SecureBackupRootNode.kt | 16 +-- .../features/space/api/SpaceEntryPoint.kt | 7 +- .../features/space/impl/SpaceFlowNode.kt | 12 +- .../features/space/impl/root/SpaceNode.kt | 15 ++- .../space/impl/DefaultSpaceEntryPointTest.kt | 6 +- .../startchat/api/StartChatEntryPoint.kt | 4 +- .../features/startchat/StartChatNavigator.kt | 5 +- .../startchat/impl/StartChatFlowNode.kt | 6 +- .../JoinRoomByAddressPresenter.kt | 2 +- .../startchat/impl/root/StartChatNode.kt | 2 +- .../impl/DefaultStartChatEntryPointTest.kt | 4 +- .../startchat/impl/FakeStartChatNavigator.kt | 2 +- .../userprofile/api/UserProfileEntryPoint.kt | 2 +- .../userprofile/impl/UserProfileFlowNode.kt | 14 +-- .../userprofile/impl/root/UserProfileNode.kt | 8 +- .../impl/DefaultUserProfileEntryPointTest.kt | 2 +- .../shared/UserProfileNodeHelper.kt | 8 +- .../api/OutgoingVerificationEntryPoint.kt | 2 +- .../impl/outgoing/OutgoingVerificationNode.kt | 2 +- ...faultOutgoingVerificationEntryPointTest.kt | 2 +- .../viewfolder/impl/folder/ViewFolderNode.kt | 4 +- .../impl/root/ViewFolderFlowNode.kt | 2 +- .../api/AccountSelectEntryPoint.kt | 2 +- .../accountselect/impl/AccountSelectNode.kt | 6 +- .../DefaultAccountSelectEntryPointTest.kt | 2 +- .../mediaviewer/api/MediaGalleryEntryPoint.kt | 4 +- .../mediaviewer/api/MediaViewerEntryPoint.kt | 4 +- .../impl/gallery/MediaGalleryNode.kt | 12 +- .../impl/gallery/root/MediaGalleryFlowNode.kt | 16 +-- .../impl/viewer/MediaViewerNode.kt | 4 +- .../impl/DefaultMediaGalleryEntryPointTest.kt | 4 +- .../impl/DefaultMediaViewerEntryPointTest.kt | 8 +- .../roomselect/impl/RoomSelectNode.kt | 4 +- .../api/NotificationTroubleShootEntryPoint.kt | 2 +- .../troubleshoot/api/PushHistoryEntryPoint.kt | 2 +- .../impl/TroubleshootNotificationsNode.kt | 2 +- .../impl/history/PushHistoryNode.kt | 2 +- ...tNotificationTroubleShootEntryPointTest.kt | 2 +- .../DefaultPushHistoryEntryPointTest.kt | 2 +- 104 files changed, 658 insertions(+), 664 deletions(-) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInAppScopeFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInAppScopeFlowNode.kt index 9ae5aa38fe..47681dc624 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInAppScopeFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInAppScopeFlowNode.kt @@ -56,8 +56,8 @@ class LoggedInAppScopeFlowNode( plugins = plugins ), DependencyInjectionGraphOwner { interface Callback : Plugin { - fun onOpenBugReport() - fun onAddAccount() + fun navigateToBugReport() + fun navigateToAddAccount() } @Parcelize @@ -81,12 +81,12 @@ class LoggedInAppScopeFlowNode( override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { val callback = object : LoggedInFlowNode.Callback { - override fun onOpenBugReport() { - plugins().forEach { it.onOpenBugReport() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } - override fun onAddAccount() { - plugins().forEach { it.onAddAccount() } + override fun navigateToAddAccount() { + plugins().forEach { it.navigateToAddAccount() } } } return createNode(buildContext, listOf(callback)) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt index 090ed70fe2..dc6ad19f4b 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt @@ -148,8 +148,8 @@ class LoggedInFlowNode( plugins = plugins ) { interface Callback : Plugin { - fun onOpenBugReport() - fun onAddAccount() + fun navigateToBugReport() + fun navigateToAddAccount() } private val loggedInFlowProcessor = LoggedInEventProcessor( @@ -282,7 +282,7 @@ class LoggedInFlowNode( data object Ftue : NavTarget @Parcelize - data object RoomDirectorySearch : NavTarget + data object RoomDirectory : NavTarget @Parcelize data class IncomingShare(val intent: Intent) : NavTarget @@ -304,32 +304,32 @@ class LoggedInFlowNode( } NavTarget.Home -> { val callback = object : HomeEntryPoint.Callback { - override fun onRoomClick(roomId: RoomId) { + override fun navigateToRoom(roomId: RoomId) { backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias())) } - override fun onSettingsClick() { + override fun navigateToSettings() { backstack.push(NavTarget.Settings()) } - override fun onStartChatClick() { + override fun navigateToCreateRoom() { backstack.push(NavTarget.CreateRoom) } - override fun onSetUpRecoveryClick() { + override fun navigateToSetUpRecovery() { backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.Root)) } - override fun onSessionConfirmRecoveryKeyClick() { + override fun navigateToEnterRecoveryKey() { 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)) } - override fun onReportBugClick() { - plugins().forEach { it.onOpenBugReport() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } } homeEntryPoint @@ -339,11 +339,11 @@ class LoggedInFlowNode( } is NavTarget.Room -> { val joinedRoomCallback = object : JoinedRoomLoadedFlowNode.Callback { - override fun onOpenRoom(roomId: RoomId, serverNames: List) { + override fun navigateToRoom(roomId: RoomId, serverNames: List) { backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), serverNames)) } - override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { when (data) { is PermalinkData.UserLink -> { // 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)) } } @@ -384,7 +384,7 @@ class LoggedInFlowNode( } is NavTarget.UserProfile -> { val callback = object : UserProfileEntryPoint.Callback { - override fun onOpenRoom(roomId: RoomId) { + override fun navigateToRoom(roomId: RoomId) { backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias())) } } @@ -395,23 +395,23 @@ class LoggedInFlowNode( } is NavTarget.Settings -> { val callback = object : PreferencesEntryPoint.Callback { - override fun onAddAccount() { - plugins().forEach { it.onAddAccount() } + override fun navigateToAddAccount() { + plugins().forEach { it.navigateToAddAccount() } } - override fun onOpenBugReport() { - plugins().forEach { it.onOpenBugReport() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } - override fun onSecureBackupClick() { + override fun navigateToSecureBackup() { backstack.push(NavTarget.SecureBackup()) } - override fun onOpenRoomNotificationSettings(roomId: RoomId) { + override fun navigateToRoomNotificationSettings(roomId: RoomId) { 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))) } } @@ -423,12 +423,12 @@ class LoggedInFlowNode( } NavTarget.CreateRoom -> { val callback = object : StartChatEntryPoint.Callback { - override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) { + override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) { backstack.replace(NavTarget.Room(roomIdOrAlias = roomIdOrAlias, serverNames = serverNames)) } - override fun onOpenRoomDirectory() { - backstack.push(NavTarget.RoomDirectorySearch) + override fun navigateToRoomDirectory() { + backstack.push(NavTarget.RoomDirectory) } } @@ -450,10 +450,10 @@ class LoggedInFlowNode( NavTarget.Ftue -> { ftueEntryPoint.createNode(this, buildContext) } - NavTarget.RoomDirectorySearch -> { + NavTarget.RoomDirectory -> { roomDirectoryEntryPoint.nodeBuilder(this, buildContext) .callback(object : RoomDirectoryEntryPoint.Callback { - override fun onResultClick(roomDescription: RoomDescription) { + override fun navigateToRoom(roomDescription: RoomDescription) { backstack.push( NavTarget.Room( roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(), diff --git a/appnav/src/main/kotlin/io/element/android/appnav/NotLoggedInFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/NotLoggedInFlowNode.kt index 08bdbadde6..f3c92f4407 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/NotLoggedInFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/NotLoggedInFlowNode.kt @@ -55,7 +55,7 @@ class NotLoggedInFlowNode( ) : NodeInputs interface Callback : Plugin { - fun onOpenBugReport() + fun navigateToBugReport() } private val inputs = inputs() @@ -78,8 +78,8 @@ class NotLoggedInFlowNode( return when (navTarget) { NavTarget.Root -> { val callback = object : LoginEntryPoint.Callback { - override fun onReportProblem() { - plugins().forEach { it.onOpenBugReport() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } } loginEntryPoint diff --git a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt index dc4e169d53..676cc75767 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt @@ -227,11 +227,11 @@ class RootFlowNode( } val inputs = LoggedInAppScopeFlowNode.Inputs(matrixClient) val callback = object : LoggedInAppScopeFlowNode.Callback { - override fun onOpenBugReport() { + override fun navigateToBugReport() { backstack.push(NavTarget.BugReport) } - override fun onAddAccount() { + override fun navigateToAddAccount() { backstack.push(NavTarget.NotLoggedInFlow(null)) } } @@ -239,7 +239,7 @@ class RootFlowNode( } is NavTarget.NotLoggedInFlow -> { val callback = object : NotLoggedInFlowNode.Callback { - override fun onOpenBugReport() { + override fun navigateToBugReport() { backstack.push(NavTarget.BugReport) } } @@ -266,7 +266,7 @@ class RootFlowNode( } is NavTarget.AccountSelect -> { val callback: AccountSelectEntryPoint.Callback = object : AccountSelectEntryPoint.Callback { - override fun onSelectAccount(sessionId: SessionId) { + override fun onAccountSelected(sessionId: SessionId) { lifecycleScope.launch { if (sessionId == navTarget.currentSessionId) { // Ensure that the account selection Node is removed from the backstack diff --git a/appnav/src/main/kotlin/io/element/android/appnav/room/joined/JoinedRoomLoadedFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/room/joined/JoinedRoomLoadedFlowNode.kt index a4e4540b92..154d8c45d0 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/room/joined/JoinedRoomLoadedFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/room/joined/JoinedRoomLoadedFlowNode.kt @@ -76,9 +76,9 @@ class JoinedRoomLoadedFlowNode( plugins = plugins, ), DependencyInjectionGraphOwner { interface Callback : Plugin { - fun onOpenRoom(roomId: RoomId, serverNames: List) - fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) - fun onOpenGlobalNotificationSettings() + fun navigateToRoom(roomId: RoomId, serverNames: List) + fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) + fun navigateToGlobalNotificationSettings() } data class Inputs( @@ -123,19 +123,19 @@ class JoinedRoomLoadedFlowNode( private fun createRoomDetailsNode(buildContext: BuildContext, initialTarget: RoomDetailsEntryPoint.InitialTarget): Node { val callback = object : RoomDetailsEntryPoint.Callback { - override fun onOpenGlobalNotificationSettings() { - callbacks.forEach { it.onOpenGlobalNotificationSettings() } + override fun navigateToGlobalNotificationSettings() { + callbacks.forEach { it.navigateToGlobalNotificationSettings() } } - override fun onOpenRoom(roomId: RoomId, serverNames: List) { - callbacks.forEach { it.onOpenRoom(roomId, serverNames) } + override fun navigateToRoom(roomId: RoomId, serverNames: List) { + callbacks.forEach { it.navigateToRoom(roomId, serverNames) } } - override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { - callbacks.forEach { it.onPermalinkClick(data, pushToBackstack) } + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { + callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack) } } - override fun forwardEvent(eventId: EventId) { + override fun startForwardEventFlow(eventId: EventId) { backstack.push(NavTarget.ForwardEvent(eventId)) } } @@ -172,7 +172,7 @@ class JoinedRoomLoadedFlowNode( override fun onDone(roomIds: List) { backstack.pop() 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 { val callback = object : SpaceEntryPoint.Callback { - override fun onOpenRoom(roomId: RoomId, viaParameters: List) { - callbacks.forEach { it.onOpenRoom(roomId, viaParameters) } + override fun navigateToRoom(roomId: RoomId, viaParameters: List) { + callbacks.forEach { it.navigateToRoom(roomId, viaParameters) } } - override fun onOpenDetails() { + override fun navigateToRoomDetails() { backstack.push(NavTarget.RoomDetails) } - override fun onOpenMemberList() { + override fun navigateToRoomMemberList() { backstack.push(NavTarget.RoomMemberList) } } @@ -209,24 +209,24 @@ class JoinedRoomLoadedFlowNode( navTarget: NavTarget.Messages, ): Node { val callback = object : MessagesEntryPoint.Callback { - override fun onRoomDetailsClick() { + override fun navigateToRoomDetails() { backstack.push(NavTarget.RoomDetails) } - override fun onUserDataClick(userId: UserId) { + override fun navigateToRoomMemberDetails(userId: UserId) { backstack.push(NavTarget.RoomMemberDetails(userId)) } - override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { - callbacks.forEach { it.onPermalinkClick(data, pushToBackstack) } + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { + callbacks.forEach { it.handlePermalinkClick(data, pushToBackstack) } } override fun forwardEvent(eventId: EventId) { backstack.push(NavTarget.ForwardEvent(eventId)) } - override fun openRoom(roomId: RoomId) { - callbacks.forEach { it.onOpenRoom(roomId, emptyList()) } + override fun navigateToRoom(roomId: RoomId) { + callbacks.forEach { it.navigateToRoom(roomId, emptyList()) } } } val params = MessagesEntryPoint.Params( diff --git a/appnav/src/test/kotlin/io/element/android/appnav/JoinedRoomLoadedFlowNodeTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/JoinedRoomLoadedFlowNodeTest.kt index c9eb28397e..d9070b97bc 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/JoinedRoomLoadedFlowNodeTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/JoinedRoomLoadedFlowNodeTest.kt @@ -212,7 +212,7 @@ class JoinedRoomLoadedFlowNodeTest { ) val roomFlowNodeTestHelper = roomFlowNode.parentNodeTestHelper() // WHEN - fakeMessagesEntryPoint.callback?.onRoomDetailsClick() + fakeMessagesEntryPoint.callback?.navigateToRoomDetails() // THEN roomFlowNodeTestHelper.assertChildHasLifecycle(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails, Lifecycle.State.CREATED) val roomDetailsNode = roomFlowNode.childNode(JoinedRoomLoadedFlowNode.NavTarget.RoomDetails)!! diff --git a/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/FtueSessionVerificationFlowNode.kt b/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/FtueSessionVerificationFlowNode.kt index 02a27d381d..b36c5633dc 100644 --- a/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/FtueSessionVerificationFlowNode.kt +++ b/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/FtueSessionVerificationFlowNode.kt @@ -82,23 +82,22 @@ class FtueSessionVerificationFlowNode( return when (navTarget) { is NavTarget.Root -> { val callback = object : ChooseSelfVerificationModeNode.Callback { - override fun onUseAnotherDevice() { + override fun navigateToUseAnotherDevice() { backstack.push(NavTarget.UseAnotherDevice) } - override fun onUseRecoveryKey() { + override fun navigateToUseRecoveryKey() { backstack.push(NavTarget.EnterRecoveryKey) } - override fun onResetKey() { + override fun navigateToResetKey() { backstack.push(NavTarget.ResetIdentity) } - override fun onLearnMoreAboutEncryption() { + override fun navigateToLearnMoreAboutEncryption() { learnMoreUrl.value = LearnMoreConfig.DEVICE_VERIFICATION_URL } } - createNode(buildContext, plugins = listOf(callback)) } is NavTarget.UseAnotherDevice -> { @@ -116,7 +115,7 @@ class FtueSessionVerificationFlowNode( backstack.pop() } - override fun onLearnMoreAboutEncryption() { + override fun navigateToLearnMoreAboutEncryption() { // Note that this callback is never called. The "Learn more" link is not displayed // for the self session interactive verification. } diff --git a/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/choosemode/ChooseSelfVerificationModeNode.kt b/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/choosemode/ChooseSelfVerificationModeNode.kt index 99409ac2d2..d5a0f91ed7 100644 --- a/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/choosemode/ChooseSelfVerificationModeNode.kt +++ b/features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/choosemode/ChooseSelfVerificationModeNode.kt @@ -29,10 +29,10 @@ class ChooseSelfVerificationModeNode( private val directLogoutView: DirectLogoutView, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onUseAnotherDevice() - fun onUseRecoveryKey() - fun onResetKey() - fun onLearnMoreAboutEncryption() + fun navigateToUseAnotherDevice() + fun navigateToUseRecoveryKey() + fun navigateToResetKey() + fun navigateToLearnMoreAboutEncryption() } private val callback = plugins().first() @@ -43,10 +43,10 @@ class ChooseSelfVerificationModeNode( ChooseSelfVerificationModeView( state = state, - onUseAnotherDevice = callback::onUseAnotherDevice, - onUseRecoveryKey = callback::onUseRecoveryKey, - onResetKey = callback::onResetKey, - onLearnMore = callback::onLearnMoreAboutEncryption, + onUseAnotherDevice = callback::navigateToUseAnotherDevice, + onUseRecoveryKey = callback::navigateToUseRecoveryKey, + onResetKey = callback::navigateToResetKey, + onLearnMore = callback::navigateToLearnMoreAboutEncryption, modifier = modifier, ) diff --git a/features/home/api/src/main/kotlin/io/element/android/features/home/api/HomeEntryPoint.kt b/features/home/api/src/main/kotlin/io/element/android/features/home/api/HomeEntryPoint.kt index 9beb147568..daf020f26c 100644 --- a/features/home/api/src/main/kotlin/io/element/android/features/home/api/HomeEntryPoint.kt +++ b/features/home/api/src/main/kotlin/io/element/android/features/home/api/HomeEntryPoint.kt @@ -21,12 +21,12 @@ interface HomeEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onRoomClick(roomId: RoomId) - fun onStartChatClick() - fun onSettingsClick() - fun onSetUpRecoveryClick() - fun onSessionConfirmRecoveryKeyClick() - fun onRoomSettingsClick(roomId: RoomId) - fun onReportBugClick() + fun navigateToRoom(roomId: RoomId) + fun navigateToCreateRoom() + fun navigateToSettings() + fun navigateToSetUpRecovery() + fun navigateToEnterRecoveryKey() + fun navigateToRoomSettings(roomId: RoomId) + fun navigateToBugReport() } } diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt index cb205960fd..7245db296e 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt @@ -116,27 +116,27 @@ class HomeFlowNode( } private fun onRoomClick(roomId: RoomId) { - plugins().forEach { it.onRoomClick(roomId) } + plugins().forEach { it.navigateToRoom(roomId) } } private fun onOpenSettings() { - plugins().forEach { it.onSettingsClick() } + plugins().forEach { it.navigateToSettings() } } private fun onStartChatClick() { - plugins().forEach { it.onStartChatClick() } + plugins().forEach { it.navigateToCreateRoom() } } private fun onSetUpRecoveryClick() { - plugins().forEach { it.onSetUpRecoveryClick() } + plugins().forEach { it.navigateToSetUpRecovery() } } private fun onSessionConfirmRecoveryKeyClick() { - plugins().forEach { it.onSessionConfirmRecoveryKeyClick() } + plugins().forEach { it.navigateToEnterRecoveryKey() } } private fun onRoomSettingsClick(roomId: RoomId) { - plugins().forEach { it.onRoomSettingsClick(roomId) } + plugins().forEach { it.navigateToRoomSettings(roomId) } } private fun onReportRoomClick(roomId: RoomId) { @@ -153,7 +153,7 @@ class HomeFlowNode( inviteFriendsUseCase.execute(activity) } RoomListMenuAction.ReportBug -> { - plugins().forEach { it.onReportBugClick() } + plugins().forEach { it.navigateToBugReport() } } } } diff --git a/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt b/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt index 7d0c95befd..b2cbea8d76 100644 --- a/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt +++ b/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt @@ -41,13 +41,13 @@ class DefaultHomeEntryPointTest { ) } val callback = object : HomeEntryPoint.Callback { - override fun onRoomClick(roomId: RoomId) = lambdaError() - override fun onStartChatClick() = lambdaError() - override fun onSettingsClick() = lambdaError() - override fun onSetUpRecoveryClick() = lambdaError() - override fun onSessionConfirmRecoveryKeyClick() = lambdaError() - override fun onRoomSettingsClick(roomId: RoomId) = lambdaError() - override fun onReportBugClick() = lambdaError() + override fun navigateToRoom(roomId: RoomId) = lambdaError() + override fun navigateToCreateRoom() = lambdaError() + override fun navigateToSettings() = lambdaError() + override fun navigateToSetUpRecovery() = lambdaError() + override fun navigateToEnterRecoveryKey() = lambdaError() + override fun navigateToRoomSettings(roomId: RoomId) = lambdaError() + override fun navigateToBugReport() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback) diff --git a/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/DependenciesFlowNode.kt b/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/DependenciesFlowNode.kt index 30e094e38e..ab16092065 100644 --- a/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/DependenciesFlowNode.kt +++ b/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/DependenciesFlowNode.kt @@ -52,7 +52,7 @@ class DependenciesFlowNode( return when (navTarget) { is NavTarget.LicensesList -> { val callback = object : DependencyLicensesListNode.Callback { - override fun onOpenLicense(license: DependencyLicenseItem) { + override fun navigateToLicense(license: DependencyLicenseItem) { backstack.push(NavTarget.LicenseDetails(license)) } } diff --git a/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/list/DependencyLicensesListNode.kt b/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/list/DependencyLicensesListNode.kt index 7280c2ad41..56faebe71b 100644 --- a/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/list/DependencyLicensesListNode.kt +++ b/features/licenses/impl/src/main/kotlin/io/element/android/features/licenses/impl/list/DependencyLicensesListNode.kt @@ -30,12 +30,12 @@ class DependencyLicensesListNode( plugins = plugins ) { interface Callback : Plugin { - fun onOpenLicense(license: DependencyLicenseItem) + fun navigateToLicense(license: DependencyLicenseItem) } private fun onOpenLicense(license: DependencyLicenseItem) { plugins() - .forEach { it.onOpenLicense(license) } + .forEach { it.navigateToLicense(license) } } @Composable diff --git a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsFlowNode.kt b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsFlowNode.kt index 01aeaabe89..1597b584bc 100644 --- a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsFlowNode.kt +++ b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsFlowNode.kt @@ -110,7 +110,7 @@ class LockScreenSettingsFlowNode( } NavTarget.Settings -> { val callback = object : LockScreenSettingsNode.Callback { - override fun onChangePinClick() { + override fun navigateToSetupPin() { backstack.push(NavTarget.SetupPin) } } diff --git a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsNode.kt b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsNode.kt index 5e27b815bc..2dcfb0524e 100644 --- a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsNode.kt +++ b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/settings/LockScreenSettingsNode.kt @@ -26,11 +26,11 @@ class LockScreenSettingsNode( private val presenter: LockScreenSettingsPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onChangePinClick() + fun navigateToSetupPin() } private fun onChangePinClick() { - plugins().forEach { it.onChangePinClick() } + plugins().forEach { it.navigateToSetupPin() } } @Composable diff --git a/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt b/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt index b3ef99ee19..3bb1db478b 100644 --- a/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt +++ b/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt @@ -19,7 +19,7 @@ interface LoginEntryPoint : FeatureEntryPoint { ) interface Callback : Plugin { - fun onReportProblem() + fun navigateToBugReport() } fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt index 4b83190f5d..ce85c617ef 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt @@ -126,13 +126,13 @@ class LoginFlowNode( return when (navTarget) { NavTarget.OnBoarding -> { val callback = object : OnBoardingNode.Callback { - override fun onSignUp() { + override fun navigateToSignUpFlow() { backstack.push( NavTarget.ConfirmAccountProvider(isAccountCreation = true) ) } - override fun onSignIn(mustChooseAccountProvider: Boolean) { + override fun navigateToSignInFlow(mustChooseAccountProvider: Boolean) { backstack.push( if (mustChooseAccountProvider) { NavTarget.ChooseAccountProvider @@ -142,23 +142,23 @@ class LoginFlowNode( ) } - override fun onSignInWithQrCode() { + override fun navigateToQrCode() { backstack.push(NavTarget.QrCode) } - override fun onReportProblem() { - plugins().forEach { it.onReportProblem() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } - override fun onOidcDetails(oidcDetails: OidcDetails) { + override fun navigateToOidc(oidcDetails: OidcDetails) { navigateToMas(oidcDetails) } - override fun onCreateAccountContinue(url: String) { + override fun navigateToCreateAccount(url: String) { backstack.push(NavTarget.CreateAccount(url)) } - override fun onLoginPasswordNeeded() { + override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword) } } @@ -171,15 +171,15 @@ class LoginFlowNode( } NavTarget.ChooseAccountProvider -> { val callback = object : ChooseAccountProviderNode.Callback { - override fun onOidcDetails(oidcDetails: OidcDetails) { + override fun navigateToOidc(oidcDetails: OidcDetails) { navigateToMas(oidcDetails) } - override fun onCreateAccountContinue(url: String) { + override fun navigateToCreateAccount(url: String) { backstack.push(NavTarget.CreateAccount(url)) } - override fun onLoginPasswordNeeded() { + override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword) } } @@ -193,19 +193,19 @@ class LoginFlowNode( isAccountCreation = navTarget.isAccountCreation, ) val callback = object : ConfirmAccountProviderNode.Callback { - override fun onOidcDetails(oidcDetails: OidcDetails) { + override fun navigateToOidc(oidcDetails: OidcDetails) { navigateToMas(oidcDetails) } - override fun onCreateAccountContinue(url: String) { + override fun navigateToCreateAccount(url: String) { backstack.push(NavTarget.CreateAccount(url)) } - override fun onLoginPasswordNeeded() { + override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword) } - override fun onChangeAccountProvider() { + override fun navigateToChangeAccountProvider() { backstack.push(NavTarget.ChangeAccountProvider) } } @@ -221,7 +221,7 @@ class LoginFlowNode( backstack.singleTop(confirmAccountProvider) } - override fun onOtherClick() { + override fun navigateToSearchAccountProvider() { backstack.push(NavTarget.SearchAccountProvider) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/qrcode/QrCodeLoginFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/qrcode/QrCodeLoginFlowNode.kt index 22dcb9da9c..992bf18590 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/qrcode/QrCodeLoginFlowNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/qrcode/QrCodeLoginFlowNode.kt @@ -147,11 +147,11 @@ class QrCodeLoginFlowNode( return when (navTarget) { is NavTarget.Initial -> { val callback = object : QrCodeIntroNode.Callback { - override fun onCancelClicked() { + override fun cancel() { navigateUp() } - override fun onContinue() { + override fun navigateToQrCodeScan() { backstack.push(NavTarget.QrCodeScan) } } @@ -159,11 +159,11 @@ class QrCodeLoginFlowNode( } is NavTarget.QrCodeScan -> { val callback = object : QrCodeScanNode.Callback { - override fun onScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) { + override fun handleScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) { lifecycleScope.startAuthentication(qrCodeLoginData) } - override fun onCancelClicked() { + override fun cancel() { backstack.pop() } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt index a0587211c0..80de8c6d71 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt @@ -29,7 +29,7 @@ class ChangeAccountProviderNode( ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { fun onDone() - fun onOtherClick() + fun navigateToSearchAccountProvider() } private fun onDone() { @@ -37,7 +37,7 @@ class ChangeAccountProviderNode( } private fun onOtherClick() { - plugins().forEach { it.onOtherClick() } + plugins().forEach { it.navigateToSearchAccountProvider() } } @Composable diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt index 128d235c93..02203aaa72 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt @@ -29,21 +29,21 @@ class ChooseAccountProviderNode( private val presenter: ChooseAccountProviderPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onLoginPasswordNeeded() - fun onOidcDetails(oidcDetails: OidcDetails) - fun onCreateAccountContinue(url: String) + fun navigateToLoginPassword() + fun navigateToOidc(oidcDetails: OidcDetails) + fun navigateToCreateAccount(url: String) } private fun onOidcDetails(oidcDetails: OidcDetails) { - plugins().forEach { it.onOidcDetails(oidcDetails) } + plugins().forEach { it.navigateToOidc(oidcDetails) } } private fun onLoginPasswordNeeded() { - plugins().forEach { it.onLoginPasswordNeeded() } + plugins().forEach { it.navigateToLoginPassword() } } private fun onCreateAccountContinue(url: String) { - plugins().forEach { it.onCreateAccountContinue(url) } + plugins().forEach { it.navigateToCreateAccount(url) } } @Composable diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt index 0d50d21a18..52df30b4fb 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt @@ -42,26 +42,26 @@ class ConfirmAccountProviderNode( ) interface Callback : Plugin { - fun onLoginPasswordNeeded() - fun onOidcDetails(oidcDetails: OidcDetails) - fun onCreateAccountContinue(url: String) - fun onChangeAccountProvider() + fun navigateToLoginPassword() + fun navigateToOidc(oidcDetails: OidcDetails) + fun navigateToCreateAccount(url: String) + fun navigateToChangeAccountProvider() } private fun onOidcDetails(data: OidcDetails) { - plugins().forEach { it.onOidcDetails(data) } + plugins().forEach { it.navigateToOidc(data) } } private fun onLoginPasswordNeeded() { - plugins().forEach { it.onLoginPasswordNeeded() } + plugins().forEach { it.navigateToLoginPassword() } } private fun onCreateAccountContinue(url: String) { - plugins().forEach { it.onCreateAccountContinue(url) } + plugins().forEach { it.navigateToCreateAccount(url) } } private fun onChangeAccountProvider() { - plugins().forEach { it.onChangeAccountProvider() } + plugins().forEach { it.navigateToChangeAccountProvider() } } @Composable diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt index 3652a3df8d..d9968af936 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt @@ -34,13 +34,13 @@ class OnBoardingNode( plugins = plugins ) { interface Callback : Plugin { - fun onSignUp() - fun onSignIn(mustChooseAccountProvider: Boolean) - fun onSignInWithQrCode() - fun onReportProblem() - fun onLoginPasswordNeeded() - fun onOidcDetails(oidcDetails: OidcDetails) - fun onCreateAccountContinue(url: String) + fun navigateToSignUpFlow() + fun navigateToSignInFlow(mustChooseAccountProvider: Boolean) + fun navigateToQrCode() + fun navigateToBugReport() + fun navigateToLoginPassword() + fun navigateToOidc(oidcDetails: OidcDetails) + fun navigateToCreateAccount(url: String) } data class Params( @@ -55,31 +55,31 @@ class OnBoardingNode( ) private fun onSignIn(mustChooseAccountProvider: Boolean) { - plugins().forEach { it.onSignIn(mustChooseAccountProvider) } + plugins().forEach { it.navigateToSignInFlow(mustChooseAccountProvider) } } private fun onSignUp() { - plugins().forEach { it.onSignUp() } + plugins().forEach { it.navigateToSignUpFlow() } } private fun onSignInWithQrCode() { - plugins().forEach { it.onSignInWithQrCode() } + plugins().forEach { it.navigateToQrCode() } } private fun onReportProblem() { - plugins().forEach { it.onReportProblem() } + plugins().forEach { it.navigateToBugReport() } } private fun onOidcDetails(data: OidcDetails) { - plugins().forEach { it.onOidcDetails(data) } + plugins().forEach { it.navigateToOidc(data) } } private fun onLoginPasswordNeeded() { - plugins().forEach { it.onLoginPasswordNeeded() } + plugins().forEach { it.navigateToLoginPassword() } } private fun onCreateAccountContinue(url: String) { - plugins().forEach { it.onCreateAccountContinue(url) } + plugins().forEach { it.navigateToCreateAccount(url) } } @Composable diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/intro/QrCodeIntroNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/intro/QrCodeIntroNode.kt index c86dc6096a..951550fc22 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/intro/QrCodeIntroNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/intro/QrCodeIntroNode.kt @@ -26,16 +26,16 @@ class QrCodeIntroNode( private val presenter: QrCodeIntroPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onCancelClicked() - fun onContinue() + fun cancel() + fun navigateToQrCodeScan() } private fun onCancelClicked() { - plugins().forEach { it.onCancelClicked() } + plugins().forEach { it.cancel() } } private fun onContinue() { - plugins().forEach { it.onContinue() } + plugins().forEach { it.navigateToQrCodeScan() } } @Composable diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/scan/QrCodeScanNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/scan/QrCodeScanNode.kt index f6b52522b5..554639c72a 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/scan/QrCodeScanNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/qrcode/scan/QrCodeScanNode.kt @@ -27,16 +27,16 @@ class QrCodeScanNode( private val presenter: QrCodeScanPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) - fun onCancelClicked() + fun handleScannedCode(qrCodeLoginData: MatrixQrCodeLoginData) + fun cancel() } private fun onQrCodeDataReady(qrCodeLoginData: MatrixQrCodeLoginData) { - plugins().forEach { it.onScannedCode(qrCodeLoginData) } + plugins().forEach { it.handleScannedCode(qrCodeLoginData) } } private fun onCancelClicked() { - plugins().forEach { it.onCancelClicked() } + plugins().forEach { it.cancel() } } @Composable diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt index c10d22c51a..d39cea9865 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt @@ -39,7 +39,7 @@ class DefaultLoginEntryPointTest { ) } val callback = object : LoginEntryPoint.Callback { - override fun onReportProblem() = lambdaError() + override fun navigateToBugReport() = lambdaError() } val params = LoginEntryPoint.Params( accountProvider = "ac", diff --git a/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutEntryPoint.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutEntryPoint.kt index 17f67813ca..676216d8f4 100644 --- a/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutEntryPoint.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutEntryPoint.kt @@ -21,6 +21,6 @@ interface LogoutEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onChangeRecoveryKeyClick() + fun navigateToSecureBackup() } } diff --git a/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/LogoutNode.kt b/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/LogoutNode.kt index d554dbe8f0..3860850fcf 100644 --- a/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/LogoutNode.kt +++ b/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/LogoutNode.kt @@ -27,7 +27,7 @@ class LogoutNode( private val presenter: LogoutPresenter, ) : Node(buildContext, plugins = plugins) { private fun onChangeRecoveryKeyClick() { - plugins().forEach { it.onChangeRecoveryKeyClick() } + plugins().forEach { it.navigateToSecureBackup() } } @Composable diff --git a/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/DefaultLogoutEntryPointTest.kt b/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/DefaultLogoutEntryPointTest.kt index 01d1bfc6ca..7e831bccf5 100644 --- a/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/DefaultLogoutEntryPointTest.kt +++ b/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/DefaultLogoutEntryPointTest.kt @@ -32,7 +32,7 @@ class DefaultLogoutEntryPointTest { ) } val callback = object : LogoutEntryPoint.Callback { - override fun onChangeRecoveryKeyClick() = lambdaError() + override fun navigateToSecureBackup() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback) diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt index 1d689663ee..6540e03684 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt @@ -38,11 +38,11 @@ interface MessagesEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onRoomDetailsClick() - fun onUserDataClick(userId: UserId) - fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) + fun navigateToRoomDetails() + fun navigateToRoomMemberDetails(userId: UserId) + fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) fun forwardEvent(eventId: EventId) - fun openRoom(roomId: RoomId) + fun navigateToRoom(roomId: RoomId) } data class Params(val initialTarget: InitialTarget) : NodeInputs diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt index 73aad6f7de..c9fe66191b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt @@ -220,18 +220,18 @@ class MessagesFlowNode( return when (navTarget) { is NavTarget.Messages -> { val callback = object : MessagesNode.Callback { - override fun onRoomDetailsClick() { - callbacks.forEach { it.onRoomDetailsClick() } + override fun navigateToRoomDetails() { + 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( timelineMode = timelineMode, event = event, ) } - override fun onPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { + override fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { backstack.push( NavTarget.AttachmentPreview( attachment = attachments.first(), @@ -241,39 +241,39 @@ class MessagesFlowNode( ) } - override fun onUserDataClick(userId: UserId) { - callbacks.forEach { it.onUserDataClick(userId) } + override fun navigateToRoomMemberDetails(userId: UserId) { + callbacks.forEach { it.navigateToRoomMemberDetails(userId) } } - override fun onPermalinkClick(data: PermalinkData) { - callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = true) } + override fun handlePermalinkClick(data: PermalinkData) { + 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)) } - override fun onForwardEventClick(eventId: EventId) { + override fun forwardEvent(eventId: EventId) { 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)) } - override fun onSendLocationClick() { + override fun navigateToSendLocation() { backstack.push(NavTarget.SendLocation(Timeline.Mode.Live)) } - override fun onCreatePollClick() { + override fun navigateToCreatePoll() { 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)) } - override fun onJoinCallClick(roomId: RoomId) { + override fun navigateToRoomCall(roomId: RoomId) { val callType = CallType.RoomCall( sessionId = sessionId, roomId = roomId, @@ -282,15 +282,15 @@ class MessagesFlowNode( elementCallEntryPoint.startCall(callType) } - override fun onViewAllPinnedEvents() { + override fun navigateToPinnedMessagesList() { backstack.push(NavTarget.PinnedMessagesList) } - override fun onViewKnockRequests() { + override fun navigateToKnockRequestsList() { backstack.push(NavTarget.KnockRequestsList) } - override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) { + override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) { backstack.push(NavTarget.Thread(threadRootId, focusedEventId)) } } @@ -311,13 +311,13 @@ class MessagesFlowNode( overlay.hide() } - override fun onViewInTimeline(eventId: EventId) { - viewInTimeline(eventId) + override fun viewInTimeline(eventId: 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 - forwardEvent(eventId) + callbacks.forEach { it.forwardEvent(eventId) } } } mediaViewerEntryPoint.nodeBuilder(this, buildContext) @@ -352,7 +352,7 @@ class MessagesFlowNode( override fun onDone(roomIds: List) { backstack.pop() roomIds.singleOrNull()?.let { roomId -> - callbacks.forEach { it.openRoom(roomId) } + callbacks.forEach { it.navigateToRoom(roomId) } } } } @@ -392,30 +392,30 @@ class MessagesFlowNode( } NavTarget.PinnedMessagesList -> { val callback = object : PinnedMessagesListNode.Callback { - override fun onEventClick(event: TimelineItem.Event) { + override fun handleEventClick(event: TimelineItem.Event) { processEventClick( timelineMode = Timeline.Mode.PinnedEvents, event = event, ) } - override fun onUserDataClick(userId: UserId) { - callbacks.forEach { it.onUserDataClick(userId) } + override fun navigateToRoomMemberDetails(userId: UserId) { + callbacks.forEach { it.navigateToRoomMemberDetails(userId) } } - override fun onViewInTimelineClick(eventId: EventId) { - viewInTimeline(eventId) + override fun viewInTimeline(eventId: EventId) { + this@MessagesFlowNode.viewInTimeline(eventId) } - override fun onRoomPermalinkClick(data: PermalinkData.RoomLink) { - callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = !room.matches(data.roomIdOrAlias)) } + override fun handlePermalinkClick(data: PermalinkData.RoomLink) { + 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)) } - override fun onForwardEventClick(eventId: EventId) { + override fun handleForwardEventClick(eventId: EventId) { backstack.push(NavTarget.ForwardEvent(eventId = eventId, fromPinnedEvents = true)) } } @@ -430,14 +430,14 @@ class MessagesFlowNode( focusedEventId = navTarget.focusedEventId, ) 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( timelineMode = timelineMode, event = event, ) } - override fun onPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { + override fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { backstack.push( NavTarget.AttachmentPreview( attachment = attachments.first(), @@ -447,39 +447,39 @@ class MessagesFlowNode( ) } - override fun onUserDataClick(userId: UserId) { - callbacks.forEach { it.onUserDataClick(userId) } + override fun navigateToRoomMemberDetails(userId: UserId) { + callbacks.forEach { it.navigateToRoomMemberDetails(userId) } } - override fun onPermalinkClick(data: PermalinkData) { - callbacks.forEach { it.onPermalinkClick(data, pushToBackstack = true) } + override fun handlePermalinkClick(data: PermalinkData) { + 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)) } - override fun onForwardEventClick(eventId: EventId) { + override fun handleForwardEventClick(eventId: EventId) { 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)) } - override fun onSendLocationClick() { + override fun navigateToSendLocation() { backstack.push(NavTarget.SendLocation(Timeline.Mode.Thread(navTarget.threadRootId))) } - override fun onCreatePollClick() { + override fun navigateToCreatePoll() { 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)) } - override fun onJoinCallClick(roomId: RoomId) { + override fun navigateToRoomCall(roomId: RoomId) { val callType = CallType.RoomCall( sessionId = sessionId, roomId = roomId, @@ -488,7 +488,7 @@ class MessagesFlowNode( elementCallEntryPoint.startCall(callType) } - override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) { + override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) { backstack.push(NavTarget.Thread(threadRootId, focusedEventId)) } } @@ -502,11 +502,7 @@ class MessagesFlowNode( roomIdOrAlias = room.roomId.toRoomIdOrAlias(), eventId = eventId, ) - callbacks.forEach { it.onPermalinkClick(permalinkData, pushToBackstack = false) } - } - - private fun forwardEvent(eventId: EventId) { - callbacks.forEach { it.forwardEvent(eventId) } + callbacks.forEach { it.handlePermalinkClick(permalinkData, pushToBackstack = false) } } private fun processEventClick( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt index 25fd7f222d..7c55e23323 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt @@ -16,12 +16,12 @@ import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugIn import kotlinx.collections.immutable.ImmutableList interface MessagesNavigator { - fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) - fun onForwardEventClick(eventId: EventId) - fun onReportContentClick(eventId: EventId, senderId: UserId) - fun onEditPollClick(eventId: EventId) - fun onPreviewAttachment(attachments: ImmutableList, inReplyToEventId: EventId?) - fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) - fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) + fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) + fun forwardEvent(eventId: EventId) + fun navigateToReportMessage(eventId: EventId, senderId: UserId) + fun navigateToEditPoll(eventId: EventId) + fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) + fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) + fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) fun onNavigateUp() } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt index e0e3e88891..bb2870b6af 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt @@ -114,21 +114,21 @@ class MessagesNode( ) interface Callback : Plugin { - fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean - fun onPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) - fun onUserDataClick(userId: UserId) - fun onPermalinkClick(data: PermalinkData) - fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) - fun onForwardEventClick(eventId: EventId) - fun onReportMessage(eventId: EventId, senderId: UserId) - fun onSendLocationClick() - fun onCreatePollClick() - fun onEditPollClick(eventId: EventId) - fun onJoinCallClick(roomId: RoomId) - fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) - fun onRoomDetailsClick() - fun onViewAllPinnedEvents() - fun onViewKnockRequests() + fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean + fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) + fun navigateToRoomMemberDetails(userId: UserId) + fun handlePermalinkClick(data: PermalinkData) + fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) + fun forwardEvent(eventId: EventId) + fun navigateToReportMessage(eventId: EventId, senderId: UserId) + fun navigateToSendLocation() + fun navigateToCreatePoll() + fun navigateToEditPoll(eventId: EventId) + fun navigateToRoomCall(roomId: RoomId) + fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) + fun navigateToRoomDetails() + fun navigateToPinnedMessagesList() + fun navigateToKnockRequestsList() } override fun onBuilt() { @@ -143,16 +143,16 @@ class MessagesNode( ) } - private fun onRoomDetailsClick() { - callbacks.forEach { it.onRoomDetailsClick() } + private fun navigateToRoomDetails() { + callbacks.forEach { it.navigateToRoomDetails() } } - private fun onViewAllPinnedMessagesClick() { - callbacks.forEach { it.onViewAllPinnedEvents() } + private fun navigateToPinnedMessagesList() { + callbacks.forEach { it.navigateToPinnedMessagesList() } } - private fun onViewKnockRequestsClick() { - callbacks.forEach { it.onViewKnockRequests() } + private fun navigateToKnockRequestsList() { + callbacks.forEach { it.navigateToKnockRequestsList() } } 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 a callback returns false, the other callback will not be invoked. return callbacks.takeIf { it.isNotEmpty() } - ?.map { it.onEventClick(timelineMode, event) } + ?.map { it.handleEventClick(timelineMode, event) } ?.all { it } .orFalse() } - private fun onUserDataClick(userId: UserId) { - callbacks.forEach { it.onUserDataClick(userId) } + private fun navigateToRoomMemberDetails(userId: UserId) { + callbacks.forEach { it.navigateToRoomMemberDetails(userId) } } private fun onLinkClick( @@ -180,7 +180,7 @@ class MessagesNode( is PermalinkData.UserLink -> { // Open the room member profile, it will fallback to // 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 -> { handleRoomLinkClick(permalink, eventSink) @@ -211,53 +211,53 @@ class MessagesNode( displaySameRoomToast() } } else { - callbacks.forEach { it.onPermalinkClick(roomLink) } + callbacks.forEach { it.handlePermalinkClick(roomLink) } } } - override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { - callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) } + override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { + callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) } } - override fun onForwardEventClick(eventId: EventId) { - callbacks.forEach { it.onForwardEventClick(eventId) } + override fun forwardEvent(eventId: EventId) { + callbacks.forEach { it.forwardEvent(eventId) } } - override fun onReportContentClick(eventId: EventId, senderId: UserId) { - callbacks.forEach { it.onReportMessage(eventId, senderId) } + override fun navigateToReportMessage(eventId: EventId, senderId: UserId) { + callbacks.forEach { it.navigateToReportMessage(eventId, senderId) } } - override fun onEditPollClick(eventId: EventId) { - callbacks.forEach { it.onEditPollClick(eventId) } + override fun navigateToEditPoll(eventId: EventId) { + callbacks.forEach { it.navigateToEditPoll(eventId) } } - override fun onPreviewAttachment(attachments: ImmutableList, inReplyToEventId: EventId?) { - callbacks.forEach { it.onPreviewAttachments(attachments, inReplyToEventId) } + override fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { + callbacks.forEach { it.navigateToPreviewAttachments(attachments, inReplyToEventId) } } - override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { + override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { if (roomId == room.roomId) { displaySameRoomToast() } else { 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?) { - callbacks.forEach { it.onOpenThread(threadRootId, focusedEventId) } + override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) { + callbacks.forEach { it.navigateToThread(threadRootId, focusedEventId) } } - private fun onSendLocationClick() { - callbacks.forEach { it.onSendLocationClick() } + private fun navigateToSendLocation() { + callbacks.forEach { it.navigateToSendLocation() } } - private fun onCreatePollClick() { - callbacks.forEach { it.onCreatePollClick() } + private fun navigateToCreatePoll() { + callbacks.forEach { it.navigateToCreatePoll() } } - private fun onJoinCallClick() { - callbacks.forEach { it.onJoinCallClick(room.roomId) } + private fun navigateToRoomCall() { + callbacks.forEach { it.navigateToRoomCall(room.roomId) } } private fun displaySameRoomToast() { @@ -288,7 +288,7 @@ class MessagesNode( MessagesView( state = state, onBackClick = { state.eventSink(MessagesEvents.MarkAsFullyReadAndExit) }, - onRoomDetailsClick = this::onRoomDetailsClick, + onRoomDetailsClick = ::navigateToRoomDetails, onEventContentClick = { isLive, event -> if (isLive) { onEventClick(timelineController.mainTimelineMode(), event) @@ -301,7 +301,7 @@ class MessagesNode( } } }, - onUserDataClick = this::onUserDataClick, + onUserDataClick = ::navigateToRoomMemberDetails, onLinkClick = { url, customTab -> onLinkClick( activity = activity, @@ -311,15 +311,15 @@ class MessagesNode( customTab = customTab, ) }, - onSendLocationClick = this::onSendLocationClick, - onCreatePollClick = this::onCreatePollClick, - onJoinCallClick = this::onJoinCallClick, - onViewAllPinnedMessagesClick = this::onViewAllPinnedMessagesClick, + onSendLocationClick = ::navigateToSendLocation, + onCreatePollClick = ::navigateToCreatePoll, + onJoinCallClick = ::navigateToRoomCall, + onViewAllPinnedMessagesClick = ::navigateToPinnedMessagesList, modifier = modifier, knockRequestsBannerView = { knockRequestsBannerRenderer.View( modifier = Modifier, - onViewRequestsClick = this::onViewKnockRequestsClick + onViewRequestsClick = ::navigateToKnockRequestsList, ) }, ) @@ -327,7 +327,7 @@ class MessagesNode( state = state.roomMemberModerationState, onSelectAction = { action, target -> when (action) { - is ModerationAction.DisplayProfile -> onUserDataClick(target.userId) + is ModerationAction.DisplayProfile -> navigateToRoomMemberDetails(target.userId) else -> state.roomMemberModerationState.eventSink(RoomMemberModerationEvents.ProcessAction(action, target)) } }, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt index 9056437218..aae371998e 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt @@ -355,7 +355,7 @@ class MessagesPresenter( is TimelineItemThreadInfo.ThreadResponse -> targetEvent.threadInfo.threadRootId is TimelineItemThreadInfo.ThreadRoot, null -> targetEvent.eventId?.toThreadId() } ?: return@launch - navigator.onOpenThread(threadId, null) + navigator.navigateToThread(threadId, null) } else { handleActionReply(targetEvent, composerState, timelineProtectionState) } @@ -463,7 +463,7 @@ class MessagesPresenter( when (targetEvent.content) { is TimelineItemPollContent -> { if (targetEvent.eventId == null) return - navigator.onEditPollClick(targetEvent.eventId) + navigator.navigateToEditPoll(targetEvent.eventId) } else -> { val composerMode = MessageComposerMode.Edit( @@ -528,17 +528,17 @@ class MessagesPresenter( } private fun handleShowDebugInfoAction(event: TimelineItem.Event) { - navigator.onShowEventDebugInfoClick(event.eventId, event.debugInfo) + navigator.navigateToEventDebugInfo(event.eventId, event.debugInfo) } private fun handleForwardAction(event: TimelineItem.Event) { if (event.eventId == null) return - navigator.onForwardEventClick(event.eventId) + navigator.forwardEvent(event.eventId) } private fun handleReportAction(event: TimelineItem.Event) { if (event.eventId == null) return - navigator.onReportContentClick(event.eventId, event.senderId) + navigator.navigateToReportMessage(event.eventId, event.senderId) } private fun handleEndPollAction( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 9505f0d758..612797261a 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -528,7 +528,7 @@ class MessageComposerPresenter( ) val mediaAttachment = Attachment.Media(localMedia) 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 messageComposerContext.composerMode = MessageComposerMode.Normal diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNavigator.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNavigator.kt index d33ad54eed..7a890eac7b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNavigator.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNavigator.kt @@ -11,7 +11,7 @@ import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo interface PinnedMessagesListNavigator { - fun onViewInTimelineClick(eventId: EventId) - fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) - fun onForwardEventClick(eventId: EventId) + fun viewInTimeline(eventId: EventId) + fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) + fun forwardEvent(eventId: EventId) } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt index 8ba776c520..6d1c7b6027 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListNode.kt @@ -48,12 +48,12 @@ class PinnedMessagesListNode( private val permalinkParser: PermalinkParser, ) : Node(buildContext, plugins = plugins), PinnedMessagesListNavigator { interface Callback : Plugin { - fun onEventClick(event: TimelineItem.Event) - fun onUserDataClick(userId: UserId) - fun onViewInTimelineClick(eventId: EventId) - fun onRoomPermalinkClick(data: PermalinkData.RoomLink) - fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) - fun onForwardEventClick(eventId: EventId) + fun handleEventClick(event: TimelineItem.Event) + fun navigateToRoomMemberDetails(userId: UserId) + fun viewInTimeline(eventId: EventId) + fun handlePermalinkClick(data: PermalinkData.RoomLink) + fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) + fun handleForwardEventClick(eventId: EventId) } private val presenter = presenterFactory.create( @@ -65,12 +65,12 @@ class PinnedMessagesListNode( ) private val callbacks = plugins() - private fun onEventClick(event: TimelineItem.Event) { - return callbacks.forEach { it.onEventClick(event) } + private fun handleEventClick(event: TimelineItem.Event) { + return callbacks.forEach { it.handleEventClick(event) } } - private fun onUserDataClick(user: MatrixUser) { - callbacks.forEach { it.onUserDataClick(user.userId) } + private fun navigateToRoomMemberDetails(user: MatrixUser) { + callbacks.forEach { it.navigateToRoomMemberDetails(user.userId) } } private fun onLinkClick(context: Context, url: String) { @@ -78,10 +78,10 @@ class PinnedMessagesListNode( is PermalinkData.UserLink -> { // Open the room member profile, it will fallback to // 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 -> { - callbacks.forEach { it.onRoomPermalinkClick(permalink) } + callbacks.forEach { it.handlePermalinkClick(permalink) } } is PermalinkData.FallbackLink, is PermalinkData.RoomEmailInviteLink -> { @@ -90,16 +90,16 @@ class PinnedMessagesListNode( } } - override fun onViewInTimelineClick(eventId: EventId) { - callbacks.forEach { it.onViewInTimelineClick(eventId) } + override fun viewInTimeline(eventId: EventId) { + callbacks.forEach { it.viewInTimeline(eventId) } } - override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { - callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) } + override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { + callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) } } - override fun onForwardEventClick(eventId: EventId) { - callbacks.forEach { it.onForwardEventClick(eventId) } + override fun forwardEvent(eventId: EventId) { + callbacks.forEach { it.handleForwardEventClick(eventId) } } @Composable @@ -113,8 +113,8 @@ class PinnedMessagesListNode( PinnedMessagesListView( state = state, onBackClick = ::navigateUp, - onEventClick = ::onEventClick, - onUserDataClick = ::onUserDataClick, + onEventClick = ::handleEventClick, + onUserDataClick = ::navigateToRoomMemberDetails, onLinkClick = { link -> onLinkClick(context, link.url) }, onLinkLongClick = { view.performHapticFeedback( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt index 50652bb6e5..6d09e12447 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt @@ -153,18 +153,18 @@ class PinnedMessagesListPresenter( ) = launch { when (action) { TimelineItemAction.ViewSource -> { - navigator.onShowEventDebugInfoClick(targetEvent.eventId, targetEvent.debugInfo) + navigator.navigateToEventDebugInfo(targetEvent.eventId, targetEvent.debugInfo) } TimelineItemAction.Forward -> { targetEvent.eventId?.let { eventId -> - navigator.onForwardEventClick(eventId) + navigator.forwardEvent(eventId) } } TimelineItemAction.Unpin -> handleUnpinAction(targetEvent) TimelineItemAction.ViewInTimeline -> { targetEvent.eventId?.let { eventId -> analyticsService.captureInteraction(Interaction.Name.PinnedMessageListViewTimeline) - navigator.onViewInTimelineClick(eventId) + navigator.viewInTimeline(eventId) } } else -> Unit diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/threads/ThreadedMessagesNode.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/threads/ThreadedMessagesNode.kt index 9b5121eeb5..62138e99e0 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/threads/ThreadedMessagesNode.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/threads/ThreadedMessagesNode.kt @@ -113,18 +113,18 @@ class ThreadedMessagesNode( ) interface Callback : Plugin { - fun onEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean - fun onPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) - fun onUserDataClick(userId: UserId) - fun onPermalinkClick(data: PermalinkData) - fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) - fun onForwardEventClick(eventId: EventId) - fun onReportMessage(eventId: EventId, senderId: UserId) - fun onSendLocationClick() - fun onCreatePollClick() - fun onEditPollClick(eventId: EventId) - fun onJoinCallClick(roomId: RoomId) - fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) + fun handleEventClick(timelineMode: Timeline.Mode, event: TimelineItem.Event): Boolean + fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) + fun navigateToRoomMemberDetails(userId: UserId) + fun handlePermalinkClick(data: PermalinkData) + fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) + fun handleForwardEventClick(eventId: EventId) + fun navigateToReportMessage(eventId: EventId, senderId: UserId) + fun navigateToSendLocation() + fun navigateToCreatePoll() + fun navigateToEditPoll(eventId: EventId) + fun navigateToRoomCall(roomId: RoomId) + fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) } override fun onBuilt() { @@ -150,13 +150,13 @@ class ThreadedMessagesNode( // - 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. return callbacks.takeIf { it.isNotEmpty() } - ?.map { it.onEventClick(timelineMode, event) } + ?.map { it.handleEventClick(timelineMode, event) } ?.all { it } .orFalse() } - private fun onUserDataClick(userId: UserId) { - callbacks.forEach { it.onUserDataClick(userId) } + private fun navigateToRoomMemberDetails(userId: UserId) { + callbacks.forEach { it.navigateToRoomMemberDetails(userId) } } private fun onLinkClick( @@ -170,7 +170,7 @@ class ThreadedMessagesNode( is PermalinkData.UserLink -> { // Open the room member profile, it will fallback to // 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 -> { handleRoomLinkClick(permalink, eventSink) @@ -204,51 +204,51 @@ class ThreadedMessagesNode( navigateUp() } } else { - callbacks.forEach { it.onPermalinkClick(roomLink) } + callbacks.forEach { it.handlePermalinkClick(roomLink) } } } - override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { - callbacks.forEach { it.onShowEventDebugInfoClick(eventId, debugInfo) } + override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { + callbacks.forEach { it.navigateToEventDebugInfo(eventId, debugInfo) } } - override fun onForwardEventClick(eventId: EventId) { - callbacks.forEach { it.onForwardEventClick(eventId) } + override fun forwardEvent(eventId: EventId) { + callbacks.forEach { it.handleForwardEventClick(eventId) } } - override fun onReportContentClick(eventId: EventId, senderId: UserId) { - callbacks.forEach { it.onReportMessage(eventId, senderId) } + override fun navigateToReportMessage(eventId: EventId, senderId: UserId) { + callbacks.forEach { it.navigateToReportMessage(eventId, senderId) } } - override fun onEditPollClick(eventId: EventId) { - callbacks.forEach { it.onEditPollClick(eventId) } + override fun navigateToEditPoll(eventId: EventId) { + callbacks.forEach { it.navigateToEditPoll(eventId) } } - override fun onPreviewAttachment(attachments: ImmutableList, inReplyToEventId: EventId?) { - callbacks.forEach { it.onPreviewAttachments(attachments, inReplyToEventId) } + override fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { + callbacks.forEach { it.navigateToPreviewAttachments(attachments, inReplyToEventId) } } - override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { + override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { 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?) { - callbacks.forEach { it.onOpenThread(threadRootId, focusedEventId) } + override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) { + callbacks.forEach { it.navigateToThread(threadRootId, focusedEventId) } } override fun onNavigateUp() = navigateUp() - private fun onSendLocationClick() { - callbacks.forEach { it.onSendLocationClick() } + private fun navigateToSendLocation() { + callbacks.forEach { it.navigateToSendLocation() } } - private fun onCreatePollClick() { - callbacks.forEach { it.onCreatePollClick() } + private fun navigateToCreatePoll() { + callbacks.forEach { it.navigateToCreatePoll() } } - private fun onJoinCallClick() { - callbacks.forEach { it.onJoinCallClick(room.roomId) } + private fun navigateToRoomCall() { + callbacks.forEach { it.navigateToRoomCall(room.roomId) } } @Composable @@ -281,7 +281,7 @@ class ThreadedMessagesNode( } } }, - onUserDataClick = this::onUserDataClick, + onUserDataClick = this::navigateToRoomMemberDetails, onLinkClick = { url, customTab -> onLinkClick( activity = activity, @@ -291,9 +291,9 @@ class ThreadedMessagesNode( customTab = customTab, ) }, - onSendLocationClick = this::onSendLocationClick, - onCreatePollClick = this::onCreatePollClick, - onJoinCallClick = this::onJoinCallClick, + onSendLocationClick = this::navigateToSendLocation, + onCreatePollClick = this::navigateToCreatePoll, + onJoinCallClick = this::navigateToRoomCall, onViewAllPinnedMessagesClick = {}, modifier = modifier, knockRequestsBannerView = {}, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt index ae8e26bff4..8602de0532 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt @@ -185,7 +185,7 @@ class TimelinePresenter( } } is TimelineEvents.EditPoll -> { - navigator.onEditPollClick(event.pollStartId) + navigator.navigateToEditPoll(event.pollStartId) } is TimelineEvents.FocusOnEvent -> sessionCoroutineScope.launch { focusRequestState.value = FocusRequestState.Requested(event.eventId, event.debounce) @@ -210,10 +210,10 @@ class TimelinePresenter( is TimelineEvents.NavigateToPredecessorOrSuccessorRoom -> { // Navigate to the predecessor or successor room val serverNames = calculateServerNamesForRoom(room) - navigator.onNavigateToRoom(event.roomId, null, serverNames) + navigator.navigateToRoom(event.roomId, null, serverNames) } is TimelineEvents.OpenThread -> { - navigator.onOpenThread( + navigator.navigateToThread( threadRootId = event.threadRootEventId, focusedEventId = event.focusedEvent, ) @@ -314,7 +314,7 @@ class TimelinePresenter( 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 focusRequestState.value = FocusRequestState.None - navigator.onNavigateToRoom(room.roomId, eventId, calculateServerNamesForRoom(room)) + navigator.navigateToRoom(room.roomId, eventId, calculateServerNamesForRoom(room)) } else { Timber.tag(tag).d("Focusing on event $eventId - thread $threadId") timelineController.focusOnEvent(eventId, threadId) @@ -331,7 +331,7 @@ class TimelinePresenter( } else { 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 - navigator.onOpenThread(result.threadId, eventId) + navigator.navigateToThread(result.threadId, eventId) } } } diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/DefaultMessagesEntryPointTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/DefaultMessagesEntryPointTest.kt index 88c0ca8020..1df6fc25f1 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/DefaultMessagesEntryPointTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/DefaultMessagesEntryPointTest.kt @@ -116,11 +116,11 @@ class DefaultMessagesEntryPointTest { ) } val callback = object : MessagesEntryPoint.Callback { - override fun onRoomDetailsClick() = lambdaError() - override fun onUserDataClick(userId: UserId) = lambdaError() - override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError() + override fun navigateToRoomDetails() = lambdaError() + override fun navigateToRoomMemberDetails(userId: UserId) = lambdaError() + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = 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 params = MessagesEntryPoint.Params(initialTarget) diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/FakeMessagesNavigator.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/FakeMessagesNavigator.kt index c26e7a83e2..04b34fe778 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/FakeMessagesNavigator.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/FakeMessagesNavigator.kt @@ -26,31 +26,31 @@ class FakeMessagesNavigator( private val onOpenThreadLambda: (threadRootId: ThreadId, focusedEventId: EventId?) -> Unit = { _, _ -> lambdaError() }, private val onNavigateUpLambda: () -> Unit = { lambdaError() }, ) : MessagesNavigator { - override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { + override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { onShowEventDebugInfoClickLambda(eventId, debugInfo) } - override fun onForwardEventClick(eventId: EventId) { + override fun forwardEvent(eventId: EventId) { onForwardEventClickLambda(eventId) } - override fun onReportContentClick(eventId: EventId, senderId: UserId) { + override fun navigateToReportMessage(eventId: EventId, senderId: UserId) { onReportContentClickLambda(eventId, senderId) } - override fun onEditPollClick(eventId: EventId) { + override fun navigateToEditPoll(eventId: EventId) { onEditPollClickLambda(eventId) } - override fun onPreviewAttachment(attachments: ImmutableList, inReplyToEventId: EventId?) { + override fun navigateToPreviewAttachments(attachments: ImmutableList, inReplyToEventId: EventId?) { onPreviewAttachmentLambda(attachments, inReplyToEventId) } - override fun onNavigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { + override fun navigateToRoom(roomId: RoomId, eventId: EventId?, serverNames: List) { onNavigateToRoomLambda(roomId, eventId, serverNames) } - override fun onOpenThread(threadRootId: ThreadId, focusedEventId: EventId?) { + override fun navigateToThread(threadRootId: ThreadId, focusedEventId: EventId?) { onOpenThreadLambda(threadRootId, focusedEventId) } diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/FakePinnedMessagesListNavigator.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/FakePinnedMessagesListNavigator.kt index bf0a24dd5a..fba3803806 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/FakePinnedMessagesListNavigator.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/FakePinnedMessagesListNavigator.kt @@ -12,17 +12,17 @@ import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugIn class FakePinnedMessagesListNavigator : PinnedMessagesListNavigator { var onViewInTimelineClickLambda: ((EventId) -> Unit)? = null - override fun onViewInTimelineClick(eventId: EventId) { + override fun viewInTimeline(eventId: EventId) { onViewInTimelineClickLambda?.invoke(eventId) } var onShowEventDebugInfoClickLambda: ((EventId?, TimelineItemDebugInfo) -> Unit)? = null - override fun onShowEventDebugInfoClick(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { + override fun navigateToEventDebugInfo(eventId: EventId?, debugInfo: TimelineItemDebugInfo) { onShowEventDebugInfoClickLambda?.invoke(eventId, debugInfo) } var onForwardEventClickLambda: ((EventId) -> Unit)? = null - override fun onForwardEventClick(eventId: EventId) { + override fun forwardEvent(eventId: EventId) { onForwardEventClickLambda?.invoke(eventId) } } diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryFlowNode.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryFlowNode.kt index 19142508a1..0f8ae56887 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryFlowNode.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryFlowNode.kt @@ -64,7 +64,7 @@ class PollHistoryFlowNode( } NavTarget.Root -> { val callback = object : PollHistoryNode.Callback { - override fun onEditPoll(pollStartEventId: EventId) { + override fun navigateToEditPoll(pollStartEventId: EventId) { backstack.push(NavTarget.EditPoll(pollStartEventId)) } } diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryNode.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryNode.kt index 3fdfdb921f..3ebabe5a2f 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryNode.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryNode.kt @@ -30,11 +30,11 @@ class PollHistoryNode( plugins = plugins, ) { interface Callback : Plugin { - fun onEditPoll(pollStartEventId: EventId) + fun navigateToEditPoll(pollStartEventId: EventId) } private fun onEditPoll(pollStartEventId: EventId) { - plugins().forEach { it.onEditPoll(pollStartEventId) } + plugins().forEach { it.navigateToEditPoll(pollStartEventId) } } @Composable diff --git a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt index c0affde2df..b828fab0ff 100644 --- a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt +++ b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt @@ -40,10 +40,10 @@ interface PreferencesEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onAddAccount() - fun onOpenBugReport() - fun onSecureBackupClick() - fun onOpenRoomNotificationSettings(roomId: RoomId) - fun navigateTo(roomId: RoomId, eventId: EventId) + fun navigateToAddAccount() + fun navigateToBugReport() + fun navigateToSecureBackup() + fun navigateToRoomNotificationSettings(roomId: RoomId) + fun navigateToEvent(roomId: RoomId, eventId: EventId) } } diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt index e4ba87c43a..4903f9d2cf 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt @@ -120,59 +120,59 @@ class PreferencesFlowNode( return when (navTarget) { NavTarget.Root -> { val callback = object : PreferencesRootNode.Callback { - override fun onAddAccount() { - plugins().forEach { it.onAddAccount() } + override fun navigateToAddAccount() { + plugins().forEach { it.navigateToAddAccount() } } - override fun onOpenBugReport() { - plugins().forEach { it.onOpenBugReport() } + override fun navigateToBugReport() { + plugins().forEach { it.navigateToBugReport() } } - override fun onSecureBackupClick() { - plugins().forEach { it.onSecureBackupClick() } + override fun navigateToSecureBackup() { + plugins().forEach { it.navigateToSecureBackup() } } - override fun onOpenAnalytics() { + override fun navigateToAnalyticsSettings() { backstack.push(NavTarget.AnalyticsSettings) } - override fun onOpenAbout() { + override fun navigateToAbout() { backstack.push(NavTarget.About) } - override fun onOpenDeveloperSettings() { + override fun navigateToDeveloperSettings() { backstack.push(NavTarget.DeveloperSettings) } - override fun onOpenNotificationSettings() { + override fun navigateToNotificationSettings() { backstack.push(NavTarget.NotificationSettings) } - override fun onOpenLockScreenSettings() { + override fun navigateToLockScreenSettings() { backstack.push(NavTarget.LockScreenSettings) } - override fun onOpenAdvancedSettings() { + override fun navigateToAdvancedSettings() { backstack.push(NavTarget.AdvancedSettings) } - override fun onOpenLabs() { + override fun navigateToLabs() { backstack.push(NavTarget.Labs) } - override fun onOpenUserProfile(matrixUser: MatrixUser) { + override fun navigateToUserProfile(matrixUser: MatrixUser) { backstack.push(NavTarget.UserProfile(matrixUser)) } - override fun onOpenBlockedUsers() { + override fun navigateToBlockedUsers() { backstack.push(NavTarget.BlockedUsers) } - override fun onSignOutClick() { + override fun startSignOutFlow() { backstack.push(NavTarget.SignOut) } - override fun onOpenAccountDeactivation() { + override fun startAccountDeactivationFlow() { backstack.push(NavTarget.AccountDeactivation) } } @@ -180,7 +180,7 @@ class PreferencesFlowNode( } NavTarget.DeveloperSettings -> { val developerSettingsCallback = object : DeveloperSettingsNode.Callback { - override fun onPushHistoryClick() { + override fun navigateToPushHistory() { backstack.push(NavTarget.PushHistory) } } @@ -191,7 +191,7 @@ class PreferencesFlowNode( } NavTarget.About -> { val callback = object : AboutNode.Callback { - override fun openOssLicenses() { + override fun navigateToOssLicenses() { backstack.push(NavTarget.OssLicenses) } } @@ -202,11 +202,11 @@ class PreferencesFlowNode( } NavTarget.NotificationSettings -> { val notificationSettingsCallback = object : NotificationSettingsNode.Callback { - override fun editDefaultNotificationMode(isOneToOne: Boolean) { + override fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean) { backstack.push(NavTarget.EditDefaultNotificationSetting(isOneToOne)) } - override fun onTroubleshootNotificationsClick() { + override fun navigateToTroubleshootNotifications() { backstack.push(NavTarget.TroubleshootNotifications) } } @@ -223,7 +223,7 @@ class PreferencesFlowNode( } } - override fun openIgnoredUsers() { + override fun navigateToBlockedUsers() { backstack.push(NavTarget.BlockedUsers) } }) @@ -240,16 +240,16 @@ class PreferencesFlowNode( } } - override fun navigateTo(roomId: RoomId, eventId: EventId) { - plugins().forEach { it.navigateTo(roomId, eventId) } + override fun navigateToEvent(roomId: RoomId, eventId: EventId) { + plugins().forEach { it.navigateToEvent(roomId, eventId) } } }) .build() } is NavTarget.EditDefaultNotificationSetting -> { val callback = object : EditDefaultNotificationSettingNode.Callback { - override fun openRoomNotificationSettings(roomId: RoomId) { - plugins().forEach { it.onOpenRoomNotificationSettings(roomId) } + override fun navigateToRoomNotificationSettings(roomId: RoomId) { + plugins().forEach { it.navigateToRoomNotificationSettings(roomId) } } } val input = EditDefaultNotificationSettingNode.Inputs(navTarget.isOneToOne) @@ -270,8 +270,8 @@ class PreferencesFlowNode( } NavTarget.SignOut -> { val callBack: LogoutEntryPoint.Callback = object : LogoutEntryPoint.Callback { - override fun onChangeRecoveryKeyClick() { - plugins().forEach { it.onSecureBackupClick() } + override fun navigateToSecureBackup() { + plugins().forEach { it.navigateToSecureBackup() } } } logoutEntryPoint.nodeBuilder(this, buildContext) diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/AboutNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/AboutNode.kt index 37de32bab7..564189442c 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/AboutNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/about/AboutNode.kt @@ -29,7 +29,7 @@ class AboutNode( private val presenter: AboutPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun openOssLicenses() + fun navigateToOssLicenses() } private fun onElementLegalClick( @@ -52,7 +52,7 @@ class AboutNode( onElementLegalClick(activity, isDark, elementLegal) }, onOpenSourceLicensesClick = { - plugins.filterIsInstance().forEach { it.openOssLicenses() } + plugins.filterIsInstance().forEach { it.navigateToOssLicenses() } }, modifier = modifier ) diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsNode.kt index 6208d0123e..6f18fd44dc 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsNode.kt @@ -29,13 +29,13 @@ class DeveloperSettingsNode( private val presenter: DeveloperSettingsPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onPushHistoryClick() + fun navigateToPushHistory() } private val callbacks = plugins() - private fun onPushHistoryClick() { - callbacks.forEach { it.onPushHistoryClick() } + private fun navigateToPushHistory() { + callbacks.forEach { it.navigateToPushHistory() } } @Composable @@ -51,7 +51,7 @@ class DeveloperSettingsNode( state = state, modifier = modifier, onOpenShowkase = ::openShowkase, - onPushHistoryClick = ::onPushHistoryClick, + onPushHistoryClick = ::navigateToPushHistory, onBackClick = ::navigateUp ) } diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/NotificationSettingsNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/NotificationSettingsNode.kt index f488889c5b..2b2879a4da 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/NotificationSettingsNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/NotificationSettingsNode.kt @@ -26,18 +26,18 @@ class NotificationSettingsNode( private val presenter: NotificationSettingsPresenter, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun editDefaultNotificationMode(isOneToOne: Boolean) - fun onTroubleshootNotificationsClick() + fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean) + fun navigateToTroubleshootNotifications() } private val callbacks = plugins() - private fun openEditDefault(isOneToOne: Boolean) { - callbacks.forEach { it.editDefaultNotificationMode(isOneToOne) } + private fun navigateToEditDefaultNotificationSetting(isOneToOne: Boolean) { + callbacks.forEach { it.navigateToEditDefaultNotificationSetting(isOneToOne) } } - private fun onTroubleshootNotificationsClick() { - callbacks.forEach { it.onTroubleshootNotificationsClick() } + private fun navigateToTroubleshootNotifications() { + callbacks.forEach { it.navigateToTroubleshootNotifications() } } @Composable @@ -45,9 +45,9 @@ class NotificationSettingsNode( val state = presenter.present() NotificationSettingsView( state = state, - onOpenEditDefault = { openEditDefault(isOneToOne = it) }, + onOpenEditDefault = ::navigateToEditDefaultNotificationSetting, onBackClick = ::navigateUp, - onTroubleshootNotificationsClick = ::onTroubleshootNotificationsClick, + onTroubleshootNotificationsClick = ::navigateToTroubleshootNotifications, modifier = modifier, ) } diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/edit/EditDefaultNotificationSettingNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/edit/EditDefaultNotificationSettingNode.kt index ccba221d9a..e697089ad1 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/edit/EditDefaultNotificationSettingNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/notifications/edit/EditDefaultNotificationSettingNode.kt @@ -29,7 +29,7 @@ class EditDefaultNotificationSettingNode( presenterFactory: EditDefaultNotificationSettingPresenter.Factory ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun openRoomNotificationSettings(roomId: RoomId) + fun navigateToRoomNotificationSettings(roomId: RoomId) } data class Inputs( @@ -40,8 +40,8 @@ class EditDefaultNotificationSettingNode( private val callbacks = plugins() private val presenter = presenterFactory.create(inputs.isOneToOne) - private fun openRoomNotificationSettings(roomId: RoomId) { - callbacks.forEach { it.openRoomNotificationSettings(roomId) } + private fun navigateToRoomNotificationSettings(roomId: RoomId) { + callbacks.forEach { it.navigateToRoomNotificationSettings(roomId) } } @Composable @@ -49,7 +49,7 @@ class EditDefaultNotificationSettingNode( val state = presenter.present() EditDefaultNotificationSettingView( state = state, - openRoomNotificationSettings = { openRoomNotificationSettings(it) }, + openRoomNotificationSettings = { navigateToRoomNotificationSettings(it) }, onBackClick = ::navigateUp, modifier = modifier, ) diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt index 67d50a76f0..ba6edb97e0 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt @@ -34,52 +34,52 @@ class PreferencesRootNode( private val directLogoutView: DirectLogoutView, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onAddAccount() - fun onOpenBugReport() - fun onSecureBackupClick() - fun onOpenAnalytics() - fun onOpenAbout() - fun onOpenDeveloperSettings() - fun onOpenNotificationSettings() - fun onOpenLockScreenSettings() - fun onOpenAdvancedSettings() - fun onOpenLabs() - fun onOpenUserProfile(matrixUser: MatrixUser) - fun onOpenBlockedUsers() - fun onSignOutClick() - fun onOpenAccountDeactivation() + fun navigateToAddAccount() + fun navigateToBugReport() + fun navigateToSecureBackup() + fun navigateToAnalyticsSettings() + fun navigateToAbout() + fun navigateToDeveloperSettings() + fun navigateToNotificationSettings() + fun navigateToLockScreenSettings() + fun navigateToAdvancedSettings() + fun navigateToLabs() + fun navigateToUserProfile(matrixUser: MatrixUser) + fun navigateToBlockedUsers() + fun startSignOutFlow() + fun startAccountDeactivationFlow() } private fun onAddAccount() { - plugins().forEach { it.onAddAccount() } + plugins().forEach { it.navigateToAddAccount() } } private fun onOpenBugReport() { - plugins().forEach { it.onOpenBugReport() } + plugins().forEach { it.navigateToBugReport() } } private fun onSecureBackupClick() { - plugins().forEach { it.onSecureBackupClick() } + plugins().forEach { it.navigateToSecureBackup() } } private fun onOpenDeveloperSettings() { - plugins().forEach { it.onOpenDeveloperSettings() } + plugins().forEach { it.navigateToDeveloperSettings() } } private fun onOpenAdvancedSettings() { - plugins().forEach { it.onOpenAdvancedSettings() } + plugins().forEach { it.navigateToAdvancedSettings() } } private fun onOpenLabs() { - plugins().forEach { it.onOpenLabs() } + plugins().forEach { it.navigateToLabs() } } private fun onOpenAnalytics() { - plugins().forEach { it.onOpenAnalytics() } + plugins().forEach { it.navigateToAnalyticsSettings() } } private fun onOpenAbout() { - plugins().forEach { it.onOpenAbout() } + plugins().forEach { it.navigateToAbout() } } private fun onManageAccountClick( @@ -97,27 +97,27 @@ class PreferencesRootNode( } private fun onOpenNotificationSettings() { - plugins().forEach { it.onOpenNotificationSettings() } + plugins().forEach { it.navigateToNotificationSettings() } } private fun onOpenLockScreenSettings() { - plugins().forEach { it.onOpenLockScreenSettings() } + plugins().forEach { it.navigateToLockScreenSettings() } } private fun onOpenUserProfile(matrixUser: MatrixUser) { - plugins().forEach { it.onOpenUserProfile(matrixUser) } + plugins().forEach { it.navigateToUserProfile(matrixUser) } } private fun onOpenBlockedUsers() { - plugins().forEach { it.onOpenBlockedUsers() } + plugins().forEach { it.navigateToBlockedUsers() } } private fun onSignOutClick() { - plugins().forEach { it.onSignOutClick() } + plugins().forEach { it.startSignOutFlow() } } private fun onOpenAccountDeactivation() { - plugins().forEach { it.onOpenAccountDeactivation() } + plugins().forEach { it.startAccountDeactivationFlow() } } @Composable diff --git a/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPointTest.kt b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPointTest.kt index 9e1bd70376..deb15561de 100644 --- a/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPointTest.kt +++ b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPointTest.kt @@ -63,11 +63,11 @@ class DefaultPreferencesEntryPointTest { ) } val callback = object : PreferencesEntryPoint.Callback { - override fun onAddAccount() = lambdaError() - override fun onOpenBugReport() = lambdaError() - override fun onSecureBackupClick() = lambdaError() - override fun onOpenRoomNotificationSettings(roomId: RoomId) = lambdaError() - override fun navigateTo(roomId: RoomId, eventId: EventId) = lambdaError() + override fun navigateToAddAccount() = lambdaError() + override fun navigateToBugReport() = lambdaError() + override fun navigateToSecureBackup() = lambdaError() + override fun navigateToRoomNotificationSettings(roomId: RoomId) = lambdaError() + override fun navigateToEvent(roomId: RoomId, eventId: EventId) = lambdaError() } val params = PreferencesEntryPoint.Params( initialElement = PreferencesEntryPoint.InitialTarget.NotificationSettings, diff --git a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportFlowNode.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportFlowNode.kt index 10af89f740..4e1f599237 100644 --- a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportFlowNode.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportFlowNode.kt @@ -64,7 +64,7 @@ class BugReportFlowNode( this@BugReportFlowNode.onDone() } - override fun onViewLogs(basePath: String) { + override fun navigateToViewLogs(basePath: String) { backstack.push(NavTarget.ViewLogs(rootPath = basePath)) } } diff --git a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt index e307dba8ec..1d3974d166 100644 --- a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt @@ -32,11 +32,11 @@ class BugReportNode( ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { fun onDone() - fun onViewLogs(basePath: String) + fun navigateToViewLogs(basePath: String) } private fun onViewLogs(basePath: String) { - plugins().forEach { it.onViewLogs(basePath) } + plugins().forEach { it.navigateToViewLogs(basePath) } } private fun onDone() { diff --git a/features/roomdetails/api/src/main/kotlin/io/element/android/features/roomdetails/api/RoomDetailsEntryPoint.kt b/features/roomdetails/api/src/main/kotlin/io/element/android/features/roomdetails/api/RoomDetailsEntryPoint.kt index 48fcac8ee6..4b47f6b276 100644 --- a/features/roomdetails/api/src/main/kotlin/io/element/android/features/roomdetails/api/RoomDetailsEntryPoint.kt +++ b/features/roomdetails/api/src/main/kotlin/io/element/android/features/roomdetails/api/RoomDetailsEntryPoint.kt @@ -37,10 +37,10 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint { data class Params(val initialElement: InitialTarget) : NodeInputs interface Callback : Plugin { - fun onOpenGlobalNotificationSettings() - fun onOpenRoom(roomId: RoomId, serverNames: List) - fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) - fun forwardEvent(eventId: EventId) + fun navigateToGlobalNotificationSettings() + fun navigateToRoom(roomId: RoomId, serverNames: List) + fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) + fun startForwardEventFlow(eventId: EventId) } interface NodeBuilder { diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsFlowNode.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsFlowNode.kt index b0540626b9..895fd9dd59 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsFlowNode.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsFlowNode.kt @@ -167,55 +167,55 @@ class RoomDetailsFlowNode( return when (navTarget) { NavTarget.RoomDetails -> { val roomDetailsCallback = object : RoomDetailsNode.Callback { - override fun openRoomMemberList() { + override fun navigateToRoomMemberList() { backstack.push(NavTarget.RoomMemberList) } - override fun editRoomDetails() { + override fun navigateToRoomDetailsEdit() { backstack.push(NavTarget.RoomDetailsEdit) } - override fun openInviteMembers() { + override fun navigateToInviteMembers() { backstack.push(NavTarget.InviteMembers) } - override fun openRoomNotificationSettings() { + override fun navigateToRoomNotificationSettings() { 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)) } - override fun openPollHistory() { + override fun navigateToPollHistory() { backstack.push(NavTarget.PollHistory) } - override fun openMediaGallery() { + override fun navigateToMediaGallery() { backstack.push(NavTarget.MediaGallery) } - override fun openAdminSettings() { + override fun navigateToAdminSettings() { backstack.push(NavTarget.AdminSettings) } - override fun openPinnedMessagesList() { + override fun navigateToPinnedMessagesList() { backstack.push(NavTarget.PinnedMessagesList) } - override fun openKnockRequestsList() { + override fun navigateToKnockRequestsList() { backstack.push(NavTarget.KnockRequestsList) } - override fun openSecurityAndPrivacy() { + override fun navigateToSecurityAndPrivacy() { backstack.push(NavTarget.SecurityAndPrivacy) } - override fun openDmUserProfile(userId: UserId) { + override fun navigateToRoomMemberDetails(userId: UserId) { backstack.push(NavTarget.RoomMemberDetails(userId)) } - override fun onJoinCall() { + override fun navigateToRoomCall() { val inputs = CallType.RoomCall( sessionId = room.sessionId, roomId = room.roomId, @@ -224,11 +224,11 @@ class RoomDetailsFlowNode( elementCallEntryPoint.startCall(inputs) } - override fun openReportRoom() { + override fun navigateToReportRoom() { backstack.push(NavTarget.ReportRoom) } - override fun onSelectNewOwnersWhenLeaving() { + override fun navigateToSelectNewOwnersWhenLeaving() { backstack.push(NavTarget.SelectNewOwnersWhenLeaving) } } @@ -237,11 +237,11 @@ class RoomDetailsFlowNode( NavTarget.RoomMemberList -> { val roomMemberListCallback = object : RoomMemberListNode.Callback { - override fun openRoomMemberDetails(roomMemberId: UserId) { + override fun navigateToRoomMemberDetails(roomMemberId: UserId) { backstack.push(NavTarget.RoomMemberDetails(roomMemberId)) } - override fun openInviteMembers() { + override fun navigateToInviteMembers() { backstack.push(NavTarget.InviteMembers) } } @@ -259,8 +259,8 @@ class RoomDetailsFlowNode( is NavTarget.RoomNotificationSettings -> { val input = RoomNotificationSettingsNode.RoomNotificationSettingInput(navTarget.showUserDefinedSettingStyle) val callback = object : RoomNotificationSettingsNode.Callback { - override fun openGlobalNotificationSettings() { - plugins().forEach { it.onOpenGlobalNotificationSettings() } + override fun navigateToGlobalNotificationSettings() { + plugins().forEach { it.navigateToGlobalNotificationSettings() } } } createNode(buildContext, listOf(input, callback)) @@ -268,19 +268,19 @@ class RoomDetailsFlowNode( is NavTarget.RoomMemberDetails -> { 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)) } - override fun onStartDM(roomId: RoomId) { - plugins().forEach { it.onOpenRoom(roomId, emptyList()) } + override fun navigateToRoom(roomId: RoomId) { + plugins().forEach { it.navigateToRoom(roomId, emptyList()) } } - override fun onStartCall(dmRoomId: RoomId) { + override fun startCall(dmRoomId: RoomId) { elementCallEntryPoint.startCall(CallType.RoomCall(roomId = dmRoomId, sessionId = room.sessionId)) } - override fun onVerifyUser(userId: UserId) { + override fun startVerifyUserFlow(userId: UserId) { backstack.push(NavTarget.VerifyUser(userId)) } } @@ -293,11 +293,11 @@ class RoomDetailsFlowNode( overlay.hide() } - override fun onViewInTimeline(eventId: EventId) { + override fun viewInTimeline(eventId: EventId) { // Cannot happen } - override fun onForwardEvent(eventId: EventId) { + override fun forwardEvent(eventId: EventId) { // Cannot happen } } @@ -318,18 +318,18 @@ class RoomDetailsFlowNode( backstack.pop() } - override fun onViewInTimeline(eventId: EventId) { + override fun viewInTimeline(eventId: EventId) { val permalinkData = PermalinkData.RoomLink( roomIdOrAlias = room.roomId.toRoomIdOrAlias(), eventId = eventId, ) plugins().forEach { - it.onPermalinkClick(permalinkData, pushToBackstack = false) + it.handlePermalinkClick(permalinkData, pushToBackstack = false) } } - override fun forwardEvent(eventId: EventId) { - plugins().forEach { it.forwardEvent(eventId) } + override fun forward(eventId: EventId) { + plugins().forEach { it.startForwardEventFlow(eventId) } } } mediaGalleryEntryPoint.nodeBuilder(this, buildContext) @@ -345,20 +345,20 @@ class RoomDetailsFlowNode( MessagesEntryPoint.InitialTarget.PinnedMessages ) 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) { - plugins().forEach { it.onPermalinkClick(data, pushToBackstack) } + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) { + plugins().forEach { it.handlePermalinkClick(data, pushToBackstack) } } override fun forwardEvent(eventId: EventId) { - plugins().forEach { it.forwardEvent(eventId) } + plugins().forEach { it.startForwardEventFlow(eventId) } } - override fun openRoom(roomId: RoomId) { - plugins().forEach { it.onOpenRoom(roomId, emptyList()) } + override fun navigateToRoom(roomId: RoomId) { + plugins().forEach { it.navigateToRoom(roomId, emptyList()) } } } return messagesEntryPoint.nodeBuilder(this, buildContext) @@ -388,7 +388,7 @@ class RoomDetailsFlowNode( backstack.pop() } - override fun onLearnMoreAboutEncryption() { + override fun navigateToLearnMoreAboutEncryption() { learnMoreUrl.value = LearnMoreConfig.ENCRYPTION_URL } }) diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsNode.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsNode.kt index 2ada71dbc8..ea37c0f774 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsNode.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsNode.kt @@ -46,21 +46,21 @@ class RoomDetailsNode( private val leaveRoomRenderer: LeaveRoomRenderer, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun openRoomMemberList() - fun openInviteMembers() - fun editRoomDetails() - fun openRoomNotificationSettings() - fun openAvatarPreview(name: String, url: String) - fun openPollHistory() - fun openMediaGallery() - fun openAdminSettings() - fun openPinnedMessagesList() - fun openKnockRequestsList() - fun openSecurityAndPrivacy() - fun openDmUserProfile(userId: UserId) - fun onJoinCall() - fun openReportRoom() - fun onSelectNewOwnersWhenLeaving() + fun navigateToRoomMemberList() + fun navigateToInviteMembers() + fun navigateToRoomDetailsEdit() + fun navigateToRoomNotificationSettings() + fun navigateToAvatarPreview(name: String, url: String) + fun navigateToPollHistory() + fun navigateToMediaGallery() + fun navigateToAdminSettings() + fun navigateToPinnedMessagesList() + fun navigateToKnockRequestsList() + fun navigateToSecurityAndPrivacy() + fun navigateToRoomMemberDetails(userId: UserId) + fun navigateToRoomCall() + fun navigateToReportRoom() + fun navigateToSelectNewOwnersWhenLeaving() } private val callback = plugins().first() @@ -74,27 +74,27 @@ class RoomDetailsNode( } private fun openRoomMemberList() { - callback.openRoomMemberList() + callback.navigateToRoomMemberList() } private fun openRoomNotificationSettings() { - callback.openRoomNotificationSettings() + callback.navigateToRoomNotificationSettings() } private fun invitePeople() { - callback.openInviteMembers() + callback.navigateToInviteMembers() } private fun openPollHistory() { - callback.openPollHistory() + callback.navigateToPollHistory() } private fun openMediaGallery() { - callback.openMediaGallery() + callback.navigateToMediaGallery() } private fun onJoinCall() { - callback.onJoinCall() + callback.navigateToRoomCall() } private fun CoroutineScope.onShareRoom(context: Context) = launch { @@ -113,39 +113,39 @@ class RoomDetailsNode( } private fun onEditRoomDetails() { - callback.editRoomDetails() + callback.navigateToRoomDetailsEdit() } private fun openAvatarPreview(name: String, url: String) { - callback.openAvatarPreview(name, url) + callback.navigateToAvatarPreview(name, url) } private fun openAdminSettings() { - callback.openAdminSettings() + callback.navigateToAdminSettings() } private fun openPinnedMessages() { - callback.openPinnedMessagesList() + callback.navigateToPinnedMessagesList() } private fun openKnockRequestsLists() { - callback.openKnockRequestsList() + callback.navigateToKnockRequestsList() } private fun openSecurityAndPrivacy() { - callback.openSecurityAndPrivacy() + callback.navigateToSecurityAndPrivacy() } private fun onProfileClick(userId: UserId) { - callback.openDmUserProfile(userId) + callback.navigateToRoomMemberDetails(userId) } private fun onReportRoomClick() { - callback.openReportRoom() + callback.navigateToReportRoom() } private fun onSelectNewOwnersWhenLeaving() { - return callback.onSelectNewOwnersWhenLeaving() + return callback.navigateToSelectNewOwnersWhenLeaving() } private val stateFlow = launchMolecule { presenter.present() } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListNode.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListNode.kt index cc7a6e2151..27a0bceb66 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListNode.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListNode.kt @@ -35,8 +35,8 @@ class RoomMemberListNode( private val roomMemberModerationRenderer: RoomMemberModerationRenderer, ) : Node(buildContext, plugins = plugins), RoomMemberListNavigator { interface Callback : Plugin { - fun openRoomMemberDetails(roomMemberId: UserId) - fun openInviteMembers() + fun navigateToRoomMemberDetails(roomMemberId: UserId) + fun navigateToInviteMembers() } private val callbacks = plugins() @@ -51,13 +51,13 @@ class RoomMemberListNode( override fun openRoomMemberDetails(roomMemberId: UserId) { callbacks.forEach { - it.openRoomMemberDetails(roomMemberId) + it.navigateToRoomMemberDetails(roomMemberId) } } override fun openInviteMembers() { callbacks.forEach { - it.openInviteMembers() + it.navigateToInviteMembers() } } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsNode.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsNode.kt index 3b364c6f92..52aa7924e6 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsNode.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/details/RoomMemberDetailsNode.kt @@ -62,12 +62,12 @@ class RoomMemberDetailsNode( userProfileNodeHelper.onShareUser(context, permalinkBuilder) } - fun onStartDM(roomId: RoomId) { - callback.onStartDM(roomId) + fun navigateToRoom(roomId: RoomId) { + callback.navigateToRoom(roomId) } fun onStartCall(roomId: RoomId) { - callback.onStartCall(roomId) + callback.startCall(roomId) } val state = presenter.present() @@ -77,10 +77,10 @@ class RoomMemberDetailsNode( modifier = modifier, goBack = this::navigateUp, onShareUser = ::onShareUser, - onOpenDm = ::onStartDM, + onOpenDm = ::navigateToRoom, onStartCall = ::onStartCall, - openAvatarPreview = callback::openAvatarPreview, - onVerifyClick = callback::onVerifyUser, + openAvatarPreview = callback::navigateToAvatarPreview, + onVerifyClick = callback::startVerifyUserFlow, ) } } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/notificationsettings/RoomNotificationSettingsNode.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/notificationsettings/RoomNotificationSettingsNode.kt index 0e5a9b23b1..ec78bf56af 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/notificationsettings/RoomNotificationSettingsNode.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/notificationsettings/RoomNotificationSettingsNode.kt @@ -35,13 +35,13 @@ class RoomNotificationSettingsNode( val showUserDefinedSettingStyle: Boolean ) : NodeInputs interface Callback : Plugin { - fun openGlobalNotificationSettings() + fun navigateToGlobalNotificationSettings() } private val inputs = inputs() private val callbacks = plugins() - private fun openGlobalNotificationSettings() { - callbacks.forEach { it.openGlobalNotificationSettings() } + private fun navigateToGlobalNotificationSettings() { + callbacks.forEach { it.navigateToGlobalNotificationSettings() } } private val presenter = presenterFactory.create(inputs.showUserDefinedSettingStyle) @@ -59,7 +59,7 @@ class RoomNotificationSettingsNode( RoomNotificationSettingsView( state = state, modifier = modifier, - onShowGlobalNotifications = this::openGlobalNotificationSettings, + onShowGlobalNotifications = this::navigateToGlobalNotificationSettings, onBackClick = this::navigateUp, ) } diff --git a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/DefaultRoomDetailsEntryPointTest.kt b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/DefaultRoomDetailsEntryPointTest.kt index a9d528ace5..0872567523 100644 --- a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/DefaultRoomDetailsEntryPointTest.kt +++ b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/DefaultRoomDetailsEntryPointTest.kt @@ -94,10 +94,10 @@ class DefaultRoomDetailsEntryPointTest { ) } val callback = object : RoomDetailsEntryPoint.Callback { - override fun onOpenGlobalNotificationSettings() = lambdaError() - override fun onOpenRoom(roomId: RoomId, serverNames: List) = lambdaError() - override fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError() - override fun forwardEvent(eventId: EventId) = lambdaError() + override fun navigateToGlobalNotificationSettings() = lambdaError() + override fun navigateToRoom(roomId: RoomId, serverNames: List) = lambdaError() + override fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean) = lambdaError() + override fun startForwardEventFlow(eventId: EventId) = lambdaError() } val params = RoomDetailsEntryPoint.Params( initialElement = RoomDetailsEntryPoint.InitialTarget.RoomDetails, diff --git a/features/roomdirectory/api/src/main/kotlin/io/element/android/features/roomdirectory/api/RoomDirectoryEntryPoint.kt b/features/roomdirectory/api/src/main/kotlin/io/element/android/features/roomdirectory/api/RoomDirectoryEntryPoint.kt index 892719554b..7a1764106a 100644 --- a/features/roomdirectory/api/src/main/kotlin/io/element/android/features/roomdirectory/api/RoomDirectoryEntryPoint.kt +++ b/features/roomdirectory/api/src/main/kotlin/io/element/android/features/roomdirectory/api/RoomDirectoryEntryPoint.kt @@ -21,6 +21,6 @@ interface RoomDirectoryEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onResultClick(roomDescription: RoomDescription) + fun navigateToRoom(roomDescription: RoomDescription) } } diff --git a/features/roomdirectory/impl/src/main/kotlin/io/element/android/features/roomdirectory/impl/root/RoomDirectoryNode.kt b/features/roomdirectory/impl/src/main/kotlin/io/element/android/features/roomdirectory/impl/root/RoomDirectoryNode.kt index 03d2be6e35..5bc492b7a8 100644 --- a/features/roomdirectory/impl/src/main/kotlin/io/element/android/features/roomdirectory/impl/root/RoomDirectoryNode.kt +++ b/features/roomdirectory/impl/src/main/kotlin/io/element/android/features/roomdirectory/impl/root/RoomDirectoryNode.kt @@ -29,7 +29,7 @@ class RoomDirectoryNode( ) : Node(buildContext, plugins = plugins) { private fun onResultClick(roomDescription: RoomDescription) { plugins().forEach { - it.onResultClick(roomDescription) + it.navigateToRoom(roomDescription) } } diff --git a/features/roomdirectory/impl/src/test/kotlin/io/element/android/features/roomdirectory/impl/DefaultRoomDirectoryEntryPointTest.kt b/features/roomdirectory/impl/src/test/kotlin/io/element/android/features/roomdirectory/impl/DefaultRoomDirectoryEntryPointTest.kt index d544f55000..50d15b66aa 100644 --- a/features/roomdirectory/impl/src/test/kotlin/io/element/android/features/roomdirectory/impl/DefaultRoomDirectoryEntryPointTest.kt +++ b/features/roomdirectory/impl/src/test/kotlin/io/element/android/features/roomdirectory/impl/DefaultRoomDirectoryEntryPointTest.kt @@ -35,7 +35,7 @@ class DefaultRoomDirectoryEntryPointTest { ) } 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)) .callback(callback) diff --git a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/SecureBackupFlowNode.kt b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/SecureBackupFlowNode.kt index 4d79f8ea1b..63f6282dc8 100644 --- a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/SecureBackupFlowNode.kt +++ b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/SecureBackupFlowNode.kt @@ -77,19 +77,19 @@ class SecureBackupFlowNode( return when (navTarget) { NavTarget.Root -> { val callback = object : SecureBackupRootNode.Callback { - override fun onSetupClick() { + override fun navigateToSetup() { backstack.push(NavTarget.Setup) } - override fun onChangeClick() { + override fun navigateToChange() { backstack.push(NavTarget.Change) } - override fun onDisableClick() { + override fun navigateToDisable() { backstack.push(NavTarget.Disable) } - override fun onConfirmRecoveryKeyClick() { + override fun navigateToEnterRecoveryKey() { backstack.push(NavTarget.EnterRecoveryKey) } } diff --git a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootNode.kt b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootNode.kt index 6d4db197d3..e8d13a3d38 100644 --- a/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootNode.kt +++ b/features/securebackup/impl/src/main/kotlin/io/element/android/features/securebackup/impl/root/SecureBackupRootNode.kt @@ -32,26 +32,26 @@ class SecureBackupRootNode( plugins = plugins ) { interface Callback : Plugin { - fun onSetupClick() - fun onChangeClick() - fun onDisableClick() - fun onConfirmRecoveryKeyClick() + fun navigateToSetup() + fun navigateToChange() + fun navigateToDisable() + fun navigateToEnterRecoveryKey() } private fun onSetupClick() { - plugins().forEach { it.onSetupClick() } + plugins().forEach { it.navigateToSetup() } } private fun onChangeClick() { - plugins().forEach { it.onChangeClick() } + plugins().forEach { it.navigateToChange() } } private fun onDisableClick() { - plugins().forEach { it.onDisableClick() } + plugins().forEach { it.navigateToDisable() } } private fun onConfirmRecoveryKeyClick() { - plugins().forEach { it.onConfirmRecoveryKeyClick() } + plugins().forEach { it.navigateToEnterRecoveryKey() } } private fun onLearnMoreClick(uriHandler: UriHandler) { diff --git a/features/space/api/src/main/kotlin/io/element/android/features/space/api/SpaceEntryPoint.kt b/features/space/api/src/main/kotlin/io/element/android/features/space/api/SpaceEntryPoint.kt index 9dd61c6dff..e939a75d15 100644 --- a/features/space/api/src/main/kotlin/io/element/android/features/space/api/SpaceEntryPoint.kt +++ b/features/space/api/src/main/kotlin/io/element/android/features/space/api/SpaceEntryPoint.kt @@ -31,9 +31,8 @@ interface SpaceEntryPoint : FeatureEntryPoint { ) : NodeInputs interface Callback : Plugin { - fun onOpenRoom(roomId: RoomId, viaParameters: List) - fun onOpenDetails() - - fun onOpenMemberList() + fun navigateToRoom(roomId: RoomId, viaParameters: List) + fun navigateToRoomDetails() + fun navigateToRoomMemberList() } } diff --git a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/SpaceFlowNode.kt b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/SpaceFlowNode.kt index f73a3d31ff..a9f8a79ed6 100644 --- a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/SpaceFlowNode.kt +++ b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/SpaceFlowNode.kt @@ -80,19 +80,19 @@ class SpaceFlowNode( } NavTarget.Root -> { val callback = object : SpaceNode.Callback { - override fun onOpenRoom(roomId: RoomId, viaParameters: List) { - callback.onOpenRoom(roomId, viaParameters) + override fun navigateToRoom(roomId: RoomId, viaParameters: List) { + callback.navigateToRoom(roomId, viaParameters) } - override fun onOpenDetails() { - callback.onOpenDetails() + override fun navigateToRoomDetails() { + callback.navigateToRoomDetails() } override fun onOpenMemberList() { - callback.onOpenMemberList() + callback.navigateToRoomMemberList() } - override fun onLeaveSpace() { + override fun startLeaveSpaceFlow() { backstack.push(NavTarget.Leave) } } diff --git a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/root/SpaceNode.kt b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/root/SpaceNode.kt index f02107dad2..978dc8dcbf 100644 --- a/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/root/SpaceNode.kt +++ b/features/space/impl/src/main/kotlin/io/element/android/features/space/impl/root/SpaceNode.kt @@ -40,11 +40,10 @@ class SpaceNode( private val acceptDeclineInviteView: AcceptDeclineInviteView, ) : Node(buildContext, plugins = plugins) { interface Callback : Plugin { - fun onOpenRoom(roomId: RoomId, viaParameters: List) - fun onOpenDetails() - + fun navigateToRoom(roomId: RoomId, viaParameters: List) + fun navigateToRoomDetails() fun onOpenMemberList() - fun onLeaveSpace() + fun startLeaveSpaceFlow() } private val callback = plugins.filterIsInstance().single() @@ -74,13 +73,13 @@ class SpaceNode( state = state, onBackClick = ::navigateUp, onLeaveSpaceClick = { - callback.onLeaveSpace() + callback.startLeaveSpaceFlow() }, onRoomClick = { spaceRoom -> - callback.onOpenRoom(spaceRoom.roomId, spaceRoom.via) + callback.navigateToRoom(spaceRoom.roomId, spaceRoom.via) }, onDetailsClick = { - callback.onOpenDetails() + callback.navigateToRoomDetails() }, onShareSpace = { onShareRoom(context) @@ -92,7 +91,7 @@ class SpaceNode( acceptDeclineInviteView.Render( state = state.acceptDeclineInviteState, onAcceptInviteSuccess = { roomId -> - callback.onOpenRoom(roomId, emptyList()) + callback.navigateToRoom(roomId, emptyList()) }, onDeclineInviteSuccess = { roomId -> // No action needed diff --git a/features/space/impl/src/test/kotlin/io/element/android/features/space/impl/DefaultSpaceEntryPointTest.kt b/features/space/impl/src/test/kotlin/io/element/android/features/space/impl/DefaultSpaceEntryPointTest.kt index 2d43ef0d39..3cf6e398f2 100644 --- a/features/space/impl/src/test/kotlin/io/element/android/features/space/impl/DefaultSpaceEntryPointTest.kt +++ b/features/space/impl/src/test/kotlin/io/element/android/features/space/impl/DefaultSpaceEntryPointTest.kt @@ -44,9 +44,9 @@ class DefaultSpaceEntryPointTest { ) } val callback = object : SpaceEntryPoint.Callback { - override fun onOpenRoom(roomId: RoomId, viaParameters: List) = lambdaError() - override fun onOpenDetails() = lambdaError() - override fun onOpenMemberList() = lambdaError() + override fun navigateToRoom(roomId: RoomId, viaParameters: List) = lambdaError() + override fun navigateToRoomDetails() = lambdaError() + override fun navigateToRoomMemberList() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .inputs(nodeInputs) diff --git a/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartChatEntryPoint.kt b/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartChatEntryPoint.kt index 17b9b902e2..ca200bed1a 100644 --- a/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartChatEntryPoint.kt +++ b/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartChatEntryPoint.kt @@ -21,7 +21,7 @@ interface StartChatEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) - fun onOpenRoomDirectory() + fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) + fun navigateToRoomDirectory() } } diff --git a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/StartChatNavigator.kt b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/StartChatNavigator.kt index a45b4dddab..70babb2928 100644 --- a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/StartChatNavigator.kt +++ b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/StartChatNavigator.kt @@ -17,7 +17,7 @@ import io.element.android.libraries.architecture.overlay.operation.show import io.element.android.libraries.matrix.api.core.RoomIdOrAlias interface StartChatNavigator : Plugin { - fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) + fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) fun onCreateNewRoom() fun onShowJoinRoomByAddress() fun onDismissJoinRoomByAddress() @@ -30,7 +30,8 @@ class DefaultStartChatNavigator( private val openRoom: (RoomIdOrAlias, List) -> Unit, private val openRoomDirectory: () -> Unit, ) : StartChatNavigator { - override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) = openRoom(roomIdOrAlias, serverNames) + override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) = + openRoom(roomIdOrAlias, serverNames) override fun onOpenRoomDirectory() = openRoomDirectory() diff --git a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/StartChatFlowNode.kt b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/StartChatFlowNode.kt index 30d1f3a2cf..e875dcc748 100644 --- a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/StartChatFlowNode.kt +++ b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/StartChatFlowNode.kt @@ -64,10 +64,10 @@ class StartChatFlowNode( backstack = backstack, overlay = overlay, openRoom = { roomIdOrAlias, viaServers -> - plugins().forEach { it.onOpenRoom(roomIdOrAlias, viaServers) } + plugins().forEach { it.onRoomCreated(roomIdOrAlias, viaServers) } }, openRoomDirectory = { - plugins().forEach { it.onOpenRoomDirectory() } + plugins().forEach { it.navigateToRoomDirectory() } } ) @@ -79,7 +79,7 @@ class StartChatFlowNode( NavTarget.NewRoom -> { val callback = object : CreateRoomEntryPoint.Callback { override fun onRoomCreated(roomId: RoomId) { - navigator.onOpenRoom(roomId.toRoomIdOrAlias(), emptyList()) + navigator.onRoomCreated(roomId.toRoomIdOrAlias(), emptyList()) } } createRoomEntryPoint.nodeBuilder(parentNode = this, buildContext = buildContext) diff --git a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressPresenter.kt b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressPresenter.kt index 540c1a4784..350a59de73 100644 --- a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressPresenter.kt +++ b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressPresenter.kt @@ -94,7 +94,7 @@ class JoinRoomByAddressPresenter( private fun onRoomFound(state: RoomAddressState.RoomFound) { navigator.onDismissJoinRoomByAddress() - navigator.onOpenRoom( + navigator.onRoomCreated( roomIdOrAlias = state.resolved.roomId.toRoomIdOrAlias(), serverNames = state.resolved.servers ) diff --git a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/root/StartChatNode.kt b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/root/StartChatNode.kt index 9a9ca85160..b5cc7f2506 100644 --- a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/root/StartChatNode.kt +++ b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/root/StartChatNode.kt @@ -53,7 +53,7 @@ class StartChatNode( onCloseClick = this::navigateUp, onNewRoomClick = navigator::onCreateNewRoom, onOpenDM = { - navigator.onOpenRoom(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList()) + navigator.onRoomCreated(roomIdOrAlias = it.toRoomIdOrAlias(), serverNames = emptyList()) }, onJoinByAddressClick = navigator::onShowJoinRoomByAddress, onInviteFriendsClick = { invitePeople(activity) }, diff --git a/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/DefaultStartChatEntryPointTest.kt b/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/DefaultStartChatEntryPointTest.kt index 8f4a41a3fa..6da424c01a 100644 --- a/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/DefaultStartChatEntryPointTest.kt +++ b/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/DefaultStartChatEntryPointTest.kt @@ -40,8 +40,8 @@ class DefaultStartChatEntryPointTest { ) } val callback = object : StartChatEntryPoint.Callback { - override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) = lambdaError() - override fun onOpenRoomDirectory() = lambdaError() + override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) = lambdaError() + override fun navigateToRoomDirectory() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback) diff --git a/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/FakeStartChatNavigator.kt b/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/FakeStartChatNavigator.kt index 9de00e0a4c..95a8801fd7 100644 --- a/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/FakeStartChatNavigator.kt +++ b/features/startchat/impl/src/test/kotlin/io/element/android/features/startchat/impl/FakeStartChatNavigator.kt @@ -17,7 +17,7 @@ class FakeStartChatNavigator( private val dismissJoinRoomByAddressLambda: () -> Unit = {}, private val openRoomDirectoryLambda: () -> Unit = {}, ) : StartChatNavigator { - override fun onOpenRoom(roomIdOrAlias: RoomIdOrAlias, serverNames: List) { + override fun onRoomCreated(roomIdOrAlias: RoomIdOrAlias, serverNames: List) { openRoomLambda(roomIdOrAlias, serverNames) } diff --git a/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfileEntryPoint.kt b/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfileEntryPoint.kt index 70968aad61..20f4a10955 100644 --- a/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfileEntryPoint.kt +++ b/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfileEntryPoint.kt @@ -19,7 +19,7 @@ interface UserProfileEntryPoint : FeatureEntryPoint { data class Params(val userId: UserId) : NodeInputs interface Callback : Plugin { - fun onOpenRoom(roomId: RoomId) + fun navigateToRoom(roomId: RoomId) } interface NodeBuilder { diff --git a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/UserProfileFlowNode.kt b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/UserProfileFlowNode.kt index da3adef973..c9df5024be 100644 --- a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/UserProfileFlowNode.kt +++ b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/UserProfileFlowNode.kt @@ -73,19 +73,19 @@ class UserProfileFlowNode( return when (navTarget) { NavTarget.Root -> { 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)) } - override fun onStartDM(roomId: RoomId) { - plugins().forEach { it.onOpenRoom(roomId) } + override fun navigateToRoom(roomId: RoomId) { + plugins().forEach { it.navigateToRoom(roomId) } } - override fun onStartCall(dmRoomId: RoomId) { + override fun startCall(dmRoomId: RoomId) { elementCallEntryPoint.startCall(CallType.RoomCall(sessionId = sessionId, roomId = dmRoomId)) } - override fun onVerifyUser(userId: UserId) { + override fun startVerifyUserFlow(userId: UserId) { backstack.push(NavTarget.VerifyUser(userId)) } } @@ -98,11 +98,11 @@ class UserProfileFlowNode( backstack.pop() } - override fun onViewInTimeline(eventId: EventId) { + override fun viewInTimeline(eventId: EventId) { // Cannot happen } - override fun onForwardEvent(eventId: EventId) { + override fun forwardEvent(eventId: EventId) { // Cannot happen } } diff --git a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfileNode.kt b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfileNode.kt index 735957946a..c182bcb26c 100644 --- a/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfileNode.kt +++ b/features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/root/UserProfileNode.kt @@ -63,7 +63,7 @@ class UserProfileNode( } fun onStartDM(roomId: RoomId) { - callback.onStartDM(roomId) + callback.navigateToRoom(roomId) } val state = presenter.present() @@ -74,9 +74,9 @@ class UserProfileNode( goBack = this::navigateUp, onShareUser = ::onShareUser, onOpenDm = ::onStartDM, - onStartCall = callback::onStartCall, - openAvatarPreview = callback::openAvatarPreview, - onVerifyClick = callback::onVerifyUser, + onStartCall = callback::startCall, + openAvatarPreview = callback::navigateToAvatarPreview, + onVerifyClick = callback::startVerifyUserFlow, ) } } diff --git a/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfileEntryPointTest.kt b/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfileEntryPointTest.kt index 75bc434048..493b9045cc 100644 --- a/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfileEntryPointTest.kt +++ b/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/DefaultUserProfileEntryPointTest.kt @@ -67,7 +67,7 @@ class DefaultUserProfileEntryPointTest { ) } val callback = object : UserProfileEntryPoint.Callback { - override fun onOpenRoom(roomId: RoomId) { + override fun navigateToRoom(roomId: RoomId) { lambdaError() } } diff --git a/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileNodeHelper.kt b/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileNodeHelper.kt index 61f4669769..af5f9691e0 100644 --- a/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileNodeHelper.kt +++ b/features/userprofile/shared/src/main/kotlin/io/element/android/features/userprofile/shared/UserProfileNodeHelper.kt @@ -21,10 +21,10 @@ class UserProfileNodeHelper( private val userId: UserId, ) { interface Callback : NodeInputs { - fun openAvatarPreview(username: String, avatarUrl: String) - fun onStartDM(roomId: RoomId) - fun onStartCall(dmRoomId: RoomId) - fun onVerifyUser(userId: UserId) + fun navigateToAvatarPreview(username: String, avatarUrl: String) + fun navigateToRoom(roomId: RoomId) + fun startCall(dmRoomId: RoomId) + fun startVerifyUserFlow(userId: UserId) } fun onShareUser( diff --git a/features/verifysession/api/src/main/kotlin/io/element/android/features/verifysession/api/OutgoingVerificationEntryPoint.kt b/features/verifysession/api/src/main/kotlin/io/element/android/features/verifysession/api/OutgoingVerificationEntryPoint.kt index 60536504d2..0d4fe76156 100644 --- a/features/verifysession/api/src/main/kotlin/io/element/android/features/verifysession/api/OutgoingVerificationEntryPoint.kt +++ b/features/verifysession/api/src/main/kotlin/io/element/android/features/verifysession/api/OutgoingVerificationEntryPoint.kt @@ -29,7 +29,7 @@ interface OutgoingVerificationEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onLearnMoreAboutEncryption() + fun navigateToLearnMoreAboutEncryption() fun onBack() fun onDone() } diff --git a/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationNode.kt b/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationNode.kt index 9941ce58fe..c5a04f7834 100644 --- a/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationNode.kt +++ b/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationNode.kt @@ -42,7 +42,7 @@ class OutgoingVerificationNode( OutgoingVerificationView( state = state, modifier = modifier, - onLearnMoreClick = callback::onLearnMoreAboutEncryption, + onLearnMoreClick = callback::navigateToLearnMoreAboutEncryption, onFinish = callback::onDone, onBack = callback::onBack, ) diff --git a/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/DefaultOutgoingVerificationEntryPointTest.kt b/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/DefaultOutgoingVerificationEntryPointTest.kt index 52ff36dbd6..7e152383f9 100644 --- a/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/DefaultOutgoingVerificationEntryPointTest.kt +++ b/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/DefaultOutgoingVerificationEntryPointTest.kt @@ -34,7 +34,7 @@ class DefaultOutgoingVerificationEntryPointTest { ) } val callback = object : OutgoingVerificationEntryPoint.Callback { - override fun onLearnMoreAboutEncryption() = lambdaError() + override fun navigateToLearnMoreAboutEncryption() = lambdaError() override fun onBack() = lambdaError() override fun onDone() = lambdaError() } diff --git a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/folder/ViewFolderNode.kt b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/folder/ViewFolderNode.kt index 4c57ea4135..b7c6fe1bd1 100644 --- a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/folder/ViewFolderNode.kt +++ b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/folder/ViewFolderNode.kt @@ -35,7 +35,7 @@ class ViewFolderNode( interface Callback : Plugin { fun onBackClick() - fun onNavigateTo(item: Item) + fun navigateToItem(item: Item) } private val inputs: Inputs = inputs() @@ -50,7 +50,7 @@ class ViewFolderNode( } private fun onNavigateTo(item: Item) { - plugins().forEach { it.onNavigateTo(item) } + plugins().forEach { it.navigateToItem(item) } } @Composable diff --git a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/root/ViewFolderFlowNode.kt b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/root/ViewFolderFlowNode.kt index d57824f2fd..3c7935464b 100644 --- a/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/root/ViewFolderFlowNode.kt +++ b/features/viewfolder/impl/src/main/kotlin/io/element/android/features/viewfolder/impl/root/ViewFolderFlowNode.kt @@ -111,7 +111,7 @@ class ViewFolderFlowNode( onDone() } - override fun onNavigateTo(item: Item) { + override fun navigateToItem(item: Item) { when (item) { Item.Parent -> { // Should not happen when in Root since parent is not accessible from root (canGoUp set to false) diff --git a/libraries/accountselect/api/src/main/kotlin/io/element/android/libraries/accountselect/api/AccountSelectEntryPoint.kt b/libraries/accountselect/api/src/main/kotlin/io/element/android/libraries/accountselect/api/AccountSelectEntryPoint.kt index 72da3491de..112293eb6a 100644 --- a/libraries/accountselect/api/src/main/kotlin/io/element/android/libraries/accountselect/api/AccountSelectEntryPoint.kt +++ b/libraries/accountselect/api/src/main/kotlin/io/element/android/libraries/accountselect/api/AccountSelectEntryPoint.kt @@ -22,7 +22,7 @@ interface AccountSelectEntryPoint : FeatureEntryPoint { } interface Callback : Plugin { - fun onSelectAccount(sessionId: SessionId) + fun onAccountSelected(sessionId: SessionId) fun onCancel() } } diff --git a/libraries/accountselect/impl/src/main/kotlin/io/element/android/libraries/accountselect/impl/AccountSelectNode.kt b/libraries/accountselect/impl/src/main/kotlin/io/element/android/libraries/accountselect/impl/AccountSelectNode.kt index 5478d9fe43..f0a543340c 100644 --- a/libraries/accountselect/impl/src/main/kotlin/io/element/android/libraries/accountselect/impl/AccountSelectNode.kt +++ b/libraries/accountselect/impl/src/main/kotlin/io/element/android/libraries/accountselect/impl/AccountSelectNode.kt @@ -32,8 +32,8 @@ class AccountSelectNode( callbacks.forEach { it.onCancel() } } - private fun onSelectAccount(sessionId: SessionId) { - callbacks.forEach { it.onSelectAccount(sessionId) } + private fun onAccountSelected(sessionId: SessionId) { + callbacks.forEach { it.onAccountSelected(sessionId) } } @Composable @@ -42,7 +42,7 @@ class AccountSelectNode( AccountSelectView( state = state, onDismiss = ::onDismiss, - onSelectAccount = ::onSelectAccount, + onSelectAccount = ::onAccountSelected, modifier = modifier, ) } diff --git a/libraries/accountselect/impl/src/test/kotlin/io/element/android/libraries/accountselect/impl/DefaultAccountSelectEntryPointTest.kt b/libraries/accountselect/impl/src/test/kotlin/io/element/android/libraries/accountselect/impl/DefaultAccountSelectEntryPointTest.kt index d61dcc89ba..230248d421 100644 --- a/libraries/accountselect/impl/src/test/kotlin/io/element/android/libraries/accountselect/impl/DefaultAccountSelectEntryPointTest.kt +++ b/libraries/accountselect/impl/src/test/kotlin/io/element/android/libraries/accountselect/impl/DefaultAccountSelectEntryPointTest.kt @@ -32,7 +32,7 @@ class DefaultAccountSelectEntryPointTest { ) } val callback = object : AccountSelectEntryPoint.Callback { - override fun onSelectAccount(sessionId: SessionId) = lambdaError() + override fun onAccountSelected(sessionId: SessionId) = lambdaError() override fun onCancel() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) diff --git a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaGalleryEntryPoint.kt b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaGalleryEntryPoint.kt index 119c1002c8..702ce181db 100644 --- a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaGalleryEntryPoint.kt +++ b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaGalleryEntryPoint.kt @@ -23,7 +23,7 @@ interface MediaGalleryEntryPoint : FeatureEntryPoint { interface Callback : Plugin { fun onBackClick() - fun onViewInTimeline(eventId: EventId) - fun forwardEvent(eventId: EventId) + fun viewInTimeline(eventId: EventId) + fun forward(eventId: EventId) } } diff --git a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaViewerEntryPoint.kt b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaViewerEntryPoint.kt index b16de69b98..da1227d66b 100644 --- a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaViewerEntryPoint.kt +++ b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/MediaViewerEntryPoint.kt @@ -30,8 +30,8 @@ interface MediaViewerEntryPoint : FeatureEntryPoint { interface Callback : Plugin { fun onDone() - fun onViewInTimeline(eventId: EventId) - fun onForwardEvent(eventId: EventId) + fun viewInTimeline(eventId: EventId) + fun forwardEvent(eventId: EventId) } data class Params( diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/MediaGalleryNode.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/MediaGalleryNode.kt index 6ee31c6520..ff1359b672 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/MediaGalleryNode.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/MediaGalleryNode.kt @@ -38,9 +38,9 @@ class MediaGalleryNode( interface Callback : Plugin { fun onBackClick() - fun onItemClick(item: MediaItem.Event) - fun onViewInTimeline(eventId: EventId) - fun onForward(eventId: EventId) + fun showItem(item: MediaItem.Event) + fun viewInTimeline(eventId: EventId) + fun forward(eventId: EventId) } private fun onBackClick() { @@ -51,19 +51,19 @@ class MediaGalleryNode( override fun onViewInTimelineClick(eventId: EventId) { plugins().forEach { - it.onViewInTimeline(eventId) + it.viewInTimeline(eventId) } } override fun onForwardClick(eventId: EventId) { plugins().forEach { - it.onForward(eventId) + it.forward(eventId) } } private fun onItemClick(item: MediaItem.Event) { plugins().forEach { - it.onItemClick(item) + it.showItem(item) } } diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/root/MediaGalleryFlowNode.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/root/MediaGalleryFlowNode.kt index 76f025006f..b72a3fbd46 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/root/MediaGalleryFlowNode.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/gallery/root/MediaGalleryFlowNode.kt @@ -78,13 +78,13 @@ class MediaGalleryFlowNode( private fun onViewInTimeline(eventId: EventId) { plugins().forEach { - it.onViewInTimeline(eventId) + it.viewInTimeline(eventId) } } private fun forwardEvent(eventId: EventId) { plugins().forEach { - it.forwardEvent(eventId) + it.forward(eventId) } } @@ -96,15 +96,15 @@ class MediaGalleryFlowNode( this@MediaGalleryFlowNode.onBackClick() } - override fun onViewInTimeline(eventId: EventId) { + override fun viewInTimeline(eventId: EventId) { this@MediaGalleryFlowNode.onViewInTimeline(eventId) } - override fun onForward(eventId: EventId) { + override fun forward(eventId: EventId) { forwardEvent(eventId) } - override fun onItemClick(item: MediaItem.Event) { + override fun showItem(item: MediaItem.Event) { val mode = when (item) { is MediaItem.Audio, is MediaItem.Voice, @@ -131,13 +131,13 @@ class MediaGalleryFlowNode( overlay.hide() } - override fun onViewInTimeline(eventId: EventId) { + override fun viewInTimeline(eventId: 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 - forwardEvent(eventId) + this@MediaGalleryFlowNode.forwardEvent(eventId) } } mediaViewerEntryPoint.nodeBuilder(this, buildContext) diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerNode.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerNode.kt index ee874156cd..a62784555a 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerNode.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerNode.kt @@ -67,13 +67,13 @@ class MediaViewerNode( override fun onViewInTimelineClick(eventId: EventId) { plugins().forEach { - it.onViewInTimeline(eventId) + it.viewInTimeline(eventId) } } override fun onForwardClick(eventId: EventId) { plugins().forEach { - it.onForwardEvent(eventId) + it.forwardEvent(eventId) } } diff --git a/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaGalleryEntryPointTest.kt b/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaGalleryEntryPointTest.kt index 38040426e1..8d38615ff3 100644 --- a/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaGalleryEntryPointTest.kt +++ b/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaGalleryEntryPointTest.kt @@ -42,8 +42,8 @@ class DefaultMediaGalleryEntryPointTest { } val callback = object : MediaGalleryEntryPoint.Callback { override fun onBackClick() = lambdaError() - override fun onViewInTimeline(eventId: EventId) = lambdaError() - override fun forwardEvent(eventId: EventId) = lambdaError() + override fun viewInTimeline(eventId: EventId) = lambdaError() + override fun forward(eventId: EventId) = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback) diff --git a/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaViewerEntryPointTest.kt b/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaViewerEntryPointTest.kt index a1f60cc124..ab31b5611e 100644 --- a/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaViewerEntryPointTest.kt +++ b/libraries/mediaviewer/impl/src/test/kotlin/io/element/android/libraries/mediaviewer/impl/DefaultMediaViewerEntryPointTest.kt @@ -71,8 +71,8 @@ class DefaultMediaViewerEntryPointTest { } val callback = object : MediaViewerEntryPoint.Callback { override fun onDone() = lambdaError() - override fun onViewInTimeline(eventId: EventId) = lambdaError() - override fun onForwardEvent(eventId: EventId) = lambdaError() + override fun viewInTimeline(eventId: EventId) = lambdaError() + override fun forwardEvent(eventId: EventId) = lambdaError() } val params = createMediaViewerEntryPointParams() val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) @@ -115,8 +115,8 @@ class DefaultMediaViewerEntryPointTest { } val callback = object : MediaViewerEntryPoint.Callback { override fun onDone() = lambdaError() - override fun onViewInTimeline(eventId: EventId) = lambdaError() - override fun onForwardEvent(eventId: EventId) = lambdaError() + override fun viewInTimeline(eventId: EventId) = lambdaError() + override fun forwardEvent(eventId: EventId) = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .avatar( diff --git a/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectNode.kt b/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectNode.kt index a7e6dc0cb0..e72c45ed22 100644 --- a/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectNode.kt +++ b/libraries/roomselect/impl/src/main/kotlin/io/element/android/libraries/roomselect/impl/RoomSelectNode.kt @@ -42,7 +42,7 @@ class RoomSelectNode( callbacks.forEach { it.onCancel() } } - private fun onSubmit(roomIds: List) { + private fun onRoomSelected(roomIds: List) { callbacks.forEach { it.onRoomSelected(roomIds) } } @@ -52,7 +52,7 @@ class RoomSelectNode( RoomSelectView( state = state, onDismiss = ::onDismiss, - onSubmit = ::onSubmit, + onSubmit = ::onRoomSelected, modifier = modifier ) } diff --git a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/NotificationTroubleShootEntryPoint.kt b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/NotificationTroubleShootEntryPoint.kt index bf0c6bb883..034abe9400 100644 --- a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/NotificationTroubleShootEntryPoint.kt +++ b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/NotificationTroubleShootEntryPoint.kt @@ -22,6 +22,6 @@ interface NotificationTroubleShootEntryPoint : FeatureEntryPoint { interface Callback : Plugin { fun onDone() - fun openIgnoredUsers() + fun navigateToBlockedUsers() } } diff --git a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/PushHistoryEntryPoint.kt b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/PushHistoryEntryPoint.kt index 0eab9b8e5a..bd0753d5cd 100644 --- a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/PushHistoryEntryPoint.kt +++ b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/PushHistoryEntryPoint.kt @@ -24,6 +24,6 @@ interface PushHistoryEntryPoint : FeatureEntryPoint { interface Callback : Plugin { fun onDone() - fun navigateTo(roomId: RoomId, eventId: EventId) + fun navigateToEvent(roomId: RoomId, eventId: EventId) } } diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsNode.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsNode.kt index 508010a3d6..9ab1156d49 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsNode.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/TroubleshootNotificationsNode.kt @@ -43,7 +43,7 @@ class TroubleshootNotificationsNode( override fun openIgnoredUsers() { plugins().forEach { - it.openIgnoredUsers() + it.navigateToBlockedUsers() } } diff --git a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/history/PushHistoryNode.kt b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/history/PushHistoryNode.kt index 69070298ec..e8b17bf2ca 100644 --- a/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/history/PushHistoryNode.kt +++ b/libraries/troubleshoot/impl/src/main/kotlin/io/element/android/libraries/troubleshoot/impl/history/PushHistoryNode.kt @@ -39,7 +39,7 @@ class PushHistoryNode( override fun navigateTo(roomId: RoomId, eventId: EventId) { plugins().forEach { - it.navigateTo(roomId, eventId) + it.navigateToEvent(roomId, eventId) } } diff --git a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/DefaultNotificationTroubleShootEntryPointTest.kt b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/DefaultNotificationTroubleShootEntryPointTest.kt index e0d817a4ca..a506502fc1 100644 --- a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/DefaultNotificationTroubleShootEntryPointTest.kt +++ b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/DefaultNotificationTroubleShootEntryPointTest.kt @@ -34,7 +34,7 @@ class DefaultNotificationTroubleShootEntryPointTest { } val callback = object : NotificationTroubleShootEntryPoint.Callback { override fun onDone() = lambdaError() - override fun openIgnoredUsers() = lambdaError() + override fun navigateToBlockedUsers() = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback) diff --git a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/history/DefaultPushHistoryEntryPointTest.kt b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/history/DefaultPushHistoryEntryPointTest.kt index 858956488c..aa73649c62 100644 --- a/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/history/DefaultPushHistoryEntryPointTest.kt +++ b/libraries/troubleshoot/impl/src/test/kotlin/io/element/android/libraries/troubleshoot/impl/history/DefaultPushHistoryEntryPointTest.kt @@ -46,7 +46,7 @@ class DefaultPushHistoryEntryPointTest { } val callback = object : PushHistoryEntryPoint.Callback { override fun onDone() = lambdaError() - override fun navigateTo(roomId: RoomId, eventId: EventId) = lambdaError() + override fun navigateToEvent(roomId: RoomId, eventId: EventId) = lambdaError() } val result = entryPoint.nodeBuilder(parentNode, BuildContext.root(null)) .callback(callback)