Using "Other sessions" title everytime
This commit is contained in:
parent
913fb1e5dc
commit
62f742bf66
@ -223,7 +223,6 @@ class VectorSettingsDevicesFragment :
|
||||
override fun onViewAllClicked() {
|
||||
viewNavigator.navigateToOtherSessions(
|
||||
requireActivity(),
|
||||
R.string.device_manager_header_section_security_recommendations_title,
|
||||
DeviceManagerFilterType.UNVERIFIED,
|
||||
excludeCurrentDevice = true
|
||||
)
|
||||
@ -233,7 +232,6 @@ class VectorSettingsDevicesFragment :
|
||||
override fun onViewAllClicked() {
|
||||
viewNavigator.navigateToOtherSessions(
|
||||
requireActivity(),
|
||||
R.string.device_manager_header_section_security_recommendations_title,
|
||||
DeviceManagerFilterType.INACTIVE,
|
||||
excludeCurrentDevice = true
|
||||
)
|
||||
@ -447,7 +445,6 @@ class VectorSettingsDevicesFragment :
|
||||
override fun onViewAllOtherSessionsClicked() {
|
||||
viewNavigator.navigateToOtherSessions(
|
||||
context = requireActivity(),
|
||||
titleResourceId = R.string.device_manager_sessions_other_title,
|
||||
defaultFilter = DeviceManagerFilterType.ALL_SESSIONS,
|
||||
excludeCurrentDevice = true
|
||||
)
|
||||
|
@ -31,12 +31,11 @@ class VectorSettingsDevicesViewNavigator @Inject constructor() {
|
||||
|
||||
fun navigateToOtherSessions(
|
||||
context: Context,
|
||||
titleResourceId: Int,
|
||||
defaultFilter: DeviceManagerFilterType,
|
||||
excludeCurrentDevice: Boolean,
|
||||
) {
|
||||
context.startActivity(
|
||||
OtherSessionsActivity.newIntent(context, titleResourceId, defaultFilter, excludeCurrentDevice)
|
||||
OtherSessionsActivity.newIntent(context, defaultFilter, excludeCurrentDevice)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.annotation.StringRes
|
||||
import com.airbnb.mvrx.Mavericks
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.core.extensions.addFragment
|
||||
@ -48,13 +47,11 @@ class OtherSessionsActivity : SimpleFragmentActivity() {
|
||||
companion object {
|
||||
fun newIntent(
|
||||
context: Context,
|
||||
@StringRes
|
||||
titleResourceId: Int,
|
||||
defaultFilter: DeviceManagerFilterType,
|
||||
excludeCurrentDevice: Boolean,
|
||||
): Intent {
|
||||
return Intent(context, OtherSessionsActivity::class.java).apply {
|
||||
putExtra(Mavericks.KEY_ARG, OtherSessionsArgs(titleResourceId, defaultFilter, excludeCurrentDevice))
|
||||
putExtra(Mavericks.KEY_ARG, OtherSessionsArgs(defaultFilter, excludeCurrentDevice))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,11 @@
|
||||
package im.vector.app.features.settings.devices.v2.othersessions
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.StringRes
|
||||
import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class OtherSessionsArgs(
|
||||
@StringRes
|
||||
val titleResourceId: Int,
|
||||
val defaultFilter: DeviceManagerFilterType,
|
||||
val excludeCurrentDevice: Boolean,
|
||||
) : Parcelable
|
||||
|
@ -182,7 +182,9 @@ class OtherSessionsFragment :
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupToolbar(views.otherSessionsToolbar).setTitle(args.titleResourceId).allowBack()
|
||||
setupToolbar(views.otherSessionsToolbar)
|
||||
.setTitle(R.string.device_manager_sessions_other_title)
|
||||
.allowBack()
|
||||
observeViewEvents()
|
||||
initFilterView()
|
||||
}
|
||||
@ -246,7 +248,7 @@ class OtherSessionsFragment :
|
||||
val selection = devices.count { it.isSelected }
|
||||
stringProvider.getQuantityString(R.plurals.x_selected, selection, selection)
|
||||
} else {
|
||||
getString(args.titleResourceId)
|
||||
getString(R.string.device_manager_sessions_other_title)
|
||||
}
|
||||
toolbar?.title = title
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
private const val A_SESSION_ID = "session_id"
|
||||
private const val A_TITLE_RESOURCE_ID = 1234
|
||||
private val A_DEFAULT_FILTER = DeviceManagerFilterType.INACTIVE
|
||||
|
||||
class VectorSettingsDevicesViewNavigatorTest {
|
||||
@ -67,11 +66,11 @@ class VectorSettingsDevicesViewNavigatorTest {
|
||||
@Test
|
||||
fun `given an intent when navigating to other sessions list then it starts the correct activity`() {
|
||||
// Given
|
||||
val intent = givenIntentForOtherSessions(A_TITLE_RESOURCE_ID, A_DEFAULT_FILTER, true)
|
||||
val intent = givenIntentForOtherSessions(A_DEFAULT_FILTER, true)
|
||||
context.givenStartActivity(intent)
|
||||
|
||||
// When
|
||||
vectorSettingsDevicesViewNavigator.navigateToOtherSessions(context.instance, A_TITLE_RESOURCE_ID, A_DEFAULT_FILTER, true)
|
||||
vectorSettingsDevicesViewNavigator.navigateToOtherSessions(context.instance, A_DEFAULT_FILTER, true)
|
||||
|
||||
// Then
|
||||
context.verifyStartActivity(intent)
|
||||
@ -96,9 +95,9 @@ class VectorSettingsDevicesViewNavigatorTest {
|
||||
return intent
|
||||
}
|
||||
|
||||
private fun givenIntentForOtherSessions(titleResourceId: Int, defaultFilter: DeviceManagerFilterType, excludeCurrentDevice: Boolean): Intent {
|
||||
private fun givenIntentForOtherSessions(defaultFilter: DeviceManagerFilterType, excludeCurrentDevice: Boolean): Intent {
|
||||
val intent = mockk<Intent>()
|
||||
every { OtherSessionsActivity.newIntent(context.instance, titleResourceId, defaultFilter, excludeCurrentDevice) } returns intent
|
||||
every { OtherSessionsActivity.newIntent(context.instance, defaultFilter, excludeCurrentDevice) } returns intent
|
||||
return intent
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user