From f5fbb2bc4f3b6a7090b316f8b5ee9355902d949f Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 17 Jul 2020 13:29:18 +0200 Subject: [PATCH 001/235] Setup screens for Pin --- build.gradle | 2 + vector/build.gradle | 1 + .../riotx/features/debug/DebugMenuActivity.kt | 6 +++ .../debug/res/layout/activity_debug_menu.xml | 7 +++ vector/src/main/AndroidManifest.xml | 1 + .../im/vector/riotx/core/di/FragmentModule.kt | 6 +++ .../features/navigation/DefaultNavigator.kt | 7 +++ .../riotx/features/navigation/Navigator.kt | 2 + .../im/vector/riotx/features/pin/PinAction.kt | 21 ++++++++ .../vector/riotx/features/pin/PinActivity.kt | 47 +++++++++++++++++ .../vector/riotx/features/pin/PinFragment.kt | 49 +++++++++++++++++ .../vector/riotx/features/pin/PinViewModel.kt | 52 +++++++++++++++++++ .../vector/riotx/features/pin/PinViewState.kt | 21 ++++++++ vector/src/main/res/layout/fragment_pin.xml | 19 +++++++ 14 files changed, 241 insertions(+) create mode 100644 vector/src/main/java/im/vector/riotx/features/pin/PinAction.kt create mode 100644 vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt create mode 100644 vector/src/main/java/im/vector/riotx/features/pin/PinFragment.kt create mode 100644 vector/src/main/java/im/vector/riotx/features/pin/PinViewModel.kt create mode 100644 vector/src/main/java/im/vector/riotx/features/pin/PinViewState.kt create mode 100644 vector/src/main/res/layout/fragment_pin.xml diff --git a/build.gradle b/build.gradle index 47b3ab240d..5593a56f6e 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,8 @@ allprojects { includeGroupByRegex 'com\\.github\\.BillCarsonFr' // PhotoView includeGroupByRegex 'com\\.github\\.chrisbanes' + // PFLockScreen-Android + includeGroupByRegex 'com\\.github\\.thealeksandr' } } maven { diff --git a/vector/build.gradle b/vector/build.gradle index 2b033790bc..0d654438f5 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -346,6 +346,7 @@ dependencies { implementation 'me.saket:better-link-movement-method:2.2.0' implementation 'com.google.android:flexbox:1.1.1' implementation "androidx.autofill:autofill:$autofill_version" + implementation 'com.github.thealeksandr:PFLockScreen-Android:1.0.0-beta7' // Custom Tab implementation 'androidx.browser:browser:1.2.0' diff --git a/vector/src/debug/java/im/vector/riotx/features/debug/DebugMenuActivity.kt b/vector/src/debug/java/im/vector/riotx/features/debug/DebugMenuActivity.kt index a197a6f93e..29ed6d101c 100644 --- a/vector/src/debug/java/im/vector/riotx/features/debug/DebugMenuActivity.kt +++ b/vector/src/debug/java/im/vector/riotx/features/debug/DebugMenuActivity.kt @@ -36,6 +36,7 @@ import im.vector.riotx.core.utils.allGranted import im.vector.riotx.core.utils.checkPermissions import im.vector.riotx.core.utils.toast import im.vector.riotx.features.debug.sas.DebugSasEmojiActivity +import im.vector.riotx.features.pin.PinActivity import im.vector.riotx.features.qrcode.QrCodeScannerActivity import kotlinx.android.synthetic.debug.activity_debug_menu.* import timber.log.Timber @@ -81,6 +82,11 @@ class DebugMenuActivity : VectorBaseActivity() { startActivity(Intent(this, DebugSasEmojiActivity::class.java)) } + @OnClick(R.id.debug_open_pin_code) + fun openPinCode() { + startActivity(PinActivity.newIntent(this)) + } + @OnClick(R.id.debug_test_notification) fun testNotification() { val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager diff --git a/vector/src/debug/res/layout/activity_debug_menu.xml b/vector/src/debug/res/layout/activity_debug_menu.xml index 6578258e70..d0e94f49a4 100644 --- a/vector/src/debug/res/layout/activity_debug_menu.xml +++ b/vector/src/debug/res/layout/activity_debug_menu.xml @@ -61,6 +61,13 @@ android:layout_height="wrap_content" android:text="Crash the app" /> + + + diff --git a/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt b/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt index 8e4f95ed54..9efe0e6adb 100644 --- a/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt +++ b/vector/src/main/java/im/vector/riotx/core/di/FragmentModule.kt @@ -66,6 +66,7 @@ import im.vector.riotx.features.login.LoginSplashFragment import im.vector.riotx.features.login.LoginWaitForEmailFragment import im.vector.riotx.features.login.LoginWebFragment import im.vector.riotx.features.login.terms.LoginTermsFragment +import im.vector.riotx.features.pin.PinFragment import im.vector.riotx.features.qrcode.QrCodeScannerFragment import im.vector.riotx.features.reactions.EmojiChooserFragment import im.vector.riotx.features.reactions.EmojiSearchResultFragment @@ -534,4 +535,9 @@ interface FragmentModule { @IntoMap @FragmentKey(ContactsBookFragment::class) fun bindPhoneBookFragment(fragment: ContactsBookFragment): Fragment + + @Binds + @IntoMap + @FragmentKey(PinFragment::class) + fun bindPinFragment(fragment: PinFragment): Fragment } diff --git a/vector/src/main/java/im/vector/riotx/features/navigation/DefaultNavigator.kt b/vector/src/main/java/im/vector/riotx/features/navigation/DefaultNavigator.kt index 8267ba4c99..7d17545309 100644 --- a/vector/src/main/java/im/vector/riotx/features/navigation/DefaultNavigator.kt +++ b/vector/src/main/java/im/vector/riotx/features/navigation/DefaultNavigator.kt @@ -52,6 +52,7 @@ import im.vector.riotx.features.invite.InviteUsersToRoomActivity import im.vector.riotx.features.media.AttachmentData import im.vector.riotx.features.media.BigImageViewerActivity import im.vector.riotx.features.media.VectorAttachmentViewerActivity +import im.vector.riotx.features.pin.PinActivity import im.vector.riotx.features.roomdirectory.RoomDirectoryActivity import im.vector.riotx.features.roomdirectory.createroom.CreateRoomActivity import im.vector.riotx.features.roomdirectory.roompreview.RoomPreviewActivity @@ -250,6 +251,7 @@ class DefaultNavigator @Inject constructor( } } + override fun openTerms(fragment: Fragment, serviceType: TermsService.ServiceType, baseUrl: String, token: String?, requestCode: Int) { val intent = ReviewTermsActivity.intent(fragment.requireContext(), serviceType, baseUrl, token) fragment.startActivityForResult(intent, requestCode) @@ -272,6 +274,11 @@ class DefaultNavigator @Inject constructor( context.startActivity(WidgetActivity.newIntent(context, widgetArgs)) } + override fun openPinCode(activity: Activity, requestCode: Int) { + val intent = PinActivity.newIntent(activity) + activity.startActivity(intent) + } + override fun openMediaViewer(activity: Activity, roomId: String, mediaData: AttachmentData, diff --git a/vector/src/main/java/im/vector/riotx/features/navigation/Navigator.kt b/vector/src/main/java/im/vector/riotx/features/navigation/Navigator.kt index 2d817183be..7ffef9aa34 100644 --- a/vector/src/main/java/im/vector/riotx/features/navigation/Navigator.kt +++ b/vector/src/main/java/im/vector/riotx/features/navigation/Navigator.kt @@ -78,6 +78,8 @@ interface Navigator { fun openBigImageViewer(activity: Activity, sharedElement: View?, matrixItem: MatrixItem) + fun openPinCode(activity: Activity, requestCode: Int = ReviewTermsActivity.TERMS_REQUEST_CODE) + fun openTerms(fragment: Fragment, serviceType: TermsService.ServiceType, baseUrl: String, diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinAction.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinAction.kt new file mode 100644 index 0000000000..fd8aac90bb --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinAction.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 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.riotx.features.pin + +import im.vector.riotx.core.platform.VectorViewModelAction + +sealed class PinAction : VectorViewModelAction diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt new file mode 100644 index 0000000000..27322c1539 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 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.riotx.features.pin + +import android.content.Context +import android.content.Intent +import androidx.appcompat.widget.Toolbar +import im.vector.riotx.R +import im.vector.riotx.core.extensions.addFragment +import im.vector.riotx.core.platform.ToolbarConfigurable +import im.vector.riotx.core.platform.VectorBaseActivity + +class PinActivity : VectorBaseActivity(), ToolbarConfigurable { + + companion object { + + fun newIntent(context: Context): Intent { + return Intent(context, PinActivity::class.java) + } + } + + override fun getLayoutRes() = R.layout.activity_simple + + override fun initUiAndData() { + if (isFirstCreation()) { + addFragment(R.id.simpleFragmentContainer, PinFragment::class.java) + } + } + + override fun configure(toolbar: Toolbar) { + configureToolbar(toolbar) + } +} diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinFragment.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinFragment.kt new file mode 100644 index 0000000000..07c426a31d --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinFragment.kt @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 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.riotx.features.pin + +import android.os.Bundle +import android.view.View +import com.airbnb.mvrx.fragmentViewModel +import com.airbnb.mvrx.withState +import im.vector.riotx.R +import im.vector.riotx.core.platform.VectorBaseFragment +import timber.log.Timber +import javax.inject.Inject + +class PinFragment @Inject constructor( + private val viewModelFactory: PinViewModel.Factory +) : VectorBaseFragment(), PinViewModel.Factory by viewModelFactory { + + private val viewModel: PinViewModel by fragmentViewModel() + + override fun getLayoutResId() = R.layout.fragment_pin + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + // Initialize your view, subscribe to viewModel... + } + + override fun onDestroyView() { + super.onDestroyView() + // Clear your view, unsubscribe... + } + + override fun invalidate() = withState(viewModel) { state -> + Timber.v("Invalidate $state") + } +} diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinViewModel.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinViewModel.kt new file mode 100644 index 0000000000..9a5cdfd8f9 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinViewModel.kt @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 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.riotx.features.pin + +import com.airbnb.mvrx.ActivityViewModelContext +import com.airbnb.mvrx.FragmentViewModelContext +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.riotx.core.platform.EmptyViewEvents +import im.vector.riotx.core.platform.VectorViewModel +import timber.log.Timber + +class PinViewModel @AssistedInject constructor(@Assisted initialState: PinViewState) + : VectorViewModel(initialState) { + + @AssistedInject.Factory + interface Factory { + fun create(initialState: PinViewState): PinViewModel + } + + companion object : MvRxViewModelFactory { + + @JvmStatic + override fun create(viewModelContext: ViewModelContext, state: PinViewState): PinViewModel? { + val factory = when (viewModelContext) { + is FragmentViewModelContext -> viewModelContext.fragment as? Factory + is ActivityViewModelContext -> viewModelContext.activity as? Factory + } + return factory?.create(state) ?: error("You should let your activity/fragment implements Factory interface") + } + } + + override fun handle(action: PinAction) { + Timber.v("$action not handled by viewModel") + } +} diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinViewState.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinViewState.kt new file mode 100644 index 0000000000..45eb9f72c2 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinViewState.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 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.riotx.features.pin + +import com.airbnb.mvrx.MvRxState + +data class PinViewState(val flag: Boolean = false) : MvRxState diff --git a/vector/src/main/res/layout/fragment_pin.xml b/vector/src/main/res/layout/fragment_pin.xml new file mode 100644 index 0000000000..31742cce30 --- /dev/null +++ b/vector/src/main/res/layout/fragment_pin.xml @@ -0,0 +1,19 @@ + + + + + + From c5f06386bd0171f4b72366c5923338d2eabca841 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 17 Jul 2020 17:13:50 +0200 Subject: [PATCH 002/235] Continue trying to configure Pin library, stil WIP --- .../vector/riotx/features/pin/PinActivity.kt | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt index 27322c1539..1fc1270192 100644 --- a/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt @@ -19,10 +19,15 @@ package im.vector.riotx.features.pin import android.content.Context import android.content.Intent import androidx.appcompat.widget.Toolbar +import com.beautycoder.pflockscreen.PFFLockScreenConfiguration +import com.beautycoder.pflockscreen.fragments.PFLockScreenFragment +import com.beautycoder.pflockscreen.fragments.PFLockScreenFragment.OnPFLockScreenCodeCreateListener import im.vector.riotx.R import im.vector.riotx.core.extensions.addFragment +import im.vector.riotx.core.extensions.replaceFragment import im.vector.riotx.core.platform.ToolbarConfigurable import im.vector.riotx.core.platform.VectorBaseActivity +import timber.log.Timber class PinActivity : VectorBaseActivity(), ToolbarConfigurable { @@ -37,11 +42,58 @@ class PinActivity : VectorBaseActivity(), ToolbarConfigurable { override fun initUiAndData() { if (isFirstCreation()) { - addFragment(R.id.simpleFragmentContainer, PinFragment::class.java) + showCreateFragment() } } override fun configure(toolbar: Toolbar) { configureToolbar(toolbar) } + + private fun showCreateFragment() { + val createFragment = PFLockScreenFragment() + val builder = PFFLockScreenConfiguration.Builder(this) + .setNewCodeValidation(true) + .setTitle("Choose a PIN for security") + .setNewCodeValidationTitle("Confirm PIN") + .setMode(PFFLockScreenConfiguration.MODE_CREATE) + createFragment.setConfiguration(builder.build()) + createFragment.setCodeCreateListener(object : OnPFLockScreenCodeCreateListener { + override fun onNewCodeValidationFailed() { + } + + override fun onCodeCreated(encodedCode: String) { + showAuthFragment(encodedCode) + } + }) + addFragment(R.id.simpleFragmentContainer, createFragment) + } + + private fun showAuthFragment(encodedCode: String) { + val authFragment = PFLockScreenFragment() + val builder = PFFLockScreenConfiguration.Builder(this) + .setUseFingerprint(true) + .setTitle("Enter your PIN") + .setLeftButton("Forgot PIN?") + .setMode(PFFLockScreenConfiguration.MODE_AUTH) + authFragment.setConfiguration(builder.build()) + authFragment.setEncodedPinCode(encodedCode) + authFragment.setOnLeftButtonClickListener { + + } + authFragment.setLoginListener(object : PFLockScreenFragment.OnPFLockScreenLoginListener { + override fun onPinLoginFailed() { + } + + override fun onFingerprintSuccessful() { + } + + override fun onFingerprintLoginFailed() { + } + + override fun onCodeInputSuccessful() { + } + }) + replaceFragment(R.id.simpleFragmentContainer, authFragment) + } } From f5b584ddb86f138c79d81919f02183aaa9c80b1d Mon Sep 17 00:00:00 2001 From: vulet Date: Mon, 20 Jul 2020 00:15:45 +0800 Subject: [PATCH 003/235] fix: invisible toolbar(status.im theme) --- CHANGES.md | 1 + vector/src/main/res/values/theme_status.xml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0099412196..ec957cd7f3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Improvements 🙌: - Bugfix 🐛: + - Fix invisible toolbar (Status.im theme) (#1746) - Fix theme issue on Room directory screen (#1613) - Fix notification not dismissing when entering a room diff --git a/vector/src/main/res/values/theme_status.xml b/vector/src/main/res/values/theme_status.xml index ed260ccfeb..06394ad049 100644 --- a/vector/src/main/res/values/theme_status.xml +++ b/vector/src/main/res/values/theme_status.xml @@ -29,9 +29,9 @@ @color/riotx_waiting_background_color_status - #FFFFFFFF - #FFD8D8D8 - #FFD8D8D8 + @color/primary_color_status + @color/primary_color_dark_status + @color/primary_color_dark_status @color/primary_hint_text_color_light From ecdef52829ed0cadf39c60b53924e488b371a800 Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 28 Jul 2020 20:22:59 +0200 Subject: [PATCH 004/235] Continue PIN code library integration (fork required) --- build.gradle | 2 +- vector/build.gradle | 2 +- .../vector/riotx/features/pin/PinActivity.kt | 29 +++++++++--- .../main/res/drawable/pin_code_dot_empty.xml | 13 ++++++ .../main/res/drawable/pin_code_dot_fill.xml | 12 +++++ .../src/main/res/drawable/pin_code_dots.xml | 9 ++++ .../src/main/res/values/styles_pin_code.xml | 44 +++++++++++++++++++ vector/src/main/res/values/theme_dark.xml | 10 +++++ vector/src/main/res/values/theme_light.xml | 10 +++++ 9 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 vector/src/main/res/drawable/pin_code_dot_empty.xml create mode 100644 vector/src/main/res/drawable/pin_code_dot_fill.xml create mode 100644 vector/src/main/res/drawable/pin_code_dots.xml create mode 100644 vector/src/main/res/values/styles_pin_code.xml diff --git a/build.gradle b/build.gradle index 5593a56f6e..12c5181ea4 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ allprojects { // PhotoView includeGroupByRegex 'com\\.github\\.chrisbanes' // PFLockScreen-Android - includeGroupByRegex 'com\\.github\\.thealeksandr' + includeGroupByRegex 'com\\.github\\.ganfra' } } maven { diff --git a/vector/build.gradle b/vector/build.gradle index 0d654438f5..f60f74629f 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -346,7 +346,7 @@ dependencies { implementation 'me.saket:better-link-movement-method:2.2.0' implementation 'com.google.android:flexbox:1.1.1' implementation "androidx.autofill:autofill:$autofill_version" - implementation 'com.github.thealeksandr:PFLockScreen-Android:1.0.0-beta7' + implementation 'com.github.ganfra:PFLockScreen-Android:1.0.0-beta8' // Custom Tab implementation 'androidx.browser:browser:1.2.0' diff --git a/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt index 1fc1270192..fc0d3b1bcb 100644 --- a/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/pin/PinActivity.kt @@ -18,16 +18,16 @@ package im.vector.riotx.features.pin import android.content.Context import android.content.Intent +import android.widget.Toast +import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.Toolbar import com.beautycoder.pflockscreen.PFFLockScreenConfiguration import com.beautycoder.pflockscreen.fragments.PFLockScreenFragment import com.beautycoder.pflockscreen.fragments.PFLockScreenFragment.OnPFLockScreenCodeCreateListener import im.vector.riotx.R -import im.vector.riotx.core.extensions.addFragment import im.vector.riotx.core.extensions.replaceFragment import im.vector.riotx.core.platform.ToolbarConfigurable import im.vector.riotx.core.platform.VectorBaseActivity -import timber.log.Timber class PinActivity : VectorBaseActivity(), ToolbarConfigurable { @@ -41,9 +41,7 @@ class PinActivity : VectorBaseActivity(), ToolbarConfigurable { override fun getLayoutRes() = R.layout.activity_simple override fun initUiAndData() { - if (isFirstCreation()) { - showCreateFragment() - } + showCreateFragment() } override fun configure(toolbar: Toolbar) { @@ -57,6 +55,7 @@ class PinActivity : VectorBaseActivity(), ToolbarConfigurable { .setTitle("Choose a PIN for security") .setNewCodeValidationTitle("Confirm PIN") .setMode(PFFLockScreenConfiguration.MODE_CREATE) + createFragment.setConfiguration(builder.build()) createFragment.setCodeCreateListener(object : OnPFLockScreenCodeCreateListener { override fun onNewCodeValidationFailed() { @@ -66,7 +65,7 @@ class PinActivity : VectorBaseActivity(), ToolbarConfigurable { showAuthFragment(encodedCode) } }) - addFragment(R.id.simpleFragmentContainer, createFragment) + replaceFragment(R.id.simpleFragmentContainer, createFragment) } private fun showAuthFragment(encodedCode: String) { @@ -75,25 +74,41 @@ class PinActivity : VectorBaseActivity(), ToolbarConfigurable { .setUseFingerprint(true) .setTitle("Enter your PIN") .setLeftButton("Forgot PIN?") + .setClearCodeOnError(true) .setMode(PFFLockScreenConfiguration.MODE_AUTH) authFragment.setConfiguration(builder.build()) authFragment.setEncodedPinCode(encodedCode) authFragment.setOnLeftButtonClickListener { - + displayForgotPinWarningDialog() } authFragment.setLoginListener(object : PFLockScreenFragment.OnPFLockScreenLoginListener { override fun onPinLoginFailed() { } override fun onFingerprintSuccessful() { + Toast.makeText(this@PinActivity, "Pin successful", Toast.LENGTH_LONG).show() + finish() } override fun onFingerprintLoginFailed() { } override fun onCodeInputSuccessful() { + Toast.makeText(this@PinActivity, "Pin successful", Toast.LENGTH_LONG).show() + finish() } }) replaceFragment(R.id.simpleFragmentContainer, authFragment) } + + private fun displayForgotPinWarningDialog() { + AlertDialog.Builder(this) + .setTitle("Reset pin") + .setMessage("To reset your PIN, you'll need to re-login and create a new one.") + .setPositiveButton("Reset pin") { _, _ -> + showCreateFragment() + } + .setNegativeButton(R.string.cancel, null) + .show() + } } diff --git a/vector/src/main/res/drawable/pin_code_dot_empty.xml b/vector/src/main/res/drawable/pin_code_dot_empty.xml new file mode 100644 index 0000000000..6ee800a07d --- /dev/null +++ b/vector/src/main/res/drawable/pin_code_dot_empty.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/pin_code_dot_fill.xml b/vector/src/main/res/drawable/pin_code_dot_fill.xml new file mode 100644 index 0000000000..799ea30174 --- /dev/null +++ b/vector/src/main/res/drawable/pin_code_dot_fill.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/drawable/pin_code_dots.xml b/vector/src/main/res/drawable/pin_code_dots.xml new file mode 100644 index 0000000000..29e445e511 --- /dev/null +++ b/vector/src/main/res/drawable/pin_code_dots.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/values/styles_pin_code.xml b/vector/src/main/res/values/styles_pin_code.xml new file mode 100644 index 0000000000..498b791e05 --- /dev/null +++ b/vector/src/main/res/values/styles_pin_code.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/values/theme_dark.xml b/vector/src/main/res/values/theme_dark.xml index fae33cf6bf..a391e48cfb 100644 --- a/vector/src/main/res/values/theme_dark.xml +++ b/vector/src/main/res/values/theme_dark.xml @@ -222,6 +222,16 @@ @style/VectorSnackBarButton @style/VectorSnackBarText + + @style/PinCodeScreenStyle + @style/PinCodeKeyButtonStyle + @style/PinCodeTitleStyle + @style/PinCodeHintStyle + @style/PinCodeDotsViewStyle + @style/PinCodeDeleteButtonStyle + @style/PinCodeFingerprintButtonStyle + @style/PinCodeNextButtonStyle + - - - - - - - - - - + + \ No newline at end of file diff --git a/vector/src/main/res/values/theme_dark.xml b/vector/src/main/res/values/theme_dark.xml index 64855223ee..3e3cc8bbac 100644 --- a/vector/src/main/res/values/theme_dark.xml +++ b/vector/src/main/res/values/theme_dark.xml @@ -147,13 +147,16 @@ @null - @style/Vector.TabView.Dark - @style/Vector.TabView.Dark + @style/Vector.TabView + @style/Vector.TabView @style/Vector.TabText @style/Vector.TabText + @color/tab_bar_selected_background_color_dark + @color/tab_bar_unselected_background_color_dark + @style/PreferenceThemeOverlay.v14.Material @@ -180,9 +183,4 @@ - diff --git a/vector/src/main/res/values/theme_light.xml b/vector/src/main/res/values/theme_light.xml index 88510e526a..943f2dc8c2 100644 --- a/vector/src/main/res/values/theme_light.xml +++ b/vector/src/main/res/values/theme_light.xml @@ -147,13 +147,16 @@ @null - @style/Vector.TabView.Light - @style/Vector.TabView.Light + @style/Vector.TabView + @style/Vector.TabView @style/Vector.TabText @style/Vector.TabText + @color/tab_bar_selected_background_color_light + @color/tab_bar_unselected_background_color_light + @style/PreferenceThemeOverlay.v14.Material @@ -180,9 +183,4 @@ - diff --git a/vector/src/main/res/values/theme_status.xml b/vector/src/main/res/values/theme_status.xml index 97e546d239..c127baf3ca 100644 --- a/vector/src/main/res/values/theme_status.xml +++ b/vector/src/main/res/values/theme_status.xml @@ -85,14 +85,13 @@ @null - - @style/Vector.TabView.Status - @style/Vector.TabView.Status - @style/Vector.TabText @style/Vector.TabText + @color/tab_bar_selected_background_color_status + @color/tab_bar_unselected_background_color_status + @style/PreferenceThemeOverlay.v14.Material @@ -101,9 +100,4 @@ - From b833198a3a7d4964e0e65172016c0463dc7839b8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 5 Aug 2020 19:34:19 +0200 Subject: [PATCH 056/235] Rework text selector --- vector/src/main/res/color/primary_text_color_selector.xml | 5 +++++ .../src/main/res/color/primary_text_color_selector_dark.xml | 5 ----- .../src/main/res/color/primary_text_color_selector_light.xml | 5 ----- .../main/res/color/primary_text_color_selector_status.xml | 5 ----- vector/src/main/res/values/colors_riot.xml | 3 +++ vector/src/main/res/values/theme_black.xml | 1 + vector/src/main/res/values/theme_dark.xml | 3 +++ vector/src/main/res/values/theme_light.xml | 3 +++ vector/src/main/res/values/theme_status.xml | 5 ++++- 9 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 vector/src/main/res/color/primary_text_color_selector.xml delete mode 100644 vector/src/main/res/color/primary_text_color_selector_dark.xml delete mode 100644 vector/src/main/res/color/primary_text_color_selector_light.xml delete mode 100644 vector/src/main/res/color/primary_text_color_selector_status.xml diff --git a/vector/src/main/res/color/primary_text_color_selector.xml b/vector/src/main/res/color/primary_text_color_selector.xml new file mode 100644 index 0000000000..3ad723c976 --- /dev/null +++ b/vector/src/main/res/color/primary_text_color_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/vector/src/main/res/color/primary_text_color_selector_dark.xml b/vector/src/main/res/color/primary_text_color_selector_dark.xml deleted file mode 100644 index 7c4c853b58..0000000000 --- a/vector/src/main/res/color/primary_text_color_selector_dark.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/vector/src/main/res/color/primary_text_color_selector_light.xml b/vector/src/main/res/color/primary_text_color_selector_light.xml deleted file mode 100644 index 8d4c0d06c4..0000000000 --- a/vector/src/main/res/color/primary_text_color_selector_light.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/vector/src/main/res/color/primary_text_color_selector_status.xml b/vector/src/main/res/color/primary_text_color_selector_status.xml deleted file mode 100644 index 9bbc84c321..0000000000 --- a/vector/src/main/res/color/primary_text_color_selector_status.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/vector/src/main/res/values/colors_riot.xml b/vector/src/main/res/values/colors_riot.xml index a606f880a1..5b85b71dd5 100644 --- a/vector/src/main/res/values/colors_riot.xml +++ b/vector/src/main/res/values/colors_riot.xml @@ -71,6 +71,9 @@ #CCDDDDDD + + + #FF2E2F32 #FF9E9E9E diff --git a/vector/src/main/res/values/theme_black.xml b/vector/src/main/res/values/theme_black.xml index 1decca7f9d..b39ef440c3 100644 --- a/vector/src/main/res/values/theme_black.xml +++ b/vector/src/main/res/values/theme_black.xml @@ -80,6 +80,7 @@ @color/riot_primary_background_color_black @color/riotx_bottom_nav_background_color_black @color/riotx_bottom_nav_background_border_color_black + + + @@ -392,6 +389,13 @@ SOFTWARE.
  • Copyright (C) 2018 stfalcon.com
  • +
  • + Jitsi Meet (jitsi-meet) +
    + Copyright @ 2020-present 8x8, Inc. +
    + Copyright @ 2017-2018 Atlassian Pty Ltd +
  •  Apache License
    
    From 35a5d9e454b7910325dd0e0412cc068e27cc7f76 Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 10:59:45 +0200
    Subject: [PATCH 171/235] Prevent click on Cross-Signing item when not in
     developer mode
    
    ---
     .../settings/VectorSettingsSecurityPrivacyFragment.kt         | 4 ++++
     .../settings/crosssigning/CrossSigningSettingsFragment.kt     | 3 +++
     vector/src/main/res/xml/vector_settings_security_privacy.xml  | 1 +
     3 files changed, 8 insertions(+)
    
    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/CrossSigningSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsFragment.kt
    index 7935d282c5..e70fd45251 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
    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 @@
         
    +
             
    Date: Mon, 17 Aug 2020 09:33:21 +0200
    Subject: [PATCH 172/235] Remove actions that have been added only for debug
     purpose - step 1
    
    ---
     .../CrossSigningSettingsAction.kt             |  6 +--
     .../CrossSigningSettingsController.kt         | 46 +------------------
     .../CrossSigningSettingsFragment.kt           | 23 +---------
     .../CrossSigningSettingsViewEvents.kt         |  4 --
     .../CrossSigningSettingsViewModel.kt          | 26 +++--------
     .../CrossSigningSettingsViewState.kt          |  5 +-
     6 files changed, 11 insertions(+), 99 deletions(-)
    
    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 e70fd45251..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
    @@ -45,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))
    @@ -53,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
             }
         }
    @@ -90,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
    
    From ac32d6bb2905f82b508993c10933c00e08ca0615 Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 14:41:07 +0200
    Subject: [PATCH 173/235] Remove `/verify` command, it was added temporarily
    
    ---
     .../main/java/im/vector/app/features/command/Command.kt   | 4 +---
     .../java/im/vector/app/features/command/CommandParser.kt  | 5 -----
     .../java/im/vector/app/features/command/ParsedCommand.kt  | 1 -
     .../app/features/home/room/detail/RoomDetailViewModel.kt  | 8 --------
     vector/src/main/res/values-cs/strings.xml                 | 1 -
     vector/src/main/res/values-de/strings.xml                 | 1 -
     vector/src/main/res/values-eu/strings.xml                 | 1 -
     vector/src/main/res/values-fi/strings.xml                 | 1 -
     vector/src/main/res/values-fr/strings.xml                 | 1 -
     vector/src/main/res/values-hu/strings.xml                 | 1 -
     vector/src/main/res/values-it/strings.xml                 | 1 -
     vector/src/main/res/values-pl/strings.xml                 | 1 -
     vector/src/main/res/values-pt-rBR/strings.xml             | 1 -
     vector/src/main/res/values-ru/strings.xml                 | 1 -
     vector/src/main/res/values-sq/strings.xml                 | 1 -
     vector/src/main/res/values-zh-rCN/strings.xml             | 1 -
     vector/src/main/res/values-zh-rTW/strings.xml             | 1 -
     vector/src/main/res/values/strings.xml                    | 1 -
     18 files changed, 1 insertion(+), 31 deletions(-)
    
    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/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"
    
    From d74dc2053bff9a21bf18772c09397b1f9868f73e Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 16:48:40 +0200
    Subject: [PATCH 174/235] Increase Font size on Calling screen (#1643) And
     cleanup the layout
    
    ---
     CHANGES.md                                   |  1 +
     vector/src/main/res/layout/activity_call.xml | 38 ++++++++++++--------
     2 files changed, 25 insertions(+), 14 deletions(-)
    
    diff --git a/CHANGES.md b/CHANGES.md
    index a49507b516..8e8cee0d98 100644
    --- a/CHANGES.md
    +++ b/CHANGES.md
    @@ -9,6 +9,7 @@ Improvements 🙌:
      - Give user the possibility to prevent accidental call (#1869)
      - Display device information (name, id and key) in Cryptography setting screen (#1784)
      - Ensure users do not accidentally ignore other users (#1890)
    + - Increase Font size on Calling screen (#1643)
     
     Bugfix 🐛:
      - Fix invisible toolbar (Status.im theme) (#1746)
    diff --git a/vector/src/main/res/layout/activity_call.xml b/vector/src/main/res/layout/activity_call.xml
    index d9d476cb9e..8fbff3692e 100644
    --- a/vector/src/main/res/layout/activity_call.xml
    +++ b/vector/src/main/res/layout/activity_call.xml
    @@ -28,31 +28,38 @@
     
         
    +        app:layout_constraintEnd_toEndOf="parent"
    +        app:layout_constraintStart_toStartOf="parent"
    +        tools:text="@sample/matrix.json/data/displayName" />
     
         
    +        app:layout_constraintEnd_toEndOf="parent"
    +        app:layout_constraintStart_toStartOf="parent"
    +        tools:text="@string/action_video_call" />
     
         
    +        tools:text="@string/call_connecting" />
     
         
    +        app:constraint_referenced_ids="participantNameText,callTypeText,otherMemberAvatar,callStatusText" />
     
         
     
    -
         
    Date: Mon, 17 Aug 2020 18:02:23 +0200
    Subject: [PATCH 175/235] Fix color issue in dark and black themes (#961)
    
    ---
     vector/src/main/res/layout/item_generic_list.xml        | 1 -
     vector/src/main/res/layout/item_verification_action.xml | 1 +
     vector/src/main/res/values/colors_riotx.xml             | 6 +++---
     3 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/vector/src/main/res/layout/item_generic_list.xml b/vector/src/main/res/layout/item_generic_list.xml
    index dee6e06693..4b206c352d 100644
    --- a/vector/src/main/res/layout/item_generic_list.xml
    +++ b/vector/src/main/res/layout/item_generic_list.xml
    @@ -5,7 +5,6 @@
         android:id="@+id/item_generic_root"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
    -    android:background="?riotx_background"
         android:minHeight="50dp">
     
         
         #FFFFFFFF
         #FF282C35
    -    #FF000000
    +    #FF282C35
     
         
         #FFFFFFFF
    @@ -225,8 +225,8 @@
         #61708B
     
         
    -    #EEEFEF
    -    #FF61708B
    +    #E3E8F0
    +    #7F61708B
         #FF22262E
     
         
    
    From 189d2b2c06b29876d3ad013a8a74a966596321f0 Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 19:08:32 +0200
    Subject: [PATCH 176/235] Increase again font size
    
    ---
     vector/src/main/res/layout/activity_call.xml | 10 +++++-----
     1 file changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/vector/src/main/res/layout/activity_call.xml b/vector/src/main/res/layout/activity_call.xml
    index 8fbff3692e..b2af9f8a9d 100644
    --- a/vector/src/main/res/layout/activity_call.xml
    +++ b/vector/src/main/res/layout/activity_call.xml
    @@ -34,7 +34,7 @@
             android:layout_marginEnd="@dimen/layout_horizontal_margin"
             android:gravity="center"
             android:textColor="?riotx_text_primary"
    -        android:textSize="24sp"
    +        android:textSize="28sp"
             android:textStyle="bold"
             app:layout_constraintBottom_toTopOf="@id/callTypeText"
             app:layout_constraintEnd_toEndOf="parent"
    @@ -50,7 +50,7 @@
             android:layout_marginBottom="8dp"
             android:gravity="center"
             android:textColor="?riotx_text_secondary"
    -        android:textSize="14sp"
    +        android:textSize="22sp"
             app:layout_constraintBottom_toTopOf="@id/otherMemberAvatar"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
    @@ -58,8 +58,8 @@
     
         
    Date: Mon, 17 Aug 2020 19:27:13 +0200
    Subject: [PATCH 177/235] #1682: parse "default_server_config"
    
    ---
     .../auth/DefaultAuthenticationService.kt      |  7 +++--
     .../sdk/internal/auth/data/RiotConfig.kt      | 28 +++++++++++++++++--
     2 files changed, 29 insertions(+), 6 deletions(-)
    
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    index 1294855b6e..385fdcbf9b 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    @@ -176,10 +176,11 @@ internal class DefaultAuthenticationService @Inject constructor(
                 }
             }
                     .map { riotConfig ->
    -                    if (riotConfig.defaultHomeServerUrl?.isNotBlank() == true) {
    +                    val defaultHomeServerUrl = riotConfig.getPreferredHomeServerUrl()
    +                    if (defaultHomeServerUrl?.isNotEmpty() == true) {
                             // Ok, good sign, we got a default hs url
                             val newHomeServerConnectionConfig = homeServerConnectionConfig.copy(
    -                                homeServerUri = Uri.parse(riotConfig.defaultHomeServerUrl)
    +                                homeServerUri = Uri.parse(defaultHomeServerUrl)
                             )
     
                             val newAuthAPI = buildAuthAPI(newHomeServerConnectionConfig)
    @@ -188,7 +189,7 @@ internal class DefaultAuthenticationService @Inject constructor(
                                 apiCall = newAuthAPI.versions()
                             }
     
    -                        getLoginFlowResult(newAuthAPI, versions, riotConfig.defaultHomeServerUrl)
    +                        getLoginFlowResult(newAuthAPI, versions, defaultHomeServerUrl)
                         } else {
                             // Config exists, but there is no default homeserver url (ex: https://riot.im/app)
                             throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    index 42db315262..1c1c5c0c29 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    @@ -22,8 +22,30 @@ import com.squareup.moshi.JsonClass
     
     @JsonClass(generateAdapter = true)
     data class RiotConfig(
    -        // There are plenty of other elements in the file config.json of a RiotWeb client, but for the moment only one is interesting
    -        // Ex: "brand", "branding", etc.
    +        /**
    +         * This is now deprecated, but still used first, rather than value from "default_server_config"
    +         */
             @Json(name = "default_hs_url")
    -        val defaultHomeServerUrl: String?
    +        val defaultHomeServerUrl: String?,
    +
    +        @Json(name = "default_server_config")
    +        val defaultServerConfig: RiotConfigDefaultServerConfig?
    +) {
    +    fun getPreferredHomeServerUrl(): String? {
    +        return defaultHomeServerUrl
    +                ?.takeIf { it.isNotEmpty() }
    +                ?: defaultServerConfig?.homeServer?.baseURL
    +    }
    +}
    +
    +@JsonClass(generateAdapter = true)
    +data class RiotConfigDefaultServerConfig(
    +        @Json(name = "m.homeserver")
    +        val homeServer: RiotConfigBaseConfig? = null
    +)
    +
    +@JsonClass(generateAdapter = true)
    +data class RiotConfigBaseConfig(
    +        @Json(name = "base_url")
    +        val baseURL: String? = null
     )
    
    From 112f77c4e06af6da6ce925094c08855cdc6ac381 Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 19:39:29 +0200
    Subject: [PATCH 178/235] #1682: try to fetch config.domain.json
    
    ---
     .../android/sdk/internal/auth/AuthAPI.kt      |  5 ++
     .../auth/DefaultAuthenticationService.kt      | 82 +++++++++++++------
     2 files changed, 63 insertions(+), 24 deletions(-)
    
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt
    index 00eb7e8599..d0c02b6027 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt
    @@ -42,6 +42,11 @@ import retrofit2.http.Url
      * The login REST API.
      */
     internal interface AuthAPI {
    +    /**
    +     * Get a Riot config file, using the name including the domain
    +     */
    +    @GET("config.{domain}.json")
    +    fun getRiotConfigDomain(@Path("domain") domain: String): Call
     
         /**
          * Get a Riot config file
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    index 385fdcbf9b..02c48dab07 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt
    @@ -19,6 +19,9 @@ package org.matrix.android.sdk.internal.auth
     
     import android.net.Uri
     import dagger.Lazy
    +import kotlinx.coroutines.launch
    +import kotlinx.coroutines.withContext
    +import okhttp3.OkHttpClient
     import org.matrix.android.sdk.api.MatrixCallback
     import org.matrix.android.sdk.api.auth.AuthenticationService
     import org.matrix.android.sdk.api.auth.data.Credentials
    @@ -50,12 +53,8 @@ import org.matrix.android.sdk.internal.task.TaskExecutor
     import org.matrix.android.sdk.internal.task.configureWith
     import org.matrix.android.sdk.internal.task.launchToCallback
     import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
    -import org.matrix.android.sdk.internal.util.exhaustive
     import org.matrix.android.sdk.internal.util.toCancelable
     import org.matrix.android.sdk.internal.wellknown.GetWellknownTask
    -import kotlinx.coroutines.launch
    -import kotlinx.coroutines.withContext
    -import okhttp3.OkHttpClient
     import javax.inject.Inject
     import javax.net.ssl.HttpsURLConnection
     
    @@ -157,7 +156,7 @@ internal class DefaultAuthenticationService @Inject constructor(
                                     if (it is Failure.OtherServerError
                                             && it.httpCode == HttpsURLConnection.HTTP_NOT_FOUND /* 404 */) {
                                         // It's maybe a Riot url?
    -                                    getRiotLoginFlowInternal(homeServerConnectionConfig)
    +                                    getRiotDomainLoginFlowInternal(homeServerConnectionConfig)
                                     } else {
                                         throw it
                                     }
    @@ -166,6 +165,37 @@ internal class DefaultAuthenticationService @Inject constructor(
             }
         }
     
    +    private suspend fun getRiotDomainLoginFlowInternal(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult {
    +        val authAPI = buildAuthAPI(homeServerConnectionConfig)
    +
    +        val domain = homeServerConnectionConfig.homeServerUri.host
    +                ?: return getRiotLoginFlowInternal(homeServerConnectionConfig)
    +
    +        // Ok, try to get the config.domain.json file of a RiotWeb client
    +        return runCatching {
    +            executeRequest(null) {
    +                apiCall = authAPI.getRiotConfigDomain(domain)
    +            }
    +        }
    +                .map { riotConfig ->
    +                    onRiotConfigRetrieved(homeServerConnectionConfig, riotConfig)
    +                }
    +                .fold(
    +                        {
    +                            it
    +                        },
    +                        {
    +                            if (it is Failure.OtherServerError
    +                                    && it.httpCode == HttpsURLConnection.HTTP_NOT_FOUND /* 404 */) {
    +                                // Try with config.json
    +                                getRiotLoginFlowInternal(homeServerConnectionConfig)
    +                            } else {
    +                                throw it
    +                            }
    +                        }
    +                )
    +    }
    +
         private suspend fun getRiotLoginFlowInternal(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult {
             val authAPI = buildAuthAPI(homeServerConnectionConfig)
     
    @@ -176,24 +206,7 @@ internal class DefaultAuthenticationService @Inject constructor(
                 }
             }
                     .map { riotConfig ->
    -                    val defaultHomeServerUrl = riotConfig.getPreferredHomeServerUrl()
    -                    if (defaultHomeServerUrl?.isNotEmpty() == true) {
    -                        // Ok, good sign, we got a default hs url
    -                        val newHomeServerConnectionConfig = homeServerConnectionConfig.copy(
    -                                homeServerUri = Uri.parse(defaultHomeServerUrl)
    -                        )
    -
    -                        val newAuthAPI = buildAuthAPI(newHomeServerConnectionConfig)
    -
    -                        val versions = executeRequest(null) {
    -                            apiCall = newAuthAPI.versions()
    -                        }
    -
    -                        getLoginFlowResult(newAuthAPI, versions, defaultHomeServerUrl)
    -                    } else {
    -                        // Config exists, but there is no default homeserver url (ex: https://riot.im/app)
    -                        throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
    -                    }
    +                    onRiotConfigRetrieved(homeServerConnectionConfig, riotConfig)
                     }
                     .fold(
                             {
    @@ -211,6 +224,27 @@ internal class DefaultAuthenticationService @Inject constructor(
                     )
         }
     
    +    private suspend fun onRiotConfigRetrieved(homeServerConnectionConfig: HomeServerConnectionConfig, riotConfig: RiotConfig): LoginFlowResult {
    +        val defaultHomeServerUrl = riotConfig.getPreferredHomeServerUrl()
    +        if (defaultHomeServerUrl?.isNotEmpty() == true) {
    +            // Ok, good sign, we got a default hs url
    +            val newHomeServerConnectionConfig = homeServerConnectionConfig.copy(
    +                    homeServerUri = Uri.parse(defaultHomeServerUrl)
    +            )
    +
    +            val newAuthAPI = buildAuthAPI(newHomeServerConnectionConfig)
    +
    +            val versions = executeRequest(null) {
    +                apiCall = newAuthAPI.versions()
    +            }
    +
    +            return getLoginFlowResult(newAuthAPI, versions, defaultHomeServerUrl)
    +        } else {
    +            // Config exists, but there is no default homeserver url (ex: https://riot.im/app)
    +            throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
    +        }
    +    }
    +
         private suspend fun getWellknownLoginFlowInternal(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult {
             val domain = homeServerConnectionConfig.homeServerUri.host
                     ?: throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
    @@ -235,7 +269,7 @@ internal class DefaultAuthenticationService @Inject constructor(
                     getLoginFlowResult(newAuthAPI, versions, wellknownResult.homeServerUrl)
                 }
                 else                      -> throw Failure.OtherServerError("", HttpsURLConnection.HTTP_NOT_FOUND /* 404 */)
    -        }.exhaustive
    +        }
         }
     
         private suspend fun getLoginFlowResult(authAPI: AuthAPI, versions: Versions, homeServerUrl: String): LoginFlowResult {
    
    From f012e23fa90f72202fa2fc23f4592c76a423378f Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 19:42:21 +0200
    Subject: [PATCH 179/235] #1682: changelog
    
    ---
     CHANGES.md | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/CHANGES.md b/CHANGES.md
    index a49507b516..1f309875a6 100644
    --- a/CHANGES.md
    +++ b/CHANGES.md
    @@ -9,6 +9,7 @@ Improvements 🙌:
      - Give user the possibility to prevent accidental call (#1869)
      - Display device information (name, id and key) in Cryptography setting screen (#1784)
      - Ensure users do not accidentally ignore other users (#1890)
    + - Support new config.json format and config.domain.json files (#1682)
     
     Bugfix 🐛:
      - Fix invisible toolbar (Status.im theme) (#1746)
    
    From bde77784b9926c4ff27991de286992d794c5bdc7 Mon Sep 17 00:00:00 2001
    From: Benoit Marty 
    Date: Mon, 17 Aug 2020 19:46:44 +0200
    Subject: [PATCH 180/235] Add `internal`
    
    ---
     .../org/matrix/android/sdk/internal/auth/data/RiotConfig.kt | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    index 1c1c5c0c29..9fb8963812 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/RiotConfig.kt
    @@ -21,7 +21,7 @@ import com.squareup.moshi.Json
     import com.squareup.moshi.JsonClass
     
     @JsonClass(generateAdapter = true)
    -data class RiotConfig(
    +internal data class RiotConfig(
             /**
              * This is now deprecated, but still used first, rather than value from "default_server_config"
              */
    @@ -39,13 +39,13 @@ data class RiotConfig(
     }
     
     @JsonClass(generateAdapter = true)
    -data class RiotConfigDefaultServerConfig(
    +internal data class RiotConfigDefaultServerConfig(
             @Json(name = "m.homeserver")
             val homeServer: RiotConfigBaseConfig? = null
     )
     
     @JsonClass(generateAdapter = true)
    -data class RiotConfigBaseConfig(
    +internal data class RiotConfigBaseConfig(
             @Json(name = "base_url")
             val baseURL: String? = null
     )
    
    From 8c7956d935c5e3ebe2903485b2c24cd4a5a4cd2b Mon Sep 17 00:00:00 2001
    From: Tilo Spannagel 
    Date: Mon, 17 Aug 2020 18:02:01 +0200
    Subject: [PATCH 181/235] Remove old code that was used on devices with api
     level <21
    
    Signed-off-by: Tilo Spannagel 
    ---
     CHANGES.md                                    |   1 +
     .../sdk/internal/crypto/store/db/Helper.kt    |   4 +-
     .../securestorage/SecretStoringUtils.kt       | 125 ++----------------
     .../widgets/DefaultWidgetPostAPIMediator.kt   |   7 +-
     .../android/sdk/internal/util/CompatUtil.kt   |  27 ----
     .../vector/app/core/hardware/HardwareInfo.kt  |   5 -
     .../app/core/intent/ExternalIntentAnalyser.kt |   7 +-
     .../core/ui/views/BottomSheetActionButton.kt  |   9 +-
     .../core/utils/ExternalApplicationsUtil.kt    |   4 +-
     .../im/vector/app/core/utils/SystemUtils.kt   |  13 +-
     .../attachments/AttachmentTypeSelectorView.kt |  26 ++--
     .../app/features/call/VectorCallActivity.kt   |  15 ---
     .../call/WebRtcPeerConnectionManager.kt       |  24 +---
     .../configuration/VectorConfiguration.kt      |   4 +-
     .../features/login/AbstractLoginFragment.kt   |   5 +-
     .../app/features/login/LoginWebFragment.kt    |   9 --
     .../media/ImageMediaViewerActivity.kt         |   5 +-
     .../app/features/reactions/EmojiDrawView.kt   |   5 +-
     .../reactions/EmojiRecyclerAdapter.kt         |  24 +---
     .../app/features/settings/VectorLocale.kt     |  86 ++++--------
     ...ficationTroubleshootRecyclerViewAdapter.kt |   5 +-
     .../features/webview/VectorWebViewActivity.kt |   7 +-
     .../features/webview/VectorWebViewClient.kt   |   2 -
     .../RoomWidgetPermissionBottomSheet.kt        |  14 +-
     .../features/widgets/webview/WidgetWebView.kt |   7 +-
     vector/src/main/res/values-v17/styles.xml     |   6 -
     vector/src/main/res/values-v21/dimens.xml     |  10 --
     .../src/main/res/values-v21/styles_login.xml  |   5 -
     .../src/main/res/values-v21/theme_black.xml   |  18 ---
     .../src/main/res/values-v21/theme_common.xml  |  16 ---
     vector/src/main/res/values-v21/theme_dark.xml |  18 ---
     .../src/main/res/values-v21/theme_light.xml   |  20 ---
     .../src/main/res/values-v21/theme_status.xml  |  20 ---
     .../src/main/res/values-v23/theme_black.xml   |   2 +-
     vector/src/main/res/values-v23/theme_dark.xml |   2 +-
     .../src/main/res/values-v23/theme_light.xml   |   2 +-
     .../src/main/res/values-v23/theme_status.xml  |   2 +-
     vector/src/main/res/values/dimens.xml         |   6 +-
     .../res/{values-v21 => values}/styles.xml     |   1 -
     vector/src/main/res/values/styles_riot.xml    |   8 --
     vector/src/main/res/values/theme_black.xml    |   9 ++
     vector/src/main/res/values/theme_common.xml   |   7 +-
     vector/src/main/res/values/theme_dark.xml     |   9 ++
     vector/src/main/res/values/theme_light.xml    |  11 ++
     vector/src/main/res/values/theme_status.xml   |  12 ++
     45 files changed, 135 insertions(+), 489 deletions(-)
     delete mode 100644 vector/src/main/res/values-v17/styles.xml
     delete mode 100644 vector/src/main/res/values-v21/dimens.xml
     delete mode 100644 vector/src/main/res/values-v21/styles_login.xml
     delete mode 100644 vector/src/main/res/values-v21/theme_black.xml
     delete mode 100644 vector/src/main/res/values-v21/theme_common.xml
     delete mode 100644 vector/src/main/res/values-v21/theme_dark.xml
     delete mode 100644 vector/src/main/res/values-v21/theme_light.xml
     delete mode 100644 vector/src/main/res/values-v21/theme_status.xml
     rename vector/src/main/res/{values-v21 => values}/styles.xml (62%)
    
    diff --git a/CHANGES.md b/CHANGES.md
    index a49507b516..6c536503c6 100644
    --- a/CHANGES.md
    +++ b/CHANGES.md
    @@ -32,6 +32,7 @@ Other changes:
      - Rename package `im.vector.riotx.attachmentviewer` to `im.vector.lib.attachmentviewer`
      - Rename package `im.vector.riotx.multipicker` to `im.vector.lib.multipicker`
      - Rename package `im.vector.riotx` to `im.vector.app`
    + - Remove old code that was used on devices with api level <21
     
     Changes in Element 1.0.4 (2020-08-03)
     ===================================================
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/Helper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/Helper.kt
    index 98098686cc..978c82303e 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/Helper.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/Helper.kt
    @@ -18,7 +18,6 @@
     package org.matrix.android.sdk.internal.crypto.store.db
     
     import android.util.Base64
    -import org.matrix.android.sdk.internal.util.CompatUtil
     import io.realm.Realm
     import io.realm.RealmConfiguration
     import io.realm.RealmObject
    @@ -26,6 +25,7 @@ import java.io.ByteArrayInputStream
     import java.io.ByteArrayOutputStream
     import java.io.ObjectOutputStream
     import java.util.zip.GZIPInputStream
    +import java.util.zip.GZIPOutputStream
     
     /**
      * Get realm, invoke the action, close realm, and return the result of the action
    @@ -78,7 +78,7 @@ fun serializeForRealm(o: Any?): String? {
         }
     
         val baos = ByteArrayOutputStream()
    -    val gzis = CompatUtil.createGzipOutputStream(baos)
    +    val gzis = GZIPOutputStream(baos)
         val out = ObjectOutputStream(gzis)
         out.use {
             it.writeObject(o)
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/securestorage/SecretStoringUtils.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/securestorage/SecretStoringUtils.kt
    index 0d898e46ce..2ae115f325 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/securestorage/SecretStoringUtils.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/securestorage/SecretStoringUtils.kt
    @@ -44,10 +44,7 @@ import javax.crypto.CipherInputStream
     import javax.crypto.CipherOutputStream
     import javax.crypto.KeyGenerator
     import javax.crypto.SecretKey
    -import javax.crypto.SecretKeyFactory
     import javax.crypto.spec.GCMParameterSpec
    -import javax.crypto.spec.IvParameterSpec
    -import javax.crypto.spec.PBEKeySpec
     import javax.crypto.spec.SecretKeySpec
     import javax.inject.Inject
     import javax.security.auth.x500.X500Principal
    @@ -127,9 +124,8 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
         @Throws(Exception::class)
         fun securelyStoreString(secret: String, keyAlias: String): ByteArray? {
             return when {
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M      -> encryptStringM(secret, keyAlias)
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT -> encryptStringK(secret, keyAlias)
    -            else                                                -> encryptForOldDevicesNotGood(secret, keyAlias)
    +            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> encryptStringM(secret, keyAlias)
    +            else                                           -> encryptString(secret, keyAlias)
             }
         }
     
    @@ -139,25 +135,22 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
         @Throws(Exception::class)
         fun loadSecureSecret(encrypted: ByteArray, keyAlias: String): String? {
             return when {
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M      -> decryptStringM(encrypted, keyAlias)
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT -> decryptStringK(encrypted, keyAlias)
    -            else                                                -> decryptForOldDevicesNotGood(encrypted, keyAlias)
    +            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> decryptStringM(encrypted, keyAlias)
    +            else                                           -> decryptString(encrypted, keyAlias)
             }
         }
     
         fun securelyStoreObject(any: Any, keyAlias: String, output: OutputStream) {
             when {
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M      -> saveSecureObjectM(keyAlias, output, any)
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT -> saveSecureObjectK(keyAlias, output, any)
    -            else                                                -> saveSecureObjectOldNotGood(keyAlias, output, any)
    +            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> saveSecureObjectM(keyAlias, output, any)
    +            else                                           -> saveSecureObject(keyAlias, output, any)
             }
         }
     
         fun  loadSecureSecret(inputStream: InputStream, keyAlias: String): T? {
             return when {
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M      -> loadSecureObjectM(keyAlias, inputStream)
    -            Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT -> loadSecureObjectK(keyAlias, inputStream)
    -            else                                                -> loadSecureObjectOldNotGood(keyAlias, inputStream)
    +            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> loadSecureObjectM(keyAlias, inputStream)
    +            else                                           -> loadSecureObject(keyAlias, inputStream)
             }
         }
     
    @@ -188,7 +181,6 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             - Store the encrypted AES
          Generate a key pair for encryption
          */
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
         fun getOrGenerateKeyPairForAlias(alias: String): KeyStore.PrivateKeyEntry {
             val privateKeyEntry = (keyStore.getEntry(alias, null) as? KeyStore.PrivateKeyEntry)
     
    @@ -238,8 +230,7 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             return String(cipher.doFinal(encryptedText), Charsets.UTF_8)
         }
     
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
    -    private fun encryptStringK(text: String, keyAlias: String): ByteArray? {
    +    private fun encryptString(text: String, keyAlias: String): ByteArray? {
             // we generate a random symmetric key
             val key = ByteArray(16)
             secureRandom.nextBytes(key)
    @@ -256,47 +247,13 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             return format1Make(encryptedKey, iv, encryptedBytes)
         }
     
    -    private fun encryptForOldDevicesNotGood(text: String, keyAlias: String): ByteArray {
    -        val salt = ByteArray(8)
    -        secureRandom.nextBytes(salt)
    -        val factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256")
    -        val spec = PBEKeySpec(keyAlias.toCharArray(), salt, 10000, 128)
    -        val tmp = factory.generateSecret(spec)
    -        val sKey = SecretKeySpec(tmp.encoded, "AES")
    -
    -        val cipher = Cipher.getInstance(AES_MODE)
    -        cipher.init(Cipher.ENCRYPT_MODE, sKey)
    -        val iv = cipher.iv
    -        val encryptedBytes: ByteArray = cipher.doFinal(text.toByteArray(Charsets.UTF_8))
    -
    -        return format2Make(salt, iv, encryptedBytes)
    -    }
    -
    -    private fun decryptForOldDevicesNotGood(data: ByteArray, keyAlias: String): String? {
    -        val (salt, iv, encrypted) = format2Extract(ByteArrayInputStream(data))
    -        val factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256")
    -        val spec = PBEKeySpec(keyAlias.toCharArray(), salt, 10_000, 128)
    -        val tmp = factory.generateSecret(spec)
    -        val sKey = SecretKeySpec(tmp.encoded, "AES")
    -
    -        val cipher = Cipher.getInstance(AES_MODE)
    -//        cipher.init(Cipher.ENCRYPT_MODE, sKey)
    -//        val encryptedBytes: ByteArray = cipher.doFinal(text.toByteArray(Charsets.UTF_8))
    -
    -        val specIV = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) IvParameterSpec(iv) else GCMParameterSpec(128, iv)
    -        cipher.init(Cipher.DECRYPT_MODE, sKey, specIV)
    -
    -        return String(cipher.doFinal(encrypted), Charsets.UTF_8)
    -    }
    -
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
    -    private fun decryptStringK(data: ByteArray, keyAlias: String): String? {
    +    private fun decryptString(data: ByteArray, keyAlias: String): String? {
             val (encryptedKey, iv, encrypted) = format1Extract(ByteArrayInputStream(data))
     
             // we need to decrypt the key
             val sKeyBytes = rsaDecrypt(keyAlias, ByteArrayInputStream(encryptedKey))
             val cipher = Cipher.getInstance(AES_MODE)
    -        val spec = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) IvParameterSpec(iv) else GCMParameterSpec(128, iv)
    +        val spec = GCMParameterSpec(128, iv)
             cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec(sKeyBytes, "AES"), spec)
     
             return String(cipher.doFinal(encrypted), Charsets.UTF_8)
    @@ -323,8 +280,7 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             output.write(doFinal)
         }
     
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
    -    private fun saveSecureObjectK(keyAlias: String, output: OutputStream, writeObject: Any) {
    +    private fun saveSecureObject(keyAlias: String, output: OutputStream, writeObject: Any) {
             // we generate a random symmetric key
             val key = ByteArray(16)
             secureRandom.nextBytes(key)
    @@ -352,32 +308,6 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             output.write(bos1.toByteArray())
         }
     
    -    private fun saveSecureObjectOldNotGood(keyAlias: String, output: OutputStream, writeObject: Any) {
    -        val salt = ByteArray(8)
    -        secureRandom.nextBytes(salt)
    -        val factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256")
    -        val tmp = factory.generateSecret(PBEKeySpec(keyAlias.toCharArray(), salt, 10000, 128))
    -        val secretKey = SecretKeySpec(tmp.encoded, "AES")
    -
    -        val cipher = Cipher.getInstance(AES_MODE)
    -        cipher.init(Cipher.ENCRYPT_MODE, secretKey)
    -        val iv = cipher.iv
    -
    -        val bos1 = ByteArrayOutputStream()
    -        ObjectOutputStream(bos1).use {
    -            it.writeObject(writeObject)
    -        }
    -        // Have to do it like that if i encapsulate the output stream, the cipher could fail saying reuse IV
    -        val doFinal = cipher.doFinal(bos1.toByteArray())
    -
    -        output.write(FORMAT_2.toInt())
    -        output.write(salt.size)
    -        output.write(salt)
    -        output.write(iv.size)
    -        output.write(iv)
    -        output.write(doFinal)
    -    }
    -
     //    @RequiresApi(Build.VERSION_CODES.M)
     //    @Throws(IOException::class)
     //    fun saveSecureObjectM(keyAlias: String, file: File, writeObject: Any) {
    @@ -418,15 +348,14 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             }
         }
     
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
         @Throws(IOException::class)
    -    private fun  loadSecureObjectK(keyAlias: String, inputStream: InputStream): T? {
    +    private fun  loadSecureObject(keyAlias: String, inputStream: InputStream): T? {
             val (encryptedKey, iv, encrypted) = format1Extract(inputStream)
     
             // we need to decrypt the key
             val sKeyBytes = rsaDecrypt(keyAlias, ByteArrayInputStream(encryptedKey))
             val cipher = Cipher.getInstance(AES_MODE)
    -        val spec = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) IvParameterSpec(iv) else GCMParameterSpec(128, iv)
    +        val spec = GCMParameterSpec(128, iv)
             cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec(sKeyBytes, "AES"), spec)
     
             val encIS = ByteArrayInputStream(encrypted)
    @@ -440,31 +369,6 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             }
         }
     
    -    @Throws(Exception::class)
    -    private fun  loadSecureObjectOldNotGood(keyAlias: String, inputStream: InputStream): T? {
    -        val (salt, iv, encrypted) = format2Extract(inputStream)
    -
    -        val factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256")
    -        val tmp = factory.generateSecret(PBEKeySpec(keyAlias.toCharArray(), salt, 10000, 128))
    -        val sKey = SecretKeySpec(tmp.encoded, "AES")
    -        // we need to decrypt the key
    -
    -        val cipher = Cipher.getInstance(AES_MODE)
    -        val spec = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) IvParameterSpec(iv) else GCMParameterSpec(128, iv)
    -        cipher.init(Cipher.DECRYPT_MODE, sKey, spec)
    -
    -        val encIS = ByteArrayInputStream(encrypted)
    -
    -        CipherInputStream(encIS, cipher).use {
    -            ObjectInputStream(it).use { ois ->
    -                val readObject = ois.readObject()
    -                @Suppress("UNCHECKED_CAST")
    -                return readObject as? T
    -            }
    -        }
    -    }
    -
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
         @Throws(Exception::class)
         private fun rsaEncrypt(alias: String, secret: ByteArray): ByteArray {
             val privateKeyEntry = getOrGenerateKeyPairForAlias(alias)
    @@ -480,7 +384,6 @@ internal class SecretStoringUtils @Inject constructor(private val context: Conte
             return outputStream.toByteArray()
         }
     
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
         @Throws(Exception::class)
         private fun rsaDecrypt(alias: String, encrypted: InputStream): ByteArray {
             val privateKeyEntry = getOrGenerateKeyPairForAlias(alias)
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt
    index 0f8f2c1f94..395484433b 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt
    @@ -17,7 +17,6 @@
     
     package org.matrix.android.sdk.internal.session.widgets
     
    -import android.os.Build
     import android.webkit.JavascriptInterface
     import android.webkit.WebView
     import com.squareup.moshi.Moshi
    @@ -172,11 +171,7 @@ internal class DefaultWidgetPostAPIMediator @Inject constructor(private val mosh
                 val functionLine = "sendResponseFromRiotAndroid('" + eventData["_id"] + "' , " + jsString + ");"
                 Timber.v("BRIDGE sendResponse: $functionLine")
                 // call the javascript method
    -            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    -                webView?.loadUrl("javascript:$functionLine")
    -            } else {
    -                webView?.evaluateJavascript(functionLine, null)
    -            }
    +            webView?.evaluateJavascript(functionLine, null)
             } catch (e: Exception) {
                 Timber.e(e, "## sendResponse() failed ")
             }
    diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CompatUtil.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CompatUtil.kt
    index 0836d96af9..6583dc89ea 100644
    --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CompatUtil.kt
    +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CompatUtil.kt
    @@ -27,7 +27,6 @@ import android.security.KeyPairGeneratorSpec
     import android.security.keystore.KeyGenParameterSpec
     import android.security.keystore.KeyProperties
     import android.util.Base64
    -import androidx.annotation.RequiresApi
     import androidx.core.content.edit
     import timber.log.Timber
     import java.io.IOException
    @@ -48,7 +47,6 @@ import java.security.cert.CertificateException
     import java.security.spec.AlgorithmParameterSpec
     import java.security.spec.RSAKeyGenParameterSpec
     import java.util.Calendar
    -import java.util.zip.GZIPOutputStream
     import javax.crypto.Cipher
     import javax.crypto.CipherInputStream
     import javax.crypto.CipherOutputStream
    @@ -82,22 +80,6 @@ object CompatUtil {
          */
         private val prng: SecureRandom by lazy(LazyThreadSafetyMode.NONE) { SecureRandom() }
     
    -    /**
    -     * Create a GZIPOutputStream instance
    -     * Special treatment on KitKat device, force the syncFlush param to false
    -     * Before Kitkat, this param does not exist and after Kitkat it is set to false by default
    -     *
    -     * @param outputStream the output stream
    -     */
    -    @Throws(IOException::class)
    -    fun createGzipOutputStream(outputStream: OutputStream): GZIPOutputStream {
    -        return if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    -            GZIPOutputStream(outputStream, false)
    -        } else {
    -            GZIPOutputStream(outputStream)
    -        }
    -    }
    -
         /**
          * Returns the AES key used for local storage encryption/decryption with AES/GCM.
          * The key is created if it does not exist already in the keystore.
    @@ -107,7 +89,6 @@ object CompatUtil {
          *
          * @param context the context holding the application shared preferences
          */
    -    @RequiresApi(Build.VERSION_CODES.KITKAT)
         @Synchronized
         @Throws(KeyStoreException::class,
                 CertificateException::class,
    @@ -249,10 +230,6 @@ object CompatUtil {
                 KeyStoreException::class,
                 IllegalBlockSizeException::class)
         fun createCipherOutputStream(out: OutputStream, context: Context): OutputStream? {
    -        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    -            return out
    -        }
    -
             val keyAndVersion = getAesGcmLocalProtectionKey(context)
     
             val cipher = Cipher.getInstance(AES_GCM_CIPHER_TYPE)
    @@ -298,10 +275,6 @@ object CompatUtil {
                 InvalidAlgorithmParameterException::class,
                 IOException::class)
         fun createCipherInputStream(`in`: InputStream, context: Context): InputStream? {
    -        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    -            return `in`
    -        }
    -
             val iv_len = `in`.read()
             if (iv_len != AES_GCM_IV_LENGTH) {
                 Timber.e(TAG, "Invalid IV length $iv_len")
    diff --git a/vector/src/main/java/im/vector/app/core/hardware/HardwareInfo.kt b/vector/src/main/java/im/vector/app/core/hardware/HardwareInfo.kt
    index dac9102a93..a9aa7be267 100644
    --- a/vector/src/main/java/im/vector/app/core/hardware/HardwareInfo.kt
    +++ b/vector/src/main/java/im/vector/app/core/hardware/HardwareInfo.kt
    @@ -22,7 +22,6 @@ import android.content.Context
     import android.hardware.Camera
     import android.hardware.camera2.CameraCharacteristics
     import android.hardware.camera2.CameraManager
    -import android.os.Build
     import androidx.core.content.getSystemService
     import javax.inject.Inject
     
    @@ -33,10 +32,6 @@ class HardwareInfo @Inject constructor(
          * Tell if the device has a back (or external) camera
          */
         fun hasBackCamera(): Boolean {
    -        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    -            return Camera.getNumberOfCameras() > 0
    -        }
    -
             val manager = context.getSystemService() ?: return Camera.getNumberOfCameras() > 0
     
             return manager.cameraIdList.any {
    diff --git a/vector/src/main/java/im/vector/app/core/intent/ExternalIntentAnalyser.kt b/vector/src/main/java/im/vector/app/core/intent/ExternalIntentAnalyser.kt
    index 44bc842447..24e03b4f40 100644
    --- a/vector/src/main/java/im/vector/app/core/intent/ExternalIntentAnalyser.kt
    +++ b/vector/src/main/java/im/vector/app/core/intent/ExternalIntentAnalyser.kt
    @@ -20,7 +20,6 @@ import android.content.ClipData
     import android.content.ClipDescription
     import android.content.Intent
     import android.net.Uri
    -import android.os.Build
     import androidx.core.util.PatternsCompat.WEB_URL
     
     /**
    @@ -87,13 +86,9 @@ fun analyseIntent(intent: Intent): List {
             }
         }
     
    -    var clipData: ClipData? = null
    +    val clipData: ClipData? = intent.clipData
         var mimeTypes: List? = null
     
    -    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    -        clipData = intent.clipData
    -    }
    -
         // multiple data
         if (null != clipData) {
             if (null != clipData.description) {
    diff --git a/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt b/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt
    index 193f57f96b..0259898ee3 100644
    --- a/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt
    +++ b/vector/src/main/java/im/vector/app/core/ui/views/BottomSheetActionButton.kt
    @@ -19,7 +19,6 @@ package im.vector.app.core.ui.views
     import android.content.Context
     import android.content.res.ColorStateList
     import android.graphics.drawable.Drawable
    -import android.os.Build
     import android.util.AttributeSet
     import android.view.View
     import android.widget.FrameLayout
    @@ -105,13 +104,7 @@ class BottomSheetActionButton @JvmOverloads constructor(
         var tint: Int? = null
             set(value) {
                 field = value
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                leftIconImageView.imageTintList = value?.let { ColorStateList.valueOf(value) }
    -            } else {
    -                leftIcon?.let {
    -                    leftIcon = ThemeUtils.tintDrawable(context, it, value ?: ThemeUtils.getColor(context, android.R.attr.textColor))
    -                }
    -            }
    +            leftIconImageView.imageTintList = value?.let { ColorStateList.valueOf(value) }
             }
     
         init {
    diff --git a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt
    index bb4fe38390..5ea3d54e6d 100644
    --- a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt
    +++ b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt
    @@ -134,9 +134,7 @@ fun openFileSelection(activity: Activity,
                           allowMultipleSelection: Boolean,
                           requestCode: Int) {
         val fileIntent = Intent(Intent.ACTION_GET_CONTENT)
    -    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    -        fileIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultipleSelection)
    -    }
    +    fileIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultipleSelection)
     
         fileIntent.addCategory(Intent.CATEGORY_OPENABLE)
         fileIntent.type = "*/*"
    diff --git a/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt b/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt
    index 1f2263889c..0e722da34a 100644
    --- a/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt
    +++ b/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt
    @@ -101,15 +101,10 @@ fun startNotificationSettingsIntent(activity: AppCompatActivity, requestCode: In
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
             intent.putExtra(Settings.EXTRA_APP_PACKAGE, activity.packageName)
    -    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +    } else {
             intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
             intent.putExtra("app_package", activity.packageName)
             intent.putExtra("app_uid", activity.applicationInfo?.uid)
    -    } else {
    -        intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
    -        intent.addCategory(Intent.CATEGORY_DEFAULT)
    -        val uri = Uri.fromParts("package", activity.packageName, null)
    -        intent.data = uri
         }
         activity.startActivityForResult(intent, requestCode)
     }
    @@ -140,11 +135,7 @@ fun startAddGoogleAccountIntent(context: AppCompatActivity, requestCode: Int) {
     fun startSharePlainTextIntent(fragment: Fragment, chooserTitle: String?, text: String, subject: String? = null, requestCode: Int? = null) {
         val share = Intent(Intent.ACTION_SEND)
         share.type = "text/plain"
    -    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -        share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
    -    } else {
    -        share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
    -    }
    +    share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
         // Add data to the intent, the receiving app will decide what to do with it.
         share.putExtra(Intent.EXTRA_SUBJECT, subject)
         share.putExtra(Intent.EXTRA_TEXT, text)
    diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt
    index fa35ac3fd8..1d6ea7339d 100644
    --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt
    +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt
    @@ -18,10 +18,8 @@ package im.vector.app.features.attachments
     
     import android.animation.Animator
     import android.animation.AnimatorListenerAdapter
    -import android.annotation.TargetApi
     import android.content.Context
     import android.graphics.drawable.BitmapDrawable
    -import android.os.Build
     import android.util.Pair
     import android.view.Gravity
     import android.view.LayoutInflater
    @@ -109,25 +107,19 @@ class AttachmentTypeSelectorView(context: Context,
                 showAtLocation(anchor, Gravity.NO_GRAVITY, 0, anchorCoordinates[1] - contentViewHeight)
             }
             contentView.doOnNextLayout {
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                animateWindowInCircular(anchor, contentView)
    -            } else {
    -                animateWindowInTranslate(contentView)
    -            }
    -        }
    -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -            animateButtonIn(galleryButton, ANIMATION_DURATION / 2)
    -            animateButtonIn(cameraButton, ANIMATION_DURATION / 2)
    -            animateButtonIn(fileButton, ANIMATION_DURATION / 4)
    -            animateButtonIn(audioButton, ANIMATION_DURATION / 2)
    -            animateButtonIn(contactButton, ANIMATION_DURATION / 4)
    -            animateButtonIn(stickersButton, 0)
    +            animateWindowInCircular(anchor, contentView)
             }
    +        animateButtonIn(galleryButton, ANIMATION_DURATION / 2)
    +        animateButtonIn(cameraButton, ANIMATION_DURATION / 2)
    +        animateButtonIn(fileButton, ANIMATION_DURATION / 4)
    +        animateButtonIn(audioButton, ANIMATION_DURATION / 2)
    +        animateButtonIn(contactButton, ANIMATION_DURATION / 4)
    +        animateButtonIn(stickersButton, 0)
         }
     
         override fun dismiss() {
             val capturedAnchor = anchor
    -        if (capturedAnchor != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +        if (capturedAnchor != null) {
                 animateWindowOutCircular(capturedAnchor, contentView)
             } else {
                 animateWindowOutTranslate(contentView)
    @@ -144,7 +136,6 @@ class AttachmentTypeSelectorView(context: Context,
             button.startAnimation(animation)
         }
     
    -    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
         private fun animateWindowInCircular(anchor: View, contentView: View) {
             val coordinates = getClickCoordinates(anchor, contentView)
             val animator = ViewAnimationUtils.createCircularReveal(contentView,
    @@ -162,7 +153,6 @@ class AttachmentTypeSelectorView(context: Context,
             getContentView().startAnimation(animation)
         }
     
    -    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
         private fun animateWindowOutCircular(anchor: View, contentView: View) {
             val coordinates = getClickCoordinates(anchor, contentView)
             val animator = ViewAnimationUtils.createCircularReveal(getContentView(),
    diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt
    index ba171b9937..4d6c4e3add 100644
    --- a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt
    +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt
    @@ -23,7 +23,6 @@ import android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP
     import android.os.Build
     import android.os.Bundle
     import android.os.Parcelable
    -import android.view.KeyEvent
     import android.view.View
     import android.view.Window
     import android.view.WindowManager
    @@ -334,20 +333,6 @@ class VectorCallActivity : VectorBaseActivity(), CallControlsView.InteractionLis
             surfaceRenderersAreInitialized = true
         }
     
    -    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
    -        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    -            // for newer version, it will be passed automatically to active media session
    -            // in call service
    -            when (keyCode) {
    -                KeyEvent.KEYCODE_HEADSETHOOK -> {
    -                    callViewModel.handle(VectorCallViewActions.HeadSetButtonPressed)
    -                    return true
    -                }
    -            }
    -        }
    -        return super.onKeyDown(keyCode, event)
    -    }
    -
         private fun handleViewEvents(event: VectorCallViewEvents?) {
             Timber.v("## VOIP handleViewEvents $event")
             when (event) {
    diff --git a/vector/src/main/java/im/vector/app/features/call/WebRtcPeerConnectionManager.kt b/vector/src/main/java/im/vector/app/features/call/WebRtcPeerConnectionManager.kt
    index cfebafb04e..bb6312a8ce 100644
    --- a/vector/src/main/java/im/vector/app/features/call/WebRtcPeerConnectionManager.kt
    +++ b/vector/src/main/java/im/vector/app/features/call/WebRtcPeerConnectionManager.kt
    @@ -18,8 +18,6 @@ package im.vector.app.features.call
     
     import android.content.Context
     import android.hardware.camera2.CameraManager
    -import android.os.Build
    -import androidx.annotation.RequiresApi
     import androidx.core.content.getSystemService
     import im.vector.app.ActiveSessionDataSource
     import im.vector.app.core.services.BluetoothHeadsetReceiver
    @@ -363,11 +361,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
                         }
                     }
                     else                                -> {
    -                    // Fallback for old android, try to restart capture when attached
    -                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && capturerIsInError && call.mxCall.isVideoCall) {
    -                        // try to restart capture?
    -                        videoCapturer?.startCapture(currentCaptureMode.width, currentCaptureMode.height, currentCaptureMode.fps)
    -                    }
                         // sink existing tracks (configuration change, e.g screen rotation)
                         attachViewRenderersInternal()
                     }
    @@ -478,12 +471,10 @@ class WebRtcPeerConnectionManager @Inject constructor(
                             // We then register in order to restart capture as soon as the camera is available again
                             Timber.v("## VOIP onCameraClosed")
                             this@WebRtcPeerConnectionManager.capturerIsInError = true
    -                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                            val restarter = CameraRestarter(cameraInUse?.name ?: "", callContext.mxCall.callId)
    -                            callContext.cameraAvailabilityCallback = restarter
    -                            val cameraManager = context.getSystemService()!!
    -                            cameraManager.registerAvailabilityCallback(restarter, null)
    -                        }
    +                        val restarter = CameraRestarter(cameraInUse?.name ?: "", callContext.mxCall.callId)
    +                        callContext.cameraAvailabilityCallback = restarter
    +                        val cameraManager = context.getSystemService()!!
    +                        cameraManager.registerAvailabilityCallback(restarter, null)
                         }
                     })
     
    @@ -792,10 +783,8 @@ class WebRtcPeerConnectionManager @Inject constructor(
             currentCall?.localVideoTrack?.setEnabled(false)
     
             currentCall?.cameraAvailabilityCallback?.let { cameraAvailabilityCallback ->
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                val cameraManager = context.getSystemService()!!
    -                cameraManager.unregisterAvailabilityCallback(cameraAvailabilityCallback)
    -            }
    +            val cameraManager = context.getSystemService()!!
    +            cameraManager.unregisterAvailabilityCallback(cameraAvailabilityCallback)
             }
     
             if (originatedByMe) {
    @@ -1041,7 +1030,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
             }
         }
     
    -    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
         inner class CameraRestarter(val cameraId: String, val callId: String) : CameraManager.AvailabilityCallback() {
     
             override fun onCameraAvailable(cameraId: String) {
    diff --git a/vector/src/main/java/im/vector/app/features/configuration/VectorConfiguration.kt b/vector/src/main/java/im/vector/app/features/configuration/VectorConfiguration.kt
    index 312e0a01ea..5567a138de 100644
    --- a/vector/src/main/java/im/vector/app/features/configuration/VectorConfiguration.kt
    +++ b/vector/src/main/java/im/vector/app/features/configuration/VectorConfiguration.kt
    @@ -82,9 +82,7 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
                 } else {
                     @Suppress("DEPRECATION")
                     configuration.locale = locale
    -                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    -                    configuration.setLayoutDirection(locale)
    -                }
    +                configuration.setLayoutDirection(locale)
                     @Suppress("DEPRECATION")
                     resources.updateConfiguration(configuration, resources.displayMetrics)
                     return context
    diff --git a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt
    index 978850d788..c6658925af 100644
    --- a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt
    +++ b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt
    @@ -16,7 +16,6 @@
     
     package im.vector.app.features.login
     
    -import android.os.Build
     import android.os.Bundle
     import android.view.View
     import androidx.annotation.CallSuper
    @@ -48,9 +47,7 @@ abstract class AbstractLoginFragment : VectorBaseFragment(), OnBackPressed {
         override fun onCreate(savedInstanceState: Bundle?) {
             super.onCreate(savedInstanceState)
     
    -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -            sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
    -        }
    +        sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
         }
     
         @CallSuper
    diff --git a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt
    index a2659316eb..6d943fd99f 100644
    --- a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt
    +++ b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt
    @@ -22,7 +22,6 @@ import android.annotation.SuppressLint
     import android.content.DialogInterface
     import android.graphics.Bitmap
     import android.net.http.SslError
    -import android.os.Build
     import android.os.Bundle
     import android.view.KeyEvent
     import android.view.View
    @@ -102,14 +101,6 @@ class LoginWebFragment @Inject constructor(
                 launchWebView(state)
             } else {
                 if (!cookieManager.hasCookies()) {
    -                launchWebView(state)
    -            } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    -                try {
    -                    cookieManager.removeAllCookie()
    -                } catch (e: Exception) {
    -                    Timber.e(e, " cookieManager.removeAllCookie() fails")
    -                }
    -
                     launchWebView(state)
                 } else {
                     try {
    diff --git a/vector/src/main/java/im/vector/app/features/media/ImageMediaViewerActivity.kt b/vector/src/main/java/im/vector/app/features/media/ImageMediaViewerActivity.kt
    index 4482990d93..fa7f397b8f 100644
    --- a/vector/src/main/java/im/vector/app/features/media/ImageMediaViewerActivity.kt
    +++ b/vector/src/main/java/im/vector/app/features/media/ImageMediaViewerActivity.kt
    @@ -19,12 +19,10 @@ package im.vector.app.features.media
     import android.content.Context
     import android.content.Intent
     import android.graphics.drawable.Drawable
    -import android.os.Build
     import android.os.Bundle
     import android.view.MenuItem
     import android.view.View
     import android.view.ViewTreeObserver
    -import androidx.annotation.RequiresApi
     import androidx.appcompat.widget.Toolbar
     import androidx.core.net.toUri
     import androidx.core.transition.addListener
    @@ -84,7 +82,7 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
     
             configureToolbar(imageMediaViewerToolbar, mediaData)
     
    -        if (isFirstCreation() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && addTransitionListener()) {
    +        if (isFirstCreation() && addTransitionListener()) {
                 // Encrypted image
                 imageTransitionView.isVisible = true
                 imageMediaViewerImageView.isVisible = false
    @@ -183,7 +181,6 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
          *
          * @return true if we were successful in adding a listener to the enter transition
          */
    -    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
         private fun addTransitionListener(): Boolean {
             val transition = window.sharedElementEnterTransition
     
    diff --git a/vector/src/main/java/im/vector/app/features/reactions/EmojiDrawView.kt b/vector/src/main/java/im/vector/app/features/reactions/EmojiDrawView.kt
    index 1866ac4bba..fec185b1c3 100644
    --- a/vector/src/main/java/im/vector/app/features/reactions/EmojiDrawView.kt
    +++ b/vector/src/main/java/im/vector/app/features/reactions/EmojiDrawView.kt
    @@ -20,6 +20,7 @@ import android.content.Context
     import android.graphics.Canvas
     import android.graphics.Color
     import android.graphics.Typeface
    +import android.os.Trace
     import android.text.StaticLayout
     import android.text.TextPaint
     import android.util.AttributeSet
    @@ -43,7 +44,7 @@ class EmojiDrawView @JvmOverloads constructor(
         var emoji: String? = null
     
         override fun onDraw(canvas: Canvas?) {
    -        EmojiRecyclerAdapter.beginTraceSession("EmojiDrawView.onDraw")
    +        Trace.beginSection("EmojiDrawView.onDraw")
             super.onDraw(canvas)
             canvas?.save()
             val space = abs((width - emojiSize) / 2f)
    @@ -52,7 +53,7 @@ class EmojiDrawView @JvmOverloads constructor(
                 mLayout!!.draw(canvas)
             }
             canvas?.restore()
    -        EmojiRecyclerAdapter.endTraceSession()
    +        Trace.endSection()
         }
     
         companion object {
    diff --git a/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt b/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt
    index fcf1ab9b9c..92bc21be25 100644
    --- a/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt
    +++ b/vector/src/main/java/im/vector/app/features/reactions/EmojiRecyclerAdapter.kt
    @@ -125,7 +125,7 @@ class EmojiRecyclerAdapter @Inject constructor(
         }
     
         override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
    -        beginTraceSession("MyAdapter.onCreateViewHolder")
    +        Trace.beginSection("MyAdapter.onCreateViewHolder")
             val inflater = LayoutInflater.from(parent.context)
             val itemView = inflater.inflate(viewType, parent, false)
             itemView.setOnClickListener(itemClickListener)
    @@ -133,16 +133,16 @@ class EmojiRecyclerAdapter @Inject constructor(
                 R.layout.grid_section_header -> SectionViewHolder(itemView)
                 else                         -> EmojiViewHolder(itemView)
             }
    -        endTraceSession()
    +        Trace.endSection()
             return viewHolder
         }
     
         override fun getItemViewType(position: Int): Int {
    -        beginTraceSession("MyAdapter.getItemViewType")
    +        Trace.beginSection("MyAdapter.getItemViewType")
             if (isSection(position)) {
                 return R.layout.grid_section_header
             }
    -        endTraceSession()
    +        Trace.endSection()
             return R.layout.grid_item_emoji
         }
     
    @@ -183,7 +183,7 @@ class EmojiRecyclerAdapter @Inject constructor(
         }
     
         override fun onBindViewHolder(holder: ViewHolder, position: Int) {
    -        beginTraceSession("MyAdapter.onBindViewHolder")
    +        Trace.beginSection("MyAdapter.onBindViewHolder")
             val sectionNumber = getSectionForAbsoluteIndex(position)
             if (isSection(position)) {
                 holder.bind(dataSource.rawData.categories[sectionNumber].name)
    @@ -202,7 +202,7 @@ class EmojiRecyclerAdapter @Inject constructor(
                     holder.bind(null)
                 }
             }
    -        endTraceSession()
    +        Trace.endSection()
         }
     
         override fun onViewRecycled(holder: ViewHolder) {
    @@ -259,18 +259,6 @@ class EmojiRecyclerAdapter @Inject constructor(
         }
     
         companion object {
    -        fun endTraceSession() {
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    -                Trace.endSection()
    -            }
    -        }
    -
    -        fun beginTraceSession(sectionName: String) {
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    -                Trace.beginSection(sectionName)
    -            }
    -        }
    -
             private val staticLayoutCache = HashMap()
     
             private fun getStaticLayoutForEmoji(emoji: String): StaticLayout {
    diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt b/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt
    index 57f80264d2..d2f92e300e 100644
    --- a/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt
    +++ b/vector/src/main/java/im/vector/app/features/settings/VectorLocale.kt
    @@ -18,7 +18,6 @@ package im.vector.app.features.settings
     
     import android.content.Context
     import android.content.res.Configuration
    -import android.os.Build
     import androidx.core.content.edit
     import androidx.preference.PreferenceManager
     import im.vector.app.BuildConfig
    @@ -108,13 +107,11 @@ object VectorLocale {
                     putString(APPLICATION_LOCALE_VARIANT_KEY, variant)
                 }
     
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                val script = locale.script
    -                if (script.isEmpty()) {
    -                    remove(APPLICATION_LOCALE_SCRIPT_KEY)
    -                } else {
    -                    putString(APPLICATION_LOCALE_SCRIPT_KEY, script)
    -                }
    +            val script = locale.script
    +            if (script.isEmpty()) {
    +                remove(APPLICATION_LOCALE_SCRIPT_KEY)
    +            } else {
    +                putString(APPLICATION_LOCALE_SCRIPT_KEY, script)
                 }
             }
         }
    @@ -128,40 +125,15 @@ object VectorLocale {
          * @return the localized string
          */
         private fun getString(context: Context, locale: Locale, resourceId: Int): String {
    -        val result: String
    -
    -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    -            val config = Configuration(context.resources.configuration)
    -            config.setLocale(locale)
    -            result = try {
    -                context.createConfigurationContext(config).getText(resourceId).toString()
    -            } catch (e: Exception) {
    -                Timber.e(e, "## getString() failed")
    -                // use the default one
    -                context.getString(resourceId)
    -            }
    -        } else {
    -            val resources = context.resources
    -            val conf = resources.configuration
    -
    -            @Suppress("DEPRECATION")
    -            val savedLocale = conf.locale
    -            @Suppress("DEPRECATION")
    -            conf.locale = locale
    -            @Suppress("DEPRECATION")
    -            resources.updateConfiguration(conf, null)
    -
    -            // retrieve resources from desired locale
    -            result = resources.getString(resourceId)
    -
    -            // restore original locale
    -            @Suppress("DEPRECATION")
    -            conf.locale = savedLocale
    -            @Suppress("DEPRECATION")
    -            resources.updateConfiguration(conf, null)
    +        val config = Configuration(context.resources.configuration)
    +        config.setLocale(locale)
    +        return try {
    +            context.createConfigurationContext(config).getText(resourceId).toString()
    +        } catch (e: Exception) {
    +            Timber.e(e, "## getString() failed")
    +            // use the default one
    +            context.getString(resourceId)
             }
    -
    -        return result
         }
     
         /**
    @@ -194,22 +166,18 @@ object VectorLocale {
             }
     
             val list = knownLocalesSet.mapNotNull { (language, country, script) ->
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                try {
    -                    Locale.Builder()
    -                            .setLanguage(language)
    -                            .setRegion(country)
    -                            .setScript(script)
    -                            .build()
    -                } catch (exception: IllformedLocaleException) {
    -                    if (BuildConfig.DEBUG) {
    -                        throw exception
    -                    }
    -                    // Ignore this locale in production
    -                    null
    +            try {
    +                Locale.Builder()
    +                        .setLanguage(language)
    +                        .setRegion(country)
    +                        .setScript(script)
    +                        .build()
    +            } catch (exception: IllformedLocaleException) {
    +                if (BuildConfig.DEBUG) {
    +                    throw exception
                     }
    -            } else {
    -                Locale(language, country)
    +                // Ignore this locale in production
    +                null
                 }
             }
                     // sort by human display names
    @@ -229,9 +197,7 @@ object VectorLocale {
             return buildString {
                 append(locale.getDisplayLanguage(locale))
     
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
    -                    && locale.script != ISO_15924_LATN
    -                    && locale.getDisplayScript(locale).isNotEmpty()) {
    +            if (locale.script != ISO_15924_LATN && locale.getDisplayScript(locale).isNotEmpty()) {
                     append(" - ")
                     append(locale.getDisplayScript(locale))
                 }
    @@ -254,7 +220,7 @@ object VectorLocale {
             return buildString {
                 append("[")
                 append(locale.displayLanguage)
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && locale.script != ISO_15924_LATN) {
    +            if (locale.script != ISO_15924_LATN) {
                     append(" - ")
                     append(locale.displayScript)
                 }
    diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt
    index b1f9b412f5..1ccd7b6735 100644
    --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt
    +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt
    @@ -15,7 +15,6 @@
      */
     package im.vector.app.features.settings.troubleshoot
     
    -import android.os.Build
     import android.view.LayoutInflater
     import android.view.View
     import android.view.ViewGroup
    @@ -87,9 +86,7 @@ class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList= Build.VERSION_CODES.LOLLIPOP) {
    -                        statusIconImage.imageTintList = null
    -                    }
    +                    statusIconImage.imageTintList = null
     
                         descriptionText.setTextColor(ContextCompat.getColor(context, R.color.riotx_notice))
                     }
    diff --git a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt
    index f90f2b8821..e49109b1d6 100644
    --- a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt
    +++ b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt
    @@ -18,7 +18,6 @@ package im.vector.app.features.webview
     
     import android.content.Context
     import android.content.Intent
    -import android.os.Build
     import android.webkit.WebChromeClient
     import android.webkit.WebView
     import androidx.annotation.CallSuper
    @@ -70,10 +69,8 @@ class VectorWebViewActivity : VectorBaseActivity() {
                 displayZoomControls = false
             }
     
    -        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -            val cookieManager = android.webkit.CookieManager.getInstance()
    -            cookieManager.setAcceptThirdPartyCookies(simple_webview, true)
    -        }
    +        val cookieManager = android.webkit.CookieManager.getInstance()
    +        cookieManager.setAcceptThirdPartyCookies(simple_webview, true)
     
             val url = intent.extras?.getString(EXTRA_URL)
             val title = intent.extras?.getString(EXTRA_TITLE, USE_TITLE_FROM_WEB_PAGE)
    diff --git a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewClient.kt b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewClient.kt
    index 47036d6fce..597486491c 100644
    --- a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewClient.kt
    +++ b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewClient.kt
    @@ -26,7 +26,6 @@ import android.webkit.WebResourceRequest
     import android.webkit.WebResourceResponse
     import android.webkit.WebView
     import android.webkit.WebViewClient
    -import androidx.annotation.RequiresApi
     
     /**
      * This class inherits from WebViewClient. It has to be used with a WebView.
    @@ -58,7 +57,6 @@ class VectorWebViewClient(private val eventListener: WebViewEventListener) : Web
             }
         }
     
    -    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
         override fun onReceivedHttpError(view: WebView, request: WebResourceRequest, errorResponse: WebResourceResponse) {
             super.onReceivedHttpError(view, request, errorResponse)
             eventListener.onHttpError(request.url.toString(),
    diff --git a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt
    index 63e54ab074..2c0aff3289 100644
    --- a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt
    +++ b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionBottomSheet.kt
    @@ -16,7 +16,6 @@
     package im.vector.app.features.widgets.permissions
     
     import android.content.DialogInterface
    -import android.os.Build
     import android.text.Spannable
     import android.text.SpannableStringBuilder
     import android.text.style.BulletSpan
    @@ -71,18 +70,7 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() {
             permissionData.permissionsList.forEach {
                 infoBuilder.append("\n")
                 val bulletPoint = getString(it)
    -            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -                infoBuilder.append(bulletPoint, BulletSpan(resources.getDimension(R.dimen.quote_gap).toInt()), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
    -            } else {
    -                val start = infoBuilder.length
    -                infoBuilder.append(bulletPoint)
    -                infoBuilder.setSpan(
    -                        BulletSpan(resources.getDimension(R.dimen.quote_gap).toInt()),
    -                        start,
    -                        bulletPoint.length,
    -                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
    -                )
    -            }
    +            infoBuilder.append(bulletPoint, BulletSpan(resources.getDimension(R.dimen.quote_gap).toInt()), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
             }
             infoBuilder.append("\n")
             widgetPermissionSharedInfo.text = infoBuilder
    diff --git a/vector/src/main/java/im/vector/app/features/widgets/webview/WidgetWebView.kt b/vector/src/main/java/im/vector/app/features/widgets/webview/WidgetWebView.kt
    index 7042e14599..446bc1663f 100644
    --- a/vector/src/main/java/im/vector/app/features/widgets/webview/WidgetWebView.kt
    +++ b/vector/src/main/java/im/vector/app/features/widgets/webview/WidgetWebView.kt
    @@ -17,7 +17,6 @@
     package im.vector.app.features.widgets.webview
     
     import android.annotation.SuppressLint
    -import android.os.Build
     import android.view.ViewGroup
     import android.webkit.CookieManager
     import android.webkit.PermissionRequest
    @@ -68,10 +67,8 @@ fun WebView.setupForWidget(webViewEventListener: WebViewEventListener) {
         }
         webViewClient = VectorWebViewClient(webViewEventListener)
     
    -    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    -        val cookieManager = CookieManager.getInstance()
    -        cookieManager.setAcceptThirdPartyCookies(this, false)
    -    }
    +    val cookieManager = CookieManager.getInstance()
    +    cookieManager.setAcceptThirdPartyCookies(this, false)
     }
     
     fun WebView.clearAfterWidget() {
    diff --git a/vector/src/main/res/values-v17/styles.xml b/vector/src/main/res/values-v17/styles.xml
    deleted file mode 100644
    index e80438a187..0000000000
    --- a/vector/src/main/res/values-v17/styles.xml
    +++ /dev/null
    @@ -1,6 +0,0 @@
    -
    -
    -
    -    
    -
    -
    \ No newline at end of file
    diff --git a/vector/src/main/res/values-v21/dimens.xml b/vector/src/main/res/values-v21/dimens.xml
    deleted file mode 100644
    index 23d45d46f2..0000000000
    --- a/vector/src/main/res/values-v21/dimens.xml
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -
    -
    -
    -    16dp
    -
    -    
    -    196dp
    -    44dp
    -
    -
    diff --git a/vector/src/main/res/values-v21/styles_login.xml b/vector/src/main/res/values-v21/styles_login.xml
    deleted file mode 100644
    index 78554f9ebb..0000000000
    --- a/vector/src/main/res/values-v21/styles_login.xml
    +++ /dev/null
    @@ -1,5 +0,0 @@
    -
    -
    -
    -
    -
    \ No newline at end of file
    diff --git a/vector/src/main/res/values-v21/theme_black.xml b/vector/src/main/res/values-v21/theme_black.xml
    deleted file mode 100644
    index 6c6d78879e..0000000000
    --- a/vector/src/main/res/values-v21/theme_black.xml
    +++ /dev/null
    @@ -1,18 +0,0 @@
    -
    -
    -
    -    
    -
    -    
    -
    -    
    -
    -
    \ No newline at end of file
    diff --git a/vector/src/main/res/values-v21/theme_dark.xml b/vector/src/main/res/values-v21/theme_dark.xml
    deleted file mode 100644
    index 285a3a2d25..0000000000
    --- a/vector/src/main/res/values-v21/theme_dark.xml
    +++ /dev/null
    @@ -1,18 +0,0 @@
    -
    -
    -
    -    
    -
    -    
    -
    -    
    -
    -    
     
    diff --git a/vector/src/main/res/values-v23/theme_dark.xml b/vector/src/main/res/values-v23/theme_dark.xml
    index f208f6dd61..c9fb7dab28 100644
    --- a/vector/src/main/res/values-v23/theme_dark.xml
    +++ b/vector/src/main/res/values-v23/theme_dark.xml
    @@ -1,7 +1,7 @@
     
     
     
    -    
     
    diff --git a/vector/src/main/res/values-v23/theme_light.xml b/vector/src/main/res/values-v23/theme_light.xml
    index 7e27b65124..283779cd47 100644
    --- a/vector/src/main/res/values-v23/theme_light.xml
    +++ b/vector/src/main/res/values-v23/theme_light.xml
    @@ -1,7 +1,7 @@
     
     
     
    -    
    diff --git a/vector/src/main/res/values-v23/theme_status.xml b/vector/src/main/res/values-v23/theme_status.xml
    index b2e12ab55d..236864d4b8 100644
    --- a/vector/src/main/res/values-v23/theme_status.xml
    +++ b/vector/src/main/res/values-v23/theme_status.xml
    @@ -1,7 +1,7 @@
     
     
     
    -    
    diff --git a/vector/src/main/res/values/dimens.xml b/vector/src/main/res/values/dimens.xml
    index 665d1819f7..ccb7ae7726 100644
    --- a/vector/src/main/res/values/dimens.xml
    +++ b/vector/src/main/res/values/dimens.xml
    @@ -9,9 +9,9 @@
         32dp
     
         50dp
    -    0dp
    -    172dp
    -    20dp
    +    16dp
    +    196dp
    +    44dp
         72dp
     
         40dp
    diff --git a/vector/src/main/res/values-v21/styles.xml b/vector/src/main/res/values/styles.xml
    similarity index 62%
    rename from vector/src/main/res/values-v21/styles.xml
    rename to vector/src/main/res/values/styles.xml
    index 79c4b4a9aa..09f17a77b4 100644
    --- a/vector/src/main/res/values-v21/styles.xml
    +++ b/vector/src/main/res/values/styles.xml
    @@ -1,7 +1,6 @@
     
     
     
    -    
         
     
    -    
    -
         
         
     
         
     
    -