Rename PermalinkUseCase to PermalinkFactory

This commit is contained in:
Benoit Marty 2022-10-04 16:49:03 +02:00 committed by Benoit Marty
parent 37f34dbdfd
commit 3bc3da1073
4 changed files with 12 additions and 12 deletions

View file

@ -32,7 +32,7 @@ import im.vector.app.core.resources.BuildMeta
import im.vector.app.core.utils.startSharePlainTextIntent
import im.vector.app.databinding.FragmentHomeDrawerBinding
import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.permalink.PermalinkUseCase
import im.vector.app.features.permalink.PermalinkFactory
import im.vector.app.features.settings.VectorPreferences
import im.vector.app.features.settings.VectorSettingsActivity
import im.vector.app.features.spaces.SpaceListFragment
@ -50,7 +50,7 @@ class HomeDrawerFragment :
@Inject lateinit var vectorPreferences: VectorPreferences
@Inject lateinit var avatarRenderer: AvatarRenderer
@Inject lateinit var buildMeta: BuildMeta
@Inject lateinit var permalinkUseCase: PermalinkUseCase
@Inject lateinit var permalinkFactory: PermalinkFactory
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
@ -103,7 +103,7 @@ class HomeDrawerFragment :
}
views.homeDrawerInviteFriendButton.debouncedClicks {
permalinkUseCase.createPermalinkOfCurrentUser()?.let { permalink ->
permalinkFactory.createPermalinkOfCurrentUser()?.let { permalink ->
analyticsTracker.screen(MobileScreen(screenName = MobileScreen.ScreenName.InviteFriends))
val text = getString(R.string.invite_friends_text, permalink)

View file

@ -169,7 +169,7 @@ import im.vector.app.features.notifications.NotificationDrawerManager
import im.vector.app.features.notifications.NotificationUtils
import im.vector.app.features.permalink.NavigationInterceptor
import im.vector.app.features.permalink.PermalinkHandler
import im.vector.app.features.permalink.PermalinkUseCase
import im.vector.app.features.permalink.PermalinkFactory
import im.vector.app.features.poll.PollMode
import im.vector.app.features.reactions.EmojiReactionPickerActivity
import im.vector.app.features.roomprofile.RoomProfileActivity
@ -248,7 +248,7 @@ class TimelineFragment :
@Inject lateinit var clock: Clock
@Inject lateinit var vectorFeatures: VectorFeatures
@Inject lateinit var galleryOrCameraDialogHelperFactory: GalleryOrCameraDialogHelperFactory
@Inject lateinit var permalinkUseCase: PermalinkUseCase
@Inject lateinit var permalinkFactory: PermalinkFactory
companion object {
const val MAX_TYPING_MESSAGE_USERS_COUNT = 4
@ -869,7 +869,7 @@ class TimelineFragment :
}
R.id.menu_thread_timeline_copy_link -> {
getRootThreadEventId()?.let {
val permalink = permalinkUseCase.createPermalink(timelineArgs.roomId, it)
val permalink = permalinkFactory.createPermalink(timelineArgs.roomId, it)
copyToClipboard(requireContext(), permalink, false)
showSnackWithMessage(getString(R.string.copied_to_clipboard))
}
@ -881,7 +881,7 @@ class TimelineFragment :
}
R.id.menu_thread_timeline_share -> {
getRootThreadEventId()?.let {
val permalink = permalinkUseCase.createPermalink(timelineArgs.roomId, it)
val permalink = permalinkFactory.createPermalink(timelineArgs.roomId, it)
shareText(requireContext(), permalink)
}
true
@ -1790,7 +1790,7 @@ class TimelineFragment :
}
}
is EventSharedAction.CopyPermalink -> {
val permalink = permalinkUseCase.createPermalink(timelineArgs.roomId, action.eventId)
val permalink = permalinkFactory.createPermalink(timelineArgs.roomId, action.eventId)
copyToClipboard(requireContext(), permalink, false)
showSnackWithMessage(getString(R.string.copied_to_clipboard))
}

View file

@ -22,7 +22,7 @@ import javax.inject.Inject
/**
* Contains synchronous methods to create permalinks from the Session.
*/
class PermalinkUseCase @Inject constructor(
class PermalinkFactory @Inject constructor(
private val session: Session,
) {
fun createPermalinkOfCurrentUser(): String? {

View file

@ -38,7 +38,7 @@ import im.vector.app.databinding.FragmentPublicRoomsBinding
import im.vector.app.features.analytics.plan.ViewRoom
import im.vector.app.features.permalink.NavigationInterceptor
import im.vector.app.features.permalink.PermalinkHandler
import im.vector.app.features.permalink.PermalinkUseCase
import im.vector.app.features.permalink.PermalinkFactory
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
@ -60,7 +60,7 @@ class PublicRoomsFragment :
@Inject lateinit var publicRoomsController: PublicRoomsController
@Inject lateinit var permalinkHandler: PermalinkHandler
@Inject lateinit var permalinkUseCase: PermalinkUseCase
@Inject lateinit var permalinkFactory: PermalinkFactory
private val viewModel: RoomDirectoryViewModel by activityViewModel()
private lateinit var sharedActionViewModel: RoomDirectorySharedActionViewModel
@ -128,7 +128,7 @@ class PublicRoomsFragment :
override fun onUnknownRoomClicked(roomIdOrAlias: String) {
viewLifecycleOwner.lifecycleScope.launch {
val permalink = permalinkUseCase.createPermalink(roomIdOrAlias)
val permalink = permalinkFactory.createPermalink(roomIdOrAlias)
val isHandled = permalinkHandler
.launch(requireActivity(), permalink, object : NavigationInterceptor {
override fun navToRoom(roomId: String?, eventId: String?, deepLink: Uri?, rootThreadEventId: String?): Boolean {