forked from GitHub-Mirror/riotX-android
Code quality: split long lines
This commit is contained in:
parent
66a018c79e
commit
0919b9460d
@ -87,7 +87,8 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
|
|||||||
val matrixConfiguration = (appContext as MatrixConfiguration.Provider).providesMatrixConfiguration()
|
val matrixConfiguration = (appContext as MatrixConfiguration.Provider).providesMatrixConfiguration()
|
||||||
instance = Matrix(appContext, matrixConfiguration)
|
instance = Matrix(appContext, matrixConfiguration)
|
||||||
} else {
|
} else {
|
||||||
throw IllegalStateException("Matrix is not initialized properly. You should call Matrix.initialize or let your application implements MatrixConfiguration.Provider.")
|
throw IllegalStateException("Matrix is not initialized properly." +
|
||||||
|
" You should call Matrix.initialize or let your application implements MatrixConfiguration.Provider.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return instance
|
return instance
|
||||||
|
@ -40,7 +40,8 @@ data class PushCondition(
|
|||||||
/**
|
/**
|
||||||
* Required for room_member_count conditions.
|
* Required for room_member_count conditions.
|
||||||
* A decimal integer optionally prefixed by one of, ==, <, >, >= or <=.
|
* A decimal integer optionally prefixed by one of, ==, <, >, >= or <=.
|
||||||
* A prefix of < matches rooms where the member count is strictly less than the given number and so forth. If no prefix is present, this parameter defaults to ==.
|
* A prefix of < matches rooms where the member count is strictly less than the given number and so forth.
|
||||||
|
* If no prefix is present, this parameter defaults to ==.
|
||||||
*/
|
*/
|
||||||
@Json(name = "is") val iz: String? = null
|
@Json(name = "is") val iz: String? = null
|
||||||
) {
|
) {
|
||||||
|
@ -85,7 +85,9 @@ sealed class MXCryptoError : Throwable() {
|
|||||||
const val BAD_ENCRYPTED_MESSAGE_REASON = "Bad Encrypted Message"
|
const val BAD_ENCRYPTED_MESSAGE_REASON = "Bad Encrypted Message"
|
||||||
const val DUPLICATE_MESSAGE_INDEX_REASON = "Duplicate message index, possible replay attack %1\$s"
|
const val DUPLICATE_MESSAGE_INDEX_REASON = "Duplicate message index, possible replay attack %1\$s"
|
||||||
const val ERROR_MISSING_PROPERTY_REASON = "No '%1\$s' property. Cannot prevent unknown-key attack"
|
const val ERROR_MISSING_PROPERTY_REASON = "No '%1\$s' property. Cannot prevent unknown-key attack"
|
||||||
const val UNKNOWN_DEVICES_REASON = "This room contains unknown devices which have not been verified.\n" + "We strongly recommend you verify them before continuing."
|
const val UNKNOWN_DEVICES_REASON = "This room contains unknown devices which have not been verified.\n" +
|
||||||
const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." + " Perhaps the homeserver is hiding the configuration event."
|
"We strongly recommend you verify them before continuing."
|
||||||
|
const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." +
|
||||||
|
" Perhaps the homeserver is hiding the configuration event."
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,7 +40,8 @@ interface KeysBackupService {
|
|||||||
* @param keysBackupCreationInfo the info object from [prepareKeysBackupVersion].
|
* @param keysBackupCreationInfo the info object from [prepareKeysBackupVersion].
|
||||||
* @param callback Asynchronous callback
|
* @param callback Asynchronous callback
|
||||||
*/
|
*/
|
||||||
fun createKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo, callback: MatrixCallback<KeysVersion>)
|
fun createKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo,
|
||||||
|
callback: MatrixCallback<KeysVersion>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Facility method to get the total number of locally stored keys
|
* Facility method to get the total number of locally stored keys
|
||||||
@ -58,7 +59,8 @@ interface KeysBackupService {
|
|||||||
* @param progressListener the callback to follow the progress
|
* @param progressListener the callback to follow the progress
|
||||||
* @param callback the main callback
|
* @param callback the main callback
|
||||||
*/
|
*/
|
||||||
fun backupAllGroupSessions(progressListener: ProgressListener?, callback: MatrixCallback<Unit>?)
|
fun backupAllGroupSessions(progressListener: ProgressListener?,
|
||||||
|
callback: MatrixCallback<Unit>?)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check trust on a key backup version.
|
* Check trust on a key backup version.
|
||||||
@ -66,7 +68,8 @@ interface KeysBackupService {
|
|||||||
* @param keysBackupVersion the backup version to check.
|
* @param keysBackupVersion the backup version to check.
|
||||||
* @param callback block called when the operations completes.
|
* @param callback block called when the operations completes.
|
||||||
*/
|
*/
|
||||||
fun getKeysBackupTrust(keysBackupVersion: KeysVersionResult, callback: MatrixCallback<KeysBackupVersionTrust>)
|
fun getKeysBackupTrust(keysBackupVersion: KeysVersionResult,
|
||||||
|
callback: MatrixCallback<KeysBackupVersionTrust>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current progress of the backup
|
* Return the current progress of the backup
|
||||||
@ -80,7 +83,8 @@ interface KeysBackupService {
|
|||||||
* @param version the backup version
|
* @param version the backup version
|
||||||
* @param callback
|
* @param callback
|
||||||
*/
|
*/
|
||||||
fun getVersion(version: String, callback: MatrixCallback<KeysVersionResult?>)
|
fun getVersion(version: String,
|
||||||
|
callback: MatrixCallback<KeysVersionResult?>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method fetches the last backup version on the server, then compare to the currently backup version use.
|
* This method fetches the last backup version on the server, then compare to the currently backup version use.
|
||||||
@ -114,7 +118,9 @@ interface KeysBackupService {
|
|||||||
* @param progressListener a progress listener, as generating private key from password may take a while
|
* @param progressListener a progress listener, as generating private key from password may take a while
|
||||||
* @param callback Asynchronous callback
|
* @param callback Asynchronous callback
|
||||||
*/
|
*/
|
||||||
fun prepareKeysBackupVersion(password: String?, progressListener: ProgressListener?, callback: MatrixCallback<MegolmBackupCreationInfo>)
|
fun prepareKeysBackupVersion(password: String?,
|
||||||
|
progressListener: ProgressListener?,
|
||||||
|
callback: MatrixCallback<MegolmBackupCreationInfo>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a keys backup version. It will delete all backed up keys on the server, and the backup itself.
|
* Delete a keys backup version. It will delete all backed up keys on the server, and the backup itself.
|
||||||
@ -123,7 +129,8 @@ interface KeysBackupService {
|
|||||||
* @param version the backup version to delete.
|
* @param version the backup version to delete.
|
||||||
* @param callback Asynchronous callback
|
* @param callback Asynchronous callback
|
||||||
*/
|
*/
|
||||||
fun deleteBackup(version: String, callback: MatrixCallback<Unit>?)
|
fun deleteBackup(version: String,
|
||||||
|
callback: MatrixCallback<Unit>?)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask if the backup on the server contains keys that we may do not have locally.
|
* Ask if the backup on the server contains keys that we may do not have locally.
|
||||||
@ -139,7 +146,9 @@ interface KeysBackupService {
|
|||||||
* @param trust the trust to set to the keys backup.
|
* @param trust the trust to set to the keys backup.
|
||||||
* @param callback block called when the operations completes.
|
* @param callback block called when the operations completes.
|
||||||
*/
|
*/
|
||||||
fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult, trust: Boolean, callback: MatrixCallback<Unit>)
|
fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult,
|
||||||
|
trust: Boolean,
|
||||||
|
callback: MatrixCallback<Unit>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set trust on a keys backup version.
|
* Set trust on a keys backup version.
|
||||||
@ -148,7 +157,9 @@ interface KeysBackupService {
|
|||||||
* @param recoveryKey the recovery key to challenge with the key backup public key.
|
* @param recoveryKey the recovery key to challenge with the key backup public key.
|
||||||
* @param callback block called when the operations completes.
|
* @param callback block called when the operations completes.
|
||||||
*/
|
*/
|
||||||
fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult, recoveryKey: String, callback: MatrixCallback<Unit>)
|
fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult,
|
||||||
|
recoveryKey: String,
|
||||||
|
callback: MatrixCallback<Unit>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set trust on a keys backup version.
|
* Set trust on a keys backup version.
|
||||||
@ -157,7 +168,9 @@ interface KeysBackupService {
|
|||||||
* @param password the pass phrase to challenge with the keyBackupVersion public key.
|
* @param password the pass phrase to challenge with the keyBackupVersion public key.
|
||||||
* @param callback block called when the operations completes.
|
* @param callback block called when the operations completes.
|
||||||
*/
|
*/
|
||||||
fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult, password: String, callback: MatrixCallback<Unit>)
|
fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult,
|
||||||
|
password: String,
|
||||||
|
callback: MatrixCallback<Unit>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore a backup with a recovery key from a given backup version stored on the homeserver.
|
* Restore a backup with a recovery key from a given backup version stored on the homeserver.
|
||||||
@ -169,7 +182,11 @@ interface KeysBackupService {
|
|||||||
* @param stepProgressListener the step progress listener
|
* @param stepProgressListener the step progress listener
|
||||||
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
|
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
|
||||||
*/
|
*/
|
||||||
fun restoreKeysWithRecoveryKey(keysVersionResult: KeysVersionResult, recoveryKey: String, roomId: String?, sessionId: String?, stepProgressListener: StepProgressListener?, callback: MatrixCallback<ImportRoomKeysResult>)
|
fun restoreKeysWithRecoveryKey(keysVersionResult: KeysVersionResult,
|
||||||
|
recoveryKey: String, roomId: String?,
|
||||||
|
sessionId: String?,
|
||||||
|
stepProgressListener: StepProgressListener?,
|
||||||
|
callback: MatrixCallback<ImportRoomKeysResult>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore a backup with a password from a given backup version stored on the homeserver.
|
* Restore a backup with a password from a given backup version stored on the homeserver.
|
||||||
@ -181,7 +198,12 @@ interface KeysBackupService {
|
|||||||
* @param stepProgressListener the step progress listener
|
* @param stepProgressListener the step progress listener
|
||||||
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
|
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
|
||||||
*/
|
*/
|
||||||
fun restoreKeyBackupWithPassword(keysBackupVersion: KeysVersionResult, password: String, roomId: String?, sessionId: String?, stepProgressListener: StepProgressListener?, callback: MatrixCallback<ImportRoomKeysResult>)
|
fun restoreKeyBackupWithPassword(keysBackupVersion: KeysVersionResult,
|
||||||
|
password: String,
|
||||||
|
roomId: String?,
|
||||||
|
sessionId: String?,
|
||||||
|
stepProgressListener: StepProgressListener?,
|
||||||
|
callback: MatrixCallback<ImportRoomKeysResult>)
|
||||||
|
|
||||||
val keysBackupVersion: KeysVersionResult?
|
val keysBackupVersion: KeysVersionResult?
|
||||||
val currentBackupVersion: String?
|
val currentBackupVersion: String?
|
||||||
|
@ -67,7 +67,8 @@ data class PublicRoom(
|
|||||||
var worldReadable: Boolean = false,
|
var worldReadable: Boolean = false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required. Whether guest users may join the room and participate in it. If they can, they will be subject to ordinary power level rules like any other user.
|
* Required. Whether guest users may join the room and participate in it. If they can,
|
||||||
|
* they will be subject to ordinary power level rules like any other user.
|
||||||
*/
|
*/
|
||||||
@Json(name = "guest_can_join")
|
@Json(name = "guest_can_join")
|
||||||
var guestCanJoin: Boolean = false,
|
var guestCanJoin: Boolean = false,
|
||||||
|
@ -168,8 +168,10 @@ internal abstract class CryptoModule {
|
|||||||
abstract fun bindSendToDeviceTask(sendToDeviceTask: DefaultSendToDeviceTask): SendToDeviceTask
|
abstract fun bindSendToDeviceTask(sendToDeviceTask: DefaultSendToDeviceTask): SendToDeviceTask
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
abstract fun bindClaimOneTimeKeysForUsersDeviceTask(claimOneTimeKeysForUsersDevice: DefaultClaimOneTimeKeysForUsersDevice): ClaimOneTimeKeysForUsersDeviceTask
|
abstract fun bindClaimOneTimeKeysForUsersDeviceTask(claimOneTimeKeysForUsersDevice: DefaultClaimOneTimeKeysForUsersDevice)
|
||||||
|
: ClaimOneTimeKeysForUsersDeviceTask
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
abstract fun bindDeleteDeviceWithUserPasswordTask(deleteDeviceWithUserPasswordTask: DefaultDeleteDeviceWithUserPasswordTask): DeleteDeviceWithUserPasswordTask
|
abstract fun bindDeleteDeviceWithUserPasswordTask(deleteDeviceWithUserPasswordTask: DefaultDeleteDeviceWithUserPasswordTask)
|
||||||
|
: DeleteDeviceWithUserPasswordTask
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,8 @@ internal class MXOlmDevice @Inject constructor(
|
|||||||
adapter.fromJson(payloadString)
|
adapter.fromJson(payloadString)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e("## decryptGroupMessage() : fails to parse the payload")
|
Timber.e("## decryptGroupMessage() : fails to parse the payload")
|
||||||
return@flatMap Try.Failure(MXCryptoError.Base(MXCryptoError.ErrorType.BAD_DECRYPTED_FORMAT, MXCryptoError.BAD_DECRYPTED_FORMAT_TEXT_REASON))
|
return@flatMap Try.Failure(
|
||||||
|
MXCryptoError.Base(MXCryptoError.ErrorType.BAD_DECRYPTED_FORMAT, MXCryptoError.BAD_DECRYPTED_FORMAT_TEXT_REASON))
|
||||||
}
|
}
|
||||||
|
|
||||||
return@flatMap Try.just(
|
return@flatMap Try.just(
|
||||||
|
@ -132,20 +132,26 @@ internal class OutgoingRoomKeyRequestManager @Inject constructor(
|
|||||||
|
|
||||||
Timber.v("cancelRoomKeyRequest: requestId: " + req.requestId + " state: " + req.state + " andResend: " + andResend)
|
Timber.v("cancelRoomKeyRequest: requestId: " + req.requestId + " state: " + req.state + " andResend: " + andResend)
|
||||||
|
|
||||||
if (req.state === OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING || req.state === OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND) {
|
when (req.state) {
|
||||||
// nothing to do here
|
OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING,
|
||||||
} else if (req.state === OutgoingRoomKeyRequest.RequestState.UNSENT || req.state === OutgoingRoomKeyRequest.RequestState.FAILED) {
|
OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND -> {
|
||||||
Timber.v("## cancelRoomKeyRequest() : deleting unnecessary room key request for $requestBody")
|
// nothing to do here
|
||||||
cryptoStore.deleteOutgoingRoomKeyRequest(req.requestId)
|
}
|
||||||
} else if (req.state === OutgoingRoomKeyRequest.RequestState.SENT) {
|
OutgoingRoomKeyRequest.RequestState.UNSENT,
|
||||||
if (andResend) {
|
OutgoingRoomKeyRequest.RequestState.FAILED -> {
|
||||||
req.state = OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND
|
Timber.v("## cancelRoomKeyRequest() : deleting unnecessary room key request for $requestBody")
|
||||||
} else {
|
cryptoStore.deleteOutgoingRoomKeyRequest(req.requestId)
|
||||||
req.state = OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING
|
}
|
||||||
|
OutgoingRoomKeyRequest.RequestState.SENT -> {
|
||||||
|
if (andResend) {
|
||||||
|
req.state = OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING_AND_WILL_RESEND
|
||||||
|
} else {
|
||||||
|
req.state = OutgoingRoomKeyRequest.RequestState.CANCELLATION_PENDING
|
||||||
|
}
|
||||||
|
req.cancellationTxnId = makeTxnId()
|
||||||
|
cryptoStore.updateOutgoingRoomKeyRequest(req)
|
||||||
|
sendOutgoingRoomKeyRequestCancellation(req)
|
||||||
}
|
}
|
||||||
req.cancellationTxnId = makeTxnId()
|
|
||||||
cryptoStore.updateOutgoingRoomKeyRequest(req)
|
|
||||||
sendOutgoingRoomKeyRequestCancellation(req)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,11 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||||||
return Try.Failure(MXCryptoError.Base(MXCryptoError.ErrorType.MISSING_FIELDS, MXCryptoError.MISSING_FIELDS_REASON))
|
return Try.Failure(MXCryptoError.Base(MXCryptoError.ErrorType.MISSING_FIELDS, MXCryptoError.MISSING_FIELDS_REASON))
|
||||||
}
|
}
|
||||||
|
|
||||||
return olmDevice.decryptGroupMessage(encryptedEventContent.ciphertext, event.roomId, timeline, encryptedEventContent.sessionId, encryptedEventContent.senderKey)
|
return olmDevice.decryptGroupMessage(encryptedEventContent.ciphertext,
|
||||||
|
event.roomId,
|
||||||
|
timeline,
|
||||||
|
encryptedEventContent.sessionId,
|
||||||
|
encryptedEventContent.senderKey)
|
||||||
.fold(
|
.fold(
|
||||||
{ throwable ->
|
{ throwable ->
|
||||||
if (throwable is MXCryptoError.OlmError) {
|
if (throwable is MXCryptoError.OlmError) {
|
||||||
@ -211,7 +215,8 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (event.getClearType() == EventType.FORWARDED_ROOM_KEY) {
|
if (event.getClearType() == EventType.FORWARDED_ROOM_KEY) {
|
||||||
Timber.v("## onRoomKeyEvent(), forward adding key : roomId ${roomKeyContent.roomId} sessionId ${roomKeyContent.sessionId} sessionKey ${roomKeyContent.sessionKey}") // from " + event);
|
Timber.v("## onRoomKeyEvent(), forward adding key : roomId ${roomKeyContent.roomId}" +
|
||||||
|
" sessionId ${roomKeyContent.sessionId} sessionKey ${roomKeyContent.sessionKey}")
|
||||||
val forwardedRoomKeyContent = event.getClearContent().toModel<ForwardedRoomKeyContent>()
|
val forwardedRoomKeyContent = event.getClearContent().toModel<ForwardedRoomKeyContent>()
|
||||||
?: return
|
?: return
|
||||||
|
|
||||||
@ -259,7 +264,13 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val added = olmDevice.addInboundGroupSession(roomKeyContent.sessionId, roomKeyContent.sessionKey, roomKeyContent.roomId, senderKey, forwardingCurve25519KeyChain, keysClaimed, exportFormat)
|
val added = olmDevice.addInboundGroupSession(roomKeyContent.sessionId,
|
||||||
|
roomKeyContent.sessionKey,
|
||||||
|
roomKeyContent.roomId,
|
||||||
|
senderKey,
|
||||||
|
forwardingCurve25519KeyChain,
|
||||||
|
keysClaimed,
|
||||||
|
exportFormat)
|
||||||
|
|
||||||
if (added) {
|
if (added) {
|
||||||
keysBackup.maybeBackupKeys()
|
keysBackup.maybeBackupKeys()
|
||||||
@ -322,7 +333,8 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||||||
// were no one-time keys.
|
// were no one-time keys.
|
||||||
Try.just(Unit)
|
Try.just(Unit)
|
||||||
}
|
}
|
||||||
Timber.v("""## shareKeysWithDevice() : sharing keys for session ${body?.senderKey}|${body?.sessionId} with device $userId:$deviceId""")
|
Timber.v("## shareKeysWithDevice() : sharing keys for session" +
|
||||||
|
" ${body?.senderKey}|${body?.sessionId} with device $userId:$deviceId")
|
||||||
|
|
||||||
val payloadJson = HashMap<String, Any>()
|
val payloadJson = HashMap<String, Any>()
|
||||||
payloadJson["type"] = EventType.FORWARDED_ROOM_KEY
|
payloadJson["type"] = EventType.FORWARDED_ROOM_KEY
|
||||||
|
@ -106,7 +106,8 @@ internal class MXOlmDecryption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (olmPayloadContent.recipient != credentials.userId) {
|
if (olmPayloadContent.recipient != credentials.userId) {
|
||||||
Timber.e("## decryptEvent() : Event ${event.eventId}: Intended recipient ${olmPayloadContent.recipient} does not match our id ${credentials.userId}")
|
Timber.e("## decryptEvent() : Event ${event.eventId}:" +
|
||||||
|
" Intended recipient ${olmPayloadContent.recipient} does not match our id ${credentials.userId}")
|
||||||
return Try.Failure(MXCryptoError.Base(MXCryptoError.ErrorType.BAD_RECIPIENT,
|
return Try.Failure(MXCryptoError.Base(MXCryptoError.ErrorType.BAD_RECIPIENT,
|
||||||
String.format(MXCryptoError.BAD_RECIPIENT_REASON, olmPayloadContent.recipient)))
|
String.format(MXCryptoError.BAD_RECIPIENT_REASON, olmPayloadContent.recipient)))
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,8 @@ internal class KeysBackup @Inject constructor(
|
|||||||
// Do not trigger a backup for them if they come from the backup version we are using
|
// Do not trigger a backup for them if they come from the backup version we are using
|
||||||
val backUp = keysVersionResult.version != keysBackupVersion?.version
|
val backUp = keysVersionResult.version != keysBackupVersion?.version
|
||||||
if (backUp) {
|
if (backUp) {
|
||||||
Timber.v("restoreKeysWithRecoveryKey: Those keys will be backed up to backup version: " + keysBackupVersion?.version)
|
Timber.v("restoreKeysWithRecoveryKey: Those keys will be backed up to backup version: "
|
||||||
|
+ keysBackupVersion?.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import them into the crypto store
|
// Import them into the crypto store
|
||||||
@ -1224,7 +1225,8 @@ internal class KeysBackup @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
keysBackupData.roomIdToRoomKeysBackupData[olmInboundGroupSessionWrapper.roomId]!!.sessionIdToKeyBackupData[olmInboundGroupSessionWrapper.olmInboundGroupSession!!.sessionIdentifier()] = keyBackupData
|
keysBackupData.roomIdToRoomKeysBackupData[olmInboundGroupSessionWrapper.roomId]!!
|
||||||
|
.sessionIdToKeyBackupData[olmInboundGroupSessionWrapper.olmInboundGroupSession!!.sessionIdentifier()] = keyBackupData
|
||||||
} catch (e: OlmException) {
|
} catch (e: OlmException) {
|
||||||
Timber.e(e, "OlmException")
|
Timber.e(e, "OlmException")
|
||||||
}
|
}
|
||||||
@ -1276,7 +1278,8 @@ internal class KeysBackup @Inject constructor(
|
|||||||
// Do not stay in KeysBackupState.WrongBackUpVersion but check what is available on the homeserver
|
// Do not stay in KeysBackupState.WrongBackUpVersion but check what is available on the homeserver
|
||||||
checkAndStartKeysBackup()
|
checkAndStartKeysBackup()
|
||||||
}
|
}
|
||||||
else -> // Come back to the ready state so that we will retry on the next received key
|
else ->
|
||||||
|
// Come back to the ready state so that we will retry on the next received key
|
||||||
keysBackupStateManager.state = KeysBackupState.ReadyToBackUp
|
keysBackupStateManager.state = KeysBackupState.ReadyToBackUp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@ import io.realm.annotations.Index
|
|||||||
// at java.lang.Thread.run(Thread.java:764)
|
// at java.lang.Thread.run(Thread.java:764)
|
||||||
// Caused by: java.lang.IllegalArgumentException: 'value' is not a valid managed object.
|
// Caused by: java.lang.IllegalArgumentException: 'value' is not a valid managed object.
|
||||||
// at io.realm.ProxyState.checkValidObject(ProxyState.java:213)
|
// at io.realm.ProxyState.checkValidObject(ProxyState.java:213)
|
||||||
// at io.realm.im_vector_matrix_android_internal_database_model_PusherEntityRealmProxy.realmSet$data(im_vector_matrix_android_internal_database_model_PusherEntityRealmProxy.java:413)
|
// at io.realm.im_vector_matrix_android_internal_database_model_PusherEntityRealmProxy
|
||||||
|
// .realmSet$data(im_vector_matrix_android_internal_database_model_PusherEntityRealmProxy.java:413)
|
||||||
// at im.vector.matrix.android.internal.database.model.PusherEntity.setData(PusherEntity.kt:16)
|
// at im.vector.matrix.android.internal.database.model.PusherEntity.setData(PusherEntity.kt:16)
|
||||||
// at im.vector.matrix.android.internal.session.pushers.AddHttpPusherWorker$doWork$$inlined$fold$lambda$2.execute(AddHttpPusherWorker.kt:70)
|
// at im.vector.matrix.android.internal.session.pushers.AddHttpPusherWorker$doWork$$inlined$fold$lambda$2.execute(AddHttpPusherWorker.kt:70)
|
||||||
// at io.realm.Realm.executeTransaction(Realm.java:1493)
|
// at io.realm.Realm.executeTransaction(Realm.java:1493)
|
||||||
|
@ -36,7 +36,8 @@ private const val GET_GROUP_DATA_WORKER = "GET_GROUP_DATA_WORKER"
|
|||||||
|
|
||||||
internal class GroupSummaryUpdater @Inject constructor(private val context: Context,
|
internal class GroupSummaryUpdater @Inject constructor(private val context: Context,
|
||||||
private val credentials: Credentials,
|
private val credentials: Credentials,
|
||||||
@SessionDatabase realmConfiguration: RealmConfiguration) : RealmLiveEntityObserver<GroupEntity>(realmConfiguration) {
|
@SessionDatabase realmConfiguration: RealmConfiguration)
|
||||||
|
: RealmLiveEntityObserver<GroupEntity>(realmConfiguration) {
|
||||||
|
|
||||||
override val query = Monarchy.Query<GroupEntity> { GroupEntity.where(it) }
|
override val query = Monarchy.Query<GroupEntity> { GroupEntity.where(it) }
|
||||||
|
|
||||||
|
@ -69,7 +69,8 @@ internal class DefaultProcessEventForPushTask @Inject constructor(
|
|||||||
}.filter {
|
}.filter {
|
||||||
it.senderId != sessionParams.credentials.userId
|
it.senderId != sessionParams.credentials.userId
|
||||||
}
|
}
|
||||||
Timber.v("[PushRules] Found ${allEvents.size} out of ${(newJoinEvents + inviteEvents).size} to check for push rules with ${params.rules.size} rules")
|
Timber.v("[PushRules] Found ${allEvents.size} out of ${(newJoinEvents + inviteEvents).size}" +
|
||||||
|
" to check for push rules with ${params.rules.size} rules")
|
||||||
allEvents.forEach { event ->
|
allEvents.forEach { event ->
|
||||||
fulfilledBingRule(event, params.rules)?.let {
|
fulfilledBingRule(event, params.rules)?.let {
|
||||||
Timber.v("[PushRules] Rule $it match for event ${event.eventId}")
|
Timber.v("[PushRules] Rule $it match for event ${event.eventId}")
|
||||||
|
@ -66,7 +66,8 @@ internal class RoomFactory @Inject constructor(private val context: Context,
|
|||||||
val stateService = DefaultStateService(roomId, taskExecutor, sendStateTask)
|
val stateService = DefaultStateService(roomId, taskExecutor, sendStateTask)
|
||||||
val roomMembersService = DefaultMembershipService(roomId, monarchy, taskExecutor, loadRoomMembersTask, inviteTask, joinRoomTask, leaveRoomTask)
|
val roomMembersService = DefaultMembershipService(roomId, monarchy, taskExecutor, loadRoomMembersTask, inviteTask, joinRoomTask, leaveRoomTask)
|
||||||
val readService = DefaultReadService(roomId, monarchy, taskExecutor, setReadMarkersTask, credentials)
|
val readService = DefaultReadService(roomId, monarchy, taskExecutor, setReadMarkersTask, credentials)
|
||||||
val relationService = DefaultRelationService(context, credentials, roomId, eventFactory, cryptoService, findReactionEventForUndoTask, monarchy, taskExecutor)
|
val relationService = DefaultRelationService(context,
|
||||||
|
credentials, roomId, eventFactory, cryptoService, findReactionEventForUndoTask, monarchy, taskExecutor)
|
||||||
|
|
||||||
return DefaultRoom(
|
return DefaultRoom(
|
||||||
roomId,
|
roomId,
|
||||||
|
@ -116,9 +116,11 @@ internal class DefaultRelationService @Inject constructor(private val context: C
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun editTextMessage(targetEventId: String, newBodyText: String, newBodyAutoMarkdown: Boolean, compatibilityBodyText: String): Cancelable {
|
override fun editTextMessage(targetEventId: String, newBodyText: String, newBodyAutoMarkdown: Boolean, compatibilityBodyText: String): Cancelable {
|
||||||
val event = eventFactory.createReplaceTextEvent(roomId, targetEventId, newBodyText, newBodyAutoMarkdown, MessageType.MSGTYPE_TEXT, compatibilityBodyText).also {
|
val event = eventFactory
|
||||||
saveLocalEcho(it)
|
.createReplaceTextEvent(roomId, targetEventId, newBodyText, newBodyAutoMarkdown, MessageType.MSGTYPE_TEXT, compatibilityBodyText)
|
||||||
}
|
.also {
|
||||||
|
saveLocalEcho(it)
|
||||||
|
}
|
||||||
val workRequest = createSendEventWork(event)
|
val workRequest = createSendEventWork(event)
|
||||||
TimelineSendEventWorkCommon.postWork(context, roomId, workRequest)
|
TimelineSendEventWorkCommon.postWork(context, roomId, workRequest)
|
||||||
return CancelableWork(context, workRequest.id)
|
return CancelableWork(context, workRequest.id)
|
||||||
|
@ -81,7 +81,12 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun createReplaceTextEvent(roomId: String, targetEventId: String, newBodyText: String, newBodyAutoMarkdown: Boolean, msgType: String, compatibilityText: String): Event {
|
fun createReplaceTextEvent(roomId: String,
|
||||||
|
targetEventId: String,
|
||||||
|
newBodyText: String,
|
||||||
|
newBodyAutoMarkdown: Boolean,
|
||||||
|
msgType: String,
|
||||||
|
compatibilityText: String): Event {
|
||||||
|
|
||||||
var newContent = MessageTextContent(
|
var newContent = MessageTextContent(
|
||||||
type = MessageType.MSGTYPE_TEXT,
|
type = MessageType.MSGTYPE_TEXT,
|
||||||
@ -255,9 +260,15 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
|||||||
// </mx-reply>
|
// </mx-reply>
|
||||||
// This is where the reply goes.
|
// This is where the reply goes.
|
||||||
val body = bodyForReply(eventReplied.getClearContent().toModel<MessageContent>())
|
val body = bodyForReply(eventReplied.getClearContent().toModel<MessageContent>())
|
||||||
val replyFallbackTemplateFormatted = """
|
val replyFallbackTemplateFormatted = """<mx-reply>
|
||||||
<mx-reply><blockquote><a href="%s">${stringProvider.getString(R.string.message_reply_to_prefix)}</a><a href="%s">%s</a><br />%s</blockquote></mx-reply>%s
|
<blockquote>
|
||||||
""".trimIndent().format(permalink, userLink, userId, body.second ?: body.first, replyText)
|
<a href="%s">${stringProvider.getString(R.string.message_reply_to_prefix)}</a>
|
||||||
|
<a href="%s">%s</a>
|
||||||
|
<br />
|
||||||
|
%s
|
||||||
|
</blockquote>
|
||||||
|
</mx-reply>
|
||||||
|
%s""".trimIndent().format(permalink, userLink, userId, body.second ?: body.first, replyText)
|
||||||
//
|
//
|
||||||
// > <@alice:example.org> This is the original body
|
// > <@alice:example.org> This is the original body
|
||||||
//
|
//
|
||||||
|
@ -120,7 +120,8 @@ object CompatUtil {
|
|||||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
// Get the version of Android when the key has been generated, default to the current version of the system. In this case, the
|
// Get the version of Android when the key has been generated, default to the current version of the system. In this case, the
|
||||||
// key will be generated
|
// key will be generated
|
||||||
val androidVersionWhenTheKeyHasBeenGenerated = sharedPreferences.getInt(SHARED_KEY_ANDROID_VERSION_WHEN_KEY_HAS_BEEN_GENERATED, Build.VERSION.SDK_INT)
|
val androidVersionWhenTheKeyHasBeenGenerated = sharedPreferences
|
||||||
|
.getInt(SHARED_KEY_ANDROID_VERSION_WHEN_KEY_HAS_BEEN_GENERATED, Build.VERSION.SDK_INT)
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (keyStore.containsAlias(AES_LOCAL_PROTECTION_KEY_ALIAS)) {
|
if (keyStore.containsAlias(AES_LOCAL_PROTECTION_KEY_ALIAS)) {
|
||||||
|
@ -26,7 +26,8 @@ import javax.inject.Inject
|
|||||||
* Test that the application is started on boot
|
* Test that the application is started on boot
|
||||||
*/
|
*/
|
||||||
class TestAutoStartBoot @Inject constructor(private val context: AppCompatActivity,
|
class TestAutoStartBoot @Inject constructor(private val context: AppCompatActivity,
|
||||||
private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
|
private val stringProvider: StringProvider)
|
||||||
|
: TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
|
||||||
|
|
||||||
override fun perform() {
|
override fun perform() {
|
||||||
if (PreferencesManager.autoStartOnBoot(context)) {
|
if (PreferencesManager.autoStartOnBoot(context)) {
|
||||||
|
@ -25,7 +25,8 @@ import im.vector.riotx.features.settings.troubleshoot.TroubleshootTest
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class TestBackgroundRestrictions @Inject constructor(private val context: AppCompatActivity,
|
class TestBackgroundRestrictions @Inject constructor(private val context: AppCompatActivity,
|
||||||
private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
|
private val stringProvider: StringProvider)
|
||||||
|
: TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
|
||||||
|
|
||||||
override fun perform() {
|
override fun perform() {
|
||||||
(context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager).apply {
|
(context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager).apply {
|
||||||
|
@ -28,7 +28,8 @@ import javax.inject.Inject
|
|||||||
* Check that the play services APK is available an up-to-date. If needed provide quick fix to install it.
|
* Check that the play services APK is available an up-to-date. If needed provide quick fix to install it.
|
||||||
*/
|
*/
|
||||||
class TestPlayServices @Inject constructor(private val context: AppCompatActivity,
|
class TestPlayServices @Inject constructor(private val context: AppCompatActivity,
|
||||||
private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) {
|
private val stringProvider: StringProvider)
|
||||||
|
: TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) {
|
||||||
|
|
||||||
override fun perform() {
|
override fun perform() {
|
||||||
val apiAvailability = GoogleApiAvailability.getInstance()
|
val apiAvailability = GoogleApiAvailability.getInstance()
|
||||||
|
@ -34,7 +34,8 @@ import javax.inject.Inject
|
|||||||
class TestTokenRegistration @Inject constructor(private val context: AppCompatActivity,
|
class TestTokenRegistration @Inject constructor(private val context: AppCompatActivity,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val pushersManager: PushersManager,
|
private val pushersManager: PushersManager,
|
||||||
private val activeSessionHolder: ActiveSessionHolder) : TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
|
private val activeSessionHolder: ActiveSessionHolder)
|
||||||
|
: TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
|
||||||
|
|
||||||
override fun perform() {
|
override fun perform() {
|
||||||
//Check if we have a registered pusher for this token
|
//Check if we have a registered pusher for this token
|
||||||
|
@ -178,7 +178,8 @@ class MessageMenuViewModel @AssistedInject constructor(@Assisted initialState: M
|
|||||||
|
|
||||||
this.add(SimpleAction(VIEW_SOURCE, R.string.view_source, R.drawable.ic_view_source,event.root.toContentStringWithIndent()))
|
this.add(SimpleAction(VIEW_SOURCE, R.string.view_source, R.drawable.ic_view_source,event.root.toContentStringWithIndent()))
|
||||||
if (event.isEncrypted()) {
|
if (event.isEncrypted()) {
|
||||||
val decryptedContent = event.root.toClearContentStringWithIndent() ?: stringProvider.getString(R.string.encryption_information_decryption_error)
|
val decryptedContent = event.root.toClearContentStringWithIndent()
|
||||||
|
?: stringProvider.getString(R.string.encryption_information_decryption_error)
|
||||||
this.add(SimpleAction(VIEW_DECRYPTED_SOURCE, R.string.view_decrypted_source, R.drawable.ic_view_source, decryptedContent))
|
this.add(SimpleAction(VIEW_DECRYPTED_SOURCE, R.string.view_decrypted_source, R.drawable.ic_view_source, decryptedContent))
|
||||||
}
|
}
|
||||||
this.add(SimpleAction(ACTION_COPY_PERMALINK, R.string.permalink, R.drawable.ic_permalink, event.root.eventId))
|
this.add(SimpleAction(ACTION_COPY_PERMALINK, R.string.permalink, R.drawable.ic_permalink, event.root.eventId))
|
||||||
|
Loading…
Reference in New Issue
Block a user