Learn more in session overview screen

This commit is contained in:
Maxime NATUREL 2022-09-12 17:47:29 +02:00
parent 400b1b0697
commit 51532687b9
2 changed files with 24 additions and 2 deletions

View File

@ -168,7 +168,7 @@ class VectorSettingsDevicesFragment :
append(getString(R.string.device_manager_learn_more_sessions_unverified)) append(getString(R.string.device_manager_learn_more_sessions_unverified))
append("\n\n") append("\n\n")
append(getString(R.string.device_manager_learn_more_sessions_inactive)) append(getString(R.string.device_manager_learn_more_sessions_inactive))
} },
) )
SessionLearnMoreBottomSheet.show(childFragmentManager, args) SessionLearnMoreBottomSheet.show(childFragmentManager, args)
} }

View File

@ -22,7 +22,6 @@ import android.view.LayoutInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
@ -44,6 +43,8 @@ import im.vector.app.features.settings.devices.v2.list.SessionInfoViewState
import im.vector.app.features.workers.signout.SignOutUiWorker import im.vector.app.features.workers.signout.SignOutUiWorker
import org.matrix.android.sdk.api.auth.data.LoginFlowTypes import org.matrix.android.sdk.api.auth.data.LoginFlowTypes
import org.matrix.android.sdk.api.extensions.orFalse import org.matrix.android.sdk.api.extensions.orFalse
import im.vector.app.features.settings.devices.v2.more.SessionLearnMoreBottomSheet
import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
import javax.inject.Inject import javax.inject.Inject
/** /**
@ -204,6 +205,9 @@ class SessionOverviewFragment :
isLastSeenDetailsVisible = true, isLastSeenDetailsVisible = true,
) )
views.sessionOverviewInfo.render(infoViewState, dateFormatter, drawableProvider, colorProvider) views.sessionOverviewInfo.render(infoViewState, dateFormatter, drawableProvider, colorProvider)
views.sessionOverviewInfo.onLearnMoreClickListener = {
showLearnMoreInfoVerificationStatus(viewState.deviceFullInfo.roomEncryptionTrustLevel == RoomEncryptionTrustLevel.Trusted)
}
} else { } else {
views.sessionOverviewInfo.isVisible = false views.sessionOverviewInfo.isVisible = false
} }
@ -249,4 +253,22 @@ class SessionOverviewFragment :
reAuthActivityResultLauncher.launch(intent) reAuthActivityResultLauncher.launch(intent)
} }
} }
private fun showLearnMoreInfoVerificationStatus(isVerified: Boolean) {
val titleResId = if (isVerified) {
R.string.device_manager_verification_status_verified
} else {
R.string.device_manager_verification_status_unverified
}
val descriptionResId = if (isVerified) {
R.string.device_manager_learn_more_session_verified
} else {
R.string.device_manager_learn_more_sessions_unverified
}
val args = SessionLearnMoreBottomSheet.Args(
title = getString(titleResId),
description = getString(descriptionResId),
)
SessionLearnMoreBottomSheet.show(childFragmentManager, args)
}
} }