Merge pull request #4668 from vector-im/feature/adm/i-already-have-an-account
FTUE Auth - I already have an account
This commit is contained in:
commit
f24c962a4a
1
changelog.d/4382.feature
Normal file
1
changelog.d/4382.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Updates onboarding splash screen to have a dedicated sign in button and removes the dual purpose sign in/up stage
|
@ -160,7 +160,7 @@ Formatter\.formatShortFileSize===1
|
|||||||
# android\.text\.TextUtils
|
# android\.text\.TextUtils
|
||||||
|
|
||||||
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
|
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
|
||||||
enum class===117
|
enum class===118
|
||||||
|
|
||||||
### Do not import temporary legacy classes
|
### Do not import temporary legacy classes
|
||||||
import org.matrix.android.sdk.internal.legacy.riot===3
|
import org.matrix.android.sdk.internal.legacy.riot===3
|
||||||
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 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.features.debug.features
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.AdapterView
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Spinner
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.airbnb.epoxy.EpoxyAttribute
|
||||||
|
import com.airbnb.epoxy.EpoxyModelClass
|
||||||
|
import im.vector.app.core.epoxy.VectorEpoxyHolder
|
||||||
|
import im.vector.app.core.epoxy.VectorEpoxyModel
|
||||||
|
|
||||||
|
@EpoxyModelClass(layout = im.vector.app.R.layout.item_feature)
|
||||||
|
abstract class BooleanFeatureItem : VectorEpoxyModel<BooleanFeatureItem.Holder>() {
|
||||||
|
|
||||||
|
@EpoxyAttribute
|
||||||
|
lateinit var feature: Feature.BooleanFeature
|
||||||
|
|
||||||
|
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
|
||||||
|
var listener: Listener? = null
|
||||||
|
|
||||||
|
override fun bind(holder: Holder) {
|
||||||
|
super.bind(holder)
|
||||||
|
holder.label.text = feature.label
|
||||||
|
|
||||||
|
holder.optionsSpinner.apply {
|
||||||
|
val arrayAdapter = ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item)
|
||||||
|
val options = listOf(
|
||||||
|
"DEFAULT - ${feature.featureDefault.toEmoji()}",
|
||||||
|
"✅",
|
||||||
|
"❌"
|
||||||
|
)
|
||||||
|
arrayAdapter.addAll(options)
|
||||||
|
adapter = arrayAdapter
|
||||||
|
|
||||||
|
feature.featureOverride?.let {
|
||||||
|
setSelection(options.indexOf(it.toEmoji()), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||||
|
when (position) {
|
||||||
|
0 -> listener?.onBooleanOptionSelected(option = null, feature)
|
||||||
|
else -> listener?.onBooleanOptionSelected(options[position].fromEmoji(), feature)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Holder : VectorEpoxyHolder() {
|
||||||
|
val label by bind<TextView>(im.vector.app.R.id.feature_label)
|
||||||
|
val optionsSpinner by bind<Spinner>(im.vector.app.R.id.feature_options)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Listener {
|
||||||
|
fun onBooleanOptionSelected(option: Boolean?, feature: Feature.BooleanFeature)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Boolean.toEmoji() = if (this) "✅" else "❌"
|
||||||
|
private fun String.fromEmoji() = when (this) {
|
||||||
|
"✅" -> true
|
||||||
|
"❌" -> false
|
||||||
|
else -> error("unexpected input $this")
|
||||||
|
}
|
@ -35,10 +35,14 @@ class DebugFeaturesSettingsActivity : VectorBaseActivity<FragmentGenericRecycler
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
controller.listener = object : EnumFeatureItem.Listener {
|
controller.listener = object : FeaturesController.Listener {
|
||||||
override fun <T : Enum<T>> onOptionSelected(option: T?, feature: Feature.EnumFeature<T>) {
|
override fun <T : Enum<T>> onEnumOptionSelected(option: T?, feature: Feature.EnumFeature<T>) {
|
||||||
debugFeatures.overrideEnum(option, feature.type)
|
debugFeatures.overrideEnum(option, feature.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBooleanOptionSelected(option: Boolean?, feature: Feature.BooleanFeature) {
|
||||||
|
debugFeatures.override(option, feature.key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
views.genericRecyclerView.configureWith(controller)
|
views.genericRecyclerView.configureWith(controller)
|
||||||
controller.setData(debugFeaturesStateFactory.create())
|
controller.setData(debugFeaturesStateFactory.create())
|
||||||
|
@ -28,17 +28,26 @@ class DebugFeaturesStateFactory @Inject constructor(
|
|||||||
return FeaturesState(listOf(
|
return FeaturesState(listOf(
|
||||||
createEnumFeature(
|
createEnumFeature(
|
||||||
label = "Onboarding variant",
|
label = "Onboarding variant",
|
||||||
selection = debugFeatures.onboardingVariant(),
|
featureOverride = debugFeatures.onboardingVariant(),
|
||||||
default = defaultFeatures.onboardingVariant()
|
featureDefault = defaultFeatures.onboardingVariant()
|
||||||
|
),
|
||||||
|
|
||||||
|
Feature.BooleanFeature(
|
||||||
|
label = "FTUE Splash - I already have an account",
|
||||||
|
featureOverride = debugFeatures.isAlreadyHaveAccountSplashEnabled().takeIf {
|
||||||
|
debugFeatures.hasOverride(DebugFeatureKeys.alreadyHaveAnAccount)
|
||||||
|
},
|
||||||
|
featureDefault = defaultFeatures.isAlreadyHaveAccountSplashEnabled(),
|
||||||
|
key = DebugFeatureKeys.alreadyHaveAnAccount
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <reified T : Enum<T>> createEnumFeature(label: String, selection: T, default: T): Feature {
|
private inline fun <reified T : Enum<T>> createEnumFeature(label: String, featureOverride: T, featureDefault: T): Feature {
|
||||||
return Feature.EnumFeature(
|
return Feature.EnumFeature(
|
||||||
label = label,
|
label = label,
|
||||||
selection = selection.takeIf { debugFeatures.hasEnumOverride(T::class) },
|
override = featureOverride.takeIf { debugFeatures.hasEnumOverride(T::class) },
|
||||||
default = default,
|
default = featureDefault,
|
||||||
options = enumValues<T>().toList(),
|
options = enumValues<T>().toList(),
|
||||||
type = T::class
|
type = T::class
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,7 @@ import android.content.Context
|
|||||||
import androidx.datastore.core.DataStore
|
import androidx.datastore.core.DataStore
|
||||||
import androidx.datastore.preferences.core.MutablePreferences
|
import androidx.datastore.preferences.core.MutablePreferences
|
||||||
import androidx.datastore.preferences.core.Preferences
|
import androidx.datastore.preferences.core.Preferences
|
||||||
|
import androidx.datastore.preferences.core.booleanPreferencesKey
|
||||||
import androidx.datastore.preferences.core.edit
|
import androidx.datastore.preferences.core.edit
|
||||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||||
import androidx.datastore.preferences.preferencesDataStore
|
import androidx.datastore.preferences.preferencesDataStore
|
||||||
@ -42,13 +43,26 @@ class DebugVectorFeatures(
|
|||||||
return readPreferences().getEnum<VectorFeatures.OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
|
return readPreferences().getEnum<VectorFeatures.OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isAlreadyHaveAccountSplashEnabled(): Boolean = readPreferences()[DebugFeatureKeys.alreadyHaveAnAccount]
|
||||||
|
?: vectorFeatures.isAlreadyHaveAccountSplashEnabled()
|
||||||
|
|
||||||
|
fun <T> override(value: T?, key: Preferences.Key<T>) = updatePreferences {
|
||||||
|
if (value == null) {
|
||||||
|
it.remove(key)
|
||||||
|
} else {
|
||||||
|
it[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> hasOverride(key: Preferences.Key<T>) = readPreferences().contains(key)
|
||||||
|
|
||||||
fun <T : Enum<T>> hasEnumOverride(type: KClass<T>) = readPreferences().containsEnum(type)
|
fun <T : Enum<T>> hasEnumOverride(type: KClass<T>) = readPreferences().containsEnum(type)
|
||||||
|
|
||||||
fun <T : Enum<T>> overrideEnum(value: T?, type: KClass<T>) {
|
fun <T : Enum<T>> overrideEnum(value: T?, type: KClass<T>) = updatePreferences {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
updatePreferences { it.removeEnum(type) }
|
it.removeEnum(type)
|
||||||
} else {
|
} else {
|
||||||
updatePreferences { it.putEnum(value, type) }
|
it.putEnum(value, type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,3 +90,8 @@ private inline fun <reified T : Enum<T>> Preferences.getEnum(): T? {
|
|||||||
private inline fun <reified T : Enum<T>> enumPreferencesKey() = enumPreferencesKey(T::class)
|
private inline fun <reified T : Enum<T>> enumPreferencesKey() = enumPreferencesKey(T::class)
|
||||||
|
|
||||||
private fun <T : Enum<T>> enumPreferencesKey(type: KClass<T>) = stringPreferencesKey("enum-${type.simpleName}")
|
private fun <T : Enum<T>> enumPreferencesKey(type: KClass<T>) = stringPreferencesKey("enum-${type.simpleName}")
|
||||||
|
|
||||||
|
object DebugFeatureKeys {
|
||||||
|
|
||||||
|
val alreadyHaveAnAccount = booleanPreferencesKey("already-have-an-account")
|
||||||
|
}
|
||||||
|
@ -45,14 +45,14 @@ abstract class EnumFeatureItem : VectorEpoxyModel<EnumFeatureItem.Holder>() {
|
|||||||
arrayAdapter.addAll(feature.options.map { it.name })
|
arrayAdapter.addAll(feature.options.map { it.name })
|
||||||
adapter = arrayAdapter
|
adapter = arrayAdapter
|
||||||
|
|
||||||
feature.selection?.let {
|
feature.override?.let {
|
||||||
setSelection(feature.options.indexOf(it) + 1, false)
|
setSelection(feature.options.indexOf(it) + 1, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||||
when (position) {
|
when (position) {
|
||||||
0 -> listener?.onOptionSelected(option = null, feature)
|
0 -> listener?.onEnumOptionSelected(option = null, feature)
|
||||||
else -> feature.onOptionSelected(position - 1)
|
else -> feature.onOptionSelected(position - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ abstract class EnumFeatureItem : VectorEpoxyModel<EnumFeatureItem.Holder>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : Enum<T>> Feature.EnumFeature<T>.onOptionSelected(selection: Int) {
|
private fun <T : Enum<T>> Feature.EnumFeature<T>.onOptionSelected(selection: Int) {
|
||||||
listener?.onOptionSelected(options[selection], this)
|
listener?.onEnumOptionSelected(options[selection], this)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Holder : VectorEpoxyHolder() {
|
class Holder : VectorEpoxyHolder() {
|
||||||
@ -74,6 +74,6 @@ abstract class EnumFeatureItem : VectorEpoxyModel<EnumFeatureItem.Holder>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
fun <T : Enum<T>> onOptionSelected(option: T?, feature: Feature.EnumFeature<T>)
|
fun <T : Enum<T>> onEnumOptionSelected(option: T?, feature: Feature.EnumFeature<T>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package im.vector.app.features.debug.features
|
package im.vector.app.features.debug.features
|
||||||
|
|
||||||
|
import androidx.datastore.preferences.core.Preferences
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
@ -28,16 +29,23 @@ sealed interface Feature {
|
|||||||
|
|
||||||
data class EnumFeature<T : Enum<T>>(
|
data class EnumFeature<T : Enum<T>>(
|
||||||
val label: String,
|
val label: String,
|
||||||
val selection: T?,
|
val override: T?,
|
||||||
val default: T,
|
val default: T,
|
||||||
val options: List<T>,
|
val options: List<T>,
|
||||||
val type: KClass<T>
|
val type: KClass<T>
|
||||||
) : Feature
|
) : Feature
|
||||||
|
|
||||||
|
data class BooleanFeature(
|
||||||
|
val label: String,
|
||||||
|
val featureOverride: Boolean?,
|
||||||
|
val featureDefault: Boolean,
|
||||||
|
val key: Preferences.Key<Boolean>
|
||||||
|
) : Feature
|
||||||
}
|
}
|
||||||
|
|
||||||
class FeaturesController @Inject constructor() : TypedEpoxyController<FeaturesState>() {
|
class FeaturesController @Inject constructor() : TypedEpoxyController<FeaturesState>() {
|
||||||
|
|
||||||
var listener: EnumFeatureItem.Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
override fun buildModels(data: FeaturesState?) {
|
override fun buildModels(data: FeaturesState?) {
|
||||||
if (data == null) return
|
if (data == null) return
|
||||||
@ -49,7 +57,14 @@ class FeaturesController @Inject constructor() : TypedEpoxyController<FeaturesSt
|
|||||||
feature(feature)
|
feature(feature)
|
||||||
listener(this@FeaturesController.listener)
|
listener(this@FeaturesController.listener)
|
||||||
}
|
}
|
||||||
|
is Feature.BooleanFeature -> booleanFeatureItem {
|
||||||
|
id(index)
|
||||||
|
feature(feature)
|
||||||
|
listener(this@FeaturesController.listener)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Listener : EnumFeatureItem.Listener, BooleanFeatureItem.Listener
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ interface VectorFeatures {
|
|||||||
|
|
||||||
fun onboardingVariant(): OnboardingVariant
|
fun onboardingVariant(): OnboardingVariant
|
||||||
|
|
||||||
|
fun isAlreadyHaveAccountSplashEnabled(): Boolean
|
||||||
|
|
||||||
enum class OnboardingVariant {
|
enum class OnboardingVariant {
|
||||||
LEGACY,
|
LEGACY,
|
||||||
LOGIN_2,
|
LOGIN_2,
|
||||||
@ -36,4 +38,5 @@ interface VectorFeatures {
|
|||||||
|
|
||||||
class DefaultVectorFeatures : VectorFeatures {
|
class DefaultVectorFeatures : VectorFeatures {
|
||||||
override fun onboardingVariant(): VectorFeatures.OnboardingVariant = BuildConfig.ONBOARDING_VARIANT
|
override fun onboardingVariant(): VectorFeatures.OnboardingVariant = BuildConfig.ONBOARDING_VARIANT
|
||||||
|
override fun isAlreadyHaveAccountSplashEnabled() = true
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ class LoginSplashFragment @Inject constructor(
|
|||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${BuildConfig.BUILD_NUMBER}"
|
||||||
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class LoginSplashSignUpSignInSelectionFragment2 @Inject constructor(
|
|||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${BuildConfig.BUILD_NUMBER}"
|
||||||
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ import org.matrix.android.sdk.api.auth.registration.RegisterThreePid
|
|||||||
import org.matrix.android.sdk.internal.network.ssl.Fingerprint
|
import org.matrix.android.sdk.internal.network.ssl.Fingerprint
|
||||||
|
|
||||||
sealed class OnboardingAction : VectorViewModelAction {
|
sealed class OnboardingAction : VectorViewModelAction {
|
||||||
data class OnGetStarted(val resetLoginConfig: Boolean) : OnboardingAction()
|
data class OnGetStarted(val resetLoginConfig: Boolean, val onboardingFlow: OnboardingFlow) : OnboardingAction()
|
||||||
|
data class OnIAlreadyHaveAnAccount(val resetLoginConfig: Boolean, val onboardingFlow: OnboardingFlow) : OnboardingAction()
|
||||||
|
|
||||||
data class UpdateServerType(val serverType: ServerType) : OnboardingAction()
|
data class UpdateServerType(val serverType: ServerType) : OnboardingAction()
|
||||||
data class UpdateHomeServer(val homeServerUrl: String) : OnboardingAction()
|
data class UpdateHomeServer(val homeServerUrl: String) : OnboardingAction()
|
||||||
|
@ -34,7 +34,7 @@ import javax.inject.Inject
|
|||||||
class OnboardingActivity : VectorBaseActivity<ActivityLoginBinding>(), ToolbarConfigurable, UnlockedActivity {
|
class OnboardingActivity : VectorBaseActivity<ActivityLoginBinding>(), ToolbarConfigurable, UnlockedActivity {
|
||||||
|
|
||||||
private val onboardingVariant by lifecycleAwareLazy {
|
private val onboardingVariant by lifecycleAwareLazy {
|
||||||
onboardingVariantFactory.create(this, onboardingViewModel = lazyViewModel(), loginViewModel2 = lazyViewModel())
|
onboardingVariantFactory.create(this, views = views, onboardingViewModel = lazyViewModel(), loginViewModel2 = lazyViewModel())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject lateinit var onboardingVariantFactory: OnboardingVariantFactory
|
@Inject lateinit var onboardingVariantFactory: OnboardingVariantFactory
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
package im.vector.app.features.onboarding
|
package im.vector.app.features.onboarding
|
||||||
|
|
||||||
|
import im.vector.app.databinding.ActivityLoginBinding
|
||||||
import im.vector.app.features.VectorFeatures
|
import im.vector.app.features.VectorFeatures
|
||||||
import im.vector.app.features.login2.LoginViewModel2
|
import im.vector.app.features.login2.LoginViewModel2
|
||||||
|
import im.vector.app.features.onboarding.ftueauth.FtueAuthVariant
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class OnboardingVariantFactory @Inject constructor(
|
class OnboardingVariantFactory @Inject constructor(
|
||||||
@ -25,18 +27,19 @@ class OnboardingVariantFactory @Inject constructor(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun create(activity: OnboardingActivity,
|
fun create(activity: OnboardingActivity,
|
||||||
|
views: ActivityLoginBinding,
|
||||||
onboardingViewModel: Lazy<OnboardingViewModel>,
|
onboardingViewModel: Lazy<OnboardingViewModel>,
|
||||||
loginViewModel2: Lazy<LoginViewModel2>
|
loginViewModel2: Lazy<LoginViewModel2>
|
||||||
) = when (vectorFeatures.onboardingVariant()) {
|
) = when (vectorFeatures.onboardingVariant()) {
|
||||||
VectorFeatures.OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE")
|
VectorFeatures.OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE")
|
||||||
VectorFeatures.OnboardingVariant.FTUE_AUTH -> OnboardingAuthVariant(
|
VectorFeatures.OnboardingVariant.FTUE_AUTH -> FtueAuthVariant(
|
||||||
views = activity.getBinding(),
|
views = views,
|
||||||
onboardingViewModel = onboardingViewModel.value,
|
onboardingViewModel = onboardingViewModel.value,
|
||||||
activity = activity,
|
activity = activity,
|
||||||
supportFragmentManager = activity.supportFragmentManager
|
supportFragmentManager = activity.supportFragmentManager
|
||||||
)
|
)
|
||||||
VectorFeatures.OnboardingVariant.LOGIN_2 -> Login2Variant(
|
VectorFeatures.OnboardingVariant.LOGIN_2 -> Login2Variant(
|
||||||
views = activity.getBinding(),
|
views = views,
|
||||||
loginViewModel = loginViewModel2.value,
|
loginViewModel = loginViewModel2.value,
|
||||||
activity = activity,
|
activity = activity,
|
||||||
supportFragmentManager = activity.supportFragmentManager
|
supportFragmentManager = activity.supportFragmentManager
|
||||||
|
@ -121,7 +121,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
|
|
||||||
override fun handle(action: OnboardingAction) {
|
override fun handle(action: OnboardingAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is OnboardingAction.OnGetStarted -> handleOnGetStarted(action)
|
is OnboardingAction.OnGetStarted -> handleSplashAction(action.resetLoginConfig, action.onboardingFlow)
|
||||||
|
is OnboardingAction.OnIAlreadyHaveAnAccount -> handleSplashAction(action.resetLoginConfig, action.onboardingFlow)
|
||||||
is OnboardingAction.UpdateServerType -> handleUpdateServerType(action)
|
is OnboardingAction.UpdateServerType -> handleUpdateServerType(action)
|
||||||
is OnboardingAction.UpdateSignMode -> handleUpdateSignMode(action)
|
is OnboardingAction.UpdateSignMode -> handleUpdateSignMode(action)
|
||||||
is OnboardingAction.InitWith -> handleInitWith(action)
|
is OnboardingAction.InitWith -> handleInitWith(action)
|
||||||
@ -140,10 +141,11 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
}.exhaustive
|
}.exhaustive
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleOnGetStarted(action: OnboardingAction.OnGetStarted) {
|
private fun handleSplashAction(resetConfig: Boolean, onboardingFlow: OnboardingFlow) {
|
||||||
if (action.resetLoginConfig) {
|
if (resetConfig) {
|
||||||
loginConfig = null
|
loginConfig = null
|
||||||
}
|
}
|
||||||
|
setState { copy(onboardingFlow = onboardingFlow) }
|
||||||
|
|
||||||
val configUrl = loginConfig?.homeServerUrl?.takeIf { it.isNotEmpty() }
|
val configUrl = loginConfig?.homeServerUrl?.takeIf { it.isNotEmpty() }
|
||||||
if (configUrl != null) {
|
if (configUrl != null) {
|
||||||
@ -822,7 +824,17 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||||||
// Notify the UI
|
// Notify the UI
|
||||||
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
_viewEvents.post(OnboardingViewEvents.OutdatedHomeserver)
|
||||||
}
|
}
|
||||||
_viewEvents.post(OnboardingViewEvents.OnLoginFlowRetrieved)
|
|
||||||
|
withState {
|
||||||
|
when (it.onboardingFlow) {
|
||||||
|
OnboardingFlow.SignIn -> handleUpdateSignMode(OnboardingAction.UpdateSignMode(SignMode.SignIn))
|
||||||
|
OnboardingFlow.SignUp -> handleUpdateSignMode(OnboardingAction.UpdateSignMode(SignMode.SignUp))
|
||||||
|
OnboardingFlow.SignInSignUp,
|
||||||
|
null -> {
|
||||||
|
_viewEvents.post(OnboardingViewEvents.OnLoginFlowRetrieved)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ data class OnboardingViewState(
|
|||||||
val asyncResetMailConfirmed: Async<Unit> = Uninitialized,
|
val asyncResetMailConfirmed: Async<Unit> = Uninitialized,
|
||||||
val asyncRegistration: Async<Unit> = Uninitialized,
|
val asyncRegistration: Async<Unit> = Uninitialized,
|
||||||
|
|
||||||
|
@PersistState
|
||||||
|
val onboardingFlow: OnboardingFlow? = null,
|
||||||
|
|
||||||
// User choices
|
// User choices
|
||||||
@PersistState
|
@PersistState
|
||||||
val serverType: ServerType = ServerType.Unknown,
|
val serverType: ServerType = ServerType.Unknown,
|
||||||
@ -74,3 +77,9 @@ data class OnboardingViewState(
|
|||||||
return asyncLoginAction is Success
|
return asyncLoginAction is Success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class OnboardingFlow {
|
||||||
|
SignIn,
|
||||||
|
SignUp,
|
||||||
|
SignInSignUp
|
||||||
|
}
|
||||||
|
@ -22,12 +22,14 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.databinding.FragmentLoginSplashBinding
|
import im.vector.app.databinding.FragmentFtueAuthSplashBinding
|
||||||
import im.vector.app.features.login.AbstractLoginFragment
|
import im.vector.app.features.VectorFeatures
|
||||||
import im.vector.app.features.login.LoginAction
|
import im.vector.app.features.onboarding.OnboardingAction
|
||||||
|
import im.vector.app.features.onboarding.OnboardingFlow
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import org.matrix.android.sdk.api.failure.Failure
|
import org.matrix.android.sdk.api.failure.Failure
|
||||||
import java.net.UnknownHostException
|
import java.net.UnknownHostException
|
||||||
@ -37,21 +39,25 @@ import javax.inject.Inject
|
|||||||
* In this screen, the user is viewing an introduction to what he can do with this application
|
* In this screen, the user is viewing an introduction to what he can do with this application
|
||||||
*/
|
*/
|
||||||
class FtueAuthSplashFragment @Inject constructor(
|
class FtueAuthSplashFragment @Inject constructor(
|
||||||
private val vectorPreferences: VectorPreferences
|
private val vectorPreferences: VectorPreferences,
|
||||||
) : AbstractLoginFragment<FragmentLoginSplashBinding>() {
|
private val vectorFeatures: VectorFeatures
|
||||||
|
) : AbstractFtueAuthFragment<FragmentFtueAuthSplashBinding>() {
|
||||||
|
|
||||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSplashBinding {
|
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueAuthSplashBinding {
|
||||||
return FragmentLoginSplashBinding.inflate(inflater, container, false)
|
return FragmentFtueAuthSplashBinding.inflate(inflater, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
setupViews()
|
setupViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
views.loginSplashSubmit.debouncedClicks { getStarted() }
|
views.loginSplashSubmit.debouncedClicks { getStarted() }
|
||||||
|
views.loginSplashAlreadyHaveAccount.apply {
|
||||||
|
isVisible = vectorFeatures.isAlreadyHaveAccountSplashEnabled()
|
||||||
|
debouncedClicks { alreadyHaveAnAccount() }
|
||||||
|
}
|
||||||
|
|
||||||
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
||||||
views.loginSplashVersion.isVisible = true
|
views.loginSplashVersion.isVisible = true
|
||||||
@ -59,11 +65,17 @@ class FtueAuthSplashFragment @Inject constructor(
|
|||||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||||
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
|
||||||
"Build: ${BuildConfig.BUILD_NUMBER}"
|
"Build: ${BuildConfig.BUILD_NUMBER}"
|
||||||
|
views.loginSplashVersion.debouncedClicks { navigator.openDebug(requireContext()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStarted() {
|
private fun getStarted() {
|
||||||
loginViewModel.handle(LoginAction.OnGetStarted(resetLoginConfig = false))
|
val getStartedFlow = if (vectorFeatures.isAlreadyHaveAccountSplashEnabled()) OnboardingFlow.SignUp else OnboardingFlow.SignInSignUp
|
||||||
|
viewModel.handle(OnboardingAction.OnGetStarted(resetLoginConfig = false, onboardingFlow = getStartedFlow))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun alreadyHaveAnAccount() {
|
||||||
|
viewModel.handle(OnboardingAction.OnIAlreadyHaveAnAccount(resetLoginConfig = false, onboardingFlow = OnboardingFlow.SignIn))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resetViewModel() {
|
override fun resetViewModel() {
|
||||||
@ -74,12 +86,13 @@ class FtueAuthSplashFragment @Inject constructor(
|
|||||||
if (throwable is Failure.NetworkConnection &&
|
if (throwable is Failure.NetworkConnection &&
|
||||||
throwable.ioException is UnknownHostException) {
|
throwable.ioException is UnknownHostException) {
|
||||||
// Invalid homeserver from URL config
|
// Invalid homeserver from URL config
|
||||||
val url = loginViewModel.getInitialHomeServerUrl().orEmpty()
|
val url = viewModel.getInitialHomeServerUrl().orEmpty()
|
||||||
MaterialAlertDialogBuilder(requireActivity())
|
MaterialAlertDialogBuilder(requireActivity())
|
||||||
.setTitle(R.string.dialog_title_error)
|
.setTitle(R.string.dialog_title_error)
|
||||||
.setMessage(getString(R.string.login_error_homeserver_from_url_not_found, url))
|
.setMessage(getString(R.string.login_error_homeserver_from_url_not_found, url))
|
||||||
.setPositiveButton(R.string.login_error_homeserver_from_url_not_found_enter_manual) { _, _ ->
|
.setPositiveButton(R.string.login_error_homeserver_from_url_not_found_enter_manual) { _, _ ->
|
||||||
loginViewModel.handle(LoginAction.OnGetStarted(resetLoginConfig = true))
|
val flow = withState(viewModel) { it.onboardingFlow } ?: OnboardingFlow.SignInSignUp
|
||||||
|
viewModel.handle(OnboardingAction.OnGetStarted(resetLoginConfig = true, flow))
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.action_cancel, null)
|
.setNegativeButton(R.string.action_cancel, null)
|
||||||
.show()
|
.show()
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.app.features.onboarding
|
package im.vector.app.features.onboarding.ftueauth
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -42,21 +42,12 @@ import im.vector.app.features.login.SignMode
|
|||||||
import im.vector.app.features.login.TextInputFormFragmentMode
|
import im.vector.app.features.login.TextInputFormFragmentMode
|
||||||
import im.vector.app.features.login.isSupported
|
import im.vector.app.features.login.isSupported
|
||||||
import im.vector.app.features.login.terms.toLocalizedLoginTerms
|
import im.vector.app.features.login.terms.toLocalizedLoginTerms
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthCaptchaFragment
|
import im.vector.app.features.onboarding.OnboardingAction
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthCaptchaFragmentArgument
|
import im.vector.app.features.onboarding.OnboardingActivity
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthGenericTextInputFormFragment
|
import im.vector.app.features.onboarding.OnboardingVariant
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthGenericTextInputFormFragmentArgument
|
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthLoginFragment
|
import im.vector.app.features.onboarding.OnboardingViewModel
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordFragment
|
import im.vector.app.features.onboarding.OnboardingViewState
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordMailConfirmationFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordSuccessFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthServerSelectionFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthServerUrlFormFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthSignUpSignInSelectionFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthSplashFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthWaitForEmailFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthWaitForEmailFragmentArgument
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthWebFragment
|
|
||||||
import im.vector.app.features.onboarding.ftueauth.terms.FtueAuthTermsFragment
|
import im.vector.app.features.onboarding.ftueauth.terms.FtueAuthTermsFragment
|
||||||
import im.vector.app.features.onboarding.ftueauth.terms.FtueAuthTermsFragmentArgument
|
import im.vector.app.features.onboarding.ftueauth.terms.FtueAuthTermsFragmentArgument
|
||||||
import org.matrix.android.sdk.api.auth.registration.FlowResult
|
import org.matrix.android.sdk.api.auth.registration.FlowResult
|
||||||
@ -66,7 +57,7 @@ import org.matrix.android.sdk.api.extensions.tryOrNull
|
|||||||
private const val FRAGMENT_REGISTRATION_STAGE_TAG = "FRAGMENT_REGISTRATION_STAGE_TAG"
|
private const val FRAGMENT_REGISTRATION_STAGE_TAG = "FRAGMENT_REGISTRATION_STAGE_TAG"
|
||||||
private const val FRAGMENT_LOGIN_TAG = "FRAGMENT_LOGIN_TAG"
|
private const val FRAGMENT_LOGIN_TAG = "FRAGMENT_LOGIN_TAG"
|
||||||
|
|
||||||
class OnboardingAuthVariant(
|
class FtueAuthVariant(
|
||||||
private val views: ActivityLoginBinding,
|
private val views: ActivityLoginBinding,
|
||||||
private val onboardingViewModel: OnboardingViewModel,
|
private val onboardingViewModel: OnboardingViewModel,
|
||||||
private val activity: VectorBaseActivity<ActivityLoginBinding>,
|
private val activity: VectorBaseActivity<ActivityLoginBinding>,
|
||||||
@ -120,17 +111,17 @@ class OnboardingAuthVariant(
|
|||||||
activity.addFragment(views.loginFragmentContainer, FtueAuthSplashFragment::class.java)
|
activity.addFragment(views.loginFragmentContainer, FtueAuthSplashFragment::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleOnboardingViewEvents(onboardingViewEvents: OnboardingViewEvents) {
|
private fun handleOnboardingViewEvents(viewEvents: OnboardingViewEvents) {
|
||||||
when (onboardingViewEvents) {
|
when (viewEvents) {
|
||||||
is OnboardingViewEvents.RegistrationFlowResult -> {
|
is OnboardingViewEvents.RegistrationFlowResult -> {
|
||||||
// Check that all flows are supported by the application
|
// Check that all flows are supported by the application
|
||||||
if (onboardingViewEvents.flowResult.missingStages.any { !it.isSupported() }) {
|
if (viewEvents.flowResult.missingStages.any { !it.isSupported() }) {
|
||||||
// Display a popup to propose use web fallback
|
// Display a popup to propose use web fallback
|
||||||
onRegistrationStageNotSupported()
|
onRegistrationStageNotSupported()
|
||||||
} else {
|
} else {
|
||||||
if (onboardingViewEvents.isRegistrationStarted) {
|
if (viewEvents.isRegistrationStarted) {
|
||||||
// Go on with registration flow
|
// Go on with registration flow
|
||||||
handleRegistrationNavigation(onboardingViewEvents.flowResult)
|
handleRegistrationNavigation(viewEvents.flowResult)
|
||||||
} else {
|
} else {
|
||||||
// First ask for login and password
|
// First ask for login and password
|
||||||
// I add a tag to indicate that this fragment is a registration stage.
|
// I add a tag to indicate that this fragment is a registration stage.
|
||||||
@ -163,13 +154,13 @@ class OnboardingAuthVariant(
|
|||||||
// TODO Disabled because it provokes a flickering
|
// TODO Disabled because it provokes a flickering
|
||||||
// ft.setCustomAnimations(enterAnim, exitAnim, popEnterAnim, popExitAnim)
|
// ft.setCustomAnimations(enterAnim, exitAnim, popEnterAnim, popExitAnim)
|
||||||
})
|
})
|
||||||
is OnboardingViewEvents.OnServerSelectionDone -> onServerSelectionDone(onboardingViewEvents)
|
is OnboardingViewEvents.OnServerSelectionDone -> onServerSelectionDone(viewEvents)
|
||||||
is OnboardingViewEvents.OnSignModeSelected -> onSignModeSelected(onboardingViewEvents)
|
is OnboardingViewEvents.OnSignModeSelected -> onSignModeSelected(viewEvents)
|
||||||
is OnboardingViewEvents.OnLoginFlowRetrieved ->
|
is OnboardingViewEvents.OnLoginFlowRetrieved ->
|
||||||
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
||||||
FtueAuthSignUpSignInSelectionFragment::class.java,
|
FtueAuthSignUpSignInSelectionFragment::class.java,
|
||||||
option = commonOption)
|
option = commonOption)
|
||||||
is OnboardingViewEvents.OnWebLoginError -> onWebLoginError(onboardingViewEvents)
|
is OnboardingViewEvents.OnWebLoginError -> onWebLoginError(viewEvents)
|
||||||
is OnboardingViewEvents.OnForgetPasswordClicked ->
|
is OnboardingViewEvents.OnForgetPasswordClicked ->
|
||||||
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
||||||
FtueAuthResetPasswordFragment::class.java,
|
FtueAuthResetPasswordFragment::class.java,
|
||||||
@ -195,7 +186,7 @@ class OnboardingAuthVariant(
|
|||||||
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
||||||
FtueAuthWaitForEmailFragment::class.java,
|
FtueAuthWaitForEmailFragment::class.java,
|
||||||
FtueAuthWaitForEmailFragmentArgument(onboardingViewEvents.email),
|
FtueAuthWaitForEmailFragmentArgument(viewEvents.email),
|
||||||
tag = FRAGMENT_REGISTRATION_STAGE_TAG,
|
tag = FRAGMENT_REGISTRATION_STAGE_TAG,
|
||||||
option = commonOption)
|
option = commonOption)
|
||||||
}
|
}
|
||||||
@ -204,7 +195,7 @@ class OnboardingAuthVariant(
|
|||||||
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
supportFragmentManager.popBackStack(FRAGMENT_REGISTRATION_STAGE_TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
activity.addFragmentToBackstack(views.loginFragmentContainer,
|
||||||
FtueAuthGenericTextInputFormFragment::class.java,
|
FtueAuthGenericTextInputFormFragment::class.java,
|
||||||
FtueAuthGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.ConfirmMsisdn, true, onboardingViewEvents.msisdn),
|
FtueAuthGenericTextInputFormFragmentArgument(TextInputFormFragmentMode.ConfirmMsisdn, true, viewEvents.msisdn),
|
||||||
tag = FRAGMENT_REGISTRATION_STAGE_TAG,
|
tag = FRAGMENT_REGISTRATION_STAGE_TAG,
|
||||||
option = commonOption)
|
option = commonOption)
|
||||||
}
|
}
|
||||||
@ -215,11 +206,11 @@ class OnboardingAuthVariant(
|
|||||||
}.exhaustive
|
}.exhaustive
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateWithState(onboardingViewState: OnboardingViewState) {
|
private fun updateWithState(viewState: OnboardingViewState) {
|
||||||
if (onboardingViewState.isUserLogged()) {
|
if (viewState.isUserLogged()) {
|
||||||
val intent = HomeActivity.newIntent(
|
val intent = HomeActivity.newIntent(
|
||||||
activity,
|
activity,
|
||||||
accountCreation = onboardingViewState.signMode == SignMode.SignUp
|
accountCreation = viewState.signMode == SignMode.SignUp
|
||||||
)
|
)
|
||||||
activity.startActivity(intent)
|
activity.startActivity(intent)
|
||||||
activity.finish()
|
activity.finish()
|
||||||
@ -227,7 +218,7 @@ class OnboardingAuthVariant(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loading
|
// Loading
|
||||||
views.loginLoading.isVisible = onboardingViewState.isLoading()
|
views.loginLoading.isVisible = viewState.isLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onWebLoginError(onWebLoginError: OnboardingViewEvents.OnWebLoginError) {
|
private fun onWebLoginError(onWebLoginError: OnboardingViewEvents.OnWebLoginError) {
|
229
vector/src/main/res/layout/fragment_ftue_auth_splash.xml
Normal file
229
vector/src/main/res/layout/fragment_ftue_auth_splash.xml
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?android:colorBackground"
|
||||||
|
android:paddingStart="36dp"
|
||||||
|
android:paddingTop="@dimen/layout_vertical_margin"
|
||||||
|
android:paddingEnd="36dp"
|
||||||
|
android:paddingBottom="@dimen/layout_vertical_margin">
|
||||||
|
|
||||||
|
<!-- Strategy: 5 Spaces are used to spread the remaining space, using weight -->
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/loginSplashSpace1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashLogoContainer"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="spread_inside"
|
||||||
|
app:layout_constraintVertical_weight="4" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/loginSplashLogoContainer"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSpace2"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSpace1">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/loginSplashLogo"
|
||||||
|
android:layout_width="64dp"
|
||||||
|
android:layout_height="64dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/element_logo_green"
|
||||||
|
android:transitionName="loginLogoTransition" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/logoType"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:contentDescription="@string/app_name"
|
||||||
|
android:src="@drawable/element_logotype"
|
||||||
|
app:tint="?colorSecondary"
|
||||||
|
tools:ignore="MissingPrefix" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/loginSplashSpace2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashTitle"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashLogoContainer"
|
||||||
|
app:layout_constraintVertical_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashTitle"
|
||||||
|
style="@style/Widget.Vector.TextView.Title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/login_splash_title"
|
||||||
|
android:textColor="?vctr_content_primary"
|
||||||
|
android:transitionName="loginTitleTransition"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSpace3"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSpace2" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/loginSplashSpace3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashContent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashTitle"
|
||||||
|
app:layout_constraintVertical_weight="2" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/loginSplashContent"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSpace4"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSpace3">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/loginSplashPicto1"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/ic_login_splash_message_circle"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/loginSplashText1"
|
||||||
|
app:tint="?vctr_content_secondary"
|
||||||
|
tools:ignore="MissingPrefix" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashText1"
|
||||||
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/login_splash_text1"
|
||||||
|
android:textColor="?vctr_content_secondary"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashText2"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/loginSplashPicto1"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/loginSplashPicto2"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/ic_login_splash_lock"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/loginSplashPicto1"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/loginSplashText2"
|
||||||
|
app:tint="?vctr_content_secondary"
|
||||||
|
tools:ignore="MissingPrefix" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashText2"
|
||||||
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/login_splash_text2"
|
||||||
|
android:textColor="?vctr_content_secondary"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashText3"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/loginSplashText1"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashText1" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/loginSplashPicto3"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
android:src="@drawable/ic_login_splash_sliders"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/loginSplashPicto1"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/loginSplashText3"
|
||||||
|
app:tint="?vctr_content_secondary"
|
||||||
|
tools:ignore="MissingPrefix" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashText3"
|
||||||
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="start"
|
||||||
|
android:text="@string/login_splash_text3"
|
||||||
|
android:textColor="?vctr_content_secondary"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/loginSplashText1"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashText2" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/loginSplashSpace4"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSubmit"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashContent"
|
||||||
|
app:layout_constraintVertical_weight="2" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/loginSplashSubmit"
|
||||||
|
style="@style/Widget.Vector.Button.Login"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/login_splash_submit"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:transitionName="loginSubmitTransition"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSpace5"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSpace4" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashAlreadyHaveAccount"
|
||||||
|
style="@style/Widget.Vector.Button.Text.Login"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/login_splash_already_have_account"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:transitionName="loginSubmitTransition"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/loginSplashSpace5"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSubmit" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:id="@+id/loginSplashSpace5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/loginSplashSubmit"
|
||||||
|
app:layout_constraintVertical_weight="4" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/loginSplashVersion"
|
||||||
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="12dp"
|
||||||
|
android:textColor="?vctr_content_secondary"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_debug_icon"
|
||||||
|
app:drawableTint="?colorPrimary"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:text="@string/settings_version"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -202,8 +202,11 @@
|
|||||||
style="@style/Widget.Vector.TextView.Caption"
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="12dp"
|
||||||
android:textColor="?vctr_content_secondary"
|
android:textColor="?vctr_content_secondary"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_debug_icon"
|
||||||
|
app:drawableTint="?colorPrimary"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:text="@string/settings_version"
|
tools:text="@string/settings_version"
|
||||||
|
@ -219,8 +219,11 @@
|
|||||||
style="@style/Widget.Vector.TextView.Caption"
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:drawablePadding="12dp"
|
||||||
android:textColor="?vctr_content_secondary"
|
android:textColor="?vctr_content_secondary"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_debug_icon"
|
||||||
|
app:drawableTint="?colorPrimary"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
tools:text="@string/settings_version"
|
tools:text="@string/settings_version"
|
||||||
|
@ -2521,6 +2521,7 @@
|
|||||||
<string name="login_splash_text2">Keep conversations private with encryption</string>
|
<string name="login_splash_text2">Keep conversations private with encryption</string>
|
||||||
<string name="login_splash_text3">Extend & customise your experience</string>
|
<string name="login_splash_text3">Extend & customise your experience</string>
|
||||||
<string name="login_splash_submit">Get started</string>
|
<string name="login_splash_submit">Get started</string>
|
||||||
|
<string name="login_splash_already_have_account">I already have an account</string>
|
||||||
|
|
||||||
<string name="login_server_title">Select a server</string>
|
<string name="login_server_title">Select a server</string>
|
||||||
<string name="login_server_text">Just like email, accounts have one home, although you can talk to anyone</string>
|
<string name="login_server_text">Just like email, accounts have one home, although you can talk to anyone</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user