Merge pull request #4892 from vector-im/feature/bma/analytics_opt_in
Revert "Disable automatic opt-in screen display."
This commit is contained in:
commit
f368ec15d8
1
changelog.d/4892.feature
Normal file
1
changelog.d/4892.feature
Normal file
@ -0,0 +1 @@
|
||||
Display Analytics opt-in screen at first start-up of the app
|
@ -26,7 +26,6 @@ import im.vector.app.activityIdlingResource
|
||||
import im.vector.app.waitForView
|
||||
import im.vector.app.withIdlingResource
|
||||
import org.hamcrest.Matcher
|
||||
import org.hamcrest.Matchers.not
|
||||
|
||||
inline fun <reified T : Activity> waitUntilActivityVisible(noinline block: (() -> Unit) = {}) {
|
||||
withIdlingResource(activityIdlingResource(T::class.java), block)
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.ui.robot
|
||||
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
import com.adevinta.android.barista.assertion.BaristaVisibilityAssertions.assertDisplayed
|
||||
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
|
||||
import im.vector.app.R
|
||||
import im.vector.app.espresso.tools.waitUntilActivityVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.analytics.ui.consent.AnalyticsOptInActivity
|
||||
|
||||
class AnalyticsRobot {
|
||||
|
||||
fun optIn() {
|
||||
answerOptIn(true)
|
||||
}
|
||||
|
||||
fun optOut() {
|
||||
answerOptIn(false)
|
||||
}
|
||||
|
||||
private fun answerOptIn(optIn: Boolean) {
|
||||
waitUntilActivityVisible<AnalyticsOptInActivity> {
|
||||
waitUntilViewVisible(withId(R.id.title))
|
||||
}
|
||||
assertDisplayed(R.id.title, R.string.analytics_opt_in_title)
|
||||
if (optIn) {
|
||||
clickOn(R.id.submit)
|
||||
} else {
|
||||
clickOn(R.id.later)
|
||||
}
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ import im.vector.app.espresso.tools.waitUntilDialogVisible
|
||||
import im.vector.app.espresso.tools.waitUntilViewVisible
|
||||
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
||||
import im.vector.app.features.home.HomeActivity
|
||||
import im.vector.app.features.login.LoginActivity
|
||||
import im.vector.app.features.onboarding.OnboardingActivity
|
||||
import im.vector.app.initialSyncIdlingResource
|
||||
import im.vector.app.ui.robot.settings.SettingsRobot
|
||||
import im.vector.app.withIdlingResource
|
||||
@ -43,6 +43,8 @@ class ElementRobot {
|
||||
fun signUp(userId: String) {
|
||||
val onboardingRobot = OnboardingRobot()
|
||||
onboardingRobot.createAccount(userId = userId)
|
||||
val analyticsRobot = AnalyticsRobot()
|
||||
analyticsRobot.optOut()
|
||||
waitForHome()
|
||||
}
|
||||
|
||||
@ -121,7 +123,7 @@ class ElementRobot {
|
||||
clickDialogPositiveButton()
|
||||
}
|
||||
|
||||
waitUntilActivityVisible<LoginActivity> {
|
||||
waitUntilActivityVisible<OnboardingActivity> {
|
||||
assertDisplayed(R.id.loginSplashLogo)
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,11 @@ class OnboardingRobot {
|
||||
homeServerUrl: String) {
|
||||
waitUntilViewVisible(withId(R.id.loginSplashSubmit))
|
||||
assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_submit)
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
if (createAccount) {
|
||||
clickOn(R.id.loginSplashSubmit)
|
||||
} else {
|
||||
clickOn(R.id.loginSplashAlreadyHaveAccount)
|
||||
}
|
||||
assertDisplayed(R.id.loginServerTitle, R.string.login_server_title)
|
||||
// Chose custom server
|
||||
clickOn(R.id.loginServerChoiceOther)
|
||||
@ -54,17 +58,7 @@ class OnboardingRobot {
|
||||
assertEnabled(R.id.loginServerUrlFormSubmit)
|
||||
closeSoftKeyboard()
|
||||
clickOn(R.id.loginServerUrlFormSubmit)
|
||||
onView(isRoot()).perform(waitForView(withId(R.id.loginSignupSigninSubmit)))
|
||||
|
||||
if (createAccount) {
|
||||
// Click on the signup button
|
||||
assertDisplayed(R.id.loginSignupSigninSubmit)
|
||||
clickOn(R.id.loginSignupSigninSubmit)
|
||||
} else {
|
||||
// Click on the signin button
|
||||
assertDisplayed(R.id.loginSignupSigninSignIn)
|
||||
clickOn(R.id.loginSignupSigninSignIn)
|
||||
}
|
||||
onView(isRoot()).perform(waitForView(withId(R.id.loginField)))
|
||||
|
||||
// Ensure password flow supported
|
||||
assertDisplayed(R.id.loginField)
|
||||
|
@ -83,12 +83,9 @@ class HomeActivityViewModel @AssistedInject constructor(
|
||||
observeInitialSync()
|
||||
checkSessionPushIsOn()
|
||||
observeCrossSigningReset()
|
||||
// Disable Analytics opt-in automatic display
|
||||
// Waiting for translation and for analytic events to be actually sent
|
||||
// observeAnalytics()
|
||||
observeAnalytics()
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
private fun observeAnalytics() {
|
||||
if (analyticsConfig.isEnabled) {
|
||||
analyticsStore.didAskUserConsentFlow
|
||||
|
Loading…
x
Reference in New Issue
Block a user