Analytics: opt-in: handle back pressed

This commit is contained in:
Benoit Marty 2021-12-07 12:51:39 +01:00
parent cf267ae234
commit d0b62738e1
1 changed files with 10 additions and 1 deletions

View File

@ -24,13 +24,15 @@ import com.airbnb.mvrx.activityViewModel
import im.vector.app.R
import im.vector.app.config.analyticsConfig
import im.vector.app.core.extensions.setTextWithColoredPart
import im.vector.app.core.platform.OnBackPressed
import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.databinding.FragmentAnalyticsOptinBinding
import javax.inject.Inject
class AnalyticsOptInFragment @Inject constructor(
) : VectorBaseFragment<FragmentAnalyticsOptinBinding>() {
) : VectorBaseFragment<FragmentAnalyticsOptinBinding>(),
OnBackPressed {
// Share the view model with the Activity so that the Activity
// can decide what to do when the data has been saved
@ -64,4 +66,11 @@ class AnalyticsOptInFragment @Inject constructor(
}
)
}
override fun onBackPressed(toolbarButton: Boolean): Boolean {
// Consider user does not give consent
viewModel.handle(AnalyticsConsentViewActions.SetUserConsent(userConsent = false))
// And consume the event
return true
}
}