Merge pull request #6593 from vector-im/task/eric/trailing-commas

Code style change: Trailing Commas
This commit is contained in:
Eric Decanini 2022-07-20 11:46:53 +02:00 committed by GitHub
commit a0bf1787cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 134 additions and 125 deletions

View File

@ -770,7 +770,7 @@ ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = false ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_assignment_wrap = off ij_kotlin_assignment_wrap = off
ij_kotlin_blank_lines_after_class_header = 0 ij_kotlin_blank_lines_after_class_header = 0

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ import timber.log.Timber
/** /**
* Throws in debug, only log in production. * Throws in debug, only log in production.
* As this method does not always throw, next statement should be a return. * As this method does not always throw, next statement should be a return.
*/ */
internal fun fatalError(message: String) { internal fun fatalError(message: String) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
error(message) error(message)

View File

@ -70,7 +70,7 @@ class AvatarRenderer @Inject constructor(
render( render(
GlideApp.with(imageView), GlideApp.with(imageView),
matrixItem, matrixItem,
DrawableImageViewTarget(imageView) DrawableImageViewTarget(imageView),
) )
} }
@ -103,7 +103,7 @@ class AvatarRenderer @Inject constructor(
render( render(
glideRequests, glideRequests,
matrixItem, matrixItem,
DrawableImageViewTarget(imageView) DrawableImageViewTarget(imageView),
) )
} }
@ -123,7 +123,7 @@ class AvatarRenderer @Inject constructor(
val matrixItem = MatrixItem.UserItem( val matrixItem = MatrixItem.UserItem(
// Need an id starting with @ // Need an id starting with @
id = "@${mappedContact.displayName}", id = "@${mappedContact.displayName}",
displayName = mappedContact.displayName displayName = mappedContact.displayName,
) )
val placeholder = getPlaceholderDrawable(matrixItem) val placeholder = getPlaceholderDrawable(matrixItem)
@ -140,7 +140,7 @@ class AvatarRenderer @Inject constructor(
val matrixItem = MatrixItem.UserItem( val matrixItem = MatrixItem.UserItem(
// Need an id starting with @ // Need an id starting with @
id = profileInfo.matrixId, id = profileInfo.matrixId,
displayName = profileInfo.displayName displayName = profileInfo.displayName,
) )
val placeholder = getPlaceholderDrawable(matrixItem) val placeholder = getPlaceholderDrawable(matrixItem)
@ -215,7 +215,7 @@ class AvatarRenderer @Inject constructor(
.bold() .bold()
.endConfig() .endConfig()
.buildRect(matrixItem.firstLetterOfDisplayName(), avatarColor) .buildRect(matrixItem.firstLetterOfDisplayName(), avatarColor)
.toBitmap(width = iconSize, height = iconSize) .toBitmap(width = iconSize, height = iconSize),
) )
} }
} }
@ -231,7 +231,7 @@ class AvatarRenderer @Inject constructor(
addPlaceholder: Boolean addPlaceholder: Boolean
) { ) {
val transformations = mutableListOf<Transformation<Bitmap>>( val transformations = mutableListOf<Transformation<Bitmap>>(
BlurTransformation(20, sampling) BlurTransformation(20, sampling),
) )
if (colorFilter != null) { if (colorFilter != null) {
transformations.add(ColorFilterTransformation(colorFilter)) 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. * 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 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. * 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 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.). * 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 configuration.isDeviceCredentialUnlockEnabled && biometricManager.canAuthenticate(DEVICE_CREDENTIAL) == BIOMETRIC_SUCCESS
/** /**
* Returns true if any system authentication method (biometric weak/strong or device credentials) can be used. * Returns true if any system authentication method (biometric weak/strong or device credentials) can be used.
*/ */
@VisibleForTesting(otherwise = PRIVATE) @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. * Returns true if any system authentication method and there is a valid associated key.