From de899bbb18d99e8c85fca82141dc69fcbff65415 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Thu, 21 Apr 2022 11:50:15 +0200 Subject: [PATCH] Formats entire project --- .../lib/attachmentviewer/ImageLoaderTarget.kt | 2 +- .../jsonviewer/JSonViewerDialog.kt | 30 +- .../jsonviewer/JSonViewerFragment.kt | 48 +- .../jsonviewer/JSonViewerModel.kt | 24 +- .../jsonviewer/JSonViewerStyleProvider.kt | 24 +- .../jsonviewer/JSonViewerViewModel.kt | 10 +- .../java/org/billcarsonfr/jsonviewer/Utils.kt | 6 +- .../org/billcarsonfr/jsonviewer/ValueItem.kt | 8 +- .../im/vector/lib/multipicker/MultiPicker.kt | 18 +- .../org/matrix/android/sdk/flow/FlowRoom.kt | 2 + .../crypto/crosssigning/XSigningTest.kt | 36 +- .../verification/qrcode/VerificationTest.kt | 4 +- .../interceptors/CurlLoggingInterceptor.kt | 2 +- .../sdk/api/session/file/FileService.kt | 6 +- .../api/session/initsync/SyncStatusService.kt | 1 + .../api/session/permalinks/MatrixLinkify.kt | 2 +- .../api/session/permalinks/PermalinkData.kt | 24 +- .../room/model/RoomJoinRulesContent.kt | 8 +- .../room/model/call/CallAnswerContent.kt | 2 +- .../room/model/call/CallInviteContent.kt | 2 +- .../room/model/call/CallNegotiateContent.kt | 2 +- .../room/model/call/CallReplacesContent.kt | 2 +- .../session/room/model/message/FileInfo.kt | 2 +- .../session/room/model/message/ImageInfo.kt | 2 +- .../MessageVerificationRequestContent.kt | 2 +- .../room/model/message/MessageVideoContent.kt | 2 +- .../session/room/model/message/VideoInfo.kt | 2 +- .../securestorage/SharedSecretStorageError.kt | 2 +- .../sdk/api/session/space/SpaceService.kt | 2 +- .../crypto/CancelGossipRequestWorker.kt | 2 +- .../crypto/CryptoSessionInfoProvider.kt | 2 +- .../crypto/InboundGroupSessionStore.kt | 18 +- .../crypto/IncomingGossipingRequestManager.kt | 4 +- .../crypto/SendGossipRequestWorker.kt | 2 +- .../crypto/algorithms/olm/MXOlmEncryption.kt | 2 +- .../DefaultSharedSecretStorageService.kt | 2 +- .../crypto/store/db/model/CryptoRoomEntity.kt | 4 +- .../db/model/OlmInboundGroupSessionEntity.kt | 2 +- .../crypto/store/db/model/OlmSessionEntity.kt | 2 +- .../SendVerificationMessageWorker.kt | 2 +- .../VerificationTransportRoomMessage.kt | 14 +- .../database/EventInsertLiveObserver.kt | 2 +- .../database/RealmLiveEntityObserver.kt | 2 +- .../internal/database/RealmSessionProvider.kt | 2 +- .../database/migration/MigrateSessionTo019.kt | 2 +- .../internal/database/model/ChunkEntity.kt | 21 +- .../internal/database/model/GroupEntity.kt | 2 +- .../sdk/internal/database/model/RoomEntity.kt | 2 + .../database/model/TimelineEventEntity.kt | 4 +- .../database/query/ChunkEntityQueries.kt | 3 + .../query/ThreadSummaryEntityQueries.kt | 2 + .../network/NetworkConnectivityChecker.kt | 2 +- .../sdk/internal/network/RequestExecutor.kt | 1 + .../internal/session/DefaultFileService.kt | 2 +- .../session/call/CallEventProcessor.kt | 2 +- .../internal/session/content/FileUploader.kt | 4 +- .../session/content/ImageCompressor.kt | 12 +- .../initsync/DefaultSyncStatusService.kt | 2 +- .../integrationmanager/IntegrationManager.kt | 2 +- .../session/pushers/AddPusherWorker.kt | 2 +- .../pushers/UpdatePushRuleActionsTask.kt | 22 +- .../room/alias/GetRoomIdByAliasTask.kt | 2 +- .../DefaultRoomPushRuleService.kt | 2 +- .../SetRoomNotificationStateTask.kt | 2 +- .../MultipleEventSendingDispatcherWorker.kt | 10 +- .../session/room/send/RedactEventWorker.kt | 2 +- .../session/room/send/SendEventWorker.kt | 2 +- .../session/room/send/queue/QueueMemento.kt | 4 +- .../room/state/SafePowerLevelContent.kt | 2 +- .../session/room/summary/GraphUtils.kt | 4 +- .../room/timeline/LiveTimelineEvent.kt | 2 +- .../session/room/timeline/TimelineChunk.kt | 33 +- .../sdk/internal/session/search/SearchTask.kt | 2 +- .../sdk/internal/session/sync/SyncPresence.kt | 5 +- .../sdk/internal/session/sync/SyncTask.kt | 2 +- .../internal/session/sync/job/SyncWorker.kt | 2 +- .../thirdparty/DefaultThirdPartyService.kt | 2 +- .../widgets/DefaultWidgetPostAPIMediator.kt | 2 +- .../session/widgets/DefaultWidgetService.kt | 4 +- .../internal/session/widgets/WidgetManager.kt | 2 +- .../internal/util/database/RealmMigrator.kt | 2 +- .../DefaultBuildVersionSdkIntProvider.kt | 2 +- .../internal/worker/AlwaysSuccessfulWorker.kt | 2 +- .../internal/worker/MatrixWorkerFactory.kt | 2 +- .../interceptors/CurlLoggingInterceptor.kt | 2 +- .../java/im/vector/app/EspressoExt.kt | 2 +- .../vector/app/ui/robot/MessageMenuRobot.kt | 1 + .../app/ui/robot/settings/SettingsRobot.kt | 2 +- .../app/features/debug/sas/SasEmojiItem.kt | 1 + .../troubleshoot/TestAutoStartBoot.kt | 2 +- .../TestBackgroundRestrictions.kt | 2 +- .../OnApplicationUpgradeOrRebootReceiver.kt | 10 +- .../settings/troubleshoot/TestPlayServices.kt | 2 +- .../troubleshoot/TestPushFromPushGateway.kt | 2 +- .../troubleshoot/TestTokenRegistration.kt | 2 +- .../main/java/im/vector/app/UISIDetector.kt | 6 +- .../core/date/DefaultDateFormatterProvider.kt | 2 +- .../core/di/HiltMavericksViewModelFactory.kt | 2 +- .../app/core/dialogs/ExportKeysDialog.kt | 4 +- .../im/vector/app/core/extensions/Session.kt | 4 +- .../app/core/glide/AvatarPlaceholder.kt | 4 +- .../app/core/glide/VectorGlideModelLoader.kt | 4 +- .../app/core/platform/ButtonStateView.kt | 2 +- .../app/core/platform/MaxHeightScrollView.kt | 2 +- .../im/vector/app/core/platform/StateView.kt | 2 +- .../app/core/platform/VectorBaseFragment.kt | 4 +- .../app/core/platform/VectorEventViewModel.kt | 2 +- .../app/core/preference/KeywordPreference.kt | 2 +- .../app/core/resources/LocaleProvider.kt | 2 +- .../BottomSheetGenericController.kt | 2 +- .../app/core/ui/views/PasswordStrengthBar.kt | 2 +- .../core/ui/views/TypingMessageDotsView.kt | 2 +- .../ui/consent/AnalyticsOptInFragment.kt | 2 +- .../preview/AttachmentsPreviewViewModel.kt | 2 +- .../app/features/auth/PromptFragment.kt | 2 +- .../app/features/auth/ReAuthActivity.kt | 6 +- .../app/features/auth/ReAuthViewModel.kt | 4 +- .../app/features/call/VectorCallViewEvents.kt | 1 + .../app/features/call/VectorCallViewModel.kt | 32 +- .../call/audio/API23AudioDeviceDetector.kt | 6 +- .../call/audio/DefaultAudioDeviceRouter.kt | 2 +- .../features/call/dialpad/DialPadLookup.kt | 2 +- .../call/transfer/CallTransferViewModel.kt | 4 +- .../call/webrtc/PeerConnectionObserver.kt | 22 +- .../KeysBackupRestoreFromKeyFragment.kt | 2 +- .../settings/KeysBackupSettingsFragment.kt | 2 +- .../quads/SharedSecureStorageViewModel.kt | 18 +- .../SharedSecuredStorageResetAllFragment.kt | 2 +- .../crypto/recover/BootstrapActions.kt | 2 +- .../crypto/recover/BootstrapBottomSheet.kt | 2 +- .../BootstrapConfirmPassphraseFragment.kt | 2 +- .../BootstrapEnterPassphraseFragment.kt | 2 +- .../BootstrapSetupRecoveryKeyFragment.kt | 2 +- .../recover/BootstrapWaitingFragment.kt | 2 +- .../IncomingVerificationRequestHandler.kt | 2 +- .../VerificationConclusionViewModel.kt | 2 +- .../devtools/RoomDevToolEditFragment.kt | 2 +- .../change/SetIdentityServerViewModel.kt | 2 +- .../vector/app/features/home/HomeActivity.kt | 2 +- .../features/home/HomeActivityViewModel.kt | 2 +- .../UnknownDeviceDetectorSharedViewModel.kt | 2 +- .../detail/JoinReplacementRoomBottomSheet.kt | 6 +- .../DisplayReadReceiptsController.kt | 2 +- .../timeline/TimelineEventController.kt | 1 + .../edithistory/ViewEditHistoryViewState.kt | 2 +- .../timeline/factory/MessageItemFactory.kt | 574 +++++++++--------- ...TimelineVisibilityStateChangedListeners.kt | 6 +- .../timeline/item/CallTileTimelineItem.kt | 6 +- .../detail/timeline/item/MessageAudioItem.kt | 2 + .../detail/timeline/item/MessageVoiceItem.kt | 6 +- .../timeline/item/StatusTileTimelineItem.kt | 2 +- .../timeline/style/TimelineMessageLayout.kt | 18 +- .../detail/upgrade/MigrateRoomViewModel.kt | 2 +- .../detail/widget/RoomWidgetsController.kt | 2 +- .../list/CollapsableTypedEpoxyController.kt | 2 +- .../RoomListQuickActionsSharedAction.kt | 2 +- .../list/viewmodel/ThreadListController.kt | 8 +- .../threads/list/views/ThreadListFragment.kt | 1 + .../app/features/invite/VectorInviteView.kt | 2 +- .../im/vector/app/features/login/LoginMode.kt | 3 +- .../features/login/SocialLoginButtonsView.kt | 6 +- .../LoginGenericTextInputFormFragment2.kt | 4 +- .../matrixto/MatrixToRoomSpaceFragment.kt | 14 +- .../features/matrixto/MatrixToUserFragment.kt | 12 +- .../features/navigation/DefaultNavigator.kt | 2 +- .../poll/create/CreatePollViewState.kt | 16 +- .../features/rageshake/BugReportActivity.kt | 8 +- .../features/rageshake/BugReportViewModel.kt | 2 +- .../reactions/EmojiSearchResultViewModel.kt | 2 +- .../room/RequireActiveMembershipViewModel.kt | 2 +- .../roomdirectory/ExplicitTermFilter.kt | 2 +- .../devices/DeviceTrustInfoEpoxyController.kt | 2 +- .../roomprofile/RoomProfileActivity.kt | 14 +- .../RoomAliasBottomSheetSharedAction.kt | 2 +- .../RoomNotificationSettingsController.kt | 4 +- .../RoomNotificationSettingsViewModel.kt | 4 +- .../RoomNotificationSettingsViewState.kt | 2 +- .../permissions/RoomPermissionsViewModel.kt | 2 +- .../settings/RoomSettingsViewState.kt | 6 +- ...mHistoryVisibilitySharedActionViewModel.kt | 2 +- .../RoomHistoryVisibilityViewModel.kt | 2 +- .../RoomJoinRuleSharedActionViewModel.kt | 2 +- .../joinrule/RoomJoinRuleViewModel.kt | 2 +- .../features/session/SessionScopedProperty.kt | 6 +- .../DeactivateAccountViewModel.kt | 8 +- .../settings/devices/DevicesAction.kt | 2 +- .../settings/devices/DevicesViewEvents.kt | 2 +- .../settings/devtools/AccountDataViewModel.kt | 2 +- .../GossipingEventsPaperTrailViewModel.kt | 2 +- .../settings/devtools/KeyRequestViewModel.kt | 2 +- .../OutgoingKeyRequestListFragment.kt | 1 + .../notifications/NotificationIndex.kt | 29 +- ...sAdvancedNotificationPreferenceFragment.kt | 2 +- ...gsDefaultNotificationPreferenceFragment.kt | 12 +- ...ingsOtherNotificationPreferenceFragment.kt | 12 +- ...sPushRuleNotificationPreferenceFragment.kt | 2 +- .../settings/push/PushRulesViewModel.kt | 2 +- .../threepids/ThreePidsSettingsFragment.kt | 5 +- .../threepids/ThreePidsSettingsViewEvents.kt | 2 +- ...ficationTroubleshootRecyclerViewAdapter.kt | 2 +- .../troubleshoot/TestAccountSettings.kt | 2 +- .../troubleshoot/TestDeviceSettings.kt | 2 +- .../settings/troubleshoot/TestNotification.kt | 2 +- .../troubleshoot/TestPushRulesSettings.kt | 2 +- .../troubleshoot/TestSystemSettings.kt | 2 +- .../features/share/IncomingShareViewModel.kt | 2 +- .../signout/soft/SoftLogoutFragment.kt | 6 +- .../spaces/create/CreateSpaceState.kt | 12 +- .../spaces/create/CreateSpaceViewModel.kt | 2 +- .../spaces/create/WizardButtonView.kt | 2 +- .../spaces/explore/SpaceDirectoryFragment.kt | 2 +- .../spaces/explore/SpaceDirectoryViewModel.kt | 6 +- .../manage/SpaceManageRoomViewEvents.kt | 2 +- .../spaces/manage/SpaceManageViewState.kt | 1 + .../spaces/manage/SpaceSettingsController.kt | 4 +- .../spaces/manage/SpaceSettingsFragment.kt | 8 +- .../spaces/preview/SpacePreviewFragment.kt | 6 +- .../spaces/preview/SpacePreviewState.kt | 4 +- .../spaces/preview/SpacePreviewViewModel.kt | 6 +- .../features/spaces/preview/SpaceTabView.kt | 2 +- .../app/features/sync/widget/SyncStateView.kt | 2 +- .../webview/ConsentWebViewEventListener.kt | 2 +- .../app/features/widgets/WidgetViewModel.kt | 2 +- .../RoomWidgetPermissionViewModel.kt | 2 +- 224 files changed, 853 insertions(+), 815 deletions(-) diff --git a/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/ImageLoaderTarget.kt b/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/ImageLoaderTarget.kt index 99686eaabb..7b54438a52 100644 --- a/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/ImageLoaderTarget.kt +++ b/library/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/ImageLoaderTarget.kt @@ -37,7 +37,7 @@ interface ImageLoaderTarget { } internal class DefaultImageLoaderTarget(val holder: AnimatedImageViewHolder, private val contextView: ImageView) : - ImageLoaderTarget { + ImageLoaderTarget { override fun contextView(): ImageView { return contextView } diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerDialog.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerDialog.kt index a8d9cac849..0ebf539d4d 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerDialog.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerDialog.kt @@ -27,9 +27,9 @@ import com.airbnb.mvrx.Mavericks class JSonViewerDialog : DialogFragment() { override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? ): View? { return inflater.inflate(R.layout.fragment_dialog_jv, container, false) } @@ -39,15 +39,15 @@ class JSonViewerDialog : DialogFragment() { val args: JSonViewerFragmentArgs = arguments?.getParcelable(Mavericks.KEY_ARG) ?: return if (savedInstanceState == null) { childFragmentManager.beginTransaction() - .replace( - R.id.fragmentContainer, JSonViewerFragment.newInstance( - args.jsonString, - args.defaultOpenDepth, - true, - args.styleProvider + .replace( + R.id.fragmentContainer, JSonViewerFragment.newInstance( + args.jsonString, + args.defaultOpenDepth, + true, + args.styleProvider ) - ) - .commitNow() + ) + .commitNow() } } @@ -63,13 +63,13 @@ class JSonViewerDialog : DialogFragment() { companion object { fun newInstance( - jsonString: String, - initialOpenDepth: Int = -1, - styleProvider: JSonViewerStyleProvider? = null + jsonString: String, + initialOpenDepth: Int = -1, + styleProvider: JSonViewerStyleProvider? = null ): JSonViewerDialog { val args = Bundle() val parcelableArgs = - JSonViewerFragmentArgs(jsonString, initialOpenDepth, false, styleProvider) + JSonViewerFragmentArgs(jsonString, initialOpenDepth, false, styleProvider) args.putParcelable(Mavericks.KEY_ARG, parcelableArgs) return JSonViewerDialog().apply { arguments = args } } diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt index 51e2797958..fbf6f88bc3 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerFragment.kt @@ -32,10 +32,10 @@ import kotlinx.parcelize.Parcelize @Parcelize internal data class JSonViewerFragmentArgs( - val jsonString: String, - val defaultOpenDepth: Int, - val wrap: Boolean, - val styleProvider: JSonViewerStyleProvider? + val jsonString: String, + val defaultOpenDepth: Int, + val wrap: Boolean, + val styleProvider: JSonViewerStyleProvider? ) : Parcelable class JSonViewerFragment : Fragment(), MavericksView { @@ -49,20 +49,20 @@ class JSonViewerFragment : Fragment(), MavericksView { private lateinit var recyclerView: EpoxyRecyclerView override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? ): View? { val args: JSonViewerFragmentArgs? = arguments?.getParcelable(Mavericks.KEY_ARG) val inflate = - if (args?.wrap == true) { - inflater.inflate(R.layout.fragment_jv_recycler_view_wrap, container, false) - } else { - inflater.inflate(R.layout.fragment_jv_recycler_view, container, false) - } + if (args?.wrap == true) { + inflater.inflate(R.layout.fragment_jv_recycler_view_wrap, container, false) + } else { + inflater.inflate(R.layout.fragment_jv_recycler_view, container, false) + } recyclerView = inflate.findViewById(R.id.jvRecyclerView) recyclerView.layoutManager = - LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) + LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) recyclerView.setController(epoxyController) epoxyController.setStyle(args?.styleProvider) registerForContextMenu(recyclerView) @@ -79,21 +79,21 @@ class JSonViewerFragment : Fragment(), MavericksView { companion object { fun newInstance( - jsonString: String, - initialOpenDepth: Int = -1, - wrap: Boolean = false, - styleProvider: JSonViewerStyleProvider? = null + jsonString: String, + initialOpenDepth: Int = -1, + wrap: Boolean = false, + styleProvider: JSonViewerStyleProvider? = null ): JSonViewerFragment { return JSonViewerFragment().apply { arguments = Bundle().apply { putParcelable( - Mavericks.KEY_ARG, - JSonViewerFragmentArgs( - jsonString, - initialOpenDepth, - wrap, - styleProvider - ) + Mavericks.KEY_ARG, + JSonViewerFragmentArgs( + jsonString, + initialOpenDepth, + wrap, + styleProvider + ) ) } } diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerModel.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerModel.kt index 3d1f8dd3e2..6940e79e3f 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerModel.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerModel.kt @@ -30,8 +30,8 @@ internal interface Composed { } internal class JSonViewerObject(key: String?, index: Int?, jObject: JSONObject) : - JSonViewerModel(key, index, jObject), - Composed { + JSonViewerModel(key, index, jObject), + Composed { var keys = LinkedHashMap() @@ -41,7 +41,7 @@ internal class JSonViewerObject(key: String?, index: Int?, jObject: JSONObject) } internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) : - JSonViewerModel(key, index, jObject), Composed { + JSonViewerModel(key, index, jObject), Composed { var items = ArrayList() override fun addChild(model: JSonViewerModel) { @@ -50,7 +50,7 @@ internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) : } internal class JSonViewerLeaf(key: String?, index: Int?, val stringRes: String, val type: JSONType) : - JSonViewerModel(key, index, stringRes) + JSonViewerModel(key, index, stringRes) internal enum class JSONType { STRING, @@ -75,41 +75,41 @@ internal object ModelParser { when (obj) { is JSONObject -> { val objectComposed = JSonViewerObject(key, index, obj) - .apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth } + .apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth } objectComposed.depth = depth obj.keys().forEach { eval(objectComposed, it, null, obj.get(it), depth + 1, initialOpenDepth) } parent.addChild(objectComposed) } - is JSONArray -> { + is JSONArray -> { val objectComposed = JSonViewerArray(key, index, obj) - .apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth } + .apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth } objectComposed.depth = depth for (i in 0 until obj.length()) { eval(objectComposed, null, i, obj[i], depth + 1, initialOpenDepth) } parent.addChild(objectComposed) } - is String -> { - JSonViewerLeaf(key, index, obj, JSONType.STRING).let { + is String -> { + JSonViewerLeaf(key, index, obj, JSONType.STRING).let { it.depth = depth parent.addChild(it) } } - is Number -> { + is Number -> { JSonViewerLeaf(key, index, obj.toString(), JSONType.NUMBER).let { it.depth = depth parent.addChild(it) } } - is Boolean -> { + is Boolean -> { JSonViewerLeaf(key, index, obj.toString(), JSONType.BOOLEAN).let { it.depth = depth parent.addChild(it) } } - else -> { + else -> { if (obj == JSONObject.NULL) { JSonViewerLeaf(key, index, "null", JSONType.NULL).let { it.depth = depth diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerStyleProvider.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerStyleProvider.kt index 4fc04c91e4..17d8034f2d 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerStyleProvider.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerStyleProvider.kt @@ -24,22 +24,22 @@ import kotlinx.parcelize.Parcelize @Parcelize data class JSonViewerStyleProvider( - @ColorInt val keyColor: Int, - @ColorInt val stringColor: Int, - @ColorInt val booleanColor: Int, - @ColorInt val numberColor: Int, - @ColorInt val baseColor: Int, - @ColorInt val secondaryColor: Int + @ColorInt val keyColor: Int, + @ColorInt val stringColor: Int, + @ColorInt val booleanColor: Int, + @ColorInt val numberColor: Int, + @ColorInt val baseColor: Int, + @ColorInt val secondaryColor: Int ) : Parcelable { companion object { fun default(context: Context) = JSonViewerStyleProvider( - keyColor = ContextCompat.getColor(context, R.color.key_color), - stringColor = ContextCompat.getColor(context, R.color.string_color), - booleanColor = ContextCompat.getColor(context, R.color.bool_color), - numberColor = ContextCompat.getColor(context, R.color.number_color), - baseColor = ContextCompat.getColor(context, R.color.base_color), - secondaryColor = ContextCompat.getColor(context, R.color.secondary_color) + keyColor = ContextCompat.getColor(context, R.color.key_color), + stringColor = ContextCompat.getColor(context, R.color.string_color), + booleanColor = ContextCompat.getColor(context, R.color.bool_color), + numberColor = ContextCompat.getColor(context, R.color.number_color), + baseColor = ContextCompat.getColor(context, R.color.base_color), + secondaryColor = ContextCompat.getColor(context, R.color.secondary_color) ) } } diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerViewModel.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerViewModel.kt index bc3f022cfa..d4e8f42604 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerViewModel.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/JSonViewerViewModel.kt @@ -28,11 +28,11 @@ import com.airbnb.mvrx.ViewModelContext import kotlinx.coroutines.launch internal data class JSonViewerState( - val root: Async = Uninitialized + val root: Async = Uninitialized ) : MavericksState internal class JSonViewerViewModel(initialState: JSonViewerState) : - MavericksViewModel(initialState) { + MavericksViewModel(initialState) { fun setJsonSource(json: String, initialOpenDepth: Int) { setState { @@ -43,14 +43,14 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) : ModelParser.fromJsonString(json, initialOpenDepth).let { setState { copy( - root = Success(it) + root = Success(it) ) } } } catch (error: Throwable) { setState { copy( - root = Fail(error) + root = Fail(error) ) } } @@ -64,7 +64,7 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) : val arg: JSonViewerFragmentArgs = viewModelContext.args() return try { JSonViewerState( - Success(ModelParser.fromJsonString(arg.jsonString, arg.defaultOpenDepth)) + Success(ModelParser.fromJsonString(arg.jsonString, arg.defaultOpenDepth)) ) } catch (failure: Throwable) { JSonViewerState(Fail(failure)) diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/Utils.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/Utils.kt index efb2bfd855..0ac1cfe5f6 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/Utils.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/Utils.kt @@ -22,9 +22,9 @@ import android.util.TypedValue internal object Utils { fun dpToPx(dp: Int, context: Context): Int { return TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_DIP, - dp.toFloat(), - context.resources.displayMetrics + TypedValue.COMPLEX_UNIT_DIP, + dp.toFloat(), + context.resources.displayMetrics ).toInt() } } diff --git a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/ValueItem.kt b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/ValueItem.kt index 00d66645e6..fac7099b37 100644 --- a/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/ValueItem.kt +++ b/library/jsonviewer/src/main/java/org/billcarsonfr/jsonviewer/ValueItem.kt @@ -71,14 +71,14 @@ internal abstract class ValueItem : EpoxyModelWithHolder() { } override fun onCreateContextMenu( - menu: ContextMenu?, - v: View?, - menuInfo: ContextMenu.ContextMenuInfo? + menu: ContextMenu?, + v: View?, + menuInfo: ContextMenu.ContextMenuInfo? ) { if (copyValue != null) { val menuItem = menu?.add(R.string.copy_value) val clipService = - v?.context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager + v?.context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager menuItem?.setOnMenuItemClickListener { clipService?.setPrimaryClip(ClipData.newPlainText("", copyValue)) true diff --git a/library/multipicker/src/main/java/im/vector/lib/multipicker/MultiPicker.kt b/library/multipicker/src/main/java/im/vector/lib/multipicker/MultiPicker.kt index 6ce50f622a..821c2f0d4c 100644 --- a/library/multipicker/src/main/java/im/vector/lib/multipicker/MultiPicker.kt +++ b/library/multipicker/src/main/java/im/vector/lib/multipicker/MultiPicker.kt @@ -31,15 +31,15 @@ class MultiPicker { @Suppress("UNCHECKED_CAST") fun get(type: MultiPicker): T { return when (type) { - IMAGE -> ImagePicker() as T - VIDEO -> VideoPicker() as T - MEDIA -> MediaPicker() as T - FILE -> FilePicker() as T - AUDIO -> AudioPicker() as T - CONTACT -> ContactPicker() as T - CAMERA -> CameraPicker() as T - CAMERA_VIDEO -> CameraVideoPicker() as T - else -> throw IllegalArgumentException("Unsupported type $type") + IMAGE -> ImagePicker() as T + VIDEO -> VideoPicker() as T + MEDIA -> MediaPicker() as T + FILE -> FilePicker() as T + AUDIO -> AudioPicker() as T + CONTACT -> ContactPicker() as T + CAMERA -> CameraPicker() as T + CAMERA_VIDEO -> CameraVideoPicker() as T + else -> throw IllegalArgumentException("Unsupported type $type") } } } diff --git a/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowRoom.kt b/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowRoom.kt index d737715306..0f0153bc23 100644 --- a/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowRoom.kt +++ b/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowRoom.kt @@ -108,12 +108,14 @@ class FlowRoom(private val room: Room) { room.getAllThreadSummaries() } } + fun liveThreadList(): Flow> { return room.getAllThreadsLive().asFlow() .startWith(room.coroutineDispatchers.io) { room.getAllThreads() } } + fun liveLocalUnreadThreadList(): Flow> { return room.getMarkedThreadNotificationsLive().asFlow() .startWith(room.coroutineDispatchers.io) { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/crosssigning/XSigningTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/crosssigning/XSigningTest.kt index dc65cec187..0f3ff7898f 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/crosssigning/XSigningTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/crosssigning/XSigningTest.kt @@ -110,11 +110,13 @@ class XSigningTest : InstrumentedTest { } }, it) } - testHelper.doSync { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { - override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { - promise.resume(bobAuthParams) - } - }, it) } + testHelper.doSync { + bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { + override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { + promise.resume(bobAuthParams) + } + }, it) + } // Check that alice can see bob keys testHelper.doSync> { aliceSession.cryptoService().downloadKeys(listOf(bobSession.myUserId), true, it) } @@ -149,16 +151,20 @@ class XSigningTest : InstrumentedTest { password = TestConstants.PASSWORD ) - testHelper.doSync { aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { - override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { - promise.resume(aliceAuthParams) - } - }, it) } - testHelper.doSync { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { - override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { - promise.resume(bobAuthParams) - } - }, it) } + testHelper.doSync { + aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { + override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { + promise.resume(aliceAuthParams) + } + }, it) + } + testHelper.doSync { + bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor { + override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation) { + promise.resume(bobAuthParams) + } + }, it) + } // Check that alice can see bob keys val bobUserId = bobSession.myUserId 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 2c96568102..374d709505 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 @@ -155,8 +155,8 @@ class VerificationTest : InstrumentedTest { bobSupportedMethods: List, expectedResultForAlice: ExpectedResult, expectedResultForBob: ExpectedResult) { - val testHelper = CommonTestHelper(context()) - val cryptoTestHelper = CryptoTestHelper(testHelper) + val testHelper = CommonTestHelper(context()) + val cryptoTestHelper = CryptoTestHelper(testHelper) val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom() val aliceSession = cryptoTestData.firstSession diff --git a/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt b/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt index 3add757efa..6dd3553d02 100644 --- a/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt +++ b/matrix-sdk-android/src/debug/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt @@ -37,7 +37,7 @@ import javax.inject.Inject */ @MatrixScope internal class CurlLoggingInterceptor @Inject constructor() : - Interceptor { + Interceptor { /** * Set any additional curl command options (see 'curl --help'). 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 72f8019ada..e3ccbad249 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 @@ -45,9 +45,9 @@ interface FileService { * 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 + mimeType: String?, + url: String?, + elementToDecrypt: ElementToDecrypt?): File suspend fun downloadFile(messageContent: MessageWithAttachmentContent): File = downloadFile( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/SyncStatusService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/SyncStatusService.kt index 267436916e..759813939f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/SyncStatusService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/initsync/SyncStatusService.kt @@ -43,6 +43,7 @@ interface SyncStatusService { val rooms: Int, val toDevice: Int ) : IncrementalSyncStatus() + object IncrementalSyncError : IncrementalSyncStatus() object IncrementalSyncDone : IncrementalSyncStatus() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixLinkify.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixLinkify.kt index 3e27da0c41..c5d919407a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixLinkify.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/MatrixLinkify.kt @@ -55,7 +55,7 @@ object MatrixLinkify { MatrixPatterns.isRoomId(url) || MatrixPatterns.isGroupId(url) || MatrixPatterns.isEventId(url)) { - url = PermalinkService.MATRIX_TO_URL_BASE + url + url = PermalinkService.MATRIX_TO_URL_BASE + url } val span = MatrixPermalinkSpan(url, callback) spannable.setSpan(span, startPos, endPos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkData.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkData.kt index 85291cf0f6..57aacc98b8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkData.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/permalinks/PermalinkData.kt @@ -35,21 +35,21 @@ sealed class PermalinkData { /** * &room_name=Team2 - &room_avatar_url=mxc: - &inviter_name=bob + &room_avatar_url=mxc: + &inviter_name=bob */ @Parcelize data class RoomEmailInviteLink( - val roomId: String, - val email: String, - val signUrl: String, - val roomName: String?, - val roomAvatarUrl: String?, - val inviterName: String?, - val identityServer: String, - val token: String, - val privateKey: String, - val roomType: String? + val roomId: String, + val email: String, + val signUrl: String, + val roomName: String?, + val roomAvatarUrl: String?, + val inviterName: String?, + val identityServer: String, + val token: String, + val privateKey: String, + val roomType: String? ) : PermalinkData(), Parcelable data class UserLink(val userId: String) : PermalinkData() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomJoinRulesContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomJoinRulesContent.kt index 871b299f93..5237b10d52 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomJoinRulesContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomJoinRulesContent.kt @@ -36,10 +36,10 @@ data class RoomJoinRulesContent( @Json(name = "allow") val allowList: List? = null ) { val joinRules: RoomJoinRules? = when (_joinRules) { - "public" -> RoomJoinRules.PUBLIC - "invite" -> RoomJoinRules.INVITE - "knock" -> RoomJoinRules.KNOCK - "private" -> RoomJoinRules.PRIVATE + "public" -> RoomJoinRules.PUBLIC + "invite" -> RoomJoinRules.INVITE + "knock" -> RoomJoinRules.KNOCK + "private" -> RoomJoinRules.PRIVATE "restricted" -> RoomJoinRules.RESTRICTED else -> { Timber.w("Invalid value for RoomJoinRules: `$_joinRules`") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallAnswerContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallAnswerContent.kt index 6b4d782832..67ef85787e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallAnswerContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallAnswerContent.kt @@ -44,7 +44,7 @@ data class CallAnswerContent( * Capability advertisement. */ @Json(name = "capabilities") val capabilities: CallCapabilities? = null -) : CallSignalingContent { +) : CallSignalingContent { @JsonClass(generateAdapter = true) data class Answer( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallInviteContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallInviteContent.kt index d70e63d122..24c8152f3c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallInviteContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallInviteContent.kt @@ -55,7 +55,7 @@ data class CallInviteContent( */ @Json(name = "capabilities") val capabilities: CallCapabilities? = null -) : CallSignalingContent { +) : CallSignalingContent { @JsonClass(generateAdapter = true) data class Offer( /** diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt index bbbfbe68ab..5c6c6cda01 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallNegotiateContent.kt @@ -47,7 +47,7 @@ data class CallNegotiateContent( */ @Json(name = "version") override val version: String? - ) : CallSignalingContent { +) : CallSignalingContent { @JsonClass(generateAdapter = true) data class Description( /** diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallReplacesContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallReplacesContent.kt index 7947b7d0bd..e480e013ea 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallReplacesContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/call/CallReplacesContent.kt @@ -61,7 +61,7 @@ data class CallReplacesContent( * Required. The version of the VoIP specification this messages adheres to. */ @Json(name = "version") override val version: String? -) : CallSignalingContent { +) : CallSignalingContent { @JsonClass(generateAdapter = true) data class TargetUser( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/FileInfo.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/FileInfo.kt index fa18bfd21f..132b72902f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/FileInfo.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/FileInfo.kt @@ -52,5 +52,5 @@ data class FileInfo( * Get the url of the encrypted thumbnail or of the thumbnail */ fun FileInfo.getThumbnailUrl(): String? { - return thumbnailFile?.url ?: thumbnailUrl + return thumbnailFile?.url ?: thumbnailUrl } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/ImageInfo.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/ImageInfo.kt index 0099208320..bd99ea6900 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/ImageInfo.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/ImageInfo.kt @@ -62,5 +62,5 @@ data class ImageInfo( * Get the url of the encrypted thumbnail or of the thumbnail */ fun ImageInfo.getThumbnailUrl(): String? { - return thumbnailFile?.url ?: thumbnailUrl + return thumbnailFile?.url ?: thumbnailUrl } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationRequestContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationRequestContent.kt index b2b3cdac90..a0699831f7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationRequestContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVerificationRequestContent.kt @@ -24,7 +24,7 @@ import org.matrix.android.sdk.internal.crypto.verification.VerificationInfoReque @JsonClass(generateAdapter = true) data class MessageVerificationRequestContent( - @Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST, + @Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST, @Json(name = "body") override val body: String, @Json(name = "from_device") override val fromDevice: String?, @Json(name = "methods") override val methods: List, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVideoContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVideoContent.kt index 9266a0fb0f..9b657971b9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVideoContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/MessageVideoContent.kt @@ -27,7 +27,7 @@ data class MessageVideoContent( /** * Required. Must be 'm.video'. */ - @Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String, + @Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String, /** * Required. A description of the video e.g. 'Gangnam style', or some kind of content description for accessibility e.g. 'video attachment'. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/VideoInfo.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/VideoInfo.kt index 28f3a47d11..b02b4d96ad 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/VideoInfo.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/message/VideoInfo.kt @@ -67,5 +67,5 @@ data class VideoInfo( * Get the url of the encrypted thumbnail or of the thumbnail */ fun VideoInfo.getThumbnailUrl(): String? { - return thumbnailFile?.url ?: thumbnailUrl + return thumbnailFile?.url ?: thumbnailUrl } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageError.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageError.kt index a91b97b86c..038533c19e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageError.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/securestorage/SharedSecretStorageError.kt @@ -23,7 +23,7 @@ sealed class SharedSecretStorageError(message: String?) : Throwable(message) { data class UnsupportedAlgorithm(val algorithm: String) : SharedSecretStorageError("Unknown algorithm $algorithm") data class SecretNotEncrypted(val secretName: String) : SharedSecretStorageError("Missing content for secret $secretName") data class SecretNotEncryptedWithKey(val secretName: String, val keyId: String) : - SharedSecretStorageError("Missing content for secret $secretName with key $keyId") + SharedSecretStorageError("Missing content for secret $secretName with key $keyId") object BadKeyFormat : SharedSecretStorageError("Bad Key Format") object ParsingError : SharedSecretStorageError("parsing Error") 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 f4460b7659..6d82b3f7df 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 @@ -68,7 +68,7 @@ interface SpaceService { suggestedOnly: Boolean? = null, limit: Int? = null, from: String? = null, - // when paginating, pass back the m.space.child state events + // when paginating, pass back the m.space.child state events knownStateList: List? = null): SpaceHierarchyData /** diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CancelGossipRequestWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CancelGossipRequestWorker.kt index 98950374ed..4380e31bff 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CancelGossipRequestWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CancelGossipRequestWorker.kt @@ -37,7 +37,7 @@ import org.matrix.android.sdk.internal.worker.SessionWorkerParams import javax.inject.Inject internal class CancelGossipRequestWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoSessionInfoProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoSessionInfoProvider.kt index 2a58d731e5..73dfc468d9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoSessionInfoProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoSessionInfoProvider.kt @@ -48,7 +48,7 @@ internal class CryptoSessionInfoProvider @Inject constructor( /** * @param allActive if true return joined as well as invited, if false, only joined */ - fun getRoomUserIds(roomId: String, allActive: Boolean): List { + fun getRoomUserIds(roomId: String, allActive: Boolean): List { var userIds: List = emptyList() monarchy.doWithRealm { realm -> userIds = if (allActive) { 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 a78444dff9..28ddf291b2 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 @@ -75,15 +75,15 @@ internal class InboundGroupSessionStore @Inject constructor( @Synchronized fun getInboundGroupSession(sessionId: String, senderKey: String): InboundGroupSessionHolder? { - val known = sessionCache[CacheKey(sessionId, senderKey)] - Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession $sessionId in cache ${known != null}") - return known - ?: store.getInboundGroupSession(sessionId, senderKey)?.also { - Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession cache populate ${it.roomId}") - sessionCache.put(CacheKey(sessionId, senderKey), InboundGroupSessionHolder(it)) - }?.let { - InboundGroupSessionHolder(it) - } + val known = sessionCache[CacheKey(sessionId, senderKey)] + Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession $sessionId in cache ${known != null}") + return known + ?: store.getInboundGroupSession(sessionId, senderKey)?.also { + Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession cache populate ${it.roomId}") + sessionCache.put(CacheKey(sessionId, senderKey), InboundGroupSessionHolder(it)) + }?.let { + InboundGroupSessionHolder(it) + } } @Synchronized diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingGossipingRequestManager.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingGossipingRequestManager.kt index 3a409cf3fd..b907b57f82 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingGossipingRequestManager.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/IncomingGossipingRequestManager.kt @@ -116,7 +116,7 @@ internal class IncomingGossipingRequestManager @Inject constructor( Timber.i("## CRYPTO | GOSSIP onGossipingRequestEvent received type ${event.type} from user:${event.senderId}, content:$roomKeyShare") // val ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it } when (roomKeyShare?.action) { - GossipingToDeviceObject.ACTION_SHARE_REQUEST -> { + GossipingToDeviceObject.ACTION_SHARE_REQUEST -> { if (event.getClearType() == EventType.REQUEST_SECRET) { IncomingSecretShareRequest.fromEvent(event)?.let { if (event.senderId == credentials.userId && it.deviceId == credentials.deviceId) { @@ -346,7 +346,7 @@ internal class IncomingGossipingRequestManager @Inject constructor( val isDeviceLocallyVerified = cryptoStore.getUserDevice(userId, deviceId)?.trustLevel?.isLocallyVerified() when (secretName) { - MASTER_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.master + MASTER_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.master SELF_SIGNING_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.selfSigned USER_SIGNING_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.user KEYBACKUP_SECRET_SSSS_NAME -> cryptoStore.getKeyBackupRecoveryKeyInfo()?.recoveryKey diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SendGossipRequestWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SendGossipRequestWorker.kt index dbdea97411..69b405aedc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SendGossipRequestWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SendGossipRequestWorker.kt @@ -41,7 +41,7 @@ import timber.log.Timber import javax.inject.Inject internal class SendGossipRequestWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( 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 7fdfd5a287..c842c54041 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 @@ -33,7 +33,7 @@ internal class MXOlmEncryption( private val messageEncrypter: MessageEncrypter, private val deviceListManager: DeviceListManager, private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction) : - IMXEncrypting { + IMXEncrypting { override suspend fun encryptEventContent(eventContent: Content, eventType: String, userIds: List): Content { // pick the list of recipients based on the membership list. 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 19e66635c7..972c03e92a 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 @@ -174,7 +174,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor( throw SharedSecretStorageError.UnknownAlgorithm(key.keyInfo.content.algorithm ?: "") } } - is KeyInfoResult.Error -> throw key.error + is KeyInfoResult.Error -> throw key.error } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/CryptoRoomEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/CryptoRoomEntity.kt index 6167314b5a..114a596964 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/CryptoRoomEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/db/model/CryptoRoomEntity.kt @@ -31,8 +31,8 @@ internal open class CryptoRoomEntity( // a security to ensure that a room will never revert to not encrypted // even if a new state event with empty encryption, or state is reset somehow var wasEncryptedOnce: Boolean? = false - ) : - RealmObject() { +) : + RealmObject() { companion object } 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 f330e8822a..83671b28d9 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 @@ -34,7 +34,7 @@ internal open class OlmInboundGroupSessionEntity( var olmInboundGroupSessionData: String? = null, // Indicate if the key has been backed up to the homeserver var backedUp: Boolean = false) : - RealmObject() { + RealmObject() { fun getInboundGroupSession(): OlmInboundGroupSessionWrapper2? { return try { 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 0b69311c57..1a637d76c4 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 @@ -30,7 +30,7 @@ internal open class OlmSessionEntity(@PrimaryKey var primaryKey: String = "", var deviceKey: String? = null, var olmSessionData: String? = null, var lastReceivedMessageTs: Long = 0) : - RealmObject() { + RealmObject() { fun getOlmSession(): OlmSession? { return deserializeFromRealm(olmSessionData) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SendVerificationMessageWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SendVerificationMessageWorker.kt index a763c05e07..0a175ae3ca 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SendVerificationMessageWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/SendVerificationMessageWorker.kt @@ -35,7 +35,7 @@ import javax.inject.Inject * Possible next worker : None */ internal class SendVerificationMessageWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( 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 bd1186908c..49235c5744 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 @@ -296,13 +296,13 @@ internal class VerificationTransportRoomMessage( messageAuthenticationCode: String, shortAuthenticationStrings: List): VerificationInfoAccept = MessageVerificationAcceptContent.create( - tid, - keyAgreementProtocol, - hash, - commitment, - messageAuthenticationCode, - shortAuthenticationStrings - ) + tid, + keyAgreementProtocol, + hash, + commitment, + messageAuthenticationCode, + shortAuthenticationStrings + ) override fun createKey(tid: String, pubKey: String): VerificationInfoKey = MessageVerificationKeyContent.create(tid, pubKey) 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 115025cc7d..b057b4c319 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 @@ -32,7 +32,7 @@ import javax.inject.Inject internal class EventInsertLiveObserver @Inject constructor(@SessionDatabase realmConfiguration: RealmConfiguration, private val processors: Set<@JvmSuppressWildcards EventInsertLiveProcessor>) : - RealmLiveEntityObserver(realmConfiguration) { + RealmLiveEntityObserver(realmConfiguration) { override val query = Monarchy.Query { it.where(EventInsertEntity::class.java).equalTo(EventInsertEntityFields.CAN_BE_PROCESSED, true) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmLiveEntityObserver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmLiveEntityObserver.kt index 50eb086f9a..f2f88e216b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmLiveEntityObserver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmLiveEntityObserver.kt @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicReference internal interface LiveEntityObserver : SessionLifecycleObserver internal abstract class RealmLiveEntityObserver(protected val realmConfiguration: RealmConfiguration) : - LiveEntityObserver, RealmChangeListener> { + LiveEntityObserver, RealmChangeListener> { private companion object { val BACKGROUND_HANDLER = createBackgroundHandler("LIVE_ENTITY_BACKGROUND") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionProvider.kt index 8c62c345d0..e5b5915590 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/RealmSessionProvider.kt @@ -33,7 +33,7 @@ import kotlin.concurrent.getOrSet */ @SessionScope internal class RealmSessionProvider @Inject constructor(@SessionDatabase private val monarchy: Monarchy) : - SessionLifecycleObserver { + SessionLifecycleObserver { private val realmThreadLocal = ThreadLocal() 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 d63ef62889..754a66bb4b 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 @@ -22,7 +22,7 @@ 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) { + 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 88eb821aa9..822bc1bd8f 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 @@ -24,19 +24,20 @@ import io.realm.annotations.LinkingObjects import org.matrix.android.sdk.internal.extensions.assertIsManaged import org.matrix.android.sdk.internal.extensions.clearWith -internal open class ChunkEntity(@Index var prevToken: String? = null, +internal open class ChunkEntity( + @Index var prevToken: String? = null, // Because of gaps we can have several chunks with nextToken == null - @Index var nextToken: String? = null, - var prevChunk: ChunkEntity? = null, - var nextChunk: ChunkEntity? = null, - var stateEvents: RealmList = RealmList(), - var timelineEvents: RealmList = RealmList(), + @Index var nextToken: String? = null, + var prevChunk: ChunkEntity? = null, + var nextChunk: ChunkEntity? = null, + var stateEvents: RealmList = RealmList(), + var timelineEvents: RealmList = RealmList(), // Only one chunk will have isLastForward == true - @Index var isLastForward: Boolean = false, - @Index var isLastBackward: Boolean = false, + @Index var isLastForward: Boolean = false, + @Index var isLastBackward: Boolean = false, // Threads - @Index var rootThreadEventId: String? = null, - @Index var isLastForwardThread: Boolean = false, + @Index var rootThreadEventId: String? = null, + @Index var isLastForwardThread: Boolean = false, ) : RealmObject() { fun identifier() = "${prevToken}_$nextToken" diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupEntity.kt index 527f782359..0120bb91d3 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/GroupEntity.kt @@ -25,7 +25,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership * Then GetGroupDataTask is called regularly to fetch group information from the homeserver. */ internal open class GroupEntity(@PrimaryKey var groupId: String = "") : - RealmObject() { + RealmObject() { private var membershipStr: String = Membership.NONE.name var membership: Membership 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 4a6f6a7bf8..d8e6b8af0f 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 @@ -48,8 +48,10 @@ internal open class RoomEntity(@PrimaryKey var roomId: String = "", set(value) { membersLoadStatusStr = value.name } + companion object } + internal fun RoomEntity.removeThreadSummaryIfNeeded(eventId: String) { assertIsManaged() threadSummaries.findRootOrLatest(eventId)?.let { 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 aacd6570bc..477c04fe51 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 @@ -32,8 +32,8 @@ internal open class TimelineEventEntity(var localId: Long = 0, 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. + // ownedByThreadChunk indicates that the current TimelineEventEntity belongs + // to a thread chunk and is a temporarily event. var ownedByThreadChunk: Boolean = false, var readReceipts: ReadReceiptsSummaryEntity? = null ) : RealmObject() { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ChunkEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ChunkEntityQueries.kt index a33ba82f7a..9350102137 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ChunkEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ChunkEntityQueries.kt @@ -56,18 +56,21 @@ internal fun ChunkEntity.Companion.findLastForwardChunkOfRoom(realm: Realm, room .equalTo(ChunkEntityFields.IS_LAST_FORWARD, true) .findFirst() } + internal fun ChunkEntity.Companion.findLastForwardChunkOfThread(realm: Realm, roomId: String, rootThreadEventId: String): ChunkEntity? { return where(realm, roomId) .equalTo(ChunkEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId) .equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true) .findFirst() } + internal fun ChunkEntity.Companion.findEventInThreadChunk(realm: Realm, roomId: String, event: String): ChunkEntity? { return where(realm, roomId) .`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, arrayListOf(event).toTypedArray()) .equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true) .findFirst() } + internal fun ChunkEntity.Companion.findAllIncludingEvents(realm: Realm, eventIds: List): RealmResults { return realm.where() .`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, eventIds.toTypedArray()) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ThreadSummaryEntityQueries.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ThreadSummaryEntityQueries.kt index 517d43d7cf..eab2740433 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ThreadSummaryEntityQueries.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/ThreadSummaryEntityQueries.kt @@ -39,9 +39,11 @@ internal fun ThreadSummaryEntity.Companion.getOrCreate(realm: Realm, roomId: Str this.rootThreadEventId = rootThreadEventId } } + internal fun ThreadSummaryEntity.Companion.getOrNull(realm: Realm, roomId: String, rootThreadEventId: String): ThreadSummaryEntity? { return where(realm, roomId, rootThreadEventId).findFirst() } + internal fun RealmList.find(rootThreadEventId: String): ThreadSummaryEntity? { return this.where() .equalTo(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId) 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 cd7c99b8f9..3d2b2bfbfb 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 @@ -44,7 +44,7 @@ internal interface NetworkConnectivityChecker { internal class DefaultNetworkConnectivityChecker @Inject constructor(private val homeServerPinger: HomeServerPinger, private val backgroundDetectionObserver: BackgroundDetectionObserver, private val networkCallbackStrategy: NetworkCallbackStrategy) : - NetworkConnectivityChecker { + NetworkConnectivityChecker { private val hasInternetAccess = AtomicBoolean(true) private val listeners = Collections.synchronizedSet(LinkedHashSet()) 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 5cd2d88000..71df7c08be 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 @@ -15,6 +15,7 @@ */ package org.matrix.android.sdk.internal.network + import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest internal interface RequestExecutor { 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 ac097f57ee..9b83cca558 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 @@ -123,7 +123,7 @@ internal class DefaultFileService @Inject constructor( val resolvedUrl = contentUrlResolver.resolveForDownload(url, elementToDecrypt) ?: throw IllegalArgumentException("url is null") val request = when (resolvedUrl) { - is ContentUrlResolver.ResolvedMethod.GET -> { + is ContentUrlResolver.ResolvedMethod.GET -> { Request.Builder() .url(resolvedUrl.url) .header(DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER, url) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallEventProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallEventProcessor.kt index 3f199c5cce..b15a647421 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallEventProcessor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/call/CallEventProcessor.kt @@ -30,7 +30,7 @@ private val loggerTag = LoggerTag("CallEventProcessor", LoggerTag.VOIP) @SessionScope internal class CallEventProcessor @Inject constructor(private val callSignalingHandler: CallSignalingHandler) : - EventInsertLiveProcessor { + EventInsertLiveProcessor { private val allowedTypes = listOf( EventType.CALL_ANSWER, 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 e9cb423893..f96a019fe2 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 @@ -148,8 +148,8 @@ internal class FileUploader @Inject constructor( .post(requestBody) .build() - return withContext(coroutineDispatchers.io) { - okHttpClient.newCall(request).awaitResponse().use { response -> + return withContext(coroutineDispatchers.io) { + okHttpClient.newCall(request).awaitResponse().use { response -> if (!response.isSuccessful) { throw response.toFailure(globalErrorReceiver) } else { 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 01eb52ff22..c5aa6cd5e7 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 @@ -68,16 +68,16 @@ internal class ImageCompressor @Inject constructor( val orientation = exifInfo.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) val matrix = Matrix() when (orientation) { - ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f) - ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f) - ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f) + ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f) + ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f) + ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f) ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.preScale(-1f, 1f) - ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.preScale(1f, -1f) - ExifInterface.ORIENTATION_TRANSPOSE -> { + ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.preScale(1f, -1f) + ExifInterface.ORIENTATION_TRANSPOSE -> { matrix.preRotate(-90f) matrix.preScale(-1f, 1f) } - ExifInterface.ORIENTATION_TRANSVERSE -> { + ExifInterface.ORIENTATION_TRANSVERSE -> { matrix.preRotate(90f) matrix.preScale(-1f, 1f) } 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 4a1e6661b0..c138c1a40e 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 @@ -24,7 +24,7 @@ import javax.inject.Inject @SessionScope internal class DefaultSyncStatusService @Inject constructor() : - SyncStatusService, + SyncStatusService, ProgressReporter { private val status = MutableLiveData() 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 30b1589169..1b96931c6c 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 @@ -59,7 +59,7 @@ internal class IntegrationManager @Inject constructor(matrixConfiguration: Matri private val updateUserAccountDataTask: UpdateUserAccountDataTask, private val accountDataDataSource: UserAccountDataDataSource, private val widgetFactory: WidgetFactory) : - SessionLifecycleObserver { + SessionLifecycleObserver { private val currentConfigs = ArrayList() private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/AddPusherWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/AddPusherWorker.kt index ce29efaaac..0042558027 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/AddPusherWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/AddPusherWorker.kt @@ -26,7 +26,7 @@ import org.matrix.android.sdk.internal.worker.SessionWorkerParams import javax.inject.Inject internal class AddPusherWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleActionsTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleActionsTask.kt index 33589dc55b..56f92d7b66 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleActionsTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/UpdatePushRuleActionsTask.kt @@ -38,18 +38,18 @@ internal class DefaultUpdatePushRuleActionsTask @Inject constructor( ) : UpdatePushRuleActionsTask { override suspend fun execute(params: UpdatePushRuleActionsTask.Params) { + executeRequest(globalErrorReceiver) { + pushRulesApi.updateEnableRuleStatus( + params.kind.value, + params.ruleId, + EnabledBody(params.enable) + ) + } + if (params.actions != null) { + val body = mapOf("actions" to params.actions.toJson()) executeRequest(globalErrorReceiver) { - pushRulesApi.updateEnableRuleStatus( - params.kind.value, - params.ruleId, - EnabledBody(params.enable) - ) - } - if (params.actions != null) { - val body = mapOf("actions" to params.actions.toJson()) - executeRequest(globalErrorReceiver) { - pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body) - } + pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body) } + } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/alias/GetRoomIdByAliasTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/alias/GetRoomIdByAliasTask.kt index dc3ea55a01..b25ef7ba0f 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/alias/GetRoomIdByAliasTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/alias/GetRoomIdByAliasTask.kt @@ -52,7 +52,7 @@ internal class DefaultGetRoomIdByAliasTask @Inject constructor( } else if (!params.searchOnServer) { Optional.from(null) } else { - val description = tryOrNull("## Failed to get roomId from alias") { + val description = tryOrNull("## Failed to get roomId from alias") { executeRequest(globalErrorReceiver) { directoryAPI.getRoomIdByAlias(params.roomAlias) } 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 8f1aefb731..7af54a45ca 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 @@ -32,7 +32,7 @@ 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) : - RoomPushRuleService { + RoomPushRuleService { @AssistedFactory interface Factory { 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 feb8c27b09..d31f8a9d85 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 @@ -38,7 +38,7 @@ internal interface SetRoomNotificationStateTask : Task(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( @@ -76,10 +76,10 @@ internal class MultipleEventSendingDispatcherWorker(context: Context, params: Wo params.localEchoIds.forEach { localEchoIds -> val roomId = localEchoIds.roomId val eventId = localEchoIds.eventId - localEchoRepository.updateSendState(eventId, roomId, SendState.SENDING) - Timber.v("## SendEvent: [${System.currentTimeMillis()}] Schedule send event $eventId") - val sendWork = createSendEventWork(params.sessionId, eventId, true) - timelineSendEventWorkCommon.postWork(roomId, sendWork) + localEchoRepository.updateSendState(eventId, roomId, SendState.SENDING) + Timber.v("## SendEvent: [${System.currentTimeMillis()}] Schedule send event $eventId") + val sendWork = createSendEventWork(params.sessionId, eventId, true) + timelineSendEventWorkCommon.postWork(roomId, sendWork) } return Result.success() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/RedactEventWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/RedactEventWorker.kt index c03d1fa81e..83c61d2845 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/RedactEventWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/RedactEventWorker.kt @@ -34,7 +34,7 @@ import javax.inject.Inject * Possible next worker : None */ internal class RedactEventWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/SendEventWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/SendEventWorker.kt index 7f24688ece..669891c822 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/SendEventWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/SendEventWorker.kt @@ -40,7 +40,7 @@ import javax.inject.Inject * Possible next worker : None */ internal class SendEventWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, params, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( 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 116c8d5c6b..545fc41737 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 @@ -74,7 +74,7 @@ internal class QueueMemento @Inject constructor(context: Context, encrypt = task.encrypt, order = order ) - is RedactQueuedTask -> RedactEventTaskInfo( + is RedactQueuedTask -> RedactEventTaskInfo( redactionLocalEcho = task.redactionLocalEchoId, order = order ) @@ -92,7 +92,7 @@ internal class QueueMemento @Inject constructor(context: Context, ?.forEach { info -> try { when (info) { - is SendEventTaskInfo -> { + is SendEventTaskInfo -> { localEchoRepository.getUpToDateEcho(info.localEchoId)?.let { if (it.sendState.isSending() && it.eventId != null && it.roomId != null) { localEchoRepository.updateSendState(it.eventId, it.roomId, SendState.UNSENT) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/SafePowerLevelContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/SafePowerLevelContent.kt index 197b4f8688..1f2ec09367 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/SafePowerLevelContent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/SafePowerLevelContent.kt @@ -51,7 +51,7 @@ internal fun JsonDict.toSafePowerLevelsContentDict(): JsonDict { usersDefault = content.usersDefault, users = content.users, stateDefault = content.stateDefault, - notifications = content.notifications?.mapValues { content.notificationLevel(it.key) } + notifications = content.notifications?.mapValues { content.notificationLevel(it.key) } ) } ?.toContent() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/GraphUtils.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/GraphUtils.kt index e3a215445d..52879d7121 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/GraphUtils.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/GraphUtils.kt @@ -101,11 +101,11 @@ internal class Graph { // it's a candidate destination = it.destination } - inPath -> { + inPath -> { // Cycle!! backwardEdges.add(it) } - completed -> { + completed -> { // dead end } } 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 64b1a4ff1d..e765e05578 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 @@ -41,7 +41,7 @@ internal class LiveTimelineEvent(private val monarchy: Monarchy, private val timelineEventMapper: TimelineEventMapper, private val roomId: String, private val eventId: String) : - MediatorLiveData>() { + MediatorLiveData>() { init { buildAndObserveQuery() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt index ca7bf8a0ac..27f4245b22 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/TimelineChunk.kt @@ -49,22 +49,23 @@ import java.util.concurrent.atomic.AtomicBoolean * It does mainly listen to the db timeline events. * It also triggers pagination to the server when needed, or dispatch to the prev or next chunk if any. */ -internal class TimelineChunk(private val chunkEntity: ChunkEntity, - private val timelineSettings: TimelineSettings, - private val roomId: String, - private val timelineId: String, - private val fetchThreadTimelineTask: FetchThreadTimelineTask, - private val eventDecryptor: TimelineEventDecryptor, - private val paginationTask: PaginationTask, - private val realmConfiguration: RealmConfiguration, - private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask, - private val timelineEventMapper: TimelineEventMapper, - private val uiEchoManager: UIEchoManager?, - private val threadsAwarenessHandler: ThreadsAwarenessHandler, - private val lightweightSettingsStorage: LightweightSettingsStorage, - private val initialEventId: String?, - private val onBuiltEvents: (Boolean) -> Unit, - private val onEventsDeleted: () -> Unit, +internal class TimelineChunk( + private val chunkEntity: ChunkEntity, + private val timelineSettings: TimelineSettings, + private val roomId: String, + private val timelineId: String, + private val fetchThreadTimelineTask: FetchThreadTimelineTask, + private val eventDecryptor: TimelineEventDecryptor, + private val paginationTask: PaginationTask, + private val realmConfiguration: RealmConfiguration, + private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask, + private val timelineEventMapper: TimelineEventMapper, + private val uiEchoManager: UIEchoManager?, + private val threadsAwarenessHandler: ThreadsAwarenessHandler, + private val lightweightSettingsStorage: LightweightSettingsStorage, + private val initialEventId: String?, + private val onBuiltEvents: (Boolean) -> Unit, + private val onEventsDeleted: () -> Unit, ) { private val isLastForward = AtomicBoolean(chunkEntity.isLastForward) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchTask.kt index 3ba7d11c3d..fcaf3b60a7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/search/SearchTask.kt @@ -87,7 +87,7 @@ internal class DefaultSearchTask @Inject constructor( results = searchCategories.roomEvents?.results?.map { searchResponseItem -> val localThreadEventDetails = localTimelineEvents - ?.firstOrNull { it.eventId == searchResponseItem.event.eventId } + ?.firstOrNull { it.eventId == searchResponseItem.event.eventId } ?.root ?.asDomain() ?.threadDetails diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt index 4f1fe43b7d..42cd972e0c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncPresence.kt @@ -34,11 +34,12 @@ internal enum class SyncPresence(val value: String) { companion object { fun from(presenceEnum: PresenceEnum): SyncPresence { return when (presenceEnum) { - PresenceEnum.ONLINE -> Online - PresenceEnum.OFFLINE -> Offline + PresenceEnum.ONLINE -> Online + PresenceEnum.OFFLINE -> Offline PresenceEnum.UNAVAILABLE -> Unavailable } } + fun from(s: String?): SyncPresence? = values().find { it.value == s } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt index b56f897749..bb0197a38d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/SyncTask.kt @@ -172,7 +172,7 @@ internal class DefaultSyncTask @Inject constructor( val nbToDevice = syncResponse.toDevice?.events.orEmpty().size val nextBatch = syncResponse.nextBatch Timber.tag(loggerTag.value).d( - "Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s). Got nextBatch: $nextBatch" + "Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s). Got nextBatch: $nextBatch" ) defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncParsing( rooms = nbRooms, 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 c67c0e350e..f183c4cb28 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 @@ -42,7 +42,7 @@ private const val DEFAULT_DELAY_MILLIS = 30_000L * Possible next worker : None */ internal class SyncWorker(context: Context, workerParameters: WorkerParameters, sessionManager: SessionManager) : - SessionSafeCoroutineWorker(context, workerParameters, sessionManager, Params::class.java) { + SessionSafeCoroutineWorker(context, workerParameters, sessionManager, Params::class.java) { @JsonClass(generateAdapter = true) internal data class Params( 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 fdd5524fc2..210cb192e7 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 @@ -23,7 +23,7 @@ import javax.inject.Inject internal class DefaultThirdPartyService @Inject constructor(private val getThirdPartyProtocolTask: GetThirdPartyProtocolsTask, private val getThirdPartyUserTask: GetThirdPartyUserTask) : - ThirdPartyService { + ThirdPartyService { override suspend fun getThirdPartyProtocols(): Map { return getThirdPartyProtocolTask.execute(Unit) 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 10b4f7f7d7..9f42688f7d 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 @@ -29,7 +29,7 @@ import javax.inject.Inject internal class DefaultWidgetPostAPIMediator @Inject constructor(private val moshi: Moshi, private val widgetPostMessageAPIProvider: WidgetPostMessageAPIProvider) : - WidgetPostAPIMediator { + 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 89e827aea0..53a435d217 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 @@ -29,7 +29,7 @@ import javax.inject.Provider internal class DefaultWidgetService @Inject constructor(private val widgetManager: WidgetManager, private val widgetURLFormatter: WidgetURLFormatter, private val widgetPostAPIMediator: Provider) : - WidgetService { + WidgetService { override fun getWidgetURLFormatter(): WidgetURLFormatter { return widgetURLFormatter @@ -52,7 +52,7 @@ internal class DefaultWidgetService @Inject constructor(private val widgetManage return widgetManager.getWidgetComputedUrl(widget, isLightTheme) } -override fun getRoomWidgetsLive( + override fun getRoomWidgetsLive( roomId: String, widgetId: QueryStringValue, widgetTypes: Set?, 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 e18117d2d7..07ed91c179 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 @@ -52,7 +52,7 @@ internal class WidgetManager @Inject constructor(private val integrationManager: private val widgetFactory: WidgetFactory, @UserId private val userId: String) : - IntegrationManagerService.Listener, SessionLifecycleObserver { + IntegrationManagerService.Listener, SessionLifecycleObserver { private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry } private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(lifecycleOwner) 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 f22f0810a1..8f3c89f2d4 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 @@ -21,7 +21,7 @@ import io.realm.RealmObjectSchema import timber.log.Timber internal abstract class RealmMigrator(private val realm: DynamicRealm, - private val targetSchemaVersion: Int) { + 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/util/system/DefaultBuildVersionSdkIntProvider.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/system/DefaultBuildVersionSdkIntProvider.kt index 2d5e4b944a..806c6e9735 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/system/DefaultBuildVersionSdkIntProvider.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/util/system/DefaultBuildVersionSdkIntProvider.kt @@ -20,6 +20,6 @@ import android.os.Build import javax.inject.Inject internal class DefaultBuildVersionSdkIntProvider @Inject constructor() : - BuildVersionSdkIntProvider { + BuildVersionSdkIntProvider { override fun get() = Build.VERSION.SDK_INT } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/AlwaysSuccessfulWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/AlwaysSuccessfulWorker.kt index 856d3debcf..c92b51fcb8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/AlwaysSuccessfulWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/worker/AlwaysSuccessfulWorker.kt @@ -20,7 +20,7 @@ import androidx.work.Worker import androidx.work.WorkerParameters internal class AlwaysSuccessfulWorker(context: Context, params: WorkerParameters) : - Worker(context, params) { + Worker(context, params) { override fun doWork(): Result { return Result.success() 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 0b451e9c34..e56b359f7a 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 @@ -93,7 +93,7 @@ internal class MatrixWorkerFactory @Inject constructor(private val sessionManage class CheckFactoryWorker(context: Context, workerParameters: WorkerParameters, private val isCreatedByMatrixWorkerFactory: Boolean) : - CoroutineWorker(context, workerParameters) { + CoroutineWorker(context, workerParameters) { // Called by WorkManager if there is no MatrixWorkerFactory constructor(context: Context, workerParameters: WorkerParameters) : this(context, diff --git a/matrix-sdk-android/src/release/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt b/matrix-sdk-android/src/release/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt index 47f6869479..0b7bac0d6f 100644 --- a/matrix-sdk-android/src/release/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt +++ b/matrix-sdk-android/src/release/java/org/matrix/android/sdk/internal/network/interceptors/CurlLoggingInterceptor.kt @@ -27,7 +27,7 @@ import javax.inject.Inject */ @MatrixScope internal class CurlLoggingInterceptor @Inject constructor() : - Interceptor { + Interceptor { @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { diff --git a/vector/src/androidTest/java/im/vector/app/EspressoExt.kt b/vector/src/androidTest/java/im/vector/app/EspressoExt.kt index 5fb404efe3..35554ae75a 100644 --- a/vector/src/androidTest/java/im/vector/app/EspressoExt.kt +++ b/vector/src/androidTest/java/im/vector/app/EspressoExt.kt @@ -198,7 +198,7 @@ fun activityIdlingResource(activityClass: Class<*>): IdlingResource { println("*** [$name] onActivityLifecycleChanged callback: $callback") callback?.onTransitionToIdle() } - else -> { + else -> { // do nothing, we're blocking until the activity resumes } } diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt index 5c9ecfdef5..53ad2af7e6 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/MessageMenuRobot.kt @@ -75,6 +75,7 @@ class MessageMenuRobot( clickOn(R.string.reply_in_thread) autoClosed = true } + fun viewInRoom() { clickOn(R.string.view_in_room) autoClosed = true diff --git a/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsRobot.kt b/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsRobot.kt index 97aee7ac4a..437f87c193 100644 --- a/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsRobot.kt +++ b/vector/src/androidTest/java/im/vector/app/ui/robot/settings/SettingsRobot.kt @@ -52,7 +52,7 @@ class SettingsRobot { clickOnAndGoBack(R.string.settings_security_and_privacy) { block(SettingsSecurityRobot()) } } - fun labs(shouldGoBack: Boolean = true, block: () -> Unit = {}) { + fun labs(shouldGoBack: Boolean = true, block: () -> Unit = {}) { if (shouldGoBack) { clickOnAndGoBack(R.string.room_settings_labs_pref_title) { block() } } else { diff --git a/vector/src/debug/java/im/vector/app/features/debug/sas/SasEmojiItem.kt b/vector/src/debug/java/im/vector/app/features/debug/sas/SasEmojiItem.kt index a7b74f3b59..9e0c013960 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/sas/SasEmojiItem.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/sas/SasEmojiItem.kt @@ -32,6 +32,7 @@ abstract class SasEmojiItem : VectorEpoxyModel() { @EpoxyAttribute var index: Int = 0 + @EpoxyAttribute lateinit var emojiRepresentation: EmojiRepresentation 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 27a3f09ddc..6d741a36ba 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 @@ -28,7 +28,7 @@ import javax.inject.Inject */ class TestAutoStartBoot @Inject constructor(private val vectorPreferences: VectorPreferences, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { if (vectorPreferences.autoStartOnBoot()) { 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 b5635e186c..f8c30f813d 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 @@ -28,7 +28,7 @@ import javax.inject.Inject class TestBackgroundRestrictions @Inject constructor(private val context: FragmentActivity, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { context.getSystemService()!!.apply { diff --git a/vector/src/fdroid/java/im/vector/app/fdroid/receiver/OnApplicationUpgradeOrRebootReceiver.kt b/vector/src/fdroid/java/im/vector/app/fdroid/receiver/OnApplicationUpgradeOrRebootReceiver.kt index 935d7e6e13..c1bc90c4db 100644 --- a/vector/src/fdroid/java/im/vector/app/fdroid/receiver/OnApplicationUpgradeOrRebootReceiver.kt +++ b/vector/src/fdroid/java/im/vector/app/fdroid/receiver/OnApplicationUpgradeOrRebootReceiver.kt @@ -29,10 +29,10 @@ class OnApplicationUpgradeOrRebootReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Timber.v("## onReceive() ${intent.action}") val singletonEntryPoint = context.singletonEntryPoint() - BackgroundSyncStarter.start( - context, - singletonEntryPoint.vectorPreferences(), - singletonEntryPoint.activeSessionHolder() - ) + BackgroundSyncStarter.start( + context, + singletonEntryPoint.vectorPreferences(), + singletonEntryPoint.activeSessionHolder() + ) } } 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 cc682e7a5f..ecb457bf9f 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 @@ -31,7 +31,7 @@ import javax.inject.Inject */ class TestPlayServices @Inject constructor(private val context: FragmentActivity, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { val apiAvailability = GoogleApiAvailability.getInstance() 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 7ae68b201b..f485de760a 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 @@ -41,7 +41,7 @@ class TestPushFromPushGateway @Inject constructor(private val context: FragmentA private val errorFormatter: ErrorFormatter, private val pushersManager: PushersManager, private val activeSessionHolder: ActiveSessionHolder) : - TroubleshootTest(R.string.settings_troubleshoot_test_push_loop_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_push_loop_title) { private var action: Job? = null private var pushReceived: Boolean = false 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 913b5491ea..f0199ad390 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 @@ -37,7 +37,7 @@ class TestTokenRegistration @Inject constructor(private val context: FragmentAct private val stringProvider: StringProvider, private val pushersManager: PushersManager, private val activeSessionHolder: ActiveSessionHolder) : - TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { // Check if we have a registered pusher for this token diff --git a/vector/src/main/java/im/vector/app/UISIDetector.kt b/vector/src/main/java/im/vector/app/UISIDetector.kt index 6157537743..fea1861cc6 100644 --- a/vector/src/main/java/im/vector/app/UISIDetector.kt +++ b/vector/src/main/java/im/vector/app/UISIDetector.kt @@ -34,7 +34,7 @@ data class E2EMessageDetected( val senderDeviceId: String, val senderKey: String, val sessionId: String - ) { +) { companion object { fun fromEvent(event: Event, roomId: String): E2EMessageDetected { @@ -109,9 +109,9 @@ class UISIDetector : LiveEventListener { timer.schedule(timeoutTask, timeoutMillis) } - override fun onLiveEvent(roomId: String, event: Event) { } + override fun onLiveEvent(roomId: String, event: Event) {} - override fun onPaginatedEvent(roomId: String, event: Event) { } + override fun onPaginatedEvent(roomId: String, event: Event) {} private fun trackerId(eventId: String, roomId: String): String = "$roomId-$eventId" 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 6371035a17..361868cd95 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 @@ -24,7 +24,7 @@ import javax.inject.Inject class DefaultDateFormatterProvider @Inject constructor(private val context: Context, private val localeProvider: LocaleProvider) : - DateFormatterProvider { + DateFormatterProvider { override val dateWithMonthFormatter: DateTimeFormatter by lazy { val pattern = DateFormat.getBestDateTimePattern(localeProvider.current(), "d MMMMM") diff --git a/vector/src/main/java/im/vector/app/core/di/HiltMavericksViewModelFactory.kt b/vector/src/main/java/im/vector/app/core/di/HiltMavericksViewModelFactory.kt index 13702053e8..5850cb8cb9 100644 --- a/vector/src/main/java/im/vector/app/core/di/HiltMavericksViewModelFactory.kt +++ b/vector/src/main/java/im/vector/app/core/di/HiltMavericksViewModelFactory.kt @@ -45,7 +45,7 @@ import dagger.hilt.components.SingletonComponent inline fun , S : MavericksState> hiltMavericksViewModelFactory() = HiltMavericksViewModelFactory(VM::class.java) class HiltMavericksViewModelFactory, S : MavericksState>( - private val viewModelClass: Class> + private val viewModelClass: Class> ) : MavericksViewModelFactory { override fun create(viewModelContext: ViewModelContext, state: S): VM { diff --git a/vector/src/main/java/im/vector/app/core/dialogs/ExportKeysDialog.kt b/vector/src/main/java/im/vector/app/core/dialogs/ExportKeysDialog.kt index b87b7f0286..024d283c4c 100644 --- a/vector/src/main/java/im/vector/app/core/dialogs/ExportKeysDialog.kt +++ b/vector/src/main/java/im/vector/app/core/dialogs/ExportKeysDialog.kt @@ -35,7 +35,7 @@ class ExportKeysDialog { val textWatcher = object : SimpleTextWatcher() { override fun afterTextChanged(s: Editable) { when { - views.exportDialogEt.text.isNullOrEmpty() -> { + views.exportDialogEt.text.isNullOrEmpty() -> { views.exportDialogSubmit.isEnabled = false views.exportDialogTilConfirm.error = null } @@ -43,7 +43,7 @@ class ExportKeysDialog { views.exportDialogSubmit.isEnabled = true views.exportDialogTilConfirm.error = null } - else -> { + else -> { views.exportDialogSubmit.isEnabled = false views.exportDialogTilConfirm.error = activity.getString(R.string.passphrase_passphrase_does_not_match) } diff --git a/vector/src/main/java/im/vector/app/core/extensions/Session.kt b/vector/src/main/java/im/vector/app/core/extensions/Session.kt index 87ed51522f..f89ba4c47a 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Session.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Session.kt @@ -74,8 +74,8 @@ fun Session.cannotLogoutSafely(): Boolean { return hasUnsavedKeys() || // has local cross signing keys (cryptoService().crossSigningService().allPrivateKeysKnown() && - // That are not backed up - !sharedSecretStorageService.isRecoverySetup()) + // That are not backed up + !sharedSecretStorageService.isRecoverySetup()) } fun Session.vectorStore(context: Context) = VectorSessionStore(context, myUserId) diff --git a/vector/src/main/java/im/vector/app/core/glide/AvatarPlaceholder.kt b/vector/src/main/java/im/vector/app/core/glide/AvatarPlaceholder.kt index e61f81de55..e7ced6b335 100644 --- a/vector/src/main/java/im/vector/app/core/glide/AvatarPlaceholder.kt +++ b/vector/src/main/java/im/vector/app/core/glide/AvatarPlaceholder.kt @@ -43,7 +43,7 @@ class AvatarPlaceholderModelLoaderFactory(private val context: Context) : ModelL } class AvatarPlaceholderModelLoader(private val context: Context) : - ModelLoader { + ModelLoader { override fun buildLoadData(model: AvatarPlaceholder, width: Int, height: Int, options: Options): ModelLoader.LoadData? { return ModelLoader.LoadData(ObjectKey(model), AvatarPlaceholderDataFetcher(context, model)) @@ -55,7 +55,7 @@ class AvatarPlaceholderModelLoader(private val context: Context) : } class AvatarPlaceholderDataFetcher(context: Context, private val data: AvatarPlaceholder) : - DataFetcher { + DataFetcher { private val avatarRenderer = context.singletonEntryPoint().avatarRenderer() 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 6b42e3fff8..c53db12b6b 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 @@ -49,7 +49,7 @@ class VectorGlideModelLoaderFactory(private val context: Context) : ModelLoaderF } class VectorGlideModelLoader(private val context: Context) : - ModelLoader { + ModelLoader { override fun handles(model: ImageContentRenderer.Data): Boolean { // Always handle return true @@ -64,7 +64,7 @@ class VectorGlideDataFetcher(context: Context, private val data: ImageContentRenderer.Data, private val width: Int, private val height: Int) : - DataFetcher { + DataFetcher { private val localFilesHelper = LocalFilesHelper(context) private val activeSessionHolder = context.singletonEntryPoint().activeSessionHolder() diff --git a/vector/src/main/java/im/vector/app/core/platform/ButtonStateView.kt b/vector/src/main/java/im/vector/app/core/platform/ButtonStateView.kt index e7e91dbfd9..7bedeaa4ff 100755 --- a/vector/src/main/java/im/vector/app/core/platform/ButtonStateView.kt +++ b/vector/src/main/java/im/vector/app/core/platform/ButtonStateView.kt @@ -29,7 +29,7 @@ import im.vector.app.core.epoxy.onClick import im.vector.app.databinding.ViewButtonStateBinding class ButtonStateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - FrameLayout(context, attrs, defStyle) { + FrameLayout(context, attrs, defStyle) { sealed class State { object Button : State() diff --git a/vector/src/main/java/im/vector/app/core/platform/MaxHeightScrollView.kt b/vector/src/main/java/im/vector/app/core/platform/MaxHeightScrollView.kt index 8d4c5d8950..da15d4413d 100644 --- a/vector/src/main/java/im/vector/app/core/platform/MaxHeightScrollView.kt +++ b/vector/src/main/java/im/vector/app/core/platform/MaxHeightScrollView.kt @@ -25,7 +25,7 @@ import im.vector.app.R private const val DEFAULT_MAX_HEIGHT = 200 class MaxHeightScrollView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - NestedScrollView(context, attrs, defStyle) { + NestedScrollView(context, attrs, defStyle) { var maxHeight: Int = 0 set(value) { diff --git a/vector/src/main/java/im/vector/app/core/platform/StateView.kt b/vector/src/main/java/im/vector/app/core/platform/StateView.kt index b3d42dc38f..a70bf54aa1 100755 --- a/vector/src/main/java/im/vector/app/core/platform/StateView.kt +++ b/vector/src/main/java/im/vector/app/core/platform/StateView.kt @@ -27,7 +27,7 @@ import im.vector.app.core.extensions.updateConstraintSet import im.vector.app.databinding.ViewStateBinding class StateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - FrameLayout(context, attrs, defStyle) { + FrameLayout(context, attrs, defStyle) { sealed class State { object Content : State() diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt index 70b265ff9f..7db35a8e8f 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt @@ -83,8 +83,8 @@ abstract class VectorBaseFragment : Fragment(), MavericksView * [ToolbarConfig] instance from host activity * */ protected var toolbar: ToolbarConfig? = null - get() = (activity as? VectorBaseActivity<*>)?.toolbar - private set + get() = (activity as? VectorBaseActivity<*>)?.toolbar + private set /* ========================================================================================== * View model * ========================================================================================== */ diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorEventViewModel.kt b/vector/src/main/java/im/vector/app/core/platform/VectorEventViewModel.kt index 9ab46557a5..2b47412901 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorEventViewModel.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorEventViewModel.kt @@ -26,4 +26,4 @@ interface VectorSharedAction * Parent class to handle navigation events, action events, or other any events */ open class VectorSharedActionViewModel(private val store: MutableDataSource = PublishDataSource()) : - ViewModel(), MutableDataSource by store + ViewModel(), MutableDataSource by store diff --git a/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt b/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt index b57bb27671..6101f8a597 100644 --- a/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt +++ b/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt @@ -139,7 +139,7 @@ class KeywordPreference : VectorPreference { keyword.contains("/") -> { context.getString(R.string.settings_notification_keyword_contains_invalid_character, "/") } - else -> null + else -> null } chipTextInputLayout.isErrorEnabled = errorMessage != null diff --git a/vector/src/main/java/im/vector/app/core/resources/LocaleProvider.kt b/vector/src/main/java/im/vector/app/core/resources/LocaleProvider.kt index fdb5f21b61..2f1b46b555 100644 --- a/vector/src/main/java/im/vector/app/core/resources/LocaleProvider.kt +++ b/vector/src/main/java/im/vector/app/core/resources/LocaleProvider.kt @@ -32,6 +32,6 @@ class LocaleProvider @Inject constructor(private val resources: Resources) { fun LocaleProvider.isEnglishSpeaking() = current().language.startsWith("en") -fun LocaleProvider.getLayoutDirectionFromCurrentLocale() = TextUtils.getLayoutDirectionFromLocale(current()) +fun LocaleProvider.getLayoutDirectionFromCurrentLocale() = TextUtils.getLayoutDirectionFromLocale(current()) fun LocaleProvider.isRTL() = getLayoutDirectionFromCurrentLocale() == View.LAYOUT_DIRECTION_RTL diff --git a/vector/src/main/java/im/vector/app/core/ui/bottomsheet/BottomSheetGenericController.kt b/vector/src/main/java/im/vector/app/core/ui/bottomsheet/BottomSheetGenericController.kt index 6e92549809..70faa87645 100644 --- a/vector/src/main/java/im/vector/app/core/ui/bottomsheet/BottomSheetGenericController.kt +++ b/vector/src/main/java/im/vector/app/core/ui/bottomsheet/BottomSheetGenericController.kt @@ -21,7 +21,7 @@ import com.airbnb.epoxy.TypedEpoxyController * Epoxy controller for generic bottom sheet actions */ abstract class BottomSheetGenericController : - TypedEpoxyController() { + TypedEpoxyController() { var listener: Listener? = null 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 a984707bf7..39bfce6975 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 @@ -36,7 +36,7 @@ class PasswordStrengthBar @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : - LinearLayout(context, attrs, defStyleAttr) { + LinearLayout(context, attrs, defStyleAttr) { private val views: ViewPasswordStrengthBarBinding diff --git a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt index bc06254b0d..2e9945c8d7 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/TypingMessageDotsView.kt @@ -30,7 +30,7 @@ import androidx.core.view.setMargins import im.vector.app.R class TypingMessageDotsView(context: Context, attrs: AttributeSet) : - LinearLayout(context, attrs) { + LinearLayout(context, attrs) { companion object { const val DEFAULT_CIRCLE_DURATION = 1000L diff --git a/vector/src/main/java/im/vector/app/features/analytics/ui/consent/AnalyticsOptInFragment.kt b/vector/src/main/java/im/vector/app/features/analytics/ui/consent/AnalyticsOptInFragment.kt index f112ba4659..320386aebd 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/ui/consent/AnalyticsOptInFragment.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/ui/consent/AnalyticsOptInFragment.kt @@ -31,7 +31,7 @@ import im.vector.app.databinding.FragmentAnalyticsOptinBinding import javax.inject.Inject class AnalyticsOptInFragment @Inject constructor() : - VectorBaseFragment(), + VectorBaseFragment(), OnBackPressed { // Share the view model with the Activity so that the Activity diff --git a/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewViewModel.kt b/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewViewModel.kt index 3e9d72e98b..81f0994899 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/preview/AttachmentsPreviewViewModel.kt @@ -20,7 +20,7 @@ package im.vector.app.features.attachments.preview import im.vector.app.core.platform.VectorViewModel class AttachmentsPreviewViewModel(initialState: AttachmentsPreviewViewState) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { override fun handle(action: AttachmentsPreviewAction) { when (action) { diff --git a/vector/src/main/java/im/vector/app/features/auth/PromptFragment.kt b/vector/src/main/java/im/vector/app/features/auth/PromptFragment.kt index 501af00ad2..bd44a5b9cd 100644 --- a/vector/src/main/java/im/vector/app/features/auth/PromptFragment.kt +++ b/vector/src/main/java/im/vector/app/features/auth/PromptFragment.kt @@ -65,7 +65,7 @@ class PromptFragment : VectorBaseFragment() { override fun invalidate() = withState(viewModel) { when (it.flowType) { - LoginFlowTypes.SSO -> { + LoginFlowTypes.SSO -> { views.passwordFieldTil.isVisible = false views.reAuthConfirmButton.text = getString(R.string.auth_login_sso) } 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 78c6cbb021..f92ec8ea9e 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 @@ -86,10 +86,10 @@ class ReAuthActivity : SimpleFragmentActivity() { sharedViewModel.observeViewEvents { when (it) { - is ReAuthEvents.OpenSsoURl -> { + is ReAuthEvents.OpenSsoURl -> { openInCustomTab(it.url) } - ReAuthEvents.Dismiss -> { + ReAuthEvents.Dismiss -> { setResult(RESULT_CANCELED) finish() } @@ -205,7 +205,7 @@ class ReAuthActivity : SimpleFragmentActivity() { LoginFlowTypes.PASSWORD -> { LoginFlowTypes.PASSWORD } - LoginFlowTypes.SSO -> { + LoginFlowTypes.SSO -> { LoginFlowTypes.SSO } else -> { diff --git a/vector/src/main/java/im/vector/app/features/auth/ReAuthViewModel.kt b/vector/src/main/java/im/vector/app/features/auth/ReAuthViewModel.kt index fcc2a59ef8..16aca5cfeb 100644 --- a/vector/src/main/java/im/vector/app/features/auth/ReAuthViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/auth/ReAuthViewModel.kt @@ -42,7 +42,7 @@ class ReAuthViewModel @AssistedInject constructor( override fun handle(action: ReAuthActions) = withState { state -> when (action) { - ReAuthActions.StartSSOFallback -> { + ReAuthActions.StartSSOFallback -> { if (state.flowType == LoginFlowTypes.SSO) { setState { copy(ssoFallbackPageWasShown = true) } val ssoURL = session.getUiaSsoFallbackUrl(initialState.session ?: "") @@ -55,7 +55,7 @@ class ReAuthViewModel @AssistedInject constructor( ReAuthActions.FallBackPageClosed -> { // Should we do something here? } - is ReAuthActions.ReAuthWithPass -> { + is ReAuthActions.ReAuthWithPass -> { val safeForIntentCypher = ByteArrayOutputStream().also { it.use { session.securelyStoreObject(action.password, initialState.resultKeyStoreAlias, it) diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallViewEvents.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallViewEvents.kt index 7c29d7eea3..256a373d44 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallViewEvents.kt @@ -27,6 +27,7 @@ sealed class VectorCallViewEvents : VectorViewEvents { val available: Set, val current: CallAudioManager.Device ) : VectorCallViewEvents() + object ShowDialPad : VectorCallViewEvents() object ShowCallTransferScreen : VectorCallViewEvents() object FailToTransfer : VectorCallViewEvents() diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt index b9bf578daa..a80055d8e7 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallViewModel.kt @@ -256,27 +256,27 @@ class VectorCallViewModel @AssistedInject constructor( override fun handle(action: VectorCallViewActions) = withState { state -> when (action) { - VectorCallViewActions.EndCall -> call?.endCall() - VectorCallViewActions.AcceptCall -> { + VectorCallViewActions.EndCall -> call?.endCall() + VectorCallViewActions.AcceptCall -> { setState { copy(callState = Loading()) } call?.acceptIncomingCall() } - VectorCallViewActions.DeclineCall -> { + VectorCallViewActions.DeclineCall -> { setState { copy(callState = Loading()) } call?.endCall() } - VectorCallViewActions.ToggleMute -> { + VectorCallViewActions.ToggleMute -> { val muted = state.isAudioMuted call?.muteCall(!muted) setState { copy(isAudioMuted = !muted) } } - VectorCallViewActions.ToggleVideo -> { + VectorCallViewActions.ToggleVideo -> { if (state.isVideoCall) { val videoEnabled = state.isVideoEnabled call?.enableVideo(!videoEnabled) @@ -286,19 +286,19 @@ class VectorCallViewModel @AssistedInject constructor( } Unit } - VectorCallViewActions.ToggleHoldResume -> { + VectorCallViewActions.ToggleHoldResume -> { val isRemoteOnHold = state.isRemoteOnHold call?.updateRemoteOnHold(!isRemoteOnHold) } - is VectorCallViewActions.ChangeAudioDevice -> { + is VectorCallViewActions.ChangeAudioDevice -> { callManager.audioManager.setAudioDevice(action.device) } - VectorCallViewActions.SwitchSoundDevice -> { + VectorCallViewActions.SwitchSoundDevice -> { _viewEvents.post( VectorCallViewEvents.ShowSoundDeviceChooser(state.availableDevices, state.device) ) } - VectorCallViewActions.HeadSetButtonPressed -> { + VectorCallViewActions.HeadSetButtonPressed -> { if (state.callState.invoke() is CallState.LocalRinging) { // accept call call?.acceptIncomingCall() @@ -309,20 +309,20 @@ class VectorCallViewModel @AssistedInject constructor( } Unit } - VectorCallViewActions.ToggleCamera -> { + VectorCallViewActions.ToggleCamera -> { call?.switchCamera() } - VectorCallViewActions.ToggleHDSD -> { + VectorCallViewActions.ToggleHDSD -> { if (!state.isVideoCall) return@withState call?.setCaptureFormat(if (state.isHD) CaptureFormat.SD else CaptureFormat.HD) } - VectorCallViewActions.OpenDialPad -> { + VectorCallViewActions.OpenDialPad -> { _viewEvents.post(VectorCallViewEvents.ShowDialPad) } - is VectorCallViewActions.SendDtmfDigit -> { + is VectorCallViewActions.SendDtmfDigit -> { call?.sendDtmfDigit(action.digit) } - VectorCallViewActions.InitiateCallTransfer -> { + VectorCallViewActions.InitiateCallTransfer -> { call?.updateRemoteOnHold(true) _viewEvents.post( VectorCallViewEvents.ShowCallTransferScreen @@ -334,10 +334,10 @@ class VectorCallViewModel @AssistedInject constructor( is VectorCallViewActions.CallTransferSelectionResult -> { handleCallTransferSelectionResult(action.callTransferResult) } - VectorCallViewActions.TransferCall -> { + VectorCallViewActions.TransferCall -> { handleCallTransfer() } - is VectorCallViewActions.SwitchCall -> { + is VectorCallViewActions.SwitchCall -> { setState { VectorCallViewState(action.callArgs) } setupCallWithCurrentState() } 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 7e12987a6b..3f9d4e9076 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 @@ -32,9 +32,9 @@ internal class API23AudioDeviceDetector(private val audioManager: AudioManager, val deviceInfos = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS) for (info in deviceInfos) { when (info.type) { - AudioDeviceInfo.TYPE_BLUETOOTH_SCO -> devices.add(CallAudioManager.Device.WirelessHeadset(info.productName.toString())) - AudioDeviceInfo.TYPE_BUILTIN_EARPIECE -> devices.add(CallAudioManager.Device.Phone) - AudioDeviceInfo.TYPE_BUILTIN_SPEAKER -> devices.add(CallAudioManager.Device.Speaker) + AudioDeviceInfo.TYPE_BLUETOOTH_SCO -> devices.add(CallAudioManager.Device.WirelessHeadset(info.productName.toString())) + AudioDeviceInfo.TYPE_BUILTIN_EARPIECE -> devices.add(CallAudioManager.Device.Phone) + AudioDeviceInfo.TYPE_BUILTIN_SPEAKER -> devices.add(CallAudioManager.Device.Speaker) AudioDeviceInfo.TYPE_WIRED_HEADPHONES, AudioDeviceInfo.TYPE_WIRED_HEADSET, TYPE_USB_HEADSET -> devices.add(CallAudioManager.Device.Headset) } } 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 fd85ce075f..c3500c7bc2 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 @@ -95,7 +95,7 @@ class DefaultAudioDeviceRouter(private val audioManager: AudioManager, override fun onAudioFocusChange(focusChange: Int) { callAudioManager.runInAudioThread { when (focusChange) { - AudioManager.AUDIOFOCUS_GAIN -> { + AudioManager.AUDIOFOCUS_GAIN -> { Timber.d(" Audio focus gained") if (audioFocusLost) { callAudioManager.resetAudioRoute() diff --git a/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadLookup.kt b/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadLookup.kt index eadccab4f6..80c4e93306 100644 --- a/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadLookup.kt +++ b/vector/src/main/java/im/vector/app/features/call/dialpad/DialPadLookup.kt @@ -49,7 +49,7 @@ class DialPadLookup @Inject constructor( } session.getExistingDirectRoomWithUser(nativeUserId) // if there is not, just create a DM with the sip user - ?: directRoomHelper.ensureDMExists(sipUserId) + ?: directRoomHelper.ensureDMExists(sipUserId) } else { // do the same if there is no corresponding native user. directRoomHelper.ensureDMExists(sipUserId) 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 1765b58a02..67f0949dcf 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 @@ -31,7 +31,7 @@ import org.matrix.android.sdk.api.session.call.MxCall class CallTransferViewModel @AssistedInject constructor(@Assisted initialState: CallTransferViewState, private val callManager: WebRtcCallManager) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { @@ -62,5 +62,5 @@ class CallTransferViewModel @AssistedInject constructor(@Assisted initialState: call?.removeListener(callListener) } - override fun handle(action: EmptyAction) { } + override fun handle(action: EmptyAction) {} } diff --git a/vector/src/main/java/im/vector/app/features/call/webrtc/PeerConnectionObserver.kt b/vector/src/main/java/im/vector/app/features/call/webrtc/PeerConnectionObserver.kt index 99c26c5ebe..c776951f93 100644 --- a/vector/src/main/java/im/vector/app/features/call/webrtc/PeerConnectionObserver.kt +++ b/vector/src/main/java/im/vector/app/features/call/webrtc/PeerConnectionObserver.kt @@ -37,13 +37,13 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * Every ICE transport used by the connection is either in use (state "connected" or "completed") * or is closed (state "closed"); in addition, at least one transport is either "connected" or "completed" */ - PeerConnection.PeerConnectionState.CONNECTED -> { + PeerConnection.PeerConnectionState.CONNECTED -> { webRtcCall.mxCall.state = CallState.Connected(MxPeerConnectionState.CONNECTED) } /** * One or more of the ICE transports on the connection is in the "failed" state. */ - PeerConnection.PeerConnectionState.FAILED -> { + PeerConnection.PeerConnectionState.FAILED -> { // This can be temporary, e.g when other ice not yet received... // webRtcCall.mxCall.state = CallState.ERROR webRtcCall.mxCall.state = CallState.Connected(MxPeerConnectionState.FAILED) @@ -58,7 +58,7 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * One or more of the ICE transports are currently in the process of establishing a connection; * that is, their RTCIceConnectionState is either "checking" or "connected", and no transports are in the "failed" state */ - PeerConnection.PeerConnectionState.CONNECTING -> { + PeerConnection.PeerConnectionState.CONNECTING -> { webRtcCall.mxCall.state = CallState.Connected(MxPeerConnectionState.CONNECTING) } /** @@ -66,7 +66,7 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * This value was in the RTCSignalingState enum (and therefore found by reading the value of the signalingState) * property until the May 13, 2016 draft of the specification. */ - PeerConnection.PeerConnectionState.CLOSED -> { + PeerConnection.PeerConnectionState.CLOSED -> { webRtcCall.mxCall.state = CallState.Connected(MxPeerConnectionState.CLOSED) } /** @@ -76,7 +76,7 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio PeerConnection.PeerConnectionState.DISCONNECTED -> { webRtcCall.mxCall.state = CallState.Connected(MxPeerConnectionState.DISCONNECTED) } - null -> { + null -> { } } } @@ -101,14 +101,14 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * the ICE agent is gathering addresses or is waiting to be given remote candidates through * calls to RTCPeerConnection.addIceCandidate() (or both). */ - PeerConnection.IceConnectionState.NEW -> { + PeerConnection.IceConnectionState.NEW -> { } /** * The ICE agent has been given one or more remote candidates and is checking pairs of local and remote candidates * against one another to try to find a compatible match, but has not yet found a pair which will allow * the peer connection to be made. It's possible that gathering of candidates is also still underway. */ - PeerConnection.IceConnectionState.CHECKING -> { + PeerConnection.IceConnectionState.CHECKING -> { } /** @@ -117,7 +117,7 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * It's possible that gathering is still underway, and it's also possible that the ICE agent is still checking * candidates against one another looking for a better connection to use. */ - PeerConnection.IceConnectionState.CONNECTED -> { + PeerConnection.IceConnectionState.CONNECTED -> { } /** * Checks to ensure that components are still connected failed for at least one component of the RTCPeerConnection. @@ -131,18 +131,18 @@ class PeerConnectionObserver(private val webRtcCall: WebRtcCall) : PeerConnectio * compatible matches for all components of the connection. * It is, however, possible that the ICE agent did find compatible connections for some components. */ - PeerConnection.IceConnectionState.FAILED -> { + PeerConnection.IceConnectionState.FAILED -> { webRtcCall.onRenegotiationNeeded(restartIce = true) } /** * The ICE agent has finished gathering candidates, has checked all pairs against one another, and has found a connection for all components. */ - PeerConnection.IceConnectionState.COMPLETED -> { + PeerConnection.IceConnectionState.COMPLETED -> { } /** * The ICE agent for this RTCPeerConnection has shut down and is no longer handling requests. */ - PeerConnection.IceConnectionState.CLOSED -> { + PeerConnection.IceConnectionState.CLOSED -> { } } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreFromKeyFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreFromKeyFragment.kt index 40ad1372fb..42605a850b 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreFromKeyFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreFromKeyFragment.kt @@ -31,7 +31,7 @@ import org.matrix.android.sdk.api.extensions.tryOrNull import javax.inject.Inject class KeysBackupRestoreFromKeyFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentKeysBackupRestoreFromKeyBinding { return FragmentKeysBackupRestoreFromKeyBinding.inflate(inflater, container, false) diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsFragment.kt index 50d5e56483..4d3ec9a820 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupSettingsFragment.kt @@ -32,7 +32,7 @@ import im.vector.app.features.crypto.keysbackup.setup.KeysBackupSetupActivity import javax.inject.Inject class KeysBackupSettingsFragment @Inject constructor(private val keysBackupSettingsRecyclerViewController: KeysBackupSettingsRecyclerViewController) : - VectorBaseFragment(), + VectorBaseFragment(), KeysBackupSettingsRecyclerViewController.Listener { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentKeysBackupSettingsBinding { 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 51d8b3a8d5..55ab672c43 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 @@ -76,7 +76,7 @@ class SharedSecureStorageViewModel @AssistedInject constructor( @Assisted private val initialState: SharedSecureStorageViewState, private val stringProvider: StringProvider, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { @@ -88,7 +88,7 @@ class SharedSecureStorageViewModel @AssistedInject constructor( copy(userId = session.myUserId) } val integrityResult = session.sharedSecretStorageService.checkShouldBeAbleToAccessSecrets(initialState.requestedSecrets, initialState.keyId) - if (integrityResult !is IntegrityResult.Success) { + if (integrityResult !is IntegrityResult.Success) { _viewEvents.post( SharedSecureStorageViewEvent.Error( stringProvider.getString(R.string.enter_secret_storage_invalid), @@ -134,13 +134,13 @@ class SharedSecureStorageViewModel @AssistedInject constructor( override fun handle(action: SharedSecureStorageAction) = withState { when (action) { - is SharedSecureStorageAction.Cancel -> handleCancel() - is SharedSecureStorageAction.SubmitPassphrase -> handleSubmitPassphrase(action) - SharedSecureStorageAction.UseKey -> handleUseKey() - is SharedSecureStorageAction.SubmitKey -> handleSubmitKey(action) - SharedSecureStorageAction.Back -> handleBack() - SharedSecureStorageAction.ForgotResetAll -> handleResetAll() - SharedSecureStorageAction.DoResetAll -> handleDoResetAll() + is SharedSecureStorageAction.Cancel -> handleCancel() + is SharedSecureStorageAction.SubmitPassphrase -> handleSubmitPassphrase(action) + SharedSecureStorageAction.UseKey -> handleUseKey() + is SharedSecureStorageAction.SubmitKey -> handleSubmitKey(action) + SharedSecureStorageAction.Back -> handleBack() + SharedSecureStorageAction.ForgotResetAll -> handleResetAll() + SharedSecureStorageAction.DoResetAll -> handleDoResetAll() } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt index 200b2b73c2..c0d0aa8e76 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/quads/SharedSecuredStorageResetAllFragment.kt @@ -30,7 +30,7 @@ import im.vector.app.features.roommemberprofile.devices.DeviceListBottomSheet import javax.inject.Inject class SharedSecuredStorageResetAllFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentSsssResetAllBinding { return FragmentSsssResetAllBinding.inflate(inflater, container, false) diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapActions.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapActions.kt index 363416b7de..395b4d0475 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapActions.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapActions.kt @@ -37,7 +37,7 @@ sealed class BootstrapActions : VectorViewModelAction { data class UpdateCandidatePassphrase(val pass: String) : BootstrapActions() data class UpdateConfirmCandidatePassphrase(val pass: String) : BootstrapActions() -// data class ReAuth(val pass: String) : BootstrapActions() + // data class ReAuth(val pass: String) : BootstrapActions() object RecoveryKeySaved : BootstrapActions() object Completed : BootstrapActions() object SaveReqQueryStarted : BootstrapActions() diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt index ac7662ca59..57a8ad68b7 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapBottomSheet.kt @@ -64,7 +64,7 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment if (activityResult.resultCode == Activity.RESULT_OK) { when (activityResult.data?.extras?.getString(ReAuthActivity.RESULT_FLOW_TYPE)) { - LoginFlowTypes.SSO -> { + LoginFlowTypes.SSO -> { viewModel.handle(BootstrapActions.SsoAuthDone) } LoginFlowTypes.PASSWORD -> { diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt index 8a211388ed..7920ab3b96 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapConfirmPassphraseFragment.kt @@ -37,7 +37,7 @@ import reactivecircus.flowbinding.android.widget.textChanges import javax.inject.Inject class BootstrapConfirmPassphraseFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentBootstrapEnterPassphraseBinding { return FragmentBootstrapEnterPassphraseBinding.inflate(inflater, container, false) diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapEnterPassphraseFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapEnterPassphraseFragment.kt index 51430ba12e..ff6d109b3c 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapEnterPassphraseFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapEnterPassphraseFragment.kt @@ -36,7 +36,7 @@ import reactivecircus.flowbinding.android.widget.textChanges import javax.inject.Inject class BootstrapEnterPassphraseFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentBootstrapEnterPassphraseBinding { return FragmentBootstrapEnterPassphraseBinding.inflate(inflater, container, false) diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt index 2765dfefd3..3be2f020b8 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSetupRecoveryKeyFragment.kt @@ -29,7 +29,7 @@ import im.vector.app.databinding.FragmentBootstrapSetupRecoveryBinding import javax.inject.Inject class BootstrapSetupRecoveryKeyFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentBootstrapSetupRecoveryBinding { return FragmentBootstrapSetupRecoveryBinding.inflate(inflater, container, false) diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapWaitingFragment.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapWaitingFragment.kt index 8cf48a7c66..cc566833d8 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapWaitingFragment.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapWaitingFragment.kt @@ -26,7 +26,7 @@ import im.vector.app.databinding.FragmentBootstrapWaitingBinding import javax.inject.Inject class BootstrapWaitingFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentBootstrapWaitingBinding { return FragmentBootstrapWaitingBinding.inflate(inflater, container, false) 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 3a3f1054f1..62affec7b5 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 @@ -61,7 +61,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?.getUser(tx.otherUserId) val name = user?.toMatrixItem()?.getBestName() ?: tx.otherUserId diff --git a/vector/src/main/java/im/vector/app/features/crypto/verification/conclusion/VerificationConclusionViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/verification/conclusion/VerificationConclusionViewModel.kt index 82bdbccdb3..0e56a6857b 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/verification/conclusion/VerificationConclusionViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/verification/conclusion/VerificationConclusionViewModel.kt @@ -36,7 +36,7 @@ enum class ConclusionState { } class VerificationConclusionViewModel(initialState: VerificationConclusionViewState) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { companion object : MavericksViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolEditFragment.kt b/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolEditFragment.kt index dd0bd174af..1b6fbb7359 100644 --- a/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolEditFragment.kt +++ b/vector/src/main/java/im/vector/app/features/devtools/RoomDevToolEditFragment.kt @@ -32,7 +32,7 @@ import reactivecircus.flowbinding.android.widget.textChanges import javax.inject.Inject class RoomDevToolEditFragment @Inject constructor() : - VectorBaseFragment() { + VectorBaseFragment() { private val sharedViewModel: RoomDevToolViewModel by activityViewModel() 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 da01ba5662..4249e8d899 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 @@ -39,7 +39,7 @@ class SetIdentityServerViewModel @AssistedInject constructor( @Assisted initialState: SetIdentityServerState, private val mxSession: Session, stringProvider: StringProvider) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { 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 7a8dcf2634..d0ae7581be 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 @@ -370,7 +370,7 @@ class HomeActivity : } views.waitingView.root.isVisible = true } - else -> { + else -> { // Idle or Incremental sync status views.waitingView.root.isVisible = false } diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index c8b0fa024e..09ca30363c 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -189,7 +189,7 @@ class HomeActivityViewModel @AssistedInject constructor( maybeBootstrapCrossSigningAfterInitialSync() } } - else -> Unit + else -> Unit } setState { diff --git a/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt index 08b528f25a..d2617bd1c8 100644 --- a/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt @@ -58,7 +58,7 @@ data class DeviceDetectionInfo( class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted initialState: UnknownDevicesState, session: Session, private val vectorPreferences: VectorPreferences) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { sealed class Action : VectorViewModelAction { data class IgnoreDevice(val deviceIds: List) : Action() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/JoinReplacementRoomBottomSheet.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/JoinReplacementRoomBottomSheet.kt index 99843084ec..ce2903a6fa 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/JoinReplacementRoomBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/JoinReplacementRoomBottomSheet.kt @@ -62,15 +62,15 @@ class JoinReplacementRoomBottomSheet : when (joinState) { // it should never be Uninitialized Uninitialized, - is Loading -> { + is Loading -> { views.roomUpgradeButton.render(ButtonStateView.State.Loading) views.descriptionText.setText(R.string.it_may_take_some_time) } - is Success -> { + is Success -> { views.roomUpgradeButton.render(ButtonStateView.State.Loaded) dismiss() } - is Fail -> { + is Fail -> { // display the error message views.descriptionText.text = errorFormatter.toHumanReadable(joinState.error) views.roomUpgradeButton.render(ButtonStateView.State.Error) 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 bf88218fa6..c316c556b0 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 @@ -31,7 +31,7 @@ import javax.inject.Inject class DisplayReadReceiptsController @Inject constructor(private val dateFormatter: VectorDateFormatter, private val session: Session, private val avatarRender: AvatarRenderer) : - TypedEpoxyController>() { + TypedEpoxyController>() { var listener: Listener? = null 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 981e5740d7..8cea57399a 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 @@ -132,6 +132,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec mediaData: ImageContentRenderer.Data, view: View, inMemory: List) + fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View) // fun onFileMessageClicked(eventId: String, messageFileContent: MessageFileContent) 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 61a400d875..dd344c4c82 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 @@ -27,7 +27,7 @@ data class ViewEditHistoryViewState( val roomId: String, val isOriginalAReply: Boolean = false, val editList: Async> = Uninitialized) : - MavericksState { + 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/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 1787da2ae7..04e087d25d 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 @@ -122,31 +122,31 @@ import org.matrix.android.sdk.api.util.MimeTypes import javax.inject.Inject class MessageItemFactory @Inject constructor( - private val localFilesHelper: LocalFilesHelper, - private val colorProvider: ColorProvider, - private val dimensionConverter: DimensionConverter, - private val timelineMediaSizeProvider: TimelineMediaSizeProvider, - private val htmlRenderer: Lazy, - private val htmlCompressor: VectorHtmlCompressor, - private val textRendererFactory: EventTextRenderer.Factory, - private val stringProvider: StringProvider, - private val imageContentRenderer: ImageContentRenderer, - private val messageInformationDataFactory: MessageInformationDataFactory, - private val messageItemAttributesFactory: MessageItemAttributesFactory, - private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder, - private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder, - private val defaultItemFactory: DefaultItemFactory, - private val noticeItemFactory: NoticeItemFactory, - private val avatarSizeProvider: AvatarSizeProvider, - private val pillsPostProcessorFactory: PillsPostProcessor.Factory, - private val lightweightSettingsStorage: LightweightSettingsStorage, - private val spanUtils: SpanUtils, - private val session: Session, - private val audioMessagePlaybackTracker: AudioMessagePlaybackTracker, - private val locationPinProvider: LocationPinProvider, - private val vectorPreferences: VectorPreferences, - private val urlMapProvider: UrlMapProvider, - private val liveLocationMessageItemFactory: LiveLocationMessageItemFactory, + private val localFilesHelper: LocalFilesHelper, + private val colorProvider: ColorProvider, + private val dimensionConverter: DimensionConverter, + private val timelineMediaSizeProvider: TimelineMediaSizeProvider, + private val htmlRenderer: Lazy, + private val htmlCompressor: VectorHtmlCompressor, + private val textRendererFactory: EventTextRenderer.Factory, + private val stringProvider: StringProvider, + private val imageContentRenderer: ImageContentRenderer, + private val messageInformationDataFactory: MessageInformationDataFactory, + private val messageItemAttributesFactory: MessageItemAttributesFactory, + private val contentUploadStateTrackerBinder: ContentUploadStateTrackerBinder, + private val contentDownloadStateTrackerBinder: ContentDownloadStateTrackerBinder, + private val defaultItemFactory: DefaultItemFactory, + private val noticeItemFactory: NoticeItemFactory, + private val avatarSizeProvider: AvatarSizeProvider, + private val pillsPostProcessorFactory: PillsPostProcessor.Factory, + private val lightweightSettingsStorage: LightweightSettingsStorage, + private val spanUtils: SpanUtils, + private val session: Session, + private val audioMessagePlaybackTracker: AudioMessagePlaybackTracker, + private val locationPinProvider: LocationPinProvider, + private val vectorPreferences: VectorPreferences, + private val urlMapProvider: UrlMapProvider, + private val liveLocationMessageItemFactory: LiveLocationMessageItemFactory, ) { // TODO inject this properly? @@ -181,7 +181,7 @@ class MessageItemFactory @Inject constructor( return defaultItemFactory.create(malformedText, informationData, highlight, callback) } if (messageContent.relatesTo?.type == RelationType.REPLACE || - event.isEncrypted() && event.root.content.toModel()?.relatesTo?.type == RelationType.REPLACE + event.isEncrypted() && event.root.content.toModel()?.relatesTo?.type == RelationType.REPLACE ) { // This is an edit event, we should display it when debugging as a notice event return noticeItemFactory.create(params) @@ -198,24 +198,24 @@ class MessageItemFactory @Inject constructor( // val all = event.root.toContent() // val ev = all.toModel() val messageItem = when (messageContent) { - is MessageEmoteContent -> buildEmoteMessageItem(messageContent, informationData, highlight, callback, attributes) - is MessageTextContent -> buildItemForTextContent(messageContent, informationData, highlight, callback, attributes) - is MessageImageInfoContent -> buildImageMessageItem(messageContent, informationData, highlight, callback, attributes) - is MessageNoticeContent -> buildNoticeMessageItem(messageContent, informationData, highlight, callback, attributes) - is MessageVideoContent -> buildVideoMessageItem(messageContent, informationData, highlight, callback, attributes) - is MessageFileContent -> buildFileMessageItem(messageContent, highlight, attributes) - is MessageAudioContent -> buildAudioContent(params, messageContent, informationData, highlight, attributes) + is MessageEmoteContent -> buildEmoteMessageItem(messageContent, informationData, highlight, callback, attributes) + is MessageTextContent -> buildItemForTextContent(messageContent, informationData, highlight, callback, attributes) + is MessageImageInfoContent -> buildImageMessageItem(messageContent, informationData, highlight, callback, attributes) + is MessageNoticeContent -> buildNoticeMessageItem(messageContent, informationData, highlight, callback, attributes) + is MessageVideoContent -> buildVideoMessageItem(messageContent, informationData, highlight, callback, attributes) + is MessageFileContent -> buildFileMessageItem(messageContent, highlight, attributes) + is MessageAudioContent -> buildAudioContent(params, messageContent, informationData, highlight, attributes) is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes) - is MessagePollContent -> buildPollItem(messageContent, informationData, highlight, callback, attributes) - is MessageLocationContent -> { + is MessagePollContent -> buildPollItem(messageContent, informationData, highlight, callback, attributes) + is MessageLocationContent -> { if (vectorPreferences.labsRenderLocationsInTimeline()) { buildLocationItem(messageContent, informationData, highlight, attributes) } else { buildMessageTextItem(messageContent.body, false, informationData, highlight, callback, attributes) } } - is LiveLocationBeaconContent -> liveLocationMessageItemFactory.create(messageContent, highlight, attributes) - else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes) + is LiveLocationBeaconContent -> liveLocationMessageItemFactory.create(messageContent, highlight, attributes) + else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes) } return messageItem?.apply { layout(informationData.messageLayout.layoutRes) @@ -223,10 +223,10 @@ class MessageItemFactory @Inject constructor( } private fun buildLocationItem( - locationContent: MessageLocationContent, - informationData: MessageInformationData, - highlight: Boolean, - attributes: AbsMessageItem.Attributes, + locationContent: MessageLocationContent, + informationData: MessageInformationData, + highlight: Boolean, + attributes: AbsMessageItem.Attributes, ): MessageLocationItem? { val width = timelineMediaSizeProvider.getMaxSize().first val height = dimensionConverter.dpToPx(MESSAGE_LOCATION_ITEM_HEIGHT_IN_DP) @@ -238,22 +238,22 @@ class MessageItemFactory @Inject constructor( val userId = if (locationContent.isSelfLocation()) informationData.senderId else null return MessageLocationItem_() - .attributes(attributes) - .locationUrl(locationUrl) - .mapWidth(width) - .mapHeight(height) - .userId(userId) - .locationPinProvider(locationPinProvider) - .highlighted(highlight) - .leftGuideline(avatarSizeProvider.leftGuideline) + .attributes(attributes) + .locationUrl(locationUrl) + .mapWidth(width) + .mapHeight(height) + .userId(userId) + .locationPinProvider(locationPinProvider) + .highlighted(highlight) + .leftGuideline(avatarSizeProvider.leftGuideline) } private fun buildPollItem( - pollContent: MessagePollContent, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + pollContent: MessagePollContent, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): PollItem { val pollResponseSummary = informationData.pollResponseAggregatedSummary val pollState = createPollState(informationData, pollResponseSummary, pollContent) @@ -264,16 +264,16 @@ class MessageItemFactory @Inject constructor( val totalVotesText = createTotalVotesText(pollState, pollResponseSummary) return PollItem_() - .attributes(attributes) - .eventId(informationData.eventId) - .pollQuestion(question) - .canVote(pollState.isVotable()) - .totalVotesText(totalVotesText) - .optionViewStates(optionViewStates) - .edited(informationData.hasBeenEdited) - .highlighted(highlight) - .leftGuideline(avatarSizeProvider.leftGuideline) - .callback(callback) + .attributes(attributes) + .eventId(informationData.eventId) + .pollQuestion(question) + .canVote(pollState.isVotable()) + .totalVotesText(totalVotesText) + .optionViewStates(optionViewStates) + .edited(informationData.hasBeenEdited) + .highlighted(highlight) + .leftGuideline(avatarSizeProvider.leftGuideline) + .callback(callback) } private fun createPollState( @@ -281,11 +281,11 @@ class MessageItemFactory @Inject constructor( pollResponseSummary: PollResponseData?, pollContent: MessagePollContent, ): PollState = when { - !informationData.sendState.isSent() -> Sending - pollResponseSummary?.isClosed.orFalse() -> Ended + !informationData.sendState.isSent() -> Sending + pollResponseSummary?.isClosed.orFalse() -> Ended pollContent.getBestPollCreationInfo()?.kind == PollType.UNDISCLOSED -> Undisclosed - pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0) - else -> Ready + pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0) + else -> Ready } private fun List.mapToOptions( @@ -303,11 +303,11 @@ class MessageItemFactory @Inject constructor( val isWinner = winnerVoteCount != 0 && voteCount == winnerVoteCount when (pollState) { - Sending -> PollSending(optionId, optionAnswer) - Ready -> PollReady(optionId, optionAnswer) - is Voted -> PollVoted(optionId, optionAnswer, voteCount, votePercentage, isMyVote) + Sending -> PollSending(optionId, optionAnswer) + Ready -> PollReady(optionId, optionAnswer) + is Voted -> PollVoted(optionId, optionAnswer, voteCount, votePercentage, isMyVote) Undisclosed -> PollUndisclosed(optionId, optionAnswer, isMyVote) - Ended -> PollEnded(optionId, optionAnswer, voteCount, votePercentage, isWinner) + Ended -> PollEnded(optionId, optionAnswer, voteCount, votePercentage, isWinner) } } @@ -327,11 +327,11 @@ class MessageItemFactory @Inject constructor( ): String { val votes = pollResponseSummary?.totalVotes ?: 0 return when { - pollState is Ended -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_after_ended, votes, votes) + pollState is Ended -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_after_ended, votes, votes) pollState is Undisclosed -> "" - pollState is Voted -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_voted, votes, votes) - votes == 0 -> stringProvider.getString(R.string.poll_no_votes_cast) - else -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_not_voted, votes, votes) + pollState is Voted -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_voted, votes, votes) + votes == 0 -> stringProvider.getString(R.string.poll_no_votes_cast) + else -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_not_voted, votes, votes) } } @@ -406,27 +406,27 @@ class MessageItemFactory @Inject constructor( } return MessageVoiceItem_() - .attributes(attributes) - .duration(messageContent.audioWaveformInfo?.duration ?: 0) - .waveform(messageContent.audioWaveformInfo?.waveform?.toFft().orEmpty()) - .playbackControlButtonClickListener(playbackControlButtonClickListener) - .waveformTouchListener(waveformTouchListener) - .audioMessagePlaybackTracker(audioMessagePlaybackTracker) - .isLocalFile(localFilesHelper.isLocalFile(fileUrl)) - .mxcUrl(fileUrl) - .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) - .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) - .highlighted(highlight) - .leftGuideline(avatarSizeProvider.leftGuideline) + .attributes(attributes) + .duration(messageContent.audioWaveformInfo?.duration ?: 0) + .waveform(messageContent.audioWaveformInfo?.waveform?.toFft().orEmpty()) + .playbackControlButtonClickListener(playbackControlButtonClickListener) + .waveformTouchListener(waveformTouchListener) + .audioMessagePlaybackTracker(audioMessagePlaybackTracker) + .isLocalFile(localFilesHelper.isLocalFile(fileUrl)) + .mxcUrl(fileUrl) + .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) + .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) + .highlighted(highlight) + .leftGuideline(avatarSizeProvider.leftGuideline) } private fun buildVerificationRequestMessageItem( - messageContent: MessageVerificationRequestContent, - @Suppress("UNUSED_PARAMETER") - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageVerificationRequestContent, + @Suppress("UNUSED_PARAMETER") + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): VerificationRequestItem? { // If this request is not sent by me or sent to me, we should ignore it in timeline val myUserId = session.myUserId @@ -441,44 +441,44 @@ class MessageItemFactory @Inject constructor( informationData.memberName } return VerificationRequestItem_() - .attributes( - VerificationRequestItem.Attributes( - otherUserId = otherUserId, - otherUserName = otherUserName.toString(), - referenceId = informationData.eventId, - informationData = informationData, - avatarRenderer = attributes.avatarRenderer, - messageColorProvider = attributes.messageColorProvider, - itemLongClickListener = attributes.itemLongClickListener, - itemClickListener = attributes.itemClickListener, - reactionPillCallback = attributes.reactionPillCallback, - readReceiptsCallback = attributes.readReceiptsCallback, - emojiTypeFace = attributes.emojiTypeFace, - reactionsSummaryEvents = attributes.reactionsSummaryEvents, + .attributes( + VerificationRequestItem.Attributes( + otherUserId = otherUserId, + otherUserName = otherUserName.toString(), + referenceId = informationData.eventId, + informationData = informationData, + avatarRenderer = attributes.avatarRenderer, + messageColorProvider = attributes.messageColorProvider, + itemLongClickListener = attributes.itemLongClickListener, + itemClickListener = attributes.itemClickListener, + reactionPillCallback = attributes.reactionPillCallback, + readReceiptsCallback = attributes.readReceiptsCallback, + emojiTypeFace = attributes.emojiTypeFace, + reactionsSummaryEvents = attributes.reactionsSummaryEvents, + ) ) - ) - .callback(callback) - .highlighted(highlight) - .leftGuideline(avatarSizeProvider.leftGuideline) + .callback(callback) + .highlighted(highlight) + .leftGuideline(avatarSizeProvider.leftGuideline) } private fun buildFileMessageItem( - messageContent: MessageFileContent, - highlight: Boolean, - attributes: AbsMessageItem.Attributes, + messageContent: MessageFileContent, + highlight: Boolean, + attributes: AbsMessageItem.Attributes, ): MessageFileItem { val mxcUrl = messageContent.getFileUrl() ?: "" return MessageFileItem_() - .attributes(attributes) - .leftGuideline(avatarSizeProvider.leftGuideline) - .isLocalFile(localFilesHelper.isLocalFile(messageContent.getFileUrl())) - .isDownloaded(session.fileService().isFileInCache(messageContent)) - .mxcUrl(mxcUrl) - .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) - .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) - .highlighted(highlight) - .filename(messageContent.body) - .iconRes(R.drawable.ic_paperclip) + .attributes(attributes) + .leftGuideline(avatarSizeProvider.leftGuideline) + .isLocalFile(localFilesHelper.isLocalFile(messageContent.getFileUrl())) + .isDownloaded(session.fileService().isFileInCache(messageContent)) + .mxcUrl(mxcUrl) + .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) + .contentDownloadStateTrackerBinder(contentDownloadStateTrackerBinder) + .highlighted(highlight) + .filename(messageContent.body) + .iconRes(R.drawable.ic_paperclip) } private fun buildAudioContent( @@ -488,10 +488,10 @@ class MessageItemFactory @Inject constructor( highlight: Boolean, attributes: AbsMessageItem.Attributes, ) = if (messageContent.voiceMessageIndicator != null) { - buildVoiceMessageItem(params, messageContent, informationData, highlight, attributes) - } else { - buildAudioMessageItem(params, messageContent, informationData, highlight, attributes) - } + buildVoiceMessageItem(params, messageContent, informationData, highlight, attributes) + } else { + buildAudioMessageItem(params, messageContent, informationData, highlight, attributes) + } private fun buildNotHandledMessageItem( messageContent: MessageContent, @@ -504,95 +504,95 @@ class MessageItemFactory @Inject constructor( } private fun buildImageMessageItem( - messageContent: MessageImageInfoContent, - @Suppress("UNUSED_PARAMETER") - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageImageInfoContent, + @Suppress("UNUSED_PARAMETER") + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageImageVideoItem? { val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize() val data = ImageContentRenderer.Data( - eventId = informationData.eventId, - filename = messageContent.body, - mimeType = messageContent.mimeType, - url = messageContent.getFileUrl(), - elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt(), - height = messageContent.info?.height, - maxHeight = maxHeight, - width = messageContent.info?.width, - maxWidth = maxWidth, - allowNonMxcUrls = informationData.sendState.isSending() + eventId = informationData.eventId, + filename = messageContent.body, + mimeType = messageContent.mimeType, + url = messageContent.getFileUrl(), + elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt(), + height = messageContent.info?.height, + maxHeight = maxHeight, + width = messageContent.info?.width, + maxWidth = maxWidth, + allowNonMxcUrls = informationData.sendState.isSending() ) return MessageImageVideoItem_() - .attributes(attributes) - .leftGuideline(avatarSizeProvider.leftGuideline) - .imageContentRenderer(imageContentRenderer) - .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) - .playable(messageContent.mimeType == MimeTypes.Gif) - .highlighted(highlight) - .mediaData(data) - .apply { - if (messageContent.msgType == MessageType.MSGTYPE_STICKER_LOCAL) { - mode(ImageContentRenderer.Mode.STICKER) - clickListener { view -> - callback?.onImageMessageClicked(messageContent, data, view, listOf(data)) - } - } else { - clickListener { view -> - callback?.onImageMessageClicked(messageContent, data, view, emptyList()) + .attributes(attributes) + .leftGuideline(avatarSizeProvider.leftGuideline) + .imageContentRenderer(imageContentRenderer) + .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) + .playable(messageContent.mimeType == MimeTypes.Gif) + .highlighted(highlight) + .mediaData(data) + .apply { + if (messageContent.msgType == MessageType.MSGTYPE_STICKER_LOCAL) { + mode(ImageContentRenderer.Mode.STICKER) + clickListener { view -> + callback?.onImageMessageClicked(messageContent, data, view, listOf(data)) + } + } else { + clickListener { view -> + callback?.onImageMessageClicked(messageContent, data, view, emptyList()) + } } } - } } private fun buildVideoMessageItem( - messageContent: MessageVideoContent, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageVideoContent, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageImageVideoItem? { val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize() val thumbnailData = ImageContentRenderer.Data( - eventId = informationData.eventId, - filename = messageContent.body, - mimeType = messageContent.mimeType, - url = messageContent.videoInfo?.getThumbnailUrl(), - elementToDecrypt = messageContent.videoInfo?.thumbnailFile?.toElementToDecrypt(), - height = messageContent.videoInfo?.height, - maxHeight = maxHeight, - width = messageContent.videoInfo?.width, - maxWidth = maxWidth, - allowNonMxcUrls = informationData.sendState.isSending() + eventId = informationData.eventId, + filename = messageContent.body, + mimeType = messageContent.mimeType, + url = messageContent.videoInfo?.getThumbnailUrl(), + elementToDecrypt = messageContent.videoInfo?.thumbnailFile?.toElementToDecrypt(), + height = messageContent.videoInfo?.height, + maxHeight = maxHeight, + width = messageContent.videoInfo?.width, + maxWidth = maxWidth, + allowNonMxcUrls = informationData.sendState.isSending() ) val videoData = VideoContentRenderer.Data( - eventId = informationData.eventId, - filename = messageContent.body, - mimeType = messageContent.mimeType, - url = messageContent.getFileUrl(), - elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt(), - thumbnailMediaData = thumbnailData + eventId = informationData.eventId, + filename = messageContent.body, + mimeType = messageContent.mimeType, + url = messageContent.getFileUrl(), + elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt(), + thumbnailMediaData = thumbnailData ) return MessageImageVideoItem_() - .leftGuideline(avatarSizeProvider.leftGuideline) - .attributes(attributes) - .imageContentRenderer(imageContentRenderer) - .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) - .playable(true) - .highlighted(highlight) - .mediaData(thumbnailData) - .clickListener { view -> callback?.onVideoMessageClicked(messageContent, videoData, view.findViewById(R.id.messageThumbnailView)) } + .leftGuideline(avatarSizeProvider.leftGuideline) + .attributes(attributes) + .imageContentRenderer(imageContentRenderer) + .contentUploadStateTrackerBinder(contentUploadStateTrackerBinder) + .playable(true) + .highlighted(highlight) + .mediaData(thumbnailData) + .clickListener { view -> callback?.onVideoMessageClicked(messageContent, videoData, view.findViewById(R.id.messageThumbnailView)) } } private fun buildItemForTextContent( - messageContent: MessageTextContent, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageTextContent, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): VectorEpoxyModel<*>? { val matrixFormattedBody = messageContent.matrixFormattedBody return if (matrixFormattedBody != null) { @@ -603,11 +603,11 @@ class MessageItemFactory @Inject constructor( } private fun buildFormattedTextItem( - matrixFormattedBody: String, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + matrixFormattedBody: String, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageTextItem? { val compressed = htmlCompressor.compress(matrixFormattedBody) val renderedFormattedBody = htmlRenderer.get().render(compressed, pillsPostProcessor) as Spanned @@ -615,42 +615,42 @@ class MessageItemFactory @Inject constructor( } private fun buildMessageTextItem( - body: CharSequence, - isFormatted: Boolean, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + body: CharSequence, + isFormatted: Boolean, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageTextItem? { val renderedBody = textRenderer.render(body) val bindingOptions = spanUtils.getBindingOptions(renderedBody) val linkifiedBody = renderedBody.linkify(callback) return MessageTextItem_() - .message( - if (informationData.hasBeenEdited) { - annotateWithEdited(linkifiedBody, callback, informationData) - } else { - linkifiedBody - }.toEpoxyCharSequence() - ) - .useBigFont(linkifiedBody.length <= MAX_NUMBER_OF_EMOJI_FOR_BIG_FONT * 2 && containsOnlyEmojis(linkifiedBody.toString())) - .bindingOptions(bindingOptions) - .markwonPlugins(htmlRenderer.get().plugins) - .searchForPills(isFormatted) - .previewUrlRetriever(callback?.getPreviewUrlRetriever()) - .imageContentRenderer(imageContentRenderer) - .previewUrlCallback(callback) - .leftGuideline(avatarSizeProvider.leftGuideline) - .attributes(attributes) - .highlighted(highlight) - .movementMethod(createLinkMovementMethod(callback)) + .message( + if (informationData.hasBeenEdited) { + annotateWithEdited(linkifiedBody, callback, informationData) + } else { + linkifiedBody + }.toEpoxyCharSequence() + ) + .useBigFont(linkifiedBody.length <= MAX_NUMBER_OF_EMOJI_FOR_BIG_FONT * 2 && containsOnlyEmojis(linkifiedBody.toString())) + .bindingOptions(bindingOptions) + .markwonPlugins(htmlRenderer.get().plugins) + .searchForPills(isFormatted) + .previewUrlRetriever(callback?.getPreviewUrlRetriever()) + .imageContentRenderer(imageContentRenderer) + .previewUrlCallback(callback) + .leftGuideline(avatarSizeProvider.leftGuideline) + .attributes(attributes) + .highlighted(highlight) + .movementMethod(createLinkMovementMethod(callback)) } private fun annotateWithEdited( - linkifiedBody: CharSequence, - callback: TimelineEventController.Callback?, - informationData: MessageInformationData, + linkifiedBody: CharSequence, + callback: TimelineEventController.Callback?, + informationData: MessageInformationData, ): Spannable { val spannable = SpannableStringBuilder() spannable.append(linkifiedBody) @@ -660,17 +660,17 @@ class MessageItemFactory @Inject constructor( val editStart = spannable.lastIndexOf(editedSuffix) val editEnd = editStart + editedSuffix.length spannable.setSpan( - ForegroundColorSpan(color), - editStart, - editEnd, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + ForegroundColorSpan(color), + editStart, + editEnd, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE) // Note: text size is set to 14sp spannable.setSpan( - AbsoluteSizeSpan(dimensionConverter.spToPx(13)), - editStart, - editEnd, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + AbsoluteSizeSpan(dimensionConverter.spToPx(13)), + editStart, + editEnd, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE) spannable.setSpan(object : ClickableSpan() { override fun onClick(widget: View) { @@ -681,19 +681,19 @@ class MessageItemFactory @Inject constructor( // nop } }, - editStart, - editEnd, - Spanned.SPAN_INCLUSIVE_EXCLUSIVE) + editStart, + editEnd, + Spanned.SPAN_INCLUSIVE_EXCLUSIVE) return spannable } private fun buildNoticeMessageItem( - messageContent: MessageNoticeContent, - @Suppress("UNUSED_PARAMETER") - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageNoticeContent, + @Suppress("UNUSED_PARAMETER") + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageTextItem? { val htmlBody = messageContent.getHtmlBody() val formattedBody = span { @@ -706,23 +706,23 @@ class MessageItemFactory @Inject constructor( val message = formattedBody.linkify(callback) return MessageTextItem_() - .leftGuideline(avatarSizeProvider.leftGuideline) - .previewUrlRetriever(callback?.getPreviewUrlRetriever()) - .imageContentRenderer(imageContentRenderer) - .previewUrlCallback(callback) - .attributes(attributes) - .message(message.toEpoxyCharSequence()) - .bindingOptions(bindingOptions) - .highlighted(highlight) - .movementMethod(createLinkMovementMethod(callback)) + .leftGuideline(avatarSizeProvider.leftGuideline) + .previewUrlRetriever(callback?.getPreviewUrlRetriever()) + .imageContentRenderer(imageContentRenderer) + .previewUrlCallback(callback) + .attributes(attributes) + .message(message.toEpoxyCharSequence()) + .bindingOptions(bindingOptions) + .highlighted(highlight) + .movementMethod(createLinkMovementMethod(callback)) } private fun buildEmoteMessageItem( - messageContent: MessageEmoteContent, - informationData: MessageInformationData, - highlight: Boolean, - callback: TimelineEventController.Callback?, - attributes: AbsMessageItem.Attributes, + messageContent: MessageEmoteContent, + informationData: MessageInformationData, + highlight: Boolean, + callback: TimelineEventController.Callback?, + attributes: AbsMessageItem.Attributes, ): MessageTextItem? { val formattedBody = SpannableStringBuilder() formattedBody.append("* ${informationData.memberName} ") @@ -731,48 +731,48 @@ class MessageItemFactory @Inject constructor( val message = formattedBody.linkify(callback) return MessageTextItem_() - .message( - if (informationData.hasBeenEdited) { - annotateWithEdited(message, callback, informationData) - } else { - message - }.toEpoxyCharSequence() - ) - .bindingOptions(bindingOptions) - .leftGuideline(avatarSizeProvider.leftGuideline) - .previewUrlRetriever(callback?.getPreviewUrlRetriever()) - .imageContentRenderer(imageContentRenderer) - .previewUrlCallback(callback) - .attributes(attributes) - .highlighted(highlight) - .movementMethod(createLinkMovementMethod(callback)) + .message( + if (informationData.hasBeenEdited) { + annotateWithEdited(message, callback, informationData) + } else { + message + }.toEpoxyCharSequence() + ) + .bindingOptions(bindingOptions) + .leftGuideline(avatarSizeProvider.leftGuideline) + .previewUrlRetriever(callback?.getPreviewUrlRetriever()) + .imageContentRenderer(imageContentRenderer) + .previewUrlCallback(callback) + .attributes(attributes) + .highlighted(highlight) + .movementMethod(createLinkMovementMethod(callback)) } private fun MessageContentWithFormattedBody.getHtmlBody(): CharSequence { return matrixFormattedBody - ?.let { htmlCompressor.compress(it) } - ?.let { htmlRenderer.get().render(it, pillsPostProcessor) } + ?.let { htmlCompressor.compress(it) } + ?.let { htmlRenderer.get().render(it, pillsPostProcessor) } ?: body } private fun buildRedactedItem( - attributes: AbsMessageItem.Attributes, - highlight: Boolean, + attributes: AbsMessageItem.Attributes, + highlight: Boolean, ): RedactedMessageItem? { return RedactedMessageItem_() - .layout(attributes.informationData.messageLayout.layoutRes) - .leftGuideline(avatarSizeProvider.leftGuideline) - .attributes(attributes) - .highlighted(highlight) + .layout(attributes.informationData.messageLayout.layoutRes) + .leftGuideline(avatarSizeProvider.leftGuideline) + .attributes(attributes) + .highlighted(highlight) } private fun List?.toFft(): List? { return this - ?.filterNotNull() - ?.map { - // Value comes from AudioWaveformView.MAX_FFT, and 1024 is the max value in the Matrix spec - it * AudioWaveformView.MAX_FFT / 1024 - } + ?.filterNotNull() + ?.map { + // Value comes from AudioWaveformView.MAX_FFT, and 1024 is the max value in the Matrix spec + it * AudioWaveformView.MAX_FFT / 1024 + } } companion object { 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 2337a6ea15..95feef83c0 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 @@ -22,7 +22,7 @@ import im.vector.app.features.home.room.detail.timeline.TimelineEventController import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent class ReadMarkerVisibilityStateChangedListener(private val callback: TimelineEventController.Callback?) : - VectorEpoxyModel.OnVisibilityStateChangedListener { + VectorEpoxyModel.OnVisibilityStateChangedListener { override fun onVisibilityStateChanged(visibilityState: Int) { if (visibilityState == VisibilityState.VISIBLE) { @@ -33,7 +33,7 @@ class ReadMarkerVisibilityStateChangedListener(private val callback: TimelineEve class TimelineEventVisibilityStateChangedListener(private val callback: TimelineEventController.Callback?, private val event: TimelineEvent) : - VectorEpoxyModel.OnVisibilityStateChangedListener { + VectorEpoxyModel.OnVisibilityStateChangedListener { override fun onVisibilityStateChanged(visibilityState: Int) { if (visibilityState == VisibilityState.VISIBLE) { @@ -46,7 +46,7 @@ class TimelineEventVisibilityStateChangedListener(private val callback: Timeline class MergedTimelineEventVisibilityStateChangedListener(private val callback: TimelineEventController.Callback?, private val events: List) : - VectorEpoxyModel.OnVisibilityStateChangedListener { + VectorEpoxyModel.OnVisibilityStateChangedListener { override fun onVisibilityStateChanged(visibilityState: Int) { if (visibilityState == VisibilityState.VISIBLE) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt index ea130901b1..b56f5264e6 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt @@ -209,13 +209,13 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem { holder.statusView.setStatus(R.string.call_tile_video_active) } - attributes.informationData.sentByMe -> { + attributes.informationData.sentByMe -> { holder.statusView.setStatus(R.string.call_ringing) } - attributes.callKind.isVoiceCall -> { + attributes.callKind.isVoiceCall -> { holder.statusView.setStatus(R.string.call_tile_voice_incoming) } - else -> { + else -> { holder.statusView.setStatus(R.string.call_tile_video_incoming) } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt index 3c071578cc..f574dcfdcb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageAudioItem.kt @@ -127,9 +127,11 @@ abstract class MessageAudioItem : AbsMessageItem() { (duration * (progress.toFloat() / 100)).toInt() ) } + override fun onStartTrackingTouch(seekBar: SeekBar) { isUserSeeking = true } + override fun onStopTrackingTouch(seekBar: SeekBar) { isUserSeeking = false val percentage = seekBar.progress.toFloat() / 100 diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt index 02937574f2..82860da886 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageVoiceItem.kt @@ -126,9 +126,9 @@ abstract class MessageVoiceItem : AbsMessageItem() { audioMessagePlaybackTracker.track(attributes.informationData.eventId, object : AudioMessagePlaybackTracker.Listener { override fun onUpdate(state: AudioMessagePlaybackTracker.Listener.State) { when (state) { - is AudioMessagePlaybackTracker.Listener.State.Idle -> renderIdleState(holder, waveformColorIdle, waveformColorPlayed) - is AudioMessagePlaybackTracker.Listener.State.Playing -> renderPlayingState(holder, state, waveformColorIdle, waveformColorPlayed) - is AudioMessagePlaybackTracker.Listener.State.Paused -> renderPausedState(holder, state, waveformColorIdle, waveformColorPlayed) + is AudioMessagePlaybackTracker.Listener.State.Idle -> renderIdleState(holder, waveformColorIdle, waveformColorPlayed) + is AudioMessagePlaybackTracker.Listener.State.Playing -> renderPlayingState(holder, state, waveformColorIdle, waveformColorPlayed) + is AudioMessagePlaybackTracker.Listener.State.Paused -> renderPausedState(holder, state, waveformColorIdle, waveformColorPlayed) is AudioMessagePlaybackTracker.Listener.State.Recording -> Unit } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt index 2d9119f14c..3810f1cb6f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt @@ -57,7 +57,7 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem R.drawable.ic_shield_trusted ShieldUIState.BLACK -> R.drawable.ic_shield_black ShieldUIState.RED -> R.drawable.ic_shield_warning - ShieldUIState.ERROR -> R.drawable.ic_warning_badge + ShieldUIState.ERROR -> R.drawable.ic_warning_badge } holder.titleView.setCompoundDrawablesWithIntrinsicBounds( diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayout.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayout.kt index ae9b004f6c..a41732be2a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayout.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/style/TimelineMessageLayout.kt @@ -29,11 +29,11 @@ sealed interface TimelineMessageLayout : Parcelable { @Parcelize data class Default( - override val showAvatar: Boolean, - override val showDisplayName: Boolean, - override val showTimestamp: Boolean, - // Keep defaultLayout generated on epoxy items - override val layoutRes: Int = 0, + override val showAvatar: Boolean, + override val showDisplayName: Boolean, + override val showTimestamp: Boolean, + // Keep defaultLayout generated on epoxy items + override val layoutRes: Int = 0, ) : TimelineMessageLayout @Parcelize @@ -56,10 +56,10 @@ sealed interface TimelineMessageLayout : Parcelable { @Parcelize data class CornersRadius( - val topStartRadius: Float, - val topEndRadius: Float, - val bottomStartRadius: Float, - val bottomEndRadius: Float, + val topStartRadius: Float, + val topEndRadius: Float, + val bottomStartRadius: Float, + val bottomEndRadius: Float, ) : Parcelable } } 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 98be65c167..5a535e5696 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 @@ -34,7 +34,7 @@ class MigrateRoomViewModel @AssistedInject constructor( @Assisted initialState: MigrateRoomViewState, private val session: Session, private val upgradeRoomViewModelTask: UpgradeRoomViewModelTask) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { init { val room = session.getRoom(initialState.roomId) 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 b2da3bfc78..87392c5d7a 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 @@ -32,7 +32,7 @@ import javax.inject.Inject class RoomWidgetsController @Inject constructor( val stringProvider: StringProvider, val colorProvider: ColorProvider) : - TypedEpoxyController>() { + TypedEpoxyController>() { var listener: Listener? = null diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/CollapsableTypedEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/list/CollapsableTypedEpoxyController.kt index 15b3602766..8cf7e6bcab 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/CollapsableTypedEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/CollapsableTypedEpoxyController.kt @@ -19,7 +19,7 @@ package im.vector.app.features.home.room.list import com.airbnb.epoxy.EpoxyController abstract class CollapsableTypedEpoxyController : - EpoxyController(), CollapsableControllerExtension { + EpoxyController(), CollapsableControllerExtension { private var currentData: T? = null private var allowModelBuildRequests = false 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 2d61da0dd5..625118919b 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 @@ -25,7 +25,7 @@ sealed class RoomListQuickActionsSharedAction( @StringRes val titleRes: Int, @DrawableRes val iconResId: Int?, val destructive: Boolean = false) : - VectorSharedAction { + VectorSharedAction { data class NotificationsAllNoisy(val roomId: String) : RoomListQuickActionsSharedAction( R.string.room_list_quick_actions_notifications_all_noisy, diff --git a/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListController.kt b/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListController.kt index aeef69c6dc..54c44e178f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/threads/list/viewmodel/ThreadListController.kt @@ -71,13 +71,13 @@ class ThreadListController @Inject constructor( } ?.forEach { threadSummary -> val date = dateFormatter.format(threadSummary.latestEvent?.originServerTs, DateFormatKind.ROOM_LIST) - val lastMessageFormatted = threadSummary.let { + val lastMessageFormatted = threadSummary.let { displayableEventFormatter.formatThreadSummary( event = it.latestEvent, latestEdition = it.threadEditions.latestThreadEdition ).toString() } - val rootMessageFormatted = threadSummary.let { + val rootMessageFormatted = threadSummary.let { displayableEventFormatter.formatThreadSummary( event = it.rootEvent, latestEdition = it.threadEditions.rootThreadEdition @@ -123,12 +123,12 @@ class ThreadListController @Inject constructor( ?.forEach { timelineEvent -> val date = dateFormatter.format(timelineEvent.root.threadDetails?.lastMessageTimestamp, DateFormatKind.ROOM_LIST) val lastRootThreadEdition = timelineEvent.root.threadDetails?.lastRootThreadEdition - val lastMessageFormatted = timelineEvent.root.threadDetails?.threadSummaryLatestEvent.let { + val lastMessageFormatted = timelineEvent.root.threadDetails?.threadSummaryLatestEvent.let { displayableEventFormatter.formatThreadSummary( event = it, ).toString() } - val rootMessageFormatted = timelineEvent.root.let { + val rootMessageFormatted = timelineEvent.root.let { displayableEventFormatter.formatThreadSummary( event = it, latestEdition = lastRootThreadEdition diff --git a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt index 16555ef03c..c90ad542c0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt @@ -122,6 +122,7 @@ class ThreadListFragment @Inject constructor( bugReporter.openBugReportScreen(requireActivity(), reportType = ReportType.THREADS_BETA_FEEDBACK) } } + override fun invalidate() = withState(threadListViewModel) { state -> invalidateOptionsMenu() renderEmptyStateIfNeeded(state) diff --git a/vector/src/main/java/im/vector/app/features/invite/VectorInviteView.kt b/vector/src/main/java/im/vector/app/features/invite/VectorInviteView.kt index d9f1ad343b..7c5159ce11 100644 --- a/vector/src/main/java/im/vector/app/features/invite/VectorInviteView.kt +++ b/vector/src/main/java/im/vector/app/features/invite/VectorInviteView.kt @@ -32,7 +32,7 @@ import javax.inject.Inject @AndroidEntryPoint class VectorInviteView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - ConstraintLayout(context, attrs, defStyle) { + ConstraintLayout(context, attrs, defStyle) { interface Callback { fun onAcceptInvite() diff --git a/vector/src/main/java/im/vector/app/features/login/LoginMode.kt b/vector/src/main/java/im/vector/app/features/login/LoginMode.kt index 00945968fb..8fec4f3991 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginMode.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginMode.kt @@ -21,7 +21,8 @@ import kotlinx.parcelize.Parcelize import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider sealed class LoginMode : Parcelable -/** because persist state */ { +/** because persist state */ +{ @Parcelize object Unknown : LoginMode() @Parcelize object Password : LoginMode() @Parcelize data class Sso(val ssoIdentityProviders: List?) : LoginMode() diff --git a/vector/src/main/java/im/vector/app/features/login/SocialLoginButtonsView.kt b/vector/src/main/java/im/vector/app/features/login/SocialLoginButtonsView.kt index 515c8e9d39..68fc2d1c59 100644 --- a/vector/src/main/java/im/vector/app/features/login/SocialLoginButtonsView.kt +++ b/vector/src/main/java/im/vector/app/features/login/SocialLoginButtonsView.kt @@ -28,7 +28,7 @@ import im.vector.app.R import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider class SocialLoginButtonsView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - LinearLayout(context, attrs, defStyle) { + LinearLayout(context, attrs, defStyle) { fun interface InteractionListener { fun onProviderSelected(id: String?) @@ -99,10 +99,10 @@ class SocialLoginButtonsView @JvmOverloads constructor(context: Context, attrs: SsoIdentityProvider.BRAND_TWITTER -> { MaterialButton(context, null, R.attr.vctr_social_login_button_twitter_style) } - SsoIdentityProvider.BRAND_GITLAB -> { + SsoIdentityProvider.BRAND_GITLAB -> { MaterialButton(context, null, R.attr.vctr_social_login_button_gitlab_style) } - else -> { + else -> { // TODO Use iconUrl MaterialButton(context, null, R.attr.materialButtonOutlinedStyle).apply { transformationMethod = null diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginGenericTextInputFormFragment2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginGenericTextInputFormFragment2.kt index 76af86fda8..f623fb5abd 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginGenericTextInputFormFragment2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginGenericTextInputFormFragment2.kt @@ -75,8 +75,8 @@ class LoginGenericTextInputFormFragment2 @Inject constructor() : AbstractLoginFr if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { views.loginGenericTextInputFormTextInput.setAutofillHints( when (params.mode) { - TextInputFormFragmentMode.SetEmail -> HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS - TextInputFormFragmentMode.SetMsisdn -> HintConstants.AUTOFILL_HINT_PHONE_NUMBER + TextInputFormFragmentMode.SetEmail -> HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS + TextInputFormFragmentMode.SetMsisdn -> HintConstants.AUTOFILL_HINT_PHONE_NUMBER TextInputFormFragmentMode.ConfirmMsisdn -> HintConstants.AUTOFILL_HINT_SMS_OTP } ) diff --git a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToRoomSpaceFragment.kt b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToRoomSpaceFragment.kt index 3b0fc175b0..4e3159b5b3 100644 --- a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToRoomSpaceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToRoomSpaceFragment.kt @@ -60,10 +60,10 @@ class MatrixToRoomSpaceFragment @Inject constructor( Uninitialized -> { views.matrixToCardContentVisibility.isVisible = false } - is Loading -> { + is Loading -> { views.matrixToCardContentVisibility.isVisible = false } - is Success -> { + is Success -> { views.matrixToCardContentVisibility.isVisible = true when (val peek = item.invoke()) { is RoomInfoResult.FullInfo -> { @@ -154,7 +154,7 @@ class MatrixToRoomSpaceFragment @Inject constructor( } } } - is Fail -> { + is Fail -> { // TODO display some error copy? sharedViewModel.handle(MatrixToAction.FailedToResolveUser) } @@ -176,14 +176,14 @@ class MatrixToRoomSpaceFragment @Inject constructor( Uninitialized -> { views.matrixToCardMainButton.render(ButtonStateView.State.Button) } - is Success -> { + is Success -> { views.matrixToCardMainButton.render(ButtonStateView.State.Button) } - is Fail -> { + is Fail -> { views.matrixToCardMainButton.render(ButtonStateView.State.Error) // TODO display some error copy? } - is Loading -> { + is Loading -> { views.matrixToCardMainButton.render(ButtonStateView.State.Loading) } } @@ -191,7 +191,7 @@ class MatrixToRoomSpaceFragment @Inject constructor( private fun mainButtonClicked() = withState(sharedViewModel) { state -> when (val info = state.roomPeekResult.invoke()) { - is RoomInfoResult.FullInfo -> { + is RoomInfoResult.FullInfo -> { when (info.membership) { Membership.NONE, Membership.INVITE, diff --git a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToUserFragment.kt b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToUserFragment.kt index 3792183bca..b0d68c57e8 100644 --- a/vector/src/main/java/im/vector/app/features/matrixto/MatrixToUserFragment.kt +++ b/vector/src/main/java/im/vector/app/features/matrixto/MatrixToUserFragment.kt @@ -60,16 +60,16 @@ class MatrixToUserFragment @Inject constructor( Uninitialized -> { views.matrixToCardUserContentVisibility.isVisible = false } - is Loading -> { + is Loading -> { views.matrixToCardUserContentVisibility.isVisible = false } - is Success -> { + is Success -> { views.matrixToCardUserContentVisibility.isVisible = true views.matrixToCardNameText.setTextOrHide(item.invoke().displayName) views.matrixToCardUserIdText.setTextOrHide(item.invoke().id) avatarRenderer.render(item.invoke(), views.matrixToCardAvatar) } - is Fail -> { + is Fail -> { // TODO display some error copy? sharedViewModel.handle(MatrixToAction.FailedToResolveUser) } @@ -80,17 +80,17 @@ class MatrixToUserFragment @Inject constructor( views.matrixToCardButtonLoading.isVisible = false views.matrixToCardSendMessageButton.isVisible = false } - is Success -> { + is Success -> { views.matrixToCardButtonLoading.isVisible = false views.matrixToCardSendMessageButton.isVisible = true } - is Fail -> { + is Fail -> { views.matrixToCardButtonLoading.isVisible = false views.matrixToCardSendMessageButton.isVisible = true // TODO display some error copy? sharedViewModel.handle(MatrixToAction.FailedToStartChatting) } - is Loading -> { + is Loading -> { views.matrixToCardButtonLoading.isVisible = true views.matrixToCardSendMessageButton.isInvisible = true } 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 6122cf1eee..c8e9ee966a 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 @@ -176,7 +176,7 @@ class DefaultNavigator @Inject constructor( Navigator.PostSwitchSpaceAction.OpenAddExistingRooms -> { startActivity(context, SpaceManageActivity.newIntent(context, spaceId, ManageType.AddRooms), false) } - Navigator.PostSwitchSpaceAction.OpenRoomList -> { + Navigator.PostSwitchSpaceAction.OpenRoomList -> { startActivity(context, SpaceExploreActivity.newIntent(context, spaceId), buildTask = false) } is Navigator.PostSwitchSpaceAction.OpenDefaultRoom -> { diff --git a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewState.kt b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewState.kt index 3fd8ab605c..cfa1ff847e 100644 --- a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewState.kt +++ b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewState.kt @@ -21,14 +21,14 @@ import im.vector.app.features.poll.PollMode import org.matrix.android.sdk.api.session.room.model.message.PollType data class CreatePollViewState( - val roomId: String, - val editedEventId: String?, - val mode: PollMode, - val question: String = "", - val options: List = List(CreatePollViewModel.MIN_OPTIONS_COUNT) { "" }, - val canCreatePoll: Boolean = false, - val canAddMoreOptions: Boolean = true, - val pollType: PollType = PollType.DISCLOSED_UNSTABLE + val roomId: String, + val editedEventId: String?, + val mode: PollMode, + val question: String = "", + val options: List = List(CreatePollViewModel.MIN_OPTIONS_COUNT) { "" }, + val canCreatePoll: Boolean = false, + val canAddMoreOptions: Boolean = true, + val pollType: PollType = PollType.DISCLOSED_UNSTABLE ) : MavericksState { constructor(args: CreatePollArgs) : this( diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt index 701d04f3c9..f0edf6fd57 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt @@ -63,11 +63,11 @@ class BugReportActivity : VectorBaseActivity() { // Default screen is for bug report, so modify it for suggestion when (reportType) { - ReportType.BUG_REPORT -> { + ReportType.BUG_REPORT -> { supportActionBar?.setTitle(R.string.title_activity_bug_report) views.bugReportButtonContactMe.isVisible = true } - ReportType.SUGGESTION -> { + ReportType.SUGGESTION -> { supportActionBar?.setTitle(R.string.send_suggestion) views.bugReportFirstText.setText(R.string.send_suggestion_content) @@ -76,7 +76,7 @@ class BugReportActivity : VectorBaseActivity() { hideBugReportOptions() } - ReportType.SPACE_BETA_FEEDBACK -> { + ReportType.SPACE_BETA_FEEDBACK -> { supportActionBar?.setTitle(R.string.send_feedback_space_title) views.bugReportFirstText.setText(R.string.send_feedback_space_info) @@ -94,7 +94,7 @@ class BugReportActivity : VectorBaseActivity() { hideBugReportOptions() } - else -> { + else -> { // other types not supported here } } diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReportViewModel.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReportViewModel.kt index d0a1280868..6437f5c8f8 100644 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReportViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReportViewModel.kt @@ -39,7 +39,7 @@ class BugReportViewModel @AssistedInject constructor( override fun create(initialState: BugReportState): BugReportViewModel } - companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() + companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() init { fetchHomeserverVersion() 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 e1e52fdca1..720061e326 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 @@ -36,7 +36,7 @@ data class EmojiSearchResultViewState( class EmojiSearchResultViewModel @AssistedInject constructor( @Assisted initialState: EmojiSearchResultViewState, private val dataSource: EmojiDataSource) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { 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 0cb49746f1..329618045f 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 @@ -50,7 +50,7 @@ class RequireActiveMembershipViewModel @AssistedInject constructor( @Assisted initialState: RequireActiveMembershipViewState, private val stringProvider: StringProvider, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/ExplicitTermFilter.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/ExplicitTermFilter.kt index e184e77557..b1876d2c4e 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/ExplicitTermFilter.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/ExplicitTermFilter.kt @@ -35,7 +35,7 @@ class ExplicitTermFilter @Inject constructor( .toRegex(RegexOption.IGNORE_CASE) fun canSearchFor(term: String): Boolean { - return term !in explicitTerms && term != "18+" + return term !in explicitTerms && term != "18+" } fun isValid(str: String): Boolean { 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 a52f56870a..c3991cef99 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 @@ -36,7 +36,7 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi private val colorProvider: ColorProvider, private val dimensionConverter: DimensionConverter, private val vectorPreferences: VectorPreferences) : - TypedEpoxyController() { + TypedEpoxyController() { interface InteractionListener { fun onVerifyManually(device: CryptoDeviceInfo) diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt index 12a5d94eca..29a2f73c78 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileActivity.kt @@ -84,21 +84,21 @@ class RoomProfileActivity : addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) addFragmentToBackstack(views.simpleFragmentContainer, RoomSettingsFragment::class.java, roomProfileArgs) } - EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> { + EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> { addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs) } - else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) + else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs) } } sharedActionViewModel .stream() .onEach { sharedAction -> when (sharedAction) { - RoomProfileSharedAction.OpenRoomMembers -> openRoomMembers() - RoomProfileSharedAction.OpenRoomSettings -> openRoomSettings() - RoomProfileSharedAction.OpenRoomAliasesSettings -> openRoomAlias() - RoomProfileSharedAction.OpenRoomPermissionsSettings -> openRoomPermissions() - RoomProfileSharedAction.OpenRoomUploads -> openRoomUploads() + RoomProfileSharedAction.OpenRoomMembers -> openRoomMembers() + RoomProfileSharedAction.OpenRoomSettings -> openRoomSettings() + RoomProfileSharedAction.OpenRoomAliasesSettings -> openRoomAlias() + RoomProfileSharedAction.OpenRoomPermissionsSettings -> openRoomPermissions() + RoomProfileSharedAction.OpenRoomUploads -> openRoomUploads() RoomProfileSharedAction.OpenBannedRoomMembers -> openBannedRoomMembers() RoomProfileSharedAction.OpenRoomNotificationSettings -> openRoomNotificationSettings() } 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 7625972b05..d50c19635d 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 @@ -25,7 +25,7 @@ sealed class RoomAliasBottomSheetSharedAction( @StringRes val titleRes: Int, @DrawableRes val iconResId: Int = 0, val destructive: Boolean = false) : - VectorSharedAction { + VectorSharedAction { data class ShareAlias(val matrixTo: String) : RoomAliasBottomSheetSharedAction( R.string.action_share, diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsController.kt b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsController.kt index 8f6e8f54c1..3ee0a00f28 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsController.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsController.kt @@ -42,7 +42,7 @@ class RoomNotificationSettingsController @Inject constructor() : TypedEpoxyContr id("roomNotificationSettingsHeader") textRes(R.string.room_settings_room_notifications_notify_me) } - data.notificationOptions.forEach { notificationState -> + data.notificationOptions.forEach { notificationState -> val title = titleForNotificationState(notificationState) radioButtonItem { id(notificationState.name) @@ -67,6 +67,6 @@ class RoomNotificationSettingsController @Inject constructor() : TypedEpoxyContr RoomNotificationState.ALL_MESSAGES_NOISY -> R.string.room_settings_all_messages RoomNotificationState.MENTIONS_ONLY -> R.string.room_settings_mention_and_keyword_only RoomNotificationState.MUTE -> R.string.room_settings_none - else -> null + else -> null } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewModel.kt index 26db6b001e..4108167409 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewModel.kt @@ -36,7 +36,7 @@ class RoomNotificationSettingsViewModel @AssistedInject constructor( @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { - override fun create(initialState: RoomNotificationSettingsViewState): RoomNotificationSettingsViewModel + override fun create(initialState: RoomNotificationSettingsViewState): RoomNotificationSettingsViewModel } companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() @@ -73,7 +73,7 @@ class RoomNotificationSettingsViewModel @AssistedInject constructor( private fun handleSelectNotificationState(action: RoomNotificationSettingsAction.SelectNotificationState) { setState { copy(isLoading = true) } viewModelScope.launch { - runCatching { room.setRoomNotificationState(action.notificationState) } + runCatching { room.setRoomNotificationState(action.notificationState) } .fold( { setState { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt index d6d1176c36..5c1e9e6bc5 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt @@ -30,7 +30,7 @@ data class RoomNotificationSettingsViewState( val roomSummary: Async = Uninitialized, val isLoading: Boolean = false, val notificationState: Async = Uninitialized -) : MavericksState { +) : MavericksState { constructor(args: RoomProfileArgs) : this(roomId = args.roomId) constructor(args: RoomListActionsArgs) : this(roomId = args.roomId) } 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 6fbc545b6c..eff4f811fc 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 @@ -38,7 +38,7 @@ import org.matrix.android.sdk.flow.unwrap class RoomPermissionsViewModel @AssistedInject constructor(@Assisted initialState: RoomPermissionsViewState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { 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 122e0034c6..fe7c984cb4 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 @@ -75,13 +75,13 @@ data class RoomSettingsViewState( fun getJoinRuleWording(stringProvider: StringProvider): String { return when (val joinRule = newRoomJoinRules.newJoinRules ?: currentRoomJoinRules) { - RoomJoinRules.INVITE -> { + RoomJoinRules.INVITE -> { stringProvider.getString(R.string.room_settings_room_access_private_title) } - RoomJoinRules.PUBLIC -> { + RoomJoinRules.PUBLIC -> { stringProvider.getString(R.string.room_settings_room_access_public_title) } - RoomJoinRules.KNOCK -> { + RoomJoinRules.KNOCK -> { stringProvider.getString(R.string.room_settings_room_access_entry_knock) } RoomJoinRules.RESTRICTED -> { diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilitySharedActionViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilitySharedActionViewModel.kt index c4f4892984..2f1fc086db 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilitySharedActionViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilitySharedActionViewModel.kt @@ -20,4 +20,4 @@ import im.vector.app.core.platform.VectorSharedActionViewModel import javax.inject.Inject class RoomHistoryVisibilitySharedActionViewModel @Inject constructor() : - VectorSharedActionViewModel() + VectorSharedActionViewModel() diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilityViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilityViewModel.kt index 5580156918..e99a8d8a0b 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/historyvisibility/RoomHistoryVisibilityViewModel.kt @@ -19,4 +19,4 @@ package im.vector.app.features.roomprofile.settings.historyvisibility import im.vector.app.core.ui.bottomsheet.BottomSheetGenericViewModel class RoomHistoryVisibilityViewModel(initialState: RoomHistoryVisibilityState) : - BottomSheetGenericViewModel(initialState) + BottomSheetGenericViewModel(initialState) diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleSharedActionViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleSharedActionViewModel.kt index 971d71e0df..fd1fb4d61e 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleSharedActionViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleSharedActionViewModel.kt @@ -20,4 +20,4 @@ import im.vector.app.core.platform.VectorSharedActionViewModel import javax.inject.Inject class RoomJoinRuleSharedActionViewModel @Inject constructor() : - VectorSharedActionViewModel() + VectorSharedActionViewModel() diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleViewModel.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleViewModel.kt index 1ff374bf5b..e528c41676 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/joinrule/RoomJoinRuleViewModel.kt @@ -19,4 +19,4 @@ package im.vector.app.features.roomprofile.settings.joinrule import im.vector.app.core.ui.bottomsheet.BottomSheetGenericViewModel class RoomJoinRuleViewModel(initialState: RoomJoinRuleState) : - BottomSheetGenericViewModel(initialState) + BottomSheetGenericViewModel(initialState) diff --git a/vector/src/main/java/im/vector/app/features/session/SessionScopedProperty.kt b/vector/src/main/java/im/vector/app/features/session/SessionScopedProperty.kt index e6a84a41d8..64d49800c8 100644 --- a/vector/src/main/java/im/vector/app/features/session/SessionScopedProperty.kt +++ b/vector/src/main/java/im/vector/app/features/session/SessionScopedProperty.kt @@ -23,9 +23,9 @@ import kotlin.reflect.KProperty * This is a simple hack for having some Session scope dependencies. * Probably a temporary solution waiting for refactoring the Dagger management of Session. * You should use it with an extension property : - val Session.myProperty: MyProperty by SessionScopedProperty { - init code - } +val Session.myProperty: MyProperty by SessionScopedProperty { +init code +} * */ class SessionScopedProperty(val initializer: (Session) -> T) { 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 95537a8700..7057f4dce4 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 @@ -44,7 +44,7 @@ data class DeactivateAccountViewState( class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private val initialState: DeactivateAccountViewState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { @@ -57,7 +57,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v override fun handle(action: DeactivateAccountAction) { when (action) { is DeactivateAccountAction.DeactivateAccount -> handleDeactivateAccount(action) - DeactivateAccountAction.SsoAuthDone -> { + DeactivateAccountAction.SsoAuthDone -> { Timber.d("## UIA - FallBack success") if (pendingAuth != null) { uiaContinuation?.resume(pendingAuth!!) @@ -65,7 +65,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v uiaContinuation?.resumeWithException(IllegalArgumentException()) } } - is DeactivateAccountAction.PasswordAuthDone -> { + is DeactivateAccountAction.PasswordAuthDone -> { val decryptedPass = session.loadSecureSecret(action.password.fromBase64().inputStream(), ReAuthActivity.DEFAULT_RESULT_KEYSTORE_ALIAS) uiaContinuation?.resume( UserPasswordAuth( @@ -75,7 +75,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v ) ) } - DeactivateAccountAction.ReAuthCancelled -> { + DeactivateAccountAction.ReAuthCancelled -> { Timber.d("## UIA - Reauth cancelled") uiaContinuation?.resumeWithException(Exception()) uiaContinuation = null diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesAction.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesAction.kt index dd8fca3820..8ee0e7636e 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesAction.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesAction.kt @@ -23,7 +23,7 @@ sealed class DevicesAction : VectorViewModelAction { object Refresh : DevicesAction() data class Delete(val deviceId: String) : DevicesAction() -// data class Password(val password: String) : DevicesAction() + // data class Password(val password: String) : DevicesAction() data class Rename(val deviceId: String, val newName: String) : DevicesAction() data class PromptRename(val deviceId: String) : DevicesAction() diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewEvents.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewEvents.kt index 941b33a8ef..8ba7dbc871 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewEvents.kt @@ -29,7 +29,7 @@ import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo sealed class DevicesViewEvents : VectorViewEvents { data class Loading(val message: CharSequence? = null) : DevicesViewEvents() -// object HideLoading : DevicesViewEvents() + // object HideLoading : DevicesViewEvents() data class Failure(val throwable: Throwable) : DevicesViewEvents() // object RequestPassword : DevicesViewEvents() 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 9576b84e98..72085d37fd 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 @@ -38,7 +38,7 @@ data class AccountDataViewState( class AccountDataViewModel @AssistedInject constructor(@Assisted initialState: AccountDataViewState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { init { session.flow().liveUserAccountData(emptySet()) 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 dde032d303..30c2757eff 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 @@ -40,7 +40,7 @@ data class GossipingEventsPaperTrailState( class GossipingEventsPaperTrailViewModel @AssistedInject constructor(@Assisted initialState: GossipingEventsPaperTrailState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { init { refresh() 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 fd1cd3480d..f2df0e4211 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 @@ -51,7 +51,7 @@ data class KeyRequestViewState( class KeyRequestViewModel @AssistedInject constructor( @Assisted initialState: KeyRequestViewState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/settings/devtools/OutgoingKeyRequestListFragment.kt b/vector/src/main/java/im/vector/app/features/settings/devtools/OutgoingKeyRequestListFragment.kt index 0483d5fb4d..ca1f36dbb2 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devtools/OutgoingKeyRequestListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devtools/OutgoingKeyRequestListFragment.kt @@ -28,6 +28,7 @@ import im.vector.app.core.extensions.configureWith import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.databinding.FragmentGenericRecyclerBinding import javax.inject.Inject + class OutgoingKeyRequestListFragment @Inject constructor( private val epoxyController: OutgoingKeyRequestPagedController ) : VectorBaseFragment() { diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/NotificationIndex.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/NotificationIndex.kt index 793b94db1d..7d5eaab8f3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/NotificationIndex.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/NotificationIndex.kt @@ -29,15 +29,16 @@ enum class NotificationIndex { * Given a push rule determine the NotificationIndex by comparing it to the static push rule definitions. * Used when determining the selected state of the PushRulePreference. */ -val PushRule.notificationIndex: NotificationIndex? get() = - NotificationIndex.values().firstOrNull { - // Get the actions for the index - val standardAction = getStandardAction(this.ruleId, it) ?: return@firstOrNull false - val indexActions = standardAction.actions ?: listOf() - // Check if the input rule matches a rule generated from the static rule definitions - val targetRule = this.copy(enabled = standardAction != StandardActions.Disabled, actions = indexActions.toJson()) - ruleMatches(this, targetRule) - } +val PushRule.notificationIndex: NotificationIndex? + get() = + NotificationIndex.values().firstOrNull { + // Get the actions for the index + val standardAction = getStandardAction(this.ruleId, it) ?: return@firstOrNull false + val indexActions = standardAction.actions ?: listOf() + // Check if the input rule matches a rule generated from the static rule definitions + val targetRule = this.copy(enabled = standardAction != StandardActions.Disabled, actions = indexActions.toJson()) + ruleMatches(this, targetRule) + } /** * A check to determine if two push rules should be considered a match. @@ -46,9 +47,9 @@ private fun ruleMatches(rule: PushRule, targetRule: PushRule): Boolean { // Rules match if both are disabled, or if both are enabled and their highlight/sound/notify actions match up. return (!rule.enabled && !targetRule.enabled) || (rule.enabled && - targetRule.enabled && - rule.getHighlight() == targetRule.getHighlight() && - rule.getNotificationSound() == targetRule.getNotificationSound() && - rule.shouldNotify() == targetRule.shouldNotify() && - rule.shouldNotNotify() == targetRule.shouldNotNotify()) + targetRule.enabled && + rule.getHighlight() == targetRule.getHighlight() && + rule.getNotificationSound() == targetRule.getNotificationSound() && + rule.shouldNotify() == targetRule.shouldNotify() && + rule.shouldNotNotify() == targetRule.shouldNotNotify()) } diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsAdvancedNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsAdvancedNotificationPreferenceFragment.kt index 3b4aef929d..8c899c2256 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsAdvancedNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsAdvancedNotificationPreferenceFragment.kt @@ -28,7 +28,7 @@ import org.matrix.android.sdk.api.pushrules.rest.PushRuleAndKind import javax.inject.Inject class VectorSettingsAdvancedNotificationPreferenceFragment @Inject constructor() : - VectorSettingsBaseFragment() { + VectorSettingsBaseFragment() { override var titleRes: Int = R.string.settings_notification_advanced diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt index 2179e0eee2..3d67f89b10 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt @@ -23,18 +23,18 @@ import im.vector.app.features.analytics.plan.MobileScreen import org.matrix.android.sdk.api.pushrules.RuleIds class VectorSettingsDefaultNotificationPreferenceFragment : - VectorSettingsPushRuleNotificationPreferenceFragment() { + VectorSettingsPushRuleNotificationPreferenceFragment() { override var titleRes: Int = R.string.settings_notification_default override val preferenceXmlRes = R.xml.vector_settings_notification_default override val prefKeyToPushRuleId = mapOf( - "SETTINGS_PUSH_RULE_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY" to RuleIds.RULE_ID_ONE_TO_ONE_ROOM, - "SETTINGS_PUSH_RULE_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ALL_OTHER_MESSAGES_ROOMS, - "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ONE_TO_ONE_ENCRYPTED_ROOM, - "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ENCRYPTED - ) + "SETTINGS_PUSH_RULE_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY" to RuleIds.RULE_ID_ONE_TO_ONE_ROOM, + "SETTINGS_PUSH_RULE_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ALL_OTHER_MESSAGES_ROOMS, + "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ONE_TO_ONE_ENCRYPTED_ROOM, + "SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY" to RuleIds.RULE_ID_ENCRYPTED + ) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsOtherNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsOtherNotificationPreferenceFragment.kt index 71f8f0920a..8637bc9b81 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsOtherNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsOtherNotificationPreferenceFragment.kt @@ -21,18 +21,18 @@ import im.vector.app.core.preference.VectorPreferenceCategory import org.matrix.android.sdk.api.pushrules.RuleIds class VectorSettingsOtherNotificationPreferenceFragment : - VectorSettingsPushRuleNotificationPreferenceFragment() { + VectorSettingsPushRuleNotificationPreferenceFragment() { override var titleRes: Int = R.string.settings_notification_other override val preferenceXmlRes = R.xml.vector_settings_notification_other override val prefKeyToPushRuleId = mapOf( - "SETTINGS_PUSH_RULE_INVITED_TO_ROOM_PREFERENCE_KEY" to RuleIds.RULE_ID_INVITE_ME, - "SETTINGS_PUSH_RULE_CALL_INVITATIONS_PREFERENCE_KEY" to RuleIds.RULE_ID_CALL, - "SETTINGS_PUSH_RULE_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY" to RuleIds.RULE_ID_SUPPRESS_BOTS_NOTIFICATIONS, - "SETTINGS_PUSH_RULE_ROOMS_UPGRADED_KEY" to RuleIds.RULE_ID_TOMBSTONE - ) + "SETTINGS_PUSH_RULE_INVITED_TO_ROOM_PREFERENCE_KEY" to RuleIds.RULE_ID_INVITE_ME, + "SETTINGS_PUSH_RULE_CALL_INVITATIONS_PREFERENCE_KEY" to RuleIds.RULE_ID_CALL, + "SETTINGS_PUSH_RULE_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY" to RuleIds.RULE_ID_SUPPRESS_BOTS_NOTIFICATIONS, + "SETTINGS_PUSH_RULE_ROOMS_UPGRADED_KEY" to RuleIds.RULE_ID_TOMBSTONE + ) override fun bindPref() { super.bindPref() diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt index 26ee2fc601..6dd1a492b3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt @@ -25,7 +25,7 @@ import org.matrix.android.sdk.api.pushrules.RuleKind import org.matrix.android.sdk.api.pushrules.rest.PushRuleAndKind abstract class VectorSettingsPushRuleNotificationPreferenceFragment : - VectorSettingsBaseFragment() { + VectorSettingsBaseFragment() { abstract val prefKeyToPushRuleId: Map diff --git a/vector/src/main/java/im/vector/app/features/settings/push/PushRulesViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/push/PushRulesViewModel.kt index 0b6b72bb10..c6423bfea6 100644 --- a/vector/src/main/java/im/vector/app/features/settings/push/PushRulesViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/push/PushRulesViewModel.kt @@ -30,7 +30,7 @@ data class PushRulesViewState( ) : MavericksState class PushRulesViewModel(initialState: PushRulesViewState) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { companion object : MavericksViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsFragment.kt index ee7f8efab4..2a9db78121 100644 --- a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsFragment.kt @@ -61,7 +61,7 @@ class ThreePidsSettingsFragment @Inject constructor( viewModel.observeViewEvents { when (it) { - is ThreePidsSettingsViewEvents.Failure -> displayErrorDialog(it.throwable) + is ThreePidsSettingsViewEvents.Failure -> displayErrorDialog(it.throwable) is ThreePidsSettingsViewEvents.RequestReAuth -> askAuthentication(it) } } @@ -75,10 +75,11 @@ class ThreePidsSettingsFragment @Inject constructor( reAuthActivityResultLauncher.launch(intent) } } + private val reAuthActivityResultLauncher = registerStartForActivityResult { activityResult -> if (activityResult.resultCode == Activity.RESULT_OK) { when (activityResult.data?.extras?.getString(ReAuthActivity.RESULT_FLOW_TYPE)) { - LoginFlowTypes.SSO -> { + LoginFlowTypes.SSO -> { viewModel.handle(ThreePidsSettingsAction.SsoAuthDone) } LoginFlowTypes.PASSWORD -> { diff --git a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewEvents.kt b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewEvents.kt index 94ea8d24c6..9768d7bd93 100644 --- a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewEvents.kt @@ -22,6 +22,6 @@ import org.matrix.android.sdk.api.auth.registration.RegistrationFlowResponse sealed class ThreePidsSettingsViewEvents : VectorViewEvents { data class Failure(val throwable: Throwable) : ThreePidsSettingsViewEvents() -// object RequestPassword : ThreePidsSettingsViewEvents() + // object RequestPassword : ThreePidsSettingsViewEvents() data class RequestReAuth(val registrationFlowResponse: RegistrationFlowResponse, val lastErrorCode: String?) : ThreePidsSettingsViewEvents() } diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt index 8f0b2cfe74..8f762a9abc 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt @@ -25,7 +25,7 @@ import im.vector.app.databinding.ItemNotificationTroubleshootBinding import im.vector.app.features.themes.ThemeUtils class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList) : - RecyclerView.Adapter() { + RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val inflater = LayoutInflater.from(parent.context) 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 9d06e1724c..5b1216445f 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 @@ -34,7 +34,7 @@ import javax.inject.Inject */ class TestAccountSettings @Inject constructor(private val stringProvider: StringProvider, private val activeSessionHolder: ActiveSessionHolder) : - TroubleshootTest(R.string.settings_troubleshoot_test_account_settings_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_account_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { val session = activeSessionHolder.getSafeActiveSession() ?: return 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 f9fc7e80e3..c58b7f4ebc 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 @@ -27,7 +27,7 @@ import javax.inject.Inject */ class TestDeviceSettings @Inject constructor(private val vectorPreferences: VectorPreferences, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_device_settings_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_device_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { if (vectorPreferences.areNotificationEnabledForDevice()) { 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 412916c201..1efe76205a 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 @@ -30,7 +30,7 @@ import javax.inject.Inject class TestNotification @Inject constructor(private val context: Context, private val notificationUtils: NotificationUtils, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_notification_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_notification_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { // Display the notification right now 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 79e4377a5c..12b3316e05 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 @@ -27,7 +27,7 @@ import javax.inject.Inject class TestPushRulesSettings @Inject constructor(private val activeSessionHolder: ActiveSessionHolder, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_bing_settings_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_bing_settings_title) { private val testedRules = listOf(RuleIds.RULE_ID_CONTAIN_DISPLAY_NAME, 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 42f506d4a6..f3e64659cf 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 @@ -29,7 +29,7 @@ import javax.inject.Inject */ class TestSystemSettings @Inject constructor(private val context: FragmentActivity, private val stringProvider: StringProvider) : - TroubleshootTest(R.string.settings_troubleshoot_test_system_settings_title) { + TroubleshootTest(R.string.settings_troubleshoot_test_system_settings_title) { override fun perform(activityResultLauncher: ActivityResultLauncher) { if (NotificationManagerCompat.from(context).areNotificationsEnabled()) { 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 ca4148ebb7..1d72f224c4 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,7 @@ class IncomingShareViewModel @AssistedInject constructor( @Assisted initialState: IncomingShareViewState, private val session: Session, private val breadcrumbsRoomComparator: BreadcrumbsRoomComparator) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { @AssistedFactory interface Factory : MavericksAssistedViewModelFactory { diff --git a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutFragment.kt b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutFragment.kt index f40f35a6e2..8a682b4b5e 100644 --- a/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutFragment.kt +++ b/vector/src/main/java/im/vector/app/features/signout/soft/SoftLogoutFragment.kt @@ -65,14 +65,14 @@ class SoftLogoutFragment @Inject constructor( mode.ssoIdentityProviders )) } - is LoginMode.Sso -> { + is LoginMode.Sso -> { loginViewModel.handle(LoginAction.SetupSsoForSessionRecovery( softLogoutViewState.homeServerUrl, softLogoutViewState.deviceId, mode.ssoIdentityProviders )) } - LoginMode.Unsupported -> { + LoginMode.Unsupported -> { // Prepare the loginViewModel for a SSO/login fallback recovery loginViewModel.handle(LoginAction.SetupSsoForSessionRecovery( softLogoutViewState.homeServerUrl, @@ -80,7 +80,7 @@ class SoftLogoutFragment @Inject constructor( null )) } - else -> Unit + else -> Unit } } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceState.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceState.kt index 57782d9182..2f55270a69 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceState.kt @@ -33,9 +33,15 @@ data class CreateSpaceState( val aliasManuallyModified: Boolean = false, val aliasVerificationTask: Async = Uninitialized, val nameInlineError: String? = null, - val defaultRooms: Map? = null, - val default3pidInvite: Map? = null, - val emailValidationResult: Map? = null, + val defaultRooms: Map? = null, + val default3pidInvite: Map? = null, + val emailValidationResult: Map? = null, val creationResult: Async = Uninitialized, val canInviteByMail: Boolean = false ) : MavericksState { diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt index 2b8276a4d7..330467d161 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/CreateSpaceViewModel.kt @@ -373,7 +373,7 @@ class CreateSpaceViewModel @AssistedInject constructor( ) ) when (result) { - is CreateSpaceTaskResult.Success -> { + is CreateSpaceTaskResult.Success -> { setState { copy(creationResult = Success(result.spaceId)) } diff --git a/vector/src/main/java/im/vector/app/features/spaces/create/WizardButtonView.kt b/vector/src/main/java/im/vector/app/features/spaces/create/WizardButtonView.kt index 971d61dd9c..c1bfba7205 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/create/WizardButtonView.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/create/WizardButtonView.kt @@ -30,7 +30,7 @@ import im.vector.app.core.extensions.setTextOrHide import im.vector.app.databinding.ViewSpaceTypeButtonBinding class WizardButtonView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - ConstraintLayout(context, attrs, defStyle) { + ConstraintLayout(context, attrs, defStyle) { private val views: ViewSpaceTypeButtonBinding diff --git a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryFragment.kt index 7e7b1d8996..e59087778f 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryFragment.kt @@ -169,7 +169,7 @@ class SpaceDirectoryFragment @Inject constructor( } else { toolbar?.title = state.currentRootSummary?.name ?: state.currentRootSummary?.canonicalAlias - ?: getString(R.string.space_explore_activity_title) + ?: getString(R.string.space_explore_activity_title) } spaceCardRenderer.render(state.currentRootSummary, emptyList(), this, views.spaceCard, showDescription = false) diff --git a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryViewModel.kt index abc70ccbc1..b980b7a457 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryViewModel.kt @@ -275,9 +275,9 @@ class SpaceDirectoryViewModel @AssistedInject constructor( knownSummaries = ( knownSummaries + (paginate.children.mapNotNull { - session.getRoomSummary(it.childRoomId) - ?.takeIf { it.membership == Membership.JOIN } // only take if joined because it will be up to date (synced) - }) + session.getRoomSummary(it.childRoomId) + ?.takeIf { it.membership == Membership.JOIN } // only take if joined because it will be up to date (synced) + }) ).distinctBy { it.roomId } query = query.copy( diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewEvents.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewEvents.kt index 8ba7398a2f..043c71f549 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewEvents.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewEvents.kt @@ -19,6 +19,6 @@ package im.vector.app.features.spaces.manage import im.vector.app.core.platform.VectorViewEvents sealed class SpaceManageRoomViewEvents : VectorViewEvents { -// object BulkActionSuccess: SpaceManageRoomViewEvents() + // object BulkActionSuccess: SpaceManageRoomViewEvents() data class BulkActionFailure(val errorList: List) : SpaceManageRoomViewEvents() } diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageViewState.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageViewState.kt index 82abc823c3..0baa4d309f 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageViewState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageViewState.kt @@ -24,6 +24,7 @@ enum class ManageType { Settings, ManageRooms } + data class SpaceManageViewState( val spaceId: String = "", val manageType: ManageType diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsController.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsController.kt index 7cd5a70279..afe5200fbb 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsController.kt @@ -65,13 +65,13 @@ class SpaceSettingsController @Inject constructor( id("avatar") enabled(data.actionPermissions.canChangeAvatar) when (val avatarAction = data.avatarAction) { - RoomSettingsViewState.AvatarAction.None -> { + RoomSettingsViewState.AvatarAction.None -> { // Use the current value avatarRenderer(host.avatarRenderer) // We do not want to use the fallback avatar url, which can be the other user avatar, or the current user avatar. matrixItem(roomSummary.toMatrixItem().updateAvatar(data.currentRoomAvatarUrl)) } - RoomSettingsViewState.AvatarAction.DeleteAvatar -> + RoomSettingsViewState.AvatarAction.DeleteAvatar -> imageUri(null) is RoomSettingsViewState.AvatarAction.UpdateAvatar -> imageUri(avatarAction.newAvatarUri) diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt index db9420abc2..57b1c97efb 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt @@ -96,8 +96,8 @@ class SpaceSettingsFragment @Inject constructor( viewModel.observeViewEvents { when (it) { is RoomSettingsViewEvents.Failure -> showFailure(it.throwable) - RoomSettingsViewEvents.Success -> showSuccess() - RoomSettingsViewEvents.GoBack -> { + RoomSettingsViewEvents.Success -> showSuccess() + RoomSettingsViewEvents.GoBack -> { ignoreChanges = true vectorBaseActivity.onBackPressed() } @@ -244,10 +244,10 @@ class SpaceSettingsFragment @Inject constructor( override fun onAvatarDelete() { withState(viewModel) { when (it.avatarAction) { - RoomSettingsViewState.AvatarAction.None -> { + RoomSettingsViewState.AvatarAction.None -> { viewModel.handle(RoomSettingsAction.SetAvatarAction(RoomSettingsViewState.AvatarAction.DeleteAvatar)) } - RoomSettingsViewState.AvatarAction.DeleteAvatar -> { + RoomSettingsViewState.AvatarAction.DeleteAvatar -> { /* Should not happen */ } is RoomSettingsViewState.AvatarAction.UpdateAvatar -> { diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewFragment.kt index e97dab1d86..271b00c707 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewFragment.kt @@ -105,7 +105,7 @@ class SpacePreviewFragment @Inject constructor( views.spacePreviewAcceptInviteButton.isEnabled = false views.spacePreviewDeclineInviteButton.isEnabled = false } - is Fail -> { + is Fail -> { views.spacePreviewPeekingProgress.isVisible = false views.spacePreviewButtonBar.isVisible = false } @@ -127,10 +127,10 @@ class SpacePreviewFragment @Inject constructor( private fun handleViewEvents(viewEvents: SpacePreviewViewEvents) { when (viewEvents) { - SpacePreviewViewEvents.Dismiss -> { + SpacePreviewViewEvents.Dismiss -> { sharedActionViewModel.post(SpacePreviewSharedAction.DismissAction) } - SpacePreviewViewEvents.JoinSuccess -> { + SpacePreviewViewEvents.JoinSuccess -> { sharedActionViewModel.post(SpacePreviewSharedAction.HideModalLoading) sharedActionViewModel.post(SpacePreviewSharedAction.DismissAction) } diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewState.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewState.kt index 14f9a45d68..ca6a472985 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewState.kt @@ -22,8 +22,8 @@ import com.airbnb.mvrx.Uninitialized data class SpacePreviewState( val idOrAlias: String, - val name: String? = null, - val topic: String? = null, + val name: String? = null, + val topic: String? = null, val avatarUrl: String? = null, val spaceInfo: Async = Uninitialized, val childInfoList: Async> = Uninitialized, diff --git a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewViewModel.kt index 149f582c5c..f7471bc7aa 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/preview/SpacePreviewViewModel.kt @@ -64,8 +64,8 @@ class SpacePreviewViewModel @AssistedInject constructor( override fun handle(action: SpacePreviewViewAction) { when (action) { - SpacePreviewViewAction.ViewReady -> handleReady() - SpacePreviewViewAction.AcceptInvite -> handleAcceptInvite() + SpacePreviewViewAction.ViewReady -> handleReady() + SpacePreviewViewAction.AcceptInvite -> handleAcceptInvite() SpacePreviewViewAction.DismissInvite -> handleDismissInvite() } } @@ -103,7 +103,7 @@ class SpacePreviewViewModel @AssistedInject constructor( // For now we don't handle partial success, it's just success _viewEvents.post(SpacePreviewViewEvents.JoinSuccess) } - is JoinSpaceResult.Fail -> { + is JoinSpaceResult.Fail -> { _viewEvents.post(SpacePreviewViewEvents.JoinFailure(errorFormatter.toHumanReadable(joinResult.error))) } } 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 41fc8bf6b9..ea28129262 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 @@ -24,7 +24,7 @@ import im.vector.app.R class SpaceTabView constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : - LinearLayout(context, attrs, defStyleAttr) { + LinearLayout(context, attrs, defStyleAttr) { constructor(context: Context, attrs: AttributeSet) : this(context, attrs, 0) {} constructor(context: Context) : this(context, null, 0) {} 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 ce6df67d53..01e933e446 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 @@ -28,7 +28,7 @@ import org.matrix.android.sdk.api.session.initsync.SyncStatusService import org.matrix.android.sdk.api.session.sync.SyncState class SyncStateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : - LinearLayout(context, attrs, defStyle) { + LinearLayout(context, attrs, defStyle) { private val views: ViewSyncStateBinding 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 a3d4902b41..91253383ea 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 @@ -32,7 +32,7 @@ private const val RIOT_BOT_ID = "@riot-bot:matrix.org" class ConsentWebViewEventListener(activity: VectorBaseActivity<*>, private val session: Session, private val delegate: WebViewEventListener) : - WebViewEventListener by delegate { + WebViewEventListener by delegate { private val safeActivity: VectorBaseActivity<*>? by weak(activity) 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 20fae6e31a..2ba35573f0 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 @@ -51,7 +51,7 @@ class WidgetViewModel @AssistedInject constructor(@Assisted val initialState: Wi widgetPostAPIHandlerFactory: WidgetPostAPIHandler.Factory, private val stringProvider: StringProvider, private val session: Session) : - VectorViewModel(initialState), + 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 78871da324..7ab2cf174d 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 @@ -37,7 +37,7 @@ import java.net.URL class RoomWidgetPermissionViewModel @AssistedInject constructor(@Assisted val initialState: RoomWidgetPermissionViewState, private val session: Session) : - VectorViewModel(initialState) { + VectorViewModel(initialState) { private val widgetService = session.widgetService() private val integrationManagerService = session.integrationManagerService()