new app layout is enabled (#6959)

This commit is contained in:
Nikita Fedrunov 2022-08-31 10:06:01 +02:00 committed by GitHub
parent 456d831a7d
commit 657796c8b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 8 deletions

1
changelog.d/6958.feature Normal file
View file

@ -0,0 +1 @@
[App Layout] New App Layout is enabled by default

View file

@ -33,12 +33,16 @@ import com.adevinta.android.barista.interaction.BaristaDialogInteractions.clickD
import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDrawer
import im.vector.app.EspressoHelper
import im.vector.app.R
import im.vector.app.espresso.tools.clickOnPreference
import im.vector.app.espresso.tools.waitUntilActivityVisible
import im.vector.app.espresso.tools.waitUntilDialogVisible
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
import im.vector.app.features.VectorFeatures
import im.vector.app.features.createdirect.CreateDirectRoomActivity
import im.vector.app.features.home.HomeActivity
import im.vector.app.features.onboarding.OnboardingActivity
import im.vector.app.features.settings.VectorSettingsActivity
import im.vector.app.initialSyncIdlingResource
import im.vector.app.ui.robot.settings.SettingsRobot
import im.vector.app.ui.robot.settings.labs.LabFeature
@ -48,6 +52,8 @@ import timber.log.Timber
class ElementRobot {
var features: VectorFeatures = DefaultVectorFeatures()
fun onboarding(block: OnboardingRobot.() -> Unit) {
block(OnboardingRobot())
}
@ -73,7 +79,7 @@ class ElementRobot {
val activity = EspressoHelper.getCurrentActivity()!!
val uiSession = (activity as HomeActivity).activeSessionHolder.getActiveSession()
withIdlingResource(initialSyncIdlingResource(uiSession)) {
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
}
@ -82,7 +88,7 @@ class ElementRobot {
clickOn(R.id.homeDrawerHeaderSettingsView)
block(SettingsRobot())
if (shouldGoBack) pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
fun newDirectMessage(block: NewDirectMessageRobot.() -> Unit) {
@ -94,19 +100,19 @@ class ElementRobot {
closeSoftKeyboard()
block(NewDirectMessageRobot())
pressBack()
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
fun newRoom(block: NewRoomRobot.() -> Unit) {
clickOn(R.id.bottom_action_rooms)
RoomListRobot().newRoom { block() }
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
fun roomList(block: RoomListRobot.() -> Unit) {
clickOn(R.id.bottom_action_rooms)
block(RoomListRobot())
waitUntilViewVisible(withId(R.id.bottomNavigationView))
waitUntilViewVisible(withId(R.id.roomListContainer))
}
fun toggleLabFeature(labFeature: LabFeature) {
@ -146,8 +152,17 @@ class ElementRobot {
}
fun signout(expectSignOutWarning: Boolean) {
clickOn(R.id.groupToolbarAvatarImageView)
clickOn(R.id.homeDrawerHeaderSignoutView)
if (features.isNewAppLayoutEnabled()) {
onView(withId((R.id.avatar)))
.perform(click())
waitUntilActivityVisible<VectorSettingsActivity> {
clickOn(R.string.settings_general_title)
}
clickOnPreference(R.string.action_sign_out)
} else {
clickOn(R.id.groupToolbarAvatarImageView)
clickOn(R.id.homeDrawerHeaderSignoutView)
}
val isShowingSignOutWarning = kotlin.runCatching {
waitUntilViewVisible(withId(R.id.exitAnywayButton))

View file

@ -50,6 +50,6 @@ class DefaultVectorFeatures : VectorFeatures {
override fun isLocationSharingEnabled() = Config.ENABLE_LOCATION_SHARING
override fun forceUsageOfOpusEncoder(): Boolean = false
override fun shouldStartDmOnFirstMessage(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = false
override fun isNewAppLayoutEnabled(): Boolean = true
override fun isNewDeviceManagementEnabled(): Boolean = false
}