Merge pull request #3056 from vector-im/feature/bma/displayVersion

Add version details on the login screen, in debug or developer mode
This commit is contained in:
Benoit Marty 2021-03-25 13:55:37 +01:00 committed by GitHub
commit 0d10d388e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View file

@ -30,7 +30,7 @@ Test:
- -
Other changes: Other changes:
- - Add version details on the login screen, in debug or developer mode
Changes in Element 1.1.3 (2021-03-18) Changes in Element 1.1.3 (2021-03-18)
=================================================== ===================================================

View file

@ -16,18 +16,24 @@
package im.vector.app.features.login package im.vector.app.features.login
import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater 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 im.vector.app.BuildConfig
import im.vector.app.databinding.FragmentLoginSplashBinding import im.vector.app.databinding.FragmentLoginSplashBinding
import im.vector.app.features.settings.VectorPreferences
import javax.inject.Inject 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 LoginSplashFragment @Inject constructor() : AbstractLoginFragment<FragmentLoginSplashBinding>() { class LoginSplashFragment @Inject constructor(
private val vectorPreferences: VectorPreferences
) : AbstractLoginFragment<FragmentLoginSplashBinding>() {
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSplashBinding { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSplashBinding {
return FragmentLoginSplashBinding.inflate(inflater, container, false) return FragmentLoginSplashBinding.inflate(inflater, container, false)
@ -41,6 +47,14 @@ class LoginSplashFragment @Inject constructor() : AbstractLoginFragment<Fragment
private fun setupViews() { private fun setupViews() {
views.loginSplashSubmit.setOnClickListener { getStarted() } views.loginSplashSubmit.setOnClickListener { getStarted() }
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
views.loginSplashVersion.isVisible = true
@SuppressLint("SetTextI18n")
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
"Branch: ${BuildConfig.GIT_BRANCH_NAME}\n" +
"Build: ${BuildConfig.BUILD_NUMBER}"
}
} }
private fun getStarted() { private fun getStarted() {

View file

@ -193,4 +193,15 @@
app:layout_constraintTop_toBottomOf="@+id/loginSplashSubmit" app:layout_constraintTop_toBottomOf="@+id/loginSplashSubmit"
app:layout_constraintVertical_weight="4" /> app:layout_constraintVertical_weight="4" />
<TextView
android:id="@+id/loginSplashVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?riotx_text_secondary"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="@string/settings_version"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>