mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-25 09:14:01 +03:00
Merge branch 'release/0.14.1'
This commit is contained in:
commit
a35302eae0
15 changed files with 143 additions and 39 deletions
|
@ -1,3 +1,10 @@
|
|||
Changes in RiotX 0.14.1 (2020-02-02)
|
||||
===================================================
|
||||
|
||||
Bugfix 🐛:
|
||||
- Cross-signing: fix UX issue when closing the bottom sheet verification (#813)
|
||||
- Room and room member profile: fix issues on dark and black themes
|
||||
|
||||
Changes in RiotX 0.14.0 (2020-02-01)
|
||||
===================================================
|
||||
|
||||
|
@ -321,7 +328,7 @@ Mode details here: https://medium.com/@RiotChat/introducing-the-riotx-beta-for-a
|
|||
=======================================================
|
||||
|
||||
|
||||
Changes in RiotX 0.0.0 (2020-XX-XX)
|
||||
Changes in RiotX 0.X.0 (2020-XX-XX)
|
||||
===================================================
|
||||
|
||||
Features ✨:
|
||||
|
|
|
@ -42,7 +42,7 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
val summaryObservable = room.getRoomSummaryLive()
|
||||
.asObservable()
|
||||
.startWith(room.roomSummary().toOptional())
|
||||
.doOnNext { Timber.d("RX: summary emitted for: ${it.getOrNull()?.roomId}") }
|
||||
.doOnNext { Timber.v("RX: summary emitted for: ${it.getOrNull()?.roomId}") }
|
||||
|
||||
val memberIdsChangeObservable = summaryObservable
|
||||
.map {
|
||||
|
@ -56,7 +56,7 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
}
|
||||
}.orEmpty()
|
||||
}.distinctUntilChanged()
|
||||
.doOnNext { Timber.d("RX: memberIds emitted. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: memberIds emitted. Size: ${it.size}") }
|
||||
|
||||
// Observe the device info of the users in the room
|
||||
val cryptoDeviceInfoObservable = memberIdsChangeObservable
|
||||
|
@ -68,9 +68,9 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
membersIds
|
||||
}
|
||||
.startWith(membersIds)
|
||||
.doOnNext { Timber.d("RX: CryptoDeviceInfo emitted. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: CryptoDeviceInfo emitted. Size: ${it.size}") }
|
||||
}
|
||||
.doOnNext { Timber.d("RX: cryptoDeviceInfo emitted 2. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: cryptoDeviceInfo emitted 2. Size: ${it.size}") }
|
||||
|
||||
val roomEncryptionTrustLevelObservable = cryptoDeviceInfoObservable
|
||||
.map { userIds ->
|
||||
|
@ -80,7 +80,7 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
session.getCrossSigningService().getTrustLevelForUsers(userIds).toOptional()
|
||||
}
|
||||
}
|
||||
.doOnNext { Timber.d("RX: roomEncryptionTrustLevel emitted: ${it.getOrNull()?.name}") }
|
||||
.doOnNext { Timber.v("RX: roomEncryptionTrustLevel emitted: ${it.getOrNull()?.name}") }
|
||||
|
||||
return Observable
|
||||
.combineLatest<Optional<RoomSummary>, Optional<RoomEncryptionTrustLevel>, Optional<RoomSummary>>(
|
||||
|
@ -92,18 +92,18 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
).toOptional()
|
||||
}
|
||||
)
|
||||
.doOnNext { Timber.d("RX: final room summary emitted for ${it.getOrNull()?.roomId}") }
|
||||
.doOnNext { Timber.v("RX: final room summary emitted for ${it.getOrNull()?.roomId}") }
|
||||
}
|
||||
|
||||
fun liveRoomMembers(queryParams: RoomMemberQueryParams): Observable<List<RoomMemberSummary>> {
|
||||
val roomMembersObservable = room.getRoomMembersLive(queryParams).asObservable()
|
||||
.startWith(room.getRoomMembers(queryParams))
|
||||
.doOnNext { Timber.d("RX: room members emitted. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: room members emitted. Size: ${it.size}") }
|
||||
|
||||
// TODO Do it only for room members of the room (switchMap)
|
||||
val cryptoDeviceInfoObservable = session.getLiveCryptoDeviceInfo().asObservable()
|
||||
.startWith(emptyList<CryptoDeviceInfo>())
|
||||
.doOnNext { Timber.d("RX: cryptoDeviceInfo emitted. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: cryptoDeviceInfo emitted. Size: ${it.size}") }
|
||||
|
||||
return Observable
|
||||
.combineLatest<List<RoomMemberSummary>, List<CryptoDeviceInfo>, List<RoomMemberSummary>>(
|
||||
|
@ -122,7 +122,7 @@ class RxRoom(private val room: Room, private val session: Session) {
|
|||
}
|
||||
}
|
||||
)
|
||||
.doOnNext { Timber.d("RX: final room members emitted. Size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: final room members emitted. Size: ${it.size}") }
|
||||
}
|
||||
|
||||
fun liveAnnotationSummary(eventId: String): Observable<Optional<EventAnnotationsSummary>> {
|
||||
|
|
|
@ -41,11 +41,11 @@ class RxSession(private val session: Session) {
|
|||
fun liveRoomSummaries(queryParams: RoomSummaryQueryParams): Observable<List<RoomSummary>> {
|
||||
val summariesObservable = session.getRoomSummariesLive(queryParams).asObservable()
|
||||
.startWith(session.getRoomSummaries(queryParams))
|
||||
.doOnNext { Timber.d("RX: summaries emitted: size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: summaries emitted: size: ${it.size}") }
|
||||
|
||||
val cryptoDeviceInfoObservable = session.getLiveCryptoDeviceInfo().asObservable()
|
||||
.startWith(emptyList<CryptoDeviceInfo>())
|
||||
.doOnNext { Timber.d("RX: crypto device info emitted: size: ${it.size}") }
|
||||
.doOnNext { Timber.v("RX: crypto device info emitted: size: ${it.size}") }
|
||||
|
||||
return Observable
|
||||
.combineLatest<List<RoomSummary>, List<CryptoDeviceInfo>, List<RoomSummary>>(
|
||||
|
|
|
@ -57,6 +57,7 @@ internal class MXMegolmDecryption(private val userId: String,
|
|||
|
||||
var newSessionListener: NewSessionListener? = null
|
||||
|
||||
var hasCheckUserCrossSigning = false
|
||||
/**
|
||||
* Events which we couldn't decrypt due to unknown sessions / indexes: map from
|
||||
* senderKey|sessionId to timelines to list of MatrixEvents.
|
||||
|
@ -65,6 +66,11 @@ internal class MXMegolmDecryption(private val userId: String,
|
|||
|
||||
override suspend fun decryptEvent(event: Event, timeline: String): MXEventDecryptionResult {
|
||||
// If cross signing is enabled, we don't send request until the keys are trusted
|
||||
// There could be a race effect here when xsigning is enabled, we should ensure that keys was downloaded once
|
||||
if (!hasCheckUserCrossSigning) {
|
||||
deviceListManager.downloadKeys(listOf(userId), true)
|
||||
hasCheckUserCrossSigning = true
|
||||
}
|
||||
val requestOnFail =
|
||||
if (cryptoStore.getMyCrossSigningInfo() != null) {
|
||||
cryptoStore.getMyCrossSigningInfo()?.isTrusted() == true
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 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.matrix.android.internal.crypto.model.rest
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import im.vector.matrix.android.internal.crypto.verification.VerificationInfoDone
|
||||
|
||||
/**
|
||||
* Requests a key verification with another user's devices.
|
||||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class KeyVerificationDone(
|
||||
@Json(name = "transaction_id") override var transactionID: String? = null
|
||||
) : SendToDeviceObject, VerificationInfoDone {
|
||||
|
||||
override fun toSendToDeviceObject() = this
|
||||
|
||||
override fun isValid(): Boolean {
|
||||
if (transactionID.isNullOrBlank()) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright 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.matrix.android.internal.crypto.verification
|
||||
|
||||
interface VerificationInfoDone : VerificationInfo
|
|
@ -23,6 +23,7 @@ import im.vector.matrix.android.api.session.room.model.message.MessageType
|
|||
import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationAccept
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationCancel
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationDone
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationKey
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationMac
|
||||
import im.vector.matrix.android.internal.crypto.model.rest.KeyVerificationReady
|
||||
|
@ -138,8 +139,24 @@ internal class VerificationTransportToDevice(
|
|||
}
|
||||
|
||||
override fun done(transactionId: String) {
|
||||
// To device do not do anything here
|
||||
Timber.d("## SAS done (nothing send in to device transport)")
|
||||
val otherUserId = tx?.otherUserId ?: return
|
||||
val otherUserDeviceId = tx?.otherDeviceId ?: return
|
||||
val cancelMessage = KeyVerificationDone(transactionId)
|
||||
val contentMap = MXUsersDevicesMap<Any>()
|
||||
contentMap.setObject(otherUserId, otherUserDeviceId, cancelMessage)
|
||||
sendToDeviceTask
|
||||
.configureWith(SendToDeviceTask.Params(EventType.KEY_VERIFICATION_DONE, contentMap, transactionId)) {
|
||||
this.callback = object : MatrixCallback<Unit> {
|
||||
override fun onSuccess(data: Unit) {
|
||||
Timber.v("## SAS verification [$transactionId] done")
|
||||
}
|
||||
|
||||
override fun onFailure(failure: Throwable) {
|
||||
Timber.e(failure, "## SAS verification [$transactionId] failed to done.")
|
||||
}
|
||||
}
|
||||
}
|
||||
.executeBy(taskExecutor)
|
||||
}
|
||||
|
||||
override fun cancelTransaction(transactionId: String, otherUserId: String, otherUserDeviceId: String, code: CancelCode) {
|
||||
|
|
|
@ -131,8 +131,7 @@ internal class DefaultEventRelationsAggregationTask @Inject constructor(
|
|||
EventType.KEY_VERIFICATION_ACCEPT,
|
||||
EventType.KEY_VERIFICATION_START,
|
||||
EventType.KEY_VERIFICATION_MAC,
|
||||
// TODO Add ?
|
||||
// EventType.KEY_VERIFICATION_READY,
|
||||
EventType.KEY_VERIFICATION_READY,
|
||||
EventType.KEY_VERIFICATION_KEY -> {
|
||||
Timber.v("## SAS REF in room $roomId for event ${event.eventId}")
|
||||
event.content.toModel<MessageRelationContent>()?.relatesTo?.let {
|
||||
|
@ -161,8 +160,7 @@ internal class DefaultEventRelationsAggregationTask @Inject constructor(
|
|||
EventType.KEY_VERIFICATION_ACCEPT,
|
||||
EventType.KEY_VERIFICATION_START,
|
||||
EventType.KEY_VERIFICATION_MAC,
|
||||
// TODO Add ?
|
||||
// EventType.KEY_VERIFICATION_READY,
|
||||
EventType.KEY_VERIFICATION_READY,
|
||||
EventType.KEY_VERIFICATION_KEY -> {
|
||||
Timber.v("## SAS REF in room $roomId for event ${event.eventId}")
|
||||
encryptedEventContent.relatesTo.eventId?.let {
|
||||
|
@ -461,6 +459,9 @@ internal class DefaultEventRelationsAggregationTask @Inject constructor(
|
|||
EventType.KEY_VERIFICATION_ACCEPT -> {
|
||||
updateVerificationState(currentState, VerificationState.WAITING)
|
||||
}
|
||||
EventType.KEY_VERIFICATION_READY -> {
|
||||
updateVerificationState(currentState, VerificationState.WAITING)
|
||||
}
|
||||
EventType.KEY_VERIFICATION_KEY -> {
|
||||
updateVerificationState(currentState, VerificationState.WAITING)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ androidExtensions {
|
|||
|
||||
ext.versionMajor = 0
|
||||
ext.versionMinor = 14
|
||||
ext.versionPatch = 0
|
||||
ext.versionPatch = 1
|
||||
|
||||
static def getGitTimestamp() {
|
||||
def cmd = 'git show -s --format=%ct'
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
|
||||
package im.vector.riotx.core.epoxy.profiles
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.ImageViewCompat
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
import im.vector.riotx.R
|
||||
|
@ -68,13 +70,20 @@ abstract class ProfileActionItem : VectorEpoxyModel<ProfileActionItem.Holder>()
|
|||
holder.subtitle.setTextOrHide(subtitle)
|
||||
if (iconRes != 0) {
|
||||
holder.icon.setImageResource(iconRes)
|
||||
ImageViewCompat.setImageTintList(holder.icon, ColorStateList.valueOf(tintColor))
|
||||
holder.icon.isVisible = true
|
||||
} else {
|
||||
holder.icon.isVisible = false
|
||||
}
|
||||
|
||||
if (editableRes != 0) {
|
||||
val tintColorSecondary = if (destructive) {
|
||||
tintColor
|
||||
} else {
|
||||
ThemeUtils.getColor(holder.view.context, R.attr.riotx_text_secondary)
|
||||
}
|
||||
holder.editable.setImageResource(editableRes)
|
||||
ImageViewCompat.setImageTintList(holder.editable, ColorStateList.valueOf(tintColorSecondary))
|
||||
holder.editable.isVisible = true
|
||||
} else {
|
||||
holder.editable.isVisible = false
|
||||
|
|
|
@ -46,9 +46,7 @@ fun EpoxyController.buildProfileAction(
|
|||
id("action_$id")
|
||||
subtitle(subtitle)
|
||||
editable(editable)
|
||||
apply {
|
||||
editableRes?.let { editableRes(editableRes) }
|
||||
}
|
||||
editableRes?.let { editableRes(editableRes) }
|
||||
destructive(destructive)
|
||||
title(title)
|
||||
listener { _ ->
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package im.vector.riotx.features.settings.crosssigning
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
|
@ -31,6 +32,7 @@ import im.vector.riotx.core.extensions.configureWith
|
|||
import im.vector.riotx.core.extensions.observeEvent
|
||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
import im.vector.riotx.core.utils.toast
|
||||
import kotlinx.android.synthetic.main.fragment_generic_recycler.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -91,27 +93,35 @@ class CrossSigningSettingsFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun requestPassword(sessionId: String) {
|
||||
// Ask for password
|
||||
val inflater = this.layoutInflater
|
||||
val layout = inflater.inflate(R.layout.dialog_base_edit_text, null)
|
||||
val inflater = requireActivity().layoutInflater
|
||||
val layout = inflater.inflate(R.layout.dialog_prompt_password, null)
|
||||
val passwordEditText = layout.findViewById<EditText>(R.id.prompt_password)
|
||||
|
||||
val input = layout.findViewById<EditText>(R.id.edit_text).also {
|
||||
it.inputType = InputType.TYPE_TEXT_VARIATION_PASSWORD
|
||||
}
|
||||
|
||||
AlertDialog.Builder(requireContext())
|
||||
.setTitle("Confirm password")
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setTitle(R.string.devices_delete_dialog_title)
|
||||
.setView(layout)
|
||||
.setPositiveButton(R.string.ok) { _, _ ->
|
||||
val pass = input.text.toString()
|
||||
.setPositiveButton(R.string.auth_submit, DialogInterface.OnClickListener { _, _ ->
|
||||
if (passwordEditText.toString().isEmpty()) {
|
||||
requireActivity().toast(R.string.error_empty_field_your_password)
|
||||
return@OnClickListener
|
||||
}
|
||||
val pass = passwordEditText.text.toString()
|
||||
|
||||
// TODO sessionId should never get out the ViewModel
|
||||
viewModel.handle(CrossSigningAction.InitializeCrossSigning(UserPasswordAuth(
|
||||
session = sessionId,
|
||||
password = pass
|
||||
)))
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event ->
|
||||
if (event.action == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
dialog.cancel()
|
||||
return@OnKeyListener true
|
||||
}
|
||||
false
|
||||
})
|
||||
.show()
|
||||
}
|
||||
|
||||
|
|
|
@ -168,8 +168,8 @@ class VectorSettingsDevicesFragment @Inject constructor(
|
|||
viewModel.handle(DevicesAction.Password(mAccountPassword))
|
||||
} else {
|
||||
val inflater = requireActivity().layoutInflater
|
||||
val layout = inflater.inflate(R.layout.dialog_device_delete, null)
|
||||
val passwordEditText = layout.findViewById<EditText>(R.id.delete_password)
|
||||
val layout = inflater.inflate(R.layout.dialog_prompt_password, null)
|
||||
val passwordEditText = layout.findViewById<EditText>(R.id.prompt_password)
|
||||
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/delete_password"
|
||||
android:id="@+id/prompt_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
|
@ -20,6 +20,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:scaleType="center"
|
||||
android:tint="?riotx_text_primary"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -55,7 +56,6 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:drawablePadding="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
|
Loading…
Add table
Reference in a new issue