diff --git a/vector/src/main/java/im/vector/app/features/command/Command.kt b/vector/src/main/java/im/vector/app/features/command/Command.kt index f0758480d9..db429f9e58 100644 --- a/vector/src/main/java/im/vector/app/features/command/Command.kt +++ b/vector/src/main/java/im/vector/app/features/command/Command.kt @@ -44,9 +44,7 @@ enum class Command(val command: String, val parameters: String, @StringRes val d POLL("/poll", "Question | Option 1 | Option 2 ...", R.string.command_description_poll), SHRUG("/shrug", "", R.string.command_description_shrug), PLAIN("/plain", "", R.string.command_description_plain), - DISCARD_SESSION("/discardsession", "", R.string.command_description_discard_session), - // TODO temporary command - VERIFY_USER("/verify", "", R.string.command_description_verify); + DISCARD_SESSION("/discardsession", "", R.string.command_description_discard_session); val length get() = command.length + 1 diff --git a/vector/src/main/java/im/vector/app/features/command/CommandParser.kt b/vector/src/main/java/im/vector/app/features/command/CommandParser.kt index 0cc371ceb3..94de6bf265 100644 --- a/vector/src/main/java/im/vector/app/features/command/CommandParser.kt +++ b/vector/src/main/java/im/vector/app/features/command/CommandParser.kt @@ -279,11 +279,6 @@ object CommandParser { ParsedCommand.SendShrug(message) } - Command.VERIFY_USER.command -> { - val message = textMessage.substring(Command.VERIFY_USER.command.length).trim() - - ParsedCommand.VerifyUser(message) - } Command.POLL.command -> { val rawCommand = textMessage.substring(Command.POLL.command.length).trim() val split = rawCommand.split("|").map { it.trim() } diff --git a/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt b/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt index c09c3c1fbe..bdfa7779fb 100644 --- a/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt +++ b/vector/src/main/java/im/vector/app/features/command/ParsedCommand.kt @@ -53,7 +53,6 @@ sealed class ParsedCommand { object ClearScalarToken : ParsedCommand() class SendSpoiler(val message: String) : ParsedCommand() class SendShrug(val message: CharSequence) : ParsedCommand() - class VerifyUser(val userId: String) : ParsedCommand() class SendPoll(val question: String, val options: List) : ParsedCommand() object DiscardSession: ParsedCommand() } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index e946240e92..4bad9c6ed0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -656,14 +656,6 @@ class RoomDetailViewModel @AssistedInject constructor( _viewEvents.post(RoomDetailViewEvents.SlashCommandHandled()) popDraft() } - is ParsedCommand.VerifyUser -> { - session - .cryptoService() - .verificationService() - .requestKeyVerificationInDMs(supportedVerificationMethodsProvider.provide(), slashCommandResult.userId, room.roomId) - _viewEvents.post(RoomDetailViewEvents.SlashCommandHandled()) - popDraft() - } is ParsedCommand.SendPoll -> { room.sendPoll(slashCommandResult.question, slashCommandResult.options.mapIndexed { index, s -> OptionItem(s, "$index. $s") }) _viewEvents.post(RoomDetailViewEvents.SlashCommandHandled()) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt index 18a082bcce..92c372f946 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsSecurityPrivacyFragment.kt @@ -305,6 +305,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor( } mCrossSigningStatePreference.isVisible = true + if (!vectorPreferences.developerMode()) { + // When not in developer mode, intercept click on this preference + mCrossSigningStatePreference.onPreferenceClickListener = Preference.OnPreferenceClickListener { true } + } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsAction.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsAction.kt index 1d7b4bf59b..af6ca9f4b7 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsAction.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsAction.kt @@ -18,8 +18,4 @@ package im.vector.app.features.settings.crosssigning import im.vector.app.core.platform.VectorViewModelAction -sealed class CrossSigningSettingsAction : VectorViewModelAction { - object SetUpRecovery : CrossSigningSettingsAction() - object VerifySession : CrossSigningSettingsAction() - object SetupCrossSigning : CrossSigningSettingsAction() -} +sealed class CrossSigningSettingsAction : VectorViewModelAction diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt index e0eced9a73..82279a3906 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsController.kt @@ -22,7 +22,6 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericItem import im.vector.app.core.ui.list.genericItemWithValue import im.vector.app.core.utils.DimensionConverter -import im.vector.app.features.crypto.verification.epoxy.bottomSheetVerificationActionItem import me.gujun.android.span.span import javax.inject.Inject @@ -32,11 +31,7 @@ class CrossSigningSettingsController @Inject constructor( private val dimensionConverter: DimensionConverter ) : TypedEpoxyController() { - interface InteractionListener { - fun setupRecovery() - fun verifySession() - fun initCrossSigning() - } + interface InteractionListener var interactionListener: InteractionListener? = null @@ -72,45 +67,6 @@ class CrossSigningSettingsController @Inject constructor( } } - if (data.recoveryHasToBeSetUp) { - if (data.xSigningIsEnableInAccount) { - bottomSheetVerificationActionItem { - id("setup_recovery") - title(stringProvider.getString(R.string.settings_setup_secure_backup)) - titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) - iconRes(R.drawable.ic_arrow_right) - listener { - interactionListener?.setupRecovery() - } - } - } else { - // Propose to setup cross signing - bottomSheetVerificationActionItem { - id("setup_xSgning") - title(stringProvider.getString(R.string.setup_cross_signing)) - titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) - subTitle(stringProvider.getString(R.string.security_prompt_text)) - iconRes(R.drawable.ic_arrow_right) - listener { - interactionListener?.initCrossSigning() - } - } - } - } - - if (data.deviceHasToBeVerified) { - bottomSheetVerificationActionItem { - id("verify") - title(stringProvider.getString(R.string.crosssigning_verify_this_session)) - titleColor(colorProvider.getColor(R.color.riotx_positive_accent)) - iconRes(R.drawable.ic_arrow_right) - iconColor(colorProvider.getColor(R.color.riotx_positive_accent)) - listener { - interactionListener?.verifySession() - } - } - } - val crossSigningKeys = data.crossSigningInfo crossSigningKeys?.masterKey()?.let { diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsFragment.kt index 7935d282c5..711819f764 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsFragment.kt @@ -29,6 +29,9 @@ import im.vector.app.core.platform.VectorBaseFragment import kotlinx.android.synthetic.main.fragment_generic_recycler.* import javax.inject.Inject +/** + * This Fragment is only used when user activates developer mode from the settings + */ class CrossSigningSettingsFragment @Inject constructor( private val controller: CrossSigningSettingsController, val viewModelFactory: CrossSigningSettingsViewModel.Factory @@ -42,7 +45,7 @@ class CrossSigningSettingsFragment @Inject constructor( super.onActivityCreated(savedInstanceState) viewModel.observeViewEvents { when (it) { - is CrossSigningSettingsViewEvents.Failure -> { + is CrossSigningSettingsViewEvents.Failure -> { AlertDialog.Builder(requireContext()) .setTitle(R.string.dialog_title_error) .setMessage(errorFormatter.toHumanReadable(it.throwable)) @@ -50,15 +53,6 @@ class CrossSigningSettingsFragment @Inject constructor( .show() Unit } - CrossSigningSettingsViewEvents.VerifySession -> { - navigator.requestSelfSessionVerification(requireActivity()) - } - CrossSigningSettingsViewEvents.SetUpRecovery -> { - navigator.upgradeSessionSecurity(requireActivity(), false) - } - CrossSigningSettingsViewEvents.SetupCrossSigning -> { - navigator.upgradeSessionSecurity(requireActivity(), true) - } }.exhaustive } } @@ -87,16 +81,4 @@ class CrossSigningSettingsFragment @Inject constructor( controller.interactionListener = null super.onDestroyView() } - - override fun setupRecovery() { - viewModel.handle(CrossSigningSettingsAction.SetUpRecovery) - } - - override fun verifySession() { - viewModel.handle(CrossSigningSettingsAction.VerifySession) - } - - override fun initCrossSigning() { - viewModel.handle(CrossSigningSettingsAction.SetupCrossSigning) - } } diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewEvents.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewEvents.kt index 52f939636c..b81a321f3f 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewEvents.kt @@ -23,8 +23,4 @@ import im.vector.app.core.platform.VectorViewEvents */ sealed class CrossSigningSettingsViewEvents : VectorViewEvents { data class Failure(val throwable: Throwable) : CrossSigningSettingsViewEvents() - - object SetUpRecovery : CrossSigningSettingsViewEvents() - object VerifySession : CrossSigningSettingsViewEvents() - object SetupCrossSigning : CrossSigningSettingsViewEvents() } diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt index f2f108b3e4..3f70ac1fd7 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt @@ -20,15 +20,14 @@ import com.airbnb.mvrx.MvRxViewModelFactory import com.airbnb.mvrx.ViewModelContext import com.squareup.inject.assisted.Assisted import com.squareup.inject.assisted.AssistedInject +import im.vector.app.core.platform.VectorViewModel +import io.reactivex.Observable +import io.reactivex.functions.BiFunction import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo import org.matrix.android.sdk.api.util.Optional import org.matrix.android.sdk.internal.crypto.crosssigning.isVerified import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo -import im.vector.app.core.extensions.exhaustive -import im.vector.app.core.platform.VectorViewModel -import io.reactivex.Observable -import io.reactivex.functions.BiFunction import org.matrix.android.sdk.rx.rx class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted private val initialState: CrossSigningSettingsViewState, @@ -48,15 +47,12 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat val xSigningIsEnableInAccount = crossSigningKeys != null val xSigningKeysAreTrusted = session.cryptoService().crossSigningService().checkUserTrust(session.myUserId).isVerified() val xSigningKeyCanSign = session.cryptoService().crossSigningService().canCrossSign() - val hasSeveralDevices = data.invoke()?.first?.size ?: 0 > 1 copy( crossSigningInfo = crossSigningKeys, xSigningIsEnableInAccount = xSigningIsEnableInAccount, xSigningKeysAreTrusted = xSigningKeysAreTrusted, - xSigningKeyCanSign = xSigningKeyCanSign, - deviceHasToBeVerified = hasSeveralDevices && (xSigningIsEnableInAccount && !xSigningKeyCanSign), - recoveryHasToBeSetUp = !session.sharedSecretStorageService.isRecoverySetup() + xSigningKeyCanSign = xSigningKeyCanSign ) } } @@ -67,17 +63,9 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat } override fun handle(action: CrossSigningSettingsAction) { - when (action) { - CrossSigningSettingsAction.SetUpRecovery -> { - _viewEvents.post(CrossSigningSettingsViewEvents.SetUpRecovery) - } - CrossSigningSettingsAction.VerifySession -> { - _viewEvents.post(CrossSigningSettingsViewEvents.VerifySession) - } - CrossSigningSettingsAction.SetupCrossSigning -> { - _viewEvents.post(CrossSigningSettingsViewEvents.SetupCrossSigning) - } - }.exhaustive + // No op for the moment + // when (action) { + // }.exhaustive } companion object : MvRxViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewState.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewState.kt index 17e2a3d9eb..8a371ada68 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewState.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewState.kt @@ -23,8 +23,5 @@ data class CrossSigningSettingsViewState( val crossSigningInfo: MXCrossSigningInfo? = null, val xSigningIsEnableInAccount: Boolean = false, val xSigningKeysAreTrusted: Boolean = false, - val xSigningKeyCanSign: Boolean = true, - - val deviceHasToBeVerified: Boolean = false, - val recoveryHasToBeSetUp: Boolean = false + val xSigningKeyCanSign: Boolean = true ) : MvRxState diff --git a/vector/src/main/res/values-cs/strings.xml b/vector/src/main/res/values-cs/strings.xml index e4b5414043..5870a4d64a 100644 --- a/vector/src/main/res/values-cs/strings.xml +++ b/vector/src/main/res/values-cs/strings.xml @@ -1909,7 +1909,6 @@ Vaši e-mailovou adresu můžete přidat k profilu v nastavení. Fail-fast Element se může zbořit častěji, když se objeví neočekávané chyby - Požadavek ověření daného uživatelského ID Předsune ¯\\_(ツ)_/¯ do textové zprávy Zapnout šifrování diff --git a/vector/src/main/res/values-de/strings.xml b/vector/src/main/res/values-de/strings.xml index 2dcb786186..52b8775a02 100644 --- a/vector/src/main/res/values-de/strings.xml +++ b/vector/src/main/res/values-de/strings.xml @@ -1987,7 +1987,6 @@ Verwahre deinen Wiederherstellungsschlüssel an einem sehr sicheren Ort wie eine Ausfallsicher Element kann häufiger abstürzen, wenn ein unerwarteter Fehler auftritt - Überprüfe die angegebenen Nutzer-ID Stellt einer Klartextnachricht ¯\\_(ツ)_/¯ voran Aktiviere Verschlüsselung diff --git a/vector/src/main/res/values-eu/strings.xml b/vector/src/main/res/values-eu/strings.xml index 3a989b7efc..4df9486bbb 100644 --- a/vector/src/main/res/values-eu/strings.xml +++ b/vector/src/main/res/values-eu/strings.xml @@ -1929,7 +1929,6 @@ Abisua: Fitxategi hau ezabatu daiteke aplikazioa desinstalatzen bada. Hutsegin-azkar Element aplikazioa ustekabeko erroreen aurrean maizago kraskatu daiteke - Eskatu emandako erabiltzaile IDa egiaztatzea "Jarri ¯\\_(ツ)_/¯ testu-soileko mezuaren aurretik" Gaitu zifratzea diff --git a/vector/src/main/res/values-fi/strings.xml b/vector/src/main/res/values-fi/strings.xml index e41799e3d7..0f0547a9aa 100644 --- a/vector/src/main/res/values-fi/strings.xml +++ b/vector/src/main/res/values-fi/strings.xml @@ -2016,7 +2016,6 @@ Haluatko lisätä paketteja? Ei turvallinen Video. Kuva. - Pyyntö annetun käyttäjä-ID:n vahvistamiseksi Johonkin näistä on mahdollisesti murtauduttu: \n \n - Kotipalvelimesi diff --git a/vector/src/main/res/values-fr/strings.xml b/vector/src/main/res/values-fr/strings.xml index ec42a259db..74fcf588cb 100644 --- a/vector/src/main/res/values-fr/strings.xml +++ b/vector/src/main/res/values-fr/strings.xml @@ -1933,7 +1933,6 @@ Si vous n’avez pas configuré de nouvelle méthode de récupération, un attaq Défaillance rapide Element peut planter plus souvent quand une erreur inattendue survient - Demande de vérification de l’identifiant utilisateur fourni Préfixe ¯\\_(ツ)_/¯ à un message en texte brut Activer le chiffrement diff --git a/vector/src/main/res/values-hu/strings.xml b/vector/src/main/res/values-hu/strings.xml index 4c617e2488..4dd38484b8 100644 --- a/vector/src/main/res/values-hu/strings.xml +++ b/vector/src/main/res/values-hu/strings.xml @@ -1930,7 +1930,6 @@ Ha nem te állítottad be a visszaállítási metódust, akkor egy támadó pró Összeomlás-hamar Element a nem várt hibák esetén többször fog összeomlani - Az adott felhasználói azonosító ellenőrzésének kérése Hozzáteszi a sima szöveges üzenethez ezt: ¯\\_(ツ)_/¯ Titkosítás engedélyezése diff --git a/vector/src/main/res/values-it/strings.xml b/vector/src/main/res/values-it/strings.xml index 07974104da..100c86048c 100644 --- a/vector/src/main/res/values-it/strings.xml +++ b/vector/src/main/res/values-it/strings.xml @@ -1981,7 +1981,6 @@ Crash facile Element potrebbe crashare più spesso quando si verifica un errore imprevisto - Richiedi di verificare l\'ID utente in questione Antepone ¯\\_(ツ)_/¯ ad un messaggio testuale Attiva la cifratura diff --git a/vector/src/main/res/values-pl/strings.xml b/vector/src/main/res/values-pl/strings.xml index 71c93ae6a0..57b1afe4f2 100644 --- a/vector/src/main/res/values-pl/strings.xml +++ b/vector/src/main/res/values-pl/strings.xml @@ -1915,7 +1915,6 @@ Spróbuj uruchomić ponownie aplikację. Bezproblemowy Element może zawieszać się częściej gdy napotka na niespodziewany błąd - Żądanie weryfikujące podany userID Preparuje ¯\\_(ツ)_/¯ dla zwykłej wiadomości tekstowej Aktywuj szyfrowanie diff --git a/vector/src/main/res/values-pt-rBR/strings.xml b/vector/src/main/res/values-pt-rBR/strings.xml index a4b1c2378e..3e43bf08ec 100644 --- a/vector/src/main/res/values-pt-rBR/strings.xml +++ b/vector/src/main/res/values-pt-rBR/strings.xml @@ -2112,7 +2112,6 @@ Na próxima tela, você será solicitado a permitir que o Element funcione sempr Relatar imediatamente as falhas Element pode quebrar com mais freqüência quando ocorre um erro inesperado - Solicitação para verificar o ID do usuário Adicionar ¯\\_(ツ)_/¯ para uma mensagem de texto simples Ativar criptografia diff --git a/vector/src/main/res/values-ru/strings.xml b/vector/src/main/res/values-ru/strings.xml index 13257551c4..ee2929419f 100644 --- a/vector/src/main/res/values-ru/strings.xml +++ b/vector/src/main/res/values-ru/strings.xml @@ -2214,7 +2214,6 @@ Раннее падение Element может падать чаще, когда происходит непредвиденная ошибка - Запрос на проверку данного идентификатора пользователя Добавляет смайл ¯\\_(ツ)_/¯ в начало сообщения После включения шифрования оно не может быть отключено. diff --git a/vector/src/main/res/values-sq/strings.xml b/vector/src/main/res/values-sq/strings.xml index 6f888c2848..d301dfe2d0 100644 --- a/vector/src/main/res/values-sq/strings.xml +++ b/vector/src/main/res/values-sq/strings.xml @@ -1890,7 +1890,6 @@ Element mund të vithiset më shpesh, kur ndodh një gabim i papritur Lejoni shërbyes rrugëzgjidhje asistimi thirrjesh - Kërko të verifikohet userID-ja i dhënë Parashtoji ¯\\_(ツ)_/¯ një mesazhi tekst të thjeshtë Aktivizoni fshehtëzim diff --git a/vector/src/main/res/values-zh-rCN/strings.xml b/vector/src/main/res/values-zh-rCN/strings.xml index f0b682841f..ba246ce710 100644 --- a/vector/src/main/res/values-zh-rCN/strings.xml +++ b/vector/src/main/res/values-zh-rCN/strings.xml @@ -2020,7 +2020,6 @@ Element 在后台时的工作将被显著的限制,这可能会影响消息通 快速失败 发生意外错误时,Element 可能更经常崩溃 - 请求验证给定 userID 在明文消息前添加 ¯\\_(ツ)_/¯ 启用加密 diff --git a/vector/src/main/res/values-zh-rTW/strings.xml b/vector/src/main/res/values-zh-rTW/strings.xml index d13e084960..b0685ab359 100644 --- a/vector/src/main/res/values-zh-rTW/strings.xml +++ b/vector/src/main/res/values-zh-rTW/strings.xml @@ -1884,7 +1884,6 @@ Matrix 中的消息可見度類似于電子郵件。我們忘記您的郵件意 快速失敗 在發生非預期的錯誤時,Element 可能更常當機 - 請求驗證給定的 userID "將 ¯\\_(ツ)_/¯ 附加到純文字訊息中" 啟用加密 diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 94cafc73e1..34cf24b476 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2022,7 +2022,6 @@ Fail-fast Element may crash more often when an unexpected error occurs - Request to verify the given userID Prepends ¯\\_(ツ)_/¯ to a plain-text message "Enable encryption" diff --git a/vector/src/main/res/xml/vector_settings_security_privacy.xml b/vector/src/main/res/xml/vector_settings_security_privacy.xml index 9965d0fff4..9cd629251e 100644 --- a/vector/src/main/res/xml/vector_settings_security_privacy.xml +++ b/vector/src/main/res/xml/vector_settings_security_privacy.xml @@ -17,6 +17,7 @@ +