From 3f3662e60562ca76f954c3d7f025a05c5524c584 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Mon, 23 May 2022 12:30:42 +0200 Subject: [PATCH] Changes code style method parameters new line around parentheses to true --- .editorconfig | 1802 ++++++++--------- .../attachmentviewer/SwipeToDismissHandler.kt | 6 +- .../android/sdk/common/CommonTestHelper.kt | 45 +- .../android/sdk/common/CryptoTestData.kt | 6 +- .../sdk/common/MockOkHttpInterceptor.kt | 8 +- .../android/sdk/common/TestMatrixCallback.kt | 6 +- .../android/sdk/common/TestMatrixComponent.kt | 6 +- .../internal/crypto/ExportEncryptionTest.kt | 12 +- .../crypto/gossiping/KeyShareTests.kt | 2 +- .../crypto/keysbackup/KeysBackupTestHelper.kt | 17 +- .../keysbackup/PrepareKeysBackupDataResult.kt | 6 +- .../crypto/keysbackup/StateObserver.kt | 8 +- .../internal/crypto/verification/SASTest.kt | 18 +- .../verification/qrcode/VerificationTest.kt | 10 +- .../session/room/send/MarkdownParserTest.kt | 18 +- .../session/room/timeline/ChunkEntityTest.kt | 8 +- .../room/timeline/FakeTokenChunkEvent.kt | 9 +- .../session/room/timeline/RoomDataHelper.kt | 11 +- .../sdk/session/space/SpaceHierarchyTest.kt | 14 +- .../sdk/api/auth/AuthenticationService.kt | 24 +- .../matrix/android/sdk/api/auth/converter.kt | 6 +- .../android/sdk/api/auth/login/LoginWizard.kt | 16 +- .../auth/registration/RegistrationWizard.kt | 8 +- .../sdk/api/auth/wellknown/WellknownResult.kt | 8 +- .../sdk/api/session/account/AccountService.kt | 12 +- .../android/sdk/api/session/call/MxCall.kt | 10 +- .../sdk/api/session/crypto/CryptoService.kt | 18 +- .../sdk/api/session/crypto/MXCryptoError.kt | 14 +- .../api/session/crypto/OutgoingKeyRequest.kt | 2 +- .../crosssigning/CrossSigningService.kt | 34 +- .../crypto/keysbackup/KeysBackupService.kt | 98 +- .../KeysBackupVersionTrustSignature.kt | 3 +- .../verification/EmojiRepresentation.kt | 7 +- .../verification/VerificationService.kt | 66 +- .../sdk/api/session/events/EventService.kt | 6 +- .../sdk/api/session/file/FileService.kt | 39 +- .../session/permalinks/MatrixPermalinkSpan.kt | 6 +- .../sdk/api/session/profile/ProfileService.kt | 6 +- .../sdk/api/session/pushers/PushersService.kt | 24 +- .../session/pushrules/ConditionResolver.kt | 24 +- .../api/session/pushrules/PushRuleService.kt | 6 +- .../api/session/room/RoomDirectoryService.kt | 6 +- .../sdk/api/session/room/RoomService.kt | 48 +- .../MessageVerificationAcceptContent.kt | 14 +- .../room/model/relation/RelationService.kt | 69 +- .../sdk/api/session/room/send/SendService.kt | 20 +- .../room/threads/model/ThreadEditions.kt | 6 +- .../room/threads/model/ThreadSummary.kt | 20 +- .../sdk/api/session/search/SearchService.kt | 18 +- .../SharedSecretStorageService.kt | 22 +- .../android/sdk/api/session/space/Space.kt | 10 +- .../sdk/api/session/space/SpaceService.kt | 44 +- .../api/session/statistics/StatisticEvent.kt | 18 +- .../sync/model/RoomSyncUnreadNotifications.kt | 3 +- .../sdk/api/session/terms/TermsResponse.kt | 6 +- .../sdk/api/session/terms/TermsService.kt | 10 +- .../matrix/android/sdk/api/util/MatrixItem.kt | 58 +- .../android/sdk/internal/SessionManager.kt | 6 +- .../android/sdk/internal/auth/AuthAPI.kt | 12 +- .../android/sdk/internal/auth/AuthModule.kt | 8 +- .../auth/DefaultAuthenticationService.kt | 24 +- .../internal/auth/data/PasswordLoginParams.kt | 37 +- .../auth/db/RealmPendingSessionStore.kt | 7 +- .../auth/db/RealmSessionParamsStore.kt | 7 +- .../internal/auth/login/DefaultLoginWizard.kt | 10 +- .../registration/DefaultRegistrationWizard.kt | 8 +- .../auth/registration/ThreePidData.kt | 8 +- .../sdk/internal/auth/registration/UIAExt.kt | 8 +- .../sdk/internal/crypto/CryptoModule.kt | 10 +- .../internal/crypto/DefaultCryptoService.kt | 34 +- .../crypto/InboundGroupSessionStore.kt | 3 +- .../crypto/IncomingKeyRequestManager.kt | 8 +- .../sdk/internal/crypto/MXOlmDevice.kt | 28 +- .../sdk/internal/crypto/ObjectSigner.kt | 6 +- .../crypto/OutgoingKeyRequestManager.kt | 33 +- .../EnsureOlmSessionsForDevicesAction.kt | 3 +- .../EnsureOlmSessionsForUsersAction.kt | 8 +- .../actions/MegolmSessionDataImporter.kt | 19 +- .../crypto/actions/MessageEncrypter.kt | 3 +- .../actions/SetDeviceVerificationAction.kt | 3 +- .../crypto/algorithms/IMXGroupEncryption.kt | 10 +- .../algorithms/megolm/MXMegolmDecryption.kt | 13 +- .../megolm/MXMegolmDecryptionFactory.kt | 3 +- .../algorithms/megolm/MXMegolmEncryption.kt | 40 +- .../algorithms/megolm/SharedWithHelper.kt | 3 +- .../crypto/algorithms/olm/MXOlmDecryption.kt | 3 +- .../algorithms/olm/MXOlmDecryptionFactory.kt | 6 +- .../crypto/algorithms/olm/MXOlmEncryption.kt | 3 +- .../algorithms/olm/MXOlmEncryptionFactory.kt | 14 +- .../sdk/internal/crypto/api/CryptoApi.kt | 26 +- .../attachments/MXEncryptedAttachments.kt | 19 +- .../DefaultCrossSigningService.kt | 7 +- .../crypto/crosssigning/UpdateTrustWorker.kt | 10 +- .../keysbackup/DefaultKeysBackupService.kt | 108 +- .../crypto/keysbackup/KeysBackupPassword.kt | 25 +- .../crypto/keysbackup/api/RoomKeysApi.kt | 58 +- .../model/rest/KeyVerificationAccept.kt | 14 +- .../DefaultSharedSecretStorageService.kt | 22 +- .../internal/crypto/store/IMXCryptoStore.kt | 19 +- .../crypto/store/db/RealmCryptoStore.kt | 114 +- .../db/model/OlmInboundGroupSessionEntity.kt | 3 +- .../crypto/store/db/model/OlmSessionEntity.kt | 12 +- .../db/model/OutgoingKeyRequestEntity.kt | 4 +- .../store/db/query/SharedSessionQueries.kt | 28 +- .../internal/crypto/tasks/EncryptEventTask.kt | 9 +- .../internal/crypto/tasks/RedactEventTask.kt | 3 +- .../internal/crypto/tasks/SendEventTask.kt | 3 +- .../tasks/SendVerificationMessageTask.kt | 3 +- .../DefaultVerificationService.kt | 67 +- .../DefaultVerificationTransaction.kt | 11 +- .../SASDefaultVerificationTransaction.kt | 12 +- .../verification/VerificationInfoAccept.kt | 14 +- .../verification/VerificationInfoStart.kt | 3 +- .../verification/VerificationTransport.kt | 112 +- .../VerificationTransportRoomMessage.kt | 78 +- .../VerificationTransportToDevice.kt | 72 +- .../database/EventInsertLiveObserver.kt | 6 +- .../sdk/internal/database/RealmKeysUtils.kt | 6 +- .../sdk/internal/database/RealmQueryLatch.kt | 8 +- .../SessionRealmConfigurationFactory.kt | 3 +- .../database/helper/ChunkEntityHelper.kt | 12 +- .../database/helper/ThreadEventsHelper.kt | 6 +- .../database/helper/ThreadSummaryHelper.kt | 3 +- .../internal/database/mapper/EventMapper.kt | 10 +- .../database/mapper/RoomSummaryMapper.kt | 6 +- .../database/migration/MigrateSessionTo019.kt | 6 +- .../internal/database/model/ChunkEntity.kt | 3 +- .../database/model/CurrentStateEventEntity.kt | 11 +- .../internal/database/model/DraftEntity.kt | 7 +- .../internal/database/model/EventEntity.kt | 39 +- .../database/model/EventInsertEntity.kt | 15 +- .../database/model/GroupSummaryEntity.kt | 13 +- .../database/model/ReadReceiptEntity.kt | 11 +- .../sdk/internal/database/model/RoomEntity.kt | 11 +- .../database/model/RoomMemberSummaryEntity.kt | 15 +- .../sdk/internal/database/model/SyncEntity.kt | 5 +- .../database/model/TimelineEventEntity.kt | 25 +- .../database/model/UserDraftsEntity.kt | 3 +- .../sdk/internal/database/model/UserEntity.kt | 7 +- .../model/presence/UserPresenceEntity.kt | 13 +- .../model/threads/ThreadSummaryEntity.kt | 23 +- .../query/CurrentStateEventEntityQueries.kt | 48 +- .../database/query/EventEntityQueries.kt | 15 +- .../internal/database/query/PushersQueries.kt | 22 +- .../internal/database/query/ReadQueries.kt | 18 +- .../query/RoomSummaryEntityQueries.kt | 6 +- .../query/TimelineEventEntityQueries.kt | 52 +- .../sdk/internal/di/MatrixComponent.kt | 6 +- .../android/sdk/internal/di/NetworkModule.kt | 16 +- .../sdk/internal/di/WorkManagerProvider.kt | 6 +- .../internal/federation/FederationModule.kt | 8 +- .../legacy/DefaultLegacySessionImporter.kt | 2 +- .../network/NetworkCallbackStrategy.kt | 6 +- .../network/NetworkConnectivityChecker.kt | 8 +- .../internal/network/ProgressRequestBody.kt | 6 +- .../android/sdk/internal/network/Request.kt | 12 +- .../sdk/internal/network/RequestExecutor.kt | 24 +- .../internal/network/UnitConverterFactory.kt | 6 +- .../sdk/internal/network/UserAgentHolder.kt | 6 +- .../parsing/RuntimeJsonAdapterFactory.kt | 12 +- .../network/ssl/PinnedTrustManager.kt | 6 +- .../network/ssl/PinnedTrustManagerApi24.kt | 6 +- .../network/ssl/PinnedTrustManagerProvider.kt | 6 +- .../android/sdk/internal/raw/RawModule.kt | 12 +- .../internal/session/DefaultFileService.kt | 62 +- .../sdk/internal/session/SessionComponent.kt | 3 +- .../sdk/internal/session/SessionModule.kt | 49 +- .../session/account/DeactivateAccountTask.kt | 4 +- .../session/account/DefaultAccountService.kt | 6 +- .../internal/session/call/MxCallFactory.kt | 10 +- .../internal/session/call/model/MxCallImpl.kt | 10 +- .../content/DefaultContentUrlResolver.kt | 8 +- .../internal/session/content/FileUploader.kt | 38 +- .../session/content/ImageCompressor.kt | 3 +- .../session/content/UploadContentWorker.kt | 64 +- .../session/content/VideoCompressor.kt | 6 +- .../contentscanner/ContentScannerModule.kt | 8 +- .../db/ContentScannerEntityQueries.kt | 10 +- .../session/directory/DirectoryAPI.kt | 12 +- .../session/download/ProgressResponseBody.kt | 3 +- .../session/filter/DefaultFilterService.kt | 6 +- .../sdk/internal/session/filter/FilterApi.kt | 12 +- .../internal/session/group/DefaultGroup.kt | 6 +- .../GetHomeServerCapabilitiesTask.kt | 10 +- .../session/homeserver/HomeServerPinger.kt | 6 +- .../internal/session/identity/IdentityAPI.kt | 6 +- .../identity/IdentityBulkLookupTask.kt | 10 +- .../session/identity/IdentityModule.kt | 16 +- .../identity/db/IdentityDataEntityQuery.kt | 26 +- .../initsync/DefaultSyncStatusService.kt | 14 +- .../internal/session/initsync/Extensions.kt | 22 +- .../session/initsync/ProgressReporter.kt | 8 +- .../sdk/internal/session/initsync/TaskInfo.kt | 10 +- .../integrationmanager/IntegrationManager.kt | 12 +- .../session/openid/GetOpenIdTokenTask.kt | 3 +- .../sdk/internal/session/openid/OpenIdAPI.kt | 6 +- .../internal/session/presence/PresenceAPI.kt | 6 +- .../session/profile/AddThreePidTask.kt | 3 +- .../session/profile/BindThreePidsTask.kt | 12 +- .../session/profile/DefaultProfileService.kt | 40 +- .../session/profile/DeleteThreePidTask.kt | 3 +- .../profile/FinalizeAddingThreePidTask.kt | 3 +- .../session/profile/GetProfileInfoTask.kt | 6 +- .../internal/session/profile/ProfileAPI.kt | 18 +- .../profile/RefreshUserThreePidsTask.kt | 8 +- .../session/profile/SetAvatarUrlTask.kt | 3 +- .../session/profile/SetDisplayNameTask.kt | 3 +- .../session/profile/UnbindThreePidsTask.kt | 8 +- .../pushers/DefaultConditionResolver.kt | 24 +- .../session/pushers/DefaultPushersService.kt | 24 +- .../internal/session/pushers/PushRulesApi.kt | 30 +- .../session/pushers/RemovePusherTask.kt | 6 +- .../pushers/UpdatePushRuleEnableStatusTask.kt | 8 +- .../room/DefaultRoomDirectoryService.kt | 6 +- .../session/room/DefaultRoomService.kt | 36 +- .../EventRelationsAggregationProcessor.kt | 58 +- .../sdk/internal/session/room/RoomAPI.kt | 210 +- .../DefaultRoomAccountDataService.kt | 7 +- .../accountdata/RoomAccountDataDataSource.kt | 8 +- .../poll/DefaultPollAggregationProcessor.kt | 6 +- .../session/room/draft/DefaultDraftService.kt | 7 +- .../session/room/draft/DraftRepository.kt | 6 +- .../membership/RoomDisplayNameResolver.kt | 6 +- .../room/membership/RoomMemberEventHandler.kt | 66 +- .../room/membership/RoomMemberHelper.kt | 5 +- .../DefaultRoomPushRuleService.kt | 8 +- .../SetRoomNotificationStateTask.kt | 8 +- .../room/relation/DefaultRelationService.kt | 35 +- .../session/room/relation/EventEditor.kt | 32 +- .../relation/FindReactionEventForUndoTask.kt | 3 +- .../room/relation/UpdateQuickReactionTask.kt | 6 +- .../threads/FetchThreadSummariesTask.kt | 6 +- .../threads/FetchThreadTimelineTask.kt | 14 +- .../room/reporting/DefaultReportingService.kt | 5 +- .../session/room/send/DefaultSendService.kt | 28 +- .../room/send/LocalEchoEventFactory.kt | 131 +- .../session/room/send/TextContentExtension.kt | 3 +- .../session/room/send/queue/QueueMemento.kt | 12 +- .../session/room/state/DefaultStateService.kt | 11 +- .../room/state/StateEventDataSource.kt | 9 +- .../room/summary/HierarchyLiveDataHelper.kt | 3 +- .../room/summary/RoomSummaryDataSource.kt | 52 +- .../room/summary/RoomSummaryUpdater.kt | 16 +- .../room/timeline/LiveTimelineEvent.kt | 12 +- .../room/timeline/TimelineEventDataSource.kt | 10 +- .../room/timeline/TokenChunkEventPersistor.kt | 8 +- .../session/search/DefaultSearchService.kt | 18 +- .../sdk/internal/session/search/SearchAPI.kt | 6 +- .../session/signout/DefaultSignOutService.kt | 7 +- .../internal/session/space/DefaultSpace.kt | 10 +- .../session/space/DefaultSpaceService.kt | 20 +- .../sdk/internal/session/space/SpaceApi.kt | 6 +- .../sdk/internal/session/sync/SyncAPI.kt | 18 +- .../session/sync/SyncResponseHandler.kt | 8 +- .../session/sync/handler/CryptoSyncHandler.kt | 6 +- .../session/sync/handler/GroupSyncHandler.kt | 26 +- .../sync/handler/room/ReadReceiptHandler.kt | 42 +- .../sync/handler/room/RoomSyncHandler.kt | 118 +- .../handler/room/RoomTypingUsersHandler.kt | 6 +- .../handler/room/ThreadsAwarenessHandler.kt | 43 +- .../internal/session/sync/job/SyncThread.kt | 11 +- .../internal/session/sync/job/SyncWorker.kt | 20 +- .../session/sync/model/TokensChunkResponse.kt | 3 +- .../parsing/RoomSyncAccountDataHandler.kt | 6 +- .../session/terms/DefaultTermsService.kt | 16 +- .../sdk/internal/session/terms/TermsAPI.kt | 14 +- .../sdk/internal/session/terms/TermsModule.kt | 6 +- .../thirdparty/DefaultThirdPartyService.kt | 6 +- .../session/thirdparty/ThirdPartyAPI.kt | 6 +- .../session/user/DefaultUserService.kt | 18 +- .../internal/session/user/UserDataSource.kt | 6 +- .../user/accountdata/AccountDataAPI.kt | 8 +- .../accountdata/UpdateUserAccountDataTask.kt | 37 +- .../accountdata/UserAccountDataDataSource.kt | 8 +- .../session/widgets/CreateWidgetTask.kt | 10 +- .../widgets/DefaultWidgetPostAPIMediator.kt | 6 +- .../session/widgets/DefaultWidgetService.kt | 8 +- .../widgets/DefaultWidgetURLFormatter.kt | 7 +- .../internal/session/widgets/WidgetManager.kt | 26 +- .../internal/session/widgets/WidgetsAPI.kt | 12 +- .../session/widgets/WidgetsAPIProvider.kt | 6 +- .../session/widgets/helper/WidgetFactory.kt | 12 +- .../widgets/token/GetScalarTokenTask.kt | 8 +- .../sdk/internal/task/ConfigurableTask.kt | 5 +- .../sdk/internal/util/CancelableWork.kt | 6 +- .../android/sdk/internal/util/LogUtil.kt | 10 +- .../internal/util/database/RealmMigrator.kt | 6 +- .../internal/worker/MatrixWorkerFactory.kt | 8 +- .../sdk/test/fakes/FakeRequestExecutor.kt | 12 +- .../java/im/vector/app/TestMatrixCallback.kt | 6 +- .../im/vector/app/VerificationTestBase.kt | 10 +- .../im/vector/app/ui/robot/ElementRobot.kt | 2 +- .../im/vector/app/ui/robot/OnboardingRobot.kt | 10 +- .../app/fdroid/BackgroundSyncStarter.kt | 10 +- .../troubleshoot/TestAutoStartBoot.kt | 6 +- .../TestBackgroundRestrictions.kt | 6 +- .../java/im/vector/app/push/fcm/FcmHelper.kt | 10 +- .../troubleshoot/TestFirebaseToken.kt | 6 +- .../settings/troubleshoot/TestPlayServices.kt | 6 +- .../troubleshoot/TestPushFromPushGateway.kt | 12 +- .../troubleshoot/TestTokenRegistration.kt | 10 +- .../java/im/vector/app/push/fcm/FcmHelper.kt | 16 +- .../app/core/date/DateFormatterProviders.kt | 6 +- .../core/date/DefaultDateFormatterProvider.kt | 6 +- .../vector/app/core/di/ActiveSessionHolder.kt | 17 +- .../im/vector/app/core/di/SingletonModule.kt | 3 +- .../core/dialogs/ConfirmationDialogBuilder.kt | 16 +- .../app/core/dialogs/PhotoOrVideoDialog.kt | 8 +- .../dialogs/UnrecognizedCertificateDialog.kt | 34 +- .../core/dispatchers/CoroutineDispatchers.kt | 3 +- .../core/error/ResourceLimitErrorFormatter.kt | 10 +- .../im/vector/app/core/extensions/Activity.kt | 18 +- .../im/vector/app/core/extensions/Context.kt | 7 +- .../im/vector/app/core/extensions/EditText.kt | 6 +- .../app/core/extensions/RecyclerView.kt | 16 +- .../im/vector/app/core/extensions/TextView.kt | 24 +- .../im/vector/app/core/files/FileSaver.kt | 12 +- .../app/core/glide/VectorGlideModelLoader.kt | 10 +- .../vector/app/core/linkify/VectorLinkify.kt | 10 +- .../app/core/platform/VectorBaseActivity.kt | 8 +- .../livedata/SharedPreferenceLiveData.kt | 8 +- .../java/im/vector/app/core/qrcode/QrCode.kt | 6 +- .../vector/app/core/services/CallService.kt | 30 +- .../app/core/services/VectorSyncService.kt | 59 +- .../app/core/ui/views/PasswordStrengthBar.kt | 3 +- .../core/ui/views/PresenceStateImageView.kt | 2 +- .../java/im/vector/app/core/utils/Dialogs.kt | 6 +- .../core/utils/ExternalApplicationsUtil.kt | 44 +- .../vector/app/core/utils/PermissionsTools.kt | 16 +- .../vector/app/core/utils/SnapHelperUtils.kt | 3 +- .../vector/app/core/utils/SpannableUtils.kt | 6 +- .../im/vector/app/core/utils/SystemUtils.kt | 14 +- .../utils/ToggleableAppBarLayoutBehavior.kt | 50 +- .../attachments/AttachmentTypeSelectorView.kt | 7 +- .../features/attachments/AttachmentsHelper.kt | 10 +- .../app/features/auth/ReAuthActivity.kt | 12 +- .../command/AutocompleteCommandPresenter.kt | 3 +- .../emoji/AutocompleteEmojiPresenter.kt | 8 +- .../group/AutocompleteGroupPresenter.kt | 7 +- .../member/AutocompleteMemberPresenter.kt | 9 +- .../room/AutocompleteRoomPresenter.kt | 7 +- .../app/features/call/VectorCallActivity.kt | 16 +- .../call/audio/API21AudioDeviceDetector.kt | 7 +- .../call/audio/API23AudioDeviceDetector.kt | 11 +- .../call/audio/DefaultAudioDeviceRouter.kt | 5 +- .../call/conference/ConferenceEvent.kt | 6 +- .../call/conference/JitsiCallViewActions.kt | 6 +- .../call/conference/VectorJitsiActivity.kt | 6 +- .../call/conference/jwt/JitsiJWTFactory.kt | 12 +- .../features/call/dialpad/DialPadFragment.kt | 3 +- .../call/transfer/CallTransferViewModel.kt | 6 +- .../im/vector/app/features/command/Command.kt | 14 +- .../features/consent/ConsentNotGivenHelper.kt | 6 +- .../contactsbook/ContactsBookController.kt | 3 +- .../contactsbook/ContactsBookFragment.kt | 2 +- .../contactsbook/ContactsBookViewModel.kt | 6 +- .../app/features/crypto/keys/KeysImporter.kt | 8 +- .../KeysBackupRestoreSharedViewModel.kt | 4 +- .../settings/KeysBackupSettingViewState.kt | 10 +- .../settings/KeysBackupSettingsViewModel.kt | 5 +- .../crypto/keysrequest/KeyRequestHandler.kt | 14 +- .../quads/SharedSecureStorageActivity.kt | 20 +- .../quads/SharedSecureStorageViewModel.kt | 3 +- .../IncomingVerificationRequestHandler.kt | 4 +- .../verification/VerificationBottomSheet.kt | 14 +- .../VerificationBottomSheetViewModel.kt | 3 +- .../app/features/discovery/Extensions.kt | 8 +- .../change/SetIdentityServerViewModel.kt | 3 +- .../app/features/home/AvatarRenderer.kt | 40 +- .../vector/app/features/home/HomeActivity.kt | 11 +- .../home/UnreadMessagesSharedViewModel.kt | 12 +- .../room/breadcrumbs/BreadcrumbsViewModel.kt | 6 +- .../JumpToBottomViewVisibilityManager.kt | 3 +- .../home/room/detail/RoomDetailAction.kt | 11 +- .../home/room/detail/RoomDetailViewEvents.kt | 8 +- .../detail/RoomMessageTouchHelperCallback.kt | 32 +- .../ScrollOnHighlightedEventCallback.kt | 8 +- .../room/detail/ScrollOnNewMessageCallback.kt | 6 +- .../room/detail/StartCallActionsHandler.kt | 3 +- .../home/room/detail/TimelineFragment.kt | 20 +- .../detail/composer/MessageComposerView.kt | 3 +- .../DisplayReadReceiptsController.kt | 8 +- .../detail/timeline/MessageColorProvider.kt | 3 +- .../timeline/TimelineEventController.kt | 20 +- .../timeline/action/EventSharedAction.kt | 8 +- .../action/MessageActionsViewModel.kt | 36 +- .../edithistory/ViewEditHistoryViewState.kt | 3 +- .../timeline/factory/CallItemFactory.kt | 3 +- .../timeline/factory/DefaultItemFactory.kt | 20 +- .../timeline/factory/EncryptedItemFactory.kt | 16 +- .../timeline/factory/EncryptionItemFactory.kt | 3 +- .../factory/MergedHeaderItemFactory.kt | 66 +- .../timeline/factory/MessageItemFactory.kt | 3 +- .../timeline/factory/NoticeItemFactory.kt | 10 +- .../factory/ReadReceiptsItemFactory.kt | 3 +- .../timeline/factory/RoomCreateItemFactory.kt | 10 +- .../timeline/factory/TimelineItemFactory.kt | 12 +- .../timeline/factory/WidgetItemFactory.kt | 3 +- .../format/DisplayableEventFormatter.kt | 3 +- .../timeline/format/NoticeEventFormatter.kt | 12 +- .../timeline/helper/AvatarSizeProvider.kt | 6 +- .../ContentDownloadStateTrackerBinder.kt | 6 +- .../helper/ContentUploadStateTrackerBinder.kt | 26 +- .../helper/MessageInformationDataFactory.kt | 18 +- .../helper/MessageItemAttributesFactory.kt | 15 +- .../TimelineControllerInterceptorHelper.kt | 5 +- .../helper/TimelineEventDiffUtilCallback.kt | 6 +- .../helper/TimelineEventVisibilityHelper.kt | 6 +- .../helper/TimelineMediaSizeProvider.kt | 6 +- ...TimelineVisibilityStateChangedListeners.kt | 12 +- .../timeline/item/AbsMessageLocationItem.kt | 22 +- .../timeline/item/PollOptionViewState.kt | 45 +- .../detail/timeline/merged/MergedTimelines.kt | 3 +- .../reactions/ViewReactionsEpoxyController.kt | 3 +- .../reactions/ViewReactionsViewModel.kt | 3 +- .../timeline/render/EventTextRenderer.kt | 10 +- .../style/TimelineMessageLayoutFactory.kt | 20 +- .../timeline/url/PreviewUrlRetriever.kt | 6 +- .../detail/timeline/url/PreviewUrlUiState.kt | 8 +- .../detail/timeline/url/PreviewUrlView.kt | 8 +- .../detail/upgrade/MigrateRoomBottomSheet.kt | 7 +- .../detail/upgrade/MigrateRoomViewModel.kt | 3 +- .../detail/widget/RoomWidgetsController.kt | 3 +- .../room/list/RoomListSectionBuilderGroup.kt | 20 +- .../room/list/RoomListSectionBuilderSpace.kt | 34 +- .../home/room/list/RoomSummaryItemFactory.kt | 40 +- .../RoomListQuickActionsSharedAction.kt | 3 +- .../room/list/widget/NotifsFabMenuView.kt | 6 +- .../list/viewmodel/ThreadListViewModel.kt | 8 +- .../vector/app/features/html/PillImageSpan.kt | 37 +- .../app/features/html/PillsPostProcessor.kt | 10 +- .../app/features/location/UrlMapProvider.kt | 10 +- .../features/login/AbstractLoginFragment.kt | 6 +- .../vector/app/features/login/LoginAction.kt | 8 +- .../app/features/login/LoginViewModel.kt | 20 +- .../app/features/login/LoginWebFragment.kt | 6 +- .../LocalizedFlowDataLoginTermsChecked.kt | 6 +- .../features/login2/AbstractLoginFragment2.kt | 4 +- .../app/features/login2/LoginAction2.kt | 8 +- .../app/features/login2/LoginViewModel2.kt | 14 +- .../app/features/login2/LoginWebFragment2.kt | 6 +- .../features/matrixto/SpaceCardRenderer.kt | 22 +- .../media/AttachmentProviderFactory.kt | 12 +- .../features/media/ImageContentRenderer.kt | 52 +- .../vector/app/features/media/UCropHelper.kt | 10 +- .../media/VectorAttachmentViewerActivity.kt | 14 +- .../features/media/VideoContentRenderer.kt | 20 +- .../features/navigation/DefaultNavigator.kt | 84 +- .../app/features/navigation/Navigator.kt | 82 +- .../notifications/NotificationFactory.kt | 10 +- .../notifications/NotificationRenderer.kt | 20 +- .../notifications/NotificationState.kt | 6 +- .../notifications/NotificationUtils.kt | 56 +- .../notifications/RoomGroupMessageCreator.kt | 2 +- .../SummaryGroupMessageCreator.kt | 24 +- .../features/onboarding/DirectLoginUseCase.kt | 4 +- .../onboarding/OnboardingVariantFactory.kt | 9 +- .../ftueauth/AbstractFtueAuthFragment.kt | 4 +- .../FtueAuthCombinedRegisterFragment.kt | 10 +- .../ftueauth/FtueAuthUseCaseFragment.kt | 2 +- .../ftueauth/FtueAuthWebFragment.kt | 6 +- .../features/permalink/PermalinkHandler.kt | 23 +- .../app/features/popup/IncomingCallAlert.kt | 17 +- .../features/popup/VerificationVectorAlert.kt | 23 +- .../app/features/rageshake/BugReporter.kt | 22 +- .../app/features/rageshake/RageShake.kt | 12 +- .../reactions/EmojiSearchResultViewModel.kt | 3 +- .../features/reactions/widget/CircleView.kt | 6 +- .../app/features/reactions/widget/DotsView.kt | 6 +- .../reactions/widget/ReactionButton.kt | 10 +- .../room/RequireActiveMembershipViewModel.kt | 3 +- .../roomdirectory/PublicRoomsController.kt | 8 +- .../createroom/CreateRoomActivity.kt | 12 +- .../createroom/CreateRoomController.kt | 6 +- .../createroom/CreateSubSpaceController.kt | 6 +- .../picker/RoomDirectoryListCreator.kt | 6 +- .../picker/RoomDirectoryPickerController.kt | 2 +- .../picker/RoomDirectoryPickerFragment.kt | 3 +- .../RoomMemberProfileController.kt | 4 +- .../devices/DeviceListBottomSheetViewModel.kt | 6 +- .../devices/DeviceListEpoxyController.kt | 10 +- .../devices/DeviceTrustInfoEpoxyController.kt | 10 +- .../powerlevel/EditPowerLevelDialogs.kt | 10 +- .../roomprofile/alias/RoomAliasViewModel.kt | 6 +- .../alias/detail/RoomAliasBottomSheet.kt | 12 +- .../RoomAliasBottomSheetSharedAction.kt | 3 +- .../banned/RoomBannedMemberListViewModel.kt | 8 +- .../members/RoomMemberListController.kt | 10 +- .../members/RoomMemberListFragment.kt | 2 +- .../members/RoomMemberListViewModel.kt | 8 +- .../permissions/EditablePermission.kt | 7 +- .../permissions/RoomPermissionsController.kt | 10 +- .../permissions/RoomPermissionsViewModel.kt | 8 +- .../settings/RoomSettingsViewModel.kt | 8 +- .../settings/RoomSettingsViewState.kt | 6 +- .../joinrule/RoomJoinRuleBottomSheet.kt | 13 +- .../DeactivateAccountViewModel.kt | 6 +- .../CrossSigningSettingsViewModel.kt | 8 +- ...ceVerificationInfoBottomSheetController.kt | 3 +- ...iceVerificationInfoBottomSheetViewModel.kt | 5 +- .../settings/devices/DevicesController.kt | 24 +- .../features/settings/devices/TrustUtils.kt | 10 +- .../settings/devtools/AccountDataViewModel.kt | 6 +- .../GossipingEventsPaperTrailViewModel.kt | 6 +- .../devtools/GossipingEventsSerializer.kt | 8 +- .../devtools/KeyRequestListViewModel.kt | 6 +- .../settings/devtools/KeyRequestViewModel.kt | 3 +- .../ignored/IgnoredUsersController.kt | 6 +- .../settings/push/PushGatewaysViewModel.kt | 6 +- .../troubleshoot/TestAccountSettings.kt | 6 +- .../troubleshoot/TestDeviceSettings.kt | 6 +- .../settings/troubleshoot/TestNotification.kt | 8 +- .../troubleshoot/TestPushRulesSettings.kt | 6 +- .../troubleshoot/TestSystemSettings.kt | 6 +- .../features/share/IncomingShareController.kt | 6 +- .../features/share/IncomingShareViewEvents.kt | 8 +- .../features/share/IncomingShareViewModel.kt | 13 +- .../app/features/spaces/SpaceListViewModel.kt | 13 +- .../features/spaces/SpaceSummaryController.kt | 24 +- .../invite/SpaceInviteBottomSheetViewModel.kt | 2 +- .../leave/SpaceLeaveAdvancedFragment.kt | 3 +- .../people/SpacePeopleListController.kt | 4 +- .../features/spaces/preview/SpaceTabView.kt | 8 +- .../spaces/share/ShareSpaceViewModel.kt | 3 +- .../app/features/sync/widget/SyncStateView.kt | 9 +- .../features/themes/ActivityOtherThemes.kt | 6 +- .../usercode/UserCodeSharedViewModel.kt | 3 +- .../userdirectory/UserListController.kt | 12 +- .../webview/ConsentWebViewEventListener.kt | 8 +- .../features/webview/VectorWebViewActivity.kt | 10 +- .../features/widgets/WidgetPostAPIHandler.kt | 8 +- .../app/features/widgets/WidgetViewModel.kt | 10 +- .../RoomWidgetPermissionViewModel.kt | 6 +- .../permissions/WidgetPermissionsHelper.kt | 6 +- .../signout/ServerBackupStatusViewModel.kt | 6 +- .../notifications/NotificationRendererTest.kt | 12 +- .../app/test/fakes/FakeNotificationFactory.kt | 20 +- .../test/fakes/FakeRoomGroupMessageCreator.kt | 10 +- .../fakes/FakeSharedSecretStorageService.kt | 12 +- 539 files changed, 5638 insertions(+), 3997 deletions(-) diff --git a/.editorconfig b/.editorconfig index 140cc085c5..4640e50d15 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,901 +1,901 @@ -[*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = space -insert_final_newline = true -max_line_length = 160 -tab_width = 4 -ij_continuation_indent_size = 8 -ij_formatter_off_tag = @formatter:off -ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = false -ij_smart_tabs = false -ij_visual_guides = none -ij_wrap_on_typing = false - -[*.java] -ij_java_align_consecutive_assignments = false -ij_java_align_consecutive_variable_declarations = false -ij_java_align_group_field_declarations = false -ij_java_align_multiline_annotation_parameters = false -ij_java_align_multiline_array_initializer_expression = false -ij_java_align_multiline_assignment = false -ij_java_align_multiline_binary_operation = false -ij_java_align_multiline_chained_methods = false -ij_java_align_multiline_extends_list = false -ij_java_align_multiline_for = true -ij_java_align_multiline_method_parentheses = false -ij_java_align_multiline_parameters = true -ij_java_align_multiline_parameters_in_calls = false -ij_java_align_multiline_parenthesized_expression = false -ij_java_align_multiline_records = true -ij_java_align_multiline_resources = true -ij_java_align_multiline_ternary_operation = false -ij_java_align_multiline_text_blocks = false -ij_java_align_multiline_throws_list = false -ij_java_align_subsequent_simple_methods = false -ij_java_align_throws_keyword = false -ij_java_annotation_parameter_wrap = off -ij_java_array_initializer_new_line_after_left_brace = false -ij_java_array_initializer_right_brace_on_new_line = false -ij_java_array_initializer_wrap = off -ij_java_assert_statement_colon_on_next_line = false -ij_java_assert_statement_wrap = off -ij_java_assignment_wrap = off -ij_java_binary_operation_sign_on_next_line = false -ij_java_binary_operation_wrap = off -ij_java_blank_lines_after_anonymous_class_header = 0 -ij_java_blank_lines_after_class_header = 0 -ij_java_blank_lines_after_imports = 1 -ij_java_blank_lines_after_package = 1 -ij_java_blank_lines_around_class = 1 -ij_java_blank_lines_around_field = 0 -ij_java_blank_lines_around_field_in_interface = 0 -ij_java_blank_lines_around_initializer = 1 -ij_java_blank_lines_around_method = 1 -ij_java_blank_lines_around_method_in_interface = 1 -ij_java_blank_lines_before_class_end = 0 -ij_java_blank_lines_before_imports = 1 -ij_java_blank_lines_before_method_body = 0 -ij_java_blank_lines_before_package = 0 -ij_java_block_brace_style = end_of_line -ij_java_block_comment_at_first_column = true -ij_java_builder_methods = none -ij_java_call_parameters_new_line_after_left_paren = false -ij_java_call_parameters_right_paren_on_new_line = false -ij_java_call_parameters_wrap = off -ij_java_case_statement_on_separate_line = true -ij_java_catch_on_new_line = false -ij_java_class_annotation_wrap = split_into_lines -ij_java_class_brace_style = end_of_line -ij_java_class_count_to_use_import_on_demand = 99 -ij_java_class_names_in_javadoc = 1 -ij_java_do_not_indent_top_level_class_members = false -ij_java_do_not_wrap_after_single_annotation = false -ij_java_do_while_brace_force = never -ij_java_doc_add_blank_line_after_description = true -ij_java_doc_add_blank_line_after_param_comments = false -ij_java_doc_add_blank_line_after_return = false -ij_java_doc_add_p_tag_on_empty_lines = true -ij_java_doc_align_exception_comments = true -ij_java_doc_align_param_comments = true -ij_java_doc_do_not_wrap_if_one_line = false -ij_java_doc_enable_formatting = true -ij_java_doc_enable_leading_asterisks = true -ij_java_doc_indent_on_continuation = false -ij_java_doc_keep_empty_lines = true -ij_java_doc_keep_empty_parameter_tag = true -ij_java_doc_keep_empty_return_tag = true -ij_java_doc_keep_empty_throws_tag = true -ij_java_doc_keep_invalid_tags = true -ij_java_doc_param_description_on_new_line = false -ij_java_doc_preserve_line_breaks = false -ij_java_doc_use_throws_not_exception_tag = true -ij_java_else_on_new_line = false -ij_java_enum_constants_wrap = off -ij_java_extends_keyword_wrap = off -ij_java_extends_list_wrap = off -ij_java_field_annotation_wrap = split_into_lines -ij_java_finally_on_new_line = false -ij_java_for_brace_force = never -ij_java_for_statement_new_line_after_left_paren = false -ij_java_for_statement_right_paren_on_new_line = false -ij_java_for_statement_wrap = off -ij_java_generate_final_locals = false -ij_java_generate_final_parameters = false -ij_java_if_brace_force = never -ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| -ij_java_indent_case_from_switch = true -ij_java_insert_inner_class_imports = false -ij_java_insert_override_annotation = true -ij_java_keep_blank_lines_before_right_brace = 2 -ij_java_keep_blank_lines_between_package_declaration_and_header = 2 -ij_java_keep_blank_lines_in_code = 2 -ij_java_keep_blank_lines_in_declarations = 2 -ij_java_keep_builder_methods_indents = false -ij_java_keep_control_statement_in_one_line = true -ij_java_keep_first_column_comment = true -ij_java_keep_indents_on_empty_lines = false -ij_java_keep_line_breaks = true -ij_java_keep_multiple_expressions_in_one_line = false -ij_java_keep_simple_blocks_in_one_line = false -ij_java_keep_simple_classes_in_one_line = false -ij_java_keep_simple_lambdas_in_one_line = false -ij_java_keep_simple_methods_in_one_line = false -ij_java_label_indent_absolute = false -ij_java_label_indent_size = 0 -ij_java_lambda_brace_style = end_of_line -ij_java_layout_static_imports_separately = true -ij_java_line_comment_add_space = false -ij_java_line_comment_at_first_column = true -ij_java_method_annotation_wrap = split_into_lines -ij_java_method_brace_style = end_of_line -ij_java_method_call_chain_wrap = off -ij_java_method_parameters_new_line_after_left_paren = false -ij_java_method_parameters_right_paren_on_new_line = false -ij_java_method_parameters_wrap = off -ij_java_modifier_list_wrap = false -ij_java_names_count_to_use_import_on_demand = 99 -ij_java_new_line_after_lparen_in_record_header = false -ij_java_parameter_annotation_wrap = off -ij_java_parentheses_expression_new_line_after_left_paren = false -ij_java_parentheses_expression_right_paren_on_new_line = false -ij_java_place_assignment_sign_on_next_line = false -ij_java_prefer_longer_names = true -ij_java_prefer_parameters_wrap = false -ij_java_record_components_wrap = normal -ij_java_repeat_synchronized = true -ij_java_replace_instanceof_and_cast = false -ij_java_replace_null_check = true -ij_java_replace_sum_lambda_with_method_ref = true -ij_java_resource_list_new_line_after_left_paren = false -ij_java_resource_list_right_paren_on_new_line = false -ij_java_resource_list_wrap = off -ij_java_rparen_on_new_line_in_record_header = false -ij_java_space_after_closing_angle_bracket_in_type_argument = false -ij_java_space_after_colon = true -ij_java_space_after_comma = true -ij_java_space_after_comma_in_type_arguments = true -ij_java_space_after_for_semicolon = true -ij_java_space_after_quest = true -ij_java_space_after_type_cast = true -ij_java_space_before_annotation_array_initializer_left_brace = false -ij_java_space_before_annotation_parameter_list = false -ij_java_space_before_array_initializer_left_brace = false -ij_java_space_before_catch_keyword = true -ij_java_space_before_catch_left_brace = true -ij_java_space_before_catch_parentheses = true -ij_java_space_before_class_left_brace = true -ij_java_space_before_colon = true -ij_java_space_before_colon_in_foreach = true -ij_java_space_before_comma = false -ij_java_space_before_do_left_brace = true -ij_java_space_before_else_keyword = true -ij_java_space_before_else_left_brace = true -ij_java_space_before_finally_keyword = true -ij_java_space_before_finally_left_brace = true -ij_java_space_before_for_left_brace = true -ij_java_space_before_for_parentheses = true -ij_java_space_before_for_semicolon = false -ij_java_space_before_if_left_brace = true -ij_java_space_before_if_parentheses = true -ij_java_space_before_method_call_parentheses = false -ij_java_space_before_method_left_brace = true -ij_java_space_before_method_parentheses = false -ij_java_space_before_opening_angle_bracket_in_type_parameter = false -ij_java_space_before_quest = true -ij_java_space_before_switch_left_brace = true -ij_java_space_before_switch_parentheses = true -ij_java_space_before_synchronized_left_brace = true -ij_java_space_before_synchronized_parentheses = true -ij_java_space_before_try_left_brace = true -ij_java_space_before_try_parentheses = true -ij_java_space_before_type_parameter_list = false -ij_java_space_before_while_keyword = true -ij_java_space_before_while_left_brace = true -ij_java_space_before_while_parentheses = true -ij_java_space_inside_one_line_enum_braces = false -ij_java_space_within_empty_array_initializer_braces = false -ij_java_space_within_empty_method_call_parentheses = false -ij_java_space_within_empty_method_parentheses = false -ij_java_spaces_around_additive_operators = true -ij_java_spaces_around_assignment_operators = true -ij_java_spaces_around_bitwise_operators = true -ij_java_spaces_around_equality_operators = true -ij_java_spaces_around_lambda_arrow = true -ij_java_spaces_around_logical_operators = true -ij_java_spaces_around_method_ref_dbl_colon = false -ij_java_spaces_around_multiplicative_operators = true -ij_java_spaces_around_relational_operators = true -ij_java_spaces_around_shift_operators = true -ij_java_spaces_around_type_bounds_in_type_parameters = true -ij_java_spaces_around_unary_operator = false -ij_java_spaces_within_angle_brackets = false -ij_java_spaces_within_annotation_parentheses = false -ij_java_spaces_within_array_initializer_braces = false -ij_java_spaces_within_braces = false -ij_java_spaces_within_brackets = false -ij_java_spaces_within_cast_parentheses = false -ij_java_spaces_within_catch_parentheses = false -ij_java_spaces_within_for_parentheses = false -ij_java_spaces_within_if_parentheses = false -ij_java_spaces_within_method_call_parentheses = false -ij_java_spaces_within_method_parentheses = false -ij_java_spaces_within_parentheses = false -ij_java_spaces_within_record_header = false -ij_java_spaces_within_switch_parentheses = false -ij_java_spaces_within_synchronized_parentheses = false -ij_java_spaces_within_try_parentheses = false -ij_java_spaces_within_while_parentheses = false -ij_java_special_else_if_treatment = true -ij_java_subclass_name_suffix = Impl -ij_java_ternary_operation_signs_on_next_line = false -ij_java_ternary_operation_wrap = off -ij_java_test_name_suffix = Test -ij_java_throws_keyword_wrap = off -ij_java_throws_list_wrap = off -ij_java_use_external_annotations = false -ij_java_use_fq_class_names = false -ij_java_use_relative_indents = false -ij_java_use_single_class_imports = true -ij_java_variable_annotation_wrap = off -ij_java_visibility = public -ij_java_while_brace_force = never -ij_java_while_on_new_line = false -ij_java_wrap_comments = false -ij_java_wrap_first_method_in_call_chain = false -ij_java_wrap_long_lines = false - -[*.properties] -ij_properties_align_group_field_declarations = false -ij_properties_keep_blank_lines = false -ij_properties_key_value_delimiter = equals -ij_properties_spaces_around_key_value_delimiter = false - -[.editorconfig] -ij_editorconfig_align_group_field_declarations = false -ij_editorconfig_space_after_colon = false -ij_editorconfig_space_after_comma = true -ij_editorconfig_space_before_colon = false -ij_editorconfig_space_before_comma = false -ij_editorconfig_spaces_around_assignment_operators = true - -[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] -ij_continuation_indent_size = 4 -ij_xml_align_attributes = false -ij_xml_align_text = false -ij_xml_attribute_wrap = normal -ij_xml_block_comment_at_first_column = true -ij_xml_keep_blank_lines = 2 -ij_xml_keep_indents_on_empty_lines = false -ij_xml_keep_line_breaks = false -ij_xml_keep_line_breaks_in_text = true -ij_xml_keep_whitespaces = false -ij_xml_keep_whitespaces_around_cdata = preserve -ij_xml_keep_whitespaces_inside_cdata = false -ij_xml_line_comment_at_first_column = true -ij_xml_space_after_tag_name = false -ij_xml_space_around_equals_in_attribute = false -ij_xml_space_inside_empty_tag = true -ij_xml_text_wrap = normal -ij_xml_use_custom_settings = true - -[{*.bash,*.sh,*.zsh}] -indent_size = 2 -tab_width = 2 -ij_shell_binary_ops_start_line = false -ij_shell_keep_column_alignment_padding = false -ij_shell_minify_program = false -ij_shell_redirect_followed_by_space = false -ij_shell_switch_cases_indented = false -ij_shell_use_unix_line_separator = true - -[{*.c,*.c++,*.cc,*.cp,*.cpp,*.cu,*.cuh,*.cxx,*.h,*.h++,*.hh,*.hp,*.hpp,*.hxx,*.i,*.icc,*.ii,*.inl,*.ino,*.ipp,*.m,*.mm,*.pch,*.tcc,*.tpp}] -ij_c_add_brief_tag = false -ij_c_add_getter_prefix = true -ij_c_add_setter_prefix = true -ij_c_align_dictionary_pair_values = false -ij_c_align_group_field_declarations = false -ij_c_align_init_list_in_columns = true -ij_c_align_multiline_array_initializer_expression = true -ij_c_align_multiline_assignment = true -ij_c_align_multiline_binary_operation = true -ij_c_align_multiline_chained_methods = false -ij_c_align_multiline_for = true -ij_c_align_multiline_ternary_operation = true -ij_c_array_initializer_comma_on_next_line = false -ij_c_array_initializer_new_line_after_left_brace = false -ij_c_array_initializer_right_brace_on_new_line = false -ij_c_array_initializer_wrap = normal -ij_c_assignment_wrap = off -ij_c_binary_operation_sign_on_next_line = false -ij_c_binary_operation_wrap = normal -ij_c_blank_lines_after_class_header = 0 -ij_c_blank_lines_after_imports = 1 -ij_c_blank_lines_around_class = 1 -ij_c_blank_lines_around_field = 0 -ij_c_blank_lines_around_field_in_interface = 0 -ij_c_blank_lines_around_method = 1 -ij_c_blank_lines_around_method_in_interface = 1 -ij_c_blank_lines_around_namespace = 0 -ij_c_blank_lines_around_properties_in_declaration = 0 -ij_c_blank_lines_around_properties_in_interface = 0 -ij_c_blank_lines_before_imports = 1 -ij_c_blank_lines_before_method_body = 0 -ij_c_block_brace_placement = end_of_line -ij_c_block_brace_style = end_of_line -ij_c_block_comment_at_first_column = true -ij_c_catch_on_new_line = false -ij_c_class_brace_style = end_of_line -ij_c_class_constructor_init_list_align_multiline = true -ij_c_class_constructor_init_list_comma_on_next_line = false -ij_c_class_constructor_init_list_new_line_after_colon = never -ij_c_class_constructor_init_list_new_line_before_colon = if_long -ij_c_class_constructor_init_list_wrap = normal -ij_c_copy_is_deep = false -ij_c_create_interface_for_categories = true -ij_c_declare_generated_methods = true -ij_c_description_include_member_names = true -ij_c_discharged_short_ternary_operator = false -ij_c_do_not_add_breaks = false -ij_c_do_while_brace_force = never -ij_c_else_on_new_line = false -ij_c_enum_constants_comma_on_next_line = false -ij_c_enum_constants_wrap = on_every_item -ij_c_for_brace_force = never -ij_c_for_statement_new_line_after_left_paren = false -ij_c_for_statement_right_paren_on_new_line = false -ij_c_for_statement_wrap = off -ij_c_function_brace_placement = end_of_line -ij_c_function_call_arguments_align_multiline = true -ij_c_function_call_arguments_align_multiline_pars = false -ij_c_function_call_arguments_comma_on_next_line = false -ij_c_function_call_arguments_new_line_after_lpar = false -ij_c_function_call_arguments_new_line_before_rpar = false -ij_c_function_call_arguments_wrap = normal -ij_c_function_non_top_after_return_type_wrap = normal -ij_c_function_parameters_align_multiline = true -ij_c_function_parameters_align_multiline_pars = false -ij_c_function_parameters_comma_on_next_line = false -ij_c_function_parameters_new_line_after_lpar = false -ij_c_function_parameters_new_line_before_rpar = false -ij_c_function_parameters_wrap = normal -ij_c_function_top_after_return_type_wrap = normal -ij_c_generate_additional_eq_operators = true -ij_c_generate_additional_rel_operators = true -ij_c_generate_class_constructor = true -ij_c_generate_comparison_operators_use_std_tie = false -ij_c_generate_instance_variables_for_properties = ask -ij_c_generate_operators_as_members = true -ij_c_header_guard_style_pattern = ${PROJECT_NAME}_${FILE_NAME}_${EXT} -ij_c_if_brace_force = never -ij_c_in_line_short_ternary_operator = true -ij_c_indent_block_comment = true -ij_c_indent_c_struct_members = 4 -ij_c_indent_case_from_switch = true -ij_c_indent_class_members = 4 -ij_c_indent_directive_as_code = false -ij_c_indent_implementation_members = 0 -ij_c_indent_inside_code_block = 4 -ij_c_indent_interface_members = 0 -ij_c_indent_interface_members_except_ivars_block = false -ij_c_indent_namespace_members = 4 -ij_c_indent_preprocessor_directive = 0 -ij_c_indent_visibility_keywords = 0 -ij_c_insert_override = true -ij_c_insert_virtual_with_override = false -ij_c_introduce_auto_vars = false -ij_c_introduce_const_params = false -ij_c_introduce_const_vars = false -ij_c_introduce_generate_property = false -ij_c_introduce_generate_synthesize = true -ij_c_introduce_globals_to_header = true -ij_c_introduce_prop_to_private_category = false -ij_c_introduce_static_consts = true -ij_c_introduce_use_ns_types = false -ij_c_ivars_prefix = _ -ij_c_keep_blank_lines_before_end = 2 -ij_c_keep_blank_lines_before_right_brace = 2 -ij_c_keep_blank_lines_in_code = 2 -ij_c_keep_blank_lines_in_declarations = 2 -ij_c_keep_case_expressions_in_one_line = false -ij_c_keep_control_statement_in_one_line = true -ij_c_keep_directive_at_first_column = true -ij_c_keep_first_column_comment = true -ij_c_keep_line_breaks = true -ij_c_keep_nested_namespaces_in_one_line = false -ij_c_keep_simple_blocks_in_one_line = true -ij_c_keep_simple_methods_in_one_line = true -ij_c_keep_structures_in_one_line = false -ij_c_lambda_capture_list_align_multiline = false -ij_c_lambda_capture_list_align_multiline_bracket = false -ij_c_lambda_capture_list_comma_on_next_line = false -ij_c_lambda_capture_list_new_line_after_lbracket = false -ij_c_lambda_capture_list_new_line_before_rbracket = false -ij_c_lambda_capture_list_wrap = off -ij_c_line_comment_add_space = false -ij_c_line_comment_at_first_column = true -ij_c_method_brace_placement = end_of_line -ij_c_method_call_arguments_align_by_colons = true -ij_c_method_call_arguments_align_multiline = false -ij_c_method_call_arguments_special_dictionary_pairs_treatment = true -ij_c_method_call_arguments_wrap = off -ij_c_method_call_chain_wrap = off -ij_c_method_parameters_align_by_colons = true -ij_c_method_parameters_align_multiline = false -ij_c_method_parameters_wrap = off -ij_c_namespace_brace_placement = end_of_line -ij_c_parentheses_expression_new_line_after_left_paren = false -ij_c_parentheses_expression_right_paren_on_new_line = false -ij_c_place_assignment_sign_on_next_line = false -ij_c_property_nonatomic = true -ij_c_put_ivars_to_implementation = true -ij_c_refactor_compatibility_aliases_and_classes = true -ij_c_refactor_properties_and_ivars = true -ij_c_release_style = ivar -ij_c_retain_object_parameters_in_constructor = true -ij_c_semicolon_after_method_signature = false -ij_c_shift_operation_align_multiline = true -ij_c_shift_operation_wrap = normal -ij_c_show_non_virtual_functions = false -ij_c_space_after_colon = true -ij_c_space_after_colon_in_selector = false -ij_c_space_after_comma = true -ij_c_space_after_cup_in_blocks = false -ij_c_space_after_dictionary_literal_colon = true -ij_c_space_after_for_semicolon = true -ij_c_space_after_init_list_colon = true -ij_c_space_after_method_parameter_type_parentheses = false -ij_c_space_after_method_return_type_parentheses = false -ij_c_space_after_pointer_in_declaration = false -ij_c_space_after_quest = true -ij_c_space_after_reference_in_declaration = false -ij_c_space_after_reference_in_rvalue = false -ij_c_space_after_structures_rbrace = true -ij_c_space_after_superclass_colon = true -ij_c_space_after_type_cast = true -ij_c_space_after_visibility_sign_in_method_declaration = true -ij_c_space_before_autorelease_pool_lbrace = true -ij_c_space_before_catch_keyword = true -ij_c_space_before_catch_left_brace = true -ij_c_space_before_catch_parentheses = true -ij_c_space_before_category_parentheses = true -ij_c_space_before_chained_send_message = true -ij_c_space_before_class_left_brace = true -ij_c_space_before_colon = true -ij_c_space_before_comma = false -ij_c_space_before_dictionary_literal_colon = false -ij_c_space_before_do_left_brace = true -ij_c_space_before_else_keyword = true -ij_c_space_before_else_left_brace = true -ij_c_space_before_for_left_brace = true -ij_c_space_before_for_parentheses = true -ij_c_space_before_for_semicolon = false -ij_c_space_before_if_left_brace = true -ij_c_space_before_if_parentheses = true -ij_c_space_before_init_list = false -ij_c_space_before_init_list_colon = true -ij_c_space_before_method_call_parentheses = false -ij_c_space_before_method_left_brace = true -ij_c_space_before_method_parentheses = false -ij_c_space_before_namespace_lbrace = true -ij_c_space_before_pointer_in_declaration = true -ij_c_space_before_property_attributes_parentheses = false -ij_c_space_before_protocols_brackets = true -ij_c_space_before_quest = true -ij_c_space_before_reference_in_declaration = true -ij_c_space_before_superclass_colon = true -ij_c_space_before_switch_left_brace = true -ij_c_space_before_switch_parentheses = true -ij_c_space_before_template_call_lt = false -ij_c_space_before_template_declaration_lt = false -ij_c_space_before_try_left_brace = true -ij_c_space_before_while_keyword = true -ij_c_space_before_while_left_brace = true -ij_c_space_before_while_parentheses = true -ij_c_space_between_adjacent_brackets = false -ij_c_space_between_operator_and_punctuator = false -ij_c_space_within_empty_array_initializer_braces = false -ij_c_spaces_around_additive_operators = true -ij_c_spaces_around_assignment_operators = true -ij_c_spaces_around_bitwise_operators = true -ij_c_spaces_around_equality_operators = true -ij_c_spaces_around_lambda_arrow = true -ij_c_spaces_around_logical_operators = true -ij_c_spaces_around_multiplicative_operators = true -ij_c_spaces_around_pm_operators = false -ij_c_spaces_around_relational_operators = true -ij_c_spaces_around_shift_operators = true -ij_c_spaces_around_unary_operator = false -ij_c_spaces_within_array_initializer_braces = false -ij_c_spaces_within_braces = true -ij_c_spaces_within_brackets = false -ij_c_spaces_within_cast_parentheses = false -ij_c_spaces_within_catch_parentheses = false -ij_c_spaces_within_category_parentheses = false -ij_c_spaces_within_empty_braces = false -ij_c_spaces_within_empty_function_call_parentheses = false -ij_c_spaces_within_empty_function_declaration_parentheses = false -ij_c_spaces_within_empty_lambda_capture_list_bracket = false -ij_c_spaces_within_empty_template_call_ltgt = false -ij_c_spaces_within_empty_template_declaration_ltgt = false -ij_c_spaces_within_for_parentheses = false -ij_c_spaces_within_function_call_parentheses = false -ij_c_spaces_within_function_declaration_parentheses = false -ij_c_spaces_within_if_parentheses = false -ij_c_spaces_within_lambda_capture_list_bracket = false -ij_c_spaces_within_method_parameter_type_parentheses = false -ij_c_spaces_within_method_return_type_parentheses = false -ij_c_spaces_within_parentheses = false -ij_c_spaces_within_property_attributes_parentheses = false -ij_c_spaces_within_protocols_brackets = false -ij_c_spaces_within_send_message_brackets = false -ij_c_spaces_within_switch_parentheses = false -ij_c_spaces_within_template_call_ltgt = false -ij_c_spaces_within_template_declaration_ltgt = false -ij_c_spaces_within_template_double_gt = true -ij_c_spaces_within_while_parentheses = false -ij_c_special_else_if_treatment = true -ij_c_superclass_list_after_colon = never -ij_c_superclass_list_align_multiline = true -ij_c_superclass_list_before_colon = if_long -ij_c_superclass_list_comma_on_next_line = false -ij_c_superclass_list_wrap = on_every_item -ij_c_tag_prefix_of_block_comment = at -ij_c_tag_prefix_of_line_comment = back_slash -ij_c_template_call_arguments_align_multiline = false -ij_c_template_call_arguments_align_multiline_pars = false -ij_c_template_call_arguments_comma_on_next_line = false -ij_c_template_call_arguments_new_line_after_lt = false -ij_c_template_call_arguments_new_line_before_gt = false -ij_c_template_call_arguments_wrap = off -ij_c_template_declaration_function_body_indent = false -ij_c_template_declaration_function_wrap = split_into_lines -ij_c_template_declaration_struct_body_indent = false -ij_c_template_declaration_struct_wrap = split_into_lines -ij_c_template_parameters_align_multiline = false -ij_c_template_parameters_align_multiline_pars = false -ij_c_template_parameters_comma_on_next_line = false -ij_c_template_parameters_new_line_after_lt = false -ij_c_template_parameters_new_line_before_gt = false -ij_c_template_parameters_wrap = off -ij_c_ternary_operation_signs_on_next_line = true -ij_c_ternary_operation_wrap = normal -ij_c_type_qualifiers_placement = before -ij_c_use_modern_casts = true -ij_c_use_setters_in_constructor = true -ij_c_while_brace_force = never -ij_c_while_on_new_line = false -ij_c_wrap_property_declaration = off - -[{*.cmake,CMakeLists.txt}] -ij_cmake_align_multiline_parameters_in_calls = false -ij_cmake_force_commands_case = 2 -ij_cmake_keep_blank_lines_in_code = 2 -ij_cmake_space_before_for_parentheses = true -ij_cmake_space_before_if_parentheses = true -ij_cmake_space_before_method_call_parentheses = false -ij_cmake_space_before_method_parentheses = false -ij_cmake_space_before_while_parentheses = true -ij_cmake_spaces_within_for_parentheses = false -ij_cmake_spaces_within_if_parentheses = false -ij_cmake_spaces_within_method_call_parentheses = false -ij_cmake_spaces_within_method_parentheses = false -ij_cmake_spaces_within_while_parentheses = false - -[{*.gant,*.gradle,*.groovy,*.gy}] -ij_groovy_align_group_field_declarations = false -ij_groovy_align_multiline_array_initializer_expression = false -ij_groovy_align_multiline_assignment = false -ij_groovy_align_multiline_binary_operation = false -ij_groovy_align_multiline_chained_methods = false -ij_groovy_align_multiline_extends_list = false -ij_groovy_align_multiline_for = true -ij_groovy_align_multiline_list_or_map = true -ij_groovy_align_multiline_method_parentheses = false -ij_groovy_align_multiline_parameters = true -ij_groovy_align_multiline_parameters_in_calls = false -ij_groovy_align_multiline_resources = true -ij_groovy_align_multiline_ternary_operation = false -ij_groovy_align_multiline_throws_list = false -ij_groovy_align_named_args_in_map = true -ij_groovy_align_throws_keyword = false -ij_groovy_array_initializer_new_line_after_left_brace = false -ij_groovy_array_initializer_right_brace_on_new_line = false -ij_groovy_array_initializer_wrap = off -ij_groovy_assert_statement_wrap = off -ij_groovy_assignment_wrap = off -ij_groovy_binary_operation_wrap = off -ij_groovy_blank_lines_after_class_header = 0 -ij_groovy_blank_lines_after_imports = 1 -ij_groovy_blank_lines_after_package = 1 -ij_groovy_blank_lines_around_class = 1 -ij_groovy_blank_lines_around_field = 0 -ij_groovy_blank_lines_around_field_in_interface = 0 -ij_groovy_blank_lines_around_method = 1 -ij_groovy_blank_lines_around_method_in_interface = 1 -ij_groovy_blank_lines_before_imports = 1 -ij_groovy_blank_lines_before_method_body = 0 -ij_groovy_blank_lines_before_package = 0 -ij_groovy_block_brace_style = end_of_line -ij_groovy_block_comment_at_first_column = true -ij_groovy_call_parameters_new_line_after_left_paren = false -ij_groovy_call_parameters_right_paren_on_new_line = false -ij_groovy_call_parameters_wrap = off -ij_groovy_catch_on_new_line = false -ij_groovy_class_annotation_wrap = split_into_lines -ij_groovy_class_brace_style = end_of_line -ij_groovy_class_count_to_use_import_on_demand = 5 -ij_groovy_do_while_brace_force = never -ij_groovy_else_on_new_line = false -ij_groovy_enum_constants_wrap = off -ij_groovy_extends_keyword_wrap = off -ij_groovy_extends_list_wrap = off -ij_groovy_field_annotation_wrap = split_into_lines -ij_groovy_finally_on_new_line = false -ij_groovy_for_brace_force = never -ij_groovy_for_statement_new_line_after_left_paren = false -ij_groovy_for_statement_right_paren_on_new_line = false -ij_groovy_for_statement_wrap = off -ij_groovy_if_brace_force = never -ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* -ij_groovy_indent_case_from_switch = true -ij_groovy_indent_label_blocks = true -ij_groovy_insert_inner_class_imports = false -ij_groovy_keep_blank_lines_before_right_brace = 2 -ij_groovy_keep_blank_lines_in_code = 2 -ij_groovy_keep_blank_lines_in_declarations = 2 -ij_groovy_keep_control_statement_in_one_line = true -ij_groovy_keep_first_column_comment = true -ij_groovy_keep_indents_on_empty_lines = false -ij_groovy_keep_line_breaks = true -ij_groovy_keep_multiple_expressions_in_one_line = false -ij_groovy_keep_simple_blocks_in_one_line = false -ij_groovy_keep_simple_classes_in_one_line = true -ij_groovy_keep_simple_lambdas_in_one_line = true -ij_groovy_keep_simple_methods_in_one_line = true -ij_groovy_label_indent_absolute = false -ij_groovy_label_indent_size = 0 -ij_groovy_lambda_brace_style = end_of_line -ij_groovy_layout_static_imports_separately = true -ij_groovy_line_comment_add_space = false -ij_groovy_line_comment_at_first_column = true -ij_groovy_method_annotation_wrap = split_into_lines -ij_groovy_method_brace_style = end_of_line -ij_groovy_method_call_chain_wrap = off -ij_groovy_method_parameters_new_line_after_left_paren = false -ij_groovy_method_parameters_right_paren_on_new_line = false -ij_groovy_method_parameters_wrap = off -ij_groovy_modifier_list_wrap = false -ij_groovy_names_count_to_use_import_on_demand = 3 -ij_groovy_parameter_annotation_wrap = off -ij_groovy_parentheses_expression_new_line_after_left_paren = false -ij_groovy_parentheses_expression_right_paren_on_new_line = false -ij_groovy_prefer_parameters_wrap = false -ij_groovy_resource_list_new_line_after_left_paren = false -ij_groovy_resource_list_right_paren_on_new_line = false -ij_groovy_resource_list_wrap = off -ij_groovy_space_after_assert_separator = true -ij_groovy_space_after_colon = true -ij_groovy_space_after_comma = true -ij_groovy_space_after_comma_in_type_arguments = true -ij_groovy_space_after_for_semicolon = true -ij_groovy_space_after_quest = true -ij_groovy_space_after_type_cast = true -ij_groovy_space_before_annotation_parameter_list = false -ij_groovy_space_before_array_initializer_left_brace = false -ij_groovy_space_before_assert_separator = false -ij_groovy_space_before_catch_keyword = true -ij_groovy_space_before_catch_left_brace = true -ij_groovy_space_before_catch_parentheses = true -ij_groovy_space_before_class_left_brace = true -ij_groovy_space_before_closure_left_brace = true -ij_groovy_space_before_colon = true -ij_groovy_space_before_comma = false -ij_groovy_space_before_do_left_brace = true -ij_groovy_space_before_else_keyword = true -ij_groovy_space_before_else_left_brace = true -ij_groovy_space_before_finally_keyword = true -ij_groovy_space_before_finally_left_brace = true -ij_groovy_space_before_for_left_brace = true -ij_groovy_space_before_for_parentheses = true -ij_groovy_space_before_for_semicolon = false -ij_groovy_space_before_if_left_brace = true -ij_groovy_space_before_if_parentheses = true -ij_groovy_space_before_method_call_parentheses = false -ij_groovy_space_before_method_left_brace = true -ij_groovy_space_before_method_parentheses = false -ij_groovy_space_before_quest = true -ij_groovy_space_before_switch_left_brace = true -ij_groovy_space_before_switch_parentheses = true -ij_groovy_space_before_synchronized_left_brace = true -ij_groovy_space_before_synchronized_parentheses = true -ij_groovy_space_before_try_left_brace = true -ij_groovy_space_before_try_parentheses = true -ij_groovy_space_before_while_keyword = true -ij_groovy_space_before_while_left_brace = true -ij_groovy_space_before_while_parentheses = true -ij_groovy_space_in_named_argument = true -ij_groovy_space_in_named_argument_before_colon = false -ij_groovy_space_within_empty_array_initializer_braces = false -ij_groovy_space_within_empty_method_call_parentheses = false -ij_groovy_spaces_around_additive_operators = true -ij_groovy_spaces_around_assignment_operators = true -ij_groovy_spaces_around_bitwise_operators = true -ij_groovy_spaces_around_equality_operators = true -ij_groovy_spaces_around_lambda_arrow = true -ij_groovy_spaces_around_logical_operators = true -ij_groovy_spaces_around_multiplicative_operators = true -ij_groovy_spaces_around_regex_operators = true -ij_groovy_spaces_around_relational_operators = true -ij_groovy_spaces_around_shift_operators = true -ij_groovy_spaces_within_annotation_parentheses = false -ij_groovy_spaces_within_array_initializer_braces = false -ij_groovy_spaces_within_braces = true -ij_groovy_spaces_within_brackets = false -ij_groovy_spaces_within_cast_parentheses = false -ij_groovy_spaces_within_catch_parentheses = false -ij_groovy_spaces_within_for_parentheses = false -ij_groovy_spaces_within_gstring_injection_braces = false -ij_groovy_spaces_within_if_parentheses = false -ij_groovy_spaces_within_list_or_map = false -ij_groovy_spaces_within_method_call_parentheses = false -ij_groovy_spaces_within_method_parentheses = false -ij_groovy_spaces_within_parentheses = false -ij_groovy_spaces_within_switch_parentheses = false -ij_groovy_spaces_within_synchronized_parentheses = false -ij_groovy_spaces_within_try_parentheses = false -ij_groovy_spaces_within_tuple_expression = false -ij_groovy_spaces_within_while_parentheses = false -ij_groovy_special_else_if_treatment = true -ij_groovy_ternary_operation_wrap = off -ij_groovy_throws_keyword_wrap = off -ij_groovy_throws_list_wrap = off -ij_groovy_use_flying_geese_braces = false -ij_groovy_use_fq_class_names = false -ij_groovy_use_fq_class_names_in_javadoc = true -ij_groovy_use_relative_indents = false -ij_groovy_use_single_class_imports = true -ij_groovy_variable_annotation_wrap = off -ij_groovy_while_brace_force = never -ij_groovy_while_on_new_line = false -ij_groovy_wrap_long_lines = false - -[{*.gradle.kts,*.kt,*.kts,*.main.kts}] -ij_kotlin_align_in_columns_case_branch = true -ij_kotlin_align_multiline_binary_operation = false -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_on_call_site = false -ij_kotlin_assignment_wrap = off -ij_kotlin_blank_lines_after_class_header = 0 -ij_kotlin_blank_lines_around_block_when_branches = 0 -ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 -ij_kotlin_block_comment_at_first_column = true -ij_kotlin_call_parameters_new_line_after_left_paren = false -ij_kotlin_call_parameters_right_paren_on_new_line = false -ij_kotlin_call_parameters_wrap = off -ij_kotlin_catch_on_new_line = false -ij_kotlin_class_annotation_wrap = off -ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL -ij_kotlin_continuation_indent_for_chained_calls = true -ij_kotlin_continuation_indent_for_expression_bodies = true -ij_kotlin_continuation_indent_in_argument_lists = true -ij_kotlin_continuation_indent_in_elvis = true -ij_kotlin_continuation_indent_in_if_conditions = true -ij_kotlin_continuation_indent_in_parameter_lists = true -ij_kotlin_continuation_indent_in_supertype_lists = true -ij_kotlin_else_on_new_line = false -ij_kotlin_enum_constants_wrap = off -ij_kotlin_extends_list_wrap = off -ij_kotlin_field_annotation_wrap = normal -ij_kotlin_finally_on_new_line = false -ij_kotlin_if_rparen_on_new_line = false -ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ -ij_kotlin_insert_whitespaces_in_simple_one_line_method = true -ij_kotlin_keep_blank_lines_before_right_brace = 0 -ij_kotlin_keep_blank_lines_in_code = 1 -ij_kotlin_keep_blank_lines_in_declarations = 1 -ij_kotlin_keep_first_column_comment = true -ij_kotlin_keep_indents_on_empty_lines = false -ij_kotlin_keep_line_breaks = true -ij_kotlin_lbrace_on_next_line = false -ij_kotlin_line_comment_add_space = false -ij_kotlin_line_comment_at_first_column = true -ij_kotlin_method_annotation_wrap = split_into_lines -ij_kotlin_method_call_chain_wrap = off -ij_kotlin_method_parameters_new_line_after_left_paren = false -ij_kotlin_method_parameters_right_paren_on_new_line = false -ij_kotlin_method_parameters_wrap = off -ij_kotlin_name_count_to_use_star_import = 2147483647 -ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.** -ij_kotlin_parameter_annotation_wrap = off -ij_kotlin_space_after_comma = true -ij_kotlin_space_after_extend_colon = true -ij_kotlin_space_after_type_colon = true -ij_kotlin_space_before_catch_parentheses = true -ij_kotlin_space_before_comma = false -ij_kotlin_space_before_extend_colon = true -ij_kotlin_space_before_for_parentheses = true -ij_kotlin_space_before_if_parentheses = true -ij_kotlin_space_before_lambda_arrow = true -ij_kotlin_space_before_type_colon = false -ij_kotlin_space_before_when_parentheses = true -ij_kotlin_space_before_while_parentheses = true -ij_kotlin_spaces_around_additive_operators = true -ij_kotlin_spaces_around_assignment_operators = true -ij_kotlin_spaces_around_equality_operators = true -ij_kotlin_spaces_around_function_type_arrow = true -ij_kotlin_spaces_around_logical_operators = true -ij_kotlin_spaces_around_multiplicative_operators = true -ij_kotlin_spaces_around_range = false -ij_kotlin_spaces_around_relational_operators = true -ij_kotlin_spaces_around_unary_operator = false -ij_kotlin_spaces_around_when_arrow = true -ij_kotlin_use_custom_formatting_for_modifiers = true -ij_kotlin_variable_annotation_wrap = off -ij_kotlin_while_on_new_line = false -ij_kotlin_wrap_elvis_expressions = 1 -ij_kotlin_wrap_expression_body_functions = 0 -ij_kotlin_wrap_first_method_in_call_chain = false - -[{*.har,*.json}] -indent_size = 2 -ij_json_keep_blank_lines_in_code = 0 -ij_json_keep_indents_on_empty_lines = false -ij_json_keep_line_breaks = true -ij_json_space_after_colon = true -ij_json_space_after_comma = true -ij_json_space_before_colon = true -ij_json_space_before_comma = false -ij_json_spaces_within_braces = false -ij_json_spaces_within_brackets = false -ij_json_wrap_long_lines = false - -[{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_at_first_column = true -ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false -ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal -ij_html_uniform_ident = false - -[{*.yaml,*.yml}] -indent_size = 2 -ij_yaml_align_values_properties = do_not_align -ij_yaml_autoinsert_sequence_marker = true -ij_yaml_block_mapping_on_new_line = false -ij_yaml_indent_sequence_value = true -ij_yaml_keep_indents_on_empty_lines = false -ij_yaml_keep_line_breaks = true -ij_yaml_sequence_on_new_line = false -ij_yaml_space_before_colon = false -ij_yaml_spaces_within_braces = true -ij_yaml_spaces_within_brackets = true +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 160 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.java] +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = none +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_continuation_indent_size = 4 +ij_xml_align_attributes = false +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = false +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = true +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = true + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.c,*.c++,*.cc,*.cp,*.cpp,*.cu,*.cuh,*.cxx,*.h,*.h++,*.hh,*.hp,*.hpp,*.hxx,*.i,*.icc,*.ii,*.inl,*.ino,*.ipp,*.m,*.mm,*.pch,*.tcc,*.tpp}] +ij_c_add_brief_tag = false +ij_c_add_getter_prefix = true +ij_c_add_setter_prefix = true +ij_c_align_dictionary_pair_values = false +ij_c_align_group_field_declarations = false +ij_c_align_init_list_in_columns = true +ij_c_align_multiline_array_initializer_expression = true +ij_c_align_multiline_assignment = true +ij_c_align_multiline_binary_operation = true +ij_c_align_multiline_chained_methods = false +ij_c_align_multiline_for = true +ij_c_align_multiline_ternary_operation = true +ij_c_array_initializer_comma_on_next_line = false +ij_c_array_initializer_new_line_after_left_brace = false +ij_c_array_initializer_right_brace_on_new_line = false +ij_c_array_initializer_wrap = normal +ij_c_assignment_wrap = off +ij_c_binary_operation_sign_on_next_line = false +ij_c_binary_operation_wrap = normal +ij_c_blank_lines_after_class_header = 0 +ij_c_blank_lines_after_imports = 1 +ij_c_blank_lines_around_class = 1 +ij_c_blank_lines_around_field = 0 +ij_c_blank_lines_around_field_in_interface = 0 +ij_c_blank_lines_around_method = 1 +ij_c_blank_lines_around_method_in_interface = 1 +ij_c_blank_lines_around_namespace = 0 +ij_c_blank_lines_around_properties_in_declaration = 0 +ij_c_blank_lines_around_properties_in_interface = 0 +ij_c_blank_lines_before_imports = 1 +ij_c_blank_lines_before_method_body = 0 +ij_c_block_brace_placement = end_of_line +ij_c_block_brace_style = end_of_line +ij_c_block_comment_at_first_column = true +ij_c_catch_on_new_line = false +ij_c_class_brace_style = end_of_line +ij_c_class_constructor_init_list_align_multiline = true +ij_c_class_constructor_init_list_comma_on_next_line = false +ij_c_class_constructor_init_list_new_line_after_colon = never +ij_c_class_constructor_init_list_new_line_before_colon = if_long +ij_c_class_constructor_init_list_wrap = normal +ij_c_copy_is_deep = false +ij_c_create_interface_for_categories = true +ij_c_declare_generated_methods = true +ij_c_description_include_member_names = true +ij_c_discharged_short_ternary_operator = false +ij_c_do_not_add_breaks = false +ij_c_do_while_brace_force = never +ij_c_else_on_new_line = false +ij_c_enum_constants_comma_on_next_line = false +ij_c_enum_constants_wrap = on_every_item +ij_c_for_brace_force = never +ij_c_for_statement_new_line_after_left_paren = false +ij_c_for_statement_right_paren_on_new_line = false +ij_c_for_statement_wrap = off +ij_c_function_brace_placement = end_of_line +ij_c_function_call_arguments_align_multiline = true +ij_c_function_call_arguments_align_multiline_pars = false +ij_c_function_call_arguments_comma_on_next_line = false +ij_c_function_call_arguments_new_line_after_lpar = false +ij_c_function_call_arguments_new_line_before_rpar = false +ij_c_function_call_arguments_wrap = normal +ij_c_function_non_top_after_return_type_wrap = normal +ij_c_function_parameters_align_multiline = true +ij_c_function_parameters_align_multiline_pars = false +ij_c_function_parameters_comma_on_next_line = false +ij_c_function_parameters_new_line_after_lpar = false +ij_c_function_parameters_new_line_before_rpar = false +ij_c_function_parameters_wrap = normal +ij_c_function_top_after_return_type_wrap = normal +ij_c_generate_additional_eq_operators = true +ij_c_generate_additional_rel_operators = true +ij_c_generate_class_constructor = true +ij_c_generate_comparison_operators_use_std_tie = false +ij_c_generate_instance_variables_for_properties = ask +ij_c_generate_operators_as_members = true +ij_c_header_guard_style_pattern = ${PROJECT_NAME}_${FILE_NAME}_${EXT} +ij_c_if_brace_force = never +ij_c_in_line_short_ternary_operator = true +ij_c_indent_block_comment = true +ij_c_indent_c_struct_members = 4 +ij_c_indent_case_from_switch = true +ij_c_indent_class_members = 4 +ij_c_indent_directive_as_code = false +ij_c_indent_implementation_members = 0 +ij_c_indent_inside_code_block = 4 +ij_c_indent_interface_members = 0 +ij_c_indent_interface_members_except_ivars_block = false +ij_c_indent_namespace_members = 4 +ij_c_indent_preprocessor_directive = 0 +ij_c_indent_visibility_keywords = 0 +ij_c_insert_override = true +ij_c_insert_virtual_with_override = false +ij_c_introduce_auto_vars = false +ij_c_introduce_const_params = false +ij_c_introduce_const_vars = false +ij_c_introduce_generate_property = false +ij_c_introduce_generate_synthesize = true +ij_c_introduce_globals_to_header = true +ij_c_introduce_prop_to_private_category = false +ij_c_introduce_static_consts = true +ij_c_introduce_use_ns_types = false +ij_c_ivars_prefix = _ +ij_c_keep_blank_lines_before_end = 2 +ij_c_keep_blank_lines_before_right_brace = 2 +ij_c_keep_blank_lines_in_code = 2 +ij_c_keep_blank_lines_in_declarations = 2 +ij_c_keep_case_expressions_in_one_line = false +ij_c_keep_control_statement_in_one_line = true +ij_c_keep_directive_at_first_column = true +ij_c_keep_first_column_comment = true +ij_c_keep_line_breaks = true +ij_c_keep_nested_namespaces_in_one_line = false +ij_c_keep_simple_blocks_in_one_line = true +ij_c_keep_simple_methods_in_one_line = true +ij_c_keep_structures_in_one_line = false +ij_c_lambda_capture_list_align_multiline = false +ij_c_lambda_capture_list_align_multiline_bracket = false +ij_c_lambda_capture_list_comma_on_next_line = false +ij_c_lambda_capture_list_new_line_after_lbracket = false +ij_c_lambda_capture_list_new_line_before_rbracket = false +ij_c_lambda_capture_list_wrap = off +ij_c_line_comment_add_space = false +ij_c_line_comment_at_first_column = true +ij_c_method_brace_placement = end_of_line +ij_c_method_call_arguments_align_by_colons = true +ij_c_method_call_arguments_align_multiline = false +ij_c_method_call_arguments_special_dictionary_pairs_treatment = true +ij_c_method_call_arguments_wrap = off +ij_c_method_call_chain_wrap = off +ij_c_method_parameters_align_by_colons = true +ij_c_method_parameters_align_multiline = false +ij_c_method_parameters_wrap = off +ij_c_namespace_brace_placement = end_of_line +ij_c_parentheses_expression_new_line_after_left_paren = false +ij_c_parentheses_expression_right_paren_on_new_line = false +ij_c_place_assignment_sign_on_next_line = false +ij_c_property_nonatomic = true +ij_c_put_ivars_to_implementation = true +ij_c_refactor_compatibility_aliases_and_classes = true +ij_c_refactor_properties_and_ivars = true +ij_c_release_style = ivar +ij_c_retain_object_parameters_in_constructor = true +ij_c_semicolon_after_method_signature = false +ij_c_shift_operation_align_multiline = true +ij_c_shift_operation_wrap = normal +ij_c_show_non_virtual_functions = false +ij_c_space_after_colon = true +ij_c_space_after_colon_in_selector = false +ij_c_space_after_comma = true +ij_c_space_after_cup_in_blocks = false +ij_c_space_after_dictionary_literal_colon = true +ij_c_space_after_for_semicolon = true +ij_c_space_after_init_list_colon = true +ij_c_space_after_method_parameter_type_parentheses = false +ij_c_space_after_method_return_type_parentheses = false +ij_c_space_after_pointer_in_declaration = false +ij_c_space_after_quest = true +ij_c_space_after_reference_in_declaration = false +ij_c_space_after_reference_in_rvalue = false +ij_c_space_after_structures_rbrace = true +ij_c_space_after_superclass_colon = true +ij_c_space_after_type_cast = true +ij_c_space_after_visibility_sign_in_method_declaration = true +ij_c_space_before_autorelease_pool_lbrace = true +ij_c_space_before_catch_keyword = true +ij_c_space_before_catch_left_brace = true +ij_c_space_before_catch_parentheses = true +ij_c_space_before_category_parentheses = true +ij_c_space_before_chained_send_message = true +ij_c_space_before_class_left_brace = true +ij_c_space_before_colon = true +ij_c_space_before_comma = false +ij_c_space_before_dictionary_literal_colon = false +ij_c_space_before_do_left_brace = true +ij_c_space_before_else_keyword = true +ij_c_space_before_else_left_brace = true +ij_c_space_before_for_left_brace = true +ij_c_space_before_for_parentheses = true +ij_c_space_before_for_semicolon = false +ij_c_space_before_if_left_brace = true +ij_c_space_before_if_parentheses = true +ij_c_space_before_init_list = false +ij_c_space_before_init_list_colon = true +ij_c_space_before_method_call_parentheses = false +ij_c_space_before_method_left_brace = true +ij_c_space_before_method_parentheses = false +ij_c_space_before_namespace_lbrace = true +ij_c_space_before_pointer_in_declaration = true +ij_c_space_before_property_attributes_parentheses = false +ij_c_space_before_protocols_brackets = true +ij_c_space_before_quest = true +ij_c_space_before_reference_in_declaration = true +ij_c_space_before_superclass_colon = true +ij_c_space_before_switch_left_brace = true +ij_c_space_before_switch_parentheses = true +ij_c_space_before_template_call_lt = false +ij_c_space_before_template_declaration_lt = false +ij_c_space_before_try_left_brace = true +ij_c_space_before_while_keyword = true +ij_c_space_before_while_left_brace = true +ij_c_space_before_while_parentheses = true +ij_c_space_between_adjacent_brackets = false +ij_c_space_between_operator_and_punctuator = false +ij_c_space_within_empty_array_initializer_braces = false +ij_c_spaces_around_additive_operators = true +ij_c_spaces_around_assignment_operators = true +ij_c_spaces_around_bitwise_operators = true +ij_c_spaces_around_equality_operators = true +ij_c_spaces_around_lambda_arrow = true +ij_c_spaces_around_logical_operators = true +ij_c_spaces_around_multiplicative_operators = true +ij_c_spaces_around_pm_operators = false +ij_c_spaces_around_relational_operators = true +ij_c_spaces_around_shift_operators = true +ij_c_spaces_around_unary_operator = false +ij_c_spaces_within_array_initializer_braces = false +ij_c_spaces_within_braces = true +ij_c_spaces_within_brackets = false +ij_c_spaces_within_cast_parentheses = false +ij_c_spaces_within_catch_parentheses = false +ij_c_spaces_within_category_parentheses = false +ij_c_spaces_within_empty_braces = false +ij_c_spaces_within_empty_function_call_parentheses = false +ij_c_spaces_within_empty_function_declaration_parentheses = false +ij_c_spaces_within_empty_lambda_capture_list_bracket = false +ij_c_spaces_within_empty_template_call_ltgt = false +ij_c_spaces_within_empty_template_declaration_ltgt = false +ij_c_spaces_within_for_parentheses = false +ij_c_spaces_within_function_call_parentheses = false +ij_c_spaces_within_function_declaration_parentheses = false +ij_c_spaces_within_if_parentheses = false +ij_c_spaces_within_lambda_capture_list_bracket = false +ij_c_spaces_within_method_parameter_type_parentheses = false +ij_c_spaces_within_method_return_type_parentheses = false +ij_c_spaces_within_parentheses = false +ij_c_spaces_within_property_attributes_parentheses = false +ij_c_spaces_within_protocols_brackets = false +ij_c_spaces_within_send_message_brackets = false +ij_c_spaces_within_switch_parentheses = false +ij_c_spaces_within_template_call_ltgt = false +ij_c_spaces_within_template_declaration_ltgt = false +ij_c_spaces_within_template_double_gt = true +ij_c_spaces_within_while_parentheses = false +ij_c_special_else_if_treatment = true +ij_c_superclass_list_after_colon = never +ij_c_superclass_list_align_multiline = true +ij_c_superclass_list_before_colon = if_long +ij_c_superclass_list_comma_on_next_line = false +ij_c_superclass_list_wrap = on_every_item +ij_c_tag_prefix_of_block_comment = at +ij_c_tag_prefix_of_line_comment = back_slash +ij_c_template_call_arguments_align_multiline = false +ij_c_template_call_arguments_align_multiline_pars = false +ij_c_template_call_arguments_comma_on_next_line = false +ij_c_template_call_arguments_new_line_after_lt = false +ij_c_template_call_arguments_new_line_before_gt = false +ij_c_template_call_arguments_wrap = off +ij_c_template_declaration_function_body_indent = false +ij_c_template_declaration_function_wrap = split_into_lines +ij_c_template_declaration_struct_body_indent = false +ij_c_template_declaration_struct_wrap = split_into_lines +ij_c_template_parameters_align_multiline = false +ij_c_template_parameters_align_multiline_pars = false +ij_c_template_parameters_comma_on_next_line = false +ij_c_template_parameters_new_line_after_lt = false +ij_c_template_parameters_new_line_before_gt = false +ij_c_template_parameters_wrap = off +ij_c_ternary_operation_signs_on_next_line = true +ij_c_ternary_operation_wrap = normal +ij_c_type_qualifiers_placement = before +ij_c_use_modern_casts = true +ij_c_use_setters_in_constructor = true +ij_c_while_brace_force = never +ij_c_while_on_new_line = false +ij_c_wrap_property_declaration = off + +[{*.cmake,CMakeLists.txt}] +ij_cmake_align_multiline_parameters_in_calls = false +ij_cmake_force_commands_case = 2 +ij_cmake_keep_blank_lines_in_code = 2 +ij_cmake_space_before_for_parentheses = true +ij_cmake_space_before_if_parentheses = true +ij_cmake_space_before_method_call_parentheses = false +ij_cmake_space_before_method_parentheses = false +ij_cmake_space_before_while_parentheses = true +ij_cmake_spaces_within_for_parentheses = false +ij_cmake_spaces_within_if_parentheses = false +ij_cmake_spaces_within_method_call_parentheses = false +ij_cmake_spaces_within_method_parentheses = false +ij_cmake_spaces_within_while_parentheses = false + +[{*.gant,*.gradle,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts,*.kt,*.kts,*.main.kts}] +ij_kotlin_align_in_columns_case_branch = true +ij_kotlin_align_multiline_binary_operation = false +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_on_call_site = false +ij_kotlin_assignment_wrap = off +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = false +ij_kotlin_call_parameters_right_paren_on_new_line = false +ij_kotlin_call_parameters_wrap = off +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = off +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = true +ij_kotlin_continuation_indent_for_expression_bodies = true +ij_kotlin_continuation_indent_in_argument_lists = true +ij_kotlin_continuation_indent_in_elvis = true +ij_kotlin_continuation_indent_in_if_conditions = true +ij_kotlin_continuation_indent_in_parameter_lists = true +ij_kotlin_continuation_indent_in_supertype_lists = true +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = off +ij_kotlin_field_annotation_wrap = normal +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = false +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 0 +ij_kotlin_keep_blank_lines_in_code = 1 +ij_kotlin_keep_blank_lines_in_declarations = 1 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = off +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = off +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_use_custom_formatting_for_modifiers = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 0 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal +ij_html_uniform_ident = false + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/SwipeToDismissHandler.kt b/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/SwipeToDismissHandler.kt index ca2c28b498..85d7c13398 100644 --- a/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/SwipeToDismissHandler.kt +++ b/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/SwipeToDismissHandler.kt @@ -44,7 +44,7 @@ class SwipeToDismissHandler( @SuppressLint("ClickableViewAccessibility") override fun onTouch(v: View, event: MotionEvent): Boolean { when (event.action) { - MotionEvent.ACTION_DOWN -> { + MotionEvent.ACTION_DOWN -> { if (swipeView.hitRect.contains(event.x.toInt(), event.y.toInt())) { isTracking = true } @@ -58,7 +58,7 @@ class SwipeToDismissHandler( } return true } - MotionEvent.ACTION_MOVE -> { + MotionEvent.ACTION_MOVE -> { if (isTracking) { val translationY = event.y - startY swipeView.translationY = translationY @@ -66,7 +66,7 @@ class SwipeToDismissHandler( } return true } - else -> { + else -> { return false } } diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt index 96ea99d92f..0cb8003919 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt @@ -216,7 +216,8 @@ class CommonTestHelper(context: Context) { message: String, numberOfMessages: Int, rootThreadEventId: String, - timeout: Long = TestConstants.timeOutMillis): List { + timeout: Long = TestConstants.timeOutMillis + ): List { val timeline = room.timelineService().createTimeline(null, TimelineSettings(10)) timeline.start() val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout, rootThreadEventId) @@ -236,9 +237,11 @@ class CommonTestHelper(context: Context) { * @param testParams test params about the session * @return the session associated with the newly created account */ - private fun createAccount(userNamePrefix: String, - password: String, - testParams: SessionTestParams): Session { + private fun createAccount( + userNamePrefix: String, + password: String, + testParams: SessionTestParams + ): Session { val session = createAccountAndSync( userNamePrefix + "_" + accountNumber++ + "_" + UUID.randomUUID(), password, @@ -256,9 +259,11 @@ class CommonTestHelper(context: Context) { * @param testParams test params about the session * @return the session associated with the existing account */ - fun logIntoAccount(userId: String, - password: String, - testParams: SessionTestParams): Session { + fun logIntoAccount( + userId: String, + password: String, + testParams: SessionTestParams + ): Session { val session = logAccountAndSync(userId, password, testParams) assertNotNull(session) return session @@ -271,9 +276,11 @@ class CommonTestHelper(context: Context) { * @param password the password * @param sessionTestParams parameters for the test */ - private fun createAccountAndSync(userName: String, - password: String, - sessionTestParams: SessionTestParams): Session { + private fun createAccountAndSync( + userName: String, + password: String, + sessionTestParams: SessionTestParams + ): Session { val hs = createHomeServerConfig() runBlockingTest { @@ -309,9 +316,11 @@ class CommonTestHelper(context: Context) { * @param password the password * @param sessionTestParams session test params */ - private fun logAccountAndSync(userName: String, - password: String, - sessionTestParams: SessionTestParams): Session { + private fun logAccountAndSync( + userName: String, + password: String, + sessionTestParams: SessionTestParams + ): Session { val hs = createHomeServerConfig() runBlockingTest { @@ -337,8 +346,10 @@ class CommonTestHelper(context: Context) { * @param userName the account username * @param password the password */ - fun logAccountWithError(userName: String, - password: String): Throwable { + fun logAccountWithError( + userName: String, + password: String + ): Throwable { val hs = createHomeServerConfig() runBlockingTest { @@ -379,8 +390,8 @@ class CommonTestHelper(context: Context) { */ fun await(latch: CountDownLatch, timeout: Long? = TestConstants.timeOutMillis) { assertTrue( - "Timed out after " + timeout + "ms waiting for something to happen. See stacktrace for cause.", - latch.await(timeout ?: TestConstants.timeOutMillis, TimeUnit.MILLISECONDS) + "Timed out after " + timeout + "ms waiting for something to happen. See stacktrace for cause.", + latch.await(timeout ?: TestConstants.timeOutMillis, TimeUnit.MILLISECONDS) ) } diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt index b6bedbd719..41d0d3a7e8 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt @@ -18,8 +18,10 @@ package org.matrix.android.sdk.common import org.matrix.android.sdk.api.session.Session -data class CryptoTestData(val roomId: String, - val sessions: List) { +data class CryptoTestData( + val roomId: String, + val sessions: List +) { val firstSession: Session get() = sessions.first() diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/MockOkHttpInterceptor.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/MockOkHttpInterceptor.kt index b6d833a77c..6dfee2f18f 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/MockOkHttpInterceptor.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/MockOkHttpInterceptor.kt @@ -73,9 +73,11 @@ class MockOkHttpInterceptor : TestInterceptor { /** * Simple rule that reply with the given body for any request that matches the match param */ - class SimpleRule(match: String, - private val code: Int = HttpsURLConnection.HTTP_OK, - private val body: String = "{}") : Rule(match) { + class SimpleRule( + match: String, + private val code: Int = HttpsURLConnection.HTTP_OK, + private val body: String = "{}" + ) : Rule(match) { override fun process(originalRequest: Request): Response? { return Response.Builder() diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixCallback.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixCallback.kt index 9f6d6eb136..a007d684e3 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixCallback.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixCallback.kt @@ -27,8 +27,10 @@ import java.util.concurrent.CountDownLatch * @param onlySuccessful true to fail if an error occurs. This is the default behavior * @param */ -open class TestMatrixCallback(private val countDownLatch: CountDownLatch, - private val onlySuccessful: Boolean = true) : MatrixCallback { +open class TestMatrixCallback( + private val countDownLatch: CountDownLatch, + private val onlySuccessful: Boolean = true +) : MatrixCallback { @CallSuper override fun onSuccess(data: T) { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixComponent.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixComponent.kt index 525e168cf1..daf6b73313 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixComponent.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/TestMatrixComponent.kt @@ -47,7 +47,9 @@ internal interface TestMatrixComponent : MatrixComponent { @Component.Factory interface Factory { - fun create(@BindsInstance context: Context, - @BindsInstance matrixConfiguration: MatrixConfiguration): TestMatrixComponent + fun create( + @BindsInstance context: Context, + @BindsInstance matrixConfiguration: MatrixConfiguration + ): TestMatrixComponent } } diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/ExportEncryptionTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/ExportEncryptionTest.kt index c2d8f4fb35..65ba33cb02 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/ExportEncryptionTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/ExportEncryptionTest.kt @@ -83,7 +83,8 @@ class ExportEncryptionTest { @Test fun checkExportDecrypt1() { val password = "password" - val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXNhbHRzYWx0c2FsdHNhbHSIiIiIiIiIiIiIiIiIiIiIAAAACmIRUW2OjZ3L2l6j9h0lHlV3M2dx\n" + "cissyYBxjsfsAndErh065A8=\n-----END MEGOLM SESSION DATA-----" + val input = + "-----BEGIN MEGOLM SESSION DATA-----\nAXNhbHRzYWx0c2FsdHNhbHSIiIiIiIiIiIiIiIiIiIiIAAAACmIRUW2OjZ3L2l6j9h0lHlV3M2dx\n" + "cissyYBxjsfsAndErh065A8=\n-----END MEGOLM SESSION DATA-----" val expectedString = "plain" var decodedString: String? = null @@ -103,7 +104,8 @@ class ExportEncryptionTest { @Test fun checkExportDecrypt2() { val password = "betterpassword" - val input = "-----BEGIN MEGOLM SESSION DATA-----\nAW1vcmVzYWx0bW9yZXNhbHT//////////wAAAAAAAAAAAAAD6KyBpe1Niv5M5NPm4ZATsJo5nghk\n" + "KYu63a0YQ5DRhUWEKk7CcMkrKnAUiZny\n-----END MEGOLM SESSION DATA-----" + val input = + "-----BEGIN MEGOLM SESSION DATA-----\nAW1vcmVzYWx0bW9yZXNhbHT//////////wAAAAAAAAAAAAAD6KyBpe1Niv5M5NPm4ZATsJo5nghk\n" + "KYu63a0YQ5DRhUWEKk7CcMkrKnAUiZny\n-----END MEGOLM SESSION DATA-----" val expectedString = "Hello, World" var decodedString: String? = null @@ -123,7 +125,8 @@ class ExportEncryptionTest { @Test fun checkExportDecrypt3() { val password = "SWORDFISH" - val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXllc3NhbHR5Z29vZG5lc3P//////////wAAAAAAAAAAAAAD6OIW+Je7gwvjd4kYrb+49gKCfExw\n" + "MgJBMD4mrhLkmgAngwR1pHjbWXaoGybtiAYr0moQ93GrBQsCzPbvl82rZhaXO3iH5uHo/RCEpOqp\nPgg29363BGR+/Ripq/VCLKGNbw==\n-----END MEGOLM SESSION DATA-----" + val input = + "-----BEGIN MEGOLM SESSION DATA-----\nAXllc3NhbHR5Z29vZG5lc3P//////////wAAAAAAAAAAAAAD6OIW+Je7gwvjd4kYrb+49gKCfExw\n" + "MgJBMD4mrhLkmgAngwR1pHjbWXaoGybtiAYr0moQ93GrBQsCzPbvl82rZhaXO3iH5uHo/RCEpOqp\nPgg29363BGR+/Ripq/VCLKGNbw==\n-----END MEGOLM SESSION DATA-----" val expectedString = "alphanumericallyalphanumericallyalphanumericallyalphanumerically" var decodedString: String? = null @@ -202,7 +205,8 @@ class ExportEncryptionTest { @Test fun checkExportEncrypt4() { - val password = "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" + "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" + val password = + "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" + "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" val expectedString = "alphanumericallyalphanumericallyalphanumericallyalphanumerically" var decodedString: String? = null diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/KeyShareTests.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/KeyShareTests.kt index 895f95aeac..49248292e6 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/KeyShareTests.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/KeyShareTests.kt @@ -442,7 +442,7 @@ class KeyShareTests : InstrumentedTest { // Should get a reply from bob and not from alice commonTestHelper.waitWithLatch { latch -> commonTestHelper.retryPeriodicallyWithLatch(latch) { - // Log.d("#TEST", "outgoing key requests :${aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().joinToString { it.sessionId ?: "?" }}") + // Log.d("#TEST", "outgoing key requests :${aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().joinToString { it.sessionId ?: "?" }}") val outgoing = aliceNewSession.cryptoService().getOutgoingRoomKeyRequests().firstOrNull { it.sessionId == sentEventMegolmSession } val bobReply = outgoing?.results?.firstOrNull { it.userId == bobSession.myUserId } val result = bobReply?.result diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupTestHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupTestHelper.kt index 2220536e28..982817b8de 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupTestHelper.kt @@ -33,7 +33,8 @@ import java.util.concurrent.CountDownLatch internal class KeysBackupTestHelper( private val testHelper: CommonTestHelper, - private val cryptoTestHelper: CryptoTestHelper) { + private val cryptoTestHelper: CryptoTestHelper +) { fun waitForKeybackUpBatching() { Thread.sleep(400) @@ -96,8 +97,10 @@ internal class KeysBackupTestHelper( ) } - fun prepareAndCreateKeysBackupData(keysBackup: KeysBackupService, - password: String? = null): PrepareKeysBackupDataResult { + fun prepareAndCreateKeysBackupData( + keysBackup: KeysBackupService, + password: String? = null + ): PrepareKeysBackupDataResult { val stateObserver = StateObserver(keysBackup) val megolmBackupCreationInfo = testHelper.doSync { @@ -169,9 +172,11 @@ internal class KeysBackupTestHelper( * - The new device must have the same count of megolm keys * - Alice must have the same keys on both devices */ - fun checkRestoreSuccess(testData: KeysBackupScenarioData, - total: Int, - imported: Int) { + fun checkRestoreSuccess( + testData: KeysBackupScenarioData, + total: Int, + imported: Int + ) { // - Imported keys number must be correct Assert.assertEquals(testData.aliceKeys.size, total) Assert.assertEquals(total, imported) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/PrepareKeysBackupDataResult.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/PrepareKeysBackupDataResult.kt index 31bd3c9cce..9ee10eddcf 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/PrepareKeysBackupDataResult.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/PrepareKeysBackupDataResult.kt @@ -18,5 +18,7 @@ package org.matrix.android.sdk.internal.crypto.keysbackup import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupCreationInfo -data class PrepareKeysBackupDataResult(val megolmBackupCreationInfo: MegolmBackupCreationInfo, - val version: String) +data class PrepareKeysBackupDataResult( + val megolmBackupCreationInfo: MegolmBackupCreationInfo, + val version: String +) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/StateObserver.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/StateObserver.kt index 80e54d82ec..6c97774547 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/StateObserver.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/keysbackup/StateObserver.kt @@ -27,9 +27,11 @@ import java.util.concurrent.CountDownLatch * This class observe the state change of a KeysBackup object and provide a method to check the several state change * It checks all state transitions and detected forbidden transition */ -internal class StateObserver(private val keysBackup: KeysBackupService, - private val latch: CountDownLatch? = null, - private val expectedStateChange: Int = -1) : KeysBackupStateListener { +internal class StateObserver( + private val keysBackup: KeysBackupService, + private val latch: CountDownLatch? = null, + private val expectedStateChange: Int = -1 +) : KeysBackupStateListener { private val allowedStateTransitions = listOf( KeysBackupState.BackingUp to KeysBackupState.ReadyToBackUp, diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/SASTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/SASTest.kt index 2892cf8464..89a9430a5e 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/SASTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/SASTest.kt @@ -281,14 +281,16 @@ class SASTest : InstrumentedTest { cryptoTestData.cleanUp(testHelper) } - private fun fakeBobStart(bobSession: Session, - aliceUserID: String?, - aliceDevice: String?, - tid: String, - protocols: List = SASDefaultVerificationTransaction.KNOWN_AGREEMENT_PROTOCOLS, - hashes: List = SASDefaultVerificationTransaction.KNOWN_HASHES, - mac: List = SASDefaultVerificationTransaction.KNOWN_MACS, - codes: List = SASDefaultVerificationTransaction.KNOWN_SHORT_CODES) { + private fun fakeBobStart( + bobSession: Session, + aliceUserID: String?, + aliceDevice: String?, + tid: String, + protocols: List = SASDefaultVerificationTransaction.KNOWN_AGREEMENT_PROTOCOLS, + hashes: List = SASDefaultVerificationTransaction.KNOWN_HASHES, + mac: List = SASDefaultVerificationTransaction.KNOWN_MACS, + codes: List = SASDefaultVerificationTransaction.KNOWN_SHORT_CODES + ) { val startMessage = KeyVerificationStart( fromDevice = bobSession.cryptoService().getMyDevice().deviceId, method = VerificationMethod.SAS.toValue(), diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/qrcode/VerificationTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/qrcode/VerificationTest.kt index ceebc3cd01..e2c2e153e1 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/qrcode/VerificationTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/qrcode/VerificationTest.kt @@ -151,10 +151,12 @@ class VerificationTest : InstrumentedTest { // TODO Add tests without SAS - private fun doTest(aliceSupportedMethods: List, - bobSupportedMethods: List, - expectedResultForAlice: ExpectedResult, - expectedResultForBob: ExpectedResult) { + private fun doTest( + aliceSupportedMethods: List, + bobSupportedMethods: List, + expectedResultForAlice: ExpectedResult, + expectedResultForBob: ExpectedResult + ) { val testHelper = CommonTestHelper(context()) val cryptoTestHelper = CryptoTestHelper(testHelper) val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom() diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt index acb23bf723..0560cfec95 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/session/room/send/MarkdownParserTest.kt @@ -289,9 +289,11 @@ class MarkdownParserTest : InstrumentedTest { markdownParser.parse(text).expect(text, null) } - private fun testType(name: String, - markdownPattern: String, - htmlExpectedTag: String) { + private fun testType( + name: String, + markdownPattern: String, + htmlExpectedTag: String + ) { // Test simple case "$markdownPattern$name$markdownPattern" .let { @@ -376,10 +378,12 @@ class MarkdownParserTest : InstrumentedTest { } } - private fun testTypeNewLines(name: String, - markdownPattern: String, - htmlExpectedTag: String, - softBreak: String = "
") { + private fun testTypeNewLines( + name: String, + markdownPattern: String, + htmlExpectedTag: String, + softBreak: String = "
" + ) { // With new line inside the block "$markdownPattern$name\n$name$markdownPattern" .let { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/ChunkEntityTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/ChunkEntityTest.kt index 94b2ba55a3..986d58741c 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/ChunkEntityTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/ChunkEntityTest.kt @@ -154,9 +154,11 @@ internal class ChunkEntityTest : InstrumentedTest { } } - private fun ChunkEntity.addAll(roomId: String, - events: List, - direction: PaginationDirection) { + private fun ChunkEntity.addAll( + roomId: String, + events: List, + direction: PaginationDirection + ) { events.forEach { event -> val fakeEvent = event.toEntity(roomId, SendState.SYNCED, clock.epochMillis()).let { realm.copyToRealm(it) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/FakeTokenChunkEvent.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/FakeTokenChunkEvent.kt index 657f622c5b..2e9478ba7e 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/FakeTokenChunkEvent.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/FakeTokenChunkEvent.kt @@ -19,8 +19,9 @@ package org.matrix.android.sdk.session.room.timeline import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.internal.session.room.timeline.TokenChunkEvent -internal data class FakeTokenChunkEvent(override val start: String?, - override val end: String?, - override val events: List = emptyList(), - override val stateEvents: List = emptyList() +internal data class FakeTokenChunkEvent( + override val start: String?, + override val end: String?, + override val events: List = emptyList(), + override val stateEvents: List = emptyList() ) : TokenChunkEvent diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/RoomDataHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/RoomDataHelper.kt index 8a4429db45..53585ae82a 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/RoomDataHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/RoomDataHelper.kt @@ -41,11 +41,12 @@ object RoomDataHelper { } } - private fun createFakeEvent(type: String, - content: Content? = null, - prevContent: Content? = null, - sender: String = FAKE_TEST_SENDER, - stateKey: String? = null + private fun createFakeEvent( + type: String, + content: Content? = null, + prevContent: Content? = null, + sender: String = FAKE_TEST_SENDER, + stateKey: String? = null ): Event { return Event( type = type, diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt index 6a17cb74ad..b72618c3bd 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt @@ -390,9 +390,10 @@ class SpaceHierarchyTest : InstrumentedTest { val roomIds: List ) - private fun createPublicSpace(session: Session, - spaceName: String, - childInfo: List> + private fun createPublicSpace( + session: Session, + spaceName: String, + childInfo: List> /** Name, auto-join, canonical*/ ): TestSpaceCreationResult { val commonTestHelper = CommonTestHelper(context()) @@ -418,9 +419,10 @@ class SpaceHierarchyTest : InstrumentedTest { return TestSpaceCreationResult(spaceId, roomIds) } - private fun createPrivateSpace(session: Session, - spaceName: String, - childInfo: List> + private fun createPrivateSpace( + session: Session, + spaceName: String, + childInfo: List> /** Name, auto-join, canonical*/ ): TestSpaceCreationResult { val commonTestHelper = CommonTestHelper(context()) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt index 5a19df90c4..af27b5fbff 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/AuthenticationService.kt @@ -93,14 +93,18 @@ interface AuthenticationService { /** * Create a session after a SSO successful login. */ - suspend fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig, - credentials: Credentials): Session + suspend fun createSessionFromSso( + homeServerConnectionConfig: HomeServerConnectionConfig, + credentials: Credentials + ): Session /** * Perform a wellknown request, using the domain from the matrixId. */ - suspend fun getWellKnownData(matrixId: String, - homeServerConnectionConfig: HomeServerConnectionConfig?): WellknownResult + suspend fun getWellKnownData( + matrixId: String, + homeServerConnectionConfig: HomeServerConnectionConfig? + ): WellknownResult /** * Authenticate with a matrixId and a password. @@ -111,9 +115,11 @@ interface AuthenticationService { * @param initialDeviceName the initial device name * @param deviceId the device id, optional. If not provided or null, the server will generate one. */ - suspend fun directAuthentication(homeServerConnectionConfig: HomeServerConnectionConfig, - matrixId: String, - password: String, - initialDeviceName: String, - deviceId: String? = null): Session + suspend fun directAuthentication( + homeServerConnectionConfig: HomeServerConnectionConfig, + matrixId: String, + password: String, + initialDeviceName: String, + deviceId: String? = null + ): Session } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/converter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/converter.kt index 80630bc4e7..c840a7453d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/converter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/converter.kt @@ -41,8 +41,10 @@ import org.matrix.android.sdk.api.auth.registration.TermPolicies * @param userLanguage the user language * @param defaultLanguage the default language to use if the user language is not found for a policy in registrationFlowResponse */ -fun TermPolicies.toLocalizedLoginTerms(userLanguage: String, - defaultLanguage: String = "en"): List { +fun TermPolicies.toLocalizedLoginTerms( + userLanguage: String, + defaultLanguage: String = "en" +): List { val result = ArrayList() val policies = get("policies") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt index 3232025de3..f5670875c2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/login/LoginWizard.kt @@ -39,10 +39,12 @@ interface LoginWizard { * @param deviceId the device id, optional. If not provided or null, the server will generate one. * @return a [Session] if the login is successful */ - suspend fun login(login: String, - password: String, - initialDeviceName: String, - deviceId: String? = null): Session + suspend fun login( + login: String, + password: String, + initialDeviceName: String, + deviceId: String? = null + ): Session /** * Exchange a login token to an access token. @@ -65,8 +67,10 @@ interface LoginWizard { * @param email an email previously associated to the account the user wants the password to be reset. * @param newPassword the desired new password */ - suspend fun resetPassword(email: String, - newPassword: String) + suspend fun resetPassword( + email: String, + newPassword: String + ) /** * Confirm the new password, once the user has checked their email diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt index 0cda64499f..01e068af75 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/registration/RegistrationWizard.kt @@ -54,9 +54,11 @@ interface RegistrationWizard { * @param password the desired password * @param initialDeviceDisplayName the device display name */ - suspend fun createAccount(userName: String?, - password: String?, - initialDeviceDisplayName: String?): RegistrationResult + suspend fun createAccount( + userName: String?, + password: String?, + initialDeviceDisplayName: String? + ): RegistrationResult /** * Perform the "m.login.recaptcha" stage. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/wellknown/WellknownResult.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/wellknown/WellknownResult.kt index 56257db79c..ea5570db1c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/wellknown/WellknownResult.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/auth/wellknown/WellknownResult.kt @@ -26,9 +26,11 @@ sealed class WellknownResult { * Retrieve the specific piece of information from the user in a way which fits within the existing client user experience, * if the client is inclined to do so. Failure can take place instead if no good user experience for this is possible at this point. */ - data class Prompt(val homeServerUrl: String, - val identityServerUrl: String?, - val wellKnown: WellKnown) : WellknownResult() + data class Prompt( + val homeServerUrl: String, + val identityServerUrl: String?, + val wellKnown: WellKnown + ) : WellknownResult() /** * Stop the current auto-discovery mechanism. If no more auto-discovery mechanisms are available, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/account/AccountService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/account/AccountService.kt index 1f28dbd8af..e3d52adfc5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/account/AccountService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/account/AccountService.kt @@ -27,8 +27,10 @@ interface AccountService { * @param password Current password. * @param newPassword New password */ - suspend fun changePassword(password: String, - newPassword: String) + suspend fun changePassword( + password: String, + newPassword: String + ) /** * Deactivate the account. @@ -46,6 +48,8 @@ interface AccountService { * an incomplete view of conversations * @param userInteractiveAuthInterceptor see [UserInteractiveAuthInterceptor] */ - suspend fun deactivateAccount(eraseAllData: Boolean, - userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) + suspend fun deactivateAccount( + eraseAllData: Boolean, + userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor + ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt index e13f7310e0..c87ac3c821 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/call/MxCall.kt @@ -91,10 +91,12 @@ interface MxCall : MxCallDetail { * Send a m.call.replaces event to initiate call transfer. * See [org.matrix.android.sdk.api.session.room.model.call.CallReplacesContent] for documentation about the parameters */ - suspend fun transfer(targetUserId: String, - targetRoomId: String?, - createCallId: String?, - awaitCallId: String?) + suspend fun transfer( + targetUserId: String, + targetRoomId: String?, + createCallId: String?, + awaitCallId: String? + ) fun addListener(listener: StateListener) fun removeListener(listener: StateListener) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/CryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/CryptoService.kt index 35f3ab3162..9cc87b6f71 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/CryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/CryptoService.kt @@ -88,9 +88,11 @@ interface CryptoService { fun getDeviceTrackingStatus(userId: String): Int - suspend fun importRoomKeys(roomKeysAsArray: ByteArray, - password: String, - progressListener: ProgressListener?): ImportRoomKeysResult + suspend fun importRoomKeys( + roomKeysAsArray: ByteArray, + password: String, + progressListener: ProgressListener? + ): ImportRoomKeysResult suspend fun exportRoomKeys(password: String): ByteArray @@ -119,10 +121,12 @@ interface CryptoService { fun isRoomEncrypted(roomId: String): Boolean // TODO This could be removed from this interface - fun encryptEventContent(eventContent: Content, - eventType: String, - roomId: String, - callback: MatrixCallback) + fun encryptEventContent( + eventContent: Content, + eventType: String, + roomId: String, + callback: MatrixCallback + ) fun discardOutboundSession(roomId: String) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/MXCryptoError.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/MXCryptoError.kt index 0b5bbe3bbd..94ee7ba403 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/MXCryptoError.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/MXCryptoError.kt @@ -25,12 +25,14 @@ import org.matrix.olm.OlmException */ sealed class MXCryptoError : Throwable() { - data class Base(val errorType: ErrorType, - val technicalMessage: String, - /** - * Describe the error with more details. - */ - val detailedErrorDescription: String? = null) : MXCryptoError() + data class Base( + val errorType: ErrorType, + val technicalMessage: String, + /** + * Describe the error with more details. + */ + val detailedErrorDescription: String? = null + ) : MXCryptoError() data class OlmError(val olmException: OlmException) : MXCryptoError() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/OutgoingKeyRequest.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/OutgoingKeyRequest.kt index 855f17a34f..7202be7a21 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/OutgoingKeyRequest.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/OutgoingKeyRequest.kt @@ -26,7 +26,7 @@ data class RequestReply( ) sealed class RequestResult { - data class Success(val chainIndex: Int) : RequestResult() + data class Success(val chainIndex: Int) : RequestResult() data class Failure(val code: WithHeldCode) : RequestResult() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/crosssigning/CrossSigningService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/crosssigning/CrossSigningService.kt index 5439389096..69f314f76f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/crosssigning/CrossSigningService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/crosssigning/CrossSigningService.kt @@ -37,14 +37,18 @@ interface CrossSigningService { * Initialize cross signing for this user. * Users needs to enter credentials */ - fun initializeCrossSigning(uiaInterceptor: UserInteractiveAuthInterceptor?, - callback: MatrixCallback) + fun initializeCrossSigning( + uiaInterceptor: UserInteractiveAuthInterceptor?, + callback: MatrixCallback + ) fun isCrossSigningInitialized(): Boolean = getMyCrossSigningKeys() != null - fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?, - uskKeyPrivateKey: String?, - sskPrivateKey: String?): UserTrustResult + fun checkTrustFromPrivateKeys( + masterKeyPrivateKey: String?, + uskKeyPrivateKey: String?, + sskPrivateKey: String? + ): UserTrustResult fun getUserCrossSigningKeys(otherUserId: String): MXCrossSigningInfo? @@ -60,20 +64,26 @@ interface CrossSigningService { fun allPrivateKeysKnown(): Boolean - fun trustUser(otherUserId: String, - callback: MatrixCallback) + fun trustUser( + otherUserId: String, + callback: MatrixCallback + ) fun markMyMasterKeyAsTrusted() /** * Sign one of your devices and upload the signature. */ - fun trustDevice(deviceId: String, - callback: MatrixCallback) + fun trustDevice( + deviceId: String, + callback: MatrixCallback + ) - fun checkDeviceTrust(otherUserId: String, - otherDeviceId: String, - locallyTrusted: Boolean?): DeviceTrustResult + fun checkDeviceTrust( + otherUserId: String, + otherDeviceId: String, + locallyTrusted: Boolean? + ): DeviceTrustResult // FIXME Those method do not have to be in the service fun onSecretMSKGossip(mskPrivateKey: String) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupService.kt index 9029c7f8a3..a0b1604e86 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupService.kt @@ -36,8 +36,10 @@ interface KeysBackupService { * @param keysBackupCreationInfo the info object from [prepareKeysBackupVersion]. * @param callback Asynchronous callback */ - fun createKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo, - callback: MatrixCallback) + fun createKeysBackupVersion( + keysBackupCreationInfo: MegolmBackupCreationInfo, + callback: MatrixCallback + ) /** * Facility method to get the total number of locally stored keys. @@ -55,8 +57,10 @@ interface KeysBackupService { * @param progressListener the callback to follow the progress * @param callback the main callback */ - fun backupAllGroupSessions(progressListener: ProgressListener?, - callback: MatrixCallback?) + fun backupAllGroupSessions( + progressListener: ProgressListener?, + callback: MatrixCallback? + ) /** * Check trust on a key backup version. @@ -64,8 +68,10 @@ interface KeysBackupService { * @param keysBackupVersion the backup version to check. * @param callback block called when the operations completes. */ - fun getKeysBackupTrust(keysBackupVersion: KeysVersionResult, - callback: MatrixCallback) + fun getKeysBackupTrust( + keysBackupVersion: KeysVersionResult, + callback: MatrixCallback + ) /** * Return the current progress of the backup. @@ -79,8 +85,10 @@ interface KeysBackupService { * @param version the backup version * @param callback */ - fun getVersion(version: String, - callback: MatrixCallback) + fun getVersion( + version: String, + callback: MatrixCallback + ) /** * This method fetches the last backup version on the server, then compare to the currently backup version use. @@ -114,9 +122,11 @@ interface KeysBackupService { * @param progressListener a progress listener, as generating private key from password may take a while * @param callback Asynchronous callback */ - fun prepareKeysBackupVersion(password: String?, - progressListener: ProgressListener?, - callback: MatrixCallback) + fun prepareKeysBackupVersion( + password: String?, + progressListener: ProgressListener?, + callback: MatrixCallback + ) /** * Delete a keys backup version. It will delete all backed up keys on the server, and the backup itself. @@ -125,8 +135,10 @@ interface KeysBackupService { * @param version the backup version to delete. * @param callback Asynchronous callback */ - fun deleteBackup(version: String, - callback: MatrixCallback?) + fun deleteBackup( + version: String, + callback: MatrixCallback? + ) /** * Ask if the backup on the server contains keys that we may do not have locally. @@ -142,9 +154,11 @@ interface KeysBackupService { * @param trust the trust to set to the keys backup. * @param callback block called when the operations completes. */ - fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult, - trust: Boolean, - callback: MatrixCallback) + fun trustKeysBackupVersion( + keysBackupVersion: KeysVersionResult, + trust: Boolean, + callback: MatrixCallback + ) /** * Set trust on a keys backup version. @@ -153,9 +167,11 @@ interface KeysBackupService { * @param recoveryKey the recovery key to challenge with the key backup public key. * @param callback block called when the operations completes. */ - fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult, - recoveryKey: String, - callback: MatrixCallback) + fun trustKeysBackupVersionWithRecoveryKey( + keysBackupVersion: KeysVersionResult, + recoveryKey: String, + callback: MatrixCallback + ) /** * Set trust on a keys backup version. @@ -164,9 +180,11 @@ interface KeysBackupService { * @param password the pass phrase to challenge with the keyBackupVersion public key. * @param callback block called when the operations completes. */ - fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult, - password: String, - callback: MatrixCallback) + fun trustKeysBackupVersionWithPassphrase( + keysBackupVersion: KeysVersionResult, + password: String, + callback: MatrixCallback + ) fun onSecretKeyGossip(secret: String) @@ -180,11 +198,13 @@ interface KeysBackupService { * @param stepProgressListener the step progress listener * @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) + fun restoreKeysWithRecoveryKey( + keysVersionResult: KeysVersionResult, + recoveryKey: String, roomId: String?, + sessionId: String?, + stepProgressListener: StepProgressListener?, + callback: MatrixCallback + ) /** * Restore a backup with a password from a given backup version stored on the homeserver. @@ -196,12 +216,14 @@ interface KeysBackupService { * @param stepProgressListener the step progress listener * @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) + fun restoreKeyBackupWithPassword( + keysBackupVersion: KeysVersionResult, + password: String, + roomId: String?, + sessionId: String?, + stepProgressListener: StepProgressListener?, + callback: MatrixCallback + ) val keysBackupVersion: KeysVersionResult? val currentBackupVersion: String? @@ -215,8 +237,10 @@ interface KeysBackupService { fun isValidRecoveryKeyForCurrentVersion(recoveryKey: String, callback: MatrixCallback) - fun computePrivateKey(passphrase: String, - privateKeySalt: String, - privateKeyIterations: Int, - progressListener: ProgressListener): ByteArray + fun computePrivateKey( + passphrase: String, + privateKeySalt: String, + privateKeyIterations: Int, + progressListener: ProgressListener + ): ByteArray } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupVersionTrustSignature.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupVersionTrustSignature.kt index 7127c8d3f4..afbf45ac70 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupVersionTrustSignature.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/keysbackup/KeysBackupVersionTrustSignature.kt @@ -40,7 +40,8 @@ sealed class KeysBackupVersionTrustSignature { /** * Flag to indicate the signature from this device is valid. */ - val valid: Boolean) : KeysBackupVersionTrustSignature() + val valid: Boolean + ) : KeysBackupVersionTrustSignature() data class UserSignature( val keyId: String?, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/EmojiRepresentation.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/EmojiRepresentation.kt index 2c1bf9ff4d..5402471e46 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/EmojiRepresentation.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/EmojiRepresentation.kt @@ -19,7 +19,8 @@ package org.matrix.android.sdk.api.session.crypto.verification import androidx.annotation.DrawableRes import androidx.annotation.StringRes -data class EmojiRepresentation(val emoji: String, - @StringRes val nameResId: Int, - @DrawableRes val drawableRes: Int? = null +data class EmojiRepresentation( + val emoji: String, + @StringRes val nameResId: Int, + @DrawableRes val drawableRes: Int? = null ) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/VerificationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/VerificationService.kt index 321ec73094..ee93f14992 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/VerificationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/crypto/verification/VerificationService.kt @@ -46,54 +46,68 @@ interface VerificationService { fun getExistingVerificationRequestInRoom(roomId: String, tid: String?): PendingVerificationRequest? - fun beginKeyVerification(method: VerificationMethod, - otherUserId: String, - otherDeviceId: String, - transactionId: String?): String? + fun beginKeyVerification( + method: VerificationMethod, + otherUserId: String, + otherDeviceId: String, + transactionId: String? + ): String? /** * Request key verification with another user via room events (instead of the to-device API). */ - fun requestKeyVerificationInDMs(methods: List, - otherUserId: String, - roomId: String, - localId: String? = LocalEcho.createLocalEchoId()): PendingVerificationRequest + fun requestKeyVerificationInDMs( + methods: List, + otherUserId: String, + roomId: String, + localId: String? = LocalEcho.createLocalEchoId() + ): PendingVerificationRequest fun cancelVerificationRequest(request: PendingVerificationRequest) /** * Request a key verification from another user using toDevice events. */ - fun requestKeyVerification(methods: List, - otherUserId: String, - otherDevices: List?): PendingVerificationRequest + fun requestKeyVerification( + methods: List, + otherUserId: String, + otherDevices: List? + ): PendingVerificationRequest - fun declineVerificationRequestInDMs(otherUserId: String, - transactionId: String, - roomId: String) + fun declineVerificationRequestInDMs( + otherUserId: String, + transactionId: String, + roomId: String + ) // Only SAS method is supported for the moment // TODO Parameter otherDeviceId should be removed in this case - fun beginKeyVerificationInDMs(method: VerificationMethod, - transactionId: String, - roomId: String, - otherUserId: String, - otherDeviceId: String): String + fun beginKeyVerificationInDMs( + method: VerificationMethod, + transactionId: String, + roomId: String, + otherUserId: String, + otherDeviceId: String + ): String /** * Returns false if the request is unknown. */ - fun readyPendingVerificationInDMs(methods: List, - otherUserId: String, - roomId: String, - transactionId: String): Boolean + fun readyPendingVerificationInDMs( + methods: List, + otherUserId: String, + roomId: String, + transactionId: String + ): Boolean /** * Returns false if the request is unknown. */ - fun readyPendingVerification(methods: List, - otherUserId: String, - transactionId: String): Boolean + fun readyPendingVerification( + methods: List, + otherUserId: String, + transactionId: String + ): Boolean interface Listener { /** diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/EventService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/EventService.kt index 297f277497..7f275bf952 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/EventService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/EventService.kt @@ -24,6 +24,8 @@ interface EventService { * Ask the homeserver for an event content. The SDK will try to decrypt it if it is possible * The result will not be stored into cache */ - suspend fun getEvent(roomId: String, - eventId: String): Event + suspend fun getEvent( + roomId: String, + eventId: String + ): Event } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/file/FileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/file/FileService.kt index a7c81136e3..ca6c889cb8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/file/FileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/file/FileService.kt @@ -44,10 +44,12 @@ interface FileService { * Download a file if necessary and ensure that if the file is encrypted, the file is decrypted. * Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision. */ - suspend fun downloadFile(fileName: String, - mimeType: String?, - url: String?, - elementToDecrypt: ElementToDecrypt?): File + suspend fun downloadFile( + fileName: String, + mimeType: String?, + url: String?, + elementToDecrypt: ElementToDecrypt? + ): File suspend fun downloadFile(messageContent: MessageWithAttachmentContent): File = downloadFile( @@ -57,10 +59,11 @@ interface FileService { elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt() ) - fun isFileInCache(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt? + fun isFileInCache( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? ): Boolean fun isFileInCache(messageContent: MessageWithAttachmentContent) = @@ -75,10 +78,12 @@ interface FileService { * Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION * (if not other app won't be able to access it). */ - fun getTemporarySharableURI(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt?): Uri? + fun getTemporarySharableURI( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? + ): Uri? fun getTemporarySharableURI(messageContent: MessageWithAttachmentContent): Uri? = getTemporarySharableURI( @@ -92,10 +97,12 @@ interface FileService { * Get information on the given file. * Mimetype should be the same one as passed to downloadFile (limitation for now) */ - fun fileState(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt?): FileState + fun fileState( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? + ): FileState fun fileState(messageContent: MessageWithAttachmentContent): FileState = fileState( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixPermalinkSpan.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixPermalinkSpan.kt index 48b30dfa21..9c71c081be 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixPermalinkSpan.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixPermalinkSpan.kt @@ -25,8 +25,10 @@ import org.matrix.android.sdk.api.session.permalinks.MatrixPermalinkSpan.Callbac * @property url the permalink url tied to the span * @property callback the callback to use. */ -class MatrixPermalinkSpan(private val url: String, - private val callback: Callback? = null) : ClickableSpan() { +class MatrixPermalinkSpan( + private val url: String, + private val callback: Callback? = null +) : ClickableSpan() { interface Callback { fun onUrlClicked(url: String) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/profile/ProfileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/profile/ProfileService.kt index 095f2ef7c2..4c00c76459 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/profile/ProfileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/profile/ProfileService.kt @@ -107,8 +107,10 @@ interface ProfileService { /** * Finalize adding a 3Pids. Call this method once the user has validated that he owns the ThreePid. */ - suspend fun finalizeAddingThreePid(threePid: ThreePid, - userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) + suspend fun finalizeAddingThreePid( + threePid: ThreePid, + userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor + ) /** * Cancel adding a threepid. It will remove locally stored data about this ThreePid. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushers/PushersService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushers/PushersService.kt index 5cb7857021..379f947b89 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushers/PushersService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushers/PushersService.kt @@ -58,12 +58,14 @@ interface PushersService { * email pushers since we don't want to stop other accounts notifying to the same email address. * @throws [InvalidParameterException] if a parameter is not correct */ - suspend fun addEmailPusher(email: String, - lang: String, - emailBranding: String, - appDisplayName: String, - deviceDisplayName: String, - append: Boolean = true) + suspend fun addEmailPusher( + email: String, + lang: String, + emailBranding: String, + appDisplayName: String, + deviceDisplayName: String, + append: Boolean = true + ) /** * Directly ask the push gateway to send a push to this device. @@ -75,10 +77,12 @@ interface PushersService { * @param pushkey the FCM token * @param eventId the eventId which will be sent in the Push message. Use a fake eventId. */ - suspend fun testPush(url: String, - appId: String, - pushkey: String, - eventId: String) + suspend fun testPush( + url: String, + appId: String, + pushkey: String, + eventId: String + ) /** * Remove a registered pusher. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/ConditionResolver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/ConditionResolver.kt index f8a930f987..d64ee5f777 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/ConditionResolver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/ConditionResolver.kt @@ -22,15 +22,23 @@ import org.matrix.android.sdk.api.session.events.model.Event * This class as all required context needed to evaluate rules */ interface ConditionResolver { - fun resolveEventMatchCondition(event: Event, - condition: EventMatchCondition): Boolean + fun resolveEventMatchCondition( + event: Event, + condition: EventMatchCondition + ): Boolean - fun resolveRoomMemberCountCondition(event: Event, - condition: RoomMemberCountCondition): Boolean + fun resolveRoomMemberCountCondition( + event: Event, + condition: RoomMemberCountCondition + ): Boolean - fun resolveSenderNotificationPermissionCondition(event: Event, - condition: SenderNotificationPermissionCondition): Boolean + fun resolveSenderNotificationPermissionCondition( + event: Event, + condition: SenderNotificationPermissionCondition + ): Boolean - fun resolveContainsDisplayNameCondition(event: Event, - condition: ContainsDisplayNameCondition): Boolean + fun resolveContainsDisplayNameCondition( + event: Event, + condition: ContainsDisplayNameCondition + ): Boolean } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/PushRuleService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/PushRuleService.kt index 7ffbc89559..8f9c25fd30 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/PushRuleService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/pushrules/PushRuleService.kt @@ -51,8 +51,10 @@ interface PushRuleService { // fun fulfilledBingRule(event: Event, rules: List): PushRule? - fun resolveSenderNotificationPermissionCondition(event: Event, - condition: SenderNotificationPermissionCondition): Boolean + fun resolveSenderNotificationPermissionCondition( + event: Event, + condition: SenderNotificationPermissionCondition + ): Boolean interface PushRuleListener { fun onEvents(pushEvents: PushEvents) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomDirectoryService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomDirectoryService.kt index cb70603e66..77092c4811 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomDirectoryService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomDirectoryService.kt @@ -28,8 +28,10 @@ interface RoomDirectoryService { /** * Get rooms from directory. */ - suspend fun getPublicRooms(server: String?, - publicRoomsParams: PublicRoomsParams): PublicRoomsResponse + suspend fun getPublicRooms( + server: String?, + publicRoomsParams: PublicRoomsParams + ): PublicRoomsResponse /** * Get the visibility of a room in the directory. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt index 6d5551ddf0..67c5b21390 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/RoomService.kt @@ -60,9 +60,11 @@ interface RoomService { * @param reason optional reason for joining the room * @param viaServers the servers to attempt to join the room through. One of the servers must be participating in the room. */ - suspend fun joinRoom(roomIdOrAlias: String, - reason: String? = null, - viaServers: List = emptyList()) + suspend fun joinRoom( + roomIdOrAlias: String, + reason: String? = null, + viaServers: List = emptyList() + ) /** * @param roomId the roomId of the room to join @@ -101,15 +103,19 @@ interface RoomService { * Get a snapshot list of room summaries. * @return the immutable list of [RoomSummary] */ - fun getRoomSummaries(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): List + fun getRoomSummaries( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): List /** * Get a live list of room summaries. This list is refreshed as soon as the data changes. * @return the [LiveData] of List[RoomSummary] */ - fun getRoomSummariesLive(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData> + fun getRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY + ): LiveData> /** * Get a snapshot list of Breadcrumbs. @@ -139,8 +145,10 @@ interface RoomService { /** * Resolve a room alias to a room ID. */ - suspend fun getRoomIdByAlias(roomAlias: String, - searchOnServer: Boolean): Optional + suspend fun getRoomIdByAlias( + roomAlias: String, + searchOnServer: Boolean + ): Optional /** * Delete a room alias. @@ -205,16 +213,20 @@ interface RoomService { /** * TODO Doc. */ - fun getPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config = defaultPagedListConfig, - sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData> + fun getPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config = defaultPagedListConfig, + sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY + ): LiveData> /** * TODO Doc. */ - fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config = defaultPagedListConfig, - sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): UpdatableLivePageResult + fun getFilteredPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config = defaultPagedListConfig, + sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY + ): UpdatableLivePageResult /** * Return a LiveData on the number of rooms. @@ -240,8 +252,10 @@ interface RoomService { /** * Returns all the children of this space, as LiveData. */ - fun getFlattenRoomSummaryChildrenOfLive(spaceId: String?, - memberships: List = Membership.activeMemberships()): LiveData> + fun getFlattenRoomSummaryChildrenOfLive( + spaceId: String?, + memberships: List = Membership.activeMemberships() + ): LiveData> /** * Refreshes the RoomSummary LatestPreviewContent for the given @param roomId. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationAcceptContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationAcceptContent.kt index 27619cf0a9..33f61648dc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationAcceptContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationAcceptContent.kt @@ -40,12 +40,14 @@ internal data class MessageVerificationAcceptContent( companion object : VerificationInfoAcceptFactory { - override fun create(tid: String, - keyAgreementProtocol: String, - hash: String, - commitment: String, - messageAuthenticationCode: String, - shortAuthenticationStrings: List): VerificationInfoAccept { + override fun create( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept { return MessageVerificationAcceptContent( hash, keyAgreementProtocol, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/relation/RelationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/relation/RelationService.kt index 02c597ee63..d34ea3c7d3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/relation/RelationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/relation/RelationService.kt @@ -58,16 +58,20 @@ interface RelationService { * @param targetEventId the id of the event being reacted * @param reaction the reaction (preferably emoji) */ - fun sendReaction(targetEventId: String, - reaction: String): Cancelable + fun sendReaction( + targetEventId: String, + reaction: String + ): Cancelable /** * Undo a reaction (emoji) to the targetedEvent. * @param targetEventId the id of the event being reacted * @param reaction the reaction (preferably emoji) */ - suspend fun undoReaction(targetEventId: String, - reaction: String): Cancelable + suspend fun undoReaction( + targetEventId: String, + reaction: String + ): Cancelable /** * Edit a poll. @@ -76,10 +80,12 @@ interface RelationService { * @param question The edited question * @param options The edited options */ - fun editPoll(targetEvent: TimelineEvent, - pollType: PollType, - question: String, - options: List): Cancelable + fun editPoll( + targetEvent: TimelineEvent, + pollType: PollType, + question: String, + options: List + ): Cancelable /** * Edit a text message body. Limited to "m.text" contentType. @@ -89,11 +95,13 @@ interface RelationService { * @param newBodyAutoMarkdown true to parse markdown on the new body * @param compatibilityBodyText The text that will appear on clients that don't support yet edition */ - fun editTextMessage(targetEvent: TimelineEvent, - msgType: String, - newBodyText: CharSequence, - newBodyAutoMarkdown: Boolean, - compatibilityBodyText: String = "* $newBodyText"): Cancelable + fun editTextMessage( + targetEvent: TimelineEvent, + msgType: String, + newBodyText: CharSequence, + newBodyAutoMarkdown: Boolean, + compatibilityBodyText: String = "* $newBodyText" + ): Cancelable /** * Edit a reply. This is a special case because replies contains fallback text as a prefix. @@ -103,10 +111,12 @@ interface RelationService { * @param newBodyText The edited body (stripped from in reply to content) * @param compatibilityBodyText The text that will appear on clients that don't support yet edition */ - fun editReply(replyToEdit: TimelineEvent, - originalTimelineEvent: TimelineEvent, - newBodyText: String, - compatibilityBodyText: String = "* $newBodyText"): Cancelable + fun editReply( + replyToEdit: TimelineEvent, + originalTimelineEvent: TimelineEvent, + newBodyText: String, + compatibilityBodyText: String = "* $newBodyText" + ): Cancelable /** * Get the edit history of the given event. @@ -127,11 +137,12 @@ interface RelationService { * @param showInThread If true, relation will be added to the reply in order to be visible from within threads * @param rootThreadEventId If show in thread is true then we need the rootThreadEventId to generate the relation */ - fun replyToMessage(eventReplied: TimelineEvent, - replyText: CharSequence, - autoMarkdown: Boolean = false, - showInThread: Boolean = false, - rootThreadEventId: String? = null + fun replyToMessage( + eventReplied: TimelineEvent, + replyText: CharSequence, + autoMarkdown: Boolean = false, + showInThread: Boolean = false, + rootThreadEventId: String? = null ): Cancelable? /** @@ -159,10 +170,12 @@ interface RelationService { * @param formattedText The formatted body using MessageType#FORMAT_MATRIX_HTML * @param eventReplied the event referenced by the reply within a thread */ - fun replyInThread(rootThreadEventId: String, - replyInThreadText: CharSequence, - msgType: String = MessageType.MSGTYPE_TEXT, - autoMarkdown: Boolean = false, - formattedText: String? = null, - eventReplied: TimelineEvent? = null): Cancelable? + fun replyInThread( + rootThreadEventId: String, + replyInThreadText: CharSequence, + msgType: String = MessageType.MSGTYPE_TEXT, + autoMarkdown: Boolean = false, + formattedText: String? = null, + eventReplied: TimelineEvent? = null + ): Cancelable? } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/send/SendService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/send/SendService.kt index c2e3ded2fa..661c3be5bd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/send/SendService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/send/SendService.kt @@ -76,10 +76,12 @@ interface SendService { * @param rootThreadEventId when this param is not null, the Media will be sent in this specific thread * @return a [Cancelable] */ - fun sendMedia(attachment: ContentAttachmentData, - compressBeforeSending: Boolean, - roomIds: Set, - rootThreadEventId: String? = null): Cancelable + fun sendMedia( + attachment: ContentAttachmentData, + compressBeforeSending: Boolean, + roomIds: Set, + rootThreadEventId: String? = null + ): Cancelable /** * Method to send a list of media asynchronously. @@ -90,10 +92,12 @@ interface SendService { * @param rootThreadEventId when this param is not null, all the Media will be sent in this specific thread * @return a [Cancelable] */ - fun sendMedias(attachments: List, - compressBeforeSending: Boolean, - roomIds: Set, - rootThreadEventId: String? = null): Cancelable + fun sendMedias( + attachments: List, + compressBeforeSending: Boolean, + roomIds: Set, + rootThreadEventId: String? = null + ): Cancelable /** * Send a poll to the room. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadEditions.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadEditions.kt index c8353cf0de..dc9cc886e9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadEditions.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadEditions.kt @@ -16,5 +16,7 @@ package org.matrix.android.sdk.api.session.room.threads.model -data class ThreadEditions(var rootThreadEdition: String? = null, - var latestThreadEdition: String? = null) +data class ThreadEditions( + var rootThreadEdition: String? = null, + var latestThreadEdition: String? = null +) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadSummary.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadSummary.kt index 1ef972e889..0b1aea1966 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadSummary.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/threads/model/ThreadSummary.kt @@ -22,12 +22,14 @@ import org.matrix.android.sdk.api.session.room.sender.SenderInfo /** * The main thread Summary model, mainly used to display the thread list. */ -data class ThreadSummary(val roomId: String, - val rootEvent: Event?, - val latestEvent: Event?, - val rootEventId: String, - val rootThreadSenderInfo: SenderInfo, - val latestThreadSenderInfo: SenderInfo, - val isUserParticipating: Boolean, - val numberOfThreads: Int, - val threadEditions: ThreadEditions = ThreadEditions()) +data class ThreadSummary( + val roomId: String, + val rootEvent: Event?, + val latestEvent: Event?, + val rootEventId: String, + val rootThreadSenderInfo: SenderInfo, + val latestThreadSenderInfo: SenderInfo, + val isUserParticipating: Boolean, + val numberOfThreads: Int, + val threadEditions: ThreadEditions = ThreadEditions() +) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/search/SearchService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/search/SearchService.kt index bc1c9e5769..ffb8b1ca4d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/search/SearchService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/search/SearchService.kt @@ -33,12 +33,14 @@ interface SearchService { * @param afterLimit how many events after the result are returned. * @param includeProfile requests that the server returns the historic profile information for the users that sent the events that were returned. */ - suspend fun search(searchTerm: String, - roomId: String, - nextBatch: String?, - orderByRecent: Boolean, - limit: Int, - beforeLimit: Int, - afterLimit: Int, - includeProfile: Boolean): SearchResult + suspend fun search( + searchTerm: String, + roomId: String, + nextBatch: String?, + orderByRecent: Boolean, + limit: Int, + beforeLimit: Int, + afterLimit: Int, + includeProfile: Boolean + ): SearchResult } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageService.kt index e3a9860523..057fb4c15e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageService.kt @@ -44,10 +44,12 @@ interface SharedSecretStorageService { * * @return key creation info */ - suspend fun generateKey(keyId: String, - key: SsssKeySpec?, - keyName: String, - keySigner: KeySigner?): SsssKeyCreationInfo + suspend fun generateKey( + keyId: String, + key: SsssKeySpec?, + keyName: String, + keySigner: KeySigner? + ): SsssKeyCreationInfo /** * Generates a SSSS key using the given passphrase. @@ -61,11 +63,13 @@ interface SharedSecretStorageService { * * @return key creation info */ - suspend fun generateKeyWithPassphrase(keyId: String, - keyName: String, - passphrase: String, - keySigner: KeySigner, - progressListener: ProgressListener?): SsssKeyCreationInfo + suspend fun generateKeyWithPassphrase( + keyId: String, + keyName: String, + passphrase: String, + keySigner: KeySigner, + progressListener: ProgressListener? + ): SsssKeyCreationInfo fun getKey(keyId: String): KeyInfoResult diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/Space.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/Space.kt index c990388628..61c03e08fc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/Space.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/Space.kt @@ -31,11 +31,13 @@ interface Space { */ fun spaceSummary(): RoomSummary? - suspend fun addChildren(roomId: String, - viaServers: List?, - order: String?, + suspend fun addChildren( + roomId: String, + viaServers: List?, + order: String?, // autoJoin: Boolean = false, - suggested: Boolean? = false) + suggested: Boolean? = false + ) fun getChildInfo(roomId: String): SpaceChildContent? diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt index 38e55664d2..c7a6405014 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt @@ -37,11 +37,13 @@ interface SpaceService { /** * Just a shortcut for space creation for ease of use. */ - suspend fun createSpace(name: String, - topic: String?, - avatarUri: Uri?, - isPublic: Boolean, - roomAliasLocalPart: String? = null): String + suspend fun createSpace( + name: String, + topic: String?, + avatarUri: Uri?, + isPublic: Boolean, + roomAliasLocalPart: String? = null + ): String /** * Get a space from a spaceId. @@ -68,25 +70,33 @@ interface SpaceService { * then the parameters given for suggested_only and max_depth must be the same. * @param knownStateList when paginating, pass back the m.space.child state events */ - suspend fun querySpaceChildren(spaceId: String, - suggestedOnly: Boolean? = null, - limit: Int? = null, - from: String? = null, - knownStateList: List? = null): SpaceHierarchyData + suspend fun querySpaceChildren( + spaceId: String, + suggestedOnly: Boolean? = null, + limit: Int? = null, + from: String? = null, + knownStateList: List? = null + ): SpaceHierarchyData /** * Get a live list of space summaries. This list is refreshed as soon as the data changes. * @return the [LiveData] of List[SpaceSummary] */ - fun getSpaceSummariesLive(queryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): LiveData> + fun getSpaceSummariesLive( + queryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): LiveData> - fun getSpaceSummaries(spaceSummaryQueryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): List + fun getSpaceSummaries( + spaceSummaryQueryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): List - suspend fun joinSpace(spaceIdOrAlias: String, - reason: String? = null, - viaServers: List = emptyList()): JoinSpaceResult + suspend fun joinSpace( + spaceIdOrAlias: String, + reason: String? = null, + viaServers: List = emptyList() + ): JoinSpaceResult suspend fun rejectInvite(spaceId: String, reason: String?) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/statistics/StatisticEvent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/statistics/StatisticEvent.kt index 76755517ce..d9c7772393 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/statistics/StatisticEvent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/statistics/StatisticEvent.kt @@ -23,15 +23,19 @@ sealed interface StatisticEvent { /** * Initial sync request, response downloading, and treatment (parsing and storage) of response. */ - data class InitialSyncRequest(val requestDurationMs: Int, - val downloadDurationMs: Int, - val treatmentDurationMs: Int, - val nbOfJoinedRooms: Int) : StatisticEvent + data class InitialSyncRequest( + val requestDurationMs: Int, + val downloadDurationMs: Int, + val treatmentDurationMs: Int, + val nbOfJoinedRooms: Int + ) : StatisticEvent /** * Incremental sync event. */ - data class SyncTreatment(val durationMs: Int, - val afterPause: Boolean, - val nbOfJoinedRooms: Int) : StatisticEvent + data class SyncTreatment( + val durationMs: Int, + val afterPause: Boolean, + val nbOfJoinedRooms: Int + ) : StatisticEvent } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/sync/model/RoomSyncUnreadNotifications.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/sync/model/RoomSyncUnreadNotifications.kt index 6618bceacd..09273f56e6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/sync/model/RoomSyncUnreadNotifications.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/sync/model/RoomSyncUnreadNotifications.kt @@ -38,4 +38,5 @@ data class RoomSyncUnreadNotifications( /** * The number of highlighted unread messages (subset of notifications). */ - @Json(name = "highlight_count") val highlightCount: Int? = null) + @Json(name = "highlight_count") val highlightCount: Int? = null +) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsResponse.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsResponse.kt index 9a30b4d764..ae728326cc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsResponse.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsResponse.kt @@ -30,8 +30,10 @@ data class TermsResponse( val policies: JsonDict? = null ) { - fun getLocalizedTerms(userLanguage: String, - defaultLanguage: String = "en"): List { + fun getLocalizedTerms( + userLanguage: String, + defaultLanguage: String = "en" + ): List { return policies?.map { val tos = policies[it.key] as? Map<*, *> ?: return@map null ((tos[userLanguage] ?: tos[defaultLanguage]) as? Map<*, *>)?.let { termsMap -> diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsService.kt index 6c357b2224..1ddce763d1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/terms/TermsService.kt @@ -24,10 +24,12 @@ interface TermsService { suspend fun getTerms(serviceType: ServiceType, baseUrl: String): GetTermsResponse - suspend fun agreeToTerms(serviceType: ServiceType, - baseUrl: String, - agreedUrls: List, - token: String?) + suspend fun agreeToTerms( + serviceType: ServiceType, + baseUrl: String, + agreedUrls: List, + token: String? + ) /** * Get the homeserver terms, from the register API. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/util/MatrixItem.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/util/MatrixItem.kt index 8a29d00380..ec775d640e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/util/MatrixItem.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/util/MatrixItem.kt @@ -33,9 +33,11 @@ sealed class MatrixItem( open val displayName: String?, open val avatarUrl: String? ) { - data class UserItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class UserItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName?.removeSuffix(IRC_PATTERN), avatarUrl) { init { @@ -45,10 +47,12 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class EveryoneInRoomItem(override val id: String, - override val displayName: String = NOTIFY_EVERYONE, - override val avatarUrl: String? = null, - val roomDisplayName: String? = null) : + data class EveryoneInRoomItem( + override val id: String, + override val displayName: String = NOTIFY_EVERYONE, + override val avatarUrl: String? = null, + val roomDisplayName: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() @@ -57,9 +61,11 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class EventItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class EventItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() @@ -68,9 +74,11 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class RoomItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class RoomItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() @@ -79,9 +87,11 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class SpaceItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class SpaceItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() @@ -90,9 +100,11 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class RoomAliasItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class RoomAliasItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() @@ -101,9 +113,11 @@ sealed class MatrixItem( override fun updateAvatar(newAvatar: String?) = copy(avatarUrl = newAvatar) } - data class GroupItem(override val id: String, - override val displayName: String? = null, - override val avatarUrl: String? = null) : + data class GroupItem( + override val id: String, + override val displayName: String? = null, + override val avatarUrl: String? = null + ) : MatrixItem(id, displayName, avatarUrl) { init { if (BuildConfig.DEBUG) checkId() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/SessionManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/SessionManager.kt index 934d61de45..1950c62995 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/SessionManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/SessionManager.kt @@ -27,8 +27,10 @@ import org.matrix.android.sdk.internal.session.SessionComponent import javax.inject.Inject @MatrixScope -internal class SessionManager @Inject constructor(private val matrixComponent: MatrixComponent, - private val sessionParamsStore: SessionParamsStore) { +internal class SessionManager @Inject constructor( + private val matrixComponent: MatrixComponent, + private val sessionParamsStore: SessionParamsStore +) { // SessionId -> SessionComponent private val sessionComponents = HashMap() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt index 46fa63334c..ea4502824e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthAPI.kt @@ -98,15 +98,19 @@ internal interface AuthAPI { * https://github.com/matrix-org/matrix-doc/pull/2290 */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "register/{threePid}/requestToken") - suspend fun add3Pid(@Path("threePid") threePid: String, - @Body params: AddThreePidRegistrationParams): AddThreePidRegistrationResponse + suspend fun add3Pid( + @Path("threePid") threePid: String, + @Body params: AddThreePidRegistrationParams + ): AddThreePidRegistrationResponse /** * Validate 3pid. */ @POST - suspend fun validate3Pid(@Url url: String, - @Body params: ValidationCodeBody): SuccessResult + suspend fun validate3Pid( + @Url url: String, + @Body params: ValidationCodeBody + ): SuccessResult /** * Get the supported login flow. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthModule.kt index 298e116199..ddb70be906 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/AuthModule.kt @@ -46,9 +46,11 @@ internal abstract class AuthModule { @JvmStatic @Provides @AuthDatabase - fun providesRealmConfiguration(context: Context, - realmKeysUtils: RealmKeysUtils, - authRealmMigration: AuthRealmMigration): RealmConfiguration { + fun providesRealmConfiguration( + context: Context, + realmKeysUtils: RealmKeysUtils, + authRealmMigration: AuthRealmMigration + ): RealmConfiguration { val old = File(context.filesDir, "matrix-sdk-auth") if (old.exists()) { old.renameTo(File(context.filesDir, "matrix-sdk-auth.realm")) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt index 02dfce04b5..9c3fe72069 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/DefaultAuthenticationService.kt @@ -368,13 +368,17 @@ internal class DefaultAuthenticationService @Inject constructor( pendingSessionStore.delete() } - override suspend fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig, - credentials: Credentials): Session { + override suspend fun createSessionFromSso( + homeServerConnectionConfig: HomeServerConnectionConfig, + credentials: Credentials + ): Session { return sessionCreator.createSession(credentials, homeServerConnectionConfig) } - override suspend fun getWellKnownData(matrixId: String, - homeServerConnectionConfig: HomeServerConnectionConfig?): WellknownResult { + override suspend fun getWellKnownData( + matrixId: String, + homeServerConnectionConfig: HomeServerConnectionConfig? + ): WellknownResult { if (!MatrixPatterns.isUserId(matrixId)) { throw MatrixIdFailure.InvalidMatrixId } @@ -392,11 +396,13 @@ internal class DefaultAuthenticationService @Inject constructor( .withHomeServerUri("https://dummy.org") .build() - override suspend fun directAuthentication(homeServerConnectionConfig: HomeServerConnectionConfig, - matrixId: String, - password: String, - initialDeviceName: String, - deviceId: String?): Session { + override suspend fun directAuthentication( + homeServerConnectionConfig: HomeServerConnectionConfig, + matrixId: String, + password: String, + initialDeviceName: String, + deviceId: String? + ): Session { return directLoginTask.execute( DirectLoginTask.Params( homeServerConnectionConfig = homeServerConnectionConfig, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/PasswordLoginParams.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/PasswordLoginParams.kt index 5be480f633..5f0a2298cb 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/PasswordLoginParams.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/data/PasswordLoginParams.kt @@ -31,7 +31,8 @@ internal data class PasswordLoginParams( @Json(name = "password") val password: String, @Json(name = "type") override val type: String, @Json(name = "initial_device_display_name") val deviceDisplayName: String?, - @Json(name = "device_id") val deviceId: String?) : LoginParams { + @Json(name = "device_id") val deviceId: String? +) : LoginParams { companion object { private const val IDENTIFIER_KEY_TYPE = "type" @@ -47,10 +48,12 @@ internal data class PasswordLoginParams( private const val IDENTIFIER_KEY_COUNTRY = "country" private const val IDENTIFIER_KEY_PHONE = "phone" - fun userIdentifier(user: String, - password: String, - deviceDisplayName: String?, - deviceId: String?): PasswordLoginParams { + fun userIdentifier( + user: String, + password: String, + deviceDisplayName: String?, + deviceId: String? + ): PasswordLoginParams { return PasswordLoginParams( identifier = mapOf( IDENTIFIER_KEY_TYPE to IDENTIFIER_KEY_TYPE_USER, @@ -63,11 +66,13 @@ internal data class PasswordLoginParams( ) } - fun thirdPartyIdentifier(medium: String, - address: String, - password: String, - deviceDisplayName: String?, - deviceId: String?): PasswordLoginParams { + fun thirdPartyIdentifier( + medium: String, + address: String, + password: String, + deviceDisplayName: String?, + deviceId: String? + ): PasswordLoginParams { return PasswordLoginParams( identifier = mapOf( IDENTIFIER_KEY_TYPE to IDENTIFIER_KEY_TYPE_THIRD_PARTY, @@ -81,11 +86,13 @@ internal data class PasswordLoginParams( ) } - fun phoneIdentifier(country: String, - phone: String, - password: String, - deviceDisplayName: String?, - deviceId: String?): PasswordLoginParams { + fun phoneIdentifier( + country: String, + phone: String, + password: String, + deviceDisplayName: String?, + deviceId: String? + ): PasswordLoginParams { return PasswordLoginParams( identifier = mapOf( IDENTIFIER_KEY_TYPE to IDENTIFIER_KEY_TYPE_PHONE, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmPendingSessionStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmPendingSessionStore.kt index 13f26e321d..aae8ff8419 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmPendingSessionStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmPendingSessionStore.kt @@ -23,9 +23,10 @@ import org.matrix.android.sdk.internal.database.awaitTransaction import org.matrix.android.sdk.internal.di.AuthDatabase import javax.inject.Inject -internal class RealmPendingSessionStore @Inject constructor(private val mapper: PendingSessionMapper, - @AuthDatabase - private val realmConfiguration: RealmConfiguration +internal class RealmPendingSessionStore @Inject constructor( + private val mapper: PendingSessionMapper, + @AuthDatabase + private val realmConfiguration: RealmConfiguration ) : PendingSessionStore { override suspend fun savePendingSessionData(pendingSessionData: PendingSessionData) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmSessionParamsStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmSessionParamsStore.kt index 235ef6b709..4c3e3ca824 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmSessionParamsStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/db/RealmSessionParamsStore.kt @@ -28,9 +28,10 @@ import org.matrix.android.sdk.internal.di.AuthDatabase import timber.log.Timber import javax.inject.Inject -internal class RealmSessionParamsStore @Inject constructor(private val mapper: SessionParamsMapper, - @AuthDatabase - private val realmConfiguration: RealmConfiguration +internal class RealmSessionParamsStore @Inject constructor( + private val mapper: SessionParamsMapper, + @AuthDatabase + private val realmConfiguration: RealmConfiguration ) : SessionParamsStore { override fun getLast(): SessionParams? { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/login/DefaultLoginWizard.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/login/DefaultLoginWizard.kt index 0583951138..0a189f86e6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/login/DefaultLoginWizard.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/login/DefaultLoginWizard.kt @@ -52,10 +52,12 @@ internal class DefaultLoginWizard( return getProfileTask.execute(GetProfileTask.Params(matrixId)) } - override suspend fun login(login: String, - password: String, - initialDeviceName: String, - deviceId: String?): Session { + override suspend fun login( + login: String, + password: String, + initialDeviceName: String, + deviceId: String? + ): Session { val loginParams = if (Patterns.EMAIL_ADDRESS.matcher(login).matches()) { PasswordLoginParams.thirdPartyIdentifier( medium = ThreePidMedium.EMAIL, 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 8f00f3440c..9cc73b00b4 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 @@ -69,9 +69,11 @@ internal class DefaultRegistrationWizard( return performRegistrationRequest(params) } - override suspend fun createAccount(userName: String?, - password: String?, - initialDeviceDisplayName: String?): RegistrationResult { + override suspend fun createAccount( + userName: String?, + password: String?, + initialDeviceDisplayName: String? + ): RegistrationResult { val params = RegistrationParams( username = userName, password = password, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/ThreePidData.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/ThreePidData.kt index c8f71af306..70615809d8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/ThreePidData.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/ThreePidData.kt @@ -40,9 +40,11 @@ internal data class ThreePidData( } companion object { - fun from(threePid: RegisterThreePid, - addThreePidRegistrationResponse: AddThreePidRegistrationResponse, - registrationParams: RegistrationParams): ThreePidData { + fun from( + threePid: RegisterThreePid, + addThreePidRegistrationResponse: AddThreePidRegistrationResponse, + registrationParams: RegistrationParams + ): ThreePidData { return when (threePid) { is RegisterThreePid.Email -> ThreePidData(threePid.email, "", "", addThreePidRegistrationResponse, registrationParams) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/UIAExt.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/UIAExt.kt index 9b135c347d..8118f9faff 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/UIAExt.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/auth/registration/UIAExt.kt @@ -35,9 +35,11 @@ import kotlin.coroutines.suspendCoroutine * @return UiaResult if UIA handled, failed or cancelled * */ -internal suspend fun handleUIA(failure: Throwable, - interceptor: UserInteractiveAuthInterceptor, - retryBlock: suspend (UIABaseAuth) -> Unit): UiaResult { +internal suspend fun handleUIA( + failure: Throwable, + interceptor: UserInteractiveAuthInterceptor, + retryBlock: suspend (UIABaseAuth) -> Unit +): UiaResult { Timber.d("## UIA: check error ${failure.message}") val flowResponse = failure.toRegistrationFlowResponse() ?: return UiaResult.FAILURE.also { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt index 2265526484..c69a859016 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt @@ -110,10 +110,12 @@ internal abstract class CryptoModule { @Provides @CryptoDatabase @SessionScope - fun providesRealmConfiguration(@SessionFilesDirectory directory: File, - @UserMd5 userMd5: String, - realmKeysUtils: RealmKeysUtils, - realmCryptoStoreMigration: RealmCryptoStoreMigration): RealmConfiguration { + fun providesRealmConfiguration( + @SessionFilesDirectory directory: File, + @UserMd5 userMd5: String, + realmKeysUtils: RealmKeysUtils, + realmCryptoStoreMigration: RealmCryptoStoreMigration + ): RealmConfiguration { return RealmConfiguration.Builder() .directory(directory) .apply { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt index 824478f1d3..a5afe3f81d 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt @@ -592,10 +592,12 @@ internal class DefaultCryptoService @Inject constructor( * @param membersId list of members to start tracking their devices * @return true if the operation succeeds. */ - private suspend fun setEncryptionInRoom(roomId: String, - algorithm: String?, - inhibitDeviceQuery: Boolean, - membersId: List): Boolean { + private suspend fun setEncryptionInRoom( + roomId: String, + algorithm: String?, + inhibitDeviceQuery: Boolean, + membersId: List + ): Boolean { // If we already have encryption in this room, we should ignore this event // (for now at least. Maybe we should alert the user somehow?) val existingAlgorithm = cryptoStore.getRoomAlgorithm(roomId) @@ -691,10 +693,12 @@ internal class DefaultCryptoService @Inject constructor( * @param roomId the room identifier the event will be sent. * @param callback the asynchronous callback */ - override fun encryptEventContent(eventContent: Content, - eventType: String, - roomId: String, - callback: MatrixCallback) { + override fun encryptEventContent( + eventContent: Content, + eventType: String, + roomId: String, + callback: MatrixCallback + ) { // moved to crypto scope to have uptodate values cryptoCoroutineScope.launch(coroutineDispatchers.crypto) { val userIds = getRoomUserIds(roomId) @@ -879,8 +883,10 @@ internal class DefaultCryptoService @Inject constructor( /** * Returns true if handled by SDK, otherwise should be sent to application layer. */ - private fun handleSDKLevelGossip(secretName: String?, - secretValue: String): Boolean { + private fun handleSDKLevelGossip( + secretName: String?, + secretValue: String + ): Boolean { return when (secretName) { MASTER_KEY_SSSS_NAME -> { crossSigningService.onSecretMSKGossip(secretValue) @@ -1022,9 +1028,11 @@ internal class DefaultCryptoService @Inject constructor( * @param progressListener the progress listener * @return the result ImportRoomKeysResult */ - override suspend fun importRoomKeys(roomKeysAsArray: ByteArray, - password: String, - progressListener: ProgressListener?): ImportRoomKeysResult { + override suspend fun importRoomKeys( + roomKeysAsArray: ByteArray, + password: String, + progressListener: ProgressListener? + ): ImportRoomKeysResult { return withContext(coroutineDispatchers.crypto) { Timber.tag(loggerTag.value).v("importRoomKeys starts") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/InboundGroupSessionStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/InboundGroupSessionStore.kt index 28ddf291b2..e4d322cadd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/InboundGroupSessionStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/InboundGroupSessionStore.kt @@ -44,7 +44,8 @@ private val loggerTag = LoggerTag("InboundGroupSessionStore", LoggerTag.CRYPTO) internal class InboundGroupSessionStore @Inject constructor( private val store: IMXCryptoStore, private val cryptoCoroutineScope: CoroutineScope, - private val coroutineDispatchers: MatrixCoroutineDispatchers) { + private val coroutineDispatchers: MatrixCoroutineDispatchers +) { private data class CacheKey( val sessionId: String, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingKeyRequestManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingKeyRequestManager.kt index 13f2fb861a..f8baab7c06 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingKeyRequestManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingKeyRequestManager.kt @@ -369,9 +369,11 @@ internal class IncomingKeyRequestManager @Inject constructor( shareMegolmKey(validReq, requestingDevice, null) } - private suspend fun shareMegolmKey(validRequest: ValidMegolmRequestBody, - requestingDevice: CryptoDeviceInfo, - chainIndex: Long?): Boolean { + private suspend fun shareMegolmKey( + validRequest: ValidMegolmRequestBody, + requestingDevice: CryptoDeviceInfo, + chainIndex: Long? + ): Boolean { Timber.tag(loggerTag.value) .d("try to re-share Megolm Key at index $chainIndex for ${validRequest.shortDbgString()}") 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 6c18f29307..8fe200a349 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 @@ -599,13 +599,15 @@ internal class MXOlmDevice @Inject constructor( * @param exportFormat true if the megolm keys are in export format * @return true if the operation succeeds. */ - fun addInboundGroupSession(sessionId: String, - sessionKey: String, - roomId: String, - senderKey: String, - forwardingCurve25519KeyChain: List, - keysClaimed: Map, - exportFormat: Boolean): AddSessionResult { + fun addInboundGroupSession( + sessionId: String, + sessionKey: String, + roomId: String, + senderKey: String, + forwardingCurve25519KeyChain: List, + keysClaimed: Map, + exportFormat: Boolean + ): AddSessionResult { val candidateSession = OlmInboundGroupSessionWrapper2(sessionKey, exportFormat) val existingSessionHolder = tryOrNull { getInboundGroupSession(sessionId, senderKey, roomId) } val existingSession = existingSessionHolder?.wrapper @@ -760,11 +762,13 @@ internal class MXOlmDevice @Inject constructor( * @return the decrypting result. Nil if the sessionId is unknown. */ @Throws(MXCryptoError::class) - suspend fun decryptGroupMessage(body: String, - roomId: String, - timeline: String?, - sessionId: String, - senderKey: String): OlmDecryptionResult { + suspend fun decryptGroupMessage( + body: String, + roomId: String, + timeline: String?, + sessionId: String, + senderKey: String + ): OlmDecryptionResult { val sessionHolder = getInboundGroupSession(sessionId, senderKey, roomId) val wrapper = sessionHolder.wrapper val inboundGroupSession = wrapper.olmInboundGroupSession diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/ObjectSigner.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/ObjectSigner.kt index ab562d954a..3f4b633ea0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/ObjectSigner.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/ObjectSigner.kt @@ -19,8 +19,10 @@ package org.matrix.android.sdk.internal.crypto import org.matrix.android.sdk.api.auth.data.Credentials import javax.inject.Inject -internal class ObjectSigner @Inject constructor(private val credentials: Credentials, - private val olmDevice: MXOlmDevice) { +internal class ObjectSigner @Inject constructor( + private val credentials: Credentials, + private val olmDevice: MXOlmDevice +) { /** * Sign Object. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OutgoingKeyRequestManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OutgoingKeyRequestManager.kt index d7652d0771..6e2ff5c22b 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OutgoingKeyRequestManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OutgoingKeyRequestManager.kt @@ -71,7 +71,8 @@ internal class OutgoingKeyRequestManager @Inject constructor( private val inboundGroupSessionStore: InboundGroupSessionStore, private val sendToDeviceTask: SendToDeviceTask, private val deviceListManager: DeviceListManager, - private val perSessionBackupQueryRateLimiter: PerSessionBackupQueryRateLimiter) { + private val perSessionBackupQueryRateLimiter: PerSessionBackupQueryRateLimiter +) { private val dispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher() private val outgoingRequestScope = CoroutineScope(SupervisorJob() + dispatcher) @@ -180,13 +181,15 @@ internal class OutgoingKeyRequestManager @Inject constructor( } } - fun onRoomKeyForwarded(sessionId: String, - algorithm: String, - roomId: String, - senderKey: String, - fromDevice: String?, - fromIndex: Int, - event: Event) { + fun onRoomKeyForwarded( + sessionId: String, + algorithm: String, + roomId: String, + senderKey: String, + fromDevice: String?, + fromIndex: Int, + event: Event + ) { Timber.tag(loggerTag.value).d("Key forwarded for $sessionId from ${event.senderId}|$fromDevice at index $fromIndex") outgoingRequestScope.launch { sequencer.post { @@ -208,12 +211,14 @@ internal class OutgoingKeyRequestManager @Inject constructor( } } - fun onRoomKeyWithHeld(sessionId: String, - algorithm: String, - roomId: String, - senderKey: String, - fromDevice: String?, - event: Event) { + fun onRoomKeyWithHeld( + sessionId: String, + algorithm: String, + roomId: String, + senderKey: String, + fromDevice: String?, + event: Event + ) { outgoingRequestScope.launch { sequencer.post { Timber.tag(loggerTag.value).d("Withheld received for $sessionId from ${event.senderId}|$fromDevice") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForDevicesAction.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForDevicesAction.kt index c728f1b682..c263192fee 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForDevicesAction.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForDevicesAction.kt @@ -39,7 +39,8 @@ private val loggerTag = LoggerTag("EnsureOlmSessionsForDevicesAction", LoggerTag internal class EnsureOlmSessionsForDevicesAction @Inject constructor( private val olmDevice: MXOlmDevice, private val coroutineDispatchers: MatrixCoroutineDispatchers, - private val oneTimeKeysForUsersDeviceTask: ClaimOneTimeKeysForUsersDeviceTask) { + private val oneTimeKeysForUsersDeviceTask: ClaimOneTimeKeysForUsersDeviceTask +) { private val ensureMutex = Mutex() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForUsersAction.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForUsersAction.kt index 4c5720daf2..da09524668 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForUsersAction.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/EnsureOlmSessionsForUsersAction.kt @@ -23,9 +23,11 @@ import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore import timber.log.Timber import javax.inject.Inject -internal class EnsureOlmSessionsForUsersAction @Inject constructor(private val olmDevice: MXOlmDevice, - private val cryptoStore: IMXCryptoStore, - private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction) { +internal class EnsureOlmSessionsForUsersAction @Inject constructor( + private val olmDevice: MXOlmDevice, + private val cryptoStore: IMXCryptoStore, + private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction +) { /** * Try to make sure we have established olm sessions for the given users. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt index 67d73c21ed..f6ab96aee6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt @@ -33,11 +33,12 @@ import javax.inject.Inject private val loggerTag = LoggerTag("MegolmSessionDataImporter", LoggerTag.CRYPTO) -internal class MegolmSessionDataImporter @Inject constructor(private val olmDevice: MXOlmDevice, - private val roomDecryptorProvider: RoomDecryptorProvider, - private val outgoingKeyRequestManager: OutgoingKeyRequestManager, - private val cryptoStore: IMXCryptoStore, - private val clock: Clock, +internal class MegolmSessionDataImporter @Inject constructor( + private val olmDevice: MXOlmDevice, + private val roomDecryptorProvider: RoomDecryptorProvider, + private val outgoingKeyRequestManager: OutgoingKeyRequestManager, + private val cryptoStore: IMXCryptoStore, + private val clock: Clock, ) { /** @@ -50,9 +51,11 @@ internal class MegolmSessionDataImporter @Inject constructor(private val olmDevi * @return import room keys result */ @WorkerThread - fun handle(megolmSessionsData: List, - fromBackup: Boolean, - progressListener: ProgressListener?): ImportRoomKeysResult { + fun handle( + megolmSessionsData: List, + fromBackup: Boolean, + progressListener: ProgressListener? + ): ImportRoomKeysResult { val t0 = clock.epochMillis() val totalNumbersOfKeys = megolmSessionsData.size diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MessageEncrypter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MessageEncrypter.kt index 919e38c391..eff2132820 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MessageEncrypter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MessageEncrypter.kt @@ -36,7 +36,8 @@ internal class MessageEncrypter @Inject constructor( private val userId: String, @DeviceId private val deviceId: String?, - private val olmDevice: MXOlmDevice) { + private val olmDevice: MXOlmDevice +) { /** * Encrypt an event payload for a list of devices. * This method must be called from the getCryptoHandler() thread. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/SetDeviceVerificationAction.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/SetDeviceVerificationAction.kt index 60181138fb..6028b1a5a2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/SetDeviceVerificationAction.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/SetDeviceVerificationAction.kt @@ -26,7 +26,8 @@ import javax.inject.Inject internal class SetDeviceVerificationAction @Inject constructor( private val cryptoStore: IMXCryptoStore, @UserId private val userId: String, - private val defaultKeysBackupService: DefaultKeysBackupService) { + private val defaultKeysBackupService: DefaultKeysBackupService +) { fun handle(trustLevel: DeviceTrustLevel, userId: String, deviceId: String) { val device = cryptoStore.getUserDevice(userId, deviceId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/IMXGroupEncryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/IMXGroupEncryption.kt index 8cf01f1972..9ec78f37cf 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/IMXGroupEncryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/IMXGroupEncryption.kt @@ -45,8 +45,10 @@ internal interface IMXGroupEncryption { * * @return true in case of success */ - suspend fun reshareKey(groupSessionId: String, - userId: String, - deviceId: String, - senderKey: String): Boolean + suspend fun reshareKey( + groupSessionId: String, + userId: String, + deviceId: String, + senderKey: String + ): Boolean } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt index d15b18ec79..92cff5d9fa 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmDecryption.kt @@ -148,7 +148,8 @@ internal class MXMegolmDecryption( throw MXCryptoError.Base( MXCryptoError.ErrorType.KEYS_WITHHELD, withHeldInfo.code?.value ?: "", - withHeldInfo.reason) + withHeldInfo.reason + ) } if (requestKeysOnFail) { @@ -248,9 +249,9 @@ internal class MXMegolmDecryption( ) when (addSessionResult) { - is MXOlmDevice.AddSessionResult.Imported -> addSessionResult.ratchetIndex + is MXOlmDevice.AddSessionResult.Imported -> addSessionResult.ratchetIndex is MXOlmDevice.AddSessionResult.NotImportedHigherIndex -> addSessionResult.newIndex - else -> null + else -> null }?.let { index -> if (event.getClearType() == EventType.FORWARDED_ROOM_KEY) { val fromDevice = (event.content?.get("sender_key") as? String)?.let { senderDeviceIdentityKey -> @@ -267,7 +268,8 @@ internal class MXMegolmDecryption( senderKey = senderKey, fromIndex = index, fromDevice = fromDevice, - event = event) + event = event + ) cryptoStore.saveIncomingForwardKeyAuditTrail( roomId = roomKeyContent.roomId, @@ -276,7 +278,8 @@ internal class MXMegolmDecryption( algorithm = roomKeyContent.algorithm ?: "", userId = event.senderId ?: "", deviceId = fromDevice ?: "", - chainIndex = index.toLong()) + chainIndex = index.toLong() + ) // The index is used to decide if we cancel sent request or if we wait for a better key outgoingKeyRequestManager.postCancelRequestForSessionIfNeeded(roomKeyContent.sessionId, roomKeyContent.roomId, senderKey, index) 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 096773a959..81a6fb28c0 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 @@ -35,6 +35,7 @@ internal class MXMegolmDecryptionFactory @Inject constructor( olmDevice, outgoingKeyRequestManager, cryptoStore, - 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 8b4e9df607..7bfbae6edf 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 @@ -84,9 +84,11 @@ internal class MXMegolmEncryption( private var sessionRotationPeriodMsgs: Int = 100 private var sessionRotationPeriodMs: Int = 7 * 24 * 3600 * 1000 - override suspend fun encryptEventContent(eventContent: Content, - eventType: String, - userIds: List): Content { + override suspend fun encryptEventContent( + eventContent: Content, + eventType: String, + userIds: List + ): Content { val ts = clock.epochMillis() Timber.tag(loggerTag.value).v("encryptEventContent : getDevicesInRoom") val devices = getDevicesInRoom(userIds) @@ -201,8 +203,10 @@ internal class MXMegolmEncryption( * @param session the session info * @param devicesByUsers the devices map */ - private suspend fun shareKey(session: MXOutboundSessionInfo, - devicesByUsers: Map>) { + private suspend fun shareKey( + session: MXOutboundSessionInfo, + devicesByUsers: Map> + ) { // nothing to send, the task is done if (devicesByUsers.isEmpty()) { Timber.tag(loggerTag.value).v("shareKey() : nothing more to do") @@ -230,8 +234,10 @@ internal class MXMegolmEncryption( * @param session the session info * @param devicesByUser the devices map */ - private suspend fun shareUserDevicesKey(session: MXOutboundSessionInfo, - devicesByUser: Map>) { + private suspend fun shareUserDevicesKey( + session: MXOutboundSessionInfo, + devicesByUser: Map> + ) { val sessionKey = olmDevice.getSessionKey(session.sessionId) val chainIndex = olmDevice.getMessageIndex(session.sessionId) @@ -321,10 +327,12 @@ internal class MXMegolmEncryption( } } - private suspend fun notifyKeyWithHeld(targets: List, - sessionId: String, - senderKey: String?, - code: WithHeldCode) { + private suspend fun notifyKeyWithHeld( + targets: List, + sessionId: String, + senderKey: String?, + code: WithHeldCode + ) { Timber.tag(loggerTag.value).d( "notifyKeyWithHeld() :sending withheld for session:$sessionId and code $code to" + " ${targets.joinToString { "${it.userId}|${it.deviceId}" }}" @@ -435,10 +443,12 @@ internal class MXMegolmEncryption( } } - override suspend fun reshareKey(groupSessionId: String, - userId: String, - deviceId: String, - senderKey: String): Boolean { + override suspend fun reshareKey( + groupSessionId: String, + userId: String, + deviceId: String, + senderKey: String + ): Boolean { Timber.tag(loggerTag.value).i("process reshareKey for $groupSessionId to $userId:$deviceId") val deviceInfo = cryptoStore.getUserDevice(userId, deviceId) ?: return false .also { Timber.tag(loggerTag.value).w("reshareKey: Device not found") } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/SharedWithHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/SharedWithHelper.kt index 61ad345c62..30fd403ce8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/SharedWithHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/SharedWithHelper.kt @@ -23,7 +23,8 @@ import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore internal class SharedWithHelper( private val roomId: String, private val sessionId: String, - private val cryptoStore: IMXCryptoStore) { + private val cryptoStore: IMXCryptoStore +) { fun sharedWithDevices(): MXUsersDevicesMap { return cryptoStore.getSharedWithInfo(roomId, sessionId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt index 23c8f0e905..17a44b19ff 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryption.kt @@ -38,7 +38,8 @@ internal class MXOlmDecryption( // The olm device interface private val olmDevice: MXOlmDevice, // the matrix userId - private val userId: String) : + private val userId: String +) : IMXDecrypting { @Throws(MXCryptoError::class) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryptionFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryptionFactory.kt index d5c5e85e41..a50ac8ca8a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryptionFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmDecryptionFactory.kt @@ -20,8 +20,10 @@ import org.matrix.android.sdk.internal.crypto.MXOlmDevice import org.matrix.android.sdk.internal.di.UserId import javax.inject.Inject -internal class MXOlmDecryptionFactory @Inject constructor(private val olmDevice: MXOlmDevice, - @UserId private val userId: String) { +internal class MXOlmDecryptionFactory @Inject constructor( + private val olmDevice: MXOlmDevice, + @UserId private val userId: String +) { fun create(): MXOlmDecryption { return MXOlmDecryption( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryption.kt index bde1d65093..fb70e23b03 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryption.kt @@ -32,7 +32,8 @@ internal class MXOlmEncryption( private val cryptoStore: IMXCryptoStore, private val messageEncrypter: MessageEncrypter, private val deviceListManager: DeviceListManager, - private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction) : + private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction +) : IMXEncrypting { override suspend fun encryptEventContent(eventContent: Content, eventType: String, userIds: List): Content { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryptionFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryptionFactory.kt index 44e55900e4..012886203e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryptionFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/olm/MXOlmEncryptionFactory.kt @@ -24,12 +24,14 @@ import org.matrix.android.sdk.internal.crypto.actions.MessageEncrypter import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore import javax.inject.Inject -internal class MXOlmEncryptionFactory @Inject constructor(private val olmDevice: MXOlmDevice, - private val cryptoStore: IMXCryptoStore, - private val messageEncrypter: MessageEncrypter, - private val deviceListManager: DeviceListManager, - private val coroutineDispatchers: MatrixCoroutineDispatchers, - private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction) { +internal class MXOlmEncryptionFactory @Inject constructor( + private val olmDevice: MXOlmDevice, + private val cryptoStore: IMXCryptoStore, + private val messageEncrypter: MessageEncrypter, + private val deviceListManager: DeviceListManager, + private val coroutineDispatchers: MatrixCoroutineDispatchers, + private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction +) { fun create(roomId: String): MXOlmEncryption { return MXOlmEncryption( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/api/CryptoApi.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/api/CryptoApi.kt index f5ead35933..d5a8bdfd7c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/api/CryptoApi.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/api/CryptoApi.kt @@ -117,9 +117,11 @@ internal interface CryptoApi { * @param body the body */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "sendToDevice/{eventType}/{txnId}") - suspend fun sendToDevice(@Path("eventType") eventType: String, - @Path("txnId") transactionId: String, - @Body body: SendToDeviceBody) + suspend fun sendToDevice( + @Path("eventType") eventType: String, + @Path("txnId") transactionId: String, + @Body body: SendToDeviceBody + ) /** * Delete a device. @@ -129,8 +131,10 @@ internal interface CryptoApi { * @param params the deletion parameters */ @HTTP(path = NetworkConstants.URI_API_PREFIX_PATH_R0 + "devices/{device_id}", method = "DELETE", hasBody = true) - suspend fun deleteDevice(@Path("device_id") deviceId: String, - @Body params: DeleteDeviceParams) + suspend fun deleteDevice( + @Path("device_id") deviceId: String, + @Body params: DeleteDeviceParams + ) /** * Update the device information. @@ -140,8 +144,10 @@ internal interface CryptoApi { * @param params the params */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "devices/{device_id}") - suspend fun updateDeviceInfo(@Path("device_id") deviceId: String, - @Body params: UpdateDeviceInfoBody) + suspend fun updateDeviceInfo( + @Path("device_id") deviceId: String, + @Body params: UpdateDeviceInfoBody + ) /** * Get the update devices list from two sync token. @@ -151,6 +157,8 @@ internal interface CryptoApi { * @param newToken the up-to token. */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "keys/changes") - suspend fun getKeyChanges(@Query("from") oldToken: String, - @Query("to") newToken: String): KeyChangesResponse + suspend fun getKeyChanges( + @Query("from") oldToken: String, + @Query("to") newToken: String + ): KeyChangesResponse } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/attachments/MXEncryptedAttachments.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/attachments/MXEncryptedAttachments.kt index 7ff08cd127..37c8e755ff 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/attachments/MXEncryptedAttachments.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/attachments/MXEncryptedAttachments.kt @@ -41,10 +41,12 @@ internal object MXEncryptedAttachments { private const val SECRET_KEY_SPEC_ALGORITHM = "AES" private const val MESSAGE_DIGEST_ALGORITHM = "SHA-256" - fun encrypt(clearStream: InputStream, - outputFile: File, - clock: Clock, - progress: ((current: Int, total: Int) -> Unit)): EncryptedFileInfo { + fun encrypt( + clearStream: InputStream, + outputFile: File, + clock: Clock, + progress: ((current: Int, total: Int) -> Unit) + ): EncryptedFileInfo { val t0 = clock.epochMillis() val secureRandom = SecureRandom() val initVectorBytes = ByteArray(16) { 0.toByte() } @@ -236,10 +238,11 @@ internal object MXEncryptedAttachments { * @param clock a clock to retrieve current time * @return true in case of success, false in case of error */ - fun decryptAttachment(attachmentStream: InputStream?, - elementToDecrypt: ElementToDecrypt?, - outputStream: OutputStream, - clock: Clock + fun decryptAttachment( + attachmentStream: InputStream?, + elementToDecrypt: ElementToDecrypt?, + outputStream: OutputStream, + clock: Clock ): Boolean { // sanity checks if (null == attachmentStream || elementToDecrypt == null) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/DefaultCrossSigningService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/DefaultCrossSigningService.kt index 6c198abc2e..e466def1a1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/DefaultCrossSigningService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/DefaultCrossSigningService.kt @@ -261,9 +261,10 @@ internal class DefaultCrossSigningService @Inject constructor( } } - override fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?, - uskKeyPrivateKey: String?, - sskPrivateKey: String? + override fun checkTrustFromPrivateKeys( + masterKeyPrivateKey: String?, + uskKeyPrivateKey: String?, + sskPrivateKey: String? ): UserTrustResult { val mxCrossSigningInfo = getMyCrossSigningKeys() ?: return UserTrustResult.CrossSigningNotConfigured(userId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt index 74f0f5745d..6e317f049b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/crosssigning/UpdateTrustWorker.kt @@ -276,10 +276,12 @@ internal class UpdateTrustWorker(context: Context, params: WorkerParameters, ses } } - private fun computeRoomShield(myCrossSigningInfo: MXCrossSigningInfo?, - cryptoRealm: Realm, - activeMemberUserIds: List, - roomSummaryEntity: RoomSummaryEntity): RoomEncryptionTrustLevel { + private fun computeRoomShield( + myCrossSigningInfo: MXCrossSigningInfo?, + cryptoRealm: Realm, + activeMemberUserIds: List, + roomSummaryEntity: RoomSummaryEntity + ): RoomEncryptionTrustLevel { Timber.v("## CrossSigning - computeRoomShield ${roomSummaryEntity.roomId} -> ${activeMemberUserIds.logLimit()}") // The set of “all users” depends on the type of room: // For regular / topic rooms which have more than 2 members (including yourself) are considered when decorating a room diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/DefaultKeysBackupService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/DefaultKeysBackupService.kt index 813adf7459..e75be11f94 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/DefaultKeysBackupService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/DefaultKeysBackupService.kt @@ -157,9 +157,11 @@ internal class DefaultKeysBackupService @Inject constructor( keysBackupStateManager.removeListener(listener) } - override fun prepareKeysBackupVersion(password: String?, - progressListener: ProgressListener?, - callback: MatrixCallback) { + override fun prepareKeysBackupVersion( + password: String?, + progressListener: ProgressListener?, + callback: MatrixCallback + ) { cryptoCoroutineScope.launch(coroutineDispatchers.io) { try { val olmPkDecryption = OlmPkDecryption() @@ -233,8 +235,10 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun createKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo, - callback: MatrixCallback) { + override fun createKeysBackupVersion( + keysBackupCreationInfo: MegolmBackupCreationInfo, + callback: MatrixCallback + ) { @Suppress("UNCHECKED_CAST") val createKeysBackupVersionBody = CreateKeysBackupVersionBody( algorithm = keysBackupCreationInfo.algorithm, @@ -345,8 +349,10 @@ internal class DefaultKeysBackupService @Inject constructor( return cryptoStore.inboundGroupSessionsCount(true) } - override fun backupAllGroupSessions(progressListener: ProgressListener?, - callback: MatrixCallback?) { + override fun backupAllGroupSessions( + progressListener: ProgressListener?, + callback: MatrixCallback? + ) { if (!isEnabled || backupOlmPkEncryption == null || keysBackupVersion == null) { callback?.onFailure(Throwable("Backup not enabled")) return @@ -397,8 +403,10 @@ internal class DefaultKeysBackupService @Inject constructor( }) } - override fun getKeysBackupTrust(keysBackupVersion: KeysVersionResult, - callback: MatrixCallback) { + override fun getKeysBackupTrust( + keysBackupVersion: KeysVersionResult, + callback: MatrixCallback + ) { // TODO Validate with François that this is correct object : Task { override suspend fun execute(params: KeysVersionResult): KeysBackupVersionTrust { @@ -505,9 +513,11 @@ internal class DefaultKeysBackupService @Inject constructor( ) } - override fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult, - trust: Boolean, - callback: MatrixCallback) { + override fun trustKeysBackupVersion( + keysBackupVersion: KeysVersionResult, + trust: Boolean, + callback: MatrixCallback + ) { Timber.v("trustKeyBackupVersion: $trust, version ${keysBackupVersion.version}") // Get auth data to update it @@ -589,9 +599,11 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult, - recoveryKey: String, - callback: MatrixCallback) { + override fun trustKeysBackupVersionWithRecoveryKey( + keysBackupVersion: KeysVersionResult, + recoveryKey: String, + callback: MatrixCallback + ) { Timber.v("trustKeysBackupVersionWithRecoveryKey: version ${keysBackupVersion.version}") cryptoCoroutineScope.launch(coroutineDispatchers.io) { @@ -608,9 +620,11 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult, - password: String, - callback: MatrixCallback) { + override fun trustKeysBackupVersionWithPassphrase( + keysBackupVersion: KeysVersionResult, + password: String, + callback: MatrixCallback + ) { Timber.v("trustKeysBackupVersionWithPassphrase: version ${keysBackupVersion.version}") cryptoCoroutineScope.launch(coroutineDispatchers.io) { @@ -707,12 +721,14 @@ internal class DefaultKeysBackupService @Inject constructor( progressListener.onProgress(backedUpKeys, total) } - override fun restoreKeysWithRecoveryKey(keysVersionResult: KeysVersionResult, - recoveryKey: String, - roomId: String?, - sessionId: String?, - stepProgressListener: StepProgressListener?, - callback: MatrixCallback) { + override fun restoreKeysWithRecoveryKey( + keysVersionResult: KeysVersionResult, + recoveryKey: String, + roomId: String?, + sessionId: String?, + stepProgressListener: StepProgressListener?, + callback: MatrixCallback + ) { Timber.v("restoreKeysWithRecoveryKey: From backup version: ${keysVersionResult.version}") cryptoCoroutineScope.launch(coroutineDispatchers.io) { @@ -806,12 +822,14 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun restoreKeyBackupWithPassword(keysBackupVersion: KeysVersionResult, - password: String, - roomId: String?, - sessionId: String?, - stepProgressListener: StepProgressListener?, - callback: MatrixCallback) { + override fun restoreKeyBackupWithPassword( + keysBackupVersion: KeysVersionResult, + password: String, + roomId: String?, + sessionId: String?, + stepProgressListener: StepProgressListener?, + callback: MatrixCallback + ) { Timber.v("[MXKeyBackup] restoreKeyBackup with password: From backup version: ${keysBackupVersion.version}") cryptoCoroutineScope.launch(coroutineDispatchers.io) { @@ -859,9 +877,11 @@ internal class DefaultKeysBackupService @Inject constructor( * Same method as [RoomKeysRestClient.getRoomKey] except that it accepts nullable * parameters and always returns a KeysBackupData object through the Callback. */ - private suspend fun getKeys(sessionId: String?, - roomId: String?, - version: String): KeysBackupData { + private suspend fun getKeys( + sessionId: String?, + roomId: String?, + version: String + ): KeysBackupData { return if (roomId != null && sessionId != null) { // Get key for the room and for the session val data = getRoomSessionDataTask.execute(GetRoomSessionDataTask.Params(roomId, sessionId, version)) @@ -939,8 +959,10 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun getVersion(version: String, - callback: MatrixCallback) { + override fun getVersion( + version: String, + callback: MatrixCallback + ) { getKeysBackupVersionTask .configureWith(version) { this.callback = object : MatrixCallback { @@ -1179,10 +1201,12 @@ internal class DefaultKeysBackupService @Inject constructor( } } - override fun computePrivateKey(passphrase: String, - privateKeySalt: String, - privateKeyIterations: Int, - progressListener: ProgressListener): ByteArray { + override fun computePrivateKey( + passphrase: String, + privateKeySalt: String, + privateKeyIterations: Int, + progressListener: ProgressListener + ): ByteArray { return deriveKey(passphrase, privateKeySalt, privateKeyIterations, progressListener) } @@ -1482,8 +1506,10 @@ internal class DefaultKeysBackupService @Inject constructor( get() = cryptoStore @VisibleForTesting - fun createFakeKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo, - callback: MatrixCallback) { + fun createFakeKeysBackupVersion( + keysBackupCreationInfo: MegolmBackupCreationInfo, + callback: MatrixCallback + ) { @Suppress("UNCHECKED_CAST") val createKeysBackupVersionBody = CreateKeysBackupVersionBody( algorithm = keysBackupCreationInfo.algorithm, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupPassword.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupPassword.kt index f821fdcf6d..8560eb5fc1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupPassword.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/KeysBackupPassword.kt @@ -49,8 +49,9 @@ internal data class GeneratePrivateKeyResult( * @return a {privateKey, salt, iterations} tuple. */ @WorkerThread -internal fun generatePrivateKeyWithPassword(password: String, - progressListener: ProgressListener? +internal fun generatePrivateKeyWithPassword( + password: String, + progressListener: ProgressListener? ): GeneratePrivateKeyResult { val salt = generateSalt() val iterations = DEFAULT_ITERATION @@ -70,10 +71,12 @@ internal fun generatePrivateKeyWithPassword(password: String, * @return a private key. */ @WorkerThread -internal fun retrievePrivateKeyWithPassword(password: String, - salt: String, - iterations: Int, - progressListener: ProgressListener? = null): ByteArray { +internal fun retrievePrivateKeyWithPassword( + password: String, + salt: String, + iterations: Int, + progressListener: ProgressListener? = null +): ByteArray { return deriveKey(password, salt, iterations, progressListener) } @@ -88,10 +91,12 @@ internal fun retrievePrivateKeyWithPassword(password: String, * @return a private key. */ @WorkerThread -internal fun deriveKey(password: String, - salt: String, - iterations: Int, - progressListener: ProgressListener?): ByteArray { +internal fun deriveKey( + password: String, + salt: String, + iterations: Int, + progressListener: ProgressListener? +): ByteArray { // Note: copied and adapted from MXMegolmExportEncryption // based on https://en.wikipedia.org/wiki/PBKDF2 algorithm // it is simpler than the generic algorithm because the expected key length is equal to the mac key length. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/api/RoomKeysApi.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/api/RoomKeysApi.kt index d9c63b46ab..48a735018a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/api/RoomKeysApi.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/api/RoomKeysApi.kt @@ -71,8 +71,10 @@ internal interface RoomKeysApi { * @param updateKeysBackupVersionBody the body */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/version/{version}") - suspend fun updateKeysBackupVersion(@Path("version") version: String, - @Body updateKeysBackupVersionBody: UpdateKeysBackupVersionBody) + suspend fun updateKeysBackupVersion( + @Path("version") version: String, + @Body updateKeysBackupVersionBody: UpdateKeysBackupVersionBody + ) /* ========================================================================================== * Storing keys @@ -93,10 +95,12 @@ internal interface RoomKeysApi { * @param keyBackupData the data to send */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}/{sessionId}") - suspend fun storeRoomSessionData(@Path("roomId") roomId: String, - @Path("sessionId") sessionId: String, - @Query("version") version: String, - @Body keyBackupData: KeyBackupData): BackupKeysResult + suspend fun storeRoomSessionData( + @Path("roomId") roomId: String, + @Path("sessionId") sessionId: String, + @Query("version") version: String, + @Body keyBackupData: KeyBackupData + ): BackupKeysResult /** * Store several keys for the given room, using the given backup version. @@ -106,9 +110,11 @@ internal interface RoomKeysApi { * @param roomKeysBackupData the data to send */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}") - suspend fun storeRoomSessionsData(@Path("roomId") roomId: String, - @Query("version") version: String, - @Body roomKeysBackupData: RoomKeysBackupData): BackupKeysResult + suspend fun storeRoomSessionsData( + @Path("roomId") roomId: String, + @Query("version") version: String, + @Body roomKeysBackupData: RoomKeysBackupData + ): BackupKeysResult /** * Store several keys, using the given backup version. @@ -117,8 +123,10 @@ internal interface RoomKeysApi { * @param keysBackupData the data to send */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys") - suspend fun storeSessionsData(@Query("version") version: String, - @Body keysBackupData: KeysBackupData): BackupKeysResult + suspend fun storeSessionsData( + @Query("version") version: String, + @Body keysBackupData: KeysBackupData + ): BackupKeysResult /* ========================================================================================== * Retrieving keys @@ -132,9 +140,11 @@ internal interface RoomKeysApi { * @param version the version of the backup, or empty String to retrieve the last version */ @GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}/{sessionId}") - suspend fun getRoomSessionData(@Path("roomId") roomId: String, - @Path("sessionId") sessionId: String, - @Query("version") version: String): KeyBackupData + suspend fun getRoomSessionData( + @Path("roomId") roomId: String, + @Path("sessionId") sessionId: String, + @Query("version") version: String + ): KeyBackupData /** * Retrieve all the keys for the given room from the backup. @@ -143,8 +153,10 @@ internal interface RoomKeysApi { * @param version the version of the backup, or empty String to retrieve the last version */ @GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}") - suspend fun getRoomSessionsData(@Path("roomId") roomId: String, - @Query("version") version: String): RoomKeysBackupData + suspend fun getRoomSessionsData( + @Path("roomId") roomId: String, + @Query("version") version: String + ): RoomKeysBackupData /** * Retrieve all the keys from the backup. @@ -162,16 +174,20 @@ internal interface RoomKeysApi { * Deletes keys from the backup. */ @DELETE(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}/{sessionId}") - suspend fun deleteRoomSessionData(@Path("roomId") roomId: String, - @Path("sessionId") sessionId: String, - @Query("version") version: String) + suspend fun deleteRoomSessionData( + @Path("roomId") roomId: String, + @Path("sessionId") sessionId: String, + @Query("version") version: String + ) /** * Deletes keys from the backup. */ @DELETE(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "room_keys/keys/{roomId}") - suspend fun deleteRoomSessionsData(@Path("roomId") roomId: String, - @Query("version") version: String) + suspend fun deleteRoomSessionsData( + @Path("roomId") roomId: String, + @Query("version") version: String + ) /** * Deletes keys from the backup. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/rest/KeyVerificationAccept.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/rest/KeyVerificationAccept.kt index 9fdeda01c9..85ba1762d3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/rest/KeyVerificationAccept.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/rest/KeyVerificationAccept.kt @@ -69,12 +69,14 @@ internal data class KeyVerificationAccept( override fun toSendToDeviceObject() = this companion object : VerificationInfoAcceptFactory { - override fun create(tid: String, - keyAgreementProtocol: String, - hash: String, - commitment: String, - messageAuthenticationCode: String, - shortAuthenticationStrings: List): VerificationInfoAccept { + override fun create( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept { return KeyVerificationAccept( transactionId = tid, keyAgreementProtocol = keyAgreementProtocol, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/secrets/DefaultSharedSecretStorageService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/secrets/DefaultSharedSecretStorageService.kt index 1ded9c6c7e..51d53d9535 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/secrets/DefaultSharedSecretStorageService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/secrets/DefaultSharedSecretStorageService.kt @@ -62,10 +62,12 @@ internal class DefaultSharedSecretStorageService @Inject constructor( private val cryptoCoroutineScope: CoroutineScope ) : SharedSecretStorageService { - override suspend fun generateKey(keyId: String, - key: SsssKeySpec?, - keyName: String, - keySigner: KeySigner?): SsssKeyCreationInfo { + override suspend fun generateKey( + keyId: String, + key: SsssKeySpec?, + keyName: String, + keySigner: KeySigner? + ): SsssKeyCreationInfo { return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation) { val bytes = (key as? RawBytesKeySpec)?.privateKey ?: ByteArray(32).also { @@ -94,11 +96,13 @@ internal class DefaultSharedSecretStorageService @Inject constructor( } } - override suspend fun generateKeyWithPassphrase(keyId: String, - keyName: String, - passphrase: String, - keySigner: KeySigner, - progressListener: ProgressListener?): SsssKeyCreationInfo { + override suspend fun generateKeyWithPassphrase( + keyId: String, + keyName: String, + passphrase: String, + keySigner: KeySigner, + progressListener: ProgressListener? + ): SsssKeyCreationInfo { return withContext(cryptoCoroutineScope.coroutineContext + coroutineDispatchers.computation) { val privatePart = generatePrivateKeyWithPassword(passphrase, progressListener) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/IMXCryptoStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/IMXCryptoStore.kt index 9b1c785059..72014ff3bb 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/IMXCryptoStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/IMXCryptoStore.kt @@ -192,10 +192,12 @@ internal interface IMXCryptoStore { */ fun storeUserDevices(userId: String, devices: Map?) - fun storeUserCrossSigningKeys(userId: String, - masterKey: CryptoCrossSigningKey?, - selfSigningKey: CryptoCrossSigningKey?, - userSigningKey: CryptoCrossSigningKey?) + fun storeUserCrossSigningKeys( + userId: String, + masterKey: CryptoCrossSigningKey?, + selfSigningKey: CryptoCrossSigningKey?, + userSigningKey: CryptoCrossSigningKey? + ) /** * Retrieve the known devices for a user. @@ -392,7 +394,8 @@ internal interface IMXCryptoStore { algorithm: String, senderKey: String, fromDevice: String?, - event: Event) + event: Event + ) fun deleteOutgoingRoomKeyRequest(requestId: String) fun deleteOutgoingRoomKeyRequestInState(state: OutgoingRoomKeyRequestState) @@ -479,8 +482,10 @@ internal interface IMXCryptoStore { fun addWithHeldMegolmSession(withHeldContent: RoomKeyWithHeldContent) fun getWithHeldMegolmSession(roomId: String, sessionId: String): RoomKeyWithHeldContent? - fun markedSessionAsShared(roomId: String?, sessionId: String, userId: String, deviceId: String, - deviceIdentityKey: String, chainIndex: Int) + fun markedSessionAsShared( + roomId: String?, sessionId: String, userId: String, deviceId: String, + deviceIdentityKey: String, chainIndex: Int + ) /** * Query for information on this session sharing history. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStore.kt index 533ab70bba..c56e4d320b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/RealmCryptoStore.kt @@ -322,10 +322,12 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun storeUserCrossSigningKeys(userId: String, - masterKey: CryptoCrossSigningKey?, - selfSigningKey: CryptoCrossSigningKey?, - userSigningKey: CryptoCrossSigningKey?) { + override fun storeUserCrossSigningKeys( + userId: String, + masterKey: CryptoCrossSigningKey?, + selfSigningKey: CryptoCrossSigningKey?, + userSigningKey: CryptoCrossSigningKey? + ) { doRealmTransaction(realmConfiguration) { realm -> UserEntity.getOrCreate(realm, userId) .let { userEntity -> @@ -1154,9 +1156,11 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun getOrAddOutgoingRoomKeyRequest(requestBody: RoomKeyRequestBody, - recipients: Map>, - fromIndex: Int): OutgoingKeyRequest { + override fun getOrAddOutgoingRoomKeyRequest( + requestBody: RoomKeyRequestBody, + recipients: Map>, + fromIndex: Int + ): OutgoingKeyRequest { // Insert the request and return the one passed in parameter lateinit var request: OutgoingKeyRequest doRealmTransaction(realmConfiguration) { realm -> @@ -1220,12 +1224,14 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun updateOutgoingRoomKeyReply(roomId: String, - sessionId: String, - algorithm: String, - senderKey: String, - fromDevice: String?, - event: Event) { + override fun updateOutgoingRoomKeyReply( + roomId: String, + sessionId: String, + algorithm: String, + senderKey: String, + fromDevice: String?, + event: Event + ) { doRealmTransaction(realmConfiguration) { realm -> realm.where() .equalTo(OutgoingKeyRequestEntityFields.ROOM_ID, roomId) @@ -1266,7 +1272,8 @@ internal class RealmCryptoStore @Inject constructor( senderKey: String, algorithm: String, fromUser: String, - fromDevice: String) { + fromDevice: String + ) { monarchy.writeAsync { realm -> val now = clock.epochMillis() realm.createObject().apply { @@ -1288,13 +1295,15 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun saveWithheldAuditTrail(roomId: String, - sessionId: String, - senderKey: String, - algorithm: String, - code: WithHeldCode, - userId: String, - deviceId: String) { + override fun saveWithheldAuditTrail( + roomId: String, + sessionId: String, + senderKey: String, + algorithm: String, + code: WithHeldCode, + userId: String, + deviceId: String + ) { monarchy.writeAsync { realm -> val now = clock.epochMillis() realm.createObject().apply { @@ -1316,34 +1325,39 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun saveForwardKeyAuditTrail(roomId: String, - sessionId: String, - senderKey: String, - algorithm: String, - userId: String, - deviceId: String, - chainIndex: Long?) { + override fun saveForwardKeyAuditTrail( + roomId: String, + sessionId: String, + senderKey: String, + algorithm: String, + userId: String, + deviceId: String, + chainIndex: Long? + ) { saveForwardKeyTrail(roomId, sessionId, senderKey, algorithm, userId, deviceId, chainIndex, false) } - override fun saveIncomingForwardKeyAuditTrail(roomId: String, - sessionId: String, - senderKey: String, - algorithm: String, - userId: String, - deviceId: String, - chainIndex: Long?) { + override fun saveIncomingForwardKeyAuditTrail( + roomId: String, + sessionId: String, + senderKey: String, + algorithm: String, + userId: String, + deviceId: String, + chainIndex: Long? + ) { saveForwardKeyTrail(roomId, sessionId, senderKey, algorithm, userId, deviceId, chainIndex, true) } - private fun saveForwardKeyTrail(roomId: String, - sessionId: String, - senderKey: String, - algorithm: String, - userId: String, - deviceId: String, - chainIndex: Long?, - incoming: Boolean + private fun saveForwardKeyTrail( + roomId: String, + sessionId: String, + senderKey: String, + algorithm: String, + userId: String, + deviceId: String, + chainIndex: Long?, + incoming: Boolean ) { monarchy.writeAsync { realm -> val now = clock.epochMillis() @@ -1617,12 +1631,14 @@ internal class RealmCryptoStore @Inject constructor( } } - override fun markedSessionAsShared(roomId: String?, - sessionId: String, - userId: String, - deviceId: String, - deviceIdentityKey: String, - chainIndex: Int) { + override fun markedSessionAsShared( + roomId: String?, + sessionId: String, + userId: String, + deviceId: String, + deviceIdentityKey: String, + chainIndex: Int + ) { doRealmTransaction(realmConfiguration) { realm -> SharedSessionEntity.create( realm = realm, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmInboundGroupSessionEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmInboundGroupSessionEntity.kt index 83671b28d9..a4f6c279ac 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmInboundGroupSessionEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmInboundGroupSessionEntity.kt @@ -33,7 +33,8 @@ internal open class OlmInboundGroupSessionEntity( // olmInboundGroupSessionData contains Json var olmInboundGroupSessionData: String? = null, // Indicate if the key has been backed up to the homeserver - var backedUp: Boolean = false) : + var backedUp: Boolean = false +) : RealmObject() { fun getInboundGroupSession(): OlmInboundGroupSessionWrapper2? { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmSessionEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmSessionEntity.kt index 1a637d76c4..9f010db288 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmSessionEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OlmSessionEntity.kt @@ -25,11 +25,13 @@ import org.matrix.olm.OlmSession internal fun OlmSessionEntity.Companion.createPrimaryKey(sessionId: String, deviceKey: String) = "$sessionId|$deviceKey" // olmSessionData is a serialized OlmSession -internal open class OlmSessionEntity(@PrimaryKey var primaryKey: String = "", - var sessionId: String? = null, - var deviceKey: String? = null, - var olmSessionData: String? = null, - var lastReceivedMessageTs: Long = 0) : +internal open class OlmSessionEntity( + @PrimaryKey var primaryKey: String = "", + var sessionId: String? = null, + var deviceKey: String? = null, + var olmSessionData: String? = null, + var lastReceivedMessageTs: Long = 0 +) : RealmObject() { fun getOlmSession(): OlmSession? { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OutgoingKeyRequestEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OutgoingKeyRequestEntity.kt index 7a8ba18809..854d148b76 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OutgoingKeyRequestEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/OutgoingKeyRequestEntity.kt @@ -117,7 +117,7 @@ internal open class OutgoingKeyRequestEntity( private fun eventToResult(event: Event): RequestResult? { return when (event.getClearType()) { - EventType.ROOM_KEY_WITHHELD -> { + EventType.ROOM_KEY_WITHHELD -> { event.content.toModel()?.code?.let { RequestResult.Failure(it) } @@ -125,7 +125,7 @@ internal open class OutgoingKeyRequestEntity( EventType.FORWARDED_ROOM_KEY -> { RequestResult.Success((event.content?.get("chain_index") as? Number)?.toInt() ?: 0) } - else -> null + else -> null } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/query/SharedSessionQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/query/SharedSessionQueries.kt index 8bf9794375..97fab9174d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/query/SharedSessionQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/query/SharedSessionQueries.kt @@ -24,12 +24,14 @@ import org.matrix.android.sdk.api.crypto.MXCRYPTO_ALGORITHM_MEGOLM import org.matrix.android.sdk.internal.crypto.store.db.model.SharedSessionEntity import org.matrix.android.sdk.internal.crypto.store.db.model.SharedSessionEntityFields -internal fun SharedSessionEntity.Companion.get(realm: Realm, - roomId: String?, - sessionId: String, - userId: String, - deviceId: String, - deviceIdentityKey: String?): SharedSessionEntity? { +internal fun SharedSessionEntity.Companion.get( + realm: Realm, + roomId: String?, + sessionId: String, + userId: String, + deviceId: String, + deviceIdentityKey: String? +): SharedSessionEntity? { return realm.where() .equalTo(SharedSessionEntityFields.ROOM_ID, roomId) .equalTo(SharedSessionEntityFields.SESSION_ID, sessionId) @@ -48,12 +50,14 @@ internal fun SharedSessionEntity.Companion.get(realm: Realm, roomId: String?, se .findAll() } -internal fun SharedSessionEntity.Companion.create(realm: Realm, roomId: String?, - sessionId: String, - userId: String, - deviceId: String, - deviceIdentityKey: String, - chainIndex: Int): SharedSessionEntity { +internal fun SharedSessionEntity.Companion.create( + realm: Realm, roomId: String?, + sessionId: String, + userId: String, + deviceId: String, + deviceIdentityKey: String, + chainIndex: Int +): SharedSessionEntity { return realm.createObject().apply { this.roomId = roomId this.algorithm = MXCRYPTO_ALGORITHM_MEGOLM diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/EncryptEventTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/EncryptEventTask.kt index 394c618968..a4b4cd0761 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/EncryptEventTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/EncryptEventTask.kt @@ -31,10 +31,11 @@ import org.matrix.android.sdk.internal.task.Task import javax.inject.Inject internal interface EncryptEventTask : Task { - data class Params(val roomId: String, - val event: Event, - /**Do not encrypt these keys, keep them as is in encrypted content (e.g. m.relates_to)*/ - val keepKeys: List? = null + data class Params( + val roomId: String, + val event: Event, + /**Do not encrypt these keys, keep them as is in encrypted content (e.g. m.relates_to)*/ + val keepKeys: List? = null ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/RedactEventTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/RedactEventTask.kt index d6a7f3c6a0..56bdc8cae8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/RedactEventTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/RedactEventTask.kt @@ -32,7 +32,8 @@ internal interface RedactEventTask : Task { internal class DefaultRedactEventTask @Inject constructor( private val roomAPI: RoomAPI, - private val globalErrorReceiver: GlobalErrorReceiver) : RedactEventTask { + private val globalErrorReceiver: GlobalErrorReceiver +) : RedactEventTask { override suspend fun execute(params: RedactEventTask.Params): String { val response = executeRequest(globalErrorReceiver) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendEventTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendEventTask.kt index 50efe51bc1..fbd9d245d9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendEventTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendEventTask.kt @@ -39,7 +39,8 @@ internal class DefaultSendEventTask @Inject constructor( private val encryptEventTask: EncryptEventTask, private val loadRoomMembersTask: LoadRoomMembersTask, private val roomAPI: RoomAPI, - private val globalErrorReceiver: GlobalErrorReceiver) : SendEventTask { + private val globalErrorReceiver: GlobalErrorReceiver +) : SendEventTask { override suspend fun execute(params: SendEventTask.Params): String { try { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendVerificationMessageTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendVerificationMessageTask.kt index 7c52c62d92..944f41d488 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendVerificationMessageTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/SendVerificationMessageTask.kt @@ -37,7 +37,8 @@ internal class DefaultSendVerificationMessageTask @Inject constructor( private val encryptEventTask: EncryptEventTask, private val roomAPI: RoomAPI, private val cryptoSessionInfoProvider: CryptoSessionInfoProvider, - private val globalErrorReceiver: GlobalErrorReceiver) : SendVerificationMessageTask { + private val globalErrorReceiver: GlobalErrorReceiver +) : SendVerificationMessageTask { override suspend fun execute(params: SendVerificationMessageTask.Params): String { val event = handleEncryption(params) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt index af48283767..7d8245da30 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt @@ -472,9 +472,11 @@ internal class DefaultVerificationService @Inject constructor( /** * Return a CancelCode to make the caller cancel the verification. Else return null */ - private suspend fun handleStart(otherUserId: String?, - startReq: ValidVerificationInfoStart, - txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? { + private suspend fun handleStart( + otherUserId: String?, + startReq: ValidVerificationInfoStart, + txConfigure: (DefaultVerificationTransaction) -> Unit + ): CancelCode? { Timber.d("## SAS onStartRequestReceived $startReq") if (otherUserId?.let { checkKeysAreDownloaded(it, startReq.fromDevice) } != null) { val tid = startReq.transactionId @@ -589,8 +591,10 @@ internal class DefaultVerificationService @Inject constructor( } // TODO Refacto: It could just return a boolean - private suspend fun checkKeysAreDownloaded(otherUserId: String, - otherDeviceId: String): MXUsersDevicesMap? { + private suspend fun checkKeysAreDownloaded( + otherUserId: String, + otherDeviceId: String + ): MXUsersDevicesMap? { return try { var keys = deviceListManager.downloadKeys(listOf(otherUserId), false) if (keys.getUserDeviceIds(otherUserId)?.contains(otherDeviceId) == true) { @@ -899,9 +903,11 @@ internal class DefaultVerificationService @Inject constructor( } } - private fun handleReadyReceived(senderId: String, - readyReq: ValidVerificationInfoReady, - transportCreator: (DefaultVerificationTransaction) -> VerificationTransport) { + private fun handleReadyReceived( + senderId: String, + readyReq: ValidVerificationInfoReady, + transportCreator: (DefaultVerificationTransaction) -> VerificationTransport + ) { val existingRequest = getExistingVerificationRequests(senderId).find { it.transactionId == readyReq.transactionId } if (existingRequest == null) { Timber.e("## SAS Received Ready for unknown request txId:${readyReq.transactionId} fromDevice ${readyReq.fromDevice}") @@ -939,7 +945,7 @@ internal class DefaultVerificationService @Inject constructor( updatePendingRequest( existingRequest.copy( - readyInfo = readyReq + readyInfo = readyReq ) ) @@ -1158,10 +1164,12 @@ internal class DefaultVerificationService @Inject constructor( } } - override fun requestKeyVerificationInDMs(methods: List, - otherUserId: String, - roomId: String, - localId: String?): PendingVerificationRequest { + override fun requestKeyVerificationInDMs( + methods: List, + otherUserId: String, + roomId: String, + localId: String? + ): PendingVerificationRequest { Timber.i("## SAS Requesting verification to user: $otherUserId in room $roomId") val requestsForUser = pendingRequests.getOrPut(otherUserId) { mutableListOf() } @@ -1328,11 +1336,13 @@ internal class DefaultVerificationService @Inject constructor( dispatchRequestUpdated(updated) } - override fun beginKeyVerificationInDMs(method: VerificationMethod, - transactionId: String, - roomId: String, - otherUserId: String, - otherDeviceId: String): String { + override fun beginKeyVerificationInDMs( + method: VerificationMethod, + transactionId: String, + roomId: String, + otherUserId: String, + otherDeviceId: String + ): String { if (method == VerificationMethod.SAS) { val tx = DefaultOutgoingSASDefaultVerificationTransaction( setDeviceVerificationAction, @@ -1357,10 +1367,12 @@ internal class DefaultVerificationService @Inject constructor( } } - override fun readyPendingVerificationInDMs(methods: List, - otherUserId: String, - roomId: String, - transactionId: String): Boolean { + override fun readyPendingVerificationInDMs( + methods: List, + otherUserId: String, + roomId: String, + transactionId: String + ): Boolean { Timber.v("## SAS readyPendingVerificationInDMs $otherUserId room:$roomId tx:$transactionId") // Let's find the related request val existingRequest = getExistingVerificationRequest(otherUserId, transactionId) @@ -1399,9 +1411,11 @@ internal class DefaultVerificationService @Inject constructor( } } - override fun readyPendingVerification(methods: List, - otherUserId: String, - transactionId: String): Boolean { + override fun readyPendingVerification( + methods: List, + otherUserId: String, + transactionId: String + ): Boolean { Timber.v("## SAS readyPendingVerification $otherUserId tx:$transactionId") // Let's find the related request val existingRequest = getExistingVerificationRequest(otherUserId, transactionId) @@ -1445,7 +1459,8 @@ internal class DefaultVerificationService @Inject constructor( otherDeviceId: String, otherUserMethods: List?, methods: List, - transportCreator: (DefaultVerificationTransaction) -> VerificationTransport): List { + transportCreator: (DefaultVerificationTransaction) -> VerificationTransport + ): List { if (otherUserMethods.isNullOrEmpty()) { return emptyList() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationTransaction.kt index 27bc764395..b683c8905f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationTransaction.kt @@ -37,7 +37,8 @@ internal abstract class DefaultVerificationTransaction( override val transactionId: String, override val otherUserId: String, override var otherDeviceId: String? = null, - override val isIncoming: Boolean) : VerificationTransaction { + override val isIncoming: Boolean +) : VerificationTransaction { lateinit var transport: VerificationTransport @@ -55,9 +56,11 @@ internal abstract class DefaultVerificationTransaction( listeners.remove(listener) } - protected fun trust(canTrustOtherUserMasterKey: Boolean, - toVerifyDeviceIds: List, - eventuallyMarkMyMasterKeyAsTrusted: Boolean, autoDone: Boolean = true) { + protected fun trust( + canTrustOtherUserMasterKey: Boolean, + toVerifyDeviceIds: List, + eventuallyMarkMyMasterKeyAsTrusted: Boolean, autoDone: Boolean = true + ) { Timber.d("## Verification: trust ($otherUserId,$otherDeviceId) , verifiedDevices:$toVerifyDeviceIds") Timber.d("## Verification: trust Mark myMSK trusted $eventuallyMarkMyMasterKeyAsTrusted") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SASDefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SASDefaultVerificationTransaction.kt index 68dd57478e..d68f2c429d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SASDefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SASDefaultVerificationTransaction.kt @@ -314,11 +314,13 @@ internal abstract class SASDefaultVerificationTransaction( transport.cancelTransaction(transactionId, otherUserId, otherDeviceId ?: "", code) } - protected fun sendToOther(type: String, - keyToDevice: VerificationInfo, - nextState: VerificationTxState, - onErrorReason: CancelCode, - onDone: (() -> Unit)?) { + protected fun sendToOther( + type: String, + keyToDevice: VerificationInfo, + nextState: VerificationTxState, + onErrorReason: CancelCode, + onDone: (() -> Unit)? + ) { transport.sendToOther(type, keyToDevice, nextState, onErrorReason, onDone) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoAccept.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoAccept.kt index 3ddb0ca758..0b9287cb05 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoAccept.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoAccept.kt @@ -63,12 +63,14 @@ internal interface VerificationInfoAccept : VerificationInfo): VerificationInfoAccept + fun create( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept } internal data class ValidVerificationInfoAccept( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoStart.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoStart.kt index d71bd7359e..991470a848 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoStart.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationInfoStart.kt @@ -105,7 +105,8 @@ internal interface VerificationInfoStart : VerificationInfo sendToOther(type: String, - verificationInfo: VerificationInfo, - nextState: VerificationTxState, - onErrorReason: CancelCode, - onDone: (() -> Unit)?) + fun sendToOther( + type: String, + verificationInfo: VerificationInfo, + nextState: VerificationTxState, + onErrorReason: CancelCode, + onDone: (() -> Unit)? + ) /** * @param supportedMethods list of supported method by this client @@ -42,65 +44,85 @@ internal interface VerificationTransport { * @param toDevices list of device Ids * @param callback will be called with eventId and ValidVerificationInfoRequest in case of success */ - fun sendVerificationRequest(supportedMethods: List, - localId: String, - otherUserId: String, - roomId: String?, - toDevices: List?, - callback: (String?, ValidVerificationInfoRequest?) -> Unit) + fun sendVerificationRequest( + supportedMethods: List, + localId: String, + otherUserId: String, + roomId: String?, + toDevices: List?, + callback: (String?, ValidVerificationInfoRequest?) -> Unit + ) - fun cancelTransaction(transactionId: String, - otherUserId: String, - otherUserDeviceId: String?, - code: CancelCode) + fun cancelTransaction( + transactionId: String, + otherUserId: String, + otherUserDeviceId: String?, + code: CancelCode + ) - fun cancelTransaction(transactionId: String, - otherUserId: String, - otherUserDeviceIds: List, - code: CancelCode) + fun cancelTransaction( + transactionId: String, + otherUserId: String, + otherUserDeviceIds: List, + code: CancelCode + ) - fun done(transactionId: String, - onDone: (() -> Unit)?) + fun done( + transactionId: String, + onDone: (() -> Unit)? + ) /** * Creates an accept message suitable for this transport. */ - fun createAccept(tid: String, - keyAgreementProtocol: String, - hash: String, - commitment: String, - messageAuthenticationCode: String, - shortAuthenticationStrings: List): VerificationInfoAccept + fun createAccept( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept - fun createKey(tid: String, - pubKey: String): VerificationInfoKey + fun createKey( + tid: String, + pubKey: String + ): VerificationInfoKey /** * Create start for SAS verification. */ - fun createStartForSas(fromDevice: String, - transactionId: String, - keyAgreementProtocols: List, - hashes: List, - messageAuthenticationCodes: List, - shortAuthenticationStrings: List): VerificationInfoStart + fun createStartForSas( + fromDevice: String, + transactionId: String, + keyAgreementProtocols: List, + hashes: List, + messageAuthenticationCodes: List, + shortAuthenticationStrings: List + ): VerificationInfoStart /** * Create start for QR code verification. */ - fun createStartForQrCode(fromDevice: String, - transactionId: String, - sharedSecret: String): VerificationInfoStart + fun createStartForQrCode( + fromDevice: String, + transactionId: String, + sharedSecret: String + ): VerificationInfoStart fun createMac(tid: String, mac: Map, keys: String): VerificationInfoMac - fun createReady(tid: String, - fromDevice: String, - methods: List): VerificationInfoReady + fun createReady( + tid: String, + fromDevice: String, + methods: List + ): VerificationInfoReady // TODO Refactor - fun sendVerificationReady(keyReq: VerificationInfoReady, - otherUserId: String, - otherDeviceId: String?, - callback: (() -> Unit)?) + fun sendVerificationReady( + keyReq: VerificationInfoReady, + otherUserId: String, + otherDeviceId: String?, + callback: (() -> Unit)? + ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportRoomMessage.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportRoomMessage.kt index 03df849d22..350c5e8cd1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportRoomMessage.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportRoomMessage.kt @@ -61,11 +61,13 @@ internal class VerificationTransportRoomMessage( private val verificationSenderScope = CoroutineScope(cryptoCoroutineScope.coroutineContext + dispatcher) private val sequencer = SemaphoreCoroutineSequencer() - override fun sendToOther(type: String, - verificationInfo: VerificationInfo, - nextState: VerificationTxState, - onErrorReason: CancelCode, - onDone: (() -> Unit)?) { + override fun sendToOther( + type: String, + verificationInfo: VerificationInfo, + nextState: VerificationTxState, + onErrorReason: CancelCode, + onDone: (() -> Unit)? + ) { Timber.d("## SAS sending msg type $type") Timber.v("## SAS sending msg info $verificationInfo") val event = createEventAndLocalEcho( @@ -92,12 +94,14 @@ internal class VerificationTransportRoomMessage( } } - override fun sendVerificationRequest(supportedMethods: List, - localId: String, - otherUserId: String, - roomId: String?, - toDevices: List?, - callback: (String?, ValidVerificationInfoRequest?) -> Unit) { + override fun sendVerificationRequest( + supportedMethods: List, + localId: String, + otherUserId: String, + roomId: String?, + toDevices: List?, + callback: (String?, ValidVerificationInfoRequest?) -> Unit + ) { Timber.d("## SAS sending verification request with supported methods: $supportedMethods") // This transport requires a room requireNotNull(roomId) @@ -163,8 +167,10 @@ internal class VerificationTransportRoomMessage( override fun cancelTransaction(transactionId: String, otherUserId: String, otherUserDeviceIds: List, code: CancelCode) = cancelTransaction(transactionId, otherUserId, null, code) - override fun done(transactionId: String, - onDone: (() -> Unit)?) { + override fun done( + transactionId: String, + onDone: (() -> Unit)? + ) { Timber.d("## SAS sending done for $transactionId") val event = createEventAndLocalEcho( type = EventType.KEY_VERIFICATION_DONE, @@ -191,12 +197,14 @@ internal class VerificationTransportRoomMessage( } } - override fun createAccept(tid: String, - keyAgreementProtocol: String, - hash: String, - commitment: String, - messageAuthenticationCode: String, - shortAuthenticationStrings: List): VerificationInfoAccept = + override fun createAccept( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept = MessageVerificationAcceptContent.create( tid, keyAgreementProtocol, @@ -210,12 +218,14 @@ internal class VerificationTransportRoomMessage( override fun createMac(tid: String, mac: Map, keys: String) = MessageVerificationMacContent.create(tid, mac, keys) - override fun createStartForSas(fromDevice: String, - transactionId: String, - keyAgreementProtocols: List, - hashes: List, - messageAuthenticationCodes: List, - shortAuthenticationStrings: List): VerificationInfoStart { + override fun createStartForSas( + fromDevice: String, + transactionId: String, + keyAgreementProtocols: List, + hashes: List, + messageAuthenticationCodes: List, + shortAuthenticationStrings: List + ): VerificationInfoStart { return MessageVerificationStartContent( fromDevice, hashes, @@ -231,9 +241,11 @@ internal class VerificationTransportRoomMessage( ) } - override fun createStartForQrCode(fromDevice: String, - transactionId: String, - sharedSecret: String): VerificationInfoStart { + override fun createStartForQrCode( + fromDevice: String, + transactionId: String, + sharedSecret: String + ): VerificationInfoStart { return MessageVerificationStartContent( fromDevice, null, @@ -274,10 +286,12 @@ internal class VerificationTransportRoomMessage( } } - override fun sendVerificationReady(keyReq: VerificationInfoReady, - otherUserId: String, - otherDeviceId: String?, - callback: (() -> Unit)?) { + override fun sendVerificationReady( + keyReq: VerificationInfoReady, + otherUserId: String, + otherDeviceId: String?, + callback: (() -> Unit)? + ) { // Not applicable (send event is called directly) Timber.w("## SAS ignored verification ready with methods: ${keyReq.methods}") } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportToDevice.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportToDevice.kt index 974adf3888..861a7a3a77 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportToDevice.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/VerificationTransportToDevice.kt @@ -47,12 +47,14 @@ internal class VerificationTransportToDevice( private val clock: Clock, ) : VerificationTransport { - override fun sendVerificationRequest(supportedMethods: List, - localId: String, - otherUserId: String, - roomId: String?, - toDevices: List?, - callback: (String?, ValidVerificationInfoRequest?) -> Unit) { + override fun sendVerificationRequest( + supportedMethods: List, + localId: String, + otherUserId: String, + roomId: String?, + toDevices: List?, + callback: (String?, ValidVerificationInfoRequest?) -> Unit + ) { Timber.d("## SAS sending verification request with supported methods: $supportedMethods") val contentMap = MXUsersDevicesMap() val validKeyReq = ValidVerificationInfoRequest( @@ -86,10 +88,12 @@ internal class VerificationTransportToDevice( .executeBy(taskExecutor) } - override fun sendVerificationReady(keyReq: VerificationInfoReady, - otherUserId: String, - otherDeviceId: String?, - callback: (() -> Unit)?) { + override fun sendVerificationReady( + keyReq: VerificationInfoReady, + otherUserId: String, + otherDeviceId: String?, + callback: (() -> Unit)? + ) { Timber.d("## SAS sending verification ready with methods: ${keyReq.methods}") val contentMap = MXUsersDevicesMap() @@ -111,11 +115,13 @@ internal class VerificationTransportToDevice( .executeBy(taskExecutor) } - override fun sendToOther(type: String, - verificationInfo: VerificationInfo, - nextState: VerificationTxState, - onErrorReason: CancelCode, - onDone: (() -> Unit)?) { + override fun sendToOther( + type: String, + verificationInfo: VerificationInfo, + nextState: VerificationTxState, + onErrorReason: CancelCode, + onDone: (() -> Unit)? + ) { Timber.d("## SAS sending msg type $type") Timber.v("## SAS sending msg info $verificationInfo") val stateBeforeCall = tx?.state @@ -214,12 +220,14 @@ internal class VerificationTransportToDevice( .executeBy(taskExecutor) } - override fun createAccept(tid: String, - keyAgreementProtocol: String, - hash: String, - commitment: String, - messageAuthenticationCode: String, - shortAuthenticationStrings: List): VerificationInfoAccept = KeyVerificationAccept.create( + override fun createAccept( + tid: String, + keyAgreementProtocol: String, + hash: String, + commitment: String, + messageAuthenticationCode: String, + shortAuthenticationStrings: List + ): VerificationInfoAccept = KeyVerificationAccept.create( tid, keyAgreementProtocol, hash, @@ -232,12 +240,14 @@ internal class VerificationTransportToDevice( override fun createMac(tid: String, mac: Map, keys: String) = KeyVerificationMac.create(tid, mac, keys) - override fun createStartForSas(fromDevice: String, - transactionId: String, - keyAgreementProtocols: List, - hashes: List, - messageAuthenticationCodes: List, - shortAuthenticationStrings: List): VerificationInfoStart { + override fun createStartForSas( + fromDevice: String, + transactionId: String, + keyAgreementProtocols: List, + hashes: List, + messageAuthenticationCodes: List, + shortAuthenticationStrings: List + ): VerificationInfoStart { return KeyVerificationStart( fromDevice, VERIFICATION_METHOD_SAS, @@ -250,9 +260,11 @@ internal class VerificationTransportToDevice( ) } - override fun createStartForQrCode(fromDevice: String, - transactionId: String, - sharedSecret: String): VerificationInfoStart { + override fun createStartForQrCode( + fromDevice: String, + transactionId: String, + sharedSecret: String + ): VerificationInfoStart { return KeyVerificationStart( fromDevice, VERIFICATION_METHOD_RECIPROCATE, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/EventInsertLiveObserver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/EventInsertLiveObserver.kt index 751992fa7f..4434347db1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/EventInsertLiveObserver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/EventInsertLiveObserver.kt @@ -33,8 +33,10 @@ import org.matrix.android.sdk.internal.session.EventInsertLiveProcessor import timber.log.Timber import javax.inject.Inject -internal class EventInsertLiveObserver @Inject constructor(@SessionDatabase realmConfiguration: RealmConfiguration, - private val processors: Set<@JvmSuppressWildcards EventInsertLiveProcessor>) : +internal class EventInsertLiveObserver @Inject constructor( + @SessionDatabase realmConfiguration: RealmConfiguration, + private val processors: Set<@JvmSuppressWildcards EventInsertLiveProcessor> +) : RealmLiveEntityObserver(realmConfiguration) { override val query = Monarchy.Query { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmKeysUtils.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmKeysUtils.kt index 392c1a7185..b3a039d119 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmKeysUtils.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmKeysUtils.kt @@ -38,8 +38,10 @@ import javax.inject.Inject * then we generate a random secret key. The database key is encrypted with the secret key; The secret * key is encrypted with the public RSA key and stored with the encrypted key in the shared pref */ -internal class RealmKeysUtils @Inject constructor(context: Context, - private val secretStoringUtils: SecretStoringUtils) { +internal class RealmKeysUtils @Inject constructor( + context: Context, + private val secretStoringUtils: SecretStoringUtils +) { private val rng = SecureRandom() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmQueryLatch.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmQueryLatch.kt index c9c797304a..c5ca861e9b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmQueryLatch.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmQueryLatch.kt @@ -27,9 +27,11 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout -internal suspend fun awaitNotEmptyResult(realmConfiguration: RealmConfiguration, - timeoutMillis: Long, - builder: (Realm) -> RealmQuery) { +internal suspend fun awaitNotEmptyResult( + realmConfiguration: RealmConfiguration, + timeoutMillis: Long, + builder: (Realm) -> RealmQuery +) { withTimeout(timeoutMillis) { // Confine Realm interaction to a single thread with Looper. withContext(Dispatchers.Main) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/SessionRealmConfigurationFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/SessionRealmConfigurationFactory.kt index 08d55b5647..949dd5daa1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/SessionRealmConfigurationFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/SessionRealmConfigurationFactory.kt @@ -44,7 +44,8 @@ internal class SessionRealmConfigurationFactory @Inject constructor( @SessionFilesDirectory val directory: File, @SessionId val sessionId: String, @UserMd5 val userMd5: String, - context: Context) { + context: Context +) { // Keep legacy preferences name for compatibility reason private val sharedPreferences = context.getSharedPreferences("im.vector.matrix.android.realm", Context.MODE_PRIVATE) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ChunkEntityHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ChunkEntityHelper.kt index caaf6b8110..efcbc9de12 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ChunkEntityHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ChunkEntityHelper.kt @@ -79,11 +79,13 @@ internal fun ChunkEntity.addStateEvent(roomId: String, stateEvent: EventEntity, } } -internal fun ChunkEntity.addTimelineEvent(roomId: String, - eventEntity: EventEntity, - direction: PaginationDirection, - ownedByThreadChunk: Boolean = false, - roomMemberContentsByUser: Map? = null): TimelineEventEntity? { +internal fun ChunkEntity.addTimelineEvent( + roomId: String, + eventEntity: EventEntity, + direction: PaginationDirection, + ownedByThreadChunk: Boolean = false, + roomMemberContentsByUser: Map? = null +): TimelineEventEntity? { val eventId = eventEntity.eventId if (timelineEvents.find(eventId) != null) { return null diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadEventsHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadEventsHelper.kt index 5db859bce2..5b2e27c24a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadEventsHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadEventsHelper.kt @@ -49,7 +49,8 @@ internal fun Map.updateThreadSummaryIfNeeded( roomId: String, realm: Realm, currentUserId: String, chunkEntity: ChunkEntity? = null, - shouldUpdateNotifications: Boolean = true) { + shouldUpdateNotifications: Boolean = true +) { for ((rootThreadEventId, eventEntity) in this) { eventEntity.threadSummaryInThread(eventEntity.realm, rootThreadEventId, chunkEntity)?.let { threadSummary -> @@ -87,7 +88,8 @@ internal fun EventEntity.findRootThreadEvent(): EventEntity? = */ internal fun EventEntity.markEventAsRoot( inThreadMessages: Int, - latestMessageTimelineEventEntity: TimelineEventEntity?) { + latestMessageTimelineEventEntity: TimelineEventEntity? +) { isRootThread = true numberOfThreads = inThreadMessages threadSummaryLatestMessage = latestMessageTimelineEventEntity diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadSummaryHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadSummaryHelper.kt index 5b4fe287cb..ebe8de7841 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadSummaryHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/helper/ThreadSummaryHelper.kt @@ -54,7 +54,8 @@ internal fun ThreadSummaryEntity.updateThreadSummary( numberOfThreads: Int?, latestThreadEventEntity: EventEntity?, isUserParticipating: Boolean, - roomMemberContentsByUser: HashMap) { + roomMemberContentsByUser: HashMap +) { updateThreadSummaryRootEvent(rootThreadEventEntity, roomMemberContentsByUser) updateThreadSummaryLatestEvent(latestThreadEventEntity, roomMemberContentsByUser) this.isUserParticipating = isUserParticipating diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/EventMapper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/EventMapper.kt index bc7d40bf6f..5b60c53642 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/EventMapper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/EventMapper.kt @@ -127,10 +127,12 @@ internal fun EventEntity.asDomain(castJsonNumbers: Boolean = false): Event { return EventMapper.map(this, castJsonNumbers) } -internal fun Event.toEntity(roomId: String, - sendState: SendState, - ageLocalTs: Long?, - contentToInject: String? = null): EventEntity { +internal fun Event.toEntity( + roomId: String, + sendState: SendState, + ageLocalTs: Long?, + contentToInject: String? = null +): EventEntity { return EventMapper.map(this, roomId).apply { this.sendState = sendState this.ageLocalTs = ageLocalTs diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt index 41faf30a82..9952a46f03 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/RoomSummaryMapper.kt @@ -29,8 +29,10 @@ import org.matrix.android.sdk.internal.database.model.RoomSummaryEntity import org.matrix.android.sdk.internal.database.model.presence.toUserPresence import javax.inject.Inject -internal class RoomSummaryMapper @Inject constructor(private val timelineEventMapper: TimelineEventMapper, - private val typingUsersTracker: TypingUsersTracker) { +internal class RoomSummaryMapper @Inject constructor( + private val timelineEventMapper: TimelineEventMapper, + private val typingUsersTracker: TypingUsersTracker +) { fun map(roomSummaryEntity: RoomSummaryEntity): RoomSummary { val tags = roomSummaryEntity.tags().map { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo019.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo019.kt index 754a66bb4b..38de70cc7c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo019.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo019.kt @@ -21,8 +21,10 @@ import org.matrix.android.sdk.internal.database.model.RoomSummaryEntityFields import org.matrix.android.sdk.internal.util.Normalizer import org.matrix.android.sdk.internal.util.database.RealmMigrator -internal class MigrateSessionTo019(realm: DynamicRealm, - private val normalizer: Normalizer) : RealmMigrator(realm, 19) { +internal class MigrateSessionTo019( + realm: DynamicRealm, + private val normalizer: Normalizer +) : RealmMigrator(realm, 19) { override fun doMigrate(realm: DynamicRealm) { realm.schema.get("RoomSummaryEntity") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ChunkEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ChunkEntity.kt index 8399d82d5d..e5360ce0b6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ChunkEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ChunkEntity.kt @@ -53,7 +53,8 @@ internal open class ChunkEntity( internal fun ChunkEntity.deleteOnCascade( deleteStateEvents: Boolean, - canDeleteRoot: Boolean) { + canDeleteRoot: Boolean +) { assertIsManaged() if (deleteStateEvents) { stateEvents.deleteAllFromRealm() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/CurrentStateEventEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/CurrentStateEventEntity.kt index 251b057722..9deef69dab 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/CurrentStateEventEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/CurrentStateEventEntity.kt @@ -20,11 +20,12 @@ package org.matrix.android.sdk.internal.database.model import io.realm.RealmObject import io.realm.annotations.Index -internal open class CurrentStateEventEntity(var eventId: String = "", - var root: EventEntity? = null, - @Index var roomId: String = "", - @Index var type: String = "", - @Index var stateKey: String = "" +internal open class CurrentStateEventEntity( + var eventId: String = "", + var root: EventEntity? = null, + @Index var roomId: String = "", + @Index var type: String = "", + @Index var stateKey: String = "" ) : RealmObject() { companion object } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/DraftEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/DraftEntity.kt index fd09da4448..3c19d4d443 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/DraftEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/DraftEntity.kt @@ -18,9 +18,10 @@ package org.matrix.android.sdk.internal.database.model import io.realm.RealmObject -internal open class DraftEntity(var content: String = "", - var draftMode: String = MODE_REGULAR, - var linkedEventId: String = "" +internal open class DraftEntity( + var content: String = "", + var draftMode: String = MODE_REGULAR, + var linkedEventId: String = "" ) : RealmObject() { companion object { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventEntity.kt index ba80cc8302..8b5a211fba 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventEntity.kt @@ -25,28 +25,29 @@ import org.matrix.android.sdk.api.session.threads.ThreadNotificationState import org.matrix.android.sdk.internal.di.MoshiProvider import org.matrix.android.sdk.internal.extensions.assertIsManaged -internal open class EventEntity(@Index var eventId: String = "", - @Index var roomId: String = "", - @Index var type: String = "", - var content: String? = null, - var prevContent: String? = null, - var isUseless: Boolean = false, - @Index var stateKey: String? = null, - var originServerTs: Long? = null, - @Index var sender: String? = null, +internal open class EventEntity( + @Index var eventId: String = "", + @Index var roomId: String = "", + @Index var type: String = "", + var content: String? = null, + var prevContent: String? = null, + var isUseless: Boolean = false, + @Index var stateKey: String? = null, + var originServerTs: Long? = null, + @Index var sender: String? = null, // Can contain a serialized MatrixError - var sendStateDetails: String? = null, - var age: Long? = 0, - var unsignedData: String? = null, - var redacts: String? = null, - var decryptionResultJson: String? = null, - var ageLocalTs: Long? = null, + var sendStateDetails: String? = null, + var age: Long? = 0, + var unsignedData: String? = null, + var redacts: String? = null, + var decryptionResultJson: String? = null, + var ageLocalTs: Long? = null, // Thread related, no need to create a new Entity for performance - @Index var isRootThread: Boolean = false, - @Index var rootThreadEventId: String? = null, + @Index var isRootThread: Boolean = false, + @Index var rootThreadEventId: String? = null, // Number messages within the thread - var numberOfThreads: Int = 0, - var threadSummaryLatestMessage: TimelineEventEntity? = null + var numberOfThreads: Int = 0, + var threadSummaryLatestMessage: TimelineEventEntity? = null ) : RealmObject() { private var sendStateStr: String = SendState.UNKNOWN.name diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventInsertEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventInsertEntity.kt index 5cfd306d2f..eff332dc3a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventInsertEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/EventInsertEntity.kt @@ -22,13 +22,14 @@ import io.realm.RealmObject * This class is used to get notification on new events being inserted. It's to avoid realm getting slow when listening to insert * in EventEntity table. */ -internal open class EventInsertEntity(var eventId: String = "", - var eventType: String = "", - /** - * This flag will be used to filter EventInsertEntity in EventInsertLiveObserver. - * Currently it's set to false when the event content is encrypted. - */ - var canBeProcessed: Boolean = true +internal open class EventInsertEntity( + var eventId: String = "", + var eventType: String = "", + /** + * This flag will be used to filter EventInsertEntity in EventInsertLiveObserver. + * Currently it's set to false when the event content is encrypted. + */ + var canBeProcessed: Boolean = true ) : RealmObject() { private var insertTypeStr: String = EventInsertType.INCREMENTAL_SYNC.name diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupSummaryEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupSummaryEntity.kt index 4ba45dcda2..d965148559 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupSummaryEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupSummaryEntity.kt @@ -21,12 +21,13 @@ import io.realm.RealmObject import io.realm.annotations.PrimaryKey import org.matrix.android.sdk.api.session.room.model.Membership -internal open class GroupSummaryEntity(@PrimaryKey var groupId: String = "", - var displayName: String = "", - var shortDescription: String = "", - var avatarUrl: String = "", - var roomIds: RealmList = RealmList(), - var userIds: RealmList = RealmList() +internal open class GroupSummaryEntity( + @PrimaryKey var groupId: String = "", + var displayName: String = "", + var shortDescription: String = "", + var avatarUrl: String = "", + var roomIds: RealmList = RealmList(), + var userIds: RealmList = RealmList() ) : RealmObject() { private var membershipStr: String = Membership.NONE.name diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ReadReceiptEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ReadReceiptEntity.kt index e01d849cc2..9623c95359 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ReadReceiptEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/ReadReceiptEntity.kt @@ -21,11 +21,12 @@ import io.realm.RealmResults import io.realm.annotations.LinkingObjects import io.realm.annotations.PrimaryKey -internal open class ReadReceiptEntity(@PrimaryKey var primaryKey: String = "", - var eventId: String = "", - var roomId: String = "", - var userId: String = "", - var originServerTs: Double = 0.0 +internal open class ReadReceiptEntity( + @PrimaryKey var primaryKey: String = "", + var eventId: String = "", + var roomId: String = "", + var userId: String = "", + var originServerTs: Double = 0.0 ) : RealmObject() { companion object diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomEntity.kt index d8e6b8af0f..d2116fa9b8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomEntity.kt @@ -24,11 +24,12 @@ import org.matrix.android.sdk.internal.database.model.threads.ThreadSummaryEntit import org.matrix.android.sdk.internal.database.query.findRootOrLatest import org.matrix.android.sdk.internal.extensions.assertIsManaged -internal open class RoomEntity(@PrimaryKey var roomId: String = "", - var chunks: RealmList = RealmList(), - var sendingTimelineEvents: RealmList = RealmList(), - var threadSummaries: RealmList = RealmList(), - var accountData: RealmList = RealmList() +internal open class RoomEntity( + @PrimaryKey var roomId: String = "", + var chunks: RealmList = RealmList(), + var sendingTimelineEvents: RealmList = RealmList(), + var threadSummaries: RealmList = RealmList(), + var accountData: RealmList = RealmList() ) : RealmObject() { private var membershipStr: String = Membership.NONE.name diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomMemberSummaryEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomMemberSummaryEntity.kt index a8a76d1681..6fb9324fcd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomMemberSummaryEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/RoomMemberSummaryEntity.kt @@ -23,13 +23,14 @@ import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.internal.database.model.presence.UserPresenceEntity -internal open class RoomMemberSummaryEntity(@PrimaryKey var primaryKey: String = "", - @Index var userId: String = "", - @Index var roomId: String = "", - @Index var displayName: String? = null, - var avatarUrl: String? = null, - var reason: String? = null, - var isDirect: Boolean = false +internal open class RoomMemberSummaryEntity( + @PrimaryKey var primaryKey: String = "", + @Index var userId: String = "", + @Index var roomId: String = "", + @Index var displayName: String? = null, + var avatarUrl: String? = null, + var reason: String? = null, + var isDirect: Boolean = false ) : RealmObject() { private var membershipStr: String = Membership.NONE.name diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/SyncEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/SyncEntity.kt index a82ec41456..ff261b80c1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/SyncEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/SyncEntity.kt @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.database.model import io.realm.RealmObject import io.realm.annotations.PrimaryKey -internal open class SyncEntity(var nextBatch: String? = null, - @PrimaryKey var id: Long = 0 +internal open class SyncEntity( + var nextBatch: String? = null, + @PrimaryKey var id: Long = 0 ) : RealmObject() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/TimelineEventEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/TimelineEventEntity.kt index 477c04fe51..c8f22dc2cc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/TimelineEventEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/TimelineEventEntity.kt @@ -22,20 +22,21 @@ import io.realm.annotations.Index import io.realm.annotations.LinkingObjects import org.matrix.android.sdk.internal.extensions.assertIsManaged -internal open class TimelineEventEntity(var localId: Long = 0, - @Index var eventId: String = "", - @Index var roomId: String = "", - @Index var displayIndex: Int = 0, - var root: EventEntity? = null, - var annotations: EventAnnotationsSummaryEntity? = null, - var senderName: String? = null, - var isUniqueDisplayName: Boolean = false, - var senderAvatar: String? = null, - var senderMembershipEventId: String? = null, +internal open class TimelineEventEntity( + var localId: Long = 0, + @Index var eventId: String = "", + @Index var roomId: String = "", + @Index var displayIndex: Int = 0, + var root: EventEntity? = null, + var annotations: EventAnnotationsSummaryEntity? = null, + var senderName: String? = null, + var isUniqueDisplayName: Boolean = false, + var senderAvatar: String? = null, + var senderMembershipEventId: String? = null, // ownedByThreadChunk indicates that the current TimelineEventEntity belongs // to a thread chunk and is a temporarily event. - var ownedByThreadChunk: Boolean = false, - var readReceipts: ReadReceiptsSummaryEntity? = null + var ownedByThreadChunk: Boolean = false, + var readReceipts: ReadReceiptsSummaryEntity? = null ) : RealmObject() { @LinkingObjects("timelineEvents") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserDraftsEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserDraftsEntity.kt index 2c778f9797..7ccfc6b104 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserDraftsEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserDraftsEntity.kt @@ -24,7 +24,8 @@ import io.realm.annotations.LinkingObjects /** * Create a specific table to be able to do direct query on it and keep the draft ordered. */ -internal open class UserDraftsEntity(var userDrafts: RealmList = RealmList() +internal open class UserDraftsEntity( + var userDrafts: RealmList = RealmList() ) : RealmObject() { // Link to RoomSummaryEntity diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserEntity.kt index bd6e73582d..3644d12ac9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/UserEntity.kt @@ -19,9 +19,10 @@ package org.matrix.android.sdk.internal.database.model import io.realm.RealmObject import io.realm.annotations.PrimaryKey -internal open class UserEntity(@PrimaryKey var userId: String = "", - var displayName: String = "", - var avatarUrl: String = "" +internal open class UserEntity( + @PrimaryKey var userId: String = "", + var displayName: String = "", + var avatarUrl: String = "" ) : RealmObject() { companion object diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/presence/UserPresenceEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/presence/UserPresenceEntity.kt index 5713337ec5..8d808417c2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/presence/UserPresenceEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/presence/UserPresenceEntity.kt @@ -21,12 +21,13 @@ import io.realm.annotations.PrimaryKey import org.matrix.android.sdk.api.session.presence.model.PresenceEnum import org.matrix.android.sdk.api.session.presence.model.UserPresence -internal open class UserPresenceEntity(@PrimaryKey var userId: String = "", - var lastActiveAgo: Long? = null, - var statusMessage: String? = null, - var isCurrentlyActive: Boolean? = null, - var avatarUrl: String? = null, - var displayName: String? = null +internal open class UserPresenceEntity( + @PrimaryKey var userId: String = "", + var lastActiveAgo: Long? = null, + var statusMessage: String? = null, + var isCurrentlyActive: Boolean? = null, + var avatarUrl: String? = null, + var displayName: String? = null ) : RealmObject() { var presence: PresenceEnum diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/threads/ThreadSummaryEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/threads/ThreadSummaryEntity.kt index ab9d66548e..45f9e3aa20 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/threads/ThreadSummaryEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/threads/ThreadSummaryEntity.kt @@ -23,17 +23,18 @@ import io.realm.annotations.LinkingObjects import org.matrix.android.sdk.internal.database.model.EventEntity import org.matrix.android.sdk.internal.database.model.RoomEntity -internal open class ThreadSummaryEntity(@Index var rootThreadEventId: String? = "", - var rootThreadEventEntity: EventEntity? = null, - var latestThreadEventEntity: EventEntity? = null, - var rootThreadSenderName: String? = null, - var latestThreadSenderName: String? = null, - var rootThreadSenderAvatar: String? = null, - var latestThreadSenderAvatar: String? = null, - var rootThreadIsUniqueDisplayName: Boolean = false, - var isUserParticipating: Boolean = false, - var latestThreadIsUniqueDisplayName: Boolean = false, - var numberOfThreads: Int = 0 +internal open class ThreadSummaryEntity( + @Index var rootThreadEventId: String? = "", + var rootThreadEventEntity: EventEntity? = null, + var latestThreadEventEntity: EventEntity? = null, + var rootThreadSenderName: String? = null, + var latestThreadSenderName: String? = null, + var rootThreadSenderAvatar: String? = null, + var latestThreadSenderAvatar: String? = null, + var rootThreadIsUniqueDisplayName: Boolean = false, + var isUserParticipating: Boolean = false, + var latestThreadIsUniqueDisplayName: Boolean = false, + var numberOfThreads: Int = 0 ) : RealmObject() { @LinkingObjects("threadSummaries") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/CurrentStateEventEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/CurrentStateEventEntityQueries.kt index 716783f2ba..e0dbf2eee8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/CurrentStateEventEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/CurrentStateEventEntityQueries.kt @@ -23,40 +23,50 @@ import io.realm.kotlin.createObject import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntity import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntityFields -internal fun CurrentStateEventEntity.Companion.whereType(realm: Realm, - roomId: String, - type: String): RealmQuery { +internal fun CurrentStateEventEntity.Companion.whereType( + realm: Realm, + roomId: String, + type: String +): RealmQuery { return realm.where(CurrentStateEventEntity::class.java) .equalTo(CurrentStateEventEntityFields.ROOM_ID, roomId) .equalTo(CurrentStateEventEntityFields.TYPE, type) } -internal fun CurrentStateEventEntity.Companion.whereStateKey(realm: Realm, - roomId: String, - type: String, - stateKey: String): RealmQuery { +internal fun CurrentStateEventEntity.Companion.whereStateKey( + realm: Realm, + roomId: String, + type: String, + stateKey: String +): RealmQuery { return whereType(realm = realm, roomId = roomId, type = type) .equalTo(CurrentStateEventEntityFields.STATE_KEY, stateKey) } -internal fun CurrentStateEventEntity.Companion.getOrNull(realm: Realm, - roomId: String, - stateKey: String, - type: String): CurrentStateEventEntity? { +internal fun CurrentStateEventEntity.Companion.getOrNull( + realm: Realm, + roomId: String, + stateKey: String, + type: String +): CurrentStateEventEntity? { return whereStateKey(realm = realm, roomId = roomId, type = type, stateKey = stateKey).findFirst() } -internal fun CurrentStateEventEntity.Companion.getOrCreate(realm: Realm, - roomId: String, - stateKey: String, - type: String): CurrentStateEventEntity { +internal fun CurrentStateEventEntity.Companion.getOrCreate( + realm: Realm, + roomId: String, + stateKey: String, + type: String +): CurrentStateEventEntity { return getOrNull(realm = realm, roomId = roomId, stateKey = stateKey, type = type) ?: create(realm, roomId, stateKey, type) } -private fun create(realm: Realm, - roomId: String, - stateKey: String, - type: String): CurrentStateEventEntity { +private fun create( + realm: Realm, + roomId: String, + stateKey: String, + type: String +): CurrentStateEventEntity { return realm.createObject().apply { this.type = type this.roomId = roomId diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/EventEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/EventEntityQueries.kt index f7fa1037ba..0f1c226044 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/EventEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/EventEntityQueries.kt @@ -59,9 +59,10 @@ internal fun EventEntity.Companion.where(realm: Realm, eventIds: List): .`in`(EventEntityFields.EVENT_ID, eventIds.toTypedArray()) } -internal fun EventEntity.Companion.whereType(realm: Realm, - type: String, - roomId: String? = null +internal fun EventEntity.Companion.whereType( + realm: Realm, + type: String, + roomId: String? = null ): RealmQuery { val query = realm.where() if (roomId != null) { @@ -70,9 +71,11 @@ internal fun EventEntity.Companion.whereType(realm: Realm, return query.equalTo(EventEntityFields.TYPE, type) } -internal fun EventEntity.Companion.whereTypes(realm: Realm, - typeList: List = emptyList(), - roomId: String? = null): RealmQuery { +internal fun EventEntity.Companion.whereTypes( + realm: Realm, + typeList: List = emptyList(), + roomId: String? = null +): RealmQuery { val query = realm.where() query.`in`(EventEntityFields.TYPE, typeList.toTypedArray()) if (roomId != null) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/PushersQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/PushersQueries.kt index 3cea19a690..67fd8296d5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/PushersQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/PushersQueries.kt @@ -26,8 +26,10 @@ import org.matrix.android.sdk.internal.database.model.PushRulesEntityFields import org.matrix.android.sdk.internal.database.model.PusherEntity import org.matrix.android.sdk.internal.database.model.PusherEntityFields -internal fun PusherEntity.Companion.where(realm: Realm, - pushKey: String? = null): RealmQuery { +internal fun PusherEntity.Companion.where( + realm: Realm, + pushKey: String? = null +): RealmQuery { return realm.where() .apply { if (pushKey != null) { @@ -36,17 +38,21 @@ internal fun PusherEntity.Companion.where(realm: Realm, } } -internal fun PushRulesEntity.Companion.where(realm: Realm, - scope: String, - kind: RuleKind): RealmQuery { +internal fun PushRulesEntity.Companion.where( + realm: Realm, + scope: String, + kind: RuleKind +): RealmQuery { return realm.where() .equalTo(PushRulesEntityFields.SCOPE, scope) .equalTo(PushRulesEntityFields.KIND_STR, kind.name) } -internal fun PushRuleEntity.Companion.where(realm: Realm, - scope: String, - ruleId: String): RealmQuery { +internal fun PushRuleEntity.Companion.where( + realm: Realm, + scope: String, + ruleId: String +): RealmQuery { return realm.where() .equalTo(PushRuleEntityFields.PARENT.SCOPE, scope) .equalTo(PushRuleEntityFields.RULE_ID, ruleId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ReadQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ReadQueries.kt index 1a832a29bb..6d295cd2ea 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ReadQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ReadQueries.kt @@ -24,10 +24,12 @@ import org.matrix.android.sdk.internal.database.model.ReadMarkerEntity import org.matrix.android.sdk.internal.database.model.ReadReceiptEntity import org.matrix.android.sdk.internal.database.model.TimelineEventEntity -internal fun isEventRead(realmConfiguration: RealmConfiguration, - userId: String?, - roomId: String?, - eventId: String?): Boolean { +internal fun isEventRead( + realmConfiguration: RealmConfiguration, + userId: String?, + roomId: String?, + eventId: String? +): Boolean { if (userId.isNullOrBlank() || roomId.isNullOrBlank() || eventId.isNullOrBlank()) { return false } @@ -77,9 +79,11 @@ private fun Realm.hasReadReceiptInLatestChunk(latestChunkEntity: ChunkEntity, ro } != null } -internal fun isReadMarkerMoreRecent(realmConfiguration: RealmConfiguration, - roomId: String?, - eventId: String?): Boolean { +internal fun isReadMarkerMoreRecent( + realmConfiguration: RealmConfiguration, + roomId: String?, + eventId: String? +): Boolean { if (roomId.isNullOrBlank() || eventId.isNullOrBlank()) { return false } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/RoomSummaryEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/RoomSummaryEntityQueries.kt index 8993c36a30..3c8d61432a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/RoomSummaryEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/RoomSummaryEntityQueries.kt @@ -53,8 +53,10 @@ internal fun RoomSummaryEntity.Companion.getOrNull(realm: Realm, roomId: String) return where(realm, roomId).findFirst() } -internal fun RoomSummaryEntity.Companion.getDirectRooms(realm: Realm, - excludeRoomIds: Set? = null): RealmResults { +internal fun RoomSummaryEntity.Companion.getDirectRooms( + realm: Realm, + excludeRoomIds: Set? = null +): RealmResults { return RoomSummaryEntity.where(realm) .equalTo(RoomSummaryEntityFields.IS_DIRECT, true) .apply { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/TimelineEventEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/TimelineEventEntityQueries.kt index 1654a33806..30010f90fd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/TimelineEventEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/TimelineEventEntityQueries.kt @@ -33,39 +33,49 @@ internal fun TimelineEventEntity.Companion.where(realm: Realm): RealmQuery { +internal fun TimelineEventEntity.Companion.where( + realm: Realm, + roomId: String, + eventId: String +): RealmQuery { return where(realm) .equalTo(TimelineEventEntityFields.ROOM_ID, roomId) .equalTo(TimelineEventEntityFields.EVENT_ID, eventId) } -internal fun TimelineEventEntity.Companion.where(realm: Realm, - roomId: String, - eventIds: List): RealmQuery { +internal fun TimelineEventEntity.Companion.where( + realm: Realm, + roomId: String, + eventIds: List +): RealmQuery { return where(realm) .equalTo(TimelineEventEntityFields.ROOM_ID, roomId) .`in`(TimelineEventEntityFields.EVENT_ID, eventIds.toTypedArray()) } -internal fun TimelineEventEntity.Companion.whereRoomId(realm: Realm, - roomId: String): RealmQuery { +internal fun TimelineEventEntity.Companion.whereRoomId( + realm: Realm, + roomId: String +): RealmQuery { return where(realm) .equalTo(TimelineEventEntityFields.ROOM_ID, roomId) } -internal fun TimelineEventEntity.Companion.findWithSenderMembershipEvent(realm: Realm, - senderMembershipEventId: String): List { +internal fun TimelineEventEntity.Companion.findWithSenderMembershipEvent( + realm: Realm, + senderMembershipEventId: String +): List { return where(realm) .equalTo(TimelineEventEntityFields.SENDER_MEMBERSHIP_EVENT_ID, senderMembershipEventId) .findAll() } -internal fun TimelineEventEntity.Companion.latestEvent(realm: Realm, - roomId: String, - includesSending: Boolean, - filters: TimelineEventFilters = TimelineEventFilters()): TimelineEventEntity? { +internal fun TimelineEventEntity.Companion.latestEvent( + realm: Realm, + roomId: String, + includesSending: Boolean, + filters: TimelineEventFilters = TimelineEventFilters() +): TimelineEventEntity? { val roomEntity = RoomEntity.where(realm, roomId).findFirst() ?: return null val sendingTimelineEvents = roomEntity.sendingTimelineEvents.where().filterEvents(filters) @@ -129,9 +139,11 @@ internal fun RealmList.find(eventId: String): TimelineEvent .findFirst() } -internal fun TimelineEventEntity.Companion.findAllInRoomWithSendStates(realm: Realm, - roomId: String, - sendStates: List): RealmResults { +internal fun TimelineEventEntity.Companion.findAllInRoomWithSendStates( + realm: Realm, + roomId: String, + sendStates: List +): RealmResults { return whereRoomId(realm, roomId) .filterSendStates(sendStates) .findAll() @@ -145,8 +157,10 @@ internal fun RealmQuery.filterSendStates(sendStates: List): RealmResults { +internal fun TimelineEventEntity.Companion.findAllFrom( + realm: Realm, + senderIds: Collection +): RealmResults { return where(realm) .`in`(TimelineEventEntityFields.ROOT.SENDER, senderIds.toTypedArray()) .isNull(TimelineEventEntityFields.ROOT.STATE_KEY) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/MatrixComponent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/MatrixComponent.kt index dbc6aac6b5..095916643c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/MatrixComponent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/MatrixComponent.kt @@ -100,7 +100,9 @@ internal interface MatrixComponent { @Component.Factory interface Factory { - fun create(@BindsInstance context: Context, - @BindsInstance matrixConfiguration: MatrixConfiguration): MatrixComponent + fun create( + @BindsInstance context: Context, + @BindsInstance matrixConfiguration: MatrixConfiguration + ): MatrixComponent } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/NetworkModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/NetworkModule.kt index 0cbbe1210d..862cf463b2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/NetworkModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/NetworkModule.kt @@ -62,13 +62,15 @@ internal object NetworkModule { @Provides @JvmStatic @Unauthenticated - fun providesOkHttpClient(matrixConfiguration: MatrixConfiguration, - stethoInterceptor: StethoInterceptor, - timeoutInterceptor: TimeOutInterceptor, - userAgentInterceptor: UserAgentInterceptor, - httpLoggingInterceptor: HttpLoggingInterceptor, - curlLoggingInterceptor: CurlLoggingInterceptor, - apiInterceptor: ApiInterceptor): OkHttpClient { + fun providesOkHttpClient( + matrixConfiguration: MatrixConfiguration, + stethoInterceptor: StethoInterceptor, + timeoutInterceptor: TimeOutInterceptor, + userAgentInterceptor: UserAgentInterceptor, + httpLoggingInterceptor: HttpLoggingInterceptor, + curlLoggingInterceptor: CurlLoggingInterceptor, + apiInterceptor: ApiInterceptor + ): OkHttpClient { val spec = ConnectionSpec.Builder(matrixConfiguration.connectionSpec).build() return OkHttpClient.Builder() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt index c59936af94..ad28286a84 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/WorkManagerProvider.kt @@ -59,8 +59,10 @@ internal class WorkManagerProvider @Inject constructor( /** * Create a PeriodicWorkRequestBuilder, with the Matrix SDK tag. */ - inline fun matrixPeriodicWorkRequestBuilder(repeatInterval: Long, - repeatIntervalTimeUnit: TimeUnit) = + inline fun matrixPeriodicWorkRequestBuilder( + repeatInterval: Long, + repeatIntervalTimeUnit: TimeUnit + ) = PeriodicWorkRequestBuilder(repeatInterval, repeatIntervalTimeUnit) .addTag(tag) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/federation/FederationModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/federation/FederationModule.kt index a4eef80c58..bbb29b6255 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/federation/FederationModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/federation/FederationModule.kt @@ -34,9 +34,11 @@ internal abstract class FederationModule { companion object { @Provides @JvmStatic - fun providesFederationAPI(@Unauthenticated okHttpClient: Lazy, - sessionParams: SessionParams, - retrofitFactory: RetrofitFactory): FederationAPI { + fun providesFederationAPI( + @Unauthenticated okHttpClient: Lazy, + sessionParams: SessionParams, + retrofitFactory: RetrofitFactory + ): FederationAPI { return retrofitFactory.create(okHttpClient, sessionParams.homeServerUrlBase) .create(FederationAPI::class.java) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/legacy/DefaultLegacySessionImporter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/legacy/DefaultLegacySessionImporter.kt index 0a76fb2eef..56d9cc2143 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/legacy/DefaultLegacySessionImporter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/legacy/DefaultLegacySessionImporter.kt @@ -132,7 +132,7 @@ internal class DefaultLegacySessionImporter @Inject constructor( bytes = it.bytes, hashType = when (it.type) { LegacyFingerprint.HashType.SHA1, - null -> Fingerprint.HashType.SHA1 + null -> Fingerprint.HashType.SHA1 LegacyFingerprint.HashType.SHA256 -> Fingerprint.HashType.SHA256 } ) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkCallbackStrategy.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkCallbackStrategy.kt index 8e18d2d850..f75fb01746 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkCallbackStrategy.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkCallbackStrategy.kt @@ -31,8 +31,10 @@ internal interface NetworkCallbackStrategy { fun unregister() } -internal class FallbackNetworkCallbackStrategy @Inject constructor(private val context: Context, - private val networkInfoReceiver: NetworkInfoReceiver) : NetworkCallbackStrategy { +internal class FallbackNetworkCallbackStrategy @Inject constructor( + private val context: Context, + private val networkInfoReceiver: NetworkInfoReceiver +) : NetworkCallbackStrategy { @Suppress("DEPRECATION") val filter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkConnectivityChecker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkConnectivityChecker.kt index 65bf3fcadf..c54227a786 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkConnectivityChecker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/NetworkConnectivityChecker.kt @@ -41,9 +41,11 @@ internal interface NetworkConnectivityChecker { } @SessionScope -internal class DefaultNetworkConnectivityChecker @Inject constructor(private val homeServerPinger: HomeServerPinger, - private val backgroundDetectionObserver: BackgroundDetectionObserver, - private val networkCallbackStrategy: NetworkCallbackStrategy) : +internal class DefaultNetworkConnectivityChecker @Inject constructor( + private val homeServerPinger: HomeServerPinger, + private val backgroundDetectionObserver: BackgroundDetectionObserver, + private val networkCallbackStrategy: NetworkCallbackStrategy +) : NetworkConnectivityChecker { private val hasInternetAccess = AtomicBoolean(true) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ProgressRequestBody.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ProgressRequestBody.kt index 818d7d6af3..6e4d064a0f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ProgressRequestBody.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ProgressRequestBody.kt @@ -26,8 +26,10 @@ import okio.buffer import org.matrix.android.sdk.api.extensions.tryOrNull import java.io.IOException -internal class ProgressRequestBody(private val delegate: RequestBody, - private val listener: Listener) : RequestBody() { +internal class ProgressRequestBody( + private val delegate: RequestBody, + private val listener: Listener +) : RequestBody() { private lateinit var countingSink: CountingSink diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt index 87a98e03f6..565111b9ab 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/Request.kt @@ -40,11 +40,13 @@ import java.io.IOException * @param maxRetriesCount the max number of retries * @param requestBlock a suspend lambda to perform the network request */ -internal suspend inline fun executeRequest(globalErrorReceiver: GlobalErrorReceiver?, - canRetry: Boolean = false, - maxDelayBeforeRetry: Long = 32_000L, - maxRetriesCount: Int = 4, - noinline requestBlock: suspend () -> DATA): DATA { +internal suspend inline fun executeRequest( + globalErrorReceiver: GlobalErrorReceiver?, + canRetry: Boolean = false, + maxDelayBeforeRetry: Long = 32_000L, + maxRetriesCount: Int = 4, + noinline requestBlock: suspend () -> DATA +): DATA { var currentRetryCount = 0 var currentDelay = 1_000L diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/RequestExecutor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/RequestExecutor.kt index 71df7c08be..2e8b2bc771 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/RequestExecutor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/RequestExecutor.kt @@ -19,19 +19,23 @@ package org.matrix.android.sdk.internal.network import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest internal interface RequestExecutor { - suspend fun executeRequest(globalErrorReceiver: GlobalErrorReceiver?, - canRetry: Boolean = false, - maxDelayBeforeRetry: Long = 32_000L, - maxRetriesCount: Int = 4, - requestBlock: suspend () -> DATA): DATA + suspend fun executeRequest( + globalErrorReceiver: GlobalErrorReceiver?, + canRetry: Boolean = false, + maxDelayBeforeRetry: Long = 32_000L, + maxRetriesCount: Int = 4, + requestBlock: suspend () -> DATA + ): DATA } internal object DefaultRequestExecutor : RequestExecutor { - override suspend fun executeRequest(globalErrorReceiver: GlobalErrorReceiver?, - canRetry: Boolean, - maxDelayBeforeRetry: Long, - maxRetriesCount: Int, - requestBlock: suspend () -> DATA): DATA { + override suspend fun executeRequest( + globalErrorReceiver: GlobalErrorReceiver?, + canRetry: Boolean, + maxDelayBeforeRetry: Long, + maxRetriesCount: Int, + requestBlock: suspend () -> DATA + ): DATA { return internalExecuteRequest(globalErrorReceiver, canRetry, maxDelayBeforeRetry, maxRetriesCount, requestBlock) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UnitConverterFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UnitConverterFactory.kt index f2571ab73f..8dcff59cba 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UnitConverterFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UnitConverterFactory.kt @@ -22,8 +22,10 @@ import retrofit2.Retrofit import java.lang.reflect.Type internal object UnitConverterFactory : Converter.Factory() { - override fun responseBodyConverter(type: Type, annotations: Array, - retrofit: Retrofit): Converter? { + override fun responseBodyConverter( + type: Type, annotations: Array, + retrofit: Retrofit + ): Converter? { return if (type == Unit::class.java) UnitConverter else null } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt index 00e15c283e..28d96dfce7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt @@ -24,8 +24,10 @@ import timber.log.Timber import javax.inject.Inject @MatrixScope -internal class UserAgentHolder @Inject constructor(private val context: Context, - matrixConfiguration: MatrixConfiguration) { +internal class UserAgentHolder @Inject constructor( + private val context: Context, + matrixConfiguration: MatrixConfiguration +) { var userAgent: String = "" private set diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/parsing/RuntimeJsonAdapterFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/parsing/RuntimeJsonAdapterFactory.kt index dd41b9f6fc..7cf3603cc5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/parsing/RuntimeJsonAdapterFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/parsing/RuntimeJsonAdapterFactory.kt @@ -70,11 +70,13 @@ internal class RuntimeJsonAdapterFactory( } @Suppress("UNCHECKED_CAST") - internal class RuntimeJsonAdapter(val labelKey: String, - val labelToAdapter: Map>, - val typeToLabel: Map, - val objectJsonAdapter: JsonAdapter, - val fallbackAdapter: JsonAdapter) : JsonAdapter() { + internal class RuntimeJsonAdapter( + val labelKey: String, + val labelToAdapter: Map>, + val typeToLabel: Map, + val objectJsonAdapter: JsonAdapter, + val fallbackAdapter: JsonAdapter + ) : JsonAdapter() { @Throws(IOException::class) override fun fromJson(reader: JsonReader): Any? { val peekedToken = reader.peek() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManager.kt index 539570cdd9..1b957c3855 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManager.kt @@ -29,8 +29,10 @@ import javax.net.ssl.X509TrustManager * @property defaultTrustManager Optional trust manager to fall back on if cert does not match * any of the fingerprints. Can be null. */ -internal class PinnedTrustManager(private val fingerprints: List, - private val defaultTrustManager: X509TrustManager?) : X509TrustManager { +internal class PinnedTrustManager( + private val fingerprints: List, + private val defaultTrustManager: X509TrustManager? +) : X509TrustManager { @Throws(CertificateException::class) override fun checkClientTrusted(chain: Array, s: String) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerApi24.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerApi24.kt index 191bb90a67..ef703f3b61 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerApi24.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerApi24.kt @@ -34,8 +34,10 @@ import javax.net.ssl.X509ExtendedTrustManager * any of the fingerprints. Can be null. */ @RequiresApi(Build.VERSION_CODES.N) -internal class PinnedTrustManagerApi24(private val fingerprints: List, - private val defaultTrustManager: X509ExtendedTrustManager?) : X509ExtendedTrustManager() { +internal class PinnedTrustManagerApi24( + private val fingerprints: List, + private val defaultTrustManager: X509ExtendedTrustManager? +) : X509ExtendedTrustManager() { @Throws(CertificateException::class) override fun checkClientTrusted(chain: Array, authType: String, engine: SSLEngine?) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerProvider.kt index f01ee7af24..bfdc4e537e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/ssl/PinnedTrustManagerProvider.kt @@ -25,8 +25,10 @@ internal object PinnedTrustManagerProvider { // Set to false to perform some tests private const val USE_DEFAULT_TRUST_MANAGER = true - fun provide(fingerprints: List?, - defaultTrustManager: X509TrustManager?): X509TrustManager { + fun provide( + fingerprints: List?, + defaultTrustManager: X509TrustManager? + ): X509TrustManager { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && defaultTrustManager is X509ExtendedTrustManager) { PinnedTrustManagerApi24( fingerprints.orEmpty(), diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/RawModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/RawModule.kt index a830976671..4b643f1fef 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/RawModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/raw/RawModule.kt @@ -51,8 +51,10 @@ internal abstract class RawModule { @Provides @GlobalDatabase @MatrixScope - fun providesRealmConfiguration(realmKeysUtils: RealmKeysUtils, - globalRealmMigration: GlobalRealmMigration): RealmConfiguration { + fun providesRealmConfiguration( + realmKeysUtils: RealmKeysUtils, + globalRealmMigration: GlobalRealmMigration + ): RealmConfiguration { return RealmConfiguration.Builder() .apply { realmKeysUtils.configureEncryption(this, DB_ALIAS) @@ -67,8 +69,10 @@ internal abstract class RawModule { @Provides @JvmStatic - fun providesRawAPI(@Unauthenticated okHttpClient: Lazy, - retrofitFactory: RetrofitFactory): RawAPI { + fun providesRawAPI( + @Unauthenticated okHttpClient: Lazy, + retrofitFactory: RetrofitFactory + ): RawAPI { return retrofitFactory.create(okHttpClient, "https://example.org").create(RawAPI::class.java) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt index 760aa41081..d3c51a7b7b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultFileService.kt @@ -80,10 +80,12 @@ internal class DefaultFileService @Inject constructor( * Download file in the cache folder, and eventually decrypt it. * TODO looks like files are copied 3 times */ - override suspend fun downloadFile(fileName: String, - mimeType: String?, - url: String?, - elementToDecrypt: ElementToDecrypt?): File { + override suspend fun downloadFile( + fileName: String, + mimeType: String?, + url: String?, + elementToDecrypt: ElementToDecrypt? + ): File { url ?: throw IllegalArgumentException("url is null") Timber.v("## FileService downloadFile $url") @@ -218,11 +220,13 @@ internal class DefaultFileService @Inject constructor( return result.getOrThrow() } - fun storeDataFor(mxcUrl: String, - filename: String?, - mimeType: String?, - originalFile: File, - encryptedFile: File?) { + fun storeDataFor( + mxcUrl: String, + filename: String?, + mimeType: String?, + originalFile: File, + encryptedFile: File? + ) { val files = getFiles(mxcUrl, filename, mimeType, encryptedFile != null) if (encryptedFile != null) { // We switch the two files here, original file it the decrypted file @@ -256,10 +260,12 @@ internal class DefaultFileService @Inject constructor( } } - override fun isFileInCache(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt?): Boolean { + override fun isFileInCache( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? + ): Boolean { return fileState(mxcUrl, fileName, mimeType, elementToDecrypt) is FileService.FileState.InCache } @@ -272,10 +278,12 @@ internal class DefaultFileService @Inject constructor( fun getClearFile(): File = decryptedFile ?: file } - private fun getFiles(mxcUrl: String, - fileName: String?, - mimeType: String?, - isEncrypted: Boolean): CachedFiles { + private fun getFiles( + mxcUrl: String, + fileName: String?, + mimeType: String?, + isEncrypted: Boolean + ): CachedFiles { val hashFolder = mxcUrl.md5() val safeFileName = safeFileName(fileName, mimeType) return if (isEncrypted) { @@ -293,10 +301,12 @@ internal class DefaultFileService @Inject constructor( } } - override fun fileState(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt?): FileService.FileState { + override fun fileState( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? + ): FileService.FileState { mxcUrl ?: return FileService.FileState.Unknown val files = getFiles(mxcUrl, fileName, mimeType, elementToDecrypt != null) if (files.file.exists()) { @@ -314,10 +324,12 @@ internal class DefaultFileService @Inject constructor( * Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION * (if not other app won't be able to access it). */ - override fun getTemporarySharableURI(mxcUrl: String?, - fileName: String, - mimeType: String?, - elementToDecrypt: ElementToDecrypt?): Uri? { + override fun getTemporarySharableURI( + mxcUrl: String?, + fileName: String, + mimeType: String?, + elementToDecrypt: ElementToDecrypt? + ): Uri? { mxcUrl ?: return null // this string could be extracted no? val authority = "${context.packageName}.mx-sdk.fileprovider" diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt index 050480e6c9..f53a89130a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt @@ -135,6 +135,7 @@ internal interface SessionComponent { interface Factory { fun create( matrixComponent: MatrixComponent, - @BindsInstance sessionParams: SessionParams): SessionComponent + @BindsInstance sessionParams: SessionParams + ): SessionComponent } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt index 9208ff219b..b35a95d687 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt @@ -166,9 +166,11 @@ internal abstract class SessionModule { @Provides @SessionFilesDirectory @SessionScope - fun providesFilesDir(@UserMd5 userMd5: String, - @SessionId sessionId: String, - context: Context): File { + fun providesFilesDir( + @UserMd5 userMd5: String, + @SessionId sessionId: String, + context: Context + ): File { // Temporary code for migration val old = File(context.filesDir, userMd5) if (old.exists()) { @@ -181,8 +183,10 @@ internal abstract class SessionModule { @JvmStatic @Provides @SessionDownloadsDirectory - fun providesDownloadsCacheDir(@SessionId sessionId: String, - @CacheDirectory cacheFile: File): File { + fun providesDownloadsCacheDir( + @SessionId sessionId: String, + @CacheDirectory cacheFile: File + ): File { return File(cacheFile, "downloads/$sessionId") } @@ -208,8 +212,10 @@ internal abstract class SessionModule { @Provides @SessionScope @UnauthenticatedWithCertificate - fun providesOkHttpClientWithCertificate(@Unauthenticated okHttpClient: OkHttpClient, - homeServerConnectionConfig: HomeServerConnectionConfig): OkHttpClient { + fun providesOkHttpClientWithCertificate( + @Unauthenticated okHttpClient: OkHttpClient, + homeServerConnectionConfig: HomeServerConnectionConfig + ): OkHttpClient { return okHttpClient .newBuilder() .addSocketFactory(homeServerConnectionConfig) @@ -220,10 +226,12 @@ internal abstract class SessionModule { @Provides @SessionScope @Authenticated - fun providesOkHttpClient(@UnauthenticatedWithCertificate okHttpClient: OkHttpClient, - @Authenticated accessTokenProvider: AccessTokenProvider, - @SessionId sessionId: String, - @MockHttpInterceptor testInterceptor: TestInterceptor?): OkHttpClient { + fun providesOkHttpClient( + @UnauthenticatedWithCertificate okHttpClient: OkHttpClient, + @Authenticated accessTokenProvider: AccessTokenProvider, + @SessionId sessionId: String, + @MockHttpInterceptor testInterceptor: TestInterceptor? + ): OkHttpClient { return okHttpClient .newBuilder() .addAccessTokenInterceptor(accessTokenProvider) @@ -240,8 +248,10 @@ internal abstract class SessionModule { @Provides @SessionScope @UnauthenticatedWithCertificateWithProgress - fun providesProgressOkHttpClient(@UnauthenticatedWithCertificate okHttpClient: OkHttpClient, - downloadProgressInterceptor: DownloadProgressInterceptor): OkHttpClient { + fun providesProgressOkHttpClient( + @UnauthenticatedWithCertificate okHttpClient: OkHttpClient, + downloadProgressInterceptor: DownloadProgressInterceptor + ): OkHttpClient { return okHttpClient.newBuilder() .apply { // Remove the previous CurlLoggingInterceptor, to add it after the accessTokenInterceptor @@ -260,9 +270,11 @@ internal abstract class SessionModule { @JvmStatic @Provides @SessionScope - fun providesRetrofit(@Authenticated okHttpClient: Lazy, - sessionParams: SessionParams, - retrofitFactory: RetrofitFactory): Retrofit { + fun providesRetrofit( + @Authenticated okHttpClient: Lazy, + sessionParams: SessionParams, + retrofitFactory: RetrofitFactory + ): Retrofit { return retrofitFactory .create(okHttpClient, sessionParams.homeServerConnectionConfig.homeServerUriBase.toString()) } @@ -270,8 +282,9 @@ internal abstract class SessionModule { @JvmStatic @Provides @SessionScope - fun providesNetworkCallbackStrategy(fallbackNetworkCallbackStrategy: Provider, - preferredNetworkCallbackStrategy: Provider + fun providesNetworkCallbackStrategy( + fallbackNetworkCallbackStrategy: Provider, + preferredNetworkCallbackStrategy: Provider ): NetworkCallbackStrategy { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { preferredNetworkCallbackStrategy.get() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DeactivateAccountTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DeactivateAccountTask.kt index 9f3f1f649e..5f4d3d5fbc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DeactivateAccountTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DeactivateAccountTask.kt @@ -60,10 +60,10 @@ internal class DefaultDeactivateAccountTask @Inject constructor( execute(params.copy(userAuthParam = authUpdate)) } )) { - UiaResult.SUCCESS -> { + UiaResult.SUCCESS -> { false } - UiaResult.FAILURE -> { + UiaResult.FAILURE -> { Timber.d("## UIA: propagate failure") throw throwable } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DefaultAccountService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DefaultAccountService.kt index dc77d7bffb..bb830a5e41 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DefaultAccountService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/account/DefaultAccountService.kt @@ -20,8 +20,10 @@ import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor import org.matrix.android.sdk.api.session.account.AccountService import javax.inject.Inject -internal class DefaultAccountService @Inject constructor(private val changePasswordTask: ChangePasswordTask, - private val deactivateAccountTask: DeactivateAccountTask) : AccountService { +internal class DefaultAccountService @Inject constructor( + private val changePasswordTask: ChangePasswordTask, + private val deactivateAccountTask: DeactivateAccountTask +) : AccountService { override suspend fun changePassword(password: String, newPassword: String) { changePasswordTask.execute(ChangePasswordTask.Params(password, newPassword)) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/MxCallFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/MxCallFactory.kt index 9ec892b65d..5b4100f276 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/MxCallFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/MxCallFactory.kt @@ -79,10 +79,12 @@ internal class MxCallFactory @Inject constructor( } } - fun updateOutgoingCallWithOpponentData(call: MxCall, - userId: String, - content: CallSignalingContent, - callCapabilities: CallCapabilities?) { + fun updateOutgoingCallWithOpponentData( + call: MxCall, + userId: String, + content: CallSignalingContent, + callCapabilities: CallCapabilities? + ) { (call as? MxCallImpl)?.updateOpponentData(userId, content, callCapabilities) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt index 796e83311f..13a77e55e1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/model/MxCallImpl.kt @@ -220,10 +220,12 @@ internal class MxCallImpl( .also { eventSenderProcessor.postEvent(it) } } - override suspend fun transfer(targetUserId: String, - targetRoomId: String?, - createCallId: String?, - awaitCallId: String?) { + override suspend fun transfer( + targetUserId: String, + targetRoomId: String?, + createCallId: String?, + awaitCallId: String? + ) { val profileInfoParams = GetProfileInfoTask.Params(targetUserId) val profileInfo = try { getProfileInfoTask.execute(profileInfoParams) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/DefaultContentUrlResolver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/DefaultContentUrlResolver.kt index 5d77424482..ad2b9d0905 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/DefaultContentUrlResolver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/DefaultContentUrlResolver.kt @@ -80,9 +80,11 @@ internal class DefaultContentUrlResolver @Inject constructor( } } - private fun resolve(contentUrl: String, - toThumbnail: Boolean, - params: String = ""): String { + private fun resolve( + contentUrl: String, + toThumbnail: Boolean, + params: String = "" + ): String { var serverAndMediaId = contentUrl.removeMxcPrefix() val apiPath = if (scannerService.isScannerEnabled()) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/FileUploader.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/FileUploader.kt index f96a019fe2..c023646c7f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/FileUploader.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/FileUploader.kt @@ -62,10 +62,12 @@ internal class FileUploader @Inject constructor( private val uploadUrl = contentUrlResolver.uploadUrl private val responseAdapter = moshi.adapter(ContentUploadResponse::class.java) - suspend fun uploadFile(file: File, - filename: String?, - mimeType: String?, - progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse { + suspend fun uploadFile( + file: File, + filename: String?, + mimeType: String?, + progressListener: ProgressRequestBody.Listener? = null + ): ContentUploadResponse { // Check size limit val maxUploadFileSize = homeServerCapabilitiesService.getHomeServerCapabilities().maxUploadFileSize @@ -99,18 +101,22 @@ internal class FileUploader @Inject constructor( return upload(uploadBody, filename, progressListener) } - suspend fun uploadByteArray(byteArray: ByteArray, - filename: String?, - mimeType: String?, - progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse { + suspend fun uploadByteArray( + byteArray: ByteArray, + filename: String?, + mimeType: String?, + progressListener: ProgressRequestBody.Listener? = null + ): ContentUploadResponse { val uploadBody = byteArray.toRequestBody(mimeType?.toMediaTypeOrNull()) return upload(uploadBody, filename, progressListener) } - suspend fun uploadFromUri(uri: Uri, - filename: String?, - mimeType: String?, - progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse { + suspend fun uploadFromUri( + uri: Uri, + filename: String?, + mimeType: String?, + progressListener: ProgressRequestBody.Listener? = null + ): ContentUploadResponse { val workingFile = context.copyUriToTempFile(uri) return uploadFile(workingFile, filename, mimeType, progressListener).also { tryOrNull { workingFile.delete() } @@ -128,9 +134,11 @@ internal class FileUploader @Inject constructor( } } - private suspend fun upload(uploadBody: RequestBody, - filename: String?, - progressListener: ProgressRequestBody.Listener?): ContentUploadResponse { + private suspend fun upload( + uploadBody: RequestBody, + filename: String?, + progressListener: ProgressRequestBody.Listener? + ): ContentUploadResponse { val urlBuilder = uploadUrl.toHttpUrlOrNull()?.newBuilder() ?: throw RuntimeException() val httpUrl = urlBuilder diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageCompressor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageCompressor.kt index c5aa6cd5e7..cca01b4dc7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageCompressor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ImageCompressor.kt @@ -35,7 +35,8 @@ internal class ImageCompressor @Inject constructor( imageFile: File, desiredWidth: Int, desiredHeight: Int, - desiredQuality: Int = 80): File { + desiredQuality: Int = 80 + ): File { return withContext(coroutineDispatchers.io) { val compressedBitmap = BitmapFactory.Options().run { inJustDecodeBounds = true diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt index 5a00c4b5b4..b62ca2c0f6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt @@ -375,12 +375,14 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter ) } - private suspend fun handleSuccess(params: Params, - attachmentUrl: String, - encryptedFileInfo: EncryptedFileInfo?, - thumbnailUrl: String?, - thumbnailEncryptedFileInfo: EncryptedFileInfo?, - newAttachmentAttributes: NewAttachmentAttributes): Result { + private suspend fun handleSuccess( + params: Params, + attachmentUrl: String, + encryptedFileInfo: EncryptedFileInfo?, + thumbnailUrl: String?, + thumbnailEncryptedFileInfo: EncryptedFileInfo?, + newAttachmentAttributes: NewAttachmentAttributes + ): Result { notifyTracker(params) { contentUploadStateTracker.setSuccess(it) } params.localEchoIds.forEach { updateEvent(it.eventId, attachmentUrl, encryptedFileInfo, thumbnailUrl, thumbnailEncryptedFileInfo, newAttachmentAttributes) @@ -396,12 +398,14 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter } } - private suspend fun updateEvent(eventId: String, - url: String, - encryptedFileInfo: EncryptedFileInfo?, - thumbnailUrl: String? = null, - thumbnailEncryptedFileInfo: EncryptedFileInfo?, - newAttachmentAttributes: NewAttachmentAttributes) { + private suspend fun updateEvent( + eventId: String, + url: String, + encryptedFileInfo: EncryptedFileInfo?, + thumbnailUrl: String? = null, + thumbnailEncryptedFileInfo: EncryptedFileInfo?, + newAttachmentAttributes: NewAttachmentAttributes + ) { localEchoRepository.updateEcho(eventId) { _, event -> val messageContent: MessageContent? = event.asDomain().content.toModel() val updatedContent = when (messageContent) { @@ -419,9 +423,11 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter params.localEchoIds.forEach { function.invoke(it.eventId) } } - private fun MessageImageContent.update(url: String, - encryptedFileInfo: EncryptedFileInfo?, - newAttachmentAttributes: NewAttachmentAttributes?): MessageImageContent { + private fun MessageImageContent.update( + url: String, + encryptedFileInfo: EncryptedFileInfo?, + newAttachmentAttributes: NewAttachmentAttributes? + ): MessageImageContent { return copy( url = if (encryptedFileInfo == null) url else null, encryptedFileInfo = encryptedFileInfo?.copy(url = url), @@ -433,11 +439,13 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter ) } - private fun MessageVideoContent.update(url: String, - encryptedFileInfo: EncryptedFileInfo?, - thumbnailUrl: String?, - thumbnailEncryptedFileInfo: EncryptedFileInfo?, - newAttachmentAttributes: NewAttachmentAttributes?): MessageVideoContent { + private fun MessageVideoContent.update( + url: String, + encryptedFileInfo: EncryptedFileInfo?, + thumbnailUrl: String?, + thumbnailEncryptedFileInfo: EncryptedFileInfo?, + newAttachmentAttributes: NewAttachmentAttributes? + ): MessageVideoContent { return copy( url = if (encryptedFileInfo == null) url else null, encryptedFileInfo = encryptedFileInfo?.copy(url = url), @@ -451,9 +459,11 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter ) } - private fun MessageFileContent.update(url: String, - encryptedFileInfo: EncryptedFileInfo?, - size: Long): MessageFileContent { + private fun MessageFileContent.update( + url: String, + encryptedFileInfo: EncryptedFileInfo?, + size: Long + ): MessageFileContent { return copy( url = if (encryptedFileInfo == null) url else null, encryptedFileInfo = encryptedFileInfo?.copy(url = url), @@ -461,9 +471,11 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter ) } - private fun MessageAudioContent.update(url: String, - encryptedFileInfo: EncryptedFileInfo?, - size: Long): MessageAudioContent { + private fun MessageAudioContent.update( + url: String, + encryptedFileInfo: EncryptedFileInfo?, + size: Long + ): MessageAudioContent { return copy( url = if (encryptedFileInfo == null) url else null, encryptedFileInfo = encryptedFileInfo?.copy(url = url), diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/VideoCompressor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/VideoCompressor.kt index a43f8abf33..85f59ab043 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/VideoCompressor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/VideoCompressor.kt @@ -32,8 +32,10 @@ internal class VideoCompressor @Inject constructor( private val temporaryFileCreator: TemporaryFileCreator ) { - suspend fun compress(videoFile: File, - progressListener: ProgressListener?): VideoCompressionResult { + suspend fun compress( + videoFile: File, + progressListener: ProgressListener? + ): VideoCompressionResult { val destinationFile = temporaryFileCreator.create() val job = Job() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/ContentScannerModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/ContentScannerModule.kt index 7ea74225cd..89b5c44ef0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/ContentScannerModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/ContentScannerModule.kt @@ -49,9 +49,11 @@ internal abstract class ContentScannerModule { @Provides @ContentScannerDatabase @SessionScope - fun providesContentScannerRealmConfiguration(realmKeysUtils: RealmKeysUtils, - @SessionFilesDirectory directory: File, - @UserMd5 userMd5: String): RealmConfiguration { + fun providesContentScannerRealmConfiguration( + realmKeysUtils: RealmKeysUtils, + @SessionFilesDirectory directory: File, + @UserMd5 userMd5: String + ): RealmConfiguration { return RealmConfiguration.Builder() .directory(directory) .name("matrix-sdk-content-scanning.realm") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScannerEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScannerEntityQueries.kt index e4b64a1a0e..bb3051bc96 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScannerEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScannerEntityQueries.kt @@ -31,10 +31,12 @@ internal fun ContentScanResultEntity.Companion.get(realm: Realm, attachmentUrl: .findFirst() } -internal fun ContentScanResultEntity.Companion.getOrCreate(realm: Realm, - attachmentUrl: String, - contentScannerUrl: String?, - currentTimeMillis: Long): ContentScanResultEntity { +internal fun ContentScanResultEntity.Companion.getOrCreate( + realm: Realm, + attachmentUrl: String, + contentScannerUrl: String?, + currentTimeMillis: Long +): ContentScanResultEntity { return ContentScanResultEntity.get(realm, attachmentUrl, contentScannerUrl) ?: realm.createObject().also { it.mediaUrl = attachmentUrl diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/directory/DirectoryAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/directory/DirectoryAPI.kt index 0db6812609..488c61206b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/directory/DirectoryAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/directory/DirectoryAPI.kt @@ -49,8 +49,10 @@ internal interface DirectoryAPI { * @param body the body containing the new directory visibility */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "directory/list/room/{roomId}") - suspend fun setRoomDirectoryVisibility(@Path("roomId") roomId: String, - @Body body: RoomDirectoryVisibilityJson) + suspend fun setRoomDirectoryVisibility( + @Path("roomId") roomId: String, + @Body body: RoomDirectoryVisibilityJson + ) /** * Add alias to the room. @@ -58,8 +60,10 @@ internal interface DirectoryAPI { * @param body the Json body */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "directory/room/{roomAlias}") - suspend fun addRoomAlias(@Path("roomAlias") roomAlias: String, - @Body body: AddRoomAliasBody) + suspend fun addRoomAlias( + @Path("roomAlias") roomAlias: String, + @Body body: AddRoomAliasBody + ) /** * Delete a room alias. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/download/ProgressResponseBody.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/download/ProgressResponseBody.kt index 4fd4fda7d1..4e0096b7dd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/download/ProgressResponseBody.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/download/ProgressResponseBody.kt @@ -27,7 +27,8 @@ import okio.buffer internal class ProgressResponseBody( private val responseBody: ResponseBody, private val chainUrl: String, - private val progressListener: ProgressListener) : ResponseBody() { + private val progressListener: ProgressListener +) : ResponseBody() { private var bufferedSource: BufferedSource? = null diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/DefaultFilterService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/DefaultFilterService.kt index 9a16b8fd4a..2e68d02d8c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/DefaultFilterService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/DefaultFilterService.kt @@ -21,8 +21,10 @@ import org.matrix.android.sdk.internal.task.TaskExecutor import org.matrix.android.sdk.internal.task.configureWith import javax.inject.Inject -internal class DefaultFilterService @Inject constructor(private val saveFilterTask: SaveFilterTask, - private val taskExecutor: TaskExecutor) : FilterService { +internal class DefaultFilterService @Inject constructor( + private val saveFilterTask: SaveFilterTask, + private val taskExecutor: TaskExecutor +) : FilterService { // TODO Pass a list of support events instead override fun setFilter(filterPreset: FilterService.FilterPreset) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/FilterApi.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/FilterApi.kt index d1df77d14a..ac1e9a654c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/FilterApi.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/FilterApi.kt @@ -31,8 +31,10 @@ internal interface FilterApi { * @param body the Json representation of a FilterBody object */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/filter") - suspend fun uploadFilter(@Path("userId") userId: String, - @Body body: Filter): FilterResponse + suspend fun uploadFilter( + @Path("userId") userId: String, + @Body body: Filter + ): FilterResponse /** * Gets a filter with a given filterId from the homeserver. @@ -42,6 +44,8 @@ internal interface FilterApi { * @return Filter */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/filter/{filterId}") - suspend fun getFilterById(@Path("userId") userId: String, - @Path("filterId") filterId: String): Filter + suspend fun getFilterById( + @Path("userId") userId: String, + @Path("filterId") filterId: String + ): Filter } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/group/DefaultGroup.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/group/DefaultGroup.kt index 4f610fd81b..9c37d4db6c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/group/DefaultGroup.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/group/DefaultGroup.kt @@ -18,8 +18,10 @@ package org.matrix.android.sdk.internal.session.group import org.matrix.android.sdk.api.session.group.Group -internal class DefaultGroup(override val groupId: String, - private val getGroupDataTask: GetGroupDataTask) : Group { +internal class DefaultGroup( + override val groupId: String, + private val getGroupDataTask: GetGroupDataTask +) : Group { override suspend fun fetchGroupData() { val params = GetGroupDataTask.Params.FetchWithIds(listOf(groupId)) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/GetHomeServerCapabilitiesTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/GetHomeServerCapabilitiesTask.kt index b1a518724c..d22da8f6f2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/GetHomeServerCapabilitiesTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/GetHomeServerCapabilitiesTask.kt @@ -109,10 +109,12 @@ internal class DefaultGetHomeServerCapabilitiesTask @Inject constructor( insertInDb(capabilities, mediaConfig, versions, wellknownResult) } - private suspend fun insertInDb(getCapabilitiesResult: GetCapabilitiesResult?, - getMediaConfigResult: GetMediaConfigResult?, - getVersionResult: Versions?, - getWellknownResult: WellknownResult?) { + private suspend fun insertInDb( + getCapabilitiesResult: GetCapabilitiesResult?, + getMediaConfigResult: GetMediaConfigResult?, + getVersionResult: Versions?, + getWellknownResult: WellknownResult? + ) { monarchy.awaitTransaction { realm -> val homeServerCapabilitiesEntity = HomeServerCapabilitiesEntity.getOrCreate(realm) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/HomeServerPinger.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/HomeServerPinger.kt index 70e1e551aa..a3d6b7fa49 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/HomeServerPinger.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/homeserver/HomeServerPinger.kt @@ -22,8 +22,10 @@ import org.matrix.android.sdk.internal.network.executeRequest import org.matrix.android.sdk.internal.task.TaskExecutor import javax.inject.Inject -internal class HomeServerPinger @Inject constructor(private val taskExecutor: TaskExecutor, - private val capabilitiesAPI: CapabilitiesAPI) { +internal class HomeServerPinger @Inject constructor( + private val taskExecutor: TaskExecutor, + private val capabilitiesAPI: CapabilitiesAPI +) { fun canReachHomeServer(callback: (Boolean) -> Unit) { taskExecutor.executorScope.launch { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityAPI.kt index aef86ed08e..7b04bc52b0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityAPI.kt @@ -95,8 +95,10 @@ internal interface IdentityAPI { * - https://matrix.org/docs/spec/identity_service/latest#post-matrix-identity-v2-validate-email-submittoken */ @POST(NetworkConstants.URI_IDENTITY_PATH_V2 + "validate/{medium}/submitToken") - suspend fun submitToken(@Path("medium") medium: String, - @Body body: IdentityRequestOwnershipParams): SuccessResult + suspend fun submitToken( + @Path("medium") medium: String, + @Body body: IdentityRequestOwnershipParams + ): SuccessResult /** * https://matrix.org/docs/spec/identity_service/r0.3.0#post-matrix-identity-v2-sign-ed25519. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityBulkLookupTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityBulkLookupTask.kt index f642ed4cf2..21b59cca9d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityBulkLookupTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityBulkLookupTask.kt @@ -75,10 +75,12 @@ internal class DefaultIdentityBulkLookupTask @Inject constructor( val identityLookUpResponse: IdentityLookUpResponse ) - private suspend fun lookUpInternal(identityAPI: IdentityAPI, - threePids: List, - hashDetailResponse: IdentityHashDetailResponse, - canRetry: Boolean): LookUpData { + private suspend fun lookUpInternal( + identityAPI: IdentityAPI, + threePids: List, + hashDetailResponse: IdentityHashDetailResponse, + canRetry: Boolean + ): LookUpData { val hashedAddresses = getHashedAddresses(threePids, hashDetailResponse.pepper) return try { LookUpData(hashedAddresses, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityModule.kt index 4e9d7dc7f7..464ae96e3a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/IdentityModule.kt @@ -47,8 +47,10 @@ internal abstract class IdentityModule { @Provides @SessionScope @AuthenticatedIdentity - fun providesOkHttpClient(@UnauthenticatedWithCertificate okHttpClient: OkHttpClient, - @AuthenticatedIdentity accessTokenProvider: AccessTokenProvider): OkHttpClient { + fun providesOkHttpClient( + @UnauthenticatedWithCertificate okHttpClient: OkHttpClient, + @AuthenticatedIdentity accessTokenProvider: AccessTokenProvider + ): OkHttpClient { return okHttpClient .newBuilder() .addAccessTokenInterceptor(accessTokenProvider) @@ -59,10 +61,12 @@ internal abstract class IdentityModule { @Provides @IdentityDatabase @SessionScope - fun providesIdentityRealmConfiguration(realmKeysUtils: RealmKeysUtils, - realmIdentityStoreMigration: RealmIdentityStoreMigration, - @SessionFilesDirectory directory: File, - @UserMd5 userMd5: String): RealmConfiguration { + fun providesIdentityRealmConfiguration( + realmKeysUtils: RealmKeysUtils, + realmIdentityStoreMigration: RealmIdentityStoreMigration, + @SessionFilesDirectory directory: File, + @UserMd5 userMd5: String + ): RealmConfiguration { return RealmConfiguration.Builder() .directory(directory) .name("matrix-sdk-identity.realm") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/IdentityDataEntityQuery.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/IdentityDataEntityQuery.kt index aecf21678c..08e5b43977 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/IdentityDataEntityQuery.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/identity/db/IdentityDataEntityQuery.kt @@ -32,8 +32,10 @@ private fun IdentityDataEntity.Companion.getOrCreate(realm: Realm): IdentityData return get(realm) ?: realm.createObject() } -internal fun IdentityDataEntity.Companion.setUrl(realm: Realm, - url: String?) { +internal fun IdentityDataEntity.Companion.setUrl( + realm: Realm, + url: String? +) { realm.where().findAll().deleteAllFromRealm() // Delete all pending binding if any IdentityPendingBindingEntity.deleteAll(realm) @@ -45,23 +47,29 @@ internal fun IdentityDataEntity.Companion.setUrl(realm: Realm, } } -internal fun IdentityDataEntity.Companion.setToken(realm: Realm, - newToken: String?) { +internal fun IdentityDataEntity.Companion.setToken( + realm: Realm, + newToken: String? +) { get(realm)?.apply { token = newToken } } -internal fun IdentityDataEntity.Companion.setUserConsent(realm: Realm, - newConsent: Boolean) { +internal fun IdentityDataEntity.Companion.setUserConsent( + realm: Realm, + newConsent: Boolean +) { get(realm)?.apply { userConsent = newConsent } } -internal fun IdentityDataEntity.Companion.setHashDetails(realm: Realm, - pepper: String, - algorithms: List) { +internal fun IdentityDataEntity.Companion.setHashDetails( + realm: Realm, + pepper: String, + algorithms: List +) { get(realm)?.apply { hashLookupPepper = pepper hashLookupAlgorithm = RealmList().apply { addAll(algorithms) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/DefaultSyncStatusService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/DefaultSyncStatusService.kt index 2aa0be80c9..c6e15733d5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/DefaultSyncStatusService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/DefaultSyncStatusService.kt @@ -43,8 +43,10 @@ internal class DefaultSyncStatusService @Inject constructor() : /** * Create a rootTask. */ - fun startRoot(initSyncStep: InitSyncStep, - totalProgress: Int) { + fun startRoot( + initSyncStep: InitSyncStep, + totalProgress: Int + ) { endAll() rootTask = TaskInfo(initSyncStep, totalProgress, null, 1F) reportProgress(0F) @@ -53,9 +55,11 @@ internal class DefaultSyncStatusService @Inject constructor() : /** * Add a child to the leaf. */ - override fun startTask(initSyncStep: InitSyncStep, - totalProgress: Int, - parentWeight: Float) { + override fun startTask( + initSyncStep: InitSyncStep, + totalProgress: Int, + parentWeight: Float + ) { val currentLeaf = rootTask?.leaf() ?: return currentLeaf.child = TaskInfo( initSyncStep = initSyncStep, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/Extensions.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/Extensions.kt index b40b1a56bf..d98590f052 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/Extensions.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/Extensions.kt @@ -18,21 +18,25 @@ package org.matrix.android.sdk.internal.session.initsync import org.matrix.android.sdk.api.session.initsync.InitSyncStep -internal inline fun reportSubtask(reporter: ProgressReporter?, - initSyncStep: InitSyncStep, - totalProgress: Int, - parentWeight: Float, - block: () -> T): T { +internal inline fun reportSubtask( + reporter: ProgressReporter?, + initSyncStep: InitSyncStep, + totalProgress: Int, + parentWeight: Float, + block: () -> T +): T { reporter?.startTask(initSyncStep, totalProgress, parentWeight) return block().also { reporter?.endTask() } } -internal inline fun Map.mapWithProgress(reporter: ProgressReporter?, - initSyncStep: InitSyncStep, - parentWeight: Float, - transform: (Map.Entry) -> R): List { +internal inline fun Map.mapWithProgress( + reporter: ProgressReporter?, + initSyncStep: InitSyncStep, + parentWeight: Float, + transform: (Map.Entry) -> R +): List { var current = 0F reporter?.startTask(initSyncStep, count() + 1, parentWeight) return map { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/ProgressReporter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/ProgressReporter.kt index 8a7b26b4b8..d608a5aa85 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/ProgressReporter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/ProgressReporter.kt @@ -19,9 +19,11 @@ package org.matrix.android.sdk.internal.session.initsync import org.matrix.android.sdk.api.session.initsync.InitSyncStep internal interface ProgressReporter { - fun startTask(initSyncStep: InitSyncStep, - totalProgress: Int, - parentWeight: Float) + fun startTask( + initSyncStep: InitSyncStep, + totalProgress: Int, + parentWeight: Float + ) fun reportProgress(progress: Float) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/TaskInfo.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/TaskInfo.kt index fef16bf1d7..5ddbcde1f1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/TaskInfo.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/initsync/TaskInfo.kt @@ -19,10 +19,12 @@ package org.matrix.android.sdk.internal.session.initsync import org.matrix.android.sdk.api.session.initsync.InitSyncStep import timber.log.Timber -internal class TaskInfo(val initSyncStep: InitSyncStep, - val totalProgress: Int, - val parent: TaskInfo?, - val parentWeight: Float) { +internal class TaskInfo( + val initSyncStep: InitSyncStep, + val totalProgress: Int, + val parent: TaskInfo?, + val parentWeight: Float +) { var child: TaskInfo? = null var currentProgress = 0F private set diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/integrationmanager/IntegrationManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/integrationmanager/IntegrationManager.kt index 8034e5b974..7588037b46 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/integrationmanager/IntegrationManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/integrationmanager/IntegrationManager.kt @@ -54,11 +54,13 @@ import javax.inject.Inject * */ @SessionScope -internal class IntegrationManager @Inject constructor(matrixConfiguration: MatrixConfiguration, - @SessionDatabase private val monarchy: Monarchy, - private val updateUserAccountDataTask: UpdateUserAccountDataTask, - private val accountDataDataSource: UserAccountDataDataSource, - private val widgetFactory: WidgetFactory) : +internal class IntegrationManager @Inject constructor( + matrixConfiguration: MatrixConfiguration, + @SessionDatabase private val monarchy: Monarchy, + private val updateUserAccountDataTask: UpdateUserAccountDataTask, + private val accountDataDataSource: UserAccountDataDataSource, + private val widgetFactory: WidgetFactory +) : SessionLifecycleObserver { private val currentConfigs = ArrayList() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/GetOpenIdTokenTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/GetOpenIdTokenTask.kt index a6ad025b8d..5ab6aca88c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/GetOpenIdTokenTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/GetOpenIdTokenTask.kt @@ -28,7 +28,8 @@ internal interface GetOpenIdTokenTask : Task internal class DefaultGetOpenIdTokenTask @Inject constructor( @UserId private val userId: String, private val openIdAPI: OpenIdAPI, - private val globalErrorReceiver: GlobalErrorReceiver) : GetOpenIdTokenTask { + private val globalErrorReceiver: GlobalErrorReceiver +) : GetOpenIdTokenTask { override suspend fun execute(params: Unit): OpenIdToken { return executeRequest(globalErrorReceiver) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/OpenIdAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/OpenIdAPI.kt index c3caaefdec..180ecbb1a3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/OpenIdAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/openid/OpenIdAPI.kt @@ -35,6 +35,8 @@ internal interface OpenIdAPI { * @param body an empty json body */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/openid/request_token") - suspend fun openIdToken(@Path("userId") userId: String, - @Body body: JsonDict = emptyMap()): OpenIdToken + suspend fun openIdToken( + @Path("userId") userId: String, + @Body body: JsonDict = emptyMap() + ): OpenIdToken } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/presence/PresenceAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/presence/PresenceAPI.kt index 53d0d5e963..4af0307cb5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/presence/PresenceAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/presence/PresenceAPI.kt @@ -31,8 +31,10 @@ internal interface PresenceAPI { * Ref: https://matrix.org/docs/spec/client_server/latest#put-matrix-client-r0-presence-userid-status */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "presence/{userId}/status") - suspend fun setPresence(@Path("userId") userId: String, - @Body body: SetPresenceBody) + suspend fun setPresence( + @Path("userId") userId: String, + @Body body: SetPresenceBody + ) /** * Get the given user's presence state. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/AddThreePidTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/AddThreePidTask.kt index 678d399428..f7798dc9e9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/AddThreePidTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/AddThreePidTask.kt @@ -37,7 +37,8 @@ internal class DefaultAddThreePidTask @Inject constructor( private val profileAPI: ProfileAPI, @SessionDatabase private val monarchy: Monarchy, private val pendingThreePidMapper: PendingThreePidMapper, - private val globalErrorReceiver: GlobalErrorReceiver) : AddThreePidTask() { + private val globalErrorReceiver: GlobalErrorReceiver +) : AddThreePidTask() { override suspend fun execute(params: Params) { when (params.threePid) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/BindThreePidsTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/BindThreePidsTask.kt index f630c2c225..71e9743c6a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/BindThreePidsTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/BindThreePidsTask.kt @@ -33,11 +33,13 @@ internal abstract class BindThreePidsTask : Task ) } -internal class DefaultBindThreePidsTask @Inject constructor(private val profileAPI: ProfileAPI, - private val identityStore: IdentityStore, - @AuthenticatedIdentity - private val accessTokenProvider: AccessTokenProvider, - private val globalErrorReceiver: GlobalErrorReceiver) : BindThreePidsTask() { +internal class DefaultBindThreePidsTask @Inject constructor( + private val profileAPI: ProfileAPI, + private val identityStore: IdentityStore, + @AuthenticatedIdentity + private val accessTokenProvider: AccessTokenProvider, + private val globalErrorReceiver: GlobalErrorReceiver +) : BindThreePidsTask() { override suspend fun execute(params: Params) { val identityServerUrlWithoutProtocol = identityStore.getIdentityServerUrlWithoutProtocol() ?: throw IdentityServiceError.NoIdentityServerConfigured val identityServerAccessToken = accessTokenProvider.getToken() ?: throw IdentityServiceError.NoIdentityServerConfigured diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DefaultProfileService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DefaultProfileService.kt index 5e64a6af0e..0776569661 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DefaultProfileService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DefaultProfileService.kt @@ -38,20 +38,22 @@ import org.matrix.android.sdk.internal.task.TaskExecutor import org.matrix.android.sdk.internal.task.configureWith import javax.inject.Inject -internal class DefaultProfileService @Inject constructor(private val taskExecutor: TaskExecutor, - @SessionDatabase private val monarchy: Monarchy, - private val coroutineDispatchers: MatrixCoroutineDispatchers, - private val refreshUserThreePidsTask: RefreshUserThreePidsTask, - private val getProfileInfoTask: GetProfileInfoTask, - private val setDisplayNameTask: SetDisplayNameTask, - private val setAvatarUrlTask: SetAvatarUrlTask, - private val addThreePidTask: AddThreePidTask, - private val validateSmsCodeTask: ValidateSmsCodeTask, - private val finalizeAddingThreePidTask: FinalizeAddingThreePidTask, - private val deleteThreePidTask: DeleteThreePidTask, - private val pendingThreePidMapper: PendingThreePidMapper, - private val userStore: UserStore, - private val fileUploader: FileUploader) : ProfileService { +internal class DefaultProfileService @Inject constructor( + private val taskExecutor: TaskExecutor, + @SessionDatabase private val monarchy: Monarchy, + private val coroutineDispatchers: MatrixCoroutineDispatchers, + private val refreshUserThreePidsTask: RefreshUserThreePidsTask, + private val getProfileInfoTask: GetProfileInfoTask, + private val setDisplayNameTask: SetDisplayNameTask, + private val setAvatarUrlTask: SetAvatarUrlTask, + private val addThreePidTask: AddThreePidTask, + private val validateSmsCodeTask: ValidateSmsCodeTask, + private val finalizeAddingThreePidTask: FinalizeAddingThreePidTask, + private val deleteThreePidTask: DeleteThreePidTask, + private val pendingThreePidMapper: PendingThreePidMapper, + private val userStore: UserStore, + private val fileUploader: FileUploader +) : ProfileService { override suspend fun getDisplayName(userId: String): Optional { val params = GetProfileInfoTask.Params(userId) @@ -132,8 +134,10 @@ internal class DefaultProfileService @Inject constructor(private val taskExecuto validateSmsCodeTask.execute(ValidateSmsCodeTask.Params(threePid, code)) } - override suspend fun finalizeAddingThreePid(threePid: ThreePid, - userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) { + override suspend fun finalizeAddingThreePid( + threePid: ThreePid, + userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor + ) { finalizeAddingThreePidTask .execute( FinalizeAddingThreePidTask.Params( @@ -165,8 +169,8 @@ internal class DefaultProfileService @Inject constructor(private val taskExecuto private fun UserThreePidEntity.asDomain(): ThreePid { return when (medium) { - ThirdPartyIdentifier.MEDIUM_EMAIL -> ThreePid.Email(address) + ThirdPartyIdentifier.MEDIUM_EMAIL -> ThreePid.Email(address) ThirdPartyIdentifier.MEDIUM_MSISDN -> ThreePid.Msisdn(address) - else -> error("Invalid medium type") + else -> error("Invalid medium type") } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DeleteThreePidTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DeleteThreePidTask.kt index 7b7617aa80..a8047a0118 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DeleteThreePidTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/DeleteThreePidTask.kt @@ -31,7 +31,8 @@ internal abstract class DeleteThreePidTask : Task -internal class DefaultRefreshUserThreePidsTask @Inject constructor(private val profileAPI: ProfileAPI, - @SessionDatabase private val monarchy: Monarchy, - private val globalErrorReceiver: GlobalErrorReceiver) : RefreshUserThreePidsTask() { +internal class DefaultRefreshUserThreePidsTask @Inject constructor( + private val profileAPI: ProfileAPI, + @SessionDatabase private val monarchy: Monarchy, + private val globalErrorReceiver: GlobalErrorReceiver +) : RefreshUserThreePidsTask() { override suspend fun execute(params: Unit) { val accountThreePidsResponse = executeRequest(globalErrorReceiver) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetAvatarUrlTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetAvatarUrlTask.kt index a7d116d919..80282a894b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetAvatarUrlTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetAvatarUrlTask.kt @@ -30,7 +30,8 @@ internal abstract class SetAvatarUrlTask : Task { internal class DefaultSetAvatarUrlTask @Inject constructor( private val profileAPI: ProfileAPI, - private val globalErrorReceiver: GlobalErrorReceiver) : SetAvatarUrlTask() { + private val globalErrorReceiver: GlobalErrorReceiver +) : SetAvatarUrlTask() { override suspend fun execute(params: Params) { val body = SetAvatarUrlBody( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetDisplayNameTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetDisplayNameTask.kt index 61d3042310..e3f04792b6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetDisplayNameTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/profile/SetDisplayNameTask.kt @@ -30,7 +30,8 @@ internal abstract class SetDisplayNameTask : Task { - data class Params(val pushKey: String, - val pushAppId: String) + data class Params( + val pushKey: String, + val pushAppId: String + ) } internal class DefaultRemovePusherTask @Inject constructor( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleEnableStatusTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleEnableStatusTask.kt index 815661a1ce..a923f1932b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleEnableStatusTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleEnableStatusTask.kt @@ -23,9 +23,11 @@ import org.matrix.android.sdk.internal.task.Task import javax.inject.Inject internal interface UpdatePushRuleEnableStatusTask : Task { - data class Params(val kind: RuleKind, - val pushRule: PushRule, - val enabled: Boolean) + data class Params( + val kind: RuleKind, + val pushRule: PushRule, + val enabled: Boolean + ) } internal class DefaultUpdatePushRuleEnableStatusTask @Inject constructor( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomDirectoryService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomDirectoryService.kt index 7330c91c20..1edc4c1e66 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomDirectoryService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomDirectoryService.kt @@ -35,8 +35,10 @@ internal class DefaultRoomDirectoryService @Inject constructor( private val roomAliasAvailabilityChecker: RoomAliasAvailabilityChecker ) : RoomDirectoryService { - override suspend fun getPublicRooms(server: String?, - publicRoomsParams: PublicRoomsParams): PublicRoomsResponse { + override suspend fun getPublicRooms( + server: String?, + publicRoomsParams: PublicRoomsParams + ): PublicRoomsResponse { return getPublicRoomTask.execute(GetPublicRoomTask.Params(server, publicRoomsParams)) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt index 8424ee8a36..b51f3d73f4 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt @@ -91,8 +91,10 @@ internal class DefaultRoomService @Inject constructor( return roomSummaryDataSource.getRoomSummary(roomIdOrAlias) } - override fun getRoomSummaries(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder): List { + override fun getRoomSummaries( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder + ): List { return roomSummaryDataSource.getRoomSummaries(queryParams, sortOrder) } @@ -113,20 +115,26 @@ internal class DefaultRoomService @Inject constructor( } } - override fun getRoomSummariesLive(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder): LiveData> { + override fun getRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder + ): LiveData> { return roomSummaryDataSource.getRoomSummariesLive(queryParams, sortOrder) } - override fun getPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config, - sortOrder: RoomSortOrder): LiveData> { + override fun getPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config, + sortOrder: RoomSortOrder + ): LiveData> { return roomSummaryDataSource.getSortedPagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder) } - override fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config, - sortOrder: RoomSortOrder): UpdatableLivePageResult { + override fun getFilteredPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config, + sortOrder: RoomSortOrder + ): UpdatableLivePageResult { return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder) } @@ -154,9 +162,11 @@ internal class DefaultRoomService @Inject constructor( joinRoomTask.execute(JoinRoomTask.Params(roomIdOrAlias, reason, viaServers)) } - override suspend fun joinRoom(roomId: String, - reason: String?, - thirdPartySigned: SignInvitationResult) { + override suspend fun joinRoom( + roomId: String, + reason: String?, + thirdPartySigned: SignInvitationResult + ) { joinRoomTask.execute(JoinRoomTask.Params(roomId, reason, thirdPartySigned = thirdPartySigned)) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt index 3efeef7688..5a794c6ba3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventRelationsAggregationProcessor.kt @@ -258,7 +258,7 @@ internal class EventRelationsAggregationProcessor @Inject constructor( liveLocationAggregationProcessor.handleBeaconInfo(realm, event, it, roomId, isLocalEcho) } } - in EventType.BEACON_LOCATION_DATA -> { + in EventType.BEACON_LOCATION_DATA -> { handleBeaconLocationData(event, realm, roomId, isLocalEcho) } else -> Timber.v("UnHandled event ${event.eventId}") @@ -271,12 +271,14 @@ internal class EventRelationsAggregationProcessor @Inject constructor( // OPT OUT serer aggregation until API mature enough private val SHOULD_HANDLE_SERVER_AGREGGATION = false // should be true to work with e2e - private fun handleReplace(realm: Realm, - event: Event, - content: MessageContent, - roomId: String, - isLocalEcho: Boolean, - relatedEventId: String? = null) { + private fun handleReplace( + realm: Realm, + event: Event, + content: MessageContent, + roomId: String, + isLocalEcho: Boolean, + relatedEventId: String? = null + ) { val eventId = event.eventId ?: return val targetEventId = relatedEventId ?: content.relatesTo?.eventId ?: return val newContent = content.newContent ?: return @@ -366,9 +368,11 @@ internal class EventRelationsAggregationProcessor @Inject constructor( * @param replaceEvent The new event * @param editions list of edition of event */ - private fun handleThreadSummaryEdition(editedEvent: EventEntity?, - replaceEvent: TimelineEventEntity?, - editions: List?) { + private fun handleThreadSummaryEdition( + editedEvent: EventEntity?, + replaceEvent: TimelineEventEntity?, + editions: List? + ) { replaceEvent ?: return editedEvent ?: return editedEvent.findRootThreadEvent()?.apply { @@ -387,10 +391,12 @@ internal class EventRelationsAggregationProcessor @Inject constructor( ?.let { PowerLevelsHelper(it) } } - private fun handleInitialAggregatedRelations(realm: Realm, - event: Event, - roomId: String, - aggregation: AggregatedAnnotation) { + private fun handleInitialAggregatedRelations( + realm: Realm, + event: Event, + roomId: String, + aggregation: AggregatedAnnotation + ) { if (SHOULD_HANDLE_SERVER_AGREGGATION) { aggregation.chunk?.forEach { if (it.type == EventType.REACTION) { @@ -412,10 +418,12 @@ internal class EventRelationsAggregationProcessor @Inject constructor( } } - private fun handleReaction(realm: Realm, - event: Event, - roomId: String, - isLocalEcho: Boolean) { + private fun handleReaction( + realm: Realm, + event: Event, + roomId: String, + isLocalEcho: Boolean + ) { val content = event.content.toModel() if (content == null) { Timber.e("Malformed reaction content ${event.content}") @@ -480,9 +488,11 @@ internal class EventRelationsAggregationProcessor @Inject constructor( /** * Called when an event is deleted. */ - private fun handleRedactionOfReplace(realm: Realm, - redacted: EventEntity, - relatedEventId: String) { + private fun handleRedactionOfReplace( + realm: Realm, + redacted: EventEntity, + relatedEventId: String + ) { Timber.d("Handle redaction of m.replace") val eventSummary = EventAnnotationsSummaryEntity.where(realm, redacted.roomId, relatedEventId).findFirst() if (eventSummary == null) { @@ -498,8 +508,10 @@ internal class EventRelationsAggregationProcessor @Inject constructor( sourceToDiscard.deleteFromRealm() } - private fun handleReactionRedact(realm: Realm, - eventToPrune: EventEntity) { + private fun handleReactionRedact( + realm: Realm, + eventToPrune: EventEntity + ) { Timber.v("REDACTION of reaction ${eventToPrune.eventId}") // delete a reaction, need to update the annotation summary if any val reactionContent: ReactionContent = EventMapper.map(eventToPrune).content.toModel() ?: return diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/RoomAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/RoomAPI.kt index ba7f4cf5ad..ac2880de69 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/RoomAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/RoomAPI.kt @@ -58,8 +58,9 @@ internal interface RoomAPI { * Ref: https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-publicrooms */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "publicRooms") - suspend fun publicRooms(@Query("server") server: String?, - @Body publicRoomsParams: PublicRoomsParams + suspend fun publicRooms( + @Query("server") server: String?, + @Body publicRoomsParams: PublicRoomsParams ): PublicRoomsResponse /** @@ -84,11 +85,12 @@ internal interface RoomAPI { * @param filter A JSON RoomEventFilter to filter returned events with. Optional. */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/messages") - suspend fun getRoomMessagesFrom(@Path("roomId") roomId: String, - @Query("from") from: String, - @Query("dir") dir: String, - @Query("limit") limit: Int?, - @Query("filter") filter: String? + suspend fun getRoomMessagesFrom( + @Path("roomId") roomId: String, + @Query("from") from: String, + @Query("dir") dir: String, + @Query("limit") limit: Int?, + @Query("filter") filter: String? ): PaginationResponse /** @@ -100,10 +102,11 @@ internal interface RoomAPI { * @param notMembership to exclude one type of membership (optional) */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/members") - suspend fun getMembers(@Path("roomId") roomId: String, - @Query("at") syncToken: String?, - @Query("membership") membership: Membership?, - @Query("not_membership") notMembership: Membership? + suspend fun getMembers( + @Path("roomId") roomId: String, + @Query("at") syncToken: String?, + @Query("membership") membership: Membership?, + @Query("not_membership") notMembership: Membership? ): RoomMembersResponse /** @@ -115,10 +118,11 @@ internal interface RoomAPI { * @param content the event content */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/send/{eventType}/{txId}") - suspend fun send(@Path("txId") txId: String, - @Path("roomId") roomId: String, - @Path("eventType") eventType: String, - @Body content: Content? + suspend fun send( + @Path("txId") txId: String, + @Path("roomId") roomId: String, + @Path("eventType") eventType: String, + @Body content: Content? ): SendResponse /** @@ -130,10 +134,12 @@ internal interface RoomAPI { * @param filter A JSON RoomEventFilter to filter returned events with. Optional. */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/context/{eventId}") - suspend fun getContextOfEvent(@Path("roomId") roomId: String, - @Path("eventId") eventId: String, - @Query("limit") limit: Int, - @Query("filter") filter: String? = null): EventContextResponse + suspend fun getContextOfEvent( + @Path("roomId") roomId: String, + @Path("eventId") eventId: String, + @Query("limit") limit: Int, + @Query("filter") filter: String? = null + ): EventContextResponse /** * Retrieve an event from its room id / events id. @@ -142,8 +148,10 @@ internal interface RoomAPI { * @param eventId the event Id */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/event/{eventId}") - suspend fun getEvent(@Path("roomId") roomId: String, - @Path("eventId") eventId: String): Event + suspend fun getEvent( + @Path("roomId") roomId: String, + @Path("eventId") eventId: String + ): Event /** * Send read markers. @@ -152,17 +160,21 @@ internal interface RoomAPI { * @param markers the read markers */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/read_markers") - suspend fun sendReadMarker(@Path("roomId") roomId: String, - @Body markers: Map) + suspend fun sendReadMarker( + @Path("roomId") roomId: String, + @Body markers: Map + ) /** * Send receipt to a room. */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/receipt/{receiptType}/{eventId}") - suspend fun sendReceipt(@Path("roomId") roomId: String, - @Path("receiptType") receiptType: String, - @Path("eventId") eventId: String, - @Body body: JsonDict = emptyMap()) + suspend fun sendReceipt( + @Path("roomId") roomId: String, + @Path("receiptType") receiptType: String, + @Path("eventId") eventId: String, + @Body body: JsonDict = emptyMap() + ) /** * Invite a user to the given room. @@ -172,8 +184,10 @@ internal interface RoomAPI { * @param body a object that just contains a user id */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/invite") - suspend fun invite(@Path("roomId") roomId: String, - @Body body: InviteBody) + suspend fun invite( + @Path("roomId") roomId: String, + @Body body: InviteBody + ) /** * Invite a user to a room, using a ThreePid @@ -182,8 +196,10 @@ internal interface RoomAPI { * @param body the Json body */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/invite") - suspend fun invite3pid(@Path("roomId") roomId: String, - @Body body: ThreePidInviteBody) + suspend fun invite3pid( + @Path("roomId") roomId: String, + @Body body: ThreePidInviteBody + ) /** * Send a generic state event. @@ -193,9 +209,10 @@ internal interface RoomAPI { * @param params the request parameters */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/state/{state_event_type}") - suspend fun sendStateEvent(@Path("roomId") roomId: String, - @Path("state_event_type") stateEventType: String, - @Body params: JsonDict + suspend fun sendStateEvent( + @Path("roomId") roomId: String, + @Path("state_event_type") stateEventType: String, + @Body params: JsonDict ): SendResponse /** @@ -207,10 +224,11 @@ internal interface RoomAPI { * @param params the request parameters */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/state/{state_event_type}/{state_key}") - suspend fun sendStateEvent(@Path("roomId") roomId: String, - @Path("state_event_type") stateEventType: String, - @Path("state_key") stateKey: String, - @Body params: JsonDict + suspend fun sendStateEvent( + @Path("roomId") roomId: String, + @Path("state_event_type") stateEventType: String, + @Path("state_key") stateKey: String, + @Body params: JsonDict ): SendResponse /** @@ -231,13 +249,14 @@ internal interface RoomAPI { * @param limit max number of Event to retrieve */ @GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "rooms/{roomId}/relations/{eventId}/{relationType}/{eventType}") - suspend fun getRelations(@Path("roomId") roomId: String, - @Path("eventId") eventId: String, - @Path("relationType") relationType: String, - @Path("eventType") eventType: String, - @Query("from") from: String? = null, - @Query("to") to: String? = null, - @Query("limit") limit: Int? = null + suspend fun getRelations( + @Path("roomId") roomId: String, + @Path("eventId") eventId: String, + @Path("relationType") relationType: String, + @Path("eventType") eventType: String, + @Query("from") from: String? = null, + @Query("to") to: String? = null, + @Query("limit") limit: Int? = null ): RelationsResponse /** @@ -251,12 +270,13 @@ internal interface RoomAPI { * @param limit max number of Event to retrieve */ @GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "rooms/{roomId}/relations/{eventId}/{relationType}") - suspend fun getThreadsRelations(@Path("roomId") roomId: String, - @Path("eventId") eventId: String, - @Path("relationType") relationType: String = RelationType.THREAD, - @Query("from") from: String? = null, - @Query("to") to: String? = null, - @Query("limit") limit: Int? = null + suspend fun getThreadsRelations( + @Path("roomId") roomId: String, + @Path("eventId") eventId: String, + @Path("relationType") relationType: String = RelationType.THREAD, + @Query("from") from: String? = null, + @Query("to") to: String? = null, + @Query("limit") limit: Int? = null ): RelationsResponse /** @@ -267,9 +287,11 @@ internal interface RoomAPI { * @param params the request body */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "join/{roomIdOrAlias}") - suspend fun join(@Path("roomIdOrAlias") roomIdOrAlias: String, - @Query("server_name") viaServers: List, - @Body params: JsonDict): JoinRoomResponse + suspend fun join( + @Path("roomIdOrAlias") roomIdOrAlias: String, + @Query("server_name") viaServers: List, + @Body params: JsonDict + ): JoinRoomResponse /** * Leave the given room. @@ -278,8 +300,10 @@ internal interface RoomAPI { * @param params the request body */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/leave") - suspend fun leave(@Path("roomId") roomId: String, - @Body params: Map) + suspend fun leave( + @Path("roomId") roomId: String, + @Body params: Map + ) /** * Ban a user from the given room. @@ -288,8 +312,10 @@ internal interface RoomAPI { * @param userIdAndReason the banned user object (userId and reason for ban) */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/ban") - suspend fun ban(@Path("roomId") roomId: String, - @Body userIdAndReason: UserIdAndReason) + suspend fun ban( + @Path("roomId") roomId: String, + @Body userIdAndReason: UserIdAndReason + ) /** * unban a user from the given room. @@ -298,8 +324,10 @@ internal interface RoomAPI { * @param userIdAndReason the unbanned user object (userId and reason for unban) */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/unban") - suspend fun unban(@Path("roomId") roomId: String, - @Body userIdAndReason: UserIdAndReason) + suspend fun unban( + @Path("roomId") roomId: String, + @Body userIdAndReason: UserIdAndReason + ) /** * Kick a user from the given room. @@ -308,8 +336,10 @@ internal interface RoomAPI { * @param userIdAndReason the kicked user object (userId and reason for kicking) */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/kick") - suspend fun kick(@Path("roomId") roomId: String, - @Body userIdAndReason: UserIdAndReason) + suspend fun kick( + @Path("roomId") roomId: String, + @Body userIdAndReason: UserIdAndReason + ) /** * Strips all information out of an event which isn't critical to the integrity of the server-side representation of the room. @@ -337,9 +367,11 @@ internal interface RoomAPI { * @param body body containing score and reason */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/report/{eventId}") - suspend fun reportContent(@Path("roomId") roomId: String, - @Path("eventId") eventId: String, - @Body body: ReportContentBody) + suspend fun reportContent( + @Path("roomId") roomId: String, + @Path("eventId") eventId: String, + @Body body: ReportContentBody + ) /** * Get a list of aliases maintained by the local server for the given room. @@ -352,9 +384,11 @@ internal interface RoomAPI { * Inform that the user is starting to type or has stopped typing. */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/typing/{userId}") - suspend fun sendTypingState(@Path("roomId") roomId: String, - @Path("userId") userId: String, - @Body body: TypingBody) + suspend fun sendTypingState( + @Path("roomId") roomId: String, + @Path("userId") userId: String, + @Body body: TypingBody + ) /* * Room tagging @@ -364,27 +398,33 @@ internal interface RoomAPI { * Add a tag to a room. */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/rooms/{roomId}/tags/{tag}") - suspend fun putTag(@Path("userId") userId: String, - @Path("roomId") roomId: String, - @Path("tag") tag: String, - @Body body: TagBody) + suspend fun putTag( + @Path("userId") userId: String, + @Path("roomId") roomId: String, + @Path("tag") tag: String, + @Body body: TagBody + ) /** * Delete a tag from a room. */ @DELETE(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/rooms/{roomId}/tags/{tag}") - suspend fun deleteTag(@Path("userId") userId: String, - @Path("roomId") roomId: String, - @Path("tag") tag: String) + suspend fun deleteTag( + @Path("userId") userId: String, + @Path("roomId") roomId: String, + @Path("tag") tag: String + ) /** * Set an AccountData event to the room. */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/rooms/{roomId}/account_data/{type}") - suspend fun setRoomAccountData(@Path("userId") userId: String, - @Path("roomId") roomId: String, - @Path("type") type: String, - @Body content: JsonDict) + suspend fun setRoomAccountData( + @Path("userId") userId: String, + @Path("roomId") roomId: String, + @Path("type") type: String, + @Body content: JsonDict + ) /** * Upgrades the given room to a particular room version. @@ -394,8 +434,10 @@ internal interface RoomAPI { * 403: The user is not permitted to upgrade the room.(M_FORBIDDEN) */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/upgrade") - suspend fun upgradeRoom(@Path("roomId") roomId: String, - @Body body: RoomUpgradeBody): RoomUpgradeResponse + suspend fun upgradeRoom( + @Path("roomId") roomId: String, + @Body body: RoomUpgradeBody + ): RoomUpgradeResponse /** * The API returns the summary of the specified room, if the room could be found and the client should be able to view @@ -404,6 +446,8 @@ internal interface RoomAPI { * https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md */ @GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "im.nheko.summary/rooms/{roomIdOrAlias}/summary") - suspend fun getRoomSummary(@Path("roomIdOrAlias") roomidOrAlias: String, - @Query("via") viaServers: List?): RoomStrippedState + suspend fun getRoomSummary( + @Path("roomIdOrAlias") roomidOrAlias: String, + @Query("via") viaServers: List? + ): RoomStrippedState } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/DefaultRoomAccountDataService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/DefaultRoomAccountDataService.kt index caeeb3bf53..aea786b46b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/DefaultRoomAccountDataService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/DefaultRoomAccountDataService.kt @@ -25,9 +25,10 @@ import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataEvent import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataService import org.matrix.android.sdk.api.util.Optional -internal class DefaultRoomAccountDataService @AssistedInject constructor(@Assisted private val roomId: String, - private val dataSource: RoomAccountDataDataSource, - private val updateRoomAccountDataTask: UpdateRoomAccountDataTask +internal class DefaultRoomAccountDataService @AssistedInject constructor( + @Assisted private val roomId: String, + private val dataSource: RoomAccountDataDataSource, + private val updateRoomAccountDataTask: UpdateRoomAccountDataTask ) : RoomAccountDataService { @AssistedFactory diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/RoomAccountDataDataSource.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/RoomAccountDataDataSource.kt index d5a110dfc2..5196f004ea 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/RoomAccountDataDataSource.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/accountdata/RoomAccountDataDataSource.kt @@ -33,9 +33,11 @@ import org.matrix.android.sdk.internal.database.model.RoomEntityFields import org.matrix.android.sdk.internal.di.SessionDatabase import javax.inject.Inject -internal class RoomAccountDataDataSource @Inject constructor(@SessionDatabase private val monarchy: Monarchy, - private val realmSessionProvider: RealmSessionProvider, - private val accountDataMapper: AccountDataMapper) { +internal class RoomAccountDataDataSource @Inject constructor( + @SessionDatabase private val monarchy: Monarchy, + private val realmSessionProvider: RealmSessionProvider, + private val accountDataMapper: AccountDataMapper +) { fun getAccountDataEvent(roomId: String, type: String): RoomAccountDataEvent? { return getAccountDataEvents(roomId, setOf(type)).firstOrNull() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/poll/DefaultPollAggregationProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/poll/DefaultPollAggregationProcessor.kt index d4b414aaea..90d8e02c39 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/poll/DefaultPollAggregationProcessor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/poll/DefaultPollAggregationProcessor.kt @@ -193,8 +193,10 @@ class DefaultPollAggregationProcessor @Inject constructor() : PollAggregationPro ?: EventAnnotationsSummaryEntity.create(realm, roomId, eventId) } - private fun getAggregatedPollSummaryEntity(realm: Realm, - eventAnnotationsSummaryEntity: EventAnnotationsSummaryEntity): PollResponseAggregatedSummaryEntity { + private fun getAggregatedPollSummaryEntity( + realm: Realm, + eventAnnotationsSummaryEntity: EventAnnotationsSummaryEntity + ): PollResponseAggregatedSummaryEntity { return eventAnnotationsSummaryEntity.pollResponseSummary ?: realm.createObject(PollResponseAggregatedSummaryEntity::class.java).also { eventAnnotationsSummaryEntity.pollResponseSummary = it diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DefaultDraftService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DefaultDraftService.kt index 3867e0dc8d..1ea8addb20 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DefaultDraftService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DefaultDraftService.kt @@ -26,9 +26,10 @@ import org.matrix.android.sdk.api.session.room.send.DraftService import org.matrix.android.sdk.api.session.room.send.UserDraft import org.matrix.android.sdk.api.util.Optional -internal class DefaultDraftService @AssistedInject constructor(@Assisted private val roomId: String, - private val draftRepository: DraftRepository, - private val coroutineDispatchers: MatrixCoroutineDispatchers +internal class DefaultDraftService @AssistedInject constructor( + @Assisted private val roomId: String, + private val draftRepository: DraftRepository, + private val coroutineDispatchers: MatrixCoroutineDispatchers ) : DraftService { @AssistedFactory diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DraftRepository.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DraftRepository.kt index c8c52c4b23..b672ef7e46 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DraftRepository.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/draft/DraftRepository.kt @@ -35,8 +35,10 @@ import org.matrix.android.sdk.internal.util.awaitTransaction import timber.log.Timber import javax.inject.Inject -internal class DraftRepository @Inject constructor(@SessionDatabase private val monarchy: Monarchy, - private val realmSessionProvider: RealmSessionProvider) { +internal class DraftRepository @Inject constructor( + @SessionDatabase private val monarchy: Monarchy, + private val realmSessionProvider: RealmSessionProvider +) { suspend fun saveDraft(roomId: String, userDraft: UserDraft) { monarchy.awaitTransaction { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomDisplayNameResolver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomDisplayNameResolver.kt index 9e672dcc5c..23d7e0fc51 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomDisplayNameResolver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomDisplayNameResolver.kt @@ -158,8 +158,10 @@ internal class RoomDisplayNameResolver @Inject constructor( } /** See [org.matrix.android.sdk.api.session.room.sender.SenderInfo.disambiguatedDisplayName]. */ - private fun resolveRoomMemberName(roomMemberSummary: RoomMemberSummaryEntity, - roomMemberHelper: RoomMemberHelper): String { + private fun resolveRoomMemberName( + roomMemberSummary: RoomMemberSummaryEntity, + roomMemberHelper: RoomMemberHelper + ): String { val isUnique = roomMemberHelper.isUniqueDisplayName(roomMemberSummary.displayName) return if (isUnique) { displayNameResolver.getBestName(roomMemberSummary.toMatrixItem()) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberEventHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberEventHandler.kt index a1b30a0be5..1e36e9c6da 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberEventHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberEventHandler.kt @@ -34,11 +34,13 @@ internal class RoomMemberEventHandler @Inject constructor( @UserId private val myUserId: String ) { - fun handle(realm: Realm, - roomId: String, - event: Event, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator? = null): Boolean { + fun handle( + realm: Realm, + roomId: String, + event: Event, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator? = null + ): Boolean { if (event.type != EventType.STATE_ROOM_MEMBER) { return false } @@ -59,12 +61,14 @@ internal class RoomMemberEventHandler @Inject constructor( } } - private fun handleInitialSync(realm: Realm, - roomId: String, - currentUserId: String, - eventUserId: String, - roomMember: RoomMemberContent, - aggregator: SyncResponsePostTreatmentAggregator?): Boolean { + private fun handleInitialSync( + realm: Realm, + roomId: String, + currentUserId: String, + eventUserId: String, + roomMember: RoomMemberContent, + aggregator: SyncResponsePostTreatmentAggregator? + ): Boolean { if (currentUserId != eventUserId) { saveUserEntityLocallyIfNecessary(realm, eventUserId, roomMember) } @@ -73,10 +77,12 @@ internal class RoomMemberEventHandler @Inject constructor( return true } - private fun saveRoomMemberEntityLocally(realm: Realm, - roomId: String, - userId: String, - roomMember: RoomMemberContent) { + private fun saveRoomMemberEntityLocally( + realm: Realm, + roomId: String, + userId: String, + roomMember: RoomMemberContent + ) { val roomMemberEntity = RoomMemberEntityFactory.create( roomId, userId, @@ -96,9 +102,11 @@ internal class RoomMemberEventHandler @Inject constructor( return RoomMemberSummaryEntity.where(realm, roomId, userId).findFirst()?.userPresenceEntity } - private fun saveUserEntityLocallyIfNecessary(realm: Realm, - userId: String, - roomMember: RoomMemberContent) { + private fun saveUserEntityLocallyIfNecessary( + realm: Realm, + userId: String, + roomMember: RoomMemberContent + ) { if (roomMember.membership.isActive()) { saveUserLocally(realm, userId, roomMember) } @@ -109,9 +117,11 @@ internal class RoomMemberEventHandler @Inject constructor( realm.insertOrUpdate(userEntity) } - private fun updateDirectChatsIfNecessary(roomId: String, - roomMember: RoomMemberContent, - aggregator: SyncResponsePostTreatmentAggregator?) { + private fun updateDirectChatsIfNecessary( + roomId: String, + roomMember: RoomMemberContent, + aggregator: SyncResponsePostTreatmentAggregator? + ) { // check whether this new room member event may be used to update the directs dictionary in account data // this is required to handle correctly invite by email in DM val mxId = roomMember.thirdPartyInvite?.signed?.mxid @@ -120,12 +130,14 @@ internal class RoomMemberEventHandler @Inject constructor( } } - private fun handleIncrementalSync(realm: Realm, - roomId: String, - eventUserId: String, - roomMember: RoomMemberContent, - prevContent: Content?, - aggregator: SyncResponsePostTreatmentAggregator?): Boolean { + private fun handleIncrementalSync( + realm: Realm, + roomId: String, + eventUserId: String, + roomMember: RoomMemberContent, + prevContent: Content?, + aggregator: SyncResponsePostTreatmentAggregator? + ): Boolean { if (aggregator != null) { val previousDisplayName = prevContent?.get("displayname") as? String val previousAvatar = prevContent?.get("avatar_url") as? String diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberHelper.kt index 40228fe8c9..7da12a75de 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/RoomMemberHelper.kt @@ -33,8 +33,9 @@ import org.matrix.android.sdk.internal.database.query.where * It allows to get the live membership of a user. */ -internal class RoomMemberHelper(private val realm: Realm, - private val roomId: String +internal class RoomMemberHelper( + private val realm: Realm, + private val roomId: String ) { private val roomSummary: RoomSummaryEntity? by lazy { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/DefaultRoomPushRuleService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/DefaultRoomPushRuleService.kt index 85f53e1346..d46100a3a8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/DefaultRoomPushRuleService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/DefaultRoomPushRuleService.kt @@ -29,9 +29,11 @@ import org.matrix.android.sdk.internal.database.model.PushRuleEntity import org.matrix.android.sdk.internal.database.query.where import org.matrix.android.sdk.internal.di.SessionDatabase -internal class DefaultRoomPushRuleService @AssistedInject constructor(@Assisted private val roomId: String, - private val setRoomNotificationStateTask: SetRoomNotificationStateTask, - @SessionDatabase private val monarchy: Monarchy) : +internal class DefaultRoomPushRuleService @AssistedInject constructor( + @Assisted private val roomId: String, + private val setRoomNotificationStateTask: SetRoomNotificationStateTask, + @SessionDatabase private val monarchy: Monarchy +) : RoomPushRuleService { @AssistedFactory diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/SetRoomNotificationStateTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/SetRoomNotificationStateTask.kt index 021d7dbefb..3d51d19cba 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/SetRoomNotificationStateTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/notification/SetRoomNotificationStateTask.kt @@ -35,9 +35,11 @@ internal interface SetRoomNotificationStateTask : Task): Cancelable { + override fun editPoll( + targetEvent: TimelineEvent, + pollType: PollType, + question: String, + options: List + ): Cancelable { return eventEditor.editPoll(targetEvent, pollType, question, options) } - override fun editTextMessage(targetEvent: TimelineEvent, - msgType: String, - newBodyText: CharSequence, - newBodyAutoMarkdown: Boolean, - compatibilityBodyText: String): Cancelable { + override fun editTextMessage( + targetEvent: TimelineEvent, + msgType: String, + newBodyText: CharSequence, + newBodyAutoMarkdown: Boolean, + compatibilityBodyText: String + ): Cancelable { return eventEditor.editTextMessage(targetEvent, msgType, newBodyText, newBodyAutoMarkdown, compatibilityBodyText) } - override fun editReply(replyToEdit: TimelineEvent, - originalTimelineEvent: TimelineEvent, - newBodyText: String, - compatibilityBodyText: String): Cancelable { + override fun editReply( + replyToEdit: TimelineEvent, + originalTimelineEvent: TimelineEvent, + newBodyText: String, + compatibilityBodyText: String + ): Cancelable { return eventEditor.editReply(replyToEdit, originalTimelineEvent, newBodyText, compatibilityBodyText) } @@ -164,7 +170,8 @@ internal class DefaultRelationService @AssistedInject constructor( msgType: String, autoMarkdown: Boolean, formattedText: String?, - eventReplied: TimelineEvent?): Cancelable? { + eventReplied: TimelineEvent? + ): Cancelable? { val event = if (eventReplied != null) { // Reply within a thread eventFactory.createReplyTextEvent( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/EventEditor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/EventEditor.kt index 7bf7d6b587..795e9003ce 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/EventEditor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/EventEditor.kt @@ -38,11 +38,13 @@ internal class EventEditor @Inject constructor( private val clock: Clock, ) { - fun editTextMessage(targetEvent: TimelineEvent, - msgType: String, - newBodyText: CharSequence, - newBodyAutoMarkdown: Boolean, - compatibilityBodyText: String): Cancelable { + fun editTextMessage( + targetEvent: TimelineEvent, + msgType: String, + newBodyText: CharSequence, + newBodyAutoMarkdown: Boolean, + compatibilityBodyText: String + ): Cancelable { val roomId = targetEvent.roomId if (targetEvent.root.sendState.hasFailed()) { // We create a new in memory event for the EventSenderProcessor but we keep the eventId of the failed event. @@ -61,10 +63,12 @@ internal class EventEditor @Inject constructor( } } - fun editPoll(targetEvent: TimelineEvent, - pollType: PollType, - question: String, - options: List): Cancelable { + fun editPoll( + targetEvent: TimelineEvent, + pollType: PollType, + question: String, + options: List + ): Cancelable { val roomId = targetEvent.roomId if (targetEvent.root.sendState.hasFailed()) { val editedEvent = eventFactory.createPollEvent(roomId, pollType, question, options).copy( @@ -92,10 +96,12 @@ internal class EventEditor @Inject constructor( return eventSenderProcessor.postEvent(editedEvent) } - fun editReply(replyToEdit: TimelineEvent, - originalTimelineEvent: TimelineEvent, - newBodyText: String, - compatibilityBodyText: String): Cancelable { + fun editReply( + replyToEdit: TimelineEvent, + originalTimelineEvent: TimelineEvent, + newBodyText: String, + compatibilityBodyText: String + ): Cancelable { val roomId = replyToEdit.roomId if (replyToEdit.root.sendState.hasFailed()) { // We create a new in memory event for the EventSenderProcessor but we keep the eventId of the failed event. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/FindReactionEventForUndoTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/FindReactionEventForUndoTask.kt index f7cfa3489d..585f896f32 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/FindReactionEventForUndoTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/FindReactionEventForUndoTask.kt @@ -41,7 +41,8 @@ internal interface FindReactionEventForUndoTask : Task diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/UpdateQuickReactionTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/UpdateQuickReactionTask.kt index d0ab430dad..24e8ba7f9e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/UpdateQuickReactionTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/UpdateQuickReactionTask.kt @@ -41,8 +41,10 @@ internal interface UpdateQuickReactionTask : Task?>? = null diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadSummariesTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadSummariesTask.kt index c5f9bd13fd..254dee4295 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadSummariesTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadSummariesTask.kt @@ -77,8 +77,10 @@ internal class DefaultFetchThreadSummariesTask @Inject constructor( return handleResponse(response, params) } - private suspend fun handleResponse(response: PaginationResponse, - params: FetchThreadSummariesTask.Params): Result { + private suspend fun handleResponse( + response: PaginationResponse, + params: FetchThreadSummariesTask.Params + ): Result { val rootThreadList = response.events monarchy.awaitTransaction { realm -> val roomEntity = RoomEntity.where(realm, roomId = params.roomId).findFirst() ?: return@awaitTransaction diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadTimelineTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadTimelineTask.kt index dabdd04f60..bad734173e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadTimelineTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/threads/FetchThreadTimelineTask.kt @@ -109,8 +109,10 @@ internal class DefaultFetchThreadTimelineTask @Inject constructor( return handleRelationsResponse(response, params) } - private suspend fun handleRelationsResponse(response: RelationsResponse, - params: FetchThreadTimelineTask.Params): Result { + private suspend fun handleRelationsResponse( + response: RelationsResponse, + params: FetchThreadTimelineTask.Params + ): Result { val threadList = response.chunks val threadRootEvent = response.originalEvent val hasReachEnd = response.nextBatch == null @@ -232,9 +234,11 @@ internal class DefaultFetchThreadTimelineTask @Inject constructor( } } - private fun handleReaction(realm: Realm, - event: Event, - roomId: String) { + private fun handleReaction( + realm: Realm, + event: Event, + roomId: String + ) { val unsignedData = event.unsignedData ?: return val relatedEventId = event.eventId ?: return diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/reporting/DefaultReportingService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/reporting/DefaultReportingService.kt index c961f718ef..1e32bf5e16 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/reporting/DefaultReportingService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/reporting/DefaultReportingService.kt @@ -21,8 +21,9 @@ import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import org.matrix.android.sdk.api.session.room.reporting.ReportingService -internal class DefaultReportingService @AssistedInject constructor(@Assisted private val roomId: String, - private val reportContentTask: ReportContentTask +internal class DefaultReportingService @AssistedInject constructor( + @Assisted private val roomId: String, + private val reportContentTask: ReportContentTask ) : ReportingService { @AssistedFactory diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/DefaultSendService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/DefaultSendService.kt index 8529365858..ffca0204a8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/DefaultSendService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/DefaultSendService.kt @@ -265,10 +265,11 @@ internal class DefaultSendService @AssistedInject constructor( } } - override fun sendMedias(attachments: List, - compressBeforeSending: Boolean, - roomIds: Set, - rootThreadEventId: String? + override fun sendMedias( + attachments: List, + compressBeforeSending: Boolean, + roomIds: Set, + rootThreadEventId: String? ): Cancelable { return attachments.mapTo(CancelableBag()) { sendMedia( @@ -280,10 +281,11 @@ internal class DefaultSendService @AssistedInject constructor( } } - override fun sendMedia(attachment: ContentAttachmentData, - compressBeforeSending: Boolean, - roomIds: Set, - rootThreadEventId: String? + override fun sendMedia( + attachment: ContentAttachmentData, + compressBeforeSending: Boolean, + roomIds: Set, + rootThreadEventId: String? ): Cancelable { // Ensure that the event will not be send in a thread if we are a different flow. // Like sending files to multiple rooms @@ -354,10 +356,12 @@ internal class DefaultSendService @AssistedInject constructor( return "${roomId}_$identifier" } - private fun createUploadMediaWork(allLocalEchos: List, - attachment: ContentAttachmentData, - isRoomEncrypted: Boolean, - compressBeforeSending: Boolean): OneTimeWorkRequest { + private fun createUploadMediaWork( + allLocalEchos: List, + attachment: ContentAttachmentData, + isRoomEncrypted: Boolean, + compressBeforeSending: Boolean + ): OneTimeWorkRequest { val localEchoIds = allLocalEchos.map { LocalEchoIdentifiers(it.roomId!!, it.eventId!!) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt index d39088bd6d..2bb6f3e04f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt @@ -119,12 +119,14 @@ internal class LocalEchoEventFactory @Inject constructor( return createMessageEvent(roomId, textContent.toMessageTextContent(msgType)) } - fun createReplaceTextEvent(roomId: String, - targetEventId: String, - newBodyText: CharSequence, - newBodyAutoMarkdown: Boolean, - msgType: String, - compatibilityText: String): Event { + fun createReplaceTextEvent( + roomId: String, + targetEventId: String, + newBodyText: CharSequence, + newBodyAutoMarkdown: Boolean, + msgType: String, + compatibilityText: String + ): Event { return createMessageEvent( roomId, MessageTextContent( @@ -138,9 +140,11 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - private fun createPollContent(question: String, - options: List, - pollType: PollType): MessagePollContent { + private fun createPollContent( + question: String, + options: List, + pollType: PollType + ): MessagePollContent { return MessagePollContent( unstablePollCreationInfo = PollCreationInfo( question = PollQuestion(unstableQuestion = question), @@ -152,11 +156,13 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createPollReplaceEvent(roomId: String, - pollType: PollType, - targetEventId: String, - question: String, - options: List): Event { + fun createPollReplaceEvent( + roomId: String, + pollType: PollType, + targetEventId: String, + question: String, + options: List + ): Event { val newContent = MessagePollContent( relatesTo = RelationDefaultContent(RelationType.REPLACE, targetEventId), newContent = createPollContent(question, options, pollType).toContent() @@ -172,9 +178,11 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createPollReplyEvent(roomId: String, - pollEventId: String, - answerId: String): Event { + fun createPollReplyEvent( + roomId: String, + pollEventId: String, + answerId: String + ): Event { val content = MessagePollResponseContent( body = answerId, relatesTo = RelationDefaultContent( @@ -195,10 +203,12 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createPollEvent(roomId: String, - pollType: PollType, - question: String, - options: List): Event { + fun createPollEvent( + roomId: String, + pollType: PollType, + question: String, + options: List + ): Event { val content = createPollContent(question, options, pollType) val localId = LocalEcho.createLocalEchoId() return Event( @@ -212,8 +222,10 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createEndPollEvent(roomId: String, - eventId: String): Event { + fun createEndPollEvent( + roomId: String, + eventId: String + ): Event { val content = MessageEndPollContent( relatesTo = RelationDefaultContent( type = RelationType.REFERENCE, @@ -232,11 +244,13 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createLocationEvent(roomId: String, - latitude: Double, - longitude: Double, - uncertainty: Double?, - isUserLocation: Boolean): Event { + fun createLocationEvent( + roomId: String, + latitude: Double, + longitude: Double, + uncertainty: Double?, + isUserLocation: Boolean + ): Event { val geoUri = buildGeoUri(latitude, longitude, uncertainty) val assetType = if (isUserLocation) LocationAssetType.SELF else LocationAssetType.PIN val content = MessageLocationContent( @@ -250,11 +264,13 @@ internal class LocalEchoEventFactory @Inject constructor( return createMessageEvent(roomId, content) } - fun createLiveLocationEvent(beaconInfoEventId: String, - roomId: String, - latitude: Double, - longitude: Double, - uncertainty: Double?): Event { + fun createLiveLocationEvent( + beaconInfoEventId: String, + roomId: String, + latitude: Double, + longitude: Double, + uncertainty: Double? + ): Event { val geoUri = buildGeoUri(latitude, longitude, uncertainty) val content = MessageBeaconLocationDataContent( body = geoUri, @@ -277,13 +293,15 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createReplaceTextOfReply(roomId: String, - eventReplaced: TimelineEvent, - originalEvent: TimelineEvent, - newBodyText: String, - autoMarkdown: Boolean, - msgType: String, - compatibilityText: String): Event { + fun createReplaceTextOfReply( + roomId: String, + eventReplaced: TimelineEvent, + originalEvent: TimelineEvent, + newBodyText: String, + autoMarkdown: Boolean, + msgType: String, + compatibilityText: String + ): Event { val permalink = permalinkFactory.createPermalink(roomId, originalEvent.root.eventId ?: "", false) val userLink = originalEvent.root.senderId?.let { permalinkFactory.createPermalink(it, false) } ?: "" @@ -321,9 +339,10 @@ internal class LocalEchoEventFactory @Inject constructor( ) } - fun createMediaEvent(roomId: String, - attachment: ContentAttachmentData, - rootThreadEventId: String? + fun createMediaEvent( + roomId: String, + attachment: ContentAttachmentData, + rootThreadEventId: String? ): Event { return when (attachment.type) { ContentAttachmentData.Type.IMAGE -> createImageEvent(roomId, attachment, rootThreadEventId) @@ -435,10 +454,11 @@ internal class LocalEchoEventFactory @Inject constructor( return createMessageEvent(roomId, content) } - private fun createAudioEvent(roomId: String, - attachment: ContentAttachmentData, - isVoiceMessage: Boolean, - rootThreadEventId: String? + private fun createAudioEvent( + roomId: String, + attachment: ContentAttachmentData, + isVoiceMessage: Boolean, + rootThreadEventId: String? ): Event { val content = MessageAudioContent( msgType = MessageType.MSGTYPE_AUDIO, @@ -534,7 +554,8 @@ internal class LocalEchoEventFactory @Inject constructor( text: CharSequence, msgType: String, autoMarkdown: Boolean, - formattedText: String?): Event { + formattedText: String? + ): Event { val content = formattedText?.let { TextContent(text.toString(), it) } ?: createTextContent(text, autoMarkdown) return createEvent( roomId, @@ -555,12 +576,14 @@ internal class LocalEchoEventFactory @Inject constructor( /** * Creates a reply to a regular timeline Event or a thread Event if needed. */ - fun createReplyTextEvent(roomId: String, - eventReplied: TimelineEvent, - replyText: CharSequence, - autoMarkdown: Boolean, - rootThreadEventId: String? = null, - showInThread: Boolean): Event? { + fun createReplyTextEvent( + roomId: String, + eventReplied: TimelineEvent, + replyText: CharSequence, + autoMarkdown: Boolean, + rootThreadEventId: String? = null, + showInThread: Boolean + ): Event? { // Fallbacks and event representation // TODO Add error/warning logs when any of this is null val permalink = permalinkFactory.createPermalink(eventReplied.root, false) ?: return null diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/TextContentExtension.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/TextContentExtension.kt index 49bc05f40c..c5728ba527 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/TextContentExtension.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/TextContentExtension.kt @@ -43,7 +43,8 @@ internal fun TextContent.toMessageTextContent(msgType: String = MessageType.MSGT internal fun TextContent.toThreadTextContent( rootThreadEventId: String, latestThreadEventId: String, - msgType: String = MessageType.MSGTYPE_TEXT): MessageTextContent { + msgType: String = MessageType.MSGTYPE_TEXT +): MessageTextContent { return MessageTextContent( msgType = msgType, format = MessageFormat.FORMAT_MATRIX_HTML.takeIf { formattedText != null }, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/queue/QueueMemento.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/queue/QueueMemento.kt index 545fc41737..a00c33f780 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/queue/QueueMemento.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/queue/QueueMemento.kt @@ -35,11 +35,13 @@ import javax.inject.Inject private const val PERSISTENCE_KEY = "ManagedBySender" -internal class QueueMemento @Inject constructor(context: Context, - @SessionId sessionId: String, - private val queuedTaskFactory: QueuedTaskFactory, - private val localEchoRepository: LocalEchoRepository, - private val cryptoService: CryptoService) { +internal class QueueMemento @Inject constructor( + context: Context, + @SessionId sessionId: String, + private val queuedTaskFactory: QueuedTaskFactory, + private val localEchoRepository: LocalEchoRepository, + private val cryptoService: CryptoService +) { private val storage = context.getSharedPreferences("QueueMemento_$sessionId", Context.MODE_PRIVATE) private val trackedTasks = mutableListOf() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt index 60231892e1..8b9300029b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt @@ -41,11 +41,12 @@ import org.matrix.android.sdk.api.util.Optional import org.matrix.android.sdk.internal.session.content.FileUploader import org.matrix.android.sdk.internal.session.permalinks.ViaParameterFinder -internal class DefaultStateService @AssistedInject constructor(@Assisted private val roomId: String, - private val stateEventDataSource: StateEventDataSource, - private val sendStateTask: SendStateTask, - private val fileUploader: FileUploader, - private val viaParameterFinder: ViaParameterFinder +internal class DefaultStateService @AssistedInject constructor( + @Assisted private val roomId: String, + private val stateEventDataSource: StateEventDataSource, + private val sendStateTask: SendStateTask, + private val fileUploader: FileUploader, + private val viaParameterFinder: ViaParameterFinder ) : StateService { @AssistedFactory diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/StateEventDataSource.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/StateEventDataSource.kt index 42d6677409..18c709adf2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/StateEventDataSource.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/StateEventDataSource.kt @@ -76,10 +76,11 @@ internal class StateEventDataSource @Inject constructor( } } - private fun buildStateEventQuery(realm: Realm, - roomId: String, - eventTypes: Set, - stateKey: QueryStringValue + private fun buildStateEventQuery( + realm: Realm, + roomId: String, + eventTypes: Set, + stateKey: QueryStringValue ): RealmQuery { return with(queryStringValueProcessor) { realm.where() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/HierarchyLiveDataHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/HierarchyLiveDataHelper.kt index 29db8431fd..b141dfffa7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/HierarchyLiveDataHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/HierarchyLiveDataHelper.kt @@ -24,7 +24,8 @@ import org.matrix.android.sdk.api.util.Optional internal class HierarchyLiveDataHelper( val spaceId: String, val memberships: List, - val roomSummaryDataSource: RoomSummaryDataSource) { + val roomSummaryDataSource: RoomSummaryDataSource +) { private val sources = HashMap>>() private val mediatorLiveData = MediatorLiveData>() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryDataSource.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryDataSource.kt index 96e8d3c73f..a6e7d310c3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryDataSource.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryDataSource.kt @@ -84,16 +84,20 @@ internal class RoomSummaryDataSource @Inject constructor( } } - fun getRoomSummaries(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): List { + fun getRoomSummaries( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): List { return monarchy.fetchAllMappedSync( { roomSummariesQuery(it, queryParams).process(sortOrder) }, { roomSummaryMapper.map(it) } ) } - fun getRoomSummariesLive(queryParams: RoomSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): LiveData> { + fun getRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): LiveData> { return monarchy.findAllMappedWithChanges( { roomSummariesQuery(it, queryParams).process(sortOrder) @@ -102,8 +106,10 @@ internal class RoomSummaryDataSource @Inject constructor( ) } - fun getSpaceSummariesLive(queryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): LiveData> { + fun getSpaceSummariesLive( + queryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): LiveData> { return getRoomSummariesLive(queryParams, sortOrder) } @@ -128,8 +134,10 @@ internal class RoomSummaryDataSource @Inject constructor( } } - fun getSpaceSummaries(spaceSummaryQueryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder = RoomSortOrder.NONE): List { + fun getSpaceSummaries( + spaceSummaryQueryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder = RoomSortOrder.NONE + ): List { return getRoomSummaries(spaceSummaryQueryParams, sortOrder) } @@ -170,9 +178,11 @@ internal class RoomSummaryDataSource @Inject constructor( .sort(RoomSummaryEntityFields.BREADCRUMBS_INDEX) } - fun getSortedPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config, - sortOrder: RoomSortOrder): LiveData> { + fun getSortedPagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config, + sortOrder: RoomSortOrder + ): LiveData> { val realmDataSourceFactory = monarchy.createDataSourceFactory { realm -> roomSummariesQuery(realm, queryParams).process(sortOrder) } @@ -185,9 +195,11 @@ internal class RoomSummaryDataSource @Inject constructor( ) } - fun getUpdatablePagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, - pagedListConfig: PagedList.Config, - sortOrder: RoomSortOrder): UpdatableLivePageResult { + fun getUpdatablePagedRoomSummariesLive( + queryParams: RoomSummaryQueryParams, + pagedListConfig: PagedList.Config, + sortOrder: RoomSortOrder + ): UpdatableLivePageResult { val realmDataSourceFactory = monarchy.createDataSourceFactory { realm -> roomSummariesQuery(realm, queryParams).process(sortOrder) } @@ -427,11 +439,13 @@ internal class RoomSummaryDataSource @Inject constructor( } } - fun flattenSubSpace(current: RoomSummary, - parenting: List, - output: MutableList, - memberShips: List, - includeCurrent: Boolean = true) { + fun flattenSubSpace( + current: RoomSummary, + parenting: List, + output: MutableList, + memberShips: List, + includeCurrent: Boolean = true + ) { if (includeCurrent) { output.add(current) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt index 611d6dc65e..e4afe7aa49 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt @@ -85,13 +85,15 @@ internal class RoomSummaryUpdater @Inject constructor( } } - fun update(realm: Realm, - roomId: String, - membership: Membership? = null, - roomSummary: RoomSyncSummary? = null, - unreadNotifications: RoomSyncUnreadNotifications? = null, - updateMembers: Boolean = false, - inviterId: String? = null) { + fun update( + realm: Realm, + roomId: String, + membership: Membership? = null, + roomSummary: RoomSyncSummary? = null, + unreadNotifications: RoomSyncUnreadNotifications? = null, + updateMembers: Boolean = false, + inviterId: String? = null + ) { val roomSummaryEntity = RoomSummaryEntity.getOrCreate(realm, roomId) if (roomSummary != null) { if (roomSummary.heroes.isNotEmpty()) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LiveTimelineEvent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LiveTimelineEvent.kt index e765e05578..4be97efd6c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LiveTimelineEvent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/LiveTimelineEvent.kt @@ -36,11 +36,13 @@ import org.matrix.android.sdk.internal.database.query.where /** * This class takes care of handling case where local echo is replaced by the synced event in the db. */ -internal class LiveTimelineEvent(private val monarchy: Monarchy, - private val coroutineScope: CoroutineScope, - private val timelineEventMapper: TimelineEventMapper, - private val roomId: String, - private val eventId: String) : +internal class LiveTimelineEvent( + private val monarchy: Monarchy, + private val coroutineScope: CoroutineScope, + private val timelineEventMapper: TimelineEventMapper, + private val roomId: String, + private val eventId: String +) : MediatorLiveData>() { init { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDataSource.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDataSource.kt index 8b58d3ca5c..b9aca7d37b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDataSource.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineEventDataSource.kt @@ -33,10 +33,12 @@ import org.matrix.android.sdk.internal.di.SessionDatabase import org.matrix.android.sdk.internal.task.TaskExecutor import javax.inject.Inject -internal class TimelineEventDataSource @Inject constructor(private val realmSessionProvider: RealmSessionProvider, - private val timelineEventMapper: TimelineEventMapper, - private val taskExecutor: TaskExecutor, - @SessionDatabase private val monarchy: Monarchy) { +internal class TimelineEventDataSource @Inject constructor( + private val realmSessionProvider: RealmSessionProvider, + private val timelineEventMapper: TimelineEventMapper, + private val taskExecutor: TaskExecutor, + @SessionDatabase private val monarchy: Monarchy +) { fun getTimelineEvent(roomId: String, eventId: String): TimelineEvent? { return realmSessionProvider.withRealm { realm -> diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt index 96ceb6c6dc..3c68191521 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TokenChunkEventPersistor.kt @@ -65,9 +65,11 @@ internal class TokenChunkEventPersistor @Inject constructor( SUCCESS } - suspend fun insertInDb(receivedChunk: TokenChunkEvent, - roomId: String, - direction: PaginationDirection): Result { + suspend fun insertInDb( + receivedChunk: TokenChunkEvent, + roomId: String, + direction: PaginationDirection + ): Result { monarchy .awaitTransaction { realm -> Timber.v("Start persisting ${receivedChunk.events.size} events in $roomId towards $direction") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/DefaultSearchService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/DefaultSearchService.kt index 12ca36fa6b..5e33631f2c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/DefaultSearchService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/DefaultSearchService.kt @@ -24,14 +24,16 @@ internal class DefaultSearchService @Inject constructor( private val searchTask: SearchTask ) : SearchService { - override suspend fun search(searchTerm: String, - roomId: String, - nextBatch: String?, - orderByRecent: Boolean, - limit: Int, - beforeLimit: Int, - afterLimit: Int, - includeProfile: Boolean): SearchResult { + override suspend fun search( + searchTerm: String, + roomId: String, + nextBatch: String?, + orderByRecent: Boolean, + limit: Int, + beforeLimit: Int, + afterLimit: Int, + includeProfile: Boolean + ): SearchResult { return searchTask.execute( SearchTask.Params( searchTerm = searchTerm, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchAPI.kt index b5099e7238..4cd96c408a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchAPI.kt @@ -30,6 +30,8 @@ internal interface SearchAPI { * Ref: https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-search */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "search") - suspend fun search(@Query("next_batch") nextBatch: String?, - @Body body: SearchRequestBody): SearchResponse + suspend fun search( + @Query("next_batch") nextBatch: String?, + @Body body: SearchRequestBody + ): SearchResponse } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/signout/DefaultSignOutService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/signout/DefaultSignOutService.kt index e7b20f905b..1bb86ecb4b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/signout/DefaultSignOutService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/signout/DefaultSignOutService.kt @@ -21,9 +21,10 @@ import org.matrix.android.sdk.api.session.signout.SignOutService import org.matrix.android.sdk.internal.auth.SessionParamsStore import javax.inject.Inject -internal class DefaultSignOutService @Inject constructor(private val signOutTask: SignOutTask, - private val signInAgainTask: SignInAgainTask, - private val sessionParamsStore: SessionParamsStore +internal class DefaultSignOutService @Inject constructor( + private val signOutTask: SignOutTask, + private val signInAgainTask: SignInAgainTask, + private val sessionParamsStore: SessionParamsStore ) : SignOutService { override suspend fun signInAgain(password: String) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpace.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpace.kt index 178a29a5a0..32faffa670 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpace.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpace.kt @@ -44,11 +44,13 @@ internal class DefaultSpace( return spaceSummaryDataSource.getSpaceSummary(room.roomId) } - override suspend fun addChildren(roomId: String, - viaServers: List?, - order: String?, + override suspend fun addChildren( + roomId: String, + viaServers: List?, + order: String?, // autoJoin: Boolean, - suggested: Boolean?) { + suggested: Boolean? + ) { // Find best via val bestVia = viaServers ?: (spaceSummaryDataSource.getRoomSummary(roomId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt index 9320665688..c08d9389a8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt @@ -99,13 +99,17 @@ internal class DefaultSpaceService @Inject constructor( return spaceGetter.get(spaceId) } - override fun getSpaceSummariesLive(queryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder): LiveData> { + override fun getSpaceSummariesLive( + queryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder + ): LiveData> { return roomSummaryDataSource.getSpaceSummariesLive(queryParams, sortOrder) } - override fun getSpaceSummaries(spaceSummaryQueryParams: SpaceSummaryQueryParams, - sortOrder: RoomSortOrder): List { + override fun getSpaceSummaries( + spaceSummaryQueryParams: SpaceSummaryQueryParams, + sortOrder: RoomSortOrder + ): List { return roomSummaryDataSource.getSpaceSummaries(spaceSummaryQueryParams, sortOrder) } @@ -221,9 +225,11 @@ internal class DefaultSpaceService @Inject constructor( worldReadable = summary.isWorldReadable ) - override suspend fun joinSpace(spaceIdOrAlias: String, - reason: String?, - viaServers: List): JoinSpaceResult { + override suspend fun joinSpace( + spaceIdOrAlias: String, + reason: String?, + viaServers: List + ): JoinSpaceResult { return joinSpaceTask.execute(JoinSpaceTask.Params(spaceIdOrAlias, reason, viaServers)) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt index 33c3c3929f..126245d015 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt @@ -38,7 +38,8 @@ internal interface SpaceApi { @Query("suggested_only") suggestedOnly: Boolean?, @Query("limit") limit: Int?, @Query("max_depth") maxDepth: Int?, - @Query("from") from: String?): SpacesResponse + @Query("from") from: String? + ): SpacesResponse /** * Unstable version of [getSpaceHierarchy]. @@ -49,5 +50,6 @@ internal interface SpaceApi { @Query("suggested_only") suggestedOnly: Boolean?, @Query("limit") limit: Int?, @Query("max_depth") maxDepth: Int?, - @Query("from") from: String?): SpacesResponse + @Query("from") from: String? + ): SpacesResponse } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncAPI.kt index 6c8a71f35e..2a2fd6ab1d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncAPI.kt @@ -31,10 +31,11 @@ internal interface SyncAPI { * Set all the timeouts to 1 minute by default. */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "sync") - suspend fun sync(@QueryMap params: Map, - @Header(TimeOutInterceptor.CONNECT_TIMEOUT) connectTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, - @Header(TimeOutInterceptor.READ_TIMEOUT) readTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, - @Header(TimeOutInterceptor.WRITE_TIMEOUT) writeTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT + suspend fun sync( + @QueryMap params: Map, + @Header(TimeOutInterceptor.CONNECT_TIMEOUT) connectTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, + @Header(TimeOutInterceptor.READ_TIMEOUT) readTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, + @Header(TimeOutInterceptor.WRITE_TIMEOUT) writeTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT ): SyncResponse /** @@ -42,9 +43,10 @@ internal interface SyncAPI { */ @Streaming @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "sync") - fun syncStream(@QueryMap params: Map, - @Header(TimeOutInterceptor.CONNECT_TIMEOUT) connectTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, - @Header(TimeOutInterceptor.READ_TIMEOUT) readTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, - @Header(TimeOutInterceptor.WRITE_TIMEOUT) writeTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT + fun syncStream( + @QueryMap params: Map, + @Header(TimeOutInterceptor.CONNECT_TIMEOUT) connectTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, + @Header(TimeOutInterceptor.READ_TIMEOUT) readTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT, + @Header(TimeOutInterceptor.WRITE_TIMEOUT) writeTimeOut: Long = TimeOutInterceptor.DEFAULT_LONG_TIMEOUT ): Call } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncResponseHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncResponseHandler.kt index 02a7a9a37f..9bdcc4e5d4 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncResponseHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncResponseHandler.kt @@ -68,9 +68,11 @@ internal class SyncResponseHandler @Inject constructor( private val presenceSyncHandler: PresenceSyncHandler ) { - suspend fun handleResponse(syncResponse: SyncResponse, - fromToken: String?, - reporter: ProgressReporter?) { + suspend fun handleResponse( + syncResponse: SyncResponse, + fromToken: String?, + reporter: ProgressReporter? + ) { val isInitialSync = fromToken == null Timber.v("Start handling sync, is InitialSync: $isInitialSync") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/CryptoSyncHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/CryptoSyncHandler.kt index e5a5a0bbad..4ae3a10b5c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/CryptoSyncHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/CryptoSyncHandler.kt @@ -35,8 +35,10 @@ import javax.inject.Inject private val loggerTag = LoggerTag("CryptoSyncHandler", LoggerTag.CRYPTO) -internal class CryptoSyncHandler @Inject constructor(private val cryptoService: DefaultCryptoService, - private val verificationService: DefaultVerificationService) { +internal class CryptoSyncHandler @Inject constructor( + private val cryptoService: DefaultCryptoService, + private val verificationService: DefaultVerificationService +) { suspend fun handleToDevice(toDevice: ToDeviceSyncResponse, progressReporter: ProgressReporter? = null) { val total = toDevice.events?.size ?: 0 diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/GroupSyncHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/GroupSyncHandler.kt index 552462e25e..49b28348f4 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/GroupSyncHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/GroupSyncHandler.kt @@ -37,9 +37,11 @@ internal class GroupSyncHandler @Inject constructor() { data class LEFT(val data: Map) : HandlingStrategy() } - fun handle(realm: Realm, - roomsSyncResponse: GroupsSyncResponse, - reporter: ProgressReporter? = null) { + fun handle( + realm: Realm, + roomsSyncResponse: GroupsSyncResponse, + reporter: ProgressReporter? = null + ) { handleGroupSync(realm, HandlingStrategy.JOINED(roomsSyncResponse.join), reporter) handleGroupSync(realm, HandlingStrategy.INVITED(roomsSyncResponse.invite), reporter) handleGroupSync(realm, HandlingStrategy.LEFT(roomsSyncResponse.leave), reporter) @@ -67,8 +69,10 @@ internal class GroupSyncHandler @Inject constructor() { realm.insertOrUpdate(groups) } - private fun handleJoinedGroup(realm: Realm, - groupId: String): GroupEntity { + private fun handleJoinedGroup( + realm: Realm, + groupId: String + ): GroupEntity { val groupEntity = GroupEntity.where(realm, groupId).findFirst() ?: GroupEntity(groupId) val groupSummaryEntity = GroupSummaryEntity.getOrCreate(realm, groupId) groupEntity.membership = Membership.JOIN @@ -76,8 +80,10 @@ internal class GroupSyncHandler @Inject constructor() { return groupEntity } - private fun handleInvitedGroup(realm: Realm, - groupId: String): GroupEntity { + private fun handleInvitedGroup( + realm: Realm, + groupId: String + ): GroupEntity { val groupEntity = GroupEntity.where(realm, groupId).findFirst() ?: GroupEntity(groupId) val groupSummaryEntity = GroupSummaryEntity.getOrCreate(realm, groupId) groupEntity.membership = Membership.INVITE @@ -85,8 +91,10 @@ internal class GroupSyncHandler @Inject constructor() { return groupEntity } - private fun handleLeftGroup(realm: Realm, - groupId: String): GroupEntity { + private fun handleLeftGroup( + realm: Realm, + groupId: String + ): GroupEntity { val groupEntity = GroupEntity.where(realm, groupId).findFirst() ?: GroupEntity(groupId) val groupSummaryEntity = GroupSummaryEntity.getOrCreate(realm, groupId) groupEntity.membership = Membership.LEAVE diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ReadReceiptHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ReadReceiptHandler.kt index 77bee18df9..7329611a01 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ReadReceiptHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ReadReceiptHandler.kt @@ -44,9 +44,11 @@ internal class ReadReceiptHandler @Inject constructor( companion object { - fun createContent(userId: String, - eventId: String, - currentTimeMillis: Long): ReadReceiptContent { + fun createContent( + userId: String, + eventId: String, + currentTimeMillis: Long + ): ReadReceiptContent { return mapOf( eventId to mapOf( READ_KEY to mapOf( @@ -59,11 +61,13 @@ internal class ReadReceiptHandler @Inject constructor( } } - fun handle(realm: Realm, - roomId: String, - content: ReadReceiptContent?, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator?) { + fun handle( + realm: Realm, + roomId: String, + content: ReadReceiptContent?, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator? + ) { content ?: return try { @@ -73,11 +77,13 @@ internal class ReadReceiptHandler @Inject constructor( } } - private fun handleReadReceiptContent(realm: Realm, - roomId: String, - content: ReadReceiptContent, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator?) { + private fun handleReadReceiptContent( + realm: Realm, + roomId: String, + content: ReadReceiptContent, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator? + ) { if (isInitialSync) { initialSyncStrategy(realm, roomId, content) } else { @@ -101,10 +107,12 @@ internal class ReadReceiptHandler @Inject constructor( realm.insertOrUpdate(readReceiptSummaries) } - private fun incrementalSyncStrategy(realm: Realm, - roomId: String, - content: ReadReceiptContent, - aggregator: SyncResponsePostTreatmentAggregator?) { + private fun incrementalSyncStrategy( + realm: Realm, + roomId: String, + content: ReadReceiptContent, + aggregator: SyncResponsePostTreatmentAggregator? + ) { // First check if we have data from init sync to handle getContentFromInitSync(roomId)?.let { Timber.w("INIT_SYNC Insert during incremental sync RR for room $roomId") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt index c5d14afac0..cb4e1db46e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomSyncHandler.kt @@ -106,11 +106,13 @@ internal class RoomSyncHandler @Inject constructor( data class LEFT(val data: Map) : HandlingStrategy() } - fun handle(realm: Realm, - roomsSyncResponse: RoomsSyncResponse, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator, - reporter: ProgressReporter? = null) { + fun handle( + realm: Realm, + roomsSyncResponse: RoomsSyncResponse, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator, + reporter: ProgressReporter? = null + ) { handleRoomSync(realm, HandlingStrategy.JOINED(roomsSyncResponse.join), isInitialSync, aggregator, reporter) handleRoomSync(realm, HandlingStrategy.INVITED(roomsSyncResponse.invite), isInitialSync, aggregator, reporter) handleRoomSync(realm, HandlingStrategy.LEFT(roomsSyncResponse.leave), isInitialSync, aggregator, reporter) @@ -124,11 +126,13 @@ internal class RoomSyncHandler @Inject constructor( } // PRIVATE METHODS ***************************************************************************** - private fun handleRoomSync(realm: Realm, - handlingStrategy: HandlingStrategy, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator, - reporter: ProgressReporter?) { + private fun handleRoomSync( + realm: Realm, + handlingStrategy: HandlingStrategy, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator, + reporter: ProgressReporter? + ) { val insertType = if (isInitialSync) { EventInsertType.INITIAL_SYNC } else { @@ -161,11 +165,13 @@ internal class RoomSyncHandler @Inject constructor( realm.insertOrUpdate(rooms) } - private fun insertJoinRoomsFromInitSync(realm: Realm, - handlingStrategy: HandlingStrategy.JOINED, - syncLocalTimeStampMillis: Long, - aggregator: SyncResponsePostTreatmentAggregator, - reporter: ProgressReporter?) { + private fun insertJoinRoomsFromInitSync( + realm: Realm, + handlingStrategy: HandlingStrategy.JOINED, + syncLocalTimeStampMillis: Long, + aggregator: SyncResponsePostTreatmentAggregator, + reporter: ProgressReporter? + ) { val bestChunkSize = computeBestChunkSize( listSize = handlingStrategy.data.keys.size, limit = (initialSyncStrategy as? InitialSyncStrategy.Optimized)?.maxRoomsToInsert ?: Int.MAX_VALUE @@ -203,12 +209,14 @@ internal class RoomSyncHandler @Inject constructor( } } - private fun handleJoinedRoom(realm: Realm, - roomId: String, - roomSync: RoomSync, - insertType: EventInsertType, - syncLocalTimestampMillis: Long, - aggregator: SyncResponsePostTreatmentAggregator): RoomEntity { + private fun handleJoinedRoom( + realm: Realm, + roomId: String, + roomSync: RoomSync, + insertType: EventInsertType, + syncLocalTimestampMillis: Long, + aggregator: SyncResponsePostTreatmentAggregator + ): RoomEntity { Timber.v("Handle join sync for room $roomId") val isInitialSync = insertType == EventInsertType.INITIAL_SYNC @@ -281,11 +289,13 @@ internal class RoomSyncHandler @Inject constructor( return roomEntity } - private fun handleInvitedRoom(realm: Realm, - roomId: String, - roomSync: InvitedRoomSync, - insertType: EventInsertType, - syncLocalTimestampMillis: Long): RoomEntity { + private fun handleInvitedRoom( + realm: Realm, + roomId: String, + roomSync: InvitedRoomSync, + insertType: EventInsertType, + syncLocalTimestampMillis: Long + ): RoomEntity { Timber.v("Handle invited sync for room $roomId") val isInitialSync = insertType == EventInsertType.INITIAL_SYNC val roomEntity = RoomEntity.getOrCreate(realm, roomId) @@ -312,11 +322,13 @@ internal class RoomSyncHandler @Inject constructor( return roomEntity } - private fun handleLeftRoom(realm: Realm, - roomId: String, - roomSync: RoomSync, - insertType: EventInsertType, - syncLocalTimestampMillis: Long): RoomEntity { + private fun handleLeftRoom( + realm: Realm, + roomId: String, + roomSync: RoomSync, + insertType: EventInsertType, + syncLocalTimestampMillis: Long + ): RoomEntity { val isInitialSync = insertType == EventInsertType.INITIAL_SYNC val roomEntity = RoomEntity.getOrCreate(realm, roomId) for (event in roomSync.state?.events.orEmpty()) { @@ -357,15 +369,17 @@ internal class RoomSyncHandler @Inject constructor( return roomEntity } - private fun handleTimelineEvents(realm: Realm, - roomId: String, - roomEntity: RoomEntity, - eventList: List, - prevToken: String? = null, - isLimited: Boolean = true, - insertType: EventInsertType, - syncLocalTimestampMillis: Long, - aggregator: SyncResponsePostTreatmentAggregator): ChunkEntity { + private fun handleTimelineEvents( + realm: Realm, + roomId: String, + roomEntity: RoomEntity, + eventList: List, + prevToken: String? = null, + isLimited: Boolean = true, + insertType: EventInsertType, + syncLocalTimestampMillis: Long, + aggregator: SyncResponsePostTreatmentAggregator + ): ChunkEntity { val lastChunk = ChunkEntity.findLastForwardChunkOfRoom(realm, roomEntity.roomId) if (isLimited && lastChunk != null) { lastChunk.deleteOnCascade(deleteStateEvents = false, canDeleteRoot = true) @@ -500,11 +514,13 @@ internal class RoomSyncHandler @Inject constructor( * Adds new event to the appropriate thread chunk. If the event is already in * the thread timeline and /relations api, we should not added it */ - private fun addToThreadChunkIfNeeded(realm: Realm, - roomId: String, - threadId: String, - timelineEventEntity: TimelineEventEntity?, - roomEntity: RoomEntity) { + private fun addToThreadChunkIfNeeded( + realm: Realm, + roomId: String, + threadId: String, + timelineEventEntity: TimelineEventEntity?, + roomEntity: RoomEntity + ) { val eventId = timelineEventEntity?.eventId ?: return ChunkEntity.findLastForwardChunkOfThread(realm, roomId, threadId)?.let { threadChunk -> @@ -541,11 +557,13 @@ internal class RoomSyncHandler @Inject constructor( val typingUserIds: List = emptyList() ) - private fun handleEphemeral(realm: Realm, - roomId: String, - ephemeralEvents: List, - isInitialSync: Boolean, - aggregator: SyncResponsePostTreatmentAggregator): EphemeralResult { + private fun handleEphemeral( + realm: Realm, + roomId: String, + ephemeralEvents: List, + isInitialSync: Boolean, + aggregator: SyncResponsePostTreatmentAggregator + ): EphemeralResult { var result = EphemeralResult() for (event in ephemeralEvents) { when (event.type) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomTypingUsersHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomTypingUsersHandler.kt index 63db13a5b8..54bb63753c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomTypingUsersHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/RoomTypingUsersHandler.kt @@ -23,8 +23,10 @@ import org.matrix.android.sdk.internal.session.room.membership.RoomMemberHelper import org.matrix.android.sdk.internal.session.typing.DefaultTypingUsersTracker import javax.inject.Inject -internal class RoomTypingUsersHandler @Inject constructor(@UserId private val userId: String, - private val typingUsersTracker: DefaultTypingUsersTracker) { +internal class RoomTypingUsersHandler @Inject constructor( + @UserId private val userId: String, + private val typingUsersTracker: DefaultTypingUsersTracker +) { // TODO This could be handled outside of the Realm transaction. Use the new aggregator? fun handle(realm: Realm, roomId: String, ephemeralResult: RoomSyncHandler.EphemeralResult?) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt index 9beb8333a4..8c7557a5b8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt @@ -156,10 +156,12 @@ internal class ThreadsAwarenessHandler @Inject constructor( * Handle events mainly coming from the RoomSyncHandler. * @return The content to inject in the roomSyncHandler live events */ - fun makeEventThreadAware(realm: Realm, - roomId: String?, - event: Event?, - eventEntity: EventEntity? = null): String? { + fun makeEventThreadAware( + realm: Realm, + roomId: String?, + event: Event?, + eventEntity: EventEntity? = null + ): String? { event ?: return null roomId ?: return null if (lightweightSettingsStorage.areThreadMessagesEnabled() && !isReplyEvent(event)) return null @@ -271,10 +273,12 @@ internal class ThreadsAwarenessHandler @Inject constructor( * Actual update the eventEntity with the new payload. * @return the content to inject when this is executed by RoomSyncHandler */ - private fun updateEventEntity(event: Event, - eventEntity: EventEntity?, - eventPayload: MutableMap, - messageTextContent: Content): String? { + private fun updateEventEntity( + event: Event, + eventEntity: EventEntity?, + eventPayload: MutableMap, + messageTextContent: Content + ): String? { eventPayload["content"] = messageTextContent if (event.isEncrypted()) { @@ -304,11 +308,12 @@ internal class ThreadsAwarenessHandler @Inject constructor( * @param threadRelation the information about thread * @return The final content with the injected event */ - private fun injectEvent(roomId: String, - eventBody: String, - eventToInject: Event, - eventToInjectBody: String, - threadRelation: RelationDefaultContent? + private fun injectEvent( + roomId: String, + eventBody: String, + eventToInject: Event, + eventToInjectBody: String, + threadRelation: RelationDefaultContent? ): Content? { val eventToInjectId = eventToInject.eventId ?: return null val eventIdToInjectSenderId = eventToInject.senderId.orEmpty() @@ -334,11 +339,13 @@ internal class ThreadsAwarenessHandler @Inject constructor( /** * Integrate fallback Quote reply. */ - private fun injectFallbackIndicator(event: Event, - eventBody: String, - eventEntity: EventEntity?, - eventPayload: MutableMap, - threadRelation: RelationDefaultContent?): String? { + private fun injectFallbackIndicator( + event: Event, + eventBody: String, + eventEntity: EventEntity?, + eventPayload: MutableMap, + threadRelation: RelationDefaultContent? + ): String? { val replyFormatted = LocalEchoEventFactory.QUOTE_PATTERN.format( "In reply to a thread", eventBody diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt index fc6a4e03d6..2d8cdc4e7f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt @@ -56,11 +56,12 @@ private const val DEFAULT_LONG_POOL_TIMEOUT = 30_000L private val loggerTag = LoggerTag("SyncThread", LoggerTag.SYNC) -internal class SyncThread @Inject constructor(private val syncTask: SyncTask, - private val networkConnectivityChecker: NetworkConnectivityChecker, - private val backgroundDetectionObserver: BackgroundDetectionObserver, - private val activeCallHandler: ActiveCallHandler, - private val lightweightSettingsStorage: DefaultLightweightSettingsStorage +internal class SyncThread @Inject constructor( + private val syncTask: SyncTask, + private val networkConnectivityChecker: NetworkConnectivityChecker, + private val backgroundDetectionObserver: BackgroundDetectionObserver, + private val activeCallHandler: ActiveCallHandler, + private val lightweightSettingsStorage: DefaultLightweightSettingsStorage ) : Thread("SyncThread"), NetworkConnectivityChecker.Listener, BackgroundDetectionObserver.Listener { private var state: SyncState = SyncState.Idle diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt index bbb18b664c..0cc7944d58 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncWorker.kt @@ -119,9 +119,11 @@ internal class SyncWorker(context: Context, workerParameters: WorkerParameters, companion object { private const val BG_SYNC_WORK_NAME = "BG_SYNCP" - fun requireBackgroundSync(workManagerProvider: WorkManagerProvider, - sessionId: String, - serverTimeoutInSeconds: Long = 0) { + fun requireBackgroundSync( + workManagerProvider: WorkManagerProvider, + sessionId: String, + serverTimeoutInSeconds: Long = 0 + ) { val data = WorkerParamsFactory.toData( Params( sessionId = sessionId, @@ -139,11 +141,13 @@ internal class SyncWorker(context: Context, workerParameters: WorkerParameters, .enqueueUniqueWork(BG_SYNC_WORK_NAME, ExistingWorkPolicy.APPEND_OR_REPLACE, workRequest) } - fun automaticallyBackgroundSync(workManagerProvider: WorkManagerProvider, - sessionId: String, - serverTimeoutInSeconds: Long = 0, - delayInSeconds: Long = 30, - forceImmediate: Boolean = false) { + fun automaticallyBackgroundSync( + workManagerProvider: WorkManagerProvider, + sessionId: String, + serverTimeoutInSeconds: Long = 0, + delayInSeconds: Long = 30, + forceImmediate: Boolean = false + ) { val data = WorkerParamsFactory.toData( Params( sessionId = sessionId, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/model/TokensChunkResponse.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/model/TokensChunkResponse.kt index 533ba70b05..40fdcbbb84 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/model/TokensChunkResponse.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/model/TokensChunkResponse.kt @@ -22,4 +22,5 @@ import com.squareup.moshi.JsonClass internal data class TokensChunkResponse( val start: String? = null, val end: String? = null, - val chunk: List? = null) + val chunk: List? = null +) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/parsing/RoomSyncAccountDataHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/parsing/RoomSyncAccountDataHandler.kt index 5e7bde87e7..b1b2bfef33 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/parsing/RoomSyncAccountDataHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/parsing/RoomSyncAccountDataHandler.kt @@ -32,8 +32,10 @@ import org.matrix.android.sdk.internal.session.sync.handler.room.RoomFullyReadHa import org.matrix.android.sdk.internal.session.sync.handler.room.RoomTagHandler import javax.inject.Inject -internal class RoomSyncAccountDataHandler @Inject constructor(private val roomTagHandler: RoomTagHandler, - private val roomFullyReadHandler: RoomFullyReadHandler) { +internal class RoomSyncAccountDataHandler @Inject constructor( + private val roomTagHandler: RoomTagHandler, + private val roomFullyReadHandler: RoomFullyReadHandler +) { fun handle(realm: Realm, roomId: String, accountData: RoomSyncAccountData) { if (accountData.events.isNullOrEmpty()) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/DefaultTermsService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/DefaultTermsService.kt index 9876643bed..7075a56803 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/DefaultTermsService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/DefaultTermsService.kt @@ -51,8 +51,10 @@ internal class DefaultTermsService @Inject constructor( private val updateUserAccountDataTask: UpdateUserAccountDataTask ) : TermsService { - override suspend fun getTerms(serviceType: TermsService.ServiceType, - baseUrl: String): GetTermsResponse { + override suspend fun getTerms( + serviceType: TermsService.ServiceType, + baseUrl: String + ): GetTermsResponse { val url = buildUrl(baseUrl, serviceType) val termsResponse = executeRequest(null) { termsAPI.getTerms("${url}terms") @@ -90,10 +92,12 @@ internal class DefaultTermsService @Inject constructor( } } - override suspend fun agreeToTerms(serviceType: TermsService.ServiceType, - baseUrl: String, - agreedUrls: List, - token: String?) { + override suspend fun agreeToTerms( + serviceType: TermsService.ServiceType, + baseUrl: String, + agreedUrls: List, + token: String? + ) { val url = buildUrl(baseUrl, serviceType) val tokenToUse = token?.takeIf { it.isNotEmpty() } ?: getToken(baseUrl) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsAPI.kt index f6f57bf0ef..6a3328ee52 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsAPI.kt @@ -37,15 +37,19 @@ internal interface TermsAPI { * This request requires authentication. */ @POST - suspend fun agreeToTerms(@Url url: String, - @Body params: AcceptTermsBody, - @Header(HttpHeaders.Authorization) token: String) + suspend fun agreeToTerms( + @Url url: String, + @Body params: AcceptTermsBody, + @Header(HttpHeaders.Authorization) token: String + ) /** * API to retrieve the terms for a homeserver. The API /terms does not exist yet, so retrieve the terms from the login flow. * We do not care about the result (Credentials). */ @POST - suspend fun register(@Url url: String, - @Body body: JsonDict = emptyJsonDict) + suspend fun register( + @Url url: String, + @Body body: JsonDict = emptyJsonDict + ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsModule.kt index d7b6f68add..06d12bfe76 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/terms/TermsModule.kt @@ -34,8 +34,10 @@ internal abstract class TermsModule { @Provides @JvmStatic @SessionScope - fun providesTermsAPI(@UnauthenticatedWithCertificate unauthenticatedOkHttpClient: Lazy, - retrofitFactory: RetrofitFactory): TermsAPI { + fun providesTermsAPI( + @UnauthenticatedWithCertificate unauthenticatedOkHttpClient: Lazy, + retrofitFactory: RetrofitFactory + ): TermsAPI { val retrofit = retrofitFactory.create(unauthenticatedOkHttpClient, "https://foo.bar") return retrofit.create(TermsAPI::class.java) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/DefaultThirdPartyService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/DefaultThirdPartyService.kt index 210cb192e7..c8b9eaf810 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/DefaultThirdPartyService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/DefaultThirdPartyService.kt @@ -21,8 +21,10 @@ import org.matrix.android.sdk.api.session.thirdparty.ThirdPartyService import org.matrix.android.sdk.api.session.thirdparty.model.ThirdPartyUser import javax.inject.Inject -internal class DefaultThirdPartyService @Inject constructor(private val getThirdPartyProtocolTask: GetThirdPartyProtocolsTask, - private val getThirdPartyUserTask: GetThirdPartyUserTask) : +internal class DefaultThirdPartyService @Inject constructor( + private val getThirdPartyProtocolTask: GetThirdPartyProtocolsTask, + private val getThirdPartyUserTask: GetThirdPartyUserTask +) : ThirdPartyService { override suspend fun getThirdPartyProtocols(): Map { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/ThirdPartyAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/ThirdPartyAPI.kt index 3ecc39ac94..6759205bf3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/ThirdPartyAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/thirdparty/ThirdPartyAPI.kt @@ -39,6 +39,8 @@ internal interface ThirdPartyAPI { * Ref: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-thirdparty-user-protocol */ @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "thirdparty/user/{protocol}") - suspend fun getThirdPartyUser(@Path("protocol") protocol: String, - @QueryMap params: Map?): List + suspend fun getThirdPartyUser( + @Path("protocol") protocol: String, + @QueryMap params: Map? + ): List } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/DefaultUserService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/DefaultUserService.kt index 4ffc42e714..660cf118df 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/DefaultUserService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/DefaultUserService.kt @@ -26,10 +26,12 @@ import org.matrix.android.sdk.internal.session.user.accountdata.UpdateIgnoredUse import org.matrix.android.sdk.internal.session.user.model.SearchUserTask import javax.inject.Inject -internal class DefaultUserService @Inject constructor(private val userDataSource: UserDataSource, - private val searchUserTask: SearchUserTask, - private val updateIgnoredUserIdsTask: UpdateIgnoredUserIdsTask, - private val getProfileInfoTask: GetProfileInfoTask) : UserService { +internal class DefaultUserService @Inject constructor( + private val userDataSource: UserDataSource, + private val searchUserTask: SearchUserTask, + private val updateIgnoredUserIdsTask: UpdateIgnoredUserIdsTask, + private val getProfileInfoTask: GetProfileInfoTask +) : UserService { override fun getUser(userId: String): User? { return userDataSource.getUser(userId) @@ -59,9 +61,11 @@ internal class DefaultUserService @Inject constructor(private val userDataSource return userDataSource.getIgnoredUsersLive() } - override suspend fun searchUsersDirectory(search: String, - limit: Int, - excludedUserIds: Set): List { + override suspend fun searchUsersDirectory( + search: String, + limit: Int, + excludedUserIds: Set + ): List { val params = SearchUserTask.Params(limit, search, excludedUserIds) return searchUserTask.execute(params) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/UserDataSource.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/UserDataSource.kt index e83725b10d..f9feb04e97 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/UserDataSource.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/UserDataSource.kt @@ -36,8 +36,10 @@ import org.matrix.android.sdk.internal.database.query.where import org.matrix.android.sdk.internal.di.SessionDatabase import javax.inject.Inject -internal class UserDataSource @Inject constructor(@SessionDatabase private val monarchy: Monarchy, - private val realmSessionProvider: RealmSessionProvider) { +internal class UserDataSource @Inject constructor( + @SessionDatabase private val monarchy: Monarchy, + private val realmSessionProvider: RealmSessionProvider +) { private val realmDataSourceFactory: Monarchy.RealmDataSourceFactory by lazy { monarchy.createDataSourceFactory { realm -> diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/AccountDataAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/AccountDataAPI.kt index 178f349ec8..b283d51845 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/AccountDataAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/AccountDataAPI.kt @@ -31,7 +31,9 @@ internal interface AccountDataAPI { * @param params the put params */ @PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/account_data/{type}") - suspend fun setAccountData(@Path("userId") userId: String, - @Path("type") type: String, - @Body params: Any) + suspend fun setAccountData( + @Path("userId") userId: String, + @Path("type") type: String, + @Body params: Any + ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/UpdateUserAccountDataTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/UpdateUserAccountDataTask.kt index 88db381852..ff0e960f0f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/UpdateUserAccountDataTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/UpdateUserAccountDataTask.kt @@ -35,8 +35,9 @@ internal interface UpdateUserAccountDataTask : Task> + data class DirectChatParams( + override val type: String = UserAccountDataTypes.TYPE_DIRECT_MESSAGES, + private val directMessages: Map> ) : Params { override fun getData(): Any { @@ -63,8 +66,9 @@ internal interface UpdateUserAccountDataTask : Task { ) } -internal class DefaultCreateWidgetTask @Inject constructor(@SessionDatabase private val monarchy: Monarchy, - private val roomAPI: RoomAPI, - @UserId private val userId: String, - private val globalErrorReceiver: GlobalErrorReceiver) : CreateWidgetTask { +internal class DefaultCreateWidgetTask @Inject constructor( + @SessionDatabase private val monarchy: Monarchy, + private val roomAPI: RoomAPI, + @UserId private val userId: String, + private val globalErrorReceiver: GlobalErrorReceiver +) : CreateWidgetTask { override suspend fun execute(params: CreateWidgetTask.Params): String { val response = executeRequest(globalErrorReceiver) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt index 857105f6ef..2665809d9a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt @@ -27,8 +27,10 @@ import timber.log.Timber import java.lang.reflect.Type import javax.inject.Inject -internal class DefaultWidgetPostAPIMediator @Inject constructor(private val moshi: Moshi, - private val widgetPostMessageAPIProvider: WidgetPostMessageAPIProvider) : +internal class DefaultWidgetPostAPIMediator @Inject constructor( + private val moshi: Moshi, + private val widgetPostMessageAPIProvider: WidgetPostMessageAPIProvider +) : WidgetPostAPIMediator { private val jsonAdapter = moshi.adapter(JSON_DICT_PARAMETERIZED_TYPE) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetService.kt index 53a435d217..7b2edf2dbf 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetService.kt @@ -26,9 +26,11 @@ import org.matrix.android.sdk.api.session.widgets.model.Widget import javax.inject.Inject import javax.inject.Provider -internal class DefaultWidgetService @Inject constructor(private val widgetManager: WidgetManager, - private val widgetURLFormatter: WidgetURLFormatter, - private val widgetPostAPIMediator: Provider) : +internal class DefaultWidgetService @Inject constructor( + private val widgetManager: WidgetManager, + private val widgetURLFormatter: WidgetURLFormatter, + private val widgetPostAPIMediator: Provider +) : WidgetService { override fun getWidgetURLFormatter(): WidgetURLFormatter { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetURLFormatter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetURLFormatter.kt index 5879b62446..019edf21b6 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetURLFormatter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetURLFormatter.kt @@ -30,9 +30,10 @@ import org.matrix.android.sdk.internal.session.widgets.token.GetScalarTokenTask import javax.inject.Inject @SessionScope -internal class DefaultWidgetURLFormatter @Inject constructor(private val integrationManager: IntegrationManager, - private val getScalarTokenTask: GetScalarTokenTask, - private val matrixConfiguration: MatrixConfiguration +internal class DefaultWidgetURLFormatter @Inject constructor( + private val integrationManager: IntegrationManager, + private val getScalarTokenTask: GetScalarTokenTask, + private val matrixConfiguration: MatrixConfiguration ) : IntegrationManagerService.Listener, WidgetURLFormatter, SessionLifecycleObserver { private lateinit var currentConfig: IntegrationManagerConfig diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetManager.kt index 07ed91c179..3f7db93b97 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetManager.kt @@ -45,12 +45,14 @@ import org.matrix.android.sdk.internal.session.widgets.helper.extractWidgetSeque import javax.inject.Inject @SessionScope -internal class WidgetManager @Inject constructor(private val integrationManager: IntegrationManager, - private val userAccountDataDataSource: UserAccountDataDataSource, - private val stateEventDataSource: StateEventDataSource, - private val createWidgetTask: CreateWidgetTask, - private val widgetFactory: WidgetFactory, - @UserId private val userId: String) : +internal class WidgetManager @Inject constructor( + private val integrationManager: IntegrationManager, + private val userAccountDataDataSource: UserAccountDataDataSource, + private val stateEventDataSource: StateEventDataSource, + private val createWidgetTask: CreateWidgetTask, + private val widgetFactory: WidgetFactory, + @UserId private val userId: String +) : IntegrationManagerService.Listener, SessionLifecycleObserver { @@ -103,8 +105,10 @@ internal class WidgetManager @Inject constructor(private val integrationManager: return widgetFactory.computeURL(widget, isLightTheme) } - private fun List.mapEventsToWidgets(widgetTypes: Set? = null, - excludedTypes: Set? = null): List { + private fun List.mapEventsToWidgets( + widgetTypes: Set? = null, + excludedTypes: Set? = null + ): List { val widgetEvents = this // Widget id -> widget val widgets: MutableMap = HashMap() @@ -149,8 +153,10 @@ internal class WidgetManager @Inject constructor(private val integrationManager: return widgetsAccountData.mapToWidgets(widgetTypes, excludedTypes) } - private fun UserAccountDataEvent.mapToWidgets(widgetTypes: Set? = null, - excludedTypes: Set? = null): List { + private fun UserAccountDataEvent.mapToWidgets( + widgetTypes: Set? = null, + excludedTypes: Set? = null + ): List { return extractWidgetSequence(widgetFactory) .filter { val widgetType = it.widgetContent.type ?: return@filter false diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPI.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPI.kt index 97b40e545e..2a4af9ffaa 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPI.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPI.kt @@ -30,10 +30,14 @@ internal interface WidgetsAPI { * @param version the widget API version */ @POST("register") - suspend fun register(@Body body: OpenIdToken, - @Query("v") version: String?): RegisterWidgetResponse + suspend fun register( + @Body body: OpenIdToken, + @Query("v") version: String? + ): RegisterWidgetResponse @GET("account") - suspend fun validateToken(@Query("scalar_token") scalarToken: String?, - @Query("v") version: String?) + suspend fun validateToken( + @Query("scalar_token") scalarToken: String?, + @Query("v") version: String? + ) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPIProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPIProvider.kt index 48c8fcdb03..25caadbade 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPIProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/WidgetsAPIProvider.kt @@ -24,8 +24,10 @@ import org.matrix.android.sdk.internal.session.SessionScope import javax.inject.Inject @SessionScope -internal class WidgetsAPIProvider @Inject constructor(@Unauthenticated private val okHttpClient: Lazy, - private val retrofitFactory: RetrofitFactory) { +internal class WidgetsAPIProvider @Inject constructor( + @Unauthenticated private val okHttpClient: Lazy, + private val retrofitFactory: RetrofitFactory +) { // Map to keep one WidgetAPI instance by serverUrl private val widgetsAPIs = mutableMapOf() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/helper/WidgetFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/helper/WidgetFactory.kt index a5e74a8af0..8bd61a7bdf 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/helper/WidgetFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/helper/WidgetFactory.kt @@ -33,11 +33,13 @@ import org.matrix.android.sdk.internal.session.user.UserDataSource import java.net.URLEncoder import javax.inject.Inject -internal class WidgetFactory @Inject constructor(private val userDataSource: UserDataSource, - private val realmSessionProvider: RealmSessionProvider, - private val displayNameResolver: DisplayNameResolver, - private val urlResolver: ContentUrlResolver, - @UserId private val userId: String) { +internal class WidgetFactory @Inject constructor( + private val userDataSource: UserDataSource, + private val realmSessionProvider: RealmSessionProvider, + private val displayNameResolver: DisplayNameResolver, + private val urlResolver: ContentUrlResolver, + @UserId private val userId: String +) { fun create(widgetEvent: Event): Widget? { val widgetContent = widgetEvent.content.toModel() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/token/GetScalarTokenTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/token/GetScalarTokenTask.kt index 17797cad52..49ae52afaa 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/token/GetScalarTokenTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/token/GetScalarTokenTask.kt @@ -37,9 +37,11 @@ internal interface GetScalarTokenTask : Task private const val WIDGET_API_VERSION = "1.1" -internal class DefaultGetScalarTokenTask @Inject constructor(private val widgetsAPIProvider: WidgetsAPIProvider, - private val scalarTokenStore: ScalarTokenStore, - private val getOpenIdTokenTask: GetOpenIdTokenTask) : GetScalarTokenTask { +internal class DefaultGetScalarTokenTask @Inject constructor( + private val widgetsAPIProvider: WidgetsAPIProvider, + private val scalarTokenStore: ScalarTokenStore, + private val getOpenIdTokenTask: GetOpenIdTokenTask +) : GetScalarTokenTask { override suspend fun execute(params: GetScalarTokenTask.Params): String { val widgetsAPI = widgetsAPIProvider.get(params.serverUrl) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/task/ConfigurableTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/task/ConfigurableTask.kt index bc80cf7ee8..eead25b57c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/task/ConfigurableTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/task/ConfigurableTask.kt @@ -21,8 +21,9 @@ import org.matrix.android.sdk.api.NoOpMatrixCallback import org.matrix.android.sdk.api.util.Cancelable import java.util.UUID -internal fun Task.configureWith(params: PARAMS, - init: (ConfigurableTask.Builder.() -> Unit) = {} +internal fun Task.configureWith( + params: PARAMS, + init: (ConfigurableTask.Builder.() -> Unit) = {} ): ConfigurableTask { return ConfigurableTask.Builder(this, params).apply(init).build() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CancelableWork.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CancelableWork.kt index 6b04cea936..2240a408ef 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CancelableWork.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/CancelableWork.kt @@ -20,8 +20,10 @@ import androidx.work.WorkManager import org.matrix.android.sdk.api.util.Cancelable import java.util.UUID -internal class CancelableWork(private val workManager: WorkManager, - private val workId: UUID) : Cancelable { +internal class CancelableWork( + private val workManager: WorkManager, + private val workId: UUID +) : Cancelable { override fun cancel() { workManager.cancelWorkById(workId) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/LogUtil.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/LogUtil.kt index ffad0b856c..2306ddf850 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/LogUtil.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/LogUtil.kt @@ -33,10 +33,12 @@ internal fun Collection.logLimit(maxQuantity: Int = 5): String { } } -internal suspend fun logDuration(message: String, - loggerTag: LoggerTag, - clock: Clock, - block: suspend () -> T): T { +internal suspend fun logDuration( + message: String, + loggerTag: LoggerTag, + clock: Clock, + block: suspend () -> T +): T { Timber.tag(loggerTag.value).d("$message -- BEGIN") val start = clock.epochMillis() val result = logRamUsage(message) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt index 8f3c89f2d4..8da1bed97e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/database/RealmMigrator.kt @@ -20,8 +20,10 @@ import io.realm.DynamicRealm import io.realm.RealmObjectSchema import timber.log.Timber -internal abstract class RealmMigrator(private val realm: DynamicRealm, - private val targetSchemaVersion: Int) { +internal abstract class RealmMigrator( + private val realm: DynamicRealm, + private val targetSchemaVersion: Int +) { fun perform() { Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion") doMigrate(realm) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/MatrixWorkerFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/MatrixWorkerFactory.kt index 95b3662c67..497825b450 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/MatrixWorkerFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/MatrixWorkerFactory.kt @@ -78,9 +78,11 @@ internal class MatrixWorkerFactory @Inject constructor(private val sessionManage * This worker is launched by the factory with the isCreatedByMatrixWorkerFactory flag to true. * If the MatrixWorkerFactory is not set up, it will default to the other constructor and it will throw */ - class CheckFactoryWorker(context: Context, - workerParameters: WorkerParameters, - private val isCreatedByMatrixWorkerFactory: Boolean) : + class CheckFactoryWorker( + context: Context, + workerParameters: WorkerParameters, + private val isCreatedByMatrixWorkerFactory: Boolean + ) : CoroutineWorker(context, workerParameters) { // Called by WorkManager if there is no MatrixWorkerFactory diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRequestExecutor.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRequestExecutor.kt index 2f332a89a8..ad20abf63c 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRequestExecutor.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/FakeRequestExecutor.kt @@ -21,11 +21,13 @@ import org.matrix.android.sdk.internal.network.RequestExecutor internal class FakeRequestExecutor : RequestExecutor { - override suspend fun executeRequest(globalErrorReceiver: GlobalErrorReceiver?, - canRetry: Boolean, - maxDelayBeforeRetry: Long, - maxRetriesCount: Int, - requestBlock: suspend () -> DATA): DATA { + override suspend fun executeRequest( + globalErrorReceiver: GlobalErrorReceiver?, + canRetry: Boolean, + maxDelayBeforeRetry: Long, + maxRetriesCount: Int, + requestBlock: suspend () -> DATA + ): DATA { return requestBlock() } } diff --git a/vector/src/androidTest/java/im/vector/app/TestMatrixCallback.kt b/vector/src/androidTest/java/im/vector/app/TestMatrixCallback.kt index 2e254d48ef..f39960ce7e 100644 --- a/vector/src/androidTest/java/im/vector/app/TestMatrixCallback.kt +++ b/vector/src/androidTest/java/im/vector/app/TestMatrixCallback.kt @@ -27,8 +27,10 @@ import java.util.concurrent.CountDownLatch * @param onlySuccessful true to fail if an error occurs. This is the default behavior * @param */ -open class TestMatrixCallback(private val countDownLatch: CountDownLatch, - private val onlySuccessful: Boolean = true) : MatrixCallback { +open class TestMatrixCallback( + private val countDownLatch: CountDownLatch, + private val onlySuccessful: Boolean = true +) : MatrixCallback { @CallSuper override fun onSuccess(data: T) { diff --git a/vector/src/androidTest/java/im/vector/app/VerificationTestBase.kt b/vector/src/androidTest/java/im/vector/app/VerificationTestBase.kt index 6ac3226674..4bb3c377d7 100644 --- a/vector/src/androidTest/java/im/vector/app/VerificationTestBase.kt +++ b/vector/src/androidTest/java/im/vector/app/VerificationTestBase.kt @@ -42,10 +42,12 @@ abstract class VerificationTestBase { protected val uiTestBase = OnboardingRobot() - fun createAccountAndSync(matrix: Matrix, - userName: String, - password: String, - withInitialSync: Boolean): Session { + fun createAccountAndSync( + matrix: Matrix, + userName: String, + password: String, + withInitialSync: Boolean + ): Session { val hs = createHomeServerConfig() runBlockingTest { diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt index b9292bd916..fb80e292c2 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/ElementRobot.kt @@ -129,7 +129,7 @@ class ElementRobot { // We need to wait for the initial sync to complete; but we can't // use waitForHome() like login does. - // waitForHome() -- does not work because we have already fufilled the initialSync + // waitForHome() -- does not work because we have already fufilled the initialSync // so we can racily have an IllegalStateException that we have transitioned from busy -> idle // but never having sent the signal. diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt index 97e3b281c0..350bbf8ba3 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/OnboardingRobot.kt @@ -79,10 +79,12 @@ class OnboardingRobot { initSession(false, userId, password, homeServerUrl) } - private fun initSession(createAccount: Boolean, - userId: String, - password: String, - homeServerUrl: String) { + private fun initSession( + createAccount: Boolean, + userId: String, + password: String, + homeServerUrl: String + ) { waitUntilViewVisible(withId(R.id.loginSplashSubmit)) assertDisplayed(R.id.loginSplashSubmit, R.string.login_splash_create_account) if (createAccount) { diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/BackgroundSyncStarter.kt b/vector/src/fdroid/java/im/vector/app/fdroid/BackgroundSyncStarter.kt index e890180c4f..a9b822e37e 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/BackgroundSyncStarter.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/BackgroundSyncStarter.kt @@ -25,10 +25,12 @@ import im.vector.app.features.settings.VectorPreferences import timber.log.Timber object BackgroundSyncStarter { - fun start(context: Context, - vectorPreferences: VectorPreferences, - activeSessionHolder: ActiveSessionHolder, - clock: Clock) { + fun start( + context: Context, + vectorPreferences: VectorPreferences, + activeSessionHolder: ActiveSessionHolder, + clock: Clock + ) { if (vectorPreferences.areNotificationEnabledForDevice()) { val activeSession = activeSessionHolder.getSafeActiveSession() ?: return when (vectorPreferences.getFdroidSyncBackgroundMode()) { diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt index 6d741a36ba..e028ed0988 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestAutoStartBoot.kt @@ -26,8 +26,10 @@ import javax.inject.Inject /** * Test that the application is started on boot */ -class TestAutoStartBoot @Inject constructor(private val vectorPreferences: VectorPreferences, - private val stringProvider: StringProvider) : +class TestAutoStartBoot @Inject constructor( + private val vectorPreferences: VectorPreferences, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt index 5932d2c372..746301018b 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/features/settings/troubleshoot/TestBackgroundRestrictions.kt @@ -26,8 +26,10 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.features.settings.troubleshoot.TroubleshootTest import javax.inject.Inject -class TestBackgroundRestrictions @Inject constructor(private val context: FragmentActivity, - private val stringProvider: StringProvider) : +class TestBackgroundRestrictions @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/fdroid/java/im/vector/app/push/fcm/FcmHelper.kt b/vector/src/fdroid/java/im/vector/app/push/fcm/FcmHelper.kt index 6e36d5dd81..a93c4f0e64 100755 --- a/vector/src/fdroid/java/im/vector/app/push/fcm/FcmHelper.kt +++ b/vector/src/fdroid/java/im/vector/app/push/fcm/FcmHelper.kt @@ -67,10 +67,12 @@ object FcmHelper { AlarmSyncBroadcastReceiver.cancelAlarm(context) } - fun onEnterBackground(context: Context, - vectorPreferences: VectorPreferences, - activeSessionHolder: ActiveSessionHolder, - clock: Clock) { + fun onEnterBackground( + context: Context, + vectorPreferences: VectorPreferences, + activeSessionHolder: ActiveSessionHolder, + clock: Clock + ) { BackgroundSyncStarter.start(context, vectorPreferences, activeSessionHolder, clock) } } diff --git a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt index 89270cce55..26350a6f67 100644 --- a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestFirebaseToken.kt @@ -30,8 +30,10 @@ import javax.inject.Inject /* * Test that app can successfully retrieve a token via firebase */ -class TestFirebaseToken @Inject constructor(private val context: FragmentActivity, - private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_fcm_title) { +class TestFirebaseToken @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_fcm_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { status = TestStatus.RUNNING diff --git a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt index ecb457bf9f..f1ea4a4153 100644 --- a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPlayServices.kt @@ -29,8 +29,10 @@ import javax.inject.Inject /* * 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: FragmentActivity, - private val stringProvider: StringProvider) : +class TestPlayServices @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt index f485de760a..b4b8a936d0 100644 --- a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt @@ -36,11 +36,13 @@ import javax.inject.Inject /** * Test Push by asking the Push Gateway to send a Push back */ -class TestPushFromPushGateway @Inject constructor(private val context: FragmentActivity, - private val stringProvider: StringProvider, - private val errorFormatter: ErrorFormatter, - private val pushersManager: PushersManager, - private val activeSessionHolder: ActiveSessionHolder) : +class TestPushFromPushGateway @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider, + private val errorFormatter: ErrorFormatter, + private val pushersManager: PushersManager, + private val activeSessionHolder: ActiveSessionHolder +) : TroubleshootTest(R.string.settings_troubleshoot_test_push_loop_title) { private var action: Job? = null diff --git a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt index 2db03f3428..a6220c2018 100644 --- a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestTokenRegistration.kt @@ -33,10 +33,12 @@ import javax.inject.Inject /** * Force registration of the token to HomeServer */ -class TestTokenRegistration @Inject constructor(private val context: FragmentActivity, - private val stringProvider: StringProvider, - private val pushersManager: PushersManager, - private val activeSessionHolder: ActiveSessionHolder) : +class TestTokenRegistration @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider, + private val pushersManager: PushersManager, + private val activeSessionHolder: ActiveSessionHolder +) : TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/FcmHelper.kt b/vector/src/gplay/java/im/vector/app/push/fcm/FcmHelper.kt index 74ab3b38f1..ac2d063700 100755 --- a/vector/src/gplay/java/im/vector/app/push/fcm/FcmHelper.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/FcmHelper.kt @@ -55,8 +55,10 @@ object FcmHelper { * @param context android context * @param token the token to store */ - fun storeFcmToken(context: Context, - token: String?) { + fun storeFcmToken( + context: Context, + token: String? + ) { DefaultSharedPreferences.getInstance(context).edit { putString(PREFS_KEY_FCM_TOKEN, token) } @@ -108,10 +110,12 @@ object FcmHelper { } @Suppress("UNUSED_PARAMETER") - fun onEnterBackground(context: Context, - vectorPreferences: VectorPreferences, - activeSessionHolder: ActiveSessionHolder, - clock: Clock) { + fun onEnterBackground( + context: Context, + vectorPreferences: VectorPreferences, + activeSessionHolder: ActiveSessionHolder, + clock: Clock + ) { // No op } } diff --git a/vector/src/main/java/im/vector/app/core/date/DateFormatterProviders.kt b/vector/src/main/java/im/vector/app/core/date/DateFormatterProviders.kt index a216b6b5d8..a686c1e410 100644 --- a/vector/src/main/java/im/vector/app/core/date/DateFormatterProviders.kt +++ b/vector/src/main/java/im/vector/app/core/date/DateFormatterProviders.kt @@ -18,8 +18,10 @@ package im.vector.app.core.date import javax.inject.Inject -class DateFormatterProviders @Inject constructor(private val defaultDateFormatterProvider: DefaultDateFormatterProvider, - private val abbrevDateFormatterProvider: AbbrevDateFormatterProvider) { +class DateFormatterProviders @Inject constructor( + private val defaultDateFormatterProvider: DefaultDateFormatterProvider, + private val abbrevDateFormatterProvider: AbbrevDateFormatterProvider +) { fun provide(abbrev: Boolean): DateFormatterProvider { return if (abbrev) { diff --git a/vector/src/main/java/im/vector/app/core/date/DefaultDateFormatterProvider.kt b/vector/src/main/java/im/vector/app/core/date/DefaultDateFormatterProvider.kt index 361868cd95..138cc51cc4 100644 --- a/vector/src/main/java/im/vector/app/core/date/DefaultDateFormatterProvider.kt +++ b/vector/src/main/java/im/vector/app/core/date/DefaultDateFormatterProvider.kt @@ -22,8 +22,10 @@ import im.vector.app.core.resources.LocaleProvider import org.threeten.bp.format.DateTimeFormatter import javax.inject.Inject -class DefaultDateFormatterProvider @Inject constructor(private val context: Context, - private val localeProvider: LocaleProvider) : +class DefaultDateFormatterProvider @Inject constructor( + private val context: Context, + private val localeProvider: LocaleProvider +) : DateFormatterProvider { override val dateWithMonthFormatter: DateTimeFormatter by lazy { diff --git a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt index 983850e3be..f0c956365f 100644 --- a/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt +++ b/vector/src/main/java/im/vector/app/core/di/ActiveSessionHolder.kt @@ -31,14 +31,15 @@ import javax.inject.Inject import javax.inject.Singleton @Singleton -class ActiveSessionHolder @Inject constructor(private val activeSessionDataSource: ActiveSessionDataSource, - private val keyRequestHandler: KeyRequestHandler, - private val incomingVerificationRequestHandler: IncomingVerificationRequestHandler, - private val callManager: WebRtcCallManager, - private val pushRuleTriggerListener: PushRuleTriggerListener, - private val sessionListener: SessionListener, - private val imageManager: ImageManager, - private val guardServiceStarter: GuardServiceStarter +class ActiveSessionHolder @Inject constructor( + private val activeSessionDataSource: ActiveSessionDataSource, + private val keyRequestHandler: KeyRequestHandler, + private val incomingVerificationRequestHandler: IncomingVerificationRequestHandler, + private val callManager: WebRtcCallManager, + private val pushRuleTriggerListener: PushRuleTriggerListener, + private val sessionListener: SessionListener, + private val imageManager: ImageManager, + private val guardServiceStarter: GuardServiceStarter ) { private var activeSession: AtomicReference = AtomicReference() diff --git a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt index 2945ae7d87..a0c59038b0 100644 --- a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt @@ -118,7 +118,8 @@ object VectorStaticModule { @Provides fun providesMatrixConfiguration( vectorPreferences: VectorPreferences, - vectorRoomDisplayNameFallbackProvider: VectorRoomDisplayNameFallbackProvider): MatrixConfiguration { + vectorRoomDisplayNameFallbackProvider: VectorRoomDisplayNameFallbackProvider + ): MatrixConfiguration { return MatrixConfiguration( applicationFlavor = BuildConfig.FLAVOR_DESCRIPTION, roomDisplayNameFallbackProvider = vectorRoomDisplayNameFallbackProvider, diff --git a/vector/src/main/java/im/vector/app/core/dialogs/ConfirmationDialogBuilder.kt b/vector/src/main/java/im/vector/app/core/dialogs/ConfirmationDialogBuilder.kt index 6f45091cf9..01d369b019 100644 --- a/vector/src/main/java/im/vector/app/core/dialogs/ConfirmationDialogBuilder.kt +++ b/vector/src/main/java/im/vector/app/core/dialogs/ConfirmationDialogBuilder.kt @@ -25,13 +25,15 @@ import im.vector.app.databinding.DialogConfirmationWithReasonBinding object ConfirmationDialogBuilder { - fun show(activity: Activity, - askForReason: Boolean, - @StringRes titleRes: Int, - @StringRes confirmationRes: Int, - @StringRes positiveRes: Int, - @StringRes reasonHintRes: Int, - confirmation: (String?) -> Unit) { + fun show( + activity: Activity, + askForReason: Boolean, + @StringRes titleRes: Int, + @StringRes confirmationRes: Int, + @StringRes positiveRes: Int, + @StringRes reasonHintRes: Int, + confirmation: (String?) -> Unit + ) { val layout = activity.layoutInflater.inflate(R.layout.dialog_confirmation_with_reason, null) val views = DialogConfirmationWithReasonBinding.bind(layout) views.dialogConfirmationText.setText(confirmationRes) diff --git a/vector/src/main/java/im/vector/app/core/dialogs/PhotoOrVideoDialog.kt b/vector/src/main/java/im/vector/app/core/dialogs/PhotoOrVideoDialog.kt index 0b76446ce2..73c936a599 100644 --- a/vector/src/main/java/im/vector/app/core/dialogs/PhotoOrVideoDialog.kt +++ b/vector/src/main/java/im/vector/app/core/dialogs/PhotoOrVideoDialog.kt @@ -63,9 +63,11 @@ class PhotoOrVideoDialog( } } - private fun submit(views: DialogPhotoOrVideoBinding, - vectorPreferences: VectorPreferences, - listener: PhotoOrVideoDialogListener) { + private fun submit( + views: DialogPhotoOrVideoBinding, + vectorPreferences: VectorPreferences, + listener: PhotoOrVideoDialogListener + ) { val mode = if (views.dialogPhotoOrVideoPhoto.isChecked) { VectorPreferences.TAKE_PHOTO_VIDEO_MODE_PHOTO } else { diff --git a/vector/src/main/java/im/vector/app/core/dialogs/UnrecognizedCertificateDialog.kt b/vector/src/main/java/im/vector/app/core/dialogs/UnrecognizedCertificateDialog.kt index 8eaced1c48..df50175f87 100644 --- a/vector/src/main/java/im/vector/app/core/dialogs/UnrecognizedCertificateDialog.kt +++ b/vector/src/main/java/im/vector/app/core/dialogs/UnrecognizedCertificateDialog.kt @@ -43,9 +43,11 @@ class UnrecognizedCertificateDialog @Inject constructor( * @param unrecognizedFingerprint the fingerprint for the unknown certificate * @param callback callback to fire when the user makes a decision */ - fun show(activity: Activity, - unrecognizedFingerprint: Fingerprint, - callback: Callback) { + fun show( + activity: Activity, + unrecognizedFingerprint: Fingerprint, + callback: Callback + ) { val userId = activeSessionHolder.getSafeActiveSession()?.myUserId val hsConfig = activeSessionHolder.getSafeActiveSession()?.sessionParams?.homeServerConnectionConfig ?: return @@ -63,10 +65,12 @@ class UnrecognizedCertificateDialog @Inject constructor( /** * To use during login flow. */ - fun show(activity: Activity, - unrecognizedFingerprint: Fingerprint, - homeServerUrl: String, - callback: Callback) { + fun show( + activity: Activity, + unrecognizedFingerprint: Fingerprint, + homeServerUrl: String, + callback: Callback + ) { internalShow( activity = activity, unrecognizedFingerprint = unrecognizedFingerprint, @@ -89,13 +93,15 @@ class UnrecognizedCertificateDialog @Inject constructor( * @param homeServerUrl the homeserver url * @param homeServerConnectionConfigHasFingerprints true if the homeServerConnectionConfig has fingerprint */ - private fun internalShow(activity: Activity, - unrecognizedFingerprint: Fingerprint, - existing: Boolean, - callback: Callback, - userId: String?, - homeServerUrl: String, - homeServerConnectionConfigHasFingerprints: Boolean) { + private fun internalShow( + activity: Activity, + unrecognizedFingerprint: Fingerprint, + existing: Boolean, + callback: Callback, + userId: String?, + homeServerUrl: String, + homeServerConnectionConfigHasFingerprints: Boolean + ) { val dialogId = userId ?: homeServerUrl + unrecognizedFingerprint.displayableHexRepr if (openDialogIds.contains(dialogId)) { diff --git a/vector/src/main/java/im/vector/app/core/dispatchers/CoroutineDispatchers.kt b/vector/src/main/java/im/vector/app/core/dispatchers/CoroutineDispatchers.kt index 008ca4a9ce..8fdc9dc637 100644 --- a/vector/src/main/java/im/vector/app/core/dispatchers/CoroutineDispatchers.kt +++ b/vector/src/main/java/im/vector/app/core/dispatchers/CoroutineDispatchers.kt @@ -21,4 +21,5 @@ import javax.inject.Inject data class CoroutineDispatchers @Inject constructor( val io: CoroutineDispatcher, - val computation: CoroutineDispatcher) + val computation: CoroutineDispatcher +) diff --git a/vector/src/main/java/im/vector/app/core/error/ResourceLimitErrorFormatter.kt b/vector/src/main/java/im/vector/app/core/error/ResourceLimitErrorFormatter.kt index da9a63d4c0..cfe9d2db58 100644 --- a/vector/src/main/java/im/vector/app/core/error/ResourceLimitErrorFormatter.kt +++ b/vector/src/main/java/im/vector/app/core/error/ResourceLimitErrorFormatter.kt @@ -34,10 +34,12 @@ class ResourceLimitErrorFormatter(private val context: Context) { object Hard : Mode(R.string.resource_limit_hard_mau, R.string.resource_limit_hard_default, R.string.resource_limit_hard_contact) } - fun format(matrixError: MatrixError, - mode: Mode, - separator: CharSequence = " ", - clickable: Boolean = false): CharSequence { + fun format( + matrixError: MatrixError, + mode: Mode, + separator: CharSequence = " ", + clickable: Boolean = false + ): CharSequence { val error = if (MatrixError.LIMIT_TYPE_MAU == matrixError.limitType) { context.getString(mode.mauErrorRes) } else { diff --git a/vector/src/main/java/im/vector/app/core/extensions/Activity.kt b/vector/src/main/java/im/vector/app/core/extensions/Activity.kt index 6f2ea9699a..77808c3fbf 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Activity.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Activity.kt @@ -39,7 +39,8 @@ fun ComponentActivity.registerStartForActivityResult(onResult: (ActivityResult) fun AppCompatActivity.addFragment( container: ViewGroup, fragment: Fragment, - allowStateLoss: Boolean = false) { + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { add(container.id, fragment) } } @@ -48,7 +49,8 @@ fun AppCompatActivity.addFragment( fragmentClass: Class, params: Parcelable? = null, tag: String? = null, - allowStateLoss: Boolean = false) { + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { add(container.id, fragmentClass, params.toMvRxBundle(), tag) } @@ -58,7 +60,8 @@ fun AppCompatActivity.replaceFragment( container: ViewGroup, fragment: Fragment, tag: String? = null, - allowStateLoss: Boolean = false) { + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { replace(container.id, fragment, tag) } @@ -70,7 +73,8 @@ fun AppCompatActivity.replaceFragment( params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false, - useCustomAnimation: Boolean = false) { + useCustomAnimation: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { if (useCustomAnimation) { setCustomAnimations(R.anim.fade_in, R.anim.fade_out, R.anim.fade_in, R.anim.fade_out) @@ -83,7 +87,8 @@ fun AppCompatActivity.addFragmentToBackstack( container: ViewGroup, fragment: Fragment, tag: String? = null, - allowStateLoss: Boolean = false) { + allowStateLoss: Boolean = false +) { supportFragmentManager.commitTransaction(allowStateLoss) { replace(container.id, fragment).addToBackStack(tag) } @@ -95,7 +100,8 @@ fun AppCompatActivity.addFragmentToBackstack( params: Parcelable? = null, tag: String? = null, allowStateLoss: Boolean = false, - option: ((FragmentTransaction) -> Unit)? = null) { + option: ((FragmentTransaction) -> Unit)? = null +) { supportFragmentManager.commitTransaction(allowStateLoss) { option?.invoke(this) replace(container.id, fragmentClass, params.toMvRxBundle(), tag).addToBackStack(tag) diff --git a/vector/src/main/java/im/vector/app/core/extensions/Context.kt b/vector/src/main/java/im/vector/app/core/extensions/Context.kt index 0f785e43a3..648e441711 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Context.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Context.kt @@ -53,9 +53,10 @@ fun Context.getResTintedDrawable(@DrawableRes drawableRes: Int, @ColorRes tint: return getTintedDrawable(drawableRes, ContextCompat.getColor(this, tint), alpha) } -fun Context.getTintedDrawable(@DrawableRes drawableRes: Int, - @ColorInt tint: Int, - @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1f +fun Context.getTintedDrawable( + @DrawableRes drawableRes: Int, + @ColorInt tint: Int, + @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1f ) = ContextCompat.getDrawable(this, drawableRes) ?.mutate() ?.also { drawable -> diff --git a/vector/src/main/java/im/vector/app/core/extensions/EditText.kt b/vector/src/main/java/im/vector/app/core/extensions/EditText.kt index 0eb9dcdaf9..24c8e6bd36 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/EditText.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/EditText.kt @@ -27,8 +27,10 @@ import androidx.annotation.DrawableRes import im.vector.app.R import im.vector.app.core.platform.SimpleTextWatcher -fun EditText.setupAsSearch(@DrawableRes searchIconRes: Int = R.drawable.ic_search, - @DrawableRes clearIconRes: Int = R.drawable.ic_x_gray) { +fun EditText.setupAsSearch( + @DrawableRes searchIconRes: Int = R.drawable.ic_search, + @DrawableRes clearIconRes: Int = R.drawable.ic_x_gray +) { addTextChangedListener(object : SimpleTextWatcher() { override fun afterTextChanged(s: Editable) { val clearIcon = if (s.isNotEmpty()) clearIconRes else 0 diff --git a/vector/src/main/java/im/vector/app/core/extensions/RecyclerView.kt b/vector/src/main/java/im/vector/app/core/extensions/RecyclerView.kt index eeb5ddce03..3ee20e362d 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/RecyclerView.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/RecyclerView.kt @@ -27,13 +27,15 @@ import com.airbnb.epoxy.EpoxyVisibilityTracker /** * Apply a Vertical LinearLayout Manager to the recyclerView and set the adapter from the epoxy controller. */ -fun RecyclerView.configureWith(epoxyController: EpoxyController, - itemAnimator: RecyclerView.ItemAnimator? = null, - viewPool: RecyclerView.RecycledViewPool? = null, - @DrawableRes - dividerDrawable: Int? = null, - hasFixedSize: Boolean = true, - disableItemAnimation: Boolean = false) { +fun RecyclerView.configureWith( + epoxyController: EpoxyController, + itemAnimator: RecyclerView.ItemAnimator? = null, + viewPool: RecyclerView.RecycledViewPool? = null, + @DrawableRes + dividerDrawable: Int? = null, + hasFixedSize: Boolean = true, + disableItemAnimation: Boolean = false +) { layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false).apply { recycleChildrenOnDetach = viewPool != null } diff --git a/vector/src/main/java/im/vector/app/core/extensions/TextView.kt b/vector/src/main/java/im/vector/app/core/extensions/TextView.kt index 7d8b60ed58..3c453d854d 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/TextView.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/TextView.kt @@ -60,11 +60,13 @@ fun TextView.setTextOrHide(newText: CharSequence?, hideWhenBlank: Boolean = true * @param underline true to also underline the text. Default to false * @param onClick attributes to handle click on the colored part if needed */ -fun TextView.setTextWithColoredPart(@StringRes fullTextRes: Int, - @StringRes coloredTextRes: Int, - @AttrRes colorAttribute: Int = R.attr.colorPrimary, - underline: Boolean = false, - onClick: (() -> Unit)? = null) { +fun TextView.setTextWithColoredPart( + @StringRes fullTextRes: Int, + @StringRes coloredTextRes: Int, + @AttrRes colorAttribute: Int = R.attr.colorPrimary, + underline: Boolean = false, + onClick: (() -> Unit)? = null +) { val coloredPart = resources.getString(coloredTextRes) // Insert colored part into the full text val fullText = resources.getString(fullTextRes, coloredPart) @@ -80,11 +82,13 @@ fun TextView.setTextWithColoredPart(@StringRes fullTextRes: Int, * @param underline true to also underline the text. Default to false * @param onClick attributes to handle click on the colored part if needed */ -fun TextView.setTextWithColoredPart(fullText: String, - coloredPart: String, - @AttrRes colorAttribute: Int = R.attr.colorPrimary, - underline: Boolean = true, - onClick: (() -> Unit)? = null) { +fun TextView.setTextWithColoredPart( + fullText: String, + coloredPart: String, + @AttrRes colorAttribute: Int = R.attr.colorPrimary, + underline: Boolean = true, + onClick: (() -> Unit)? = null +) { val color = ThemeUtils.getColor(context, colorAttribute) val foregroundSpan = ForegroundColorSpan(color) diff --git a/vector/src/main/java/im/vector/app/core/files/FileSaver.kt b/vector/src/main/java/im/vector/app/core/files/FileSaver.kt index d0f2247f33..7de5286854 100644 --- a/vector/src/main/java/im/vector/app/core/files/FileSaver.kt +++ b/vector/src/main/java/im/vector/app/core/files/FileSaver.kt @@ -55,11 +55,13 @@ fun writeToFile(data: ByteArray, file: File): Try { } } -fun addEntryToDownloadManager(context: Context, - file: File, - mimeType: String, - title: String = file.name, - description: String = file.name): Uri? { +fun addEntryToDownloadManager( + context: Context, + file: File, + mimeType: String, + title: String = file.name, + description: String = file.name +): Uri? { try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val contentValues = ContentValues().apply { diff --git a/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt b/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt index a643ee908c..92c95d3062 100644 --- a/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt +++ b/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt @@ -60,10 +60,12 @@ class VectorGlideModelLoader(private val context: Context) : } } -class VectorGlideDataFetcher(context: Context, - private val data: ImageContentRenderer.Data, - private val width: Int, - private val height: Int) : +class VectorGlideDataFetcher( + context: Context, + private val data: ImageContentRenderer.Data, + private val width: Int, + private val height: Int +) : DataFetcher { private val localFilesHelper = LocalFilesHelper(context) diff --git a/vector/src/main/java/im/vector/app/core/linkify/VectorLinkify.kt b/vector/src/main/java/im/vector/app/core/linkify/VectorLinkify.kt index d2184d9bd7..c833f39063 100644 --- a/vector/src/main/java/im/vector/app/core/linkify/VectorLinkify.kt +++ b/vector/src/main/java/im/vector/app/core/linkify/VectorLinkify.kt @@ -143,10 +143,12 @@ object VectorLinkify { } } - private data class LinkSpec(val span: URLSpan, - val start: Int, - val end: Int, - val important: Boolean = false) + private data class LinkSpec( + val span: URLSpan, + val start: Int, + val end: Int, + val important: Boolean = false + ) private val COMPARATOR = Comparator { (_, startA, endA), (_, startB, endB) -> if (startA < startB) { diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index 8a4aaa4b26..0c6708af33 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -261,11 +261,11 @@ abstract class VectorBaseActivity : AppCompatActivity(), Maver private fun handleGlobalError(globalError: GlobalError) { when (globalError) { - is GlobalError.InvalidToken -> handleInvalidToken(globalError) + is GlobalError.InvalidToken -> handleInvalidToken(globalError) is GlobalError.ConsentNotGivenError -> displayConsentNotGivenDialog(globalError) - is GlobalError.CertificateError -> handleCertificateError(globalError) - GlobalError.ExpiredAccount -> Unit // TODO Handle account expiration - is GlobalError.InitialSyncRequest -> handleInitialSyncRequest(globalError) + is GlobalError.CertificateError -> handleCertificateError(globalError) + GlobalError.ExpiredAccount -> Unit // TODO Handle account expiration + is GlobalError.InitialSyncRequest -> handleInitialSyncRequest(globalError) } } diff --git a/vector/src/main/java/im/vector/app/core/platform/livedata/SharedPreferenceLiveData.kt b/vector/src/main/java/im/vector/app/core/platform/livedata/SharedPreferenceLiveData.kt index 3e0733b35d..dddce313ff 100644 --- a/vector/src/main/java/im/vector/app/core/platform/livedata/SharedPreferenceLiveData.kt +++ b/vector/src/main/java/im/vector/app/core/platform/livedata/SharedPreferenceLiveData.kt @@ -19,9 +19,11 @@ package im.vector.app.core.platform.livedata import android.content.SharedPreferences import androidx.lifecycle.LiveData -abstract class SharedPreferenceLiveData(protected val sharedPrefs: SharedPreferences, - protected val key: String, - private val defValue: T) : LiveData() { +abstract class SharedPreferenceLiveData( + protected val sharedPrefs: SharedPreferences, + protected val key: String, + private val defValue: T +) : LiveData() { private val preferenceChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> if (key == this.key) { diff --git a/vector/src/main/java/im/vector/app/core/qrcode/QrCode.kt b/vector/src/main/java/im/vector/app/core/qrcode/QrCode.kt index 170baa04fe..226ec5ee59 100644 --- a/vector/src/main/java/im/vector/app/core/qrcode/QrCode.kt +++ b/vector/src/main/java/im/vector/app/core/qrcode/QrCode.kt @@ -32,8 +32,10 @@ fun String.toBitMatrix(size: Int): BitMatrix { ) } -fun BitMatrix.toBitmap(@ColorInt backgroundColor: Int = Color.WHITE, - @ColorInt foregroundColor: Int = Color.BLACK): Bitmap { +fun BitMatrix.toBitmap( + @ColorInt backgroundColor: Int = Color.WHITE, + @ColorInt foregroundColor: Int = Color.BLACK +): Bitmap { val colorBuffer = IntArray(width * height) var rowOffset = 0 for (y in 0 until height) { diff --git a/vector/src/main/java/im/vector/app/core/services/CallService.kt b/vector/src/main/java/im/vector/app/core/services/CallService.kt index df9e670423..b7db7b2542 100644 --- a/vector/src/main/java/im/vector/app/core/services/CallService.kt +++ b/vector/src/main/java/im/vector/app/core/services/CallService.kt @@ -321,9 +321,11 @@ class CallService : VectorService() { private const val EXTRA_END_CALL_REJECTED = "EXTRA_END_CALL_REJECTED" private const val EXTRA_END_CALL_REASON = "EXTRA_END_CALL_REASON" - fun onIncomingCallRinging(context: Context, - callId: String, - isInBackground: Boolean) { + fun onIncomingCallRinging( + context: Context, + callId: String, + isInBackground: Boolean + ) { val intent = Intent(context, CallService::class.java) .apply { action = ACTION_INCOMING_RINGING_CALL @@ -333,8 +335,10 @@ class CallService : VectorService() { ContextCompat.startForegroundService(context, intent) } - fun onOutgoingCallRinging(context: Context, - callId: String) { + fun onOutgoingCallRinging( + context: Context, + callId: String + ) { val intent = Intent(context, CallService::class.java) .apply { action = ACTION_OUTGOING_RINGING_CALL @@ -343,8 +347,10 @@ class CallService : VectorService() { ContextCompat.startForegroundService(context, intent) } - fun onPendingCall(context: Context, - callId: String) { + fun onPendingCall( + context: Context, + callId: String + ) { val intent = Intent(context, CallService::class.java) .apply { action = ACTION_ONGOING_CALL @@ -353,10 +359,12 @@ class CallService : VectorService() { ContextCompat.startForegroundService(context, intent) } - fun onCallTerminated(context: Context, - callId: String, - endCallReason: EndCallReason, - rejected: Boolean) { + fun onCallTerminated( + context: Context, + callId: String, + endCallReason: EndCallReason, + rejected: Boolean + ) { val intent = Intent(context, CallService::class.java) .apply { action = ACTION_CALL_TERMINATED diff --git a/vector/src/main/java/im/vector/app/core/services/VectorSyncService.kt b/vector/src/main/java/im/vector/app/core/services/VectorSyncService.kt index 131276bea6..1ac7b83f44 100644 --- a/vector/src/main/java/im/vector/app/core/services/VectorSyncService.kt +++ b/vector/src/main/java/im/vector/app/core/services/VectorSyncService.kt @@ -47,8 +47,10 @@ class VectorSyncService : SyncService() { companion object { - fun newOneShotIntent(context: Context, - sessionId: String): Intent { + fun newOneShotIntent( + context: Context, + sessionId: String + ): Intent { return Intent(context, VectorSyncService::class.java).also { it.putExtra(EXTRA_SESSION_ID, sessionId) it.putExtra(EXTRA_TIMEOUT_SECONDS, 0) @@ -56,11 +58,13 @@ class VectorSyncService : SyncService() { } } - fun newPeriodicIntent(context: Context, - sessionId: String, - syncTimeoutSeconds: Int, - syncDelaySeconds: Int, - isNetworkBack: Boolean): Intent { + fun newPeriodicIntent( + context: Context, + sessionId: String, + syncTimeoutSeconds: Int, + syncDelaySeconds: Int, + isNetworkBack: Boolean + ): Intent { return Intent(context, VectorSyncService::class.java).also { it.putExtra(EXTRA_SESSION_ID, sessionId) it.putExtra(EXTRA_TIMEOUT_SECONDS, syncTimeoutSeconds) @@ -97,9 +101,11 @@ class VectorSyncService : SyncService() { startForeground(NotificationUtils.NOTIFICATION_ID_FOREGROUND_SERVICE, notification) } - override fun onRescheduleAsked(sessionId: String, - syncTimeoutSeconds: Int, - syncDelaySeconds: Int) { + override fun onRescheduleAsked( + sessionId: String, + syncTimeoutSeconds: Int, + syncDelaySeconds: Int + ) { rescheduleSyncService( sessionId = sessionId, syncTimeoutSeconds = syncTimeoutSeconds, @@ -110,10 +116,12 @@ class VectorSyncService : SyncService() { ) } - override fun onNetworkError(sessionId: String, - syncTimeoutSeconds: Int, - syncDelaySeconds: Int, - isPeriodic: Boolean) { + override fun onNetworkError( + sessionId: String, + syncTimeoutSeconds: Int, + syncDelaySeconds: Int, + isPeriodic: Boolean + ) { Timber.d("## Sync: A network error occurred during sync") val rescheduleSyncWorkRequest: WorkRequest = OneTimeWorkRequestBuilder() @@ -169,10 +177,11 @@ class VectorSyncService : SyncService() { } companion object { - fun createInputData(sessionId: String, - syncTimeoutSeconds: Int, - syncDelaySeconds: Int, - isPeriodic: Boolean + fun createInputData( + sessionId: String, + syncTimeoutSeconds: Int, + syncDelaySeconds: Int, + isPeriodic: Boolean ): Data { return Data.Builder() .putString(KEY_SESSION_ID, sessionId) @@ -190,12 +199,14 @@ class VectorSyncService : SyncService() { } } -private fun Context.rescheduleSyncService(sessionId: String, - syncTimeoutSeconds: Int, - syncDelaySeconds: Int, - isPeriodic: Boolean, - isNetworkBack: Boolean, - currentTimeMillis: Long) { +private fun Context.rescheduleSyncService( + sessionId: String, + syncTimeoutSeconds: Int, + syncDelaySeconds: Int, + isPeriodic: Boolean, + isNetworkBack: Boolean, + currentTimeMillis: Long +) { Timber.d("## Sync: rescheduleSyncService") val intent = if (isPeriodic) { VectorSyncService.newPeriodicIntent( diff --git a/vector/src/main/java/im/vector/app/core/ui/views/PasswordStrengthBar.kt b/vector/src/main/java/im/vector/app/core/ui/views/PasswordStrengthBar.kt index 04bc821387..eb5b05e79b 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/PasswordStrengthBar.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/PasswordStrengthBar.kt @@ -35,7 +35,8 @@ import im.vector.app.databinding.ViewPasswordStrengthBarBinding class PasswordStrengthBar @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : + defStyleAttr: Int = 0 +) : LinearLayout(context, attrs, defStyleAttr) { private val views: ViewPasswordStrengthBarBinding diff --git a/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt b/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt index a1d3e49f3b..6fd8cba94e 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/PresenceStateImageView.kt @@ -49,7 +49,7 @@ class PresenceStateImageView @JvmOverloads constructor( setImageResource(R.drawable.ic_presence_offline) contentDescription = context.getString(R.string.a11y_presence_offline) } - PresenceEnum.BUSY -> { + PresenceEnum.BUSY -> { setImageResource(R.drawable.ic_presence_busy) contentDescription = context.getString(R.string.a11y_presence_busy) } diff --git a/vector/src/main/java/im/vector/app/core/utils/Dialogs.kt b/vector/src/main/java/im/vector/app/core/utils/Dialogs.kt index 9f3e6a91cf..c9bd4e54b0 100644 --- a/vector/src/main/java/im/vector/app/core/utils/Dialogs.kt +++ b/vector/src/main/java/im/vector/app/core/utils/Dialogs.kt @@ -45,8 +45,10 @@ fun Context.displayInWebView(url: String) { .show() } -fun Context.showIdentityServerConsentDialog(identityServerWithTerms: ServerAndPolicies?, - consentCallBack: (() -> Unit)) { +fun Context.showIdentityServerConsentDialog( + identityServerWithTerms: ServerAndPolicies?, + consentCallBack: (() -> Unit) +) { // Build the message val content = span { +getString(R.string.identity_server_consent_dialog_content_3) diff --git a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt index 9616e35840..bb5f7dcf9c 100644 --- a/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt +++ b/vector/src/main/java/im/vector/app/core/utils/ExternalApplicationsUtil.kt @@ -89,9 +89,11 @@ fun openUrlInExternalBrowser(context: Context, uri: Uri?) { * If several compatible browsers are installed, the user will be proposed to choose one. * Ref: https://developer.chrome.com/multidevice/android/customtabs. */ -fun openUrlInChromeCustomTab(context: Context, - session: CustomTabsSession?, - url: String) { +fun openUrlInChromeCustomTab( + context: Context, + session: CustomTabsSession?, + url: String +) { try { CustomTabsIntent.Builder() .setDefaultColorSchemeParams( @@ -122,10 +124,12 @@ fun openUrlInChromeCustomTab(context: Context, /** * Open file selection activity. */ -fun openFileSelection(activity: Activity, - activityResultLauncher: ActivityResultLauncher?, - allowMultipleSelection: Boolean, - requestCode: Int) { +fun openFileSelection( + activity: Activity, + activityResultLauncher: ActivityResultLauncher?, + allowMultipleSelection: Boolean, + requestCode: Int +) { val fileIntent = Intent(Intent.ACTION_GET_CONTENT) fileIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultipleSelection) @@ -251,12 +255,14 @@ private fun appendTimeToFilename(name: String): String { return """${filename}_$dateExtension.$fileExtension""" } -suspend fun saveMedia(context: Context, - file: File, - title: String, - mediaMimeType: String?, - notificationUtils: NotificationUtils, - currentTimeMillis: Long) { +suspend fun saveMedia( + context: Context, + file: File, + title: String, + mediaMimeType: String?, + notificationUtils: NotificationUtils, + currentTimeMillis: Long +) { withContext(Dispatchers.IO) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val filename = appendTimeToFilename(title) @@ -303,11 +309,13 @@ suspend fun saveMedia(context: Context, } @Suppress("DEPRECATION") -private fun saveMediaLegacy(context: Context, - mediaMimeType: String?, - title: String, - file: File, - currentTimeMillis: Long) { +private fun saveMediaLegacy( + context: Context, + mediaMimeType: String?, + title: String, + file: File, + currentTimeMillis: Long +) { val state = Environment.getExternalStorageState() if (Environment.MEDIA_MOUNTED != state) { context.toast(context.getString(R.string.error_saving_media_file)) diff --git a/vector/src/main/java/im/vector/app/core/utils/PermissionsTools.kt b/vector/src/main/java/im/vector/app/core/utils/PermissionsTools.kt index a41abba7ab..a89b167c55 100644 --- a/vector/src/main/java/im/vector/app/core/utils/PermissionsTools.kt +++ b/vector/src/main/java/im/vector/app/core/utils/PermissionsTools.kt @@ -106,10 +106,12 @@ private fun onPermissionResult(result: Map, lambda: (allGranted * @param rationaleMessage message to be displayed BEFORE requesting for the permission * @return true if the permissions are granted (synchronous flow), false otherwise (asynchronous flow) */ -fun checkPermissions(permissionsToBeGranted: List, - activity: Activity, - activityResultLauncher: ActivityResultLauncher>, - @StringRes rationaleMessage: Int = 0): Boolean { +fun checkPermissions( + permissionsToBeGranted: List, + activity: Activity, + activityResultLauncher: ActivityResultLauncher>, + @StringRes rationaleMessage: Int = 0 +): Boolean { // retrieve the permissions to be granted according to the permission list val missingPermissions = permissionsToBeGranted.filter { permission -> ContextCompat.checkSelfPermission(activity.applicationContext, permission) == PackageManager.PERMISSION_DENIED @@ -149,8 +151,10 @@ fun checkPermissions(permissionsToBeGranted: List, * * @return true if one of the permission has been denied and the user check the do not ask again checkbox */ -private fun permissionsDeniedPermanently(permissionsToBeGranted: List, - activity: Activity): Boolean { +private fun permissionsDeniedPermanently( + permissionsToBeGranted: List, + activity: Activity +): Boolean { return permissionsToBeGranted .filter { permission -> ContextCompat.checkSelfPermission(activity.applicationContext, permission) == PackageManager.PERMISSION_DENIED diff --git a/vector/src/main/java/im/vector/app/core/utils/SnapHelperUtils.kt b/vector/src/main/java/im/vector/app/core/utils/SnapHelperUtils.kt index 070c953a3f..7d1bfc926d 100644 --- a/vector/src/main/java/im/vector/app/core/utils/SnapHelperUtils.kt +++ b/vector/src/main/java/im/vector/app/core/utils/SnapHelperUtils.kt @@ -27,7 +27,8 @@ interface OnSnapPositionChangeListener { fun RecyclerView.attachSnapHelperWithListener( snapHelper: SnapHelper, behavior: SnapOnScrollListener.Behavior = SnapOnScrollListener.Behavior.NOTIFY_ON_SCROLL_STATE_IDLE, - onSnapPositionChangeListener: OnSnapPositionChangeListener) { + onSnapPositionChangeListener: OnSnapPositionChangeListener +) { snapHelper.attachToRecyclerView(this) val snapOnScrollListener = SnapOnScrollListener(snapHelper, behavior, onSnapPositionChangeListener) addOnScrollListener(snapOnScrollListener) diff --git a/vector/src/main/java/im/vector/app/core/utils/SpannableUtils.kt b/vector/src/main/java/im/vector/app/core/utils/SpannableUtils.kt index aa1917e326..146df82e35 100644 --- a/vector/src/main/java/im/vector/app/core/utils/SpannableUtils.kt +++ b/vector/src/main/java/im/vector/app/core/utils/SpannableUtils.kt @@ -48,8 +48,10 @@ fun Spannable.tappableMatchingText(match: String, clickSpan: ClickableSpan): Spa return this } -fun Span.bullet(text: CharSequence = "", - init: Span.() -> Unit = {}): Span = apply { +fun Span.bullet( + text: CharSequence = "", + init: Span.() -> Unit = {} +): Span = apply { append(Span(parent = this).apply { this.text = text this.spans.add(BulletSpan()) diff --git a/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt b/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt index 1d9ac6c3ef..1939bdf6a9 100644 --- a/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt +++ b/vector/src/main/java/im/vector/app/core/utils/SystemUtils.kt @@ -145,12 +145,14 @@ fun startInstallFromSourceIntent(context: Context, activityResultLauncher: Activ } } -fun startSharePlainTextIntent(fragment: Fragment, - activityResultLauncher: ActivityResultLauncher?, - chooserTitle: String?, - text: String, - subject: String? = null, - extraTitle: String? = null) { +fun startSharePlainTextIntent( + fragment: Fragment, + activityResultLauncher: ActivityResultLauncher?, + chooserTitle: String?, + text: String, + subject: String? = null, + extraTitle: String? = null +) { val share = Intent(Intent.ACTION_SEND) share.type = "text/plain" share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT) diff --git a/vector/src/main/java/im/vector/app/core/utils/ToggleableAppBarLayoutBehavior.kt b/vector/src/main/java/im/vector/app/core/utils/ToggleableAppBarLayoutBehavior.kt index c829313256..b2509a145d 100644 --- a/vector/src/main/java/im/vector/app/core/utils/ToggleableAppBarLayoutBehavior.kt +++ b/vector/src/main/java/im/vector/app/core/utils/ToggleableAppBarLayoutBehavior.kt @@ -32,35 +32,41 @@ class ToggleableAppBarLayoutBehavior : AppBarLayout.Behavior { var isEnabled = true - override fun onStartNestedScroll(parent: CoordinatorLayout, - child: AppBarLayout, - directTargetChild: View, - target: View, - nestedScrollAxes: Int, - type: Int): Boolean { + override fun onStartNestedScroll( + parent: CoordinatorLayout, + child: AppBarLayout, + directTargetChild: View, + target: View, + nestedScrollAxes: Int, + type: Int + ): Boolean { return isEnabled && super.onStartNestedScroll(parent, child, directTargetChild, target, nestedScrollAxes, type) } - override fun onNestedScroll(coordinatorLayout: CoordinatorLayout, - child: AppBarLayout, - target: View, - dxConsumed: Int, - dyConsumed: Int, - dxUnconsumed: Int, - dyUnconsumed: Int, - type: Int, - consumed: IntArray) { + override fun onNestedScroll( + coordinatorLayout: CoordinatorLayout, + child: AppBarLayout, + target: View, + dxConsumed: Int, + dyConsumed: Int, + dxUnconsumed: Int, + dyUnconsumed: Int, + type: Int, + consumed: IntArray + ) { if (!isEnabled) return super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type, consumed) } - override fun onNestedPreScroll(coordinatorLayout: CoordinatorLayout, - child: AppBarLayout, - target: View, - dx: Int, - dy: Int, - consumed: IntArray, - type: Int) { + override fun onNestedPreScroll( + coordinatorLayout: CoordinatorLayout, + child: AppBarLayout, + target: View, + dx: Int, + dy: Int, + consumed: IntArray, + type: Int + ) { if (!isEnabled) return super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type) } diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt index d1f0efae6c..c2eb5a29a8 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentTypeSelectorView.kt @@ -51,9 +51,10 @@ private const val ANIMATION_DURATION = 250 * It will return result through [Callback]. */ -class AttachmentTypeSelectorView(context: Context, - inflater: LayoutInflater, - var callback: Callback? +class AttachmentTypeSelectorView( + context: Context, + inflater: LayoutInflater, + var callback: Callback? ) : PopupWindow(context) { interface Callback { diff --git a/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt b/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt index 14324896bc..d5f65a4aef 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/AttachmentsHelper.kt @@ -96,10 +96,12 @@ class AttachmentsHelper(val context: Context, val callback: Callback) : Restorab /** * Starts the process for handling image/video capture. Can open a dialog */ - fun openCamera(activity: Activity, - vectorPreferences: VectorPreferences, - cameraActivityResultLauncher: ActivityResultLauncher, - cameraVideoActivityResultLauncher: ActivityResultLauncher) { + fun openCamera( + activity: Activity, + vectorPreferences: VectorPreferences, + cameraActivityResultLauncher: ActivityResultLauncher, + cameraVideoActivityResultLauncher: ActivityResultLauncher + ) { PhotoOrVideoDialog(activity, vectorPreferences).show(object : PhotoOrVideoDialog.PhotoOrVideoDialogListener { override fun takePhoto() { captureUri = MultiPicker.get(MultiPicker.CAMERA).startWithExpectingFile(context, cameraActivityResultLauncher) diff --git a/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt b/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt index f92ec8ea9e..1e9ccd7243 100644 --- a/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt +++ b/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt @@ -196,11 +196,13 @@ class ReAuthActivity : SimpleFragmentActivity() { const val RESULT_VALUE = "RESULT_VALUE" const val DEFAULT_RESULT_KEYSTORE_ALIAS = "ReAuthActivity" - fun newIntent(context: Context, - fromError: RegistrationFlowResponse, - lastErrorCode: String?, - reasonTitle: String?, - resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS): Intent { + fun newIntent( + context: Context, + fromError: RegistrationFlowResponse, + lastErrorCode: String?, + reasonTitle: String?, + resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS + ): Intent { val authType = when (fromError.nextUncompletedStage()) { LoginFlowTypes.PASSWORD -> { LoginFlowTypes.PASSWORD diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/command/AutocompleteCommandPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/command/AutocompleteCommandPresenter.kt index 5e4528d381..497c5b5d51 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/command/AutocompleteCommandPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/command/AutocompleteCommandPresenter.kt @@ -30,7 +30,8 @@ class AutocompleteCommandPresenter @AssistedInject constructor( @Assisted val isInThreadTimeline: Boolean, context: Context, private val controller: AutocompleteCommandController, - private val vectorPreferences: VectorPreferences) : + private val vectorPreferences: VectorPreferences +) : RecyclerViewPresenter(context), AutocompleteClickListener { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/emoji/AutocompleteEmojiPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/emoji/AutocompleteEmojiPresenter.kt index 4f272c7a24..2b83c1dc30 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/emoji/AutocompleteEmojiPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/emoji/AutocompleteEmojiPresenter.kt @@ -28,9 +28,11 @@ import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.launch import javax.inject.Inject -class AutocompleteEmojiPresenter @Inject constructor(context: Context, - private val emojiDataSource: EmojiDataSource, - private val controller: AutocompleteEmojiController) : +class AutocompleteEmojiPresenter @Inject constructor( + context: Context, + private val emojiDataSource: EmojiDataSource, + private val controller: AutocompleteEmojiController +) : RecyclerViewPresenter(context), AutocompleteClickListener { private val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Main) diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/group/AutocompleteGroupPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/group/AutocompleteGroupPresenter.kt index fc7479eb21..32a1bed1c6 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/group/AutocompleteGroupPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/group/AutocompleteGroupPresenter.kt @@ -26,9 +26,10 @@ import org.matrix.android.sdk.api.session.group.groupSummaryQueryParams import org.matrix.android.sdk.api.session.group.model.GroupSummary import javax.inject.Inject -class AutocompleteGroupPresenter @Inject constructor(context: Context, - private val controller: AutocompleteGroupController, - private val session: Session +class AutocompleteGroupPresenter @Inject constructor( + context: Context, + private val controller: AutocompleteGroupController, + private val session: Session ) : RecyclerViewPresenter(context), AutocompleteClickListener { init { diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt index 88d015ec0c..a480b1c279 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt @@ -36,10 +36,11 @@ import org.matrix.android.sdk.api.session.room.model.PowerLevelsContent import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary import org.matrix.android.sdk.api.util.MatrixItem -class AutocompleteMemberPresenter @AssistedInject constructor(context: Context, - @Assisted val roomId: String, - private val session: Session, - private val controller: AutocompleteMemberController +class AutocompleteMemberPresenter @AssistedInject constructor( + context: Context, + @Assisted val roomId: String, + private val session: Session, + private val controller: AutocompleteMemberController ) : RecyclerViewPresenter(context), AutocompleteClickListener { /* ========================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/room/AutocompleteRoomPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/room/AutocompleteRoomPresenter.kt index d9310e295d..2d61508796 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/room/AutocompleteRoomPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/room/AutocompleteRoomPresenter.kt @@ -26,9 +26,10 @@ import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams import javax.inject.Inject -class AutocompleteRoomPresenter @Inject constructor(context: Context, - private val controller: AutocompleteRoomController, - private val session: Session +class AutocompleteRoomPresenter @Inject constructor( + context: Context, + private val controller: AutocompleteRoomController, + private val session: Session ) : RecyclerViewPresenter(context), AutocompleteClickListener { init { diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt index a904658e9c..daafecc643 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt @@ -706,13 +706,15 @@ class VectorCallActivity : VectorBaseActivity(), CallContro } } - fun newIntent(context: Context, - callId: String, - signalingRoomId: String, - otherUserId: String, - isIncomingCall: Boolean, - isVideoCall: Boolean, - mode: String?): Intent { + fun newIntent( + context: Context, + callId: String, + signalingRoomId: String, + otherUserId: String, + isIncomingCall: Boolean, + isVideoCall: Boolean, + mode: String? + ): Intent { val callArgs = CallArgs(signalingRoomId, callId, otherUserId, isIncomingCall, isVideoCall) return Intent(context, VectorCallActivity::class.java).apply { // what could be the best flags? diff --git a/vector/src/main/java/im/vector/app/features/call/audio/API21AudioDeviceDetector.kt b/vector/src/main/java/im/vector/app/features/call/audio/API21AudioDeviceDetector.kt index 15d213e017..1c7dcd841d 100644 --- a/vector/src/main/java/im/vector/app/features/call/audio/API21AudioDeviceDetector.kt +++ b/vector/src/main/java/im/vector/app/features/call/audio/API21AudioDeviceDetector.kt @@ -30,9 +30,10 @@ import timber.log.Timber private val loggerTag = LoggerTag("API21AudioDeviceDetector", LoggerTag.VOIP) -internal class API21AudioDeviceDetector(private val context: Context, - private val audioManager: AudioManager, - private val callAudioManager: CallAudioManager +internal class API21AudioDeviceDetector( + private val context: Context, + private val audioManager: AudioManager, + private val callAudioManager: CallAudioManager ) : CallAudioManager.AudioDeviceDetector, WiredHeadsetStateReceiver.HeadsetEventListener, BluetoothHeadsetReceiver.EventListener { private var bluetoothAdapter: BluetoothAdapter? = null diff --git a/vector/src/main/java/im/vector/app/features/call/audio/API23AudioDeviceDetector.kt b/vector/src/main/java/im/vector/app/features/call/audio/API23AudioDeviceDetector.kt index ccf79cc02d..f4e7687d39 100644 --- a/vector/src/main/java/im/vector/app/features/call/audio/API23AudioDeviceDetector.kt +++ b/vector/src/main/java/im/vector/app/features/call/audio/API23AudioDeviceDetector.kt @@ -23,8 +23,9 @@ import androidx.annotation.RequiresApi import timber.log.Timber @RequiresApi(Build.VERSION_CODES.M) -internal class API23AudioDeviceDetector(private val audioManager: AudioManager, - private val callAudioManager: CallAudioManager +internal class API23AudioDeviceDetector( + private val audioManager: AudioManager, + private val callAudioManager: CallAudioManager ) : CallAudioManager.AudioDeviceDetector { private val onAudioDeviceChangeRunner = Runnable { @@ -45,13 +46,15 @@ internal class API23AudioDeviceDetector(private val audioManager: AudioManager, } private val audioDeviceCallback: AudioDeviceCallback = object : AudioDeviceCallback() { override fun onAudioDevicesAdded( - addedDevices: Array) { + addedDevices: Array + ) { Timber.d(" Audio devices added") onAudioDeviceChange() } override fun onAudioDevicesRemoved( - removedDevices: Array) { + removedDevices: Array + ) { Timber.d(" Audio devices removed") onAudioDeviceChange() } diff --git a/vector/src/main/java/im/vector/app/features/call/audio/DefaultAudioDeviceRouter.kt b/vector/src/main/java/im/vector/app/features/call/audio/DefaultAudioDeviceRouter.kt index c3500c7bc2..8b1c4ded7c 100644 --- a/vector/src/main/java/im/vector/app/features/call/audio/DefaultAudioDeviceRouter.kt +++ b/vector/src/main/java/im/vector/app/features/call/audio/DefaultAudioDeviceRouter.kt @@ -22,8 +22,9 @@ import androidx.media.AudioFocusRequestCompat import androidx.media.AudioManagerCompat import timber.log.Timber -class DefaultAudioDeviceRouter(private val audioManager: AudioManager, - private val callAudioManager: CallAudioManager +class DefaultAudioDeviceRouter( + private val audioManager: AudioManager, + private val callAudioManager: CallAudioManager ) : CallAudioManager.AudioDeviceRouter, AudioManager.OnAudioFocusChangeListener { private var audioFocusLost = false diff --git a/vector/src/main/java/im/vector/app/features/call/conference/ConferenceEvent.kt b/vector/src/main/java/im/vector/app/features/call/conference/ConferenceEvent.kt index 0d8e538eca..6474825fa2 100644 --- a/vector/src/main/java/im/vector/app/features/call/conference/ConferenceEvent.kt +++ b/vector/src/main/java/im/vector/app/features/call/conference/ConferenceEvent.kt @@ -49,8 +49,10 @@ class ConferenceEventEmitter(private val context: Context) { } } -class ConferenceEventObserver(private val context: Context, - private val onBroadcastEvent: (ConferenceEvent) -> Unit) : +class ConferenceEventObserver( + private val context: Context, + private val onBroadcastEvent: (ConferenceEvent) -> Unit +) : DefaultLifecycleObserver { // See https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-android-sdk#listening-for-broadcasted-events diff --git a/vector/src/main/java/im/vector/app/features/call/conference/JitsiCallViewActions.kt b/vector/src/main/java/im/vector/app/features/call/conference/JitsiCallViewActions.kt index 7c9b9385f9..be0d8775d6 100644 --- a/vector/src/main/java/im/vector/app/features/call/conference/JitsiCallViewActions.kt +++ b/vector/src/main/java/im/vector/app/features/call/conference/JitsiCallViewActions.kt @@ -19,8 +19,10 @@ package im.vector.app.features.call.conference import im.vector.app.core.platform.VectorViewModelAction sealed class JitsiCallViewActions : VectorViewModelAction { - data class SwitchTo(val args: VectorJitsiActivity.Args, - val withConfirmation: Boolean) : JitsiCallViewActions() + data class SwitchTo( + val args: VectorJitsiActivity.Args, + val withConfirmation: Boolean + ) : JitsiCallViewActions() /** * The ViewModel will either ask the View to finish, or to join another conf. diff --git a/vector/src/main/java/im/vector/app/features/call/conference/VectorJitsiActivity.kt b/vector/src/main/java/im/vector/app/features/call/conference/VectorJitsiActivity.kt index 5a12337e4f..be917c61b2 100644 --- a/vector/src/main/java/im/vector/app/features/call/conference/VectorJitsiActivity.kt +++ b/vector/src/main/java/im/vector/app/features/call/conference/VectorJitsiActivity.kt @@ -138,8 +138,10 @@ class VectorJitsiActivity : VectorBaseActivity(), JitsiMee .show() } - override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, - newConfig: Configuration) { + override fun onPictureInPictureModeChanged( + isInPictureInPictureMode: Boolean, + newConfig: Configuration + ) { super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig) checkIfActivityShouldBeFinished() Timber.w("onPictureInPictureModeChanged($isInPictureInPictureMode)") diff --git a/vector/src/main/java/im/vector/app/features/call/conference/jwt/JitsiJWTFactory.kt b/vector/src/main/java/im/vector/app/features/call/conference/jwt/JitsiJWTFactory.kt index 39b87c5d63..8809606e6e 100644 --- a/vector/src/main/java/im/vector/app/features/call/conference/jwt/JitsiJWTFactory.kt +++ b/vector/src/main/java/im/vector/app/features/call/conference/jwt/JitsiJWTFactory.kt @@ -29,11 +29,13 @@ class JitsiJWTFactory @Inject constructor() { * Create a JWT token for jitsi openidtoken-jwt authentication * See https://github.com/matrix-org/prosody-mod-auth-matrix-user-verification */ - fun create(openIdToken: OpenIdToken, - jitsiServerDomain: String, - roomId: String, - userAvatarUrl: String, - userDisplayName: String): String { + fun create( + openIdToken: OpenIdToken, + jitsiServerDomain: String, + roomId: String, + userAvatarUrl: String, + userDisplayName: String + ): String { // The secret key here is irrelevant, we're only using the JWT to transport data to Prosody in the Jitsi stack. val key = Keys.secretKeyFor(SignatureAlgorithm.HS256) val context = mapOf( diff --git a/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadFragment.kt b/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadFragment.kt index 606ba1d1e9..05337e2064 100644 --- a/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadFragment.kt +++ b/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadFragment.kt @@ -73,7 +73,8 @@ class DialPadFragment : Fragment(), TextWatcher { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { + savedInstanceState: Bundle? + ): View { initArgs(savedInstanceState) val view = inflater.inflate(R.layout.dialpad_fragment, container, false) view.setBackgroundColor(ThemeUtils.getColor(requireContext(), R.attr.backgroundColor)) diff --git a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt index 67f0949dcf..189b1ab2a7 100644 --- a/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/call/transfer/CallTransferViewModel.kt @@ -29,8 +29,10 @@ import im.vector.app.features.call.webrtc.WebRtcCallManager import org.matrix.android.sdk.api.session.call.CallState import org.matrix.android.sdk.api.session.call.MxCall -class CallTransferViewModel @AssistedInject constructor(@Assisted initialState: CallTransferViewState, - private val callManager: WebRtcCallManager) : +class CallTransferViewModel @AssistedInject constructor( + @Assisted initialState: CallTransferViewState, + private val callManager: WebRtcCallManager +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/command/Command.kt b/vector/src/main/java/im/vector/app/features/command/Command.kt index 24b4ed5300..20c8f9d8fe 100644 --- a/vector/src/main/java/im/vector/app/features/command/Command.kt +++ b/vector/src/main/java/im/vector/app/features/command/Command.kt @@ -24,12 +24,14 @@ import im.vector.app.R * The user can write theses messages to perform some actions. * The list will be displayed in this order. */ -enum class Command(val command: String, - val aliases: Array?, - val parameters: String, - @StringRes val description: Int, - val isDevCommand: Boolean, - val isThreadCommand: Boolean) { +enum class Command( + val command: String, + val aliases: Array?, + val parameters: String, + @StringRes val description: Int, + val isDevCommand: Boolean, + val isThreadCommand: Boolean +) { EMOTE("/me", null, "", R.string.command_description_emote, false, true), BAN_USER("/ban", null, " [reason]", R.string.command_description_ban_user, false, false), UNBAN_USER("/unban", null, " [reason]", R.string.command_description_unban_user, false, false), diff --git a/vector/src/main/java/im/vector/app/features/consent/ConsentNotGivenHelper.kt b/vector/src/main/java/im/vector/app/features/consent/ConsentNotGivenHelper.kt index 463954dff7..d2bb6b78b0 100644 --- a/vector/src/main/java/im/vector/app/features/consent/ConsentNotGivenHelper.kt +++ b/vector/src/main/java/im/vector/app/features/consent/ConsentNotGivenHelper.kt @@ -24,8 +24,10 @@ import im.vector.app.core.platform.Restorable import im.vector.app.features.webview.VectorWebViewActivity import im.vector.app.features.webview.WebViewMode -class ConsentNotGivenHelper(private val activity: Activity, - private val dialogLocker: DialogLocker) : +class ConsentNotGivenHelper( + private val activity: Activity, + private val dialogLocker: DialogLocker +) : Restorable by dialogLocker { /* ========================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookController.kt b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookController.kt index 219be0abeb..2530e9c867 100644 --- a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookController.kt +++ b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookController.kt @@ -35,7 +35,8 @@ import javax.inject.Inject class ContactsBookController @Inject constructor( private val stringProvider: StringProvider, private val avatarRenderer: AvatarRenderer, - private val errorFormatter: ErrorFormatter) : EpoxyController() { + private val errorFormatter: ErrorFormatter +) : EpoxyController() { private var state: ContactsBookViewState? = null diff --git a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookFragment.kt b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookFragment.kt index 7425e0ae8a..8cd7f2de45 100644 --- a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookFragment.kt +++ b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookFragment.kt @@ -70,7 +70,7 @@ class ContactsBookFragment @Inject constructor( .allowBack(useCross = true) contactsBookViewModel.observeViewEvents { when (it) { - is ContactsBookViewEvents.Failure -> showFailure(it.throwable) + is ContactsBookViewEvents.Failure -> showFailure(it.throwable) is ContactsBookViewEvents.OnPoliciesRetrieved -> showConsentDialog(it) } } diff --git a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookViewModel.kt b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookViewModel.kt index d016558764..402fc40c9a 100644 --- a/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/contactsbook/ContactsBookViewModel.kt @@ -160,10 +160,10 @@ class ContactsBookViewModel @AssistedInject constructor( override fun handle(action: ContactsBookAction) { when (action) { - is ContactsBookAction.FilterWith -> handleFilterWith(action) + is ContactsBookAction.FilterWith -> handleFilterWith(action) is ContactsBookAction.OnlyBoundContacts -> handleOnlyBoundContacts(action) - ContactsBookAction.UserConsentGranted -> handleUserConsentGranted() - ContactsBookAction.UserConsentRequest -> handleUserConsentRequest() + ContactsBookAction.UserConsentGranted -> handleUserConsentGranted() + ContactsBookAction.UserConsentRequest -> handleUserConsentRequest() } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/keys/KeysImporter.kt b/vector/src/main/java/im/vector/app/features/crypto/keys/KeysImporter.kt index 4b27111851..b360055bc9 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keys/KeysImporter.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keys/KeysImporter.kt @@ -33,9 +33,11 @@ class KeysImporter @Inject constructor( /** * Import keys from provided Uri. */ - suspend fun import(uri: Uri, - mimetype: String?, - password: String): ImportRoomKeysResult { + suspend fun import( + uri: Uri, + mimetype: String?, + password: String + ): ImportRoomKeysResult { return withContext(Dispatchers.IO) { val resource = openResource(context, uri, mimetype ?: getMimeTypeFromUri(context, uri)) val stream = resource?.mContentStream ?: throw Exception("Error") diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreSharedViewModel.kt index a8c3f41efe..df24666285 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreSharedViewModel.kt @@ -83,7 +83,7 @@ class KeysBackupRestoreSharedViewModel @Inject constructor( val progressObserver = object : StepProgressListener { override fun onStepProgress(step: StepProgressListener.Step) { when (step) { - is StepProgressListener.Step.ComputingKey -> { + is StepProgressListener.Step.ComputingKey -> { loadingEvent.postValue( WaitingViewData( stringProvider.getString(R.string.keys_backup_restoring_waiting_message) + @@ -102,7 +102,7 @@ class KeysBackupRestoreSharedViewModel @Inject constructor( ) ) } - is StepProgressListener.Step.ImportingKey -> { + is StepProgressListener.Step.ImportingKey -> { Timber.d("backupKeys.ImportingKey.progress: ${step.progress}") // Progress 0 can take a while, display an indeterminate progress in this case if (step.progress == 0) { diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingViewState.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingViewState.kt index 7c1105277b..8d43b72ad9 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingViewState.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingViewState.kt @@ -23,8 +23,10 @@ import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupState import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupVersionTrust import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysVersionResult -data class KeysBackupSettingViewState(val keysBackupVersionTrust: Async = Uninitialized, - val keysBackupState: KeysBackupState? = null, - val keysBackupVersion: KeysVersionResult? = null, - val deleteBackupRequest: Async = Uninitialized) : +data class KeysBackupSettingViewState( + val keysBackupVersionTrust: Async = Uninitialized, + val keysBackupState: KeysBackupState? = null, + val keysBackupVersion: KeysVersionResult? = null, + val deleteBackupRequest: Async = Uninitialized +) : MavericksState diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsViewModel.kt index b47b84af71..f9fd1d1cc1 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsViewModel.kt @@ -41,8 +41,9 @@ import org.matrix.android.sdk.api.util.awaitCallback import org.matrix.android.sdk.api.util.toBase64NoPadding import timber.log.Timber -class KeysBackupSettingsViewModel @AssistedInject constructor(@Assisted initialState: KeysBackupSettingViewState, - private val session: Session +class KeysBackupSettingsViewModel @AssistedInject constructor( + @Assisted initialState: KeysBackupSettingViewState, + private val session: Session ) : VectorViewModel(initialState), KeysBackupStateListener { diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysrequest/KeyRequestHandler.kt b/vector/src/main/java/im/vector/app/features/crypto/keysrequest/KeyRequestHandler.kt index 034c667aac..b234b3109b 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysrequest/KeyRequestHandler.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysrequest/KeyRequestHandler.kt @@ -143,12 +143,14 @@ class KeyRequestHandler @Inject constructor( }) } - private fun postAlert(context: Context, - userId: String, - deviceId: String, - wasNewDevice: Boolean, - deviceInfo: CryptoDeviceInfo?, - moreInfo: DeviceInfo? = null) { + private fun postAlert( + context: Context, + userId: String, + deviceId: String, + wasNewDevice: Boolean, + deviceInfo: CryptoDeviceInfo?, + moreInfo: DeviceInfo? = null + ) { val deviceName = if (deviceInfo!!.displayName().isNullOrEmpty()) deviceInfo.deviceId else deviceInfo.displayName() val dialogText: String? diff --git a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageActivity.kt b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageActivity.kt index 40ad2859fe..ed3e6a146b 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageActivity.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageActivity.kt @@ -149,10 +149,12 @@ class SharedSecureStorageActivity : const val EXTRA_DATA_RESET = "EXTRA_DATA_RESET" const val DEFAULT_RESULT_KEYSTORE_ALIAS = "SharedSecureStorageActivity" - fun newReadIntent(context: Context, - keyId: String? = null, - requestedSecrets: List, - resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS): Intent { + fun newReadIntent( + context: Context, + keyId: String? = null, + requestedSecrets: List, + resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS + ): Intent { require(requestedSecrets.isNotEmpty()) return Intent(context, SharedSecureStorageActivity::class.java).also { it.putExtra( @@ -166,10 +168,12 @@ class SharedSecureStorageActivity : } } - fun newWriteIntent(context: Context, - keyId: String? = null, - writeSecrets: List>, - resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS): Intent { + fun newWriteIntent( + context: Context, + keyId: String? = null, + writeSecrets: List>, + resultKeyStoreAlias: String = DEFAULT_RESULT_KEYSTORE_ALIAS + ): Intent { require(writeSecrets.isNotEmpty()) return Intent(context, SharedSecureStorageActivity::class.java).also { it.putExtra( diff --git a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModel.kt index e045ac020d..6963f7ab49 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModel.kt @@ -86,7 +86,8 @@ data class SharedSecureStorageViewState( class SharedSecureStorageViewModel @AssistedInject constructor( @Assisted private val initialState: SharedSecureStorageViewState, private val stringProvider: StringProvider, - private val session: Session) : + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt index e0aa4592a4..91bb3fa7f2 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/IncomingVerificationRequestHandler.kt @@ -65,7 +65,7 @@ class IncomingVerificationRequestHandler @Inject constructor( // TODO maybe check also if val uid = "kvr_${tx.transactionId}" when (tx.state) { - is VerificationTxState.OnStarted -> { + is VerificationTxState.OnStarted -> { // Add a notification for every incoming request val user = session?.userService()?.getUser(tx.otherUserId) val name = user?.toMatrixItem()?.getBestName() ?: tx.otherUserId @@ -116,7 +116,7 @@ class IncomingVerificationRequestHandler @Inject constructor( // cancel related notification popupAlertManager.cancelAlert(uid) } - else -> Unit + else -> Unit } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt index dc79136cad..bf2c62a647 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt @@ -95,12 +95,14 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment dismiss() is VerificationBottomSheetViewEvents.AccessSecretStore -> { - secretStartForActivityResult.launch(SharedSecureStorageActivity.newReadIntent( - requireContext(), - null, // use default key - listOf(MASTER_KEY_SSSS_NAME, USER_SIGNING_KEY_SSSS_NAME, SELF_SIGNING_KEY_SSSS_NAME, KEYBACKUP_SECRET_SSSS_NAME), - SharedSecureStorageActivity.DEFAULT_RESULT_KEYSTORE_ALIAS - )) + secretStartForActivityResult.launch( + SharedSecureStorageActivity.newReadIntent( + requireContext(), + null, // use default key + listOf(MASTER_KEY_SSSS_NAME, USER_SIGNING_KEY_SSSS_NAME, SELF_SIGNING_KEY_SSSS_NAME, KEYBACKUP_SECRET_SSSS_NAME), + SharedSecureStorageActivity.DEFAULT_RESULT_KEYSTORE_ALIAS + ) + ) } is VerificationBottomSheetViewEvents.ModalError -> { MaterialAlertDialogBuilder(requireContext()) diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt index b65ce4b30b..26480e6770 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheetViewModel.kt @@ -94,7 +94,8 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( @Assisted initialState: VerificationBottomSheetViewState, private val session: Session, private val supportedVerificationMethodsProvider: SupportedVerificationMethodsProvider, - private val stringProvider: StringProvider) : + private val stringProvider: StringProvider +) : VectorViewModel(initialState), VerificationService.Listener { diff --git a/vector/src/main/java/im/vector/app/features/discovery/Extensions.kt b/vector/src/main/java/im/vector/app/features/discovery/Extensions.kt index dc25a35646..1efe9f7bc2 100644 --- a/vector/src/main/java/im/vector/app/features/discovery/Extensions.kt +++ b/vector/src/main/java/im/vector/app/features/discovery/Extensions.kt @@ -36,9 +36,11 @@ suspend fun Session.fetchHomeserverWithTerms(userLanguage: String): ServerAndPol return buildServerAndPolicies(homeserverUrl, terms, userLanguage) } -private fun buildServerAndPolicies(serviceUrl: String, - termsResponse: TermsResponse, - userLanguage: String): ServerAndPolicies { +private fun buildServerAndPolicies( + serviceUrl: String, + termsResponse: TermsResponse, + userLanguage: String +): ServerAndPolicies { val terms = termsResponse.getLocalizedTerms(userLanguage) val policyUrls = terms.mapNotNull { val name = it.localizedName ?: it.policyName diff --git a/vector/src/main/java/im/vector/app/features/discovery/change/SetIdentityServerViewModel.kt b/vector/src/main/java/im/vector/app/features/discovery/change/SetIdentityServerViewModel.kt index ae1c7f7753..c5dc0c17ea 100644 --- a/vector/src/main/java/im/vector/app/features/discovery/change/SetIdentityServerViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/discovery/change/SetIdentityServerViewModel.kt @@ -38,7 +38,8 @@ import java.net.UnknownHostException class SetIdentityServerViewModel @AssistedInject constructor( @Assisted initialState: SetIdentityServerState, private val mxSession: Session, - stringProvider: StringProvider) : + stringProvider: StringProvider +) : VectorViewModel(initialState) { @AssistedFactory 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 cb24382e6a..d02f8f0bd4 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 @@ -55,9 +55,11 @@ import javax.inject.Inject /** * This helper centralise ways to retrieve avatar into ImageView or even generic Target. */ -class AvatarRenderer @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, - private val matrixItemColorProvider: MatrixItemColorProvider, - private val dimensionConverter: DimensionConverter) { +class AvatarRenderer @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val matrixItemColorProvider: MatrixItemColorProvider, + private val dimensionConverter: DimensionConverter +) { companion object { private const val THUMBNAIL_SIZE = 250 @@ -150,9 +152,11 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active } @UiThread - fun render(glideRequests: GlideRequests, - matrixItem: MatrixItem, - target: Target) { + fun render( + glideRequests: GlideRequests, + matrixItem: MatrixItem, + target: Target + ) { val placeholder = getPlaceholderDrawable(matrixItem) glideRequests.loadResolvedUrl(matrixItem.avatarUrl) .let { @@ -182,10 +186,12 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active @AnyThread @Throws - fun adaptiveShortcutDrawable(glideRequests: GlideRequests, - matrixItem: MatrixItem, iconSize: Int, - adaptiveIconSize: Int, - adaptiveIconOuterSides: Float): Bitmap { + fun adaptiveShortcutDrawable( + glideRequests: GlideRequests, + matrixItem: MatrixItem, iconSize: Int, + adaptiveIconSize: Int, + adaptiveIconOuterSides: Float + ): Bitmap { return glideRequests .asBitmap() .avatarOrText(matrixItem, iconSize) @@ -216,12 +222,14 @@ class AvatarRenderer @Inject constructor(private val activeSessionHolder: Active } @UiThread - fun renderBlur(matrixItem: MatrixItem, - imageView: ImageView, - sampling: Int, - rounded: Boolean, - @ColorInt colorFilter: Int? = null, - addPlaceholder: Boolean) { + fun renderBlur( + matrixItem: MatrixItem, + imageView: ImageView, + sampling: Int, + rounded: Boolean, + @ColorInt colorFilter: Int? = null, + addPlaceholder: Boolean + ) { val transformations = mutableListOf>( BlurTransformation(20, sampling) ) 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 ee9340f37d..05e36d1fe5 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 @@ -592,11 +592,12 @@ class HomeActivity : } companion object { - fun newIntent(context: Context, - clearNotification: Boolean = false, - accountCreation: Boolean = false, - existingSession: Boolean = false, - inviteNotificationRoomId: String? = null + fun newIntent( + context: Context, + clearNotification: Boolean = false, + accountCreation: Boolean = false, + existingSession: Boolean = false, + inviteNotificationRoomId: String? = null ): Intent { val args = HomeActivityArgs( clearNotification = clearNotification, diff --git a/vector/src/main/java/im/vector/app/features/home/UnreadMessagesSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/home/UnreadMessagesSharedViewModel.kt index c1b3937fee..582b10b871 100644 --- a/vector/src/main/java/im/vector/app/features/home/UnreadMessagesSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/UnreadMessagesSharedViewModel.kt @@ -55,11 +55,13 @@ data class CountInfo( val otherCount: RoomAggregateNotificationCount ) -class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initialState: UnreadMessagesState, - session: Session, - private val vectorPreferences: VectorPreferences, - appStateHandler: AppStateHandler, - private val autoAcceptInvites: AutoAcceptInvites) : +class UnreadMessagesSharedViewModel @AssistedInject constructor( + @Assisted initialState: UnreadMessagesState, + session: Session, + private val vectorPreferences: VectorPreferences, + appStateHandler: AppStateHandler, + private val autoAcceptInvites: AutoAcceptInvites +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt index 112b7e8574..651c323c86 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt @@ -31,8 +31,10 @@ import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams import org.matrix.android.sdk.flow.flow -class BreadcrumbsViewModel @AssistedInject constructor(@Assisted initialState: BreadcrumbsViewState, - private val session: Session) : +class BreadcrumbsViewModel @AssistedInject constructor( + @Assisted initialState: BreadcrumbsViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/JumpToBottomViewVisibilityManager.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/JumpToBottomViewVisibilityManager.kt index 7c0dcbb0d2..58da62d503 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/JumpToBottomViewVisibilityManager.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/JumpToBottomViewVisibilityManager.kt @@ -31,7 +31,8 @@ class JumpToBottomViewVisibilityManager( private val jumpToBottomView: FloatingActionButton, private val debouncer: Debouncer, recyclerView: RecyclerView, - private val layoutManager: LinearLayoutManager) { + private val layoutManager: LinearLayoutManager +) { init { recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt index f6ea8b76ef..64670c73ac 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailAction.kt @@ -60,7 +60,8 @@ sealed class RoomDetailAction : VectorViewModelAction { val senderId: String?, val reason: String, val spam: Boolean = false, - val inappropriate: Boolean = false) : RoomDetailAction() + val inappropriate: Boolean = false + ) : RoomDetailAction() data class IgnoreUser(val userId: String?) : RoomDetailAction() @@ -86,9 +87,11 @@ sealed class RoomDetailAction : VectorViewModelAction { object JoinJitsiCall : RoomDetailAction() object LeaveJitsiCall : RoomDetailAction() - data class EnsureNativeWidgetAllowed(val widget: Widget, - val userJustAccepted: Boolean, - val grantedEvents: RoomDetailViewEvents) : RoomDetailAction() + data class EnsureNativeWidgetAllowed( + val widget: Widget, + val userJustAccepted: Boolean, + val grantedEvents: RoomDetailViewEvents + ) : RoomDetailAction() data class UpdateJoinJitsiCallStatus(val conferenceEvent: ConferenceEvent) : RoomDetailAction() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt index b168bfea97..4d57647a1d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewEvents.kt @@ -75,9 +75,11 @@ sealed class RoomDetailViewEvents : VectorViewEvents { object OpenIntegrationManager : RoomDetailViewEvents() object OpenActiveWidgetBottomSheet : RoomDetailViewEvents() - data class RequestNativeWidgetPermission(val widget: Widget, - val domain: String, - val grantedEvents: RoomDetailViewEvents) : RoomDetailViewEvents() + data class RequestNativeWidgetPermission( + val widget: Widget, + val domain: String, + val grantedEvents: RoomDetailViewEvents + ) : RoomDetailViewEvents() data class StartChatEffect(val type: ChatEffect) : RoomDetailViewEvents() object StopChatEffects : RoomDetailViewEvents() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomMessageTouchHelperCallback.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomMessageTouchHelperCallback.kt index 1f1124b8c0..5a1342b7da 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomMessageTouchHelperCallback.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomMessageTouchHelperCallback.kt @@ -98,13 +98,15 @@ class RoomMessageTouchHelperCallback( return super.convertToAbsoluteDirection(flags, layoutDirection) } - override fun onChildDraw(c: Canvas, - recyclerView: RecyclerView, - viewHolder: EpoxyViewHolder, - dX: Float, - dY: Float, - actionState: Int, - isCurrentlyActive: Boolean) { + override fun onChildDraw( + c: Canvas, + recyclerView: RecyclerView, + viewHolder: EpoxyViewHolder, + dX: Float, + dY: Float, + actionState: Int, + isCurrentlyActive: Boolean + ) { if (actionState == ACTION_STATE_SWIPE) { setTouchListener(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive) } @@ -119,13 +121,15 @@ class RoomMessageTouchHelperCallback( @Suppress("UNUSED_PARAMETER") @SuppressLint("ClickableViewAccessibility") - private fun setTouchListener(c: Canvas, - recyclerView: RecyclerView, - viewHolder: EpoxyViewHolder, - dX: Float, - dY: Float, - actionState: Int, - isCurrentlyActive: Boolean) { + private fun setTouchListener( + c: Canvas, + recyclerView: RecyclerView, + viewHolder: EpoxyViewHolder, + dX: Float, + dY: Float, + actionState: Int, + isCurrentlyActive: Boolean + ) { // TODO can this interfere with other interactions? should i remove it recyclerView.setOnTouchListener { _, event -> swipeBack = event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnHighlightedEventCallback.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnHighlightedEventCallback.kt index 7f652a2eea..3f9d7beb74 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnHighlightedEventCallback.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnHighlightedEventCallback.kt @@ -25,9 +25,11 @@ import java.util.concurrent.atomic.AtomicReference /** * This handles scrolling to an event which wasn't yet loaded when scheduled. */ -class ScrollOnHighlightedEventCallback(private val recyclerView: RecyclerView, - private val layoutManager: LinearLayoutManager, - private val timelineEventController: TimelineEventController) : DefaultListUpdateCallback { +class ScrollOnHighlightedEventCallback( + private val recyclerView: RecyclerView, + private val layoutManager: LinearLayoutManager, + private val timelineEventController: TimelineEventController +) : DefaultListUpdateCallback { private val scheduledEventId = AtomicReference() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt index 249618e12f..467906ac59 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/ScrollOnNewMessageCallback.kt @@ -23,8 +23,10 @@ import im.vector.app.features.home.room.detail.timeline.item.ItemWithEvents import org.matrix.android.sdk.api.extensions.tryOrNull import java.util.concurrent.CopyOnWriteArrayList -class ScrollOnNewMessageCallback(private val layoutManager: LinearLayoutManager, - private val timelineEventController: TimelineEventController) : DefaultListUpdateCallback { +class ScrollOnNewMessageCallback( + private val layoutManager: LinearLayoutManager, + private val timelineEventController: TimelineEventController +) : DefaultListUpdateCallback { private val newTimelineEventIds = CopyOnWriteArrayList() private var forceScroll = false diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt index d75b9ff69d..97cc58e78c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/StartCallActionsHandler.kt @@ -35,7 +35,8 @@ class StartCallActionsHandler( private val timelineViewModel: TimelineViewModel, private val startCallActivityResultLauncher: ActivityResultLauncher>, private val showDialogWithMessage: (String) -> Unit, - private val onTapToReturnToCall: () -> Unit) { + private val onTapToReturnToCall: () -> Unit +) { fun onVideoCallClicked() { handleCallRequest(true) 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 635b00c05d..b48a06d927 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 @@ -1230,10 +1230,12 @@ class TimelineFragment @Inject constructor( views.composerLayout.views.sendButton.contentDescription = getString(R.string.action_send) } - private fun renderSpecialMode(event: TimelineEvent, - @DrawableRes iconRes: Int, - @StringRes descriptionRes: Int, - defaultContent: String) { + private fun renderSpecialMode( + event: TimelineEvent, + @DrawableRes iconRes: Int, + @StringRes descriptionRes: Int, + defaultContent: String + ) { autoCompleter.enterSpecialMode() // switch to expanded bar views.composerLayout.views.composerRelatedMessageTitle.apply { @@ -1958,10 +1960,12 @@ class TimelineFragment @Inject constructor( vectorBaseActivity.notImplemented("encrypted message click") } - override fun onImageMessageClicked(messageImageContent: MessageImageInfoContent, - mediaData: ImageContentRenderer.Data, - view: View, - inMemory: List) { + override fun onImageMessageClicked( + messageImageContent: MessageImageInfoContent, + mediaData: ImageContentRenderer.Data, + view: View, + inMemory: List + ) { navigator.openMediaViewer( activity = requireActivity(), roomId = timelineArgs.roomId, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerView.kt index e77ad66a9f..1522960cc9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerView.kt @@ -39,7 +39,8 @@ import im.vector.app.databinding.ComposerLayoutBinding class MessageComposerView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr) { + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { interface Callback : ComposerEditText.Callback { fun onCloseRelatedMessage() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsController.kt index 5246906223..76f2d72456 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/readreceipts/DisplayReadReceiptsController.kt @@ -28,9 +28,11 @@ import javax.inject.Inject /** * Epoxy controller for read receipt event list. */ -class DisplayReadReceiptsController @Inject constructor(private val dateFormatter: VectorDateFormatter, - private val session: Session, - private val avatarRender: AvatarRenderer) : +class DisplayReadReceiptsController @Inject constructor( + private val dateFormatter: VectorDateFormatter, + private val session: Session, + private val avatarRender: AvatarRenderer +) : TypedEpoxyController>() { var listener: Listener? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/MessageColorProvider.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/MessageColorProvider.kt index 2b39eb1e26..8214029a3a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/MessageColorProvider.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/MessageColorProvider.kt @@ -28,7 +28,8 @@ import javax.inject.Inject class MessageColorProvider @Inject constructor( private val colorProvider: ColorProvider, private val matrixItemColorProvider: MatrixItemColorProvider, - private val vectorPreferences: VectorPreferences) { + private val vectorPreferences: VectorPreferences +) { @ColorInt fun getMemberNameTextColor(matrixItem: MatrixItem): Int { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt index a601870ae8..a02eaa3202 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt @@ -131,10 +131,12 @@ class TimelineEventController @Inject constructor( fun onEventVisible(event: TimelineEvent) fun onRoomCreateLinkClicked(url: String) fun onEncryptedMessageClicked(informationData: MessageInformationData, view: View) - fun onImageMessageClicked(messageImageContent: MessageImageInfoContent, - mediaData: ImageContentRenderer.Data, - view: View, - inMemory: List) + fun onImageMessageClicked( + messageImageContent: MessageImageInfoContent, + mediaData: ImageContentRenderer.Data, + view: View, + inMemory: List + ) fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View) @@ -474,10 +476,12 @@ class TimelineEventController @Inject constructor( ) } - private fun CacheItemData.enrichWithModels(event: TimelineEvent, - nextEvent: TimelineEvent?, - position: Int, - receiptsByEvents: Map>): CacheItemData { + private fun CacheItemData.enrichWithModels( + event: TimelineEvent, + nextEvent: TimelineEvent?, + position: Int, + receiptsByEvents: Map> + ): CacheItemData { val wantsDateSeparator = wantsDateSeparator(event, nextEvent) val mergedHeaderModel = mergedHeaderItemFactory.create( event, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/EventSharedAction.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/EventSharedAction.kt index 5f12c2f174..0be462835d 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/EventSharedAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/EventSharedAction.kt @@ -24,9 +24,11 @@ import im.vector.app.features.home.room.detail.timeline.item.MessageInformationD import org.matrix.android.sdk.api.session.room.model.message.MessageContent import org.matrix.android.sdk.api.session.room.model.message.MessageWithAttachmentContent -sealed class EventSharedAction(@StringRes val titleRes: Int, - @DrawableRes val iconResId: Int, - val destructive: Boolean = false) : VectorSharedAction { +sealed class EventSharedAction( + @StringRes val titleRes: Int, + @DrawableRes val iconResId: Int, + val destructive: Boolean = false +) : VectorSharedAction { object Separator : EventSharedAction(0, 0) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt index 4bc513284b..6473191669 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt @@ -280,10 +280,12 @@ class MessageActionsViewModel @AssistedInject constructor( } } - private fun ArrayList.addActionsForFailedState(timelineEvent: TimelineEvent, - actionPermissions: ActionPermissions, - messageContent: MessageContent?, - msgType: String?) { + private fun ArrayList.addActionsForFailedState( + timelineEvent: TimelineEvent, + actionPermissions: ActionPermissions, + messageContent: MessageContent?, + msgType: String? + ) { val eventId = timelineEvent.eventId if (canRetry(timelineEvent, actionPermissions)) { add(EventSharedAction.Resend(eventId)) @@ -320,10 +322,12 @@ class MessageActionsViewModel @AssistedInject constructor( // TODO sent by me or sufficient power level } - private fun ArrayList.addActionsForSyncedState(timelineEvent: TimelineEvent, - actionPermissions: ActionPermissions, - messageContent: MessageContent?, - msgType: String?) { + private fun ArrayList.addActionsForSyncedState( + timelineEvent: TimelineEvent, + actionPermissions: ActionPermissions, + messageContent: MessageContent?, + msgType: String? + ) { val eventId = timelineEvent.eventId if (!timelineEvent.root.isRedacted()) { if (canReply(timelineEvent, messageContent, actionPermissions)) { @@ -452,9 +456,11 @@ class MessageActionsViewModel @AssistedInject constructor( * Determine whether or not the Reply In Thread bottom sheet action will be visible * to the user. */ - private fun canReplyInThread(event: TimelineEvent, - messageContent: MessageContent?, - actionPermissions: ActionPermissions): Boolean { + private fun canReplyInThread( + event: TimelineEvent, + messageContent: MessageContent?, + actionPermissions: ActionPermissions + ): Boolean { // We let reply in thread visible even if threads are not enabled, with an enhanced flow to attract users // if (!vectorPreferences.areThreadMessagesEnabled()) return false // Disable beta prompt if the homeserver do not support threads @@ -483,9 +489,11 @@ class MessageActionsViewModel @AssistedInject constructor( /** * Determine whether or not the view in room action will be available for the current event. */ - private fun canViewInRoom(event: TimelineEvent, - messageContent: MessageContent?, - actionPermissions: ActionPermissions): Boolean { + private fun canViewInRoom( + event: TimelineEvent, + messageContent: MessageContent?, + actionPermissions: ActionPermissions + ): Boolean { if (!vectorPreferences.areThreadMessagesEnabled()) return false if (!initialState.isFromThreadTimeline) return false if (event.root.getClearType() != EventType.MESSAGE && diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryViewState.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryViewState.kt index dd344c4c82..fc5b58815b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryViewState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/edithistory/ViewEditHistoryViewState.kt @@ -26,7 +26,8 @@ data class ViewEditHistoryViewState( val eventId: String, val roomId: String, val isOriginalAReply: Boolean = false, - val editList: Async> = Uninitialized) : + val editList: Async> = Uninitialized +) : MavericksState { constructor(args: TimelineEventFragmentArgs) : this(roomId = args.roomId, eventId = args.eventId) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt index a5d6f75387..6f955b656b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt @@ -40,7 +40,8 @@ class CallItemFactory @Inject constructor( private val messageInformationDataFactory: MessageInformationDataFactory, private val messageItemAttributesFactory: MessageItemAttributesFactory, private val avatarSizeProvider: AvatarSizeProvider, - private val noticeItemFactory: NoticeItemFactory) { + private val noticeItemFactory: NoticeItemFactory +) { fun create(params: TimelineItemFactoryParams): VectorEpoxyModel<*>? { val event = params.event diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/DefaultItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/DefaultItemFactory.kt index db7b84ed06..d704003627 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/DefaultItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/DefaultItemFactory.kt @@ -27,15 +27,19 @@ import im.vector.app.features.home.room.detail.timeline.item.DefaultItem_ import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData import javax.inject.Inject -class DefaultItemFactory @Inject constructor(private val avatarSizeProvider: AvatarSizeProvider, - private val avatarRenderer: AvatarRenderer, - private val stringProvider: StringProvider, - private val informationDataFactory: MessageInformationDataFactory) { +class DefaultItemFactory @Inject constructor( + private val avatarSizeProvider: AvatarSizeProvider, + private val avatarRenderer: AvatarRenderer, + private val stringProvider: StringProvider, + private val informationDataFactory: MessageInformationDataFactory +) { - fun create(text: String, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?): DefaultItem { + fun create( + text: String, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback? + ): DefaultItem { val attributes = DefaultItem.Attributes( avatarRenderer = avatarRenderer, informationData = informationData, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt index dd91f00ab9..ebfb318cc9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt @@ -37,13 +37,15 @@ import org.matrix.android.sdk.api.session.events.model.toModel import javax.inject.Inject // This class handles timeline events who haven't been successfully decrypted -class EncryptedItemFactory @Inject constructor(private val messageInformationDataFactory: MessageInformationDataFactory, - private val colorProvider: ColorProvider, - private val stringProvider: StringProvider, - private val avatarSizeProvider: AvatarSizeProvider, - private val drawableProvider: DrawableProvider, - private val attributesFactory: MessageItemAttributesFactory, - private val vectorPreferences: VectorPreferences) { +class EncryptedItemFactory @Inject constructor( + private val messageInformationDataFactory: MessageInformationDataFactory, + private val colorProvider: ColorProvider, + private val stringProvider: StringProvider, + private val avatarSizeProvider: AvatarSizeProvider, + private val drawableProvider: DrawableProvider, + private val attributesFactory: MessageItemAttributesFactory, + private val vectorPreferences: VectorPreferences +) { fun create(params: TimelineItemFactoryParams): VectorEpoxyModel<*>? { val event = params.event 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 0cbd92f525..dd058197b4 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 @@ -38,7 +38,8 @@ class EncryptionItemFactory @Inject constructor( private val stringProvider: StringProvider, private val informationDataFactory: MessageInformationDataFactory, private val avatarSizeProvider: AvatarSizeProvider, - private val session: Session) { + private val session: Session +) { fun create(params: TimelineItemFactoryParams): StatusTileTimelineItem? { val event = params.event diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt index 224c1cdbea..8c39584a94 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MergedHeaderItemFactory.kt @@ -46,10 +46,12 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import javax.inject.Inject -class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, - private val avatarRenderer: AvatarRenderer, - private val avatarSizeProvider: AvatarSizeProvider, - private val timelineEventVisibilityHelper: TimelineEventVisibilityHelper) { +class MergedHeaderItemFactory @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val avatarRenderer: AvatarRenderer, + private val avatarSizeProvider: AvatarSizeProvider, + private val timelineEventVisibilityHelper: TimelineEventVisibilityHelper +) { private val collapsedEventIds = linkedSetOf() private val mergeItemCollapseStates = HashMap() @@ -65,15 +67,17 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde * @param callback callback for user event * @param requestModelBuild lambda to let the built Item request a model build when the collapse state is changed */ - fun create(event: TimelineEvent, - nextEvent: TimelineEvent?, - items: List, - partialState: TimelineEventController.PartialState, - addDaySeparator: Boolean, - currentPosition: Int, - eventIdToHighlight: String?, - callback: TimelineEventController.Callback?, - requestModelBuild: () -> Unit): BasedMergedItem<*>? { + fun create( + event: TimelineEvent, + nextEvent: TimelineEvent?, + items: List, + partialState: TimelineEventController.PartialState, + addDaySeparator: Boolean, + currentPosition: Int, + eventIdToHighlight: String?, + callback: TimelineEventController.Callback?, + requestModelBuild: () -> Unit + ): BasedMergedItem<*>? { return if (nextEvent?.root?.getClearType() == EventType.STATE_ROOM_CREATE && event.isRoomConfiguration(nextEvent.root.getClearContent()?.toModel()?.creator)) { // It's the first item before room.create @@ -86,13 +90,15 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde } } - private fun buildMembershipEventsMergedSummary(currentPosition: Int, - items: List, - partialState: TimelineEventController.PartialState, - event: TimelineEvent, - eventIdToHighlight: String?, - requestModelBuild: () -> Unit, - callback: TimelineEventController.Callback?): MergedSimilarEventsItem_? { + private fun buildMembershipEventsMergedSummary( + currentPosition: Int, + items: List, + partialState: TimelineEventController.PartialState, + event: TimelineEvent, + eventIdToHighlight: String?, + requestModelBuild: () -> Unit, + callback: TimelineEventController.Callback? + ): MergedSimilarEventsItem_? { val mergedEvents = timelineEventVisibilityHelper.prevSameTypeEvents( items, currentPosition, @@ -134,9 +140,9 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde } val mergeId = mergedEventIds.joinToString(separator = "_") { it.toString() } val summaryTitleResId = when (event.root.getClearType()) { - EventType.STATE_ROOM_MEMBER -> R.plurals.membership_changes + EventType.STATE_ROOM_MEMBER -> R.plurals.membership_changes EventType.STATE_ROOM_SERVER_ACL -> R.plurals.notice_room_server_acl_changes - else -> null + else -> null } summaryTitleResId?.let { summaryTitle -> val attributes = MergedSimilarEventsItem.Attributes( @@ -161,13 +167,15 @@ class MergedHeaderItemFactory @Inject constructor(private val activeSessionHolde } } - private fun buildRoomCreationMergedSummary(currentPosition: Int, - items: List, - partialState: TimelineEventController.PartialState, - event: TimelineEvent, - eventIdToHighlight: String?, - requestModelBuild: () -> Unit, - callback: TimelineEventController.Callback?): MergedRoomCreationItem_? { + private fun buildRoomCreationMergedSummary( + currentPosition: Int, + items: List, + partialState: TimelineEventController.PartialState, + event: TimelineEvent, + eventIdToHighlight: String?, + requestModelBuild: () -> Unit, + callback: TimelineEventController.Callback? + ): MergedRoomCreationItem_? { var prevEvent = items.prevOrNull(currentPosition) var tmpPos = currentPosition - 1 val mergedEvents = mutableListOf(event) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 13f783cded..e0316017f2 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -501,7 +501,8 @@ class MessageItemFactory @Inject constructor( informationData: MessageInformationData, highlight: Boolean, callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes): MessageTextItem? { + attributes: AbsMessageItem.Attributes + ): MessageTextItem? { // For compatibility reason we should display the body return buildMessageTextItem(messageContent.body, false, informationData, highlight, callback, attributes) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/NoticeItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/NoticeItemFactory.kt index 6951c3c316..d1f2eaf607 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/NoticeItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/NoticeItemFactory.kt @@ -26,10 +26,12 @@ import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence import org.matrix.android.sdk.api.extensions.orFalse import javax.inject.Inject -class NoticeItemFactory @Inject constructor(private val eventFormatter: NoticeEventFormatter, - private val avatarRenderer: AvatarRenderer, - private val informationDataFactory: MessageInformationDataFactory, - private val avatarSizeProvider: AvatarSizeProvider) { +class NoticeItemFactory @Inject constructor( + private val eventFormatter: NoticeEventFormatter, + private val avatarRenderer: AvatarRenderer, + private val informationDataFactory: MessageInformationDataFactory, + private val avatarSizeProvider: AvatarSizeProvider +) { fun create(params: TimelineItemFactoryParams): NoticeItem? { val event = params.event diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt index ed3cc8df53..6a711ec2dc 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/ReadReceiptsItemFactory.kt @@ -30,7 +30,8 @@ class ReadReceiptsItemFactory @Inject constructor(private val avatarRenderer: Av eventId: String, readReceipts: List, callback: TimelineEventController.Callback?, - isFromThreadTimeLine: Boolean): ReadReceiptsItem? { + isFromThreadTimeLine: Boolean + ): ReadReceiptsItem? { if (readReceipts.isEmpty()) { return null } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/RoomCreateItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/RoomCreateItemFactory.kt index fff709f346..33851c808a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/RoomCreateItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/RoomCreateItemFactory.kt @@ -28,10 +28,12 @@ import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent import javax.inject.Inject -class RoomCreateItemFactory @Inject constructor(private val stringProvider: StringProvider, - private val userPreferencesProvider: UserPreferencesProvider, - private val session: Session, - private val noticeItemFactory: NoticeItemFactory) { +class RoomCreateItemFactory @Inject constructor( + private val stringProvider: StringProvider, + private val userPreferencesProvider: UserPreferencesProvider, + private val session: Session, + private val noticeItemFactory: NoticeItemFactory +) { fun create(params: TimelineItemFactoryParams): VectorEpoxyModel<*>? { val event = params.event diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt index 07ae9d66c3..3f94c161d7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactory.kt @@ -158,11 +158,13 @@ class TimelineItemFactory @Inject constructor( ) } - private fun buildEmptyItem(timelineEvent: TimelineEvent, - prevEvent: TimelineEvent?, - highlightedEventId: String?, - rootThreadEventId: String?, - isFromThreadTimeline: Boolean): TimelineEmptyItem { + private fun buildEmptyItem( + timelineEvent: TimelineEvent, + prevEvent: TimelineEvent?, + highlightedEventId: String?, + rootThreadEventId: String?, + isFromThreadTimeline: Boolean + ): TimelineEmptyItem { val isNotBlank = prevEvent == null || timelineEventVisibilityHelper.shouldShowEvent( timelineEvent = prevEvent, highlightedEventId = highlightedEventId, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt index 647b34c626..019028dfd4 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt @@ -37,7 +37,8 @@ class WidgetItemFactory @Inject constructor( private val avatarSizeProvider: AvatarSizeProvider, private val messageColorProvider: MessageColorProvider, private val avatarRenderer: AvatarRenderer, - private val userPreferencesProvider: UserPreferencesProvider) { + private val userPreferencesProvider: UserPreferencesProvider +) { fun create(params: TimelineItemFactoryParams): VectorEpoxyModel<*>? { val event = params.event diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt index 3c2bdb53ab..aeed9e0a41 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt @@ -146,7 +146,8 @@ class DisplayableEventFormatter @Inject constructor( fun formatThreadSummary( event: Event?, - latestEdition: String? = null): CharSequence { + latestEdition: String? = null + ): CharSequence { event ?: return "" // There event have been edited diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt index 8e06b3ee5d..918118f854 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/NoticeEventFormatter.kt @@ -669,11 +669,13 @@ class NoticeEventFormatter @Inject constructor( return displayText.toString() } - private fun buildMembershipNotice(event: Event, - senderName: String?, - eventContent: RoomMemberContent?, - prevEventContent: RoomMemberContent?, - isDm: Boolean): String? { + private fun buildMembershipNotice( + event: Event, + senderName: String?, + eventContent: RoomMemberContent?, + prevEventContent: RoomMemberContent?, + isDm: Boolean + ): String? { val senderDisplayName = senderName ?: event.senderId ?: "" val targetDisplayName = eventContent?.displayName ?: prevEventContent?.displayName ?: event.stateKey ?: "" return when (eventContent?.membership) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt index a34c216fad..99b42a8c61 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/AvatarSizeProvider.kt @@ -21,8 +21,10 @@ import im.vector.app.features.home.room.detail.timeline.style.TimelineLayoutSett import im.vector.app.features.home.room.detail.timeline.style.TimelineLayoutSettingsProvider import javax.inject.Inject -class AvatarSizeProvider @Inject constructor(private val dimensionConverter: DimensionConverter, - private val layoutSettingsProvider: TimelineLayoutSettingsProvider) { +class AvatarSizeProvider @Inject constructor( + private val dimensionConverter: DimensionConverter, + private val layoutSettingsProvider: TimelineLayoutSettingsProvider +) { private val avatarStyle by lazy { when (layoutSettingsProvider.getLayoutSettings()) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt index 8f5f80c834..178007b38a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentDownloadStateTrackerBinder.kt @@ -31,8 +31,10 @@ class ContentDownloadStateTrackerBinder @Inject constructor(private val activeSe private val updateListeners = mutableMapOf() - fun bind(mxcUrl: String, - holder: MessageFileItem.Holder) { + fun bind( + mxcUrl: String, + holder: MessageFileItem.Holder + ) { activeSessionHolder.getSafeActiveSession()?.also { session -> val downloadStateTracker = session.contentDownloadProgressTracker() val updateListener = ContentDownloadUpdater(holder) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt index b8882b3f47..97b2cc6eab 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ContentUploadStateTrackerBinder.kt @@ -33,15 +33,19 @@ import org.matrix.android.sdk.api.session.room.send.SendState import javax.inject.Inject @ActivityScoped -class ContentUploadStateTrackerBinder @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, - private val messageColorProvider: MessageColorProvider, - private val errorFormatter: ErrorFormatter) { +class ContentUploadStateTrackerBinder @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val messageColorProvider: MessageColorProvider, + private val errorFormatter: ErrorFormatter +) { private val updateListeners = mutableMapOf() - fun bind(eventId: String, - isLocalFile: Boolean, - progressLayout: ViewGroup) { + fun bind( + eventId: String, + isLocalFile: Boolean, + progressLayout: ViewGroup + ) { activeSessionHolder.getSafeActiveSession()?.also { session -> val uploadStateTracker = session.contentUploadProgressTracker() val updateListener = ContentMediaProgressUpdater(progressLayout, isLocalFile, messageColorProvider, errorFormatter) @@ -66,10 +70,12 @@ class ContentUploadStateTrackerBinder @Inject constructor(private val activeSess } } -private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup, - private val isLocalFile: Boolean, - private val messageColorProvider: MessageColorProvider, - private val errorFormatter: ErrorFormatter) : ContentUploadStateTracker.UpdateListener { +private class ContentMediaProgressUpdater( + private val progressLayout: ViewGroup, + private val isLocalFile: Boolean, + private val messageColorProvider: MessageColorProvider, + private val errorFormatter: ErrorFormatter +) : ContentUploadStateTracker.UpdateListener { private val progressBar: ProgressBar = progressLayout.findViewById(R.id.mediaProgressBar) private val progressTextView: TextView = progressLayout.findViewById(R.id.mediaProgressTextView) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt index 7874f843e1..e57f61a543 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt @@ -46,10 +46,12 @@ import javax.inject.Inject /** * This class is responsible of building extra information data associated to a given event. */ -class MessageInformationDataFactory @Inject constructor(private val session: Session, - private val dateFormatter: VectorDateFormatter, - private val messageLayoutFactory: TimelineMessageLayoutFactory, - private val reactionsSummaryFactory: ReactionsSummaryFactory) { +class MessageInformationDataFactory @Inject constructor( + private val session: Session, + private val dateFormatter: VectorDateFormatter, + private val messageLayoutFactory: TimelineMessageLayoutFactory, + private val reactionsSummaryFactory: ReactionsSummaryFactory +) { fun create(params: TimelineItemFactoryParams): MessageInformationData { val event = params.event @@ -122,9 +124,11 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses ) } - private fun getSendStateDecoration(event: TimelineEvent, - lastSentEventWithoutReadReceipts: String?, - isMedia: Boolean): SendStateDecoration { + private fun getSendStateDecoration( + event: TimelineEvent, + lastSentEventWithoutReadReceipts: String?, + isMedia: Boolean + ): SendStateDecoration { val eventSendState = event.root.sendState return if (eventSendState.isSending()) { if (isMedia) SendStateDecoration.SENDING_MEDIA else SendStateDecoration.SENDING_NON_MEDIA diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt index 737b0dc85d..d005135032 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt @@ -36,13 +36,16 @@ class MessageItemAttributesFactory @Inject constructor( private val stringProvider: StringProvider, private val displayableEventFormatter: DisplayableEventFormatter, private val preferencesProvider: UserPreferencesProvider, - private val emojiCompatFontProvider: EmojiCompatFontProvider) { + private val emojiCompatFontProvider: EmojiCompatFontProvider +) { - fun create(messageContent: Any?, - informationData: MessageInformationData, - callback: TimelineEventController.Callback?, - reactionsSummaryEvents: ReactionsSummaryEvents?, - threadDetails: ThreadDetails? = null): AbsMessageItem.Attributes { + fun create( + messageContent: Any?, + informationData: MessageInformationData, + callback: TimelineEventController.Callback?, + reactionsSummaryEvents: ReactionsSummaryEvents?, + threadDetails: ThreadDetails? = null + ): AbsMessageItem.Attributes { return AbsMessageItem.Attributes( avatarSize = avatarSizeProvider.avatarSize, informationData = informationData, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt index e9361e564c..6739eff010 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt @@ -30,8 +30,9 @@ import kotlin.reflect.KMutableProperty0 private const val DEFAULT_PREFETCH_THRESHOLD = 30 -class TimelineControllerInterceptorHelper(private val positionOfReadMarker: KMutableProperty0, - private val adapterPositionMapping: MutableMap +class TimelineControllerInterceptorHelper( + private val positionOfReadMarker: KMutableProperty0, + private val adapterPositionMapping: MutableMap ) { private var previousModelsSize = 0 diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventDiffUtilCallback.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventDiffUtilCallback.kt index 7aa43a4513..c2569b038b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventDiffUtilCallback.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventDiffUtilCallback.kt @@ -19,8 +19,10 @@ package im.vector.app.features.home.room.detail.timeline.helper import androidx.recyclerview.widget.DiffUtil import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent -class TimelineEventDiffUtilCallback(private val oldList: List, - private val newList: List) : DiffUtil.Callback() { +class TimelineEventDiffUtilCallback( + private val oldList: List, + private val newList: List +) : DiffUtil.Callback() { override fun getOldListSize(): Int { return oldList.size diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt index 8ca999309a..e4e0ea8352 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineEventVisibilityHelper.kt @@ -47,7 +47,8 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen minSize: Int, eventIdToHighlight: String?, rootThreadEventId: String?, - isFromThreadTimeline: Boolean): List { + isFromThreadTimeline: Boolean + ): List { if (index >= timelineEvents.size - 1) { return emptyList() } @@ -99,7 +100,8 @@ class TimelineEventVisibilityHelper @Inject constructor(private val userPreferen minSize: Int, eventIdToHighlight: String?, rootThreadEventId: String?, - isFromThreadTimeline: Boolean): List { + isFromThreadTimeline: Boolean + ): List { val prevSub = timelineEvents.subList(0, index + 1) return prevSub .reversed() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineMediaSizeProvider.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineMediaSizeProvider.kt index 53c2f6c0d4..107873b776 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineMediaSizeProvider.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineMediaSizeProvider.kt @@ -25,8 +25,10 @@ import javax.inject.Inject import kotlin.math.roundToInt @ActivityScoped -class TimelineMediaSizeProvider @Inject constructor(private val resources: Resources, - private val vectorPreferences: VectorPreferences) { +class TimelineMediaSizeProvider @Inject constructor( + private val resources: Resources, + private val vectorPreferences: VectorPreferences +) { var recyclerView: RecyclerView? = null private var cachedSize: Pair? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineVisibilityStateChangedListeners.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineVisibilityStateChangedListeners.kt index 95feef83c0..61a7557906 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineVisibilityStateChangedListeners.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineVisibilityStateChangedListeners.kt @@ -31,8 +31,10 @@ class ReadMarkerVisibilityStateChangedListener(private val callback: TimelineEve } } -class TimelineEventVisibilityStateChangedListener(private val callback: TimelineEventController.Callback?, - private val event: TimelineEvent) : +class TimelineEventVisibilityStateChangedListener( + private val callback: TimelineEventController.Callback?, + private val event: TimelineEvent +) : VectorEpoxyModel.OnVisibilityStateChangedListener { override fun onVisibilityStateChanged(visibilityState: Int) { @@ -44,8 +46,10 @@ class TimelineEventVisibilityStateChangedListener(private val callback: Timeline } } -class MergedTimelineEventVisibilityStateChangedListener(private val callback: TimelineEventController.Callback?, - private val events: List) : +class MergedTimelineEventVisibilityStateChangedListener( + private val callback: TimelineEventController.Callback?, + private val events: List +) : VectorEpoxyModel.OnVisibilityStateChangedListener { override fun onVisibilityStateChanged(visibilityState: Int) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageLocationItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageLocationItem.kt index e7823845fa..935d5e9aa1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageLocationItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageLocationItem.kt @@ -77,20 +77,24 @@ abstract class AbsMessageLocationItem : AbsMe .apply(RequestOptions.centerCropTransform()) .placeholder(holder.staticMapImageView.drawable) .listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean): Boolean { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean + ): Boolean { holder.staticMapPinImageView.setImageResource(R.drawable.ic_location_pin_failed) holder.staticMapErrorTextView.isVisible = true return false } - override fun onResourceReady(resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean): Boolean { + override fun onResourceReady( + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean + ): Boolean { locationPinProvider?.create(locationUserId) { pinDrawable -> // we are not using Glide since it does not display it correctly when there is no user photo holder.staticMapPinImageView.setImageDrawable(pinDrawable) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollOptionViewState.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollOptionViewState.kt index fe17f9e9e7..826c6c5395 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollOptionViewState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/PollOptionViewState.kt @@ -16,47 +16,54 @@ package im.vector.app.features.home.room.detail.timeline.item -sealed class PollOptionViewState(open val optionId: String, - open val optionAnswer: String) { +sealed class PollOptionViewState( + open val optionId: String, + open val optionAnswer: String +) { /** * Represents a poll that is not sent to the server yet. */ - data class PollSending(override val optionId: String, - override val optionAnswer: String + data class PollSending( + override val optionId: String, + override val optionAnswer: String ) : PollOptionViewState(optionId, optionAnswer) /** * Represents a poll that is sent but not voted by the user. */ - data class PollReady(override val optionId: String, - override val optionAnswer: String + data class PollReady( + override val optionId: String, + override val optionAnswer: String ) : PollOptionViewState(optionId, optionAnswer) /** * Represents a poll that user already voted. */ - data class PollVoted(override val optionId: String, - override val optionAnswer: String, - val voteCount: Int, - val votePercentage: Double, - val isSelected: Boolean + data class PollVoted( + override val optionId: String, + override val optionAnswer: String, + val voteCount: Int, + val votePercentage: Double, + val isSelected: Boolean ) : PollOptionViewState(optionId, optionAnswer) /** * Represents a poll that is ended. */ - data class PollEnded(override val optionId: String, - override val optionAnswer: String, - val voteCount: Int, - val votePercentage: Double, - val isWinner: Boolean + data class PollEnded( + override val optionId: String, + override val optionAnswer: String, + val voteCount: Int, + val votePercentage: Double, + val isWinner: Boolean ) : PollOptionViewState(optionId, optionAnswer) /** * Represent a poll that is undisclosed, votes will be hidden until the poll is ended. */ - data class PollUndisclosed(override val optionId: String, - override val optionAnswer: String, - val isSelected: Boolean + data class PollUndisclosed( + override val optionId: String, + override val optionAnswer: String, + val isSelected: Boolean ) : PollOptionViewState(optionId, optionAnswer) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt index a517aab720..58ad08f026 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/merged/MergedTimelines.kt @@ -35,7 +35,8 @@ import kotlin.reflect.KMutableProperty0 class MergedTimelines( private val coroutineScope: CoroutineScope, private val mainTimeline: Timeline, - private val secondaryTimelineParams: SecondaryTimelineParams) : Timeline by mainTimeline { + private val secondaryTimelineParams: SecondaryTimelineParams +) : Timeline by mainTimeline { data class SecondaryTimelineParams( val timeline: Timeline, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt index a4677da1d9..7554885aec 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt @@ -34,7 +34,8 @@ import javax.inject.Inject */ class ViewReactionsEpoxyController @Inject constructor( private val stringProvider: StringProvider, - private val emojiSpanify: EmojiSpanify) : + private val emojiSpanify: EmojiSpanify +) : TypedEpoxyController() { var listener: Listener? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt index 1c9127aa1e..1ce4341167 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt @@ -41,7 +41,8 @@ import org.matrix.android.sdk.flow.unwrap data class DisplayReactionsViewState( val eventId: String, val roomId: String, - val mapReactionKeyToMemberList: Async> = Uninitialized) : + val mapReactionKeyToMemberList: Async> = Uninitialized +) : MavericksState { constructor(args: TimelineEventFragmentArgs) : this(roomId = args.roomId, eventId = args.eventId) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/render/EventTextRenderer.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/render/EventTextRenderer.kt index 83cffc4279..920f3e3b80 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/render/EventTextRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/render/EventTextRenderer.kt @@ -30,10 +30,12 @@ import im.vector.app.features.html.PillImageSpan import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.util.MatrixItem -class EventTextRenderer @AssistedInject constructor(@Assisted private val roomId: String?, - private val context: Context, - private val avatarRenderer: AvatarRenderer, - private val sessionHolder: ActiveSessionHolder) { +class EventTextRenderer @AssistedInject constructor( + @Assisted private val roomId: String?, + private val context: Context, + private val avatarRenderer: AvatarRenderer, + private val sessionHolder: ActiveSessionHolder +) { /* ========================================================================================== * Public api diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt index a0d10a8a75..80405077e7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayoutFactory.kt @@ -34,11 +34,13 @@ import org.matrix.android.sdk.api.session.room.timeline.isEdition import org.matrix.android.sdk.api.session.room.timeline.isRootThread import javax.inject.Inject -class TimelineMessageLayoutFactory @Inject constructor(private val session: Session, - private val layoutSettingsProvider: TimelineLayoutSettingsProvider, - private val localeProvider: LocaleProvider, - private val resources: Resources, - private val vectorPreferences: VectorPreferences) { +class TimelineMessageLayoutFactory @Inject constructor( + private val session: Session, + private val layoutSettingsProvider: TimelineLayoutSettingsProvider, + private val localeProvider: LocaleProvider, + private val resources: Resources, + private val vectorPreferences: VectorPreferences +) { companion object { // Can be rendered in bubbles, other types will fallback to default @@ -182,9 +184,11 @@ class TimelineMessageLayoutFactory @Inject constructor(private val session: Sess ) } - private fun buildCornersRadius(isIncoming: Boolean, - isFirstFromThisSender: Boolean, - isLastFromThisSender: Boolean): TimelineMessageLayout.Bubble.CornersRadius { + private fun buildCornersRadius( + isIncoming: Boolean, + isFirstFromThisSender: Boolean, + isLastFromThisSender: Boolean + ): TimelineMessageLayout.Bubble.CornersRadius { return if ((isIncoming && !isRTL) || (!isIncoming && isRTL)) { TimelineMessageLayout.Bubble.CornersRadius( topStartRadius = if (isFirstFromThisSender) cornerRadius else 0f, diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlRetriever.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlRetriever.kt index c97fae055d..eef649dbc0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlRetriever.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlRetriever.kt @@ -25,8 +25,10 @@ import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import org.matrix.android.sdk.api.session.room.timeline.getLatestEventId -class PreviewUrlRetriever(session: Session, - private val coroutineScope: CoroutineScope) { +class PreviewUrlRetriever( + session: Session, + private val coroutineScope: CoroutineScope +) { private val mediaService = session.mediaService() private data class EventIdPreviewUrlUiState( diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlUiState.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlUiState.kt index 29a314d1b3..e0df5c466f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlUiState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlUiState.kt @@ -35,7 +35,9 @@ sealed class PreviewUrlUiState { data class Error(val throwable: Throwable) : PreviewUrlUiState() // PreviewUrl data - data class Data(val eventId: String, - val url: String, - val previewUrlData: PreviewUrlData) : PreviewUrlUiState() + data class Data( + val eventId: String, + val url: String, + val previewUrlData: PreviewUrlData + ) : PreviewUrlUiState() } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt index 69455c767e..50388246f4 100755 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/url/PreviewUrlView.kt @@ -62,9 +62,11 @@ class PreviewUrlView @JvmOverloads constructor( * @param imageContentRenderer the tool to render the image * @param force true to force refresh */ - fun render(newState: PreviewUrlUiState, - imageContentRenderer: ImageContentRenderer, - force: Boolean = false) { + fun render( + newState: PreviewUrlUiState, + imageContentRenderer: ImageContentRenderer, + force: Boolean = false + ) { if (newState == state && !force) { return } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomBottomSheet.kt index 03a0e64d9b..3f89b99e59 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomBottomSheet.kt @@ -149,9 +149,10 @@ class MigrateRoomBottomSheet : const val REQUEST_KEY = "MigrateRoomBottomSheetRequest" const val BUNDLE_KEY_REPLACEMENT_ROOM = "BUNDLE_KEY_REPLACEMENT_ROOM" - fun newInstance(roomId: String, newVersion: String, - reason: MigrationReason = MigrationReason.MANUAL, - customDescription: CharSequence? = null + fun newInstance( + roomId: String, newVersion: String, + reason: MigrationReason = MigrationReason.MANUAL, + customDescription: CharSequence? = null ): MigrateRoomBottomSheet { return MigrateRoomBottomSheet().apply { setArguments(Args(roomId, newVersion, reason, customDescription)) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomViewModel.kt index 50eecb90fb..0a49c2c775 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/upgrade/MigrateRoomViewModel.kt @@ -35,7 +35,8 @@ import org.matrix.android.sdk.api.session.getRoomSummary class MigrateRoomViewModel @AssistedInject constructor( @Assisted initialState: MigrateRoomViewState, private val session: Session, - private val upgradeRoomViewModelTask: UpgradeRoomViewModelTask) : + private val upgradeRoomViewModelTask: UpgradeRoomViewModelTask +) : VectorViewModel(initialState) { init { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/widget/RoomWidgetsController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/widget/RoomWidgetsController.kt index 0f91f7b7c6..ef122509a4 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/widget/RoomWidgetsController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/widget/RoomWidgetsController.kt @@ -31,7 +31,8 @@ import javax.inject.Inject */ class RoomWidgetsController @Inject constructor( val stringProvider: StringProvider, - val colorProvider: ColorProvider) : + val colorProvider: ColorProvider +) : TypedEpoxyController>() { var listener: Listener? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt index 80c7b4e921..15c0d4b125 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderGroup.kt @@ -126,9 +126,11 @@ class RoomListSectionBuilderGroup( return sections } - private fun buildRoomsSections(sections: MutableList, - activeSpaceAwareQueries: MutableList, - actualGroupId: String?) { + private fun buildRoomsSections( + sections: MutableList, + activeSpaceAwareQueries: MutableList, + actualGroupId: String? + ) { if (autoAcceptInvites.showInvites()) { addSection( sections, @@ -246,11 +248,13 @@ class RoomListSectionBuilderGroup( } } - private fun addSection(sections: MutableList, - activeSpaceUpdaters: MutableList, - @StringRes nameRes: Int, - notifyOfLocalEcho: Boolean = false, - query: (RoomSummaryQueryParams.Builder) -> Unit) { + private fun addSection( + sections: MutableList, + activeSpaceUpdaters: MutableList, + @StringRes nameRes: Int, + notifyOfLocalEcho: Boolean = false, + query: (RoomSummaryQueryParams.Builder) -> Unit + ) { withQueryParams(query) { roomQueryParams -> val name = stringProvider.getString(nameRes) session.roomService().getFilteredPagedRoomSummariesLive(roomQueryParams) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt index 59137ec490..bef381b2e0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListSectionBuilderSpace.kt @@ -105,8 +105,10 @@ class RoomListSectionBuilderSpace( return sections } - private fun buildRoomsSections(sections: MutableList, - activeSpaceAwareQueries: MutableList) { + private fun buildRoomsSections( + sections: MutableList, + activeSpaceAwareQueries: MutableList + ) { if (autoAcceptInvites.showInvites()) { addSection( sections = sections, @@ -228,8 +230,10 @@ class RoomListSectionBuilderSpace( ) } - private fun buildDmSections(sections: MutableList, - activeSpaceAwareQueries: MutableList) { + private fun buildDmSections( + sections: MutableList, + activeSpaceAwareQueries: MutableList + ) { if (autoAcceptInvites.showInvites()) { addSection( sections = sections, @@ -281,8 +285,10 @@ class RoomListSectionBuilderSpace( } } - private fun buildNotificationsSection(sections: MutableList, - activeSpaceAwareQueries: MutableList) { + private fun buildNotificationsSection( + sections: MutableList, + activeSpaceAwareQueries: MutableList + ) { if (autoAcceptInvites.showInvites()) { addSection( sections = sections, @@ -343,13 +349,15 @@ class RoomListSectionBuilderSpace( ) } - private fun addSection(sections: MutableList, - activeSpaceUpdaters: MutableList, - @StringRes nameRes: Int, - notifyOfLocalEcho: Boolean = false, - spaceFilterStrategy: RoomListViewModel.SpaceFilterStrategy = RoomListViewModel.SpaceFilterStrategy.NONE, - countRoomAsNotif: Boolean = false, - query: (RoomSummaryQueryParams.Builder) -> Unit) { + private fun addSection( + sections: MutableList, + activeSpaceUpdaters: MutableList, + @StringRes nameRes: Int, + notifyOfLocalEcho: Boolean = false, + spaceFilterStrategy: RoomListViewModel.SpaceFilterStrategy = RoomListViewModel.SpaceFilterStrategy.NONE, + countRoomAsNotif: Boolean = false, + query: (RoomSummaryQueryParams.Builder) -> Unit + ) { withQueryParams(query) { roomQueryParams -> val updatedQueryParams = roomQueryParams.process(spaceFilterStrategy, appStateHandler.safeActiveSpaceId()) val liveQueryParams = MutableStateFlow(updatedQueryParams) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt index 6326d9c97a..8c37445276 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt @@ -36,17 +36,21 @@ import org.matrix.android.sdk.api.session.room.model.SpaceChildInfo import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject -class RoomSummaryItemFactory @Inject constructor(private val displayableEventFormatter: DisplayableEventFormatter, - private val dateFormatter: VectorDateFormatter, - private val stringProvider: StringProvider, - private val typingHelper: TypingHelper, - private val avatarRenderer: AvatarRenderer, - private val errorFormatter: ErrorFormatter) { +class RoomSummaryItemFactory @Inject constructor( + private val displayableEventFormatter: DisplayableEventFormatter, + private val dateFormatter: VectorDateFormatter, + private val stringProvider: StringProvider, + private val typingHelper: TypingHelper, + private val avatarRenderer: AvatarRenderer, + private val errorFormatter: ErrorFormatter +) { - fun create(roomSummary: RoomSummary, - roomChangeMembershipStates: Map, - selectedRoomIds: Set, - listener: RoomListListener?): VectorEpoxyModel<*> { + fun create( + roomSummary: RoomSummary, + roomChangeMembershipStates: Map, + selectedRoomIds: Set, + listener: RoomListListener? + ): VectorEpoxyModel<*> { return when (roomSummary.membership) { Membership.INVITE -> { val changeMembershipState = roomChangeMembershipStates[roomSummary.roomId] ?: ChangeMembershipState.Unknown @@ -56,9 +60,11 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor } } - fun createSuggestion(spaceChildInfo: SpaceChildInfo, - suggestedRoomJoiningStates: Map>, - listener: RoomListListener?): VectorEpoxyModel<*> { + fun createSuggestion( + spaceChildInfo: SpaceChildInfo, + suggestedRoomJoiningStates: Map>, + listener: RoomListListener? + ): VectorEpoxyModel<*> { val error = (suggestedRoomJoiningStates[spaceChildInfo.childRoomId] as? Fail)?.error return SpaceChildInfoItem_() .id("sug_${spaceChildInfo.childRoomId}") @@ -80,9 +86,11 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor .itemClickListener { listener?.onSuggestedRoomClicked(spaceChildInfo) } } - private fun createInvitationItem(roomSummary: RoomSummary, - changeMembershipState: ChangeMembershipState, - listener: RoomListListener?): VectorEpoxyModel<*> { + private fun createInvitationItem( + roomSummary: RoomSummary, + changeMembershipState: ChangeMembershipState, + listener: RoomListListener? + ): VectorEpoxyModel<*> { val secondLine = if (roomSummary.isDirect) { roomSummary.inviterId } else { diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt index 21fbd8b914..0423a8fffc 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/actions/RoomListQuickActionsSharedAction.kt @@ -24,7 +24,8 @@ import im.vector.app.core.platform.VectorSharedAction sealed class RoomListQuickActionsSharedAction( @StringRes val titleRes: Int, @DrawableRes val iconResId: Int?, - val destructive: Boolean = false) : + val destructive: Boolean = false +) : VectorSharedAction { data class NotificationsAllNoisy(val roomId: String) : RoomListQuickActionsSharedAction( diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/widget/NotifsFabMenuView.kt b/vector/src/main/java/im/vector/app/features/home/room/list/widget/NotifsFabMenuView.kt index 72b58fc7ca..1487c30957 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/widget/NotifsFabMenuView.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/widget/NotifsFabMenuView.kt @@ -24,8 +24,10 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton import im.vector.app.R import im.vector.app.databinding.MotionNotifsFabMenuMergeBinding -class NotifsFabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : MotionLayout(context, attrs, defStyleAttr) { +class NotifsFabMenuView @JvmOverloads constructor( + context: Context, attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : MotionLayout(context, attrs, defStyleAttr) { private val views: MotionNotifsFabMenuMergeBinding diff --git a/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListViewModel.kt index d038b14491..eafad43016 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListViewModel.kt @@ -37,9 +37,11 @@ import org.matrix.android.sdk.api.session.getRoom import org.matrix.android.sdk.api.session.threads.ThreadTimelineEvent import org.matrix.android.sdk.flow.flow -class ThreadListViewModel @AssistedInject constructor(@Assisted val initialState: ThreadListViewState, - private val analyticsTracker: AnalyticsTracker, - private val session: Session) : +class ThreadListViewModel @AssistedInject constructor( + @Assisted val initialState: ThreadListViewState, + private val analyticsTracker: AnalyticsTracker, + private val session: Session +) : VectorViewModel(initialState) { private val room = session.getRoom(initialState.roomId) diff --git a/vector/src/main/java/im/vector/app/features/html/PillImageSpan.kt b/vector/src/main/java/im/vector/app/features/html/PillImageSpan.kt index ae285b074c..b285bef9ec 100644 --- a/vector/src/main/java/im/vector/app/features/html/PillImageSpan.kt +++ b/vector/src/main/java/im/vector/app/features/html/PillImageSpan.kt @@ -43,10 +43,11 @@ import java.lang.ref.WeakReference * It's needed to call [bind] method to start requesting avatar, otherwise only the placeholder icon will be displayed if not already cached. * Implements MatrixItemSpan so that it could be automatically transformed in matrix links and displayed as pills. */ -class PillImageSpan(private val glideRequests: GlideRequests, - private val avatarRenderer: AvatarRenderer, - private val context: Context, - override val matrixItem: MatrixItem +class PillImageSpan( + private val glideRequests: GlideRequests, + private val avatarRenderer: AvatarRenderer, + private val context: Context, + override val matrixItem: MatrixItem ) : ReplacementSpan(), MatrixItemSpan { private val pillDrawable = createChipDrawable() @@ -61,10 +62,12 @@ class PillImageSpan(private val glideRequests: GlideRequests, // ReplacementSpan ***************************************************************************** - override fun getSize(paint: Paint, text: CharSequence, - start: Int, - end: Int, - fm: Paint.FontMetricsInt?): Int { + override fun getSize( + paint: Paint, text: CharSequence, + start: Int, + end: Int, + fm: Paint.FontMetricsInt? + ): Int { val rect = pillDrawable.bounds if (fm != null) { val fmPaint = paint.fontMetricsInt @@ -80,14 +83,16 @@ class PillImageSpan(private val glideRequests: GlideRequests, return rect.right } - override fun draw(canvas: Canvas, text: CharSequence, - start: Int, - end: Int, - x: Float, - top: Int, - y: Int, - bottom: Int, - paint: Paint) { + override fun draw( + canvas: Canvas, text: CharSequence, + start: Int, + end: Int, + x: Float, + top: Int, + y: Int, + bottom: Int, + paint: Paint + ) { canvas.save() val fm = paint.fontMetricsInt val transY: Int = y + (fm.descent + fm.ascent - pillDrawable.bounds.bottom) / 2 diff --git a/vector/src/main/java/im/vector/app/features/html/PillsPostProcessor.kt b/vector/src/main/java/im/vector/app/features/html/PillsPostProcessor.kt index 2d63d69c35..72519cd97a 100644 --- a/vector/src/main/java/im/vector/app/features/html/PillsPostProcessor.kt +++ b/vector/src/main/java/im/vector/app/features/html/PillsPostProcessor.kt @@ -34,10 +34,12 @@ import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem -class PillsPostProcessor @AssistedInject constructor(@Assisted private val roomId: String?, - private val context: Context, - private val avatarRenderer: AvatarRenderer, - private val sessionHolder: ActiveSessionHolder) : +class PillsPostProcessor @AssistedInject constructor( + @Assisted private val roomId: String?, + private val context: Context, + private val avatarRenderer: AvatarRenderer, + private val sessionHolder: ActiveSessionHolder +) : EventHtmlRenderer.PostProcessor { /* ========================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt b/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt index 3e4e16861e..f0d1581724 100644 --- a/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt +++ b/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt @@ -44,10 +44,12 @@ class UrlMapProvider @Inject constructor( return upstreamMapUrl ?: fallbackMapUrl } - fun buildStaticMapUrl(locationData: LocationData, - zoom: Double, - width: Int, - height: Int): String { + fun buildStaticMapUrl( + locationData: LocationData, + zoom: Double, + width: Int, + height: Int + ): String { return buildString { append(STATIC_MAP_BASE_URL) append(locationData.longitude) diff --git a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt index 2308f2c544..b11e6739eb 100644 --- a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt @@ -78,10 +78,10 @@ abstract class AbstractLoginFragment : VectorBaseFragment( } when (throwable) { - is CancellationException -> + is CancellationException -> /* Ignore this error, user has cancelled the action */ Unit - is Failure.ServerError -> + is Failure.ServerError -> if (throwable.error.code == MatrixError.M_FORBIDDEN && throwable.httpCode == HttpsURLConnection.HTTP_FORBIDDEN /* 403 */) { MaterialAlertDialogBuilder(requireActivity()) @@ -94,7 +94,7 @@ abstract class AbstractLoginFragment : VectorBaseFragment( } is Failure.UnrecognizedCertificateFailure -> showUnrecognizedCertificateFailure(throwable) - else -> + else -> onError(throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/login/LoginAction.kt b/vector/src/main/java/im/vector/app/features/login/LoginAction.kt index 800df32b9d..5947fa0cb5 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginAction.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginAction.kt @@ -66,9 +66,11 @@ sealed class LoginAction : VectorViewModelAction { object ClearHomeServerHistory : LoginAction() // For the soft logout case - data class SetupSsoForSessionRecovery(val homeServerUrl: String, - val deviceId: String, - val ssoIdentityProviders: List?) : LoginAction() + data class SetupSsoForSessionRecovery( + val homeServerUrl: String, + val deviceId: String, + val ssoIdentityProviders: List? + ) : LoginAction() data class PostViewEvent(val viewEvent: LoginViewEvents) : LoginAction() diff --git a/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt b/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt index 1b08d2a86f..2273e08c39 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt @@ -261,8 +261,10 @@ class LoginViewModel @AssistedInject constructor( } } - private fun executeRegistrationStep(withLoading: Boolean = true, - block: suspend (RegistrationWizard) -> RegistrationResult): Job { + private fun executeRegistrationStep( + withLoading: Boolean = true, + block: suspend (RegistrationWizard) -> RegistrationResult + ): Job { if (withLoading) { setState { copy(asyncRegistration = Loading()) } } @@ -598,9 +600,11 @@ class LoginViewModel @AssistedInject constructor( _viewEvents.post(LoginViewEvents.Failure(Exception(stringProvider.getString(R.string.autodiscover_well_known_error)))) } - private suspend fun onWellknownSuccess(action: LoginAction.LoginOrRegister, - wellKnownPrompt: WellknownResult.Prompt, - homeServerConnectionConfig: HomeServerConnectionConfig?) { + private suspend fun onWellknownSuccess( + action: LoginAction.LoginOrRegister, + wellKnownPrompt: WellknownResult.Prompt, + homeServerConnectionConfig: HomeServerConnectionConfig? + ) { val alteredHomeServerConnectionConfig = homeServerConnectionConfig ?.copy( homeServerUriBase = Uri.parse(wellKnownPrompt.homeServerUrl), @@ -754,8 +758,10 @@ class LoginViewModel @AssistedInject constructor( } } - private fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig, - serverTypeOverride: ServerType? = null) { + private fun getLoginFlow( + homeServerConnectionConfig: HomeServerConnectionConfig, + serverTypeOverride: ServerType? = null + ) { currentHomeServerConnectionConfig = homeServerConnectionConfig currentJob = viewModelScope.launch { diff --git a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt index 02ce0bb670..007c27d3be 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginWebFragment.kt @@ -123,8 +123,10 @@ class LoginWebFragment @Inject constructor( views.loginWebWebView.loadUrl(url) views.loginWebWebView.webViewClient = object : WebViewClient() { - override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, - error: SslError) { + override fun onReceivedSslError( + view: WebView, handler: SslErrorHandler, + error: SslError + ) { MaterialAlertDialogBuilder(requireActivity()) .setMessage(R.string.ssl_could_not_verify) .setPositiveButton(R.string.ssl_trust) { _, _ -> handler.proceed() } diff --git a/vector/src/main/java/im/vector/app/features/login/terms/LocalizedFlowDataLoginTermsChecked.kt b/vector/src/main/java/im/vector/app/features/login/terms/LocalizedFlowDataLoginTermsChecked.kt index a248b3471b..d235db8d8e 100644 --- a/vector/src/main/java/im/vector/app/features/login/terms/LocalizedFlowDataLoginTermsChecked.kt +++ b/vector/src/main/java/im/vector/app/features/login/terms/LocalizedFlowDataLoginTermsChecked.kt @@ -18,5 +18,7 @@ package im.vector.app.features.login.terms import org.matrix.android.sdk.api.auth.data.LocalizedFlowDataLoginTerms -data class LocalizedFlowDataLoginTermsChecked(val localizedFlowDataLoginTerms: LocalizedFlowDataLoginTerms, - var checked: Boolean = false) +data class LocalizedFlowDataLoginTermsChecked( + val localizedFlowDataLoginTerms: LocalizedFlowDataLoginTerms, + var checked: Boolean = false +) diff --git a/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt b/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt index 0b82ea445d..e722fadffa 100644 --- a/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/AbstractLoginFragment2.kt @@ -76,12 +76,12 @@ abstract class AbstractLoginFragment2 : VectorBaseFragment } when (throwable) { - is CancellationException -> + is CancellationException -> /* Ignore this error, user has cancelled the action */ Unit is Failure.UnrecognizedCertificateFailure -> showUnrecognizedCertificateFailure(throwable) - else -> + else -> onError(throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginAction2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginAction2.kt index 85e2e0cea3..37dafbfbe0 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginAction2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginAction2.kt @@ -77,9 +77,11 @@ sealed class LoginAction2 : VectorViewModelAction { object ClearHomeServerHistory : LoginAction2() // For the soft logout case - data class SetupSsoForSessionRecovery(val homeServerUrl: String, - val deviceId: String, - val ssoIdentityProviders: List?) : LoginAction2() + data class SetupSsoForSessionRecovery( + val homeServerUrl: String, + val deviceId: String, + val ssoIdentityProviders: List? + ) : LoginAction2() data class PostViewEvent(val viewEvent: LoginViewEvents2) : LoginAction2() diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt index 6b9d255937..f2620f92a1 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt @@ -248,8 +248,10 @@ class LoginViewModel2 @AssistedInject constructor( } } - private fun executeRegistrationStep(withLoading: Boolean = true, - block: suspend (RegistrationWizard) -> RegistrationResult): Job { + private fun executeRegistrationStep( + withLoading: Boolean = true, + block: suspend (RegistrationWizard) -> RegistrationResult + ): Job { if (withLoading) { setState { copy(isLoading = true) } } @@ -596,9 +598,11 @@ class LoginViewModel2 @AssistedInject constructor( setState { copy(isLoading = false) } } - private suspend fun onWellknownSuccess(action: LoginAction2.SetUserName, - wellKnownPrompt: WellknownResult.Prompt, - homeServerConnectionConfig: HomeServerConnectionConfig?) { + private suspend fun onWellknownSuccess( + action: LoginAction2.SetUserName, + wellKnownPrompt: WellknownResult.Prompt, + homeServerConnectionConfig: HomeServerConnectionConfig? + ) { val alteredHomeServerConnectionConfig = homeServerConnectionConfig ?.copy( homeServerUriBase = Uri.parse(wellKnownPrompt.homeServerUrl), diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt index cf8952b944..bc79ef8bd8 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginWebFragment2.kt @@ -124,8 +124,10 @@ class LoginWebFragment2 @Inject constructor( views.loginWebWebView.loadUrl(url) views.loginWebWebView.webViewClient = object : WebViewClient() { - override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, - error: SslError) { + override fun onReceivedSslError( + view: WebView, handler: SslErrorHandler, + error: SslError + ) { MaterialAlertDialogBuilder(requireActivity()) .setMessage(R.string.ssl_could_not_verify) .setPositiveButton(R.string.ssl_trust) { _, _ -> handler.proceed() } diff --git a/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt b/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt index b72b36a564..87ba176255 100644 --- a/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt @@ -38,11 +38,13 @@ class SpaceCardRenderer @Inject constructor( private val stringProvider: StringProvider ) { - fun render(spaceSummary: RoomSummary?, - peopleYouKnow: List, - matrixLinkCallback: TimelineEventController.UrlClickCallback?, - inCard: FragmentMatrixToRoomSpaceCardBinding, - showDescription: Boolean) { + fun render( + spaceSummary: RoomSummary?, + peopleYouKnow: List, + matrixLinkCallback: TimelineEventController.UrlClickCallback?, + inCard: FragmentMatrixToRoomSpaceCardBinding, + showDescription: Boolean + ) { if (spaceSummary == null) { inCard.matrixToCardContentVisibility.isVisible = false inCard.matrixToCardButtonLoading.isVisible = true @@ -87,10 +89,12 @@ class SpaceCardRenderer @Inject constructor( }) } - fun render(spaceChildInfo: SpaceChildInfo?, - peopleYouKnow: List, - matrixLinkCallback: TimelineEventController.UrlClickCallback?, - inCard: FragmentMatrixToRoomSpaceCardBinding) { + fun render( + spaceChildInfo: SpaceChildInfo?, + peopleYouKnow: List, + matrixLinkCallback: TimelineEventController.UrlClickCallback?, + inCard: FragmentMatrixToRoomSpaceCardBinding + ) { if (spaceChildInfo == null) { inCard.matrixToCardContentVisibility.isVisible = false inCard.matrixToCardButtonLoading.isVisible = true diff --git a/vector/src/main/java/im/vector/app/features/media/AttachmentProviderFactory.kt b/vector/src/main/java/im/vector/app/features/media/AttachmentProviderFactory.kt index f067cd7599..ff41425f9b 100644 --- a/vector/src/main/java/im/vector/app/features/media/AttachmentProviderFactory.kt +++ b/vector/src/main/java/im/vector/app/features/media/AttachmentProviderFactory.kt @@ -31,8 +31,9 @@ class AttachmentProviderFactory @Inject constructor( private val session: Session ) { - fun createProvider(attachments: List, - coroutineScope: CoroutineScope + fun createProvider( + attachments: List, + coroutineScope: CoroutineScope ): RoomEventsAttachmentProvider { return RoomEventsAttachmentProvider( attachments = attachments, @@ -44,9 +45,10 @@ class AttachmentProviderFactory @Inject constructor( ) } - fun createProvider(attachments: List, - room: Room?, - coroutineScope: CoroutineScope + fun createProvider( + attachments: List, + room: Room?, + coroutineScope: CoroutineScope ): DataAttachmentRoomProvider { return DataAttachmentRoomProvider( attachments = attachments, diff --git a/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt b/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt index 49bced7e81..1f125de33e 100644 --- a/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt @@ -65,9 +65,11 @@ interface AttachmentData : Parcelable { private const val URL_PREVIEW_IMAGE_MIN_FULL_WIDTH_PX = 600 private const val URL_PREVIEW_IMAGE_MIN_FULL_HEIGHT_PX = 315 -class ImageContentRenderer @Inject constructor(private val localFilesHelper: LocalFilesHelper, - private val activeSessionHolder: ActiveSessionHolder, - private val dimensionConverter: DimensionConverter) { +class ImageContentRenderer @Inject constructor( + private val localFilesHelper: LocalFilesHelper, + private val activeSessionHolder: ActiveSessionHolder, + private val dimensionConverter: DimensionConverter +) { @Parcelize data class Data( @@ -179,19 +181,23 @@ class ImageContentRenderer @Inject constructor(private val localFilesHelper: Loc createGlideRequest(data, mode, imageView, size) .listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean): Boolean { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean + ): Boolean { callback?.invoke(false) return false } - override fun onResourceReady(resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean): Boolean { + override fun onResourceReady( + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean + ): Boolean { callback?.invoke(true) return false } @@ -222,19 +228,23 @@ class ImageContentRenderer @Inject constructor(private val localFilesHelper: Loc } req.listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean): Boolean { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean + ): Boolean { callback?.invoke(false) return false } - override fun onResourceReady(resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean): Boolean { + override fun onResourceReady( + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean + ): Boolean { callback?.invoke(true) return false } diff --git a/vector/src/main/java/im/vector/app/features/media/UCropHelper.kt b/vector/src/main/java/im/vector/app/features/media/UCropHelper.kt index a6be47553f..7f73f3387e 100644 --- a/vector/src/main/java/im/vector/app/features/media/UCropHelper.kt +++ b/vector/src/main/java/im/vector/app/features/media/UCropHelper.kt @@ -23,10 +23,12 @@ import com.yalantis.ucrop.UCropActivity import im.vector.app.R import im.vector.app.core.resources.ColorProvider -fun createUCropWithDefaultSettings(colorProvider: ColorProvider, - source: Uri, - destination: Uri, - toolbarTitle: String?): UCrop { +fun createUCropWithDefaultSettings( + colorProvider: ColorProvider, + source: Uri, + destination: Uri, + toolbarTitle: String? +): UCrop { return UCrop.of(source, destination) .withOptions( UCrop.Options() diff --git a/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt b/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt index 2259eb513f..08d87b528c 100644 --- a/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt +++ b/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt @@ -307,12 +307,14 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), AttachmentInt private const val EXTRA_IMAGE_DATA = "EXTRA_IMAGE_DATA" private const val EXTRA_IN_MEMORY_DATA = "EXTRA_IN_MEMORY_DATA" - fun newIntent(context: Context, - mediaData: AttachmentData, - roomId: String?, - eventId: String, - inMemoryData: List, - sharedTransitionName: String?) = Intent(context, VectorAttachmentViewerActivity::class.java).also { + fun newIntent( + context: Context, + mediaData: AttachmentData, + roomId: String?, + eventId: String, + inMemoryData: List, + sharedTransitionName: String? + ) = Intent(context, VectorAttachmentViewerActivity::class.java).also { it.putExtra(EXTRA_ARGS, Args(roomId, eventId, sharedTransitionName)) it.putExtra(EXTRA_IMAGE_DATA, mediaData) if (inMemoryData.isNotEmpty()) { diff --git a/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt b/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt index c7bb54fcf4..cdfa3d2e28 100644 --- a/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt @@ -36,9 +36,11 @@ import timber.log.Timber import java.net.URLEncoder import javax.inject.Inject -class VideoContentRenderer @Inject constructor(private val localFilesHelper: LocalFilesHelper, - private val activeSessionHolder: ActiveSessionHolder, - private val errorFormatter: ErrorFormatter) { +class VideoContentRenderer @Inject constructor( + private val localFilesHelper: LocalFilesHelper, + private val activeSessionHolder: ActiveSessionHolder, + private val errorFormatter: ErrorFormatter +) { private val sessionScope: CoroutineScope get() = activeSessionHolder.getActiveSession().coroutineScope @@ -55,11 +57,13 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc override val allowNonMxcUrls: Boolean = false ) : AttachmentData - fun render(data: Data, - thumbnailView: ImageView, - loadingView: ProgressBar, - videoView: VideoView, - errorView: TextView) { + fun render( + data: Data, + thumbnailView: ImageView, + loadingView: ProgressBar, + videoView: VideoView, + errorView: TextView + ) { val contentUrlResolver = activeSessionHolder.getActiveSession().contentUrlResolver() if (data.elementToDecrypt != null) { diff --git a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt index 0f921ab80a..1491b46fe9 100644 --- a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt +++ b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt @@ -467,29 +467,35 @@ class DefaultNavigator @Inject constructor( context.startActivity(Intent(context, AnalyticsOptInActivity::class.java)) } - override fun openTerms(context: Context, - activityResultLauncher: ActivityResultLauncher, - serviceType: TermsService.ServiceType, - baseUrl: String, - token: String?) { + override fun openTerms( + context: Context, + activityResultLauncher: ActivityResultLauncher, + serviceType: TermsService.ServiceType, + baseUrl: String, + token: String? + ) { val intent = ReviewTermsActivity.intent(context, serviceType, baseUrl, token) activityResultLauncher.launch(intent) } - override fun openStickerPicker(context: Context, - activityResultLauncher: ActivityResultLauncher, - roomId: String, - widget: Widget) { + override fun openStickerPicker( + context: Context, + activityResultLauncher: ActivityResultLauncher, + roomId: String, + widget: Widget + ) { val widgetArgs = widgetArgsBuilder.buildStickerPickerArgs(roomId, widget) val intent = WidgetActivity.newIntent(context, widgetArgs) activityResultLauncher.launch(intent) } - override fun openIntegrationManager(context: Context, - activityResultLauncher: ActivityResultLauncher, - roomId: String, - integId: String?, - screen: String?) { + override fun openIntegrationManager( + context: Context, + activityResultLauncher: ActivityResultLauncher, + roomId: String, + integId: String?, + screen: String? + ) { val widgetArgs = widgetArgsBuilder.buildIntegrationManagerArgs(roomId, integId, screen) val intent = WidgetActivity.newIntent(context, widgetArgs) activityResultLauncher.launch(intent) @@ -514,19 +520,23 @@ class DefaultNavigator @Inject constructor( } } - override fun openPinCode(context: Context, - activityResultLauncher: ActivityResultLauncher, - pinMode: PinMode) { + override fun openPinCode( + context: Context, + activityResultLauncher: ActivityResultLauncher, + pinMode: PinMode + ) { val intent = PinActivity.newIntent(context, PinArgs(pinMode)) activityResultLauncher.launch(intent) } - override fun openMediaViewer(activity: Activity, - roomId: String, - mediaData: AttachmentData, - view: View, - inMemory: List, - options: ((MutableList>) -> Unit)?) { + override fun openMediaViewer( + activity: Activity, + roomId: String, + mediaData: AttachmentData, + view: View, + inMemory: List, + options: ((MutableList>) -> Unit)? + ) { VectorAttachmentViewerActivity.newIntent( activity, mediaData, @@ -551,10 +561,12 @@ class DefaultNavigator @Inject constructor( } } - override fun openSearch(context: Context, - roomId: String, - roomDisplayName: String?, - roomAvatarUrl: String?) { + override fun openSearch( + context: Context, + roomId: String, + roomDisplayName: String?, + roomAvatarUrl: String? + ) { val intent = SearchActivity.newIntent(context, SearchArgs(roomId, roomDisplayName, roomAvatarUrl)) context.startActivity(intent) } @@ -580,11 +592,13 @@ class DefaultNavigator @Inject constructor( context.startActivity(intent) } - override fun openLocationSharing(context: Context, - roomId: String, - mode: LocationSharingMode, - initialLocationData: LocationData?, - locationOwnerId: String?) { + override fun openLocationSharing( + context: Context, + roomId: String, + mode: LocationSharingMode, + initialLocationData: LocationData?, + locationOwnerId: String? + ) { val intent = LocationSharingActivity.getIntent( context, LocationSharingArgs(roomId = roomId, mode = mode, initialLocationData = initialLocationData, locationOwnerId = locationOwnerId) @@ -628,8 +642,10 @@ class DefaultNavigator @Inject constructor( ) } - override fun openScreenSharingPermissionDialog(screenCaptureIntent: Intent, - activityResultLauncher: ActivityResultLauncher) { + override fun openScreenSharingPermissionDialog( + screenCaptureIntent: Intent, + activityResultLauncher: ActivityResultLauncher + ) { activityResultLauncher.launch(screenCaptureIntent) } } diff --git a/vector/src/main/java/im/vector/app/features/navigation/Navigator.kt b/vector/src/main/java/im/vector/app/features/navigation/Navigator.kt index 075b41daf3..f2728dce2b 100644 --- a/vector/src/main/java/im/vector/app/features/navigation/Navigator.kt +++ b/vector/src/main/java/im/vector/app/features/navigation/Navigator.kt @@ -52,12 +52,14 @@ interface Navigator { fun softLogout(context: Context) - fun openRoom(context: Context, - roomId: String, - eventId: String? = null, - buildTask: Boolean = false, - isInviteAlreadyAccepted: Boolean = false, - trigger: ViewRoom.Trigger? = null) + fun openRoom( + context: Context, + roomId: String, + eventId: String? = null, + buildTask: Boolean = false, + isInviteAlreadyAccepted: Boolean = false, + trigger: ViewRoom.Trigger? = null + ) sealed class PostSwitchSpaceAction { object None : PostSwitchSpaceAction() @@ -124,35 +126,45 @@ interface Navigator { fun openAnalyticsOptIn(context: Context) - fun openPinCode(context: Context, - activityResultLauncher: ActivityResultLauncher, - pinMode: PinMode) + fun openPinCode( + context: Context, + activityResultLauncher: ActivityResultLauncher, + pinMode: PinMode + ) - fun openTerms(context: Context, - activityResultLauncher: ActivityResultLauncher, - serviceType: TermsService.ServiceType, - baseUrl: String, - token: String?) + fun openTerms( + context: Context, + activityResultLauncher: ActivityResultLauncher, + serviceType: TermsService.ServiceType, + baseUrl: String, + token: String? + ) - fun openStickerPicker(context: Context, - activityResultLauncher: ActivityResultLauncher, - roomId: String, - widget: Widget) + fun openStickerPicker( + context: Context, + activityResultLauncher: ActivityResultLauncher, + roomId: String, + widget: Widget + ) - fun openIntegrationManager(context: Context, - activityResultLauncher: ActivityResultLauncher, - roomId: String, - integId: String?, - screen: String?) + fun openIntegrationManager( + context: Context, + activityResultLauncher: ActivityResultLauncher, + roomId: String, + integId: String?, + screen: String? + ) fun openRoomWidget(context: Context, roomId: String, widget: Widget, options: Map? = null) - fun openMediaViewer(activity: Activity, - roomId: String, - mediaData: AttachmentData, - view: View, - inMemory: List = emptyList(), - options: ((MutableList>) -> Unit)?) + fun openMediaViewer( + activity: Activity, + roomId: String, + mediaData: AttachmentData, + view: View, + inMemory: List = emptyList(), + options: ((MutableList>) -> Unit)? + ) fun openSearch(context: Context, roomId: String, roomDisplayName: String?, roomAvatarUrl: String?) @@ -166,11 +178,13 @@ interface Navigator { fun openCreatePoll(context: Context, roomId: String, editedEventId: String?, mode: PollMode) - fun openLocationSharing(context: Context, - roomId: String, - mode: LocationSharingMode, - initialLocationData: LocationData?, - locationOwnerId: String?) + fun openLocationSharing( + context: Context, + roomId: String, + mode: LocationSharingMode, + initialLocationData: LocationData?, + locationOwnerId: String? + ) fun openThread(context: Context, threadTimelineArgs: ThreadTimelineArgs, eventIdToNavigate: String? = null) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt index 4b6815e7e4..dfe214124e 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationFactory.kt @@ -81,10 +81,12 @@ class NotificationFactory @Inject constructor( } } - fun createSummaryNotification(roomNotifications: List, - invitationNotifications: List, - simpleNotifications: List, - useCompleteNotificationFormat: Boolean): SummaryNotification { + fun createSummaryNotification( + roomNotifications: List, + invitationNotifications: List, + simpleNotifications: List, + useCompleteNotificationFormat: Boolean + ): SummaryNotification { val roomMeta = roomNotifications.filterIsInstance().map { it.meta } val invitationMeta = invitationNotifications.filterIsInstance().map { it.meta } val simpleMeta = simpleNotifications.filterIsInstance().map { it.meta } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt index e0e21a39a7..449c32cbf4 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationRenderer.kt @@ -24,16 +24,20 @@ import im.vector.app.features.notifications.NotificationDrawerManager.Companion. import timber.log.Timber import javax.inject.Inject -class NotificationRenderer @Inject constructor(private val notificationDisplayer: NotificationDisplayer, - private val notificationFactory: NotificationFactory, - private val appContext: Context) { +class NotificationRenderer @Inject constructor( + private val notificationDisplayer: NotificationDisplayer, + private val notificationFactory: NotificationFactory, + private val appContext: Context +) { @WorkerThread - fun render(myUserId: String, - myUserDisplayName: String, - myUserAvatarUrl: String?, - useCompleteNotificationFormat: Boolean, - eventsToProcess: List>) { + fun render( + myUserId: String, + myUserDisplayName: String, + myUserAvatarUrl: String?, + useCompleteNotificationFormat: Boolean, + eventsToProcess: List> + ) { val (roomEvents, simpleEvents, invitationEvents) = eventsToProcess.groupByType() with(notificationFactory) { val roomNotifications = roomEvents.toNotifications(myUserDisplayName, myUserAvatarUrl) diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationState.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationState.kt index 3114cd45ca..42d009a501 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationState.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationState.kt @@ -36,8 +36,10 @@ class NotificationState( private val renderedEvents: MutableList>, ) { - fun updateQueuedEvents(drawerManager: NotificationDrawerManager, - action: NotificationDrawerManager.(NotificationEventQueue, List>) -> T): T { + fun updateQueuedEvents( + drawerManager: NotificationDrawerManager, + action: NotificationDrawerManager.(NotificationEventQueue, List>) -> T + ): T { return synchronized(queuedEvents) { action(drawerManager, queuedEvents, renderedEvents) } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt index abfca1a64c..c0fc231c8a 100755 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt @@ -305,9 +305,11 @@ class NotificationUtils @Inject constructor( * @return the call notification. */ @SuppressLint("NewApi") - fun buildIncomingCallNotification(call: WebRtcCall, - title: String, - fromBg: Boolean): Notification { + fun buildIncomingCallNotification( + call: WebRtcCall, + title: String, + fromBg: Boolean + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) val notificationChannel = if (fromBg) CALL_NOTIFICATION_CHANNEL_ID else SILENT_NOTIFICATION_CHANNEL_ID val builder = NotificationCompat.Builder(context, notificationChannel) @@ -378,8 +380,10 @@ class NotificationUtils @Inject constructor( return builder.build() } - fun buildOutgoingRingingCallNotification(call: WebRtcCall, - title: String): Notification { + fun buildOutgoingRingingCallNotification( + call: WebRtcCall, + title: String + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) val builder = NotificationCompat.Builder(context, SILENT_NOTIFICATION_CHANNEL_ID) .setContentTitle(ensureTitleNotEmpty(title)) @@ -434,8 +438,10 @@ class NotificationUtils @Inject constructor( * @return the call notification. */ @SuppressLint("NewApi") - fun buildPendingCallNotification(call: WebRtcCall, - title: String): Notification { + fun buildPendingCallNotification( + call: WebRtcCall, + title: String + ): Notification { val builder = NotificationCompat.Builder(context, SILENT_NOTIFICATION_CHANNEL_ID) .setContentTitle(ensureTitleNotEmpty(title)) .apply { @@ -586,12 +592,14 @@ class NotificationUtils @Inject constructor( /** * Build a notification for a Room. */ - fun buildMessagesListNotification(messageStyle: NotificationCompat.MessagingStyle, - roomInfo: RoomEventGroupInfo, - largeIcon: Bitmap?, - lastMessageTimestamp: Long, - senderDisplayNameForReplyCompat: String?, - tickerText: String): Notification { + fun buildMessagesListNotification( + messageStyle: NotificationCompat.MessagingStyle, + roomInfo: RoomEventGroupInfo, + largeIcon: Bitmap?, + lastMessageTimestamp: Long, + senderDisplayNameForReplyCompat: String?, + tickerText: String + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked val openRoomIntent = buildOpenRoomIntent(roomInfo.roomId) @@ -702,8 +710,10 @@ class NotificationUtils @Inject constructor( .build() } - fun buildRoomInvitationNotification(inviteNotifiableEvent: InviteNotifiableEvent, - matrixId: String): Notification { + fun buildRoomInvitationNotification( + inviteNotifiableEvent: InviteNotifiableEvent, + matrixId: String + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked val smallIcon = R.drawable.ic_status_bar @@ -776,8 +786,10 @@ class NotificationUtils @Inject constructor( .build() } - fun buildSimpleEventNotification(simpleNotifiableEvent: SimpleNotifiableEvent, - matrixId: String): Notification { + fun buildSimpleEventNotification( + simpleNotifiableEvent: SimpleNotifiableEvent, + matrixId: String + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) // Build the pending intent for when the notification is clicked val smallIcon = R.drawable.ic_status_bar @@ -887,10 +899,12 @@ class NotificationUtils @Inject constructor( /** * Build the summary notification. */ - fun buildSummaryListNotification(style: NotificationCompat.InboxStyle?, - compatSummary: String, - noisy: Boolean, - lastMessageTimestamp: Long): Notification { + fun buildSummaryListNotification( + style: NotificationCompat.InboxStyle?, + compatSummary: String, + noisy: Boolean, + lastMessageTimestamp: Long + ): Notification { val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color) val smallIcon = R.drawable.ic_status_bar diff --git a/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt b/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt index aa54176815..9ef60e62c9 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/RoomGroupMessageCreator.kt @@ -112,7 +112,7 @@ class RoomGroupMessageCreator @Inject constructor( private fun createRoomMessagesGroupSummaryLine(events: List, roomName: String, roomIsDirect: Boolean): CharSequence { return try { when (events.size) { - 1 -> createFirstMessageSummaryLine(events.first(), roomName, roomIsDirect) + 1 -> createFirstMessageSummaryLine(events.first(), roomName, roomIsDirect) else -> { stringProvider.getQuantityString( R.plurals.notification_compat_summary_line_for_room, diff --git a/vector/src/main/java/im/vector/app/features/notifications/SummaryGroupMessageCreator.kt b/vector/src/main/java/im/vector/app/features/notifications/SummaryGroupMessageCreator.kt index 7d1cb074ec..d998c480d0 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/SummaryGroupMessageCreator.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/SummaryGroupMessageCreator.kt @@ -41,10 +41,12 @@ class SummaryGroupMessageCreator @Inject constructor( private val notificationUtils: NotificationUtils ) { - fun createSummaryNotification(roomNotifications: List, - invitationNotifications: List, - simpleNotifications: List, - useCompleteNotificationFormat: Boolean): Notification { + fun createSummaryNotification( + roomNotifications: List, + invitationNotifications: List, + simpleNotifications: List, + useCompleteNotificationFormat: Boolean + ): Notification { val summaryInboxStyle = NotificationCompat.InboxStyle().also { style -> roomNotifications.forEach { style.addLine(it.summaryLine) } invitationNotifications.forEach { style.addLine(it.summaryLine) } @@ -86,12 +88,14 @@ class SummaryGroupMessageCreator @Inject constructor( } } - private fun processSimpleGroupSummary(summaryIsNoisy: Boolean, - messageEventsCount: Int, - simpleEventsCount: Int, - invitationEventsCount: Int, - roomCount: Int, - lastMessageTimestamp: Long): Notification { + private fun processSimpleGroupSummary( + summaryIsNoisy: Boolean, + messageEventsCount: Int, + simpleEventsCount: Int, + invitationEventsCount: Int, + roomCount: Int, + lastMessageTimestamp: Long + ): Notification { // Add the simple events as message (?) val messageNotificationCount = messageEventsCount + simpleEventsCount diff --git a/vector/src/main/java/im/vector/app/features/onboarding/DirectLoginUseCase.kt b/vector/src/main/java/im/vector/app/features/onboarding/DirectLoginUseCase.kt index 3014b199b4..d878eef9e2 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/DirectLoginUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/DirectLoginUseCase.kt @@ -43,9 +43,9 @@ class DirectLoginUseCase @Inject constructor( } private suspend fun createSessionFor(data: WellknownResult, action: LoginOrRegister, config: HomeServerConnectionConfig?) = when (data) { - is WellknownResult.Prompt -> loginDirect(action, data, config) + is WellknownResult.Prompt -> loginDirect(action, data, config) is WellknownResult.FailPrompt -> handleFailPrompt(data, action, config) - else -> onWellKnownError() + else -> onWellKnownError() } private suspend fun handleFailPrompt(data: WellknownResult.FailPrompt, action: LoginOrRegister, config: HomeServerConnectionConfig?): Result { diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingVariantFactory.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingVariantFactory.kt index 52423d7019..d63acb4f82 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingVariantFactory.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingVariantFactory.kt @@ -28,10 +28,11 @@ class OnboardingVariantFactory @Inject constructor( private val orientationLocker: ScreenOrientationLocker, ) { - fun create(activity: OnboardingActivity, - views: ActivityLoginBinding, - onboardingViewModel: Lazy, - loginViewModel2: Lazy + fun create( + activity: OnboardingActivity, + views: ActivityLoginBinding, + onboardingViewModel: Lazy, + loginViewModel2: Lazy ) = when (vectorFeatures.onboardingVariant()) { VectorFeatures.OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE") VectorFeatures.OnboardingVariant.FTUE_AUTH -> FtueAuthVariant( diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt index f5c81773ea..4fa94541e5 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt @@ -80,11 +80,11 @@ abstract class AbstractFtueAuthFragment : VectorBaseFragment + is CancellationException -> /* Ignore this error, user has cancelled the action */ Unit is Failure.UnrecognizedCertificateFailure -> showUnrecognizedCertificateFailure(throwable) - else -> onError(throwable) + else -> onError(throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthCombinedRegisterFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthCombinedRegisterFragment.kt index 0755f18c8c..7a7f630ba9 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthCombinedRegisterFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthCombinedRegisterFragment.kt @@ -138,26 +138,26 @@ class FtueAuthCombinedRegisterFragment @Inject constructor() : AbstractSSOFtueAu // Trick to display the error without text. views.createAccountInput.error = " " when { - throwable.isUsernameInUse() || throwable.isInvalidUsername() -> { + throwable.isUsernameInUse() || throwable.isInvalidUsername() -> { views.createAccountInput.error = errorFormatter.toHumanReadable(throwable) } - throwable.isLoginEmailUnknown() -> { + throwable.isLoginEmailUnknown() -> { views.createAccountInput.error = getString(R.string.login_login_with_email_error) } throwable.isInvalidPassword() && views.createAccountPasswordInput.hasSurroundingSpaces() -> { views.createAccountPasswordInput.error = getString(R.string.auth_invalid_login_param_space_in_password) } - throwable.isWeakPassword() || throwable.isInvalidPassword() -> { + throwable.isWeakPassword() || throwable.isInvalidPassword() -> { views.createAccountPasswordInput.error = errorFormatter.toHumanReadable(throwable) } - throwable.isRegistrationDisabled() -> { + throwable.isRegistrationDisabled() -> { MaterialAlertDialogBuilder(requireActivity()) .setTitle(R.string.dialog_title_error) .setMessage(getString(R.string.login_registration_disabled)) .setPositiveButton(R.string.ok, null) .show() } - else -> { + else -> { super.onError(throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt index 5325b25e93..6cfb7b8e34 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthUseCaseFragment.kt @@ -104,7 +104,7 @@ class FtueAuthUseCaseFragment @Inject constructor( private fun createIcon(@ColorRes tint: Int, icon: Int, isLightMode: Boolean): Drawable { val context = requireContext() val alpha = when (isLightMode) { - true -> LIGHT_MODE_ICON_BACKGROUND_ALPHA + true -> LIGHT_MODE_ICON_BACKGROUND_ALPHA false -> DARK_MODE_ICON_BACKGROUND_ALPHA } val iconBackground = context.getResTintedDrawable(R.drawable.bg_feature_icon, tint, alpha = alpha) diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWebFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWebFragment.kt index 68e8632608..4d912b8ed8 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWebFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthWebFragment.kt @@ -120,8 +120,10 @@ class FtueAuthWebFragment @Inject constructor( views.loginWebWebView.loadUrl(url) views.loginWebWebView.webViewClient = object : WebViewClient() { - override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, - error: SslError) { + override fun onReceivedSslError( + view: WebView, handler: SslErrorHandler, + error: SslError + ) { MaterialAlertDialogBuilder(requireActivity()) .setMessage(R.string.ssl_could_not_verify) .setPositiveButton(R.string.ssl_trust) { _, _ -> handler.proceed() } diff --git a/vector/src/main/java/im/vector/app/features/permalink/PermalinkHandler.kt b/vector/src/main/java/im/vector/app/features/permalink/PermalinkHandler.kt index 5d1ba4e20c..663275e2f7 100644 --- a/vector/src/main/java/im/vector/app/features/permalink/PermalinkHandler.kt +++ b/vector/src/main/java/im/vector/app/features/permalink/PermalinkHandler.kt @@ -45,9 +45,11 @@ import org.matrix.android.sdk.api.session.room.model.RoomType import org.matrix.android.sdk.api.session.room.timeline.isRootThread import javax.inject.Inject -class PermalinkHandler @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, - private val userPreferencesProvider: UserPreferencesProvider, - private val navigator: Navigator) { +class PermalinkHandler @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val userPreferencesProvider: UserPreferencesProvider, + private val navigator: Navigator +) { suspend fun launch( context: Context, @@ -204,13 +206,14 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti } } - private fun NavigationInterceptor?.openJoinedRoomScreen(buildTask: Boolean, - roomId: String, - eventId: String?, - rawLink: Uri, - context: Context, - rootThreadEventId: String?, - roomSummary: RoomSummary + private fun NavigationInterceptor?.openJoinedRoomScreen( + buildTask: Boolean, + roomId: String, + eventId: String?, + rawLink: Uri, + context: Context, + rootThreadEventId: String?, + roomSummary: RoomSummary ) { if (this?.navToRoom(roomId, eventId, rawLink, rootThreadEventId) != true) { if (rootThreadEventId != null && userPreferencesProvider.areThreadMessagesEnabled()) { diff --git a/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt b/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt index 3b7aa18ee9..2c640cd2ca 100644 --- a/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt +++ b/vector/src/main/java/im/vector/app/features/popup/IncomingCallAlert.kt @@ -26,8 +26,9 @@ import im.vector.app.features.displayname.getBestName import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.util.MatrixItem -class IncomingCallAlert(uid: String, - override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true } +class IncomingCallAlert( + uid: String, + override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true } ) : DefaultVectorAlert(uid, "", "", 0, shouldBeDisplayedIn) { override val priority = PopupAlertManager.INCOMING_CALL_PRIORITY @@ -36,11 +37,13 @@ class IncomingCallAlert(uid: String, override val dismissOnClick: Boolean = false override val isLight: Boolean = true - class ViewBinder(private val matrixItem: MatrixItem?, - private val avatarRenderer: AvatarRenderer, - private val isVideoCall: Boolean, - private val onAccept: () -> Unit, - private val onReject: () -> Unit) : VectorAlert.ViewBinder { + class ViewBinder( + private val matrixItem: MatrixItem?, + private val avatarRenderer: AvatarRenderer, + private val isVideoCall: Boolean, + private val onAccept: () -> Unit, + private val onReject: () -> Unit + ) : VectorAlert.ViewBinder { override fun bind(view: View) { val views = AlerterIncomingCallLayoutBinding.bind(view) diff --git a/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt b/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt index d02d5dbfe8..6848bbb1f3 100644 --- a/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt +++ b/vector/src/main/java/im/vector/app/features/popup/VerificationVectorAlert.kt @@ -25,19 +25,22 @@ import im.vector.app.databinding.AlerterVerificationLayoutBinding import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.util.MatrixItem -class VerificationVectorAlert(uid: String, - title: String, - override val description: String, - @DrawableRes override val iconId: Int?, - /** - * Alert are displayed by default, but let this lambda return false to prevent displaying. - */ - override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true } +class VerificationVectorAlert( + uid: String, + title: String, + override val description: String, + @DrawableRes override val iconId: Int?, + /** + * Alert are displayed by default, but let this lambda return false to prevent displaying. + */ + override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true } ) : DefaultVectorAlert(uid, title, description, iconId, shouldBeDisplayedIn) { override val layoutRes = R.layout.alerter_verification_layout - class ViewBinder(private val matrixItem: MatrixItem?, - private val avatarRenderer: AvatarRenderer) : VectorAlert.ViewBinder { + class ViewBinder( + private val matrixItem: MatrixItem?, + private val avatarRenderer: AvatarRenderer + ) : VectorAlert.ViewBinder { override fun bind(view: View) { val views = AlerterVerificationLayoutBinding.bind(view) diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt index e2c1aaa2a4..dfc188180e 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt @@ -168,16 +168,18 @@ class BugReporter @Inject constructor( * @param listener the listener */ @SuppressLint("StaticFieldLeak") - fun sendBugReport(reportType: ReportType, - withDevicesLogs: Boolean, - withCrashLogs: Boolean, - withKeyRequestHistory: Boolean, - withScreenshot: Boolean, - theBugDescription: String, - serverVersion: String, - canContact: Boolean = false, - customFields: Map? = null, - listener: IMXBugReportListener?) { + fun sendBugReport( + reportType: ReportType, + withDevicesLogs: Boolean, + withCrashLogs: Boolean, + withKeyRequestHistory: Boolean, + withScreenshot: Boolean, + theBugDescription: String, + serverVersion: String, + canContact: Boolean = false, + customFields: Map? = null, + listener: IMXBugReportListener? + ) { // enumerate files to delete val mBugReportFiles: MutableList = ArrayList() diff --git a/vector/src/main/java/im/vector/app/features/rageshake/RageShake.kt b/vector/src/main/java/im/vector/app/features/rageshake/RageShake.kt index ce738b85b9..513f99f27d 100644 --- a/vector/src/main/java/im/vector/app/features/rageshake/RageShake.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/RageShake.kt @@ -31,11 +31,13 @@ import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.settings.VectorSettingsActivity import javax.inject.Inject -class RageShake @Inject constructor(private val activity: FragmentActivity, - private val bugReporter: BugReporter, - private val navigator: Navigator, - private val sessionHolder: ActiveSessionHolder, - private val vectorPreferences: VectorPreferences) : ShakeDetector.Listener { +class RageShake @Inject constructor( + private val activity: FragmentActivity, + private val bugReporter: BugReporter, + private val navigator: Navigator, + private val sessionHolder: ActiveSessionHolder, + private val vectorPreferences: VectorPreferences +) : ShakeDetector.Listener { private var shakeDetector: ShakeDetector? = null diff --git a/vector/src/main/java/im/vector/app/features/reactions/EmojiSearchResultViewModel.kt b/vector/src/main/java/im/vector/app/features/reactions/EmojiSearchResultViewModel.kt index 720061e326..829c06616e 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/EmojiSearchResultViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/EmojiSearchResultViewModel.kt @@ -35,7 +35,8 @@ data class EmojiSearchResultViewState( class EmojiSearchResultViewModel @AssistedInject constructor( @Assisted initialState: EmojiSearchResultViewState, - private val dataSource: EmojiDataSource) : + private val dataSource: EmojiDataSource +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/reactions/widget/CircleView.kt b/vector/src/main/java/im/vector/app/features/reactions/widget/CircleView.kt index d2ada9e7cf..b8bba289a1 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/widget/CircleView.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/widget/CircleView.kt @@ -32,8 +32,10 @@ import kotlin.math.min * This view is responsible for drawing big circle that will pulse when clicked * As describe in http://frogermcs.github.io/twitters-like-animation-in-android-alternative/ */ -class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr) { +class CircleView @JvmOverloads constructor( + context: Context, attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : View(context, attrs, defStyleAttr) { var startColor = -0xa8de var endColor = -0x3ef9 diff --git a/vector/src/main/java/im/vector/app/features/reactions/widget/DotsView.kt b/vector/src/main/java/im/vector/app/features/reactions/widget/DotsView.kt index 7b0052db0b..f6a7c4e6b9 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/widget/DotsView.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/widget/DotsView.kt @@ -29,8 +29,10 @@ import kotlin.math.sin * This view will draw dots floating around the center of it's view * As describe in http://frogermcs.github.io/twitters-like-animation-in-android-alternative/ */ -class DotsView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr) { +class DotsView @JvmOverloads constructor( + context: Context, attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : View(context, attrs, defStyleAttr) { private var COLOR_1 = -0x3ef9 private var COLOR_2 = -0x6800 diff --git a/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt b/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt index 7340953f32..1bad4ff248 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt @@ -34,10 +34,12 @@ import javax.inject.Inject * Displays a String reaction (emoji), with a count, and that can be selected or not (toggle) */ @AndroidEntryPoint -class ReactionButton @JvmOverloads constructor(context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0, - defStyleRes: Int = R.style.TimelineReactionView) : +class ReactionButton @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0, + defStyleRes: Int = R.style.TimelineReactionView +) : LinearLayout(context, attrs, defStyleAttr, defStyleRes), View.OnClickListener, View.OnLongClickListener { @Inject lateinit var emojiSpanify: EmojiSpanify diff --git a/vector/src/main/java/im/vector/app/features/room/RequireActiveMembershipViewModel.kt b/vector/src/main/java/im/vector/app/features/room/RequireActiveMembershipViewModel.kt index 0cd289cf64..0626749ff4 100644 --- a/vector/src/main/java/im/vector/app/features/room/RequireActiveMembershipViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/room/RequireActiveMembershipViewModel.kt @@ -51,7 +51,8 @@ import org.matrix.android.sdk.flow.unwrap class RequireActiveMembershipViewModel @AssistedInject constructor( @Assisted initialState: RequireActiveMembershipViewState, private val stringProvider: StringProvider, - private val session: Session) : + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/PublicRoomsController.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/PublicRoomsController.kt index a350bff0bb..fdb2f5ab15 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/PublicRoomsController.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/PublicRoomsController.kt @@ -35,9 +35,11 @@ import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject -class PublicRoomsController @Inject constructor(private val stringProvider: StringProvider, - private val avatarRenderer: AvatarRenderer, - private val errorFormatter: ErrorFormatter) : TypedEpoxyController() { +class PublicRoomsController @Inject constructor( + private val stringProvider: StringProvider, + private val avatarRenderer: AvatarRenderer, + private val errorFormatter: ErrorFormatter +) : TypedEpoxyController() { var callback: Callback? = null diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomActivity.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomActivity.kt index 154c0bbb9d..5ba1b1f64e 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomActivity.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomActivity.kt @@ -81,11 +81,13 @@ class CreateRoomActivity : VectorBaseActivity() { private const val RESULT_CREATED_ROOM_ID = "RESULT_CREATED_ROOM_ID" - fun getIntent(context: Context, - initialName: String = "", - isSpace: Boolean = false, - openAfterCreate: Boolean = true, - currentSpaceId: String? = null): Intent { + fun getIntent( + context: Context, + initialName: String = "", + isSpace: Boolean = false, + openAfterCreate: Boolean = true, + currentSpaceId: String? = null + ): Intent { return Intent(context, CreateRoomActivity::class.java).apply { putExtra( Mavericks.KEY_ARG, CreateRoomArgs( diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt index fae88ed8a2..71c83946d0 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomController.kt @@ -94,7 +94,7 @@ class CreateRoomController @Inject constructor( } when (viewState.roomJoinRules) { - RoomJoinRules.INVITE -> { + RoomJoinRules.INVITE -> { buildProfileAction( id = "joinRule", title = stringProvider.getString(R.string.room_settings_room_access_private_title), @@ -104,7 +104,7 @@ class CreateRoomController @Inject constructor( action = { host.listener?.selectVisibility() } ) } - RoomJoinRules.PUBLIC -> { + RoomJoinRules.PUBLIC -> { buildProfileAction( id = "joinRule", title = stringProvider.getString(R.string.room_settings_room_access_public_title), @@ -124,7 +124,7 @@ class CreateRoomController @Inject constructor( action = { host.listener?.selectVisibility() } ) } - else -> { + else -> { // not yet supported } } diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateSubSpaceController.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateSubSpaceController.kt index 6d2fc15a0b..07f35956d7 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateSubSpaceController.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateSubSpaceController.kt @@ -112,7 +112,7 @@ class CreateSubSpaceController @Inject constructor( } when (data.roomJoinRules) { - RoomJoinRules.INVITE -> { + RoomJoinRules.INVITE -> { buildProfileAction( id = "joinRule", title = stringProvider.getString(R.string.room_settings_room_access_private_title), @@ -122,7 +122,7 @@ class CreateSubSpaceController @Inject constructor( action = { host.listener?.selectVisibility() } ) } - RoomJoinRules.PUBLIC -> { + RoomJoinRules.PUBLIC -> { buildProfileAction( id = "joinRule", title = stringProvider.getString(R.string.room_settings_room_access_public_title), @@ -142,7 +142,7 @@ class CreateSubSpaceController @Inject constructor( action = { host.listener?.selectVisibility() } ) } - else -> { + else -> { // not yet supported } } diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryListCreator.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryListCreator.kt index a168ea749c..0e8c3efa97 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryListCreator.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryListCreator.kt @@ -30,8 +30,10 @@ class RoomDirectoryListCreator @Inject constructor( private val session: Session ) { - fun computeDirectories(thirdPartyProtocolData: Map, - customHomeservers: Set): List { + fun computeDirectories( + thirdPartyProtocolData: Map, + customHomeservers: Set + ): List { val result = ArrayList() val protocols = ArrayList() diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerController.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerController.kt index 7d121d1ff4..8c2eec86ae 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerController.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerController.kt @@ -135,7 +135,7 @@ class RoomDirectoryPickerController @Inject constructor( } when (data.addServerAsync) { Uninitialized, - is Fail -> settingsContinueCancelItem { + is Fail -> settingsContinueCancelItem { id("continueCancel") continueText(host.stringProvider.getString(R.string.ok)) canContinue(data.enteredServer.isNotEmpty()) diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerFragment.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerFragment.kt index cb71f93a0e..66e09bb2d4 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/picker/RoomDirectoryPickerFragment.kt @@ -39,7 +39,8 @@ import im.vector.app.features.roomdirectory.RoomDirectoryViewModel import timber.log.Timber import javax.inject.Inject -class RoomDirectoryPickerFragment @Inject constructor(private val roomDirectoryPickerController: RoomDirectoryPickerController +class RoomDirectoryPickerFragment @Inject constructor( + private val roomDirectoryPickerController: RoomDirectoryPickerController ) : VectorBaseFragment(), OnBackPressed, RoomDirectoryPickerController.Callback { diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt index adc720b0a5..bdf2978cca 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileController.kt @@ -278,7 +278,7 @@ class RoomMemberProfileController @Inject constructor( if (canKick) { when (membership) { - Membership.JOIN -> { + Membership.JOIN -> { buildProfileAction( id = "kick", editable = false, @@ -298,7 +298,7 @@ class RoomMemberProfileController @Inject constructor( action = { callback?.onCancelInviteClicked() } ) } - else -> Unit + else -> Unit } } if (canBan) { diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheetViewModel.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheetViewModel.kt index 19040a1fde..ed8945c9e2 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListBottomSheetViewModel.kt @@ -48,8 +48,10 @@ data class DeviceListViewState( val selectedDevice: CryptoDeviceInfo? = null ) : MavericksState -class DeviceListBottomSheetViewModel @AssistedInject constructor(@Assisted private val initialState: DeviceListViewState, - private val session: Session) : +class DeviceListBottomSheetViewModel @AssistedInject constructor( + @Assisted private val initialState: DeviceListViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt index 6a9d053d2a..1934528d6f 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceListEpoxyController.kt @@ -37,10 +37,12 @@ import me.gujun.android.span.span import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo import javax.inject.Inject -class DeviceListEpoxyController @Inject constructor(private val stringProvider: StringProvider, - private val colorProvider: ColorProvider, - private val dimensionConverter: DimensionConverter, - private val vectorPreferences: VectorPreferences) : +class DeviceListEpoxyController @Inject constructor( + private val stringProvider: StringProvider, + private val colorProvider: ColorProvider, + private val dimensionConverter: DimensionConverter, + private val vectorPreferences: VectorPreferences +) : TypedEpoxyController() { interface InteractionListener { diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt index 0e25ec5f8f..569a7f980c 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/devices/DeviceTrustInfoEpoxyController.kt @@ -32,10 +32,12 @@ import me.gujun.android.span.span import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo import javax.inject.Inject -class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvider: StringProvider, - private val colorProvider: ColorProvider, - private val dimensionConverter: DimensionConverter, - private val vectorPreferences: VectorPreferences) : +class DeviceTrustInfoEpoxyController @Inject constructor( + private val stringProvider: StringProvider, + private val colorProvider: ColorProvider, + private val dimensionConverter: DimensionConverter, + private val vectorPreferences: VectorPreferences +) : TypedEpoxyController() { interface InteractionListener { diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/powerlevel/EditPowerLevelDialogs.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/powerlevel/EditPowerLevelDialogs.kt index 926c9fb60e..66b0a0be5c 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/powerlevel/EditPowerLevelDialogs.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/powerlevel/EditPowerLevelDialogs.kt @@ -29,10 +29,12 @@ import org.matrix.android.sdk.api.session.room.powerlevels.Role object EditPowerLevelDialogs { - fun showChoice(activity: Activity, - @StringRes titleRes: Int, - currentRole: Role, - listener: (Int) -> Unit) { + fun showChoice( + activity: Activity, + @StringRes titleRes: Int, + currentRole: Role, + listener: (Int) -> Unit + ) { val dialogLayout = activity.layoutInflater.inflate(R.layout.dialog_edit_power_level, null) val views = DialogEditPowerLevelBinding.bind(dialogLayout) views.powerLevelRadioGroup.setOnCheckedChangeListener { _, checkedId -> diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasViewModel.kt index a66ef9a659..af4021e715 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/alias/RoomAliasViewModel.kt @@ -43,8 +43,10 @@ import org.matrix.android.sdk.flow.flow import org.matrix.android.sdk.flow.mapOptional import org.matrix.android.sdk.flow.unwrap -class RoomAliasViewModel @AssistedInject constructor(@Assisted initialState: RoomAliasViewState, - private val session: Session) : +class RoomAliasViewModel @AssistedInject constructor( + @Assisted initialState: RoomAliasViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheet.kt b/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheet.kt index 6d6d4564da..7204c227f7 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheet.kt @@ -86,11 +86,13 @@ class RoomAliasBottomSheet : } companion object { - fun newInstance(alias: String, - isPublished: Boolean, - isMainAlias: Boolean, - isLocal: Boolean, - canEditCanonicalAlias: Boolean): RoomAliasBottomSheet { + fun newInstance( + alias: String, + isPublished: Boolean, + isMainAlias: Boolean, + isLocal: Boolean, + canEditCanonicalAlias: Boolean + ): RoomAliasBottomSheet { return RoomAliasBottomSheet().apply { setArguments( RoomAliasBottomSheetArgs( diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheetSharedAction.kt b/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheetSharedAction.kt index d50c19635d..ea18e0ff8f 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheetSharedAction.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/alias/detail/RoomAliasBottomSheetSharedAction.kt @@ -24,7 +24,8 @@ import im.vector.app.core.platform.VectorSharedAction sealed class RoomAliasBottomSheetSharedAction( @StringRes val titleRes: Int, @DrawableRes val iconResId: Int = 0, - val destructive: Boolean = false) : + val destructive: Boolean = false +) : VectorSharedAction { data class ShareAlias(val matrixTo: String) : RoomAliasBottomSheetSharedAction( diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListViewModel.kt index 1fef5e8ff2..d7728f7772 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/banned/RoomBannedMemberListViewModel.kt @@ -42,9 +42,11 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper import org.matrix.android.sdk.flow.flow import org.matrix.android.sdk.flow.unwrap -class RoomBannedMemberListViewModel @AssistedInject constructor(@Assisted initialState: RoomBannedMemberListViewState, - private val stringProvider: StringProvider, - private val session: Session) : +class RoomBannedMemberListViewModel @AssistedInject constructor( + @Assisted initialState: RoomBannedMemberListViewState, + private val stringProvider: StringProvider, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListController.kt index ebcebfa470..8f310a6a89 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListController.kt @@ -117,10 +117,12 @@ class RoomMemberListController @Inject constructor( } } - private fun buildRoomMember(roomMember: RoomMemberSummary, - powerLevelCategory: RoomMemberListCategories, - host: RoomMemberListController, - data: RoomMemberListViewState) { + private fun buildRoomMember( + roomMember: RoomMemberSummary, + powerLevelCategory: RoomMemberListCategories, + host: RoomMemberListController, + data: RoomMemberListViewState + ) { val powerLabel = stringProvider.getString(powerLevelCategory.titleRes) profileMatrixItemWithPowerLevelWithPresence { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt index c1e97f0416..951e3e1dcd 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListFragment.kt @@ -79,7 +79,7 @@ class RoomMemberListFragment @Inject constructor( object : RecyclerView.OnScrollListener() { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { when (newState) { - RecyclerView.SCROLL_STATE_IDLE -> { + RecyclerView.SCROLL_STATE_IDLE -> { if (withState(viewModel) { it.actionsPermissions.canInvite }) { views.inviteUsersButton.show() } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListViewModel.kt index 8863d18560..0ca99eb3c8 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/members/RoomMemberListViewModel.kt @@ -51,9 +51,11 @@ import org.matrix.android.sdk.flow.mapOptional import org.matrix.android.sdk.flow.unwrap import timber.log.Timber -class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState: RoomMemberListViewState, - private val roomMemberSummaryComparator: RoomMemberSummaryComparator, - private val session: Session) : +class RoomMemberListViewModel @AssistedInject constructor( + @Assisted initialState: RoomMemberListViewState, + private val roomMemberSummaryComparator: RoomMemberSummaryComparator, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/EditablePermission.kt b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/EditablePermission.kt index 22d74ff7a3..d9c1bca2da 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/EditablePermission.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/EditablePermission.kt @@ -25,9 +25,10 @@ import org.matrix.android.sdk.api.session.events.model.EventType */ sealed class EditablePermission(@StringRes val labelResId: Int, @StringRes val spaceLabelResId: Int = labelResId) { // Updates `content.events.[eventType]` - open class EventTypeEditablePermission(val eventType: String, - @StringRes labelResId: Int, - @StringRes spaceLabelResId: Int = labelResId + open class EventTypeEditablePermission( + val eventType: String, + @StringRes labelResId: Int, + @StringRes spaceLabelResId: Int = labelResId ) : EditablePermission(labelResId, spaceLabelResId) class ModifyWidgets : EventTypeEditablePermission( diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt index fffae6159c..5c9695a6f5 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsController.kt @@ -168,10 +168,12 @@ class RoomPermissionsController @Inject constructor( } } - private fun buildPermission(editablePermission: EditablePermission, - content: PowerLevelsContent, - editable: Boolean, - isSpace: Boolean) { + private fun buildPermission( + editablePermission: EditablePermission, + content: PowerLevelsContent, + editable: Boolean, + isSpace: Boolean + ) { val currentRole = getCurrentRole(editablePermission, content) buildProfileAction( id = editablePermission.labelResId.toString(), diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsViewModel.kt index e387cca004..99c1531a03 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/permissions/RoomPermissionsViewModel.kt @@ -37,8 +37,10 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper import org.matrix.android.sdk.flow.flow import org.matrix.android.sdk.flow.unwrap -class RoomPermissionsViewModel @AssistedInject constructor(@Assisted initialState: RoomPermissionsViewState, - private val session: Session) : +class RoomPermissionsViewModel @AssistedInject constructor( + @Assisted initialState: RoomPermissionsViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory @@ -88,7 +90,7 @@ class RoomPermissionsViewModel @AssistedInject constructor(@Assisted initialStat override fun handle(action: RoomPermissionsAction) { when (action) { - is RoomPermissionsAction.UpdatePermission -> updatePermission(action) + is RoomPermissionsAction.UpdatePermission -> updatePermission(action) RoomPermissionsAction.ToggleShowAllPermissions -> toggleShowAllPermissions() } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewModel.kt index ee04d22ddc..cec972d982 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewModel.kt @@ -46,9 +46,11 @@ import org.matrix.android.sdk.flow.flow import org.matrix.android.sdk.flow.mapOptional import org.matrix.android.sdk.flow.unwrap -class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState: RoomSettingsViewState, - private val vectorPreferences: VectorPreferences, - private val session: Session) : +class RoomSettingsViewModel @AssistedInject constructor( + @Assisted initialState: RoomSettingsViewState, + private val vectorPreferences: VectorPreferences, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewState.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewState.kt index fe7c984cb4..ae5aadbaa7 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewState.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsViewState.kt @@ -62,8 +62,10 @@ data class RoomSettingsViewState( sealed class AvatarAction { object None : AvatarAction() object DeleteAvatar : AvatarAction() - data class UpdateAvatar(val newAvatarUri: Uri, - val newAvatarFileName: String) : AvatarAction() + data class UpdateAvatar( + val newAvatarUri: Uri, + val newAvatarFileName: String + ) : AvatarAction() } data class NewJoinRule( diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleBottomSheet.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleBottomSheet.kt index 4185c2031b..dbbd193631 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleBottomSheet.kt @@ -69,12 +69,13 @@ class RoomJoinRuleBottomSheet : BottomSheetGeneric = listOf( - RoomJoinRules.INVITE, RoomJoinRules.PUBLIC - ).map { it.toOption(true) }, - isSpace: Boolean = false, - parentSpaceName: String? = null + fun newInstance( + currentRoomJoinRule: RoomJoinRules, + allowedJoinedRules: List = listOf( + RoomJoinRules.INVITE, RoomJoinRules.PUBLIC + ).map { it.toOption(true) }, + isSpace: Boolean = false, + parentSpaceName: String? = null ): RoomJoinRuleBottomSheet { return RoomJoinRuleBottomSheet().apply { setArguments( diff --git a/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt index ad73854060..b9f272f88f 100644 --- a/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt @@ -43,8 +43,10 @@ data class DeactivateAccountViewState( val dummy: Boolean = false ) : MavericksState -class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private val initialState: DeactivateAccountViewState, - private val session: Session) : +class DeactivateAccountViewModel @AssistedInject constructor( + @Assisted private val initialState: DeactivateAccountViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt index c81064c8d9..572f287a40 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt @@ -92,9 +92,11 @@ class CrossSigningSettingsViewModel @AssistedInject constructor( awaitCallback { session.cryptoService().crossSigningService().initializeCrossSigning( object : UserInteractiveAuthInterceptor { - override fun performStage(flowResponse: RegistrationFlowResponse, - errCode: String?, - promise: Continuation) { + override fun performStage( + flowResponse: RegistrationFlowResponse, + errCode: String?, + promise: Continuation + ) { Timber.d("## UIA : initializeCrossSigning UIA") if (flowResponse.nextUncompletedStage() == LoginFlowTypes.PASSWORD && reAuthHelper.data != null && errCode == null) { diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetController.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetController.kt index 648e9b3261..933f035474 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetController.kt @@ -34,7 +34,8 @@ import javax.inject.Inject class DeviceVerificationInfoBottomSheetController @Inject constructor( private val stringProvider: StringProvider, - private val colorProvider: ColorProvider) : + private val colorProvider: ColorProvider +) : TypedEpoxyController() { var callback: Callback? = null diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetViewModel.kt index b24b8475a5..beabcd3b84 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetViewModel.kt @@ -30,8 +30,9 @@ import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo import org.matrix.android.sdk.flow.flow -class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@Assisted initialState: DeviceVerificationInfoBottomSheetViewState, - val session: Session +class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor( + @Assisted initialState: DeviceVerificationInfoBottomSheetViewState, + val session: Session ) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt index 2659ff4966..2077f07fc3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesController.kt @@ -36,12 +36,14 @@ import org.matrix.android.sdk.api.session.crypto.crosssigning.DeviceTrustLevel import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo import javax.inject.Inject -class DevicesController @Inject constructor(private val errorFormatter: ErrorFormatter, - private val stringProvider: StringProvider, - private val colorProvider: ColorProvider, - private val dateFormatter: VectorDateFormatter, - private val dimensionConverter: DimensionConverter, - private val vectorPreferences: VectorPreferences) : EpoxyController() { +class DevicesController @Inject constructor( + private val errorFormatter: ErrorFormatter, + private val stringProvider: StringProvider, + private val colorProvider: ColorProvider, + private val dateFormatter: VectorDateFormatter, + private val dimensionConverter: DimensionConverter, + private val vectorPreferences: VectorPreferences +) : EpoxyController() { var callback: Callback? = null private var viewState: DevicesViewState? = null @@ -75,10 +77,12 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor } } - private fun buildDevicesList(devices: List, - myDeviceId: String, - legacyMode: Boolean, - currentSessionCrossTrusted: Boolean) { + private fun buildDevicesList( + devices: List, + myDeviceId: String, + legacyMode: Boolean, + currentSessionCrossTrusted: Boolean + ) { val host = this devices .firstOrNull { diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/TrustUtils.kt b/vector/src/main/java/im/vector/app/features/settings/devices/TrustUtils.kt index eadf020f7e..3477f10e74 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/TrustUtils.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/TrustUtils.kt @@ -21,10 +21,12 @@ import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel object TrustUtils { - fun shieldForTrust(currentDevice: Boolean, - trustMSK: Boolean, - legacyMode: Boolean, - deviceTrustLevel: DeviceTrustLevel?): RoomEncryptionTrustLevel { + fun shieldForTrust( + currentDevice: Boolean, + trustMSK: Boolean, + legacyMode: Boolean, + deviceTrustLevel: DeviceTrustLevel? + ): RoomEncryptionTrustLevel { return when { currentDevice -> { if (legacyMode) { diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataViewModel.kt index 72085d37fd..d773d80c93 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/AccountDataViewModel.kt @@ -36,8 +36,10 @@ data class AccountDataViewState( val accountData: Async> = Uninitialized ) : MavericksState -class AccountDataViewModel @AssistedInject constructor(@Assisted initialState: AccountDataViewState, - private val session: Session) : +class AccountDataViewModel @AssistedInject constructor( + @Assisted initialState: AccountDataViewState, + private val session: Session +) : VectorViewModel(initialState) { init { diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsPaperTrailViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsPaperTrailViewModel.kt index e7f09b09e0..576cb1bf6b 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsPaperTrailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsPaperTrailViewModel.kt @@ -38,8 +38,10 @@ data class GossipingEventsPaperTrailState( val events: Async> = Uninitialized ) : MavericksState -class GossipingEventsPaperTrailViewModel @AssistedInject constructor(@Assisted initialState: GossipingEventsPaperTrailState, - private val session: Session) : +class GossipingEventsPaperTrailViewModel @AssistedInject constructor( + @Assisted initialState: GossipingEventsPaperTrailState, + private val session: Session +) : VectorViewModel(initialState) { init { diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt index b8d82699e6..0d79501753 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/GossipingEventsSerializer.kt @@ -34,10 +34,10 @@ class GossipingEventsSerializer { append("[${getFormattedDate(trail.ageLocalTs)}] ${type.name} ") append("sessionId: ${info.sessionId} ") when (type) { - TrailType.IncomingKeyRequest -> { + TrailType.IncomingKeyRequest -> { append("from:${info.userId}|${info.deviceId} - ") } - TrailType.OutgoingKeyForward -> { + TrailType.OutgoingKeyForward -> { append("to:${info.userId}|${info.deviceId} - ") (trail.info as? ForwardInfo)?.let { append("chainIndex: ${it.chainIndex} ") @@ -49,13 +49,13 @@ class GossipingEventsSerializer { append("code: ${it.code} ") } } - TrailType.IncomingKeyForward -> { + TrailType.IncomingKeyForward -> { append("from:${info.userId}|${info.deviceId} - ") (trail.info as? ForwardInfo)?.let { append("chainIndex: ${it.chainIndex} ") } } - else -> { + else -> { append("??") } } diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestListViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestListViewModel.kt index e0a130a1e6..7574339bb1 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestListViewModel.kt @@ -40,8 +40,10 @@ data class KeyRequestListViewState( val outgoingRoomKeyRequests: Async> = Uninitialized ) : MavericksState -class KeyRequestListViewModel @AssistedInject constructor(@Assisted initialState: KeyRequestListViewState, - private val session: Session) : +class KeyRequestListViewModel @AssistedInject constructor( + @Assisted initialState: KeyRequestListViewState, + private val session: Session +) : VectorViewModel(initialState) { init { diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestViewModel.kt index f2df0e4211..3c451c4fc3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/KeyRequestViewModel.kt @@ -50,7 +50,8 @@ data class KeyRequestViewState( class KeyRequestViewModel @AssistedInject constructor( @Assisted initialState: KeyRequestViewState, - private val session: Session) : + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/settings/ignored/IgnoredUsersController.kt b/vector/src/main/java/im/vector/app/features/settings/ignored/IgnoredUsersController.kt index 286379986d..c0ab0bb02f 100644 --- a/vector/src/main/java/im/vector/app/features/settings/ignored/IgnoredUsersController.kt +++ b/vector/src/main/java/im/vector/app/features/settings/ignored/IgnoredUsersController.kt @@ -25,8 +25,10 @@ import org.matrix.android.sdk.api.session.user.model.User import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject -class IgnoredUsersController @Inject constructor(private val stringProvider: StringProvider, - private val avatarRenderer: AvatarRenderer) : EpoxyController() { +class IgnoredUsersController @Inject constructor( + private val stringProvider: StringProvider, + private val avatarRenderer: AvatarRenderer +) : EpoxyController() { var callback: Callback? = null private var viewState: IgnoredUsersViewState? = null diff --git a/vector/src/main/java/im/vector/app/features/settings/push/PushGatewaysViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/push/PushGatewaysViewModel.kt index 14b7a53b65..9ae8b45c3c 100644 --- a/vector/src/main/java/im/vector/app/features/settings/push/PushGatewaysViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/push/PushGatewaysViewModel.kt @@ -35,8 +35,10 @@ data class PushGatewayViewState( val pushGateways: Async> = Uninitialized ) : MavericksState -class PushGatewaysViewModel @AssistedInject constructor(@Assisted initialState: PushGatewayViewState, - private val session: Session) : +class PushGatewaysViewModel @AssistedInject constructor( + @Assisted initialState: PushGatewayViewState, + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt index c567026eb1..e8a92c9e3f 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestAccountSettings.kt @@ -32,8 +32,10 @@ import javax.inject.Inject /** * Check that the main pushRule (RULE_ID_DISABLE_ALL) is correctly setup. */ -class TestAccountSettings @Inject constructor(private val stringProvider: StringProvider, - private val activeSessionHolder: ActiveSessionHolder) : +class TestAccountSettings @Inject constructor( + private val stringProvider: StringProvider, + private val activeSessionHolder: ActiveSessionHolder +) : TroubleshootTest(R.string.settings_troubleshoot_test_account_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt index c58b7f4ebc..e18c6ce4e1 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestDeviceSettings.kt @@ -25,8 +25,10 @@ import javax.inject.Inject /** * Checks if notifications are enable in the system settings for this app. */ -class TestDeviceSettings @Inject constructor(private val vectorPreferences: VectorPreferences, - private val stringProvider: StringProvider) : +class TestDeviceSettings @Inject constructor( + private val vectorPreferences: VectorPreferences, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_device_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt index c2e5dc4997..22fab0cad4 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNotification.kt @@ -27,9 +27,11 @@ import javax.inject.Inject /** * Checks if notifications can be displayed and clicked by the user. */ -class TestNotification @Inject constructor(private val context: Context, - private val notificationUtils: NotificationUtils, - private val stringProvider: StringProvider) : +class TestNotification @Inject constructor( + private val context: Context, + private val notificationUtils: NotificationUtils, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_notification_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt index ae57babf9a..837b4952f0 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestPushRulesSettings.kt @@ -25,8 +25,10 @@ import org.matrix.android.sdk.api.session.pushrules.RuleIds import org.matrix.android.sdk.api.session.pushrules.getActions import javax.inject.Inject -class TestPushRulesSettings @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, - private val stringProvider: StringProvider) : +class TestPushRulesSettings @Inject constructor( + private val activeSessionHolder: ActiveSessionHolder, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_bing_settings_title) { private val testedRules = diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt index f3e64659cf..2c73bef701 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestSystemSettings.kt @@ -27,8 +27,10 @@ import javax.inject.Inject /** * Checks if notifications are enable in the system settings for this app. */ -class TestSystemSettings @Inject constructor(private val context: FragmentActivity, - private val stringProvider: StringProvider) : +class TestSystemSettings @Inject constructor( + private val context: FragmentActivity, + private val stringProvider: StringProvider +) : TroubleshootTest(R.string.settings_troubleshoot_test_system_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { diff --git a/vector/src/main/java/im/vector/app/features/share/IncomingShareController.kt b/vector/src/main/java/im/vector/app/features/share/IncomingShareController.kt index fd35bf11a4..b322d7d1ce 100644 --- a/vector/src/main/java/im/vector/app/features/share/IncomingShareController.kt +++ b/vector/src/main/java/im/vector/app/features/share/IncomingShareController.kt @@ -26,8 +26,10 @@ import im.vector.app.features.home.room.list.RoomSummaryItemFactory import org.matrix.android.sdk.api.session.room.model.RoomSummary import javax.inject.Inject -class IncomingShareController @Inject constructor(private val roomSummaryItemFactory: RoomSummaryItemFactory, - private val stringProvider: StringProvider) : TypedEpoxyController() { +class IncomingShareController @Inject constructor( + private val roomSummaryItemFactory: RoomSummaryItemFactory, + private val stringProvider: StringProvider +) : TypedEpoxyController() { interface Callback { fun onRoomClicked(roomSummary: RoomSummary) diff --git a/vector/src/main/java/im/vector/app/features/share/IncomingShareViewEvents.kt b/vector/src/main/java/im/vector/app/features/share/IncomingShareViewEvents.kt index 3f5a43e103..3c61503b01 100644 --- a/vector/src/main/java/im/vector/app/features/share/IncomingShareViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/share/IncomingShareViewEvents.kt @@ -21,9 +21,11 @@ import org.matrix.android.sdk.api.session.content.ContentAttachmentData import org.matrix.android.sdk.api.session.room.model.RoomSummary sealed class IncomingShareViewEvents : VectorViewEvents { - data class ShareToRoom(val roomSummary: RoomSummary, - val sharedData: SharedData, - val showAlert: Boolean) : IncomingShareViewEvents() + data class ShareToRoom( + val roomSummary: RoomSummary, + val sharedData: SharedData, + val showAlert: Boolean + ) : IncomingShareViewEvents() data class EditMediaBeforeSending(val contentAttachmentData: List) : IncomingShareViewEvents() data class MultipleRoomsShareDone(val roomId: String) : IncomingShareViewEvents() diff --git a/vector/src/main/java/im/vector/app/features/share/IncomingShareViewModel.kt b/vector/src/main/java/im/vector/app/features/share/IncomingShareViewModel.kt index d184713f60..deb0b14a42 100644 --- a/vector/src/main/java/im/vector/app/features/share/IncomingShareViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/share/IncomingShareViewModel.kt @@ -42,7 +42,8 @@ import org.matrix.android.sdk.flow.flow class IncomingShareViewModel @AssistedInject constructor( @Assisted initialState: IncomingShareViewState, private val session: Session, - private val breadcrumbsRoomComparator: BreadcrumbsRoomComparator) : + private val breadcrumbsRoomComparator: BreadcrumbsRoomComparator +) : VectorViewModel(initialState) { @AssistedFactory @@ -142,10 +143,12 @@ class IncomingShareViewModel @AssistedInject constructor( } } - private fun shareAttachments(attachmentData: List, - selectedRoomIds: Set, - proposeMediaEdition: Boolean, - compressMediaBeforeSending: Boolean) { + private fun shareAttachments( + attachmentData: List, + selectedRoomIds: Set, + proposeMediaEdition: Boolean, + compressMediaBeforeSending: Boolean + ) { if (proposeMediaEdition) { val grouped = attachmentData.toGroupedContentAttachmentData() if (grouped.notPreviewables.isNotEmpty()) { diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt index 52b6cc0749..62375c188b 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt @@ -63,12 +63,13 @@ import org.matrix.android.sdk.api.session.space.model.TopLevelSpaceComparator import org.matrix.android.sdk.api.util.toMatrixItem import org.matrix.android.sdk.flow.flow -class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: SpaceListViewState, - private val appStateHandler: AppStateHandler, - private val session: Session, - private val vectorPreferences: VectorPreferences, - private val autoAcceptInvites: AutoAcceptInvites, - private val analyticsTracker: AnalyticsTracker +class SpaceListViewModel @AssistedInject constructor( + @Assisted initialState: SpaceListViewState, + private val appStateHandler: AppStateHandler, + private val session: Session, + private val vectorPreferences: VectorPreferences, + private val autoAcceptInvites: AutoAcceptInvites, + private val analyticsTracker: AnalyticsTracker ) : VectorViewModel(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt index ca9c05f3f9..302676a27c 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt @@ -107,11 +107,13 @@ class SpaceSummaryController @Inject constructor( } } - private fun buildGroupModels(summaries: List?, - selected: RoomGroupingMethod, - rootSpaces: List?, - expandedStates: Map, - homeCount: RoomAggregateNotificationCount) { + private fun buildGroupModels( + summaries: List?, + selected: RoomGroupingMethod, + rootSpaces: List?, + expandedStates: Map, + homeCount: RoomAggregateNotificationCount + ) { val host = this spaceBetaHeaderItem { id("beta_header") @@ -187,11 +189,13 @@ class SpaceSummaryController @Inject constructor( } } - private fun buildSubSpace(idPrefix: String, - summaries: List?, - expandedStates: Map, - selected: RoomGroupingMethod, - info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) { + private fun buildSubSpace( + idPrefix: String, + summaries: List?, + expandedStates: Map, + selected: RoomGroupingMethod, + info: SpaceChildInfo, currentDepth: Int, maxDepth: Int + ) { val host = this if (currentDepth >= maxDepth) return val childSummary = summaries?.firstOrNull { it.roomId == info.childRoomId } ?: return diff --git a/vector/src/main/java/im/vector/app/features/spaces/invite/SpaceInviteBottomSheetViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/invite/SpaceInviteBottomSheetViewModel.kt index 5e56373a88..ea36908dd2 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/invite/SpaceInviteBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/invite/SpaceInviteBottomSheetViewModel.kt @@ -101,7 +101,7 @@ class SpaceInviteBottomSheetViewModel @AssistedInject constructor( override fun handle(action: SpaceInviteBottomSheetAction) { when (action) { - SpaceInviteBottomSheetAction.DoJoin -> { + SpaceInviteBottomSheetAction.DoJoin -> { setState { copy(joinActionState = Loading()) } session.coroutineScope.launch(Dispatchers.IO) { try { diff --git a/vector/src/main/java/im/vector/app/features/spaces/leave/SpaceLeaveAdvancedFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/leave/SpaceLeaveAdvancedFragment.kt index 308572a30f..ed724db6c0 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/leave/SpaceLeaveAdvancedFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/leave/SpaceLeaveAdvancedFragment.kt @@ -141,7 +141,8 @@ class SpaceLeaveAdvancedFragment @Inject constructor( private fun MenuItem.bind( onExpanded: () -> Unit, onCollapsed: () -> Unit, - onTextChanged: (String) -> Unit) { + onTextChanged: (String) -> Unit + ) { setOnActionExpandListener(object : MenuItem.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem?): Boolean { onExpanded() diff --git a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleListController.kt b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleListController.kt index 1fbe9bbbf9..5e6efcc816 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleListController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/people/SpacePeopleListController.kt @@ -150,9 +150,9 @@ class SpacePeopleListController @Inject constructor( private fun toPowerLevelLabel(categories: RoomMemberListCategories): String? { return when (categories) { - RoomMemberListCategories.ADMIN -> stringProvider.getString(R.string.power_level_admin) + RoomMemberListCategories.ADMIN -> stringProvider.getString(R.string.power_level_admin) RoomMemberListCategories.MODERATOR -> stringProvider.getString(R.string.power_level_moderator) - else -> null + else -> null } } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpaceTabView.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpaceTabView.kt index ea28129262..0ad3be5ce7 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpaceTabView.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpaceTabView.kt @@ -21,9 +21,11 @@ import android.util.AttributeSet import android.widget.LinearLayout import im.vector.app.R -class SpaceTabView constructor(context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0) : +class SpaceTabView constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : LinearLayout(context, attrs, defStyleAttr) { constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) {} diff --git a/vector/src/main/java/im/vector/app/features/spaces/share/ShareSpaceViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/share/ShareSpaceViewModel.kt index 43d69e6fef..bbec676fb2 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/share/ShareSpaceViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/share/ShareSpaceViewModel.kt @@ -36,7 +36,8 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper class ShareSpaceViewModel @AssistedInject constructor( @Assisted private val initialState: ShareSpaceViewState, - private val session: Session) : VectorViewModel(initialState) { + private val session: Session +) : VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt b/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt index 27116093d2..4dc288e353 100755 --- a/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt +++ b/vector/src/main/java/im/vector/app/features/sync/widget/SyncStateView.kt @@ -39,10 +39,11 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute } @SuppressLint("SetTextI18n") - fun render(newState: SyncState, - incrementalSyncStatus: SyncStatusService.Status.IncrementalSyncStatus, - pushCounter: Int, - showDebugInfo: Boolean + fun render( + newState: SyncState, + incrementalSyncStatus: SyncStatusService.Status.IncrementalSyncStatus, + pushCounter: Int, + showDebugInfo: Boolean ) { views.syncStateDebugInfo.isVisible = showDebugInfo if (showDebugInfo) { diff --git a/vector/src/main/java/im/vector/app/features/themes/ActivityOtherThemes.kt b/vector/src/main/java/im/vector/app/features/themes/ActivityOtherThemes.kt index 8c21e96bea..656110c43d 100644 --- a/vector/src/main/java/im/vector/app/features/themes/ActivityOtherThemes.kt +++ b/vector/src/main/java/im/vector/app/features/themes/ActivityOtherThemes.kt @@ -23,8 +23,10 @@ import im.vector.app.R * Class to manage Activity other possible themes. * Note that style for light theme is default and is declared in the Android Manifest */ -sealed class ActivityOtherThemes(@StyleRes val dark: Int, - @StyleRes val black: Int) { +sealed class ActivityOtherThemes( + @StyleRes val dark: Int, + @StyleRes val black: Int +) { object Default : ActivityOtherThemes( R.style.Theme_Vector_Dark, diff --git a/vector/src/main/java/im/vector/app/features/usercode/UserCodeSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/usercode/UserCodeSharedViewModel.kt index 505bbdd2dd..8f761e2dbd 100644 --- a/vector/src/main/java/im/vector/app/features/usercode/UserCodeSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/usercode/UserCodeSharedViewModel.kt @@ -42,7 +42,8 @@ class UserCodeSharedViewModel @AssistedInject constructor( private val session: Session, private val stringProvider: StringProvider, private val directRoomHelper: DirectRoomHelper, - private val rawService: RawService) : VectorViewModel(initialState) { + private val rawService: RawService +) : VectorViewModel(initialState) { companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() diff --git a/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt b/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt index 55858b2baf..f04b70beee 100644 --- a/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt +++ b/vector/src/main/java/im/vector/app/features/userdirectory/UserListController.kt @@ -40,11 +40,13 @@ import org.matrix.android.sdk.api.session.user.model.User import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject -class UserListController @Inject constructor(private val session: Session, - private val avatarRenderer: AvatarRenderer, - private val stringProvider: StringProvider, - private val colorProvider: ColorProvider, - private val errorFormatter: ErrorFormatter) : EpoxyController() { +class UserListController @Inject constructor( + private val session: Session, + private val avatarRenderer: AvatarRenderer, + private val stringProvider: StringProvider, + private val colorProvider: ColorProvider, + private val errorFormatter: ErrorFormatter +) : EpoxyController() { private var state: UserListViewState? = null diff --git a/vector/src/main/java/im/vector/app/features/webview/ConsentWebViewEventListener.kt b/vector/src/main/java/im/vector/app/features/webview/ConsentWebViewEventListener.kt index e7f5ac29b9..2eaaa7ac51 100644 --- a/vector/src/main/java/im/vector/app/features/webview/ConsentWebViewEventListener.kt +++ b/vector/src/main/java/im/vector/app/features/webview/ConsentWebViewEventListener.kt @@ -29,9 +29,11 @@ private const val RIOT_BOT_ID = "@riot-bot:matrix.org" * This class is the Consent implementation of WebViewEventListener. * It is used to manage the consent agreement flow. */ -class ConsentWebViewEventListener(activity: VectorBaseActivity<*>, - private val session: Session, - private val delegate: WebViewEventListener) : +class ConsentWebViewEventListener( + activity: VectorBaseActivity<*>, + private val session: Session, + private val delegate: WebViewEventListener +) : WebViewEventListener by delegate { private val safeActivity: VectorBaseActivity<*>? by weak(activity) diff --git a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt index fd26fff017..0678d5143d 100644 --- a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt +++ b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt @@ -115,10 +115,12 @@ class VectorWebViewActivity : VectorBaseActivity() private const val USE_TITLE_FROM_WEB_PAGE = "" - fun getIntent(context: Context, - url: String, - title: String = USE_TITLE_FROM_WEB_PAGE, - mode: WebViewMode = WebViewMode.DEFAULT): Intent { + fun getIntent( + context: Context, + url: String, + title: String = USE_TITLE_FROM_WEB_PAGE, + mode: WebViewMode = WebViewMode.DEFAULT + ): Intent { return Intent(context, VectorWebViewActivity::class.java) .apply { putExtra(EXTRA_URL, url) diff --git a/vector/src/main/java/im/vector/app/features/widgets/WidgetPostAPIHandler.kt b/vector/src/main/java/im/vector/app/features/widgets/WidgetPostAPIHandler.kt index fc73e71b51..203b63d70b 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/WidgetPostAPIHandler.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/WidgetPostAPIHandler.kt @@ -42,9 +42,11 @@ import org.matrix.android.sdk.api.session.widgets.WidgetPostAPIMediator import org.matrix.android.sdk.api.util.JsonDict import timber.log.Timber -class WidgetPostAPIHandler @AssistedInject constructor(@Assisted private val roomId: String, - private val stringProvider: StringProvider, - private val session: Session) : WidgetPostAPIMediator.Handler { +class WidgetPostAPIHandler @AssistedInject constructor( + @Assisted private val roomId: String, + private val stringProvider: StringProvider, + private val session: Session +) : WidgetPostAPIMediator.Handler { @AssistedFactory interface Factory { diff --git a/vector/src/main/java/im/vector/app/features/widgets/WidgetViewModel.kt b/vector/src/main/java/im/vector/app/features/widgets/WidgetViewModel.kt index c7b1429304..e06c8b2134 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/WidgetViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/WidgetViewModel.kt @@ -48,10 +48,12 @@ import org.matrix.android.sdk.flow.unwrap import timber.log.Timber import javax.net.ssl.HttpsURLConnection -class WidgetViewModel @AssistedInject constructor(@Assisted val initialState: WidgetViewState, - widgetPostAPIHandlerFactory: WidgetPostAPIHandler.Factory, - private val stringProvider: StringProvider, - private val session: Session) : +class WidgetViewModel @AssistedInject constructor( + @Assisted val initialState: WidgetViewState, + widgetPostAPIHandlerFactory: WidgetPostAPIHandler.Factory, + private val stringProvider: StringProvider, + private val session: Session +) : VectorViewModel(initialState), WidgetPostAPIHandler.NavigationCallback, IntegrationManagerService.Listener { diff --git a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionViewModel.kt b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionViewModel.kt index 7ab2cf174d..b6b805e5f0 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/permissions/RoomWidgetPermissionViewModel.kt @@ -35,8 +35,10 @@ import org.matrix.android.sdk.flow.flow import timber.log.Timber import java.net.URL -class RoomWidgetPermissionViewModel @AssistedInject constructor(@Assisted val initialState: RoomWidgetPermissionViewState, - private val session: Session) : +class RoomWidgetPermissionViewModel @AssistedInject constructor( + @Assisted val initialState: RoomWidgetPermissionViewState, + private val session: Session +) : VectorViewModel(initialState) { private val widgetService = session.widgetService() diff --git a/vector/src/main/java/im/vector/app/features/widgets/permissions/WidgetPermissionsHelper.kt b/vector/src/main/java/im/vector/app/features/widgets/permissions/WidgetPermissionsHelper.kt index 5664609a99..c9f71749c1 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/permissions/WidgetPermissionsHelper.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/permissions/WidgetPermissionsHelper.kt @@ -20,8 +20,10 @@ import org.matrix.android.sdk.api.query.QueryStringValue import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService import org.matrix.android.sdk.api.session.widgets.WidgetService -class WidgetPermissionsHelper(private val integrationManagerService: IntegrationManagerService, - private val widgetService: WidgetService) { +class WidgetPermissionsHelper( + private val integrationManagerService: IntegrationManagerService, + private val widgetService: WidgetService +) { suspend fun changePermission(roomId: String, widgetId: String, allow: Boolean) { val widget = widgetService.getRoomWidgets( diff --git a/vector/src/main/java/im/vector/app/features/workers/signout/ServerBackupStatusViewModel.kt b/vector/src/main/java/im/vector/app/features/workers/signout/ServerBackupStatusViewModel.kt index 8c24b2893a..52501c3ad8 100644 --- a/vector/src/main/java/im/vector/app/features/workers/signout/ServerBackupStatusViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/workers/signout/ServerBackupStatusViewModel.kt @@ -62,8 +62,10 @@ sealed class BannerState { object BackingUp : BannerState() } -class ServerBackupStatusViewModel @AssistedInject constructor(@Assisted initialState: ServerBackupStatusViewState, - private val session: Session) : +class ServerBackupStatusViewModel @AssistedInject constructor( + @Assisted initialState: ServerBackupStatusViewState, + private val session: Session +) : VectorViewModel(initialState), KeysBackupStateListener { @AssistedFactory diff --git a/vector/src/test/java/im/vector/app/features/notifications/NotificationRendererTest.kt b/vector/src/test/java/im/vector/app/features/notifications/NotificationRendererTest.kt index 7bfdfdc40c..f13bd90fce 100644 --- a/vector/src/test/java/im/vector/app/features/notifications/NotificationRendererTest.kt +++ b/vector/src/test/java/im/vector/app/features/notifications/NotificationRendererTest.kt @@ -205,11 +205,13 @@ class NotificationRendererTest { givenNotifications(emptyList(), emptyList(), emptyList(), USE_COMPLETE_NOTIFICATION_FORMAT, A_REMOVE_SUMMARY_NOTIFICATION) } - private fun givenNotifications(roomNotifications: List = emptyList(), - invitationNotifications: List = emptyList(), - simpleNotifications: List = emptyList(), - useCompleteNotificationFormat: Boolean = USE_COMPLETE_NOTIFICATION_FORMAT, - summaryNotification: SummaryNotification = A_SUMMARY_NOTIFICATION) { + private fun givenNotifications( + roomNotifications: List = emptyList(), + invitationNotifications: List = emptyList(), + simpleNotifications: List = emptyList(), + useCompleteNotificationFormat: Boolean = USE_COMPLETE_NOTIFICATION_FORMAT, + summaryNotification: SummaryNotification = A_SUMMARY_NOTIFICATION + ) { notificationFactory.givenNotificationsFor( groupedEvents = A_PROCESSED_EVENTS, myUserId = MY_USER_ID, diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeNotificationFactory.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeNotificationFactory.kt index a6e7d1a078..7fec142b3d 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeNotificationFactory.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeNotificationFactory.kt @@ -28,15 +28,17 @@ class FakeNotificationFactory { val instance = mockk() - fun givenNotificationsFor(groupedEvents: GroupedNotificationEvents, - myUserId: String, - myUserDisplayName: String, - myUserAvatarUrl: String?, - useCompleteNotificationFormat: Boolean, - roomNotifications: List, - invitationNotifications: List, - simpleNotifications: List, - summaryNotification: SummaryNotification) { + fun givenNotificationsFor( + groupedEvents: GroupedNotificationEvents, + myUserId: String, + myUserDisplayName: String, + myUserAvatarUrl: String?, + useCompleteNotificationFormat: Boolean, + roomNotifications: List, + invitationNotifications: List, + simpleNotifications: List, + summaryNotification: SummaryNotification + ) { with(instance) { every { groupedEvents.roomEvents.toNotifications(myUserDisplayName, myUserAvatarUrl) } returns roomNotifications every { groupedEvents.invitationEvents.toNotifications(myUserId) } returns invitationNotifications diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeRoomGroupMessageCreator.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeRoomGroupMessageCreator.kt index c164b9a661..307a8cee9a 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeRoomGroupMessageCreator.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeRoomGroupMessageCreator.kt @@ -26,10 +26,12 @@ class FakeRoomGroupMessageCreator { val instance = mockk() - fun givenCreatesRoomMessageFor(events: List, - roomId: String, - userDisplayName: String, - userAvatarUrl: String?): RoomNotification.Message { + fun givenCreatesRoomMessageFor( + events: List, + roomId: String, + userDisplayName: String, + userAvatarUrl: String? + ): RoomNotification.Message { val mockMessage = mockk() every { instance.createRoomMessage(events, roomId, userDisplayName, userAvatarUrl) } returns mockMessage return mockMessage diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt index c79a0be542..e148432d64 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeSharedSecretStorageService.kt @@ -34,11 +34,13 @@ class FakeSharedSecretStorageService : SharedSecretStorageService { TODO("Not yet implemented") } - override suspend fun generateKeyWithPassphrase(keyId: String, - keyName: String, - passphrase: String, - keySigner: KeySigner, - progressListener: ProgressListener?): SsssKeyCreationInfo { + override suspend fun generateKeyWithPassphrase( + keyId: String, + keyName: String, + passphrase: String, + keySigner: KeySigner, + progressListener: ProgressListener? + ): SsssKeyCreationInfo { TODO("Not yet implemented") }