From cc1e1fe8eb56795add763aaa499e69d2045385d8 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 19 Jul 2022 14:51:07 +0200 Subject: [PATCH 1/2] Enables trailing comma editor config --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 231d35cfe4..4f23d46afd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -770,7 +770,7 @@ ij_kotlin_align_multiline_extends_list = false ij_kotlin_align_multiline_method_parentheses = false ij_kotlin_align_multiline_parameters = true 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_assignment_wrap = off ij_kotlin_blank_lines_after_class_header = 0 From 8c53d2f9b06b3c16e57f52608809696e134dc9a0 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 19 Jul 2022 15:11:42 +0200 Subject: [PATCH 2/2] Reformats modules --- .../registration/DefaultRegistrationWizard.kt | 44 +++++++++---------- .../sdk/internal/crypto/MXOlmDevice.kt | 22 +++++----- .../megolm/MXMegolmDecryptionFactory.kt | 3 +- .../algorithms/megolm/MXMegolmEncryption.kt | 6 ++- .../matrix/android/sdk/internal/util/fatal.kt | 2 +- .../analytics/extensions/SignUpExt.kt | 6 +-- .../app/features/home/AvatarRenderer.kt | 12 ++--- .../vector/app/features/home/HomeActivity.kt | 2 +- .../home/room/detail/TimelineFragment.kt | 4 +- .../timeline/factory/EncryptionItemFactory.kt | 4 +- .../home/room/list/RoomListViewModel.kt | 22 +++++----- .../app/features/html/EventHtmlRenderer.kt | 40 ++++++++--------- ...iveLocationLabsFlagPromotionBottomSheet.kt | 2 +- .../onboarding/AuthenticationDescription.kt | 14 +++--- .../onboarding/OnboardingViewModel.kt | 2 +- .../onboarding/ftueauth/FtueExtensions.kt | 2 +- .../biometrics/BiometricAuthError.kt | 2 +- .../lockscreen/biometrics/BiometricHelper.kt | 30 +++++++------ .../crypto/LockScreenKeyRepository.kt | 2 +- .../pin/lockscreen/ui/LockScreenFragment.kt | 8 ++-- .../pin/lockscreen/ui/LockScreenViewModel.kt | 2 +- .../pin/lockscreen/utils/DevicePromptCheck.kt | 8 ++-- .../settings/font/FontScaleSettingFragment.kt | 2 +- .../signout/soft/SoftLogoutController.kt | 20 ++++----- 24 files changed, 135 insertions(+), 126 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt index 56425cbc74..46ebbb7b71 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/DefaultRegistrationWizard.kt @@ -37,9 +37,9 @@ import org.matrix.android.sdk.internal.auth.db.PendingSessionData * This class execute the registration request and is responsible to keep the session of interactive authentication. */ internal class DefaultRegistrationWizard( - authAPI: AuthAPI, - private val sessionCreator: SessionCreator, - private val pendingSessionStore: PendingSessionStore + authAPI: AuthAPI, + private val sessionCreator: SessionCreator, + private val pendingSessionStore: PendingSessionStore ) : RegistrationWizard { private var pendingSessionData: PendingSessionData = pendingSessionStore.getPendingSessionData() ?: error("Pending session data should exist here") @@ -74,20 +74,20 @@ internal class DefaultRegistrationWizard( initialDeviceDisplayName: String? ): RegistrationResult { val params = RegistrationParams( - username = userName, - password = password, - initialDeviceDisplayName = initialDeviceDisplayName + username = userName, + password = password, + initialDeviceDisplayName = initialDeviceDisplayName ) return performRegistrationRequest(params, LoginType.PASSWORD) - .also { - pendingSessionData = pendingSessionData.copy(isRegistrationStarted = true) - .also { pendingSessionStore.savePendingSessionData(it) } - } + .also { + pendingSessionData = pendingSessionData.copy(isRegistrationStarted = true) + .also { pendingSessionStore.savePendingSessionData(it) } + } } override suspend fun performReCaptcha(response: String): RegistrationResult { val safeSession = pendingSessionData.currentSession - ?: throw IllegalStateException("developer error, call createAccount() method first") + ?: throw IllegalStateException("developer error, call createAccount() method first") val params = RegistrationParams(auth = AuthParams.createForCaptcha(safeSession, response)) return performRegistrationRequest(params, LoginType.PASSWORD) @@ -95,7 +95,7 @@ internal class DefaultRegistrationWizard( override suspend fun acceptTerms(): RegistrationResult { val safeSession = pendingSessionData.currentSession - ?: throw IllegalStateException("developer error, call createAccount() method first") + ?: throw IllegalStateException("developer error, call createAccount() method first") val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.TERMS, session = safeSession)) return performRegistrationRequest(params, LoginType.PASSWORD) @@ -103,14 +103,14 @@ internal class DefaultRegistrationWizard( override suspend fun addThreePid(threePid: RegisterThreePid): RegistrationResult { pendingSessionData = pendingSessionData.copy(currentThreePidData = null) - .also { pendingSessionStore.savePendingSessionData(it) } + .also { pendingSessionStore.savePendingSessionData(it) } return sendThreePid(threePid) } override suspend fun sendAgainThreePid(): RegistrationResult { val safeCurrentThreePid = pendingSessionData.currentThreePidData?.threePid - ?: throw IllegalStateException("developer error, call createAccount() method first") + ?: throw IllegalStateException("developer error, call createAccount() method first") return sendThreePid(safeCurrentThreePid) } @@ -126,7 +126,7 @@ internal class DefaultRegistrationWizard( ) pendingSessionData = pendingSessionData.copy(sendAttempt = pendingSessionData.sendAttempt + 1) - .also { pendingSessionStore.savePendingSessionData(it) } + .also { pendingSessionStore.savePendingSessionData(it) } val params = RegistrationParams( auth = if (threePid is RegisterThreePid.Email) { @@ -149,7 +149,7 @@ internal class DefaultRegistrationWizard( ) // Store data pendingSessionData = pendingSessionData.copy(currentThreePidData = ThreePidData.from(threePid, response, params)) - .also { pendingSessionStore.savePendingSessionData(it) } + .also { pendingSessionStore.savePendingSessionData(it) } // and send the sid a first time return performRegistrationRequest(params, LoginType.PASSWORD) @@ -157,7 +157,7 @@ internal class DefaultRegistrationWizard( override suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult { val safeParam = pendingSessionData.currentThreePidData?.registrationParams - ?: throw IllegalStateException("developer error, no pending three pid") + ?: throw IllegalStateException("developer error, no pending three pid") return performRegistrationRequest(safeParam, LoginType.PASSWORD, delayMillis) } @@ -168,13 +168,13 @@ internal class DefaultRegistrationWizard( private suspend fun validateThreePid(code: String): RegistrationResult { val registrationParams = pendingSessionData.currentThreePidData?.registrationParams - ?: throw IllegalStateException("developer error, no pending three pid") + ?: throw IllegalStateException("developer error, no pending three pid") val safeCurrentData = pendingSessionData.currentThreePidData ?: throw IllegalStateException("developer error, call createAccount() method first") val url = safeCurrentData.addThreePidRegistrationResponse.submitUrl ?: throw IllegalStateException("Missing url to send the code") val validationBody = ValidationCodeBody( - clientSecret = pendingSessionData.clientSecret, - sid = safeCurrentData.addThreePidRegistrationResponse.sid, - code = code + clientSecret = pendingSessionData.clientSecret, + sid = safeCurrentData.addThreePidRegistrationResponse.sid, + code = code ) val validationResponse = validateCodeTask.execute(ValidateCodeTask.Params(url, validationBody)) if (validationResponse.isSuccess()) { @@ -189,7 +189,7 @@ internal class DefaultRegistrationWizard( override suspend fun dummy(): RegistrationResult { val safeSession = pendingSessionData.currentSession - ?: throw IllegalStateException("developer error, call createAccount() method first") + ?: throw IllegalStateException("developer error, call createAccount() method first") val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.DUMMY, session = safeSession)) return performRegistrationRequest(params, LoginType.PASSWORD) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt index c4a6488258..0e511e14c2 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt @@ -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, - sessionKey: String, - roomId: String, - senderKey: String, - forwardingCurve25519KeyChain: List, - keysClaimed: Map, - exportFormat: Boolean, - sharedHistory: Boolean): AddSessionResult { + fun addInboundGroupSession( + sessionId: String, + sessionKey: String, + roomId: String, + senderKey: String, + forwardingCurve25519KeyChain: List, + keysClaimed: Map, + exportFormat: Boolean, + sharedHistory: Boolean + ): AddSessionResult { val candidateSession = tryOrNull("Failed to create inbound session in room $roomId") { if (exportFormat) { OlmInboundGroupSession.importSession(sessionKey) @@ -701,8 +703,8 @@ internal class MXOlmDevice @Inject constructor( val senderKey = megolmSessionData.senderKey ?: continue val roomId = megolmSessionData.roomId - val candidateSessionToImport = try { - MXInboundMegolmSessionWrapper.newFromMegolmData(megolmSessionData, true) + val candidateSessionToImport = try { + MXInboundMegolmSessionWrapper.newFromMegolmData(megolmSessionData, true) } catch (e: Throwable) { Timber.tag(loggerTag.value).e(e, "## importInboundGroupSession() : Failed to import session $senderKey/$sessionId") continue diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt index 414416a0f6..38edbb7430 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryptionFactory.kt @@ -38,6 +38,7 @@ internal class MXMegolmDecryptionFactory @Inject constructor( outgoingKeyRequestManager, cryptoStore, matrixConfiguration, - eventsManager) + eventsManager + ) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt index 48a25f2a8b..ceaee582c7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt @@ -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>) { + private suspend fun shareUserDevicesKey( + sessionInfo: MXOutboundSessionInfo, + devicesByUser: Map> + ) { val sessionKey = olmDevice.getSessionKey(sessionInfo.sessionId) ?: return Unit.also { Timber.tag(loggerTag.value).v("shareUserDevicesKey() Failed to share session, failed to export") } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/fatal.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/fatal.kt index 323eee0b1c..7ed807d7cc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/fatal.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/fatal.kt @@ -22,7 +22,7 @@ import timber.log.Timber /** * Throws in debug, only log in production. * As this method does not always throw, next statement should be a return. -*/ + */ internal fun fatalError(message: String) { if (BuildConfig.DEBUG) { error(message) diff --git a/vector/src/main/java/im/vector/app/features/analytics/extensions/SignUpExt.kt b/vector/src/main/java/im/vector/app/features/analytics/extensions/SignUpExt.kt index e63aafbfc4..d71e52de8c 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/extensions/SignUpExt.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/extensions/SignUpExt.kt @@ -21,11 +21,11 @@ import im.vector.app.features.onboarding.AuthenticationDescription fun AuthenticationDescription.AuthenticationType.toAnalyticsType() = when (this) { AuthenticationDescription.AuthenticationType.Password -> Signup.AuthenticationType.Password - AuthenticationDescription.AuthenticationType.Apple -> Signup.AuthenticationType.Apple + AuthenticationDescription.AuthenticationType.Apple -> Signup.AuthenticationType.Apple AuthenticationDescription.AuthenticationType.Facebook -> Signup.AuthenticationType.Facebook AuthenticationDescription.AuthenticationType.GitHub -> Signup.AuthenticationType.GitHub AuthenticationDescription.AuthenticationType.GitLab -> Signup.AuthenticationType.GitLab AuthenticationDescription.AuthenticationType.Google -> Signup.AuthenticationType.Google - AuthenticationDescription.AuthenticationType.SSO -> Signup.AuthenticationType.SSO - AuthenticationDescription.AuthenticationType.Other -> Signup.AuthenticationType.Other + AuthenticationDescription.AuthenticationType.SSO -> Signup.AuthenticationType.SSO + AuthenticationDescription.AuthenticationType.Other -> Signup.AuthenticationType.Other } diff --git a/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt b/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt index 4b32f3307f..f4ffbb826a 100644 --- a/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt @@ -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>( - BlurTransformation(20, sampling) + BlurTransformation(20, sampling), ) if (colorFilter != null) { transformations.add(ColorFilterTransformation(colorFilter)) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index d82621977f..926c1eb113 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -219,7 +219,7 @@ class HomeActivity : is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId) is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId) HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK) - HomeActivitySharedAction.OnCloseSpace -> onCloseSpace() + HomeActivitySharedAction.OnCloseSpace -> onCloseSpace() } } .launchIn(lifecycleScope) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index e86a7fe227..19c946b8d7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -1706,7 +1706,7 @@ class TimelineFragment @Inject constructor( private fun renderToolbar(roomSummary: RoomSummary?) { when { - isLocalRoom() -> { + isLocalRoom() -> { views.includeRoomToolbar.roomToolbarContentView.isVisible = false views.includeThreadToolbar.roomToolbarThreadConstraintLayout.isVisible = false setupToolbar(views.roomToolbar) @@ -1724,7 +1724,7 @@ class TimelineFragment @Inject constructor( } views.includeThreadToolbar.roomToolbarThreadTitleTextView.text = resources.getText(R.string.thread_timeline_title) } - else -> { + else -> { views.includeRoomToolbar.roomToolbarContentView.isVisible = true views.includeThreadToolbar.roomToolbarThreadConstraintLayout.isVisible = false if (roomSummary == null) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt index 5f32696334..69b4f6e039 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt @@ -63,10 +63,10 @@ class EncryptionItemFactory @Inject constructor( isDirect && RoomLocalEcho.isLocalEchoId(event.root.roomId.orEmpty()) -> { R.string.direct_room_encryption_enabled_tile_description_future } - isDirect -> { + isDirect -> { R.string.direct_room_encryption_enabled_tile_description } - else -> { + else -> { R.string.encryption_enabled_tile_description } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewModel.kt index 44d61f9ed2..77f7c148d9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListViewModel.kt @@ -146,17 +146,17 @@ class RoomListViewModel @AssistedInject constructor( companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() private val roomListSectionBuilder = RoomListSectionBuilder( - session, - stringProvider, - appStateHandler, - viewModelScope, - autoAcceptInvites, - { - updatableQuery = it - }, - suggestedRoomJoiningState, - !vectorPreferences.prefSpacesShowAllRoomInHome() - ) + session, + stringProvider, + appStateHandler, + viewModelScope, + autoAcceptInvites, + { + updatableQuery = it + }, + suggestedRoomJoiningState, + !vectorPreferences.prefSpacesShowAllRoomInHome() + ) val sections: List by lazy { roomListSectionBuilder.buildSections(initialState.displayMode) diff --git a/vector/src/main/java/im/vector/app/features/html/EventHtmlRenderer.kt b/vector/src/main/java/im/vector/app/features/html/EventHtmlRenderer.kt index 412b28862a..725f23cddd 100644 --- a/vector/src/main/java/im/vector/app/features/html/EventHtmlRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/html/EventHtmlRenderer.kt @@ -85,27 +85,27 @@ class EventHtmlRenderer @Inject constructor( } else { builder } - .usePlugin( - MarkwonInlineParserPlugin.create( - /* Configuring the Markwon inline formatting processor. - * Default settings are all Markdown features. Turn those off, only using the - * inline HTML processor and HTML entities processor. - */ - MarkwonInlineParser.factoryBuilderNoDefaults() - .addInlineProcessor(HtmlInlineProcessor()) // use inline HTML processor - .addInlineProcessor(EntityInlineProcessor()) // use HTML entities processor + .usePlugin( + MarkwonInlineParserPlugin.create( + /* Configuring the Markwon inline formatting processor. + * Default settings are all Markdown features. Turn those off, only using the + * inline HTML processor and HTML entities processor. + */ + MarkwonInlineParser.factoryBuilderNoDefaults() + .addInlineProcessor(HtmlInlineProcessor()) // use inline HTML processor + .addInlineProcessor(EntityInlineProcessor()) // use HTML entities processor + ) ) - ) - .usePlugin(object : AbstractMarkwonPlugin() { - override fun configureParser(builder: Parser.Builder) { - /* Configuring the Markwon block formatting processor. - * Default settings are all Markdown blocks. Turn those off. - */ - builder.enabledBlockTypes(kotlin.collections.emptySet()) - } - }) - .textSetter(PrecomputedFutureTextSetterCompat.create()) - .build() + .usePlugin(object : AbstractMarkwonPlugin() { + override fun configureParser(builder: Parser.Builder) { + /* Configuring the Markwon block formatting processor. + * Default settings are all Markdown blocks. Turn those off. + */ + builder.enabledBlockTypes(kotlin.collections.emptySet()) + } + }) + .textSetter(PrecomputedFutureTextSetterCompat.create()) + .build() val plugins: List = markwon.plugins diff --git a/vector/src/main/java/im/vector/app/features/location/live/LiveLocationLabsFlagPromotionBottomSheet.kt b/vector/src/main/java/im/vector/app/features/location/live/LiveLocationLabsFlagPromotionBottomSheet.kt index cf360ec277..be8e774ad0 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/LiveLocationLabsFlagPromotionBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/LiveLocationLabsFlagPromotionBottomSheet.kt @@ -29,7 +29,7 @@ import im.vector.app.databinding.BottomSheetLiveLocationLabsFlagPromotionBinding * This should not be shown if the user already enabled the labs flag. */ class LiveLocationLabsFlagPromotionBottomSheet : - VectorBaseBottomSheetDialogFragment() { + VectorBaseBottomSheetDialogFragment() { override val showExpanded = true diff --git a/vector/src/main/java/im/vector/app/features/onboarding/AuthenticationDescription.kt b/vector/src/main/java/im/vector/app/features/onboarding/AuthenticationDescription.kt index 3672b8eef3..c540871ab7 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/AuthenticationDescription.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/AuthenticationDescription.kt @@ -41,12 +41,12 @@ sealed interface AuthenticationDescription : Parcelable { } fun SsoIdentityProvider?.toAuthenticationType() = when (this?.brand) { - SsoIdentityProvider.BRAND_GOOGLE -> AuthenticationType.Google - SsoIdentityProvider.BRAND_GITHUB -> AuthenticationType.GitHub - SsoIdentityProvider.BRAND_APPLE -> AuthenticationType.Apple + SsoIdentityProvider.BRAND_GOOGLE -> AuthenticationType.Google + SsoIdentityProvider.BRAND_GITHUB -> AuthenticationType.GitHub + SsoIdentityProvider.BRAND_APPLE -> AuthenticationType.Apple SsoIdentityProvider.BRAND_FACEBOOK -> AuthenticationType.Facebook - SsoIdentityProvider.BRAND_GITLAB -> AuthenticationType.GitLab - SsoIdentityProvider.BRAND_TWITTER -> AuthenticationType.SSO - null -> AuthenticationType.SSO - else -> AuthenticationType.SSO + SsoIdentityProvider.BRAND_GITLAB -> AuthenticationType.GitLab + SsoIdentityProvider.BRAND_TWITTER -> AuthenticationType.SSO + null -> AuthenticationType.SSO + else -> AuthenticationType.SSO } diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt index 27c501176e..a7316584b2 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt @@ -511,7 +511,7 @@ class OnboardingViewModel @AssistedInject constructor( setState { copy(isLoading = false, resetState = ResetState()) } val nextEvent = when { vectorFeatures.isOnboardingCombinedLoginEnabled() -> OnboardingViewEvents.OnResetPasswordComplete - else -> OnboardingViewEvents.OpenResetPasswordComplete + else -> OnboardingViewEvents.OpenResetPasswordComplete } _viewEvents.post(nextEvent) }, diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueExtensions.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueExtensions.kt index 8deb10b7b8..074b6be88d 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueExtensions.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueExtensions.kt @@ -53,6 +53,6 @@ fun observeContentChangesAndResetErrors(username: TextInputLayout, password: Tex } fun ThemeProvider.ftueBreakerBackground() = when (isLightTheme()) { - true -> R.drawable.bg_gradient_ftue_breaker + true -> R.drawable.bg_gradient_ftue_breaker false -> R.drawable.bg_color_background } diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricAuthError.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricAuthError.kt index 1b7d35879e..7a293d022e 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricAuthError.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricAuthError.kt @@ -33,6 +33,6 @@ class BiometricAuthError(val code: Int, message: String) : Throwable(message) { val isAuthPermanentlyDisabledError: Boolean get() = code == BiometricPrompt.ERROR_LOCKOUT_PERMANENT companion object { - private val LOCKOUT_ERROR_CODES = arrayOf(BiometricPrompt.ERROR_LOCKOUT, BiometricPrompt.ERROR_LOCKOUT_PERMANENT) + private val LOCKOUT_ERROR_CODES = arrayOf(BiometricPrompt.ERROR_LOCKOUT, BiometricPrompt.ERROR_LOCKOUT_PERMANENT) } } diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt index 1b510f5983..a34b284193 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/biometrics/BiometricHelper.kt @@ -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() = - configuration.isWeakBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_WEAK) == BIOMETRIC_SUCCESS + 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() = - configuration.isStrongBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_STRONG) == BIOMETRIC_SUCCESS + 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() = - configuration.isDeviceCredentialUnlockEnabled && biometricManager.canAuthenticate(DEVICE_CREDENTIAL) == BIOMETRIC_SUCCESS + 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. @@ -153,9 +157,9 @@ class BiometricHelper @Inject constructor( @SuppressLint("NewApi") @OptIn(ExperimentalCoroutinesApi::class) private fun authenticateInternal( - activity: FragmentActivity, - checkSystemKeyExists: Boolean, - cryptoObject: BiometricPrompt.CryptoObject? = null, + activity: FragmentActivity, + checkSystemKeyExists: Boolean, + cryptoObject: BiometricPrompt.CryptoObject? = null, ): Flow { if (checkSystemKeyExists && !isSystemAuthEnabledAndValid) return flowOf(false) @@ -189,9 +193,9 @@ class BiometricHelper @Inject constructor( @VisibleForTesting(otherwise = PRIVATE) internal fun authenticateWithPromptInternal( - activity: FragmentActivity, - cryptoObject: BiometricPrompt.CryptoObject? = null, - channel: Channel, + activity: FragmentActivity, + cryptoObject: BiometricPrompt.CryptoObject? = null, + channel: Channel, ): BiometricPrompt { val executor = ContextCompat.getMainExecutor(context) val callback = createSuspendingAuthCallback(channel, executor.asCoroutineDispatcher()) diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/crypto/LockScreenKeyRepository.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/crypto/LockScreenKeyRepository.kt index a8690f69d2..4a7bce8a52 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/crypto/LockScreenKeyRepository.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/crypto/LockScreenKeyRepository.kt @@ -36,7 +36,7 @@ class LockScreenKeyRepository( private val systemKeyAlias = "$baseName.system" private val pinCodeCrypto: KeyStoreCrypto by lazy { - keyStoreCryptoFactory.provide(pinCodeKeyAlias, keyNeedsUserAuthentication = false) + keyStoreCryptoFactory.provide(pinCodeKeyAlias, keyNeedsUserAuthentication = false) } private val systemKeyCrypto: KeyStoreCrypto by lazy { keyStoreCryptoFactory.provide(systemKeyAlias, keyNeedsUserAuthentication = true) diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenFragment.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenFragment.kt index 764da8cceb..0e6fdfb61e 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenFragment.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenFragment.kt @@ -114,15 +114,15 @@ class LockScreenFragment : VectorBaseFragment() { private fun handleEvent(viewEvent: LockScreenViewEvent) { when (viewEvent) { is LockScreenViewEvent.CodeCreationComplete -> lockScreenListener?.onPinCodeCreated() - is LockScreenViewEvent.ClearPinCode -> { + is LockScreenViewEvent.ClearPinCode -> { if (viewEvent.confirmationFailed) { lockScreenListener?.onNewCodeValidationFailed() } views.codeView.clearCode() } - is LockScreenViewEvent.AuthSuccessful -> lockScreenListener?.onAuthenticationSuccess(viewEvent.method) - is LockScreenViewEvent.AuthFailure -> onAuthFailure(viewEvent.method) - is LockScreenViewEvent.AuthError -> onAuthError(viewEvent.method, viewEvent.throwable) + is LockScreenViewEvent.AuthSuccessful -> lockScreenListener?.onAuthenticationSuccess(viewEvent.method) + is LockScreenViewEvent.AuthFailure -> onAuthFailure(viewEvent.method) + is LockScreenViewEvent.AuthError -> onAuthError(viewEvent.method, viewEvent.throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenViewModel.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenViewModel.kt index a240af243a..39d0937323 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/ui/LockScreenViewModel.kt @@ -94,7 +94,7 @@ class LockScreenViewModel @AssistedInject constructor( override fun handle(action: LockScreenAction) { when (action) { - is LockScreenAction.PinCodeEntered -> onPinCodeEntered(action.value) + is LockScreenAction.PinCodeEntered -> onPinCodeEntered(action.value) is LockScreenAction.ShowBiometricPrompt -> showBiometricPrompt(action.callingActivity) } } diff --git a/vector/src/main/java/im/vector/app/features/pin/lockscreen/utils/DevicePromptCheck.kt b/vector/src/main/java/im/vector/app/features/pin/lockscreen/utils/DevicePromptCheck.kt index fa1d7d5559..1760cd6c80 100644 --- a/vector/src/main/java/im/vector/app/features/pin/lockscreen/utils/DevicePromptCheck.kt +++ b/vector/src/main/java/im/vector/app/features/pin/lockscreen/utils/DevicePromptCheck.kt @@ -48,15 +48,15 @@ object DevicePromptCheck { * See [this OP forum thread](https://forums.oneplus.com/threads/oneplus-7-pro-fingerprint-biometricprompt-does-not-show.1035821/). */ private val isOnePlusDeviceWithNoBiometricUI: Boolean = - Build.BRAND.equals("OnePlus", ignoreCase = true) && - !onePlusModelsWithWorkingBiometricUI.contains(Build.MODEL) && - Build.VERSION.SDK_INT < Build.VERSION_CODES.R + Build.BRAND.equals("OnePlus", ignoreCase = true) && + !onePlusModelsWithWorkingBiometricUI.contains(Build.MODEL) && + Build.VERSION.SDK_INT < Build.VERSION_CODES.R /** * Some LG models don't seem to have a system biometric prompt at all. */ private val isLGDeviceWithNoBiometricUI: Boolean = - Build.BRAND.equals("LG", ignoreCase = true) && lgModelsWithoutBiometricUI.contains(Build.MODEL) + Build.BRAND.equals("LG", ignoreCase = true) && lgModelsWithoutBiometricUI.contains(Build.MODEL) /** * Check if this device is included in the list of devices with known Biometric Prompt issues. diff --git a/vector/src/main/java/im/vector/app/features/settings/font/FontScaleSettingFragment.kt b/vector/src/main/java/im/vector/app/features/settings/font/FontScaleSettingFragment.kt index d553c1a8ce..78c06d5969 100644 --- a/vector/src/main/java/im/vector/app/features/settings/font/FontScaleSettingFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/font/FontScaleSettingFragment.kt @@ -31,7 +31,7 @@ import javax.inject.Inject class FontScaleSettingFragment @Inject constructor( private val fontListController: FontScaleSettingController -) : VectorBaseFragment(), FontScaleSettingController.Callback { +) : VectorBaseFragment(), FontScaleSettingController.Callback { private val viewModel: FontScaleSettingViewModel by fragmentViewModel() diff --git a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt index 265cf3199e..b1a240e942 100644 --- a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt +++ b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutController.kt @@ -94,10 +94,10 @@ class SoftLogoutController @Inject constructor( } private fun buildForm(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest) { - is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error) - is Success -> buildLoginSuccessItem(state) + is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error) + is Success -> buildLoginSuccessItem(state) is Loading, Uninitialized -> buildLoadingItem() - is Incomplete -> Unit + is Incomplete -> Unit } private fun buildLoadingItem() { @@ -116,11 +116,11 @@ class SoftLogoutController @Inject constructor( } private fun buildLoginSuccessItem(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest.invoke()) { - LoginMode.Password -> buildLoginPasswordForm(state) - is LoginMode.Sso -> buildLoginSSOForm() + LoginMode.Password -> buildLoginPasswordForm(state) + is LoginMode.Sso -> buildLoginSSOForm() is LoginMode.SsoAndPassword -> disambiguateLoginSSOAndPasswordForm(state) - LoginMode.Unsupported -> buildLoginUnsupportedForm() - LoginMode.Unknown, null -> Unit // Should not happen + LoginMode.Unsupported -> buildLoginUnsupportedForm() + LoginMode.Unknown, null -> Unit // Should not happen } private fun buildLoginPasswordForm(state: SoftLogoutViewState) { @@ -148,12 +148,12 @@ class SoftLogoutController @Inject constructor( private fun disambiguateLoginSSOAndPasswordForm(state: SoftLogoutViewState) { when (state.loginType) { - LoginType.PASSWORD -> buildLoginPasswordForm(state) - LoginType.SSO -> buildLoginSSOForm() + LoginType.PASSWORD -> buildLoginPasswordForm(state) + LoginType.SSO -> buildLoginSSOForm() LoginType.DIRECT, LoginType.CUSTOM, LoginType.UNSUPPORTED -> buildLoginUnsupportedForm() - LoginType.UNKNOWN -> Unit + LoginType.UNKNOWN -> Unit } }