mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-31 03:17:13 +01:00
Adding new method into navigator
This commit is contained in:
parent
1091ae41ad
commit
3de96a3a0c
@ -118,7 +118,7 @@ class SessionOverviewFragment :
|
||||
|
||||
private fun updateEntryDetails(deviceId: String) {
|
||||
views.sessionOverviewEntryDetails.setOnClickListener {
|
||||
viewNavigator.navigateToSessionDetails(requireContext(), deviceId)
|
||||
viewNavigator.goToSessionDetails(requireContext(), deviceId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,16 @@ package im.vector.app.features.settings.devices.v2.overview
|
||||
|
||||
import android.content.Context
|
||||
import im.vector.app.features.settings.devices.v2.details.SessionDetailsActivity
|
||||
import im.vector.app.features.settings.devices.v2.rename.RenameSessionActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
class SessionOverviewViewNavigator @Inject constructor() {
|
||||
|
||||
fun navigateToSessionDetails(context: Context, deviceId: String) {
|
||||
fun goToSessionDetails(context: Context, deviceId: String) {
|
||||
context.startActivity(SessionDetailsActivity.newIntent(context, deviceId))
|
||||
}
|
||||
|
||||
fun goToRenameSession(context: Context, deviceId: String) {
|
||||
context.startActivity(RenameSessionActivity.newIntent(context, deviceId))
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package im.vector.app.features.settings.devices.v2.overview
|
||||
|
||||
import android.content.Intent
|
||||
import im.vector.app.features.settings.devices.v2.details.SessionDetailsActivity
|
||||
import im.vector.app.features.settings.devices.v2.rename.RenameSessionActivity
|
||||
import im.vector.app.test.fakes.FakeContext
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
@ -38,6 +39,7 @@ class SessionOverviewViewNavigatorTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
mockkObject(SessionDetailsActivity)
|
||||
mockkObject(RenameSessionActivity)
|
||||
}
|
||||
|
||||
@After
|
||||
@ -52,7 +54,22 @@ class SessionOverviewViewNavigatorTest {
|
||||
context.givenStartActivity(intent)
|
||||
|
||||
// When
|
||||
sessionOverviewViewNavigator.navigateToSessionDetails(context.instance, A_SESSION_ID)
|
||||
sessionOverviewViewNavigator.goToSessionDetails(context.instance, A_SESSION_ID)
|
||||
|
||||
// Then
|
||||
verify {
|
||||
context.instance.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given a session id when navigating to rename screen then it starts the correct activity`() {
|
||||
// Given
|
||||
val intent = givenIntentForRenameSession(A_SESSION_ID)
|
||||
context.givenStartActivity(intent)
|
||||
|
||||
// When
|
||||
sessionOverviewViewNavigator.goToRenameSession(context.instance, A_SESSION_ID)
|
||||
|
||||
// Then
|
||||
verify {
|
||||
@ -65,4 +82,10 @@ class SessionOverviewViewNavigatorTest {
|
||||
every { SessionDetailsActivity.newIntent(context.instance, sessionId) } returns intent
|
||||
return intent
|
||||
}
|
||||
|
||||
private fun givenIntentForRenameSession(sessionId: String): Intent {
|
||||
val intent = mockk<Intent>()
|
||||
every { RenameSessionActivity.newIntent(context.instance, sessionId) } returns intent
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user