Reformats modules

This commit is contained in:
ericdecanini 2022-07-19 15:11:42 +02:00
parent cc1e1fe8eb
commit 8c53d2f9b0
24 changed files with 135 additions and 126 deletions

View File

@ -604,14 +604,16 @@ internal class MXOlmDevice @Inject constructor(
* @param sharedHistory MSC3061, this key is sharable on invite
* @return true if the operation succeeds.
*/
fun addInboundGroupSession(sessionId: String,
fun addInboundGroupSession(
sessionId: String,
sessionKey: String,
roomId: String,
senderKey: String,
forwardingCurve25519KeyChain: List<String>,
keysClaimed: Map<String, String>,
exportFormat: Boolean,
sharedHistory: Boolean): AddSessionResult {
sharedHistory: Boolean
): AddSessionResult {
val candidateSession = tryOrNull("Failed to create inbound session in room $roomId") {
if (exportFormat) {
OlmInboundGroupSession.importSession(sessionKey)

View File

@ -38,6 +38,7 @@ internal class MXMegolmDecryptionFactory @Inject constructor(
outgoingKeyRequestManager,
cryptoStore,
matrixConfiguration,
eventsManager)
eventsManager
)
}
}

View File

@ -250,8 +250,10 @@ internal class MXMegolmEncryption(
* @param sessionInfo the session info
* @param devicesByUser the devices map
*/
private suspend fun shareUserDevicesKey(sessionInfo: MXOutboundSessionInfo,
devicesByUser: Map<String, List<CryptoDeviceInfo>>) {
private suspend fun shareUserDevicesKey(
sessionInfo: MXOutboundSessionInfo,
devicesByUser: Map<String, List<CryptoDeviceInfo>>
) {
val sessionKey = olmDevice.getSessionKey(sessionInfo.sessionId) ?: return Unit.also {
Timber.tag(loggerTag.value).v("shareUserDevicesKey() Failed to share session, failed to export")
}

View File

@ -70,7 +70,7 @@ class AvatarRenderer @Inject constructor(
render(
GlideApp.with(imageView),
matrixItem,
DrawableImageViewTarget(imageView)
DrawableImageViewTarget(imageView),
)
}
@ -103,7 +103,7 @@ class AvatarRenderer @Inject constructor(
render(
glideRequests,
matrixItem,
DrawableImageViewTarget(imageView)
DrawableImageViewTarget(imageView),
)
}
@ -123,7 +123,7 @@ class AvatarRenderer @Inject constructor(
val matrixItem = MatrixItem.UserItem(
// Need an id starting with @
id = "@${mappedContact.displayName}",
displayName = mappedContact.displayName
displayName = mappedContact.displayName,
)
val placeholder = getPlaceholderDrawable(matrixItem)
@ -140,7 +140,7 @@ class AvatarRenderer @Inject constructor(
val matrixItem = MatrixItem.UserItem(
// Need an id starting with @
id = profileInfo.matrixId,
displayName = profileInfo.displayName
displayName = profileInfo.displayName,
)
val placeholder = getPlaceholderDrawable(matrixItem)
@ -215,7 +215,7 @@ class AvatarRenderer @Inject constructor(
.bold()
.endConfig()
.buildRect(matrixItem.firstLetterOfDisplayName(), avatarColor)
.toBitmap(width = iconSize, height = iconSize)
.toBitmap(width = iconSize, height = iconSize),
)
}
}
@ -231,7 +231,7 @@ class AvatarRenderer @Inject constructor(
addPlaceholder: Boolean
) {
val transformations = mutableListOf<Transformation<Bitmap>>(
BlurTransformation(20, sampling)
BlurTransformation(20, sampling),
)
if (colorFilter != null) {
transformations.add(ColorFilterTransformation(colorFilter))

View File

@ -73,26 +73,30 @@ class BiometricHelper @Inject constructor(
/**
* Returns true if a weak biometric method (i.e.: some face or iris unlock implementations) can be used.
*/
val canUseWeakBiometricAuth: Boolean get() =
val canUseWeakBiometricAuth: Boolean
get() =
configuration.isWeakBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_WEAK) == BIOMETRIC_SUCCESS
/**
* Returns true if a strong biometric method (i.e.: fingerprint, some face or iris unlock implementations) can be used.
*/
val canUseStrongBiometricAuth: Boolean get() =
val canUseStrongBiometricAuth: Boolean
get() =
configuration.isStrongBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_STRONG) == BIOMETRIC_SUCCESS
/**
* Returns true if the device credentials can be used to unlock (system pin code, password, pattern, etc.).
*/
val canUseDeviceCredentialsAuth: Boolean get() =
val canUseDeviceCredentialsAuth: Boolean
get() =
configuration.isDeviceCredentialUnlockEnabled && biometricManager.canAuthenticate(DEVICE_CREDENTIAL) == BIOMETRIC_SUCCESS
/**
* Returns true if any system authentication method (biometric weak/strong or device credentials) can be used.
*/
@VisibleForTesting(otherwise = PRIVATE)
internal val canUseAnySystemAuth: Boolean get() = canUseWeakBiometricAuth || canUseStrongBiometricAuth || canUseDeviceCredentialsAuth
internal val canUseAnySystemAuth: Boolean
get() = canUseWeakBiometricAuth || canUseStrongBiometricAuth || canUseDeviceCredentialsAuth
/**
* Returns true if any system authentication method and there is a valid associated key.