From 9093631f8b3ecb89b330350fc92383e37836e820 Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:16:11 +0200 Subject: [PATCH] Periphery cleanup (#5893) --- .agents/skills/periphery-cleanup/SKILL.md | 99 +++ .periphery.yml | 32 +- .../Sources/AccessibilityTests.swift | 1 - .../Sources/GeneratedAccessibilityTests.swift | 4 - .../UserPreferenceMacro.swift | 14 +- ElementX.xcodeproj/project.pbxproj | 28 +- ElementX/Sources/AppHooks/AppHooks.swift | 3 + .../AppHooks/Hooks/RemoteSettingsHook.swift | 2 - .../Sources/Application/AppCoordinator.swift | 2 +- .../Application/AppMediatorProtocol.swift | 4 - .../Application/FlowCoordinatorProtocol.swift | 1 - .../Navigation/NavigationCoordinators.swift | 2 - .../Application/Settings/AppSettings.swift | 1 - .../Settings/UserDefaultsProtocol.swift | 2 +- .../Settings/VolatileUserDefaults.swift | 16 +- .../Application/Windowing/WindowManager.swift | 4 - .../AuthenticationFlowCoordinator.swift | 6 +- .../ChatsTabFlowCoordinator.swift | 8 +- .../OnboardingFlowCoordinator.swift | 2 +- .../RoomFlowCoordinator.swift | 16 +- .../RoomFlowCoordinatorStateMachine.swift | 12 - .../RoomMembersFlowCoordinator.swift | 11 +- .../SettingsFlowCoordinator.swift | 10 +- .../SpaceFlowCoordinator.swift | 1 + .../SpaceSettingsFlowCoordinator.swift | 11 +- .../SpacesTabFlowCoordinator.swift | 3 +- .../StartChatFlowCoordinator.swift | 4 +- .../UserSessionFlowCoordinator.swift | 4 +- .../Sources/Mocks/BannedRoomProxyMock.swift | 11 - .../Mocks/Generated/GeneratedMocks.swift | 797 ------------------ .../Sources/Mocks/InvitedRoomProxyMock.swift | 13 +- .../Sources/Mocks/JoinedRoomProxyMock.swift | 28 - .../Sources/Mocks/KnockedRoomProxyMock.swift | 11 - .../Sources/Mocks/MediaProviderMock.swift | 8 - .../Mocks/NotificationItemProxyMock.swift | 2 - .../Mocks/RoomPowerLevelsProxyMock.swift | 11 - .../SignallingTimelineItemProviderMock.swift | 2 - .../Mocks/TimelineControllerMock.swift | 3 - .../Other/AccessibilityIdentifiers.swift | 3 - ElementX/Sources/Other/CallIntent.swift | 2 +- ElementX/Sources/Other/CancellableTask.swift | 1 - .../AVMetadataMachineReadableCodeObject.swift | 4 - .../Other/Extensions/AttributedString.swift | 12 - .../Other/Extensions/CompoundIcon.swift | 4 - .../Other/Extensions/ConfirmationDialog.swift | 13 - ElementX/Sources/Other/Extensions/Label.swift | 46 - .../Sources/Other/Extensions/String.swift | 1 + ElementX/Sources/Other/Extensions/Task.swift | 1 + .../Sources/Other/Extensions/XCTestCase.swift | 194 ----- .../HTMLParsing/ElementXAttributeScope.swift | 11 +- ElementX/Sources/Other/InfoPlistReader.swift | 5 +- ElementX/Sources/Other/Logging/MXLog.swift | 1 + .../Sources/Other/Pills/MessageText.swift | 2 + ElementX/Sources/Other/Pills/PillView.swift | 2 - .../Sources/Other/ScrollViewAdapter.swift | 8 - .../ViewModel/StateStoreViewModelV2.swift | 1 + .../Other/SwiftUI/Views/LoadableImage.swift | 1 - .../SwiftUI/Views/TopBannerModifier.swift | 6 - .../TestablePreviewsDictionary.swift | 1 - .../View/PINTextField.swift | 1 + .../LoginScreen/LoginScreenCoordinator.swift | 11 +- .../LoginScreen/LoginScreenModels.swift | 4 - .../LoginScreen/LoginScreenViewModel.swift | 5 +- .../LoginScreen/View/LoginScreen.swift | 3 +- .../ServerSelectionScreenCoordinator.swift | 5 - .../ServerSelectionScreenModels.swift | 2 - .../AuthenticationStartScreenViewModel.swift | 2 - .../BugReportScreenViewModel.swift | 1 - .../Screens/CallScreen/View/CallScreen.swift | 5 +- .../ChatsSpaceFiltersScreenViewModel.swift | 4 - ...sSpaceFiltersScreenViewModelProtocol.swift | 1 + .../CreateRoomScreenModels.swift | 10 - .../DeclineAndBlockScreenCoordinator.swift | 5 - .../EditRoomAddressScreenCoordinator.swift | 2 - .../EmojiPickerScreenCoordinator.swift | 3 - ...yptionResetPasswordScreenCoordinator.swift | 3 - .../EncryptionResetPasswordScreenModels.swift | 1 - .../EncryptionResetScreenCoordinator.swift | 2 - .../EncryptionResetScreenModels.swift | 19 - .../TimelineMediaPreviewDataSource.swift | 2 - .../TimelineMediaPreviewModels.swift | 4 - .../TimelineMediaPreviewModifier.swift | 1 - .../TimelineMediaPreviewViewModel.swift | 1 - .../View/TimelineMediaPreviewController.swift | 4 - .../HomeScreen/View/HomeScreenContent.swift | 2 - .../HomeScreen/View/HomeScreenRoomCell.swift | 11 - .../InviteUsersScreenCoordinator.swift | 4 +- .../InviteUsersScreenModels.swift | 1 - .../InviteUsersScreenViewModel.swift | 6 +- .../InviteUsersConfirmationSheetView.swift | 3 +- .../View/InviteUsersScreen.swift | 3 +- .../View/InviteUsersScreenSelectedItem.swift | 7 - .../JoinRoomScreen/JoinRoomScreenModels.swift | 1 + .../KnockRequestsListScreenCoordinator.swift | 11 +- .../LabsScreen/LabsScreenCoordinator.swift | 2 - .../Screens/LabsScreen/LabsScreenModels.swift | 1 - ...ageAuthorizedSpacesScreenCoordinator.swift | 2 - ...nageRoomMemberSheetViewModelProtocol.swift | 1 + ...MediaEventsTimelineScreenCoordinator.swift | 3 - .../MediaEventsTimelineScreenViewModel.swift | 2 - .../VideoMediaEventsTimelineView.swift | 2 +- .../MediaUploadPreviewScreenCoordinator.swift | 2 - .../MediaUploadPreviewScreenModels.swift | 1 - .../MediaUploadPreviewScreenViewModel.swift | 2 - .../View/MediaUploadPreviewScreen.swift | 2 - ...dentityConfirmationScreenCoordinator.swift | 3 - .../IdentityConfirmedScreenCoordinator.swift | 7 +- .../ReportRoomScreenCoordinator.swift | 5 - ...fiedUserSendFailureScreenCoordinator.swift | 3 - .../RoomChangeRolesScreenCoordinator.swift | 3 - .../RoomDetailsEditScreenCoordinator.swift | 1 - .../RoomDetailsScreenCoordinator.swift | 4 +- .../RoomDetailsScreenViewModel.swift | 5 +- .../View/RoomDetailsScreen.swift | 9 +- .../RoomMemberDetailsScreenCoordinator.swift | 4 +- .../RoomMemberDetailsScreenViewModel.swift | 5 +- .../View/RoomMemberDetailsScreen.swift | 3 +- .../RoomMembersListScreenModels.swift | 6 +- .../RoomMembersListScreenViewModel.swift | 16 - .../View/RoomMembersListScreen.swift | 3 +- ...mNotificationSettingsScreenViewModel.swift | 1 - ...omRolesAndPermissionsScreenViewModel.swift | 1 - .../CompletionSuggestionService.swift | 2 +- .../ComposerToolbarModels.swift | 2 - .../ComposerToolbarViewModel.swift | 12 +- .../ComposerToolbarViewModelProtocol.swift | 1 - .../View/MessageComposer.swift | 1 - .../View/MessageComposerTextField.swift | 17 +- .../RoomScreen/View/SwipeRightAction.swift | 49 -- .../RoomSelectionScreenViewModel.swift | 2 - .../RoomThreadListScreenCoordinator.swift | 3 - .../SearchScreen/SearchScreenViewModel.swift | 2 - .../SearchScreen/View/SearchScreen.swift | 2 - ...kupLogoutConfirmationScreenViewModel.swift | 1 - .../SecureBackupScreenCoordinator.swift | 3 - .../SecurityAndPrivacyScreenModels.swift | 6 +- .../SecurityAndPrivacyScreenViewModel.swift | 3 +- .../AdvancedSettingsScreenModels.swift | 1 - .../DeactivateAccountScreenCoordinator.swift | 3 - .../DeveloperOptionsScreenCoordinator.swift | 1 - .../DeveloperOptionsScreenModels.swift | 2 - .../DeveloperOptionsScreenViewModel.swift | 5 +- .../View/DeveloperOptionsScreen.swift | 1 - .../LegalInformationScreenCoordinator.swift | 2 +- ...alInformationScreenViewModelProtocol.swift | 1 - ...ificationSettingsEditScreenViewModel.swift | 2 - .../NotificationSettingsScreenViewModel.swift | 1 - .../UserDetailsEditScreenCoordinator.swift | 5 +- .../LeaveSpace/LeaveSpaceViewModel.swift | 2 - .../SpaceScreen/SpaceScreenCoordinator.swift | 5 - .../View/SpaceSettingsScreen.swift | 3 +- .../SpacesScreenCoordinator.swift | 5 - .../SpacesScreen/SpacesScreenViewModel.swift | 3 - .../SpacesScreen/View/SpacesScreen.swift | 1 - .../StartChatScreenCoordinator.swift | 7 +- .../StartChatScreenModels.swift | 1 - .../StartChatScreenViewModel.swift | 7 +- .../View/JoinRoomByAddressView.swift | 5 +- .../View/StartChatScreen.swift | 3 +- .../ThreadTimelineScreenCoordinator.swift | 3 - .../TimelineTableViewController.swift | 1 - .../Screens/Timeline/TimelineViewModel.swift | 2 - .../View/ItemMenu/TimelineItemMenu.swift | 1 - .../TimelineItemMenuActionProvider.swift | 7 +- .../View/Replies/TimelineReplyView.swift | 1 + .../View/Style/SwipeToReplyView.swift | 34 - .../Style/TimelineItemBubbledStylerView.swift | 5 +- .../Supplementary/TimelineReactionsView.swift | 2 - .../CallInviteRoomTimelineView.swift | 8 +- .../CallNotificationRoomTimelineView.swift | 16 - .../LiveLocationRoomTimelineView.swift | 2 - .../PaginationIndicatorRoomTimelineView.swift | 5 +- .../ReadMarkerRoomTimelineView.swift | 6 +- .../TextBasedRoomTimelineViewProtocol.swift | 1 - .../Screens/Timeline/View/TimelineView.swift | 1 - .../UserProfileScreenCoordinator.swift | 4 +- .../UserProfileScreenViewModel.swift | 5 +- .../View/UserProfileScreen.swift | 3 +- .../AlertTones/NotificationToneManager.swift | 2 - .../Services/Analytics/AnalyticsService.swift | 6 +- .../Analytics/AnalyticsServiceProtocol.swift | 6 - .../Services/Analytics/Signposter.swift | 4 - .../Services/Audio/Player/AudioPlayer.swift | 1 - .../Audio/Player/AudioPlayerProtocol.swift | 1 - .../Audio/Recorder/AudioRecorder.swift | 5 - .../AuthenticationServiceProtocol.swift | 1 - .../ClassicApp/ClassicAppMXAccount.swift | 20 +- .../Sources/Services/Client/ClientProxy.swift | 8 +- .../Services/Client/ClientProxyProtocol.swift | 2 - .../ElementCall/ElementCallWidgetDriver.swift | 1 + .../Emojis/EmojiProviderProtocol.swift | 2 - .../LinkMetadata/LinkMetadataProvider.swift | 2 +- .../LinkMetadataProviderProtocol.swift | 1 - .../Location/LiveLocationShareProxy.swift | 1 + .../Provider/MediaProviderProtocol.swift | 1 - .../MediaPlayerProviderProtocol.swift | 4 - ElementX/Sources/Services/Room/JoinRule.swift | 4 +- .../Services/Room/JoinedRoomProxy.swift | 45 - .../Sources/Services/Room/RoomInfoProxy.swift | 22 + .../Services/Room/RoomInfoProxyProtocol.swift | 11 + .../Room/RoomMember/RoomMemberProxy.swift | 1 + .../RoomMember/RoomMemberProxyProtocol.swift | 1 + .../Services/Room/RoomPowerLevel.swift | 4 - .../Room/RoomPowerLevelProxyProtocol.swift | 11 - .../Services/Room/RoomPowerLevelsProxy.swift | 90 -- .../Services/Room/RoomProxyProtocol.swift | 20 - .../RoomSummary/RoomEventStringBuilder.swift | 1 + .../Room/RoomSummary/RoomSummary.swift | 7 - .../RoomSummary/RoomSummaryProvider.swift | 1 - .../Room/RoomThreadListServiceProxy.swift | 4 +- .../RoomDirectorySearchProxy.swift | 1 + .../Services/Search/SearchServiceProxy.swift | 1 - .../SecureBackup/SecureBackupController.swift | 3 +- .../Spaces/LeaveSpaceHandleProxy.swift | 1 + .../Services/Spaces/SpaceRoomListProxy.swift | 3 + .../Services/Spaces/SpaceServiceProxy.swift | 2 + .../Services/Spaces/SpaceServiceRoom.swift | 3 + .../Timeline/Fixtures/TimelineFixtures.swift | 5 - .../TimelineControllerProtocol.swift | 1 - .../Timeline/TimelineItemIdentifier.swift | 2 + .../Timeline/TimelineItemProvider.swift | 19 - .../Services/Timeline/TimelineItemProxy.swift | 4 + .../DecorationTimelineItemProtocol.swift | 1 - .../EmoteRoomTimelineItemContent.swift | 1 + .../CallNotificationRoomTimelineItem.swift | 3 - .../Items/Other/PollRoomTimelineItem.swift | 1 + .../RoomTimelineItemFactory.swift | 2 - .../TimelineItems/RoomTimelineItemView.swift | 14 +- .../Services/Timeline/TimelineProxy.swift | 12 - .../Timeline/TimelineProxyProtocol.swift | 2 - .../Sources/Services/Users/UserProfile.swift | 3 + .../VoiceMessage/VoiceMessageRecorder.swift | 2 - .../UITests/UITestsAppCoordinator.swift | 4 +- .../UnitTests/UnitTestsAppCoordinator.swift | 1 + Enterprise | 2 +- IntegrationTests/Sources/Common.swift | 2 +- NSE/Sources/NSEUserSession.swift | 9 +- .../NotificationItemProxy.swift | 19 - .../NotificationItemProxyProtocol.swift | 4 - .../Sources/GeneratedPreviewTests.swift | 7 - PreviewTests/Sources/PreviewTests.swift | 1 - .../swipeToReplyView.iPad-en-GB-0.png | 3 - .../swipeToReplyView.iPad-pseudo-0.png | 3 - .../swipeToReplyView.iPhone-en-GB-0.png | 3 - .../swipeToReplyView.iPhone-pseudo-0.png | 3 - .../ShareExtensionViewController.swift | 2 - Tools/Sources/Commands/SetupProject.swift | 4 +- UITests/Sources/Application.swift | 12 - .../AuthenticationFlowCoordinatorTests.swift | 1 + UITests/Sources/StartChatTests.swift | 1 - UITests/Sources/UserSessionScreenTests.swift | 1 - .../AttributedStringBuilderTests.swift | 1 - UnitTests/Sources/AudioPlayerStateTests.swift | 1 - .../ChatsTabFlowCoordinatorTests.swift | 5 +- .../Sources/CreateRoomViewModelTests.swift | 2 - .../Sources/InviteUsersViewModelTests.swift | 6 +- UnitTests/Sources/LoggingTests.swift | 4 - .../Sources/LoginScreenViewModelTests.swift | 3 +- .../Sources/MediaPlayerProviderTests.swift | 6 - ...diaUploadPreviewScreenViewModelTests.swift | 1 - UnitTests/Sources/RestorationTokenTests.swift | 1 + .../RoomDetailsScreenViewModelTests.swift | 78 +- .../Sources/RoomFlowCoordinatorTests.swift | 4 - .../RoomMemberDetailsViewModelTests.swift | 4 +- .../Sources/RoomScreenViewModelTests.swift | 16 - ...curityAndPrivacyScreenViewModelTests.swift | 1 - .../SpaceListScreenViewModelTests.swift | 1 - .../Sources/StartChatViewModelTests.swift | 3 +- .../TestUtilities/WaitingConfirmation.swift | 1 + .../Sources/TimelineViewModelTests.swift | 2 - UnitTests/Sources/UserPreferenceTests.swift | 2 + .../UserProfileScreenViewModelTests.swift | 9 +- .../UserSessionFlowCoordinatorTests.swift | 2 - .../Sources/VoiceMessageRecorderTests.swift | 1 - UnitTests/SupportingFiles/target.yml | 1 - 275 files changed, 381 insertions(+), 2268 deletions(-) create mode 100644 .agents/skills/periphery-cleanup/SKILL.md delete mode 100644 ElementX/Sources/Other/Extensions/Label.swift delete mode 100644 ElementX/Sources/Other/Extensions/XCTestCase.swift delete mode 100644 ElementX/Sources/Screens/Timeline/View/Style/SwipeToReplyView.swift delete mode 100644 PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-en-GB-0.png delete mode 100644 PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-pseudo-0.png delete mode 100644 PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-en-GB-0.png delete mode 100644 PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-pseudo-0.png diff --git a/.agents/skills/periphery-cleanup/SKILL.md b/.agents/skills/periphery-cleanup/SKILL.md new file mode 100644 index 000000000..9bc035988 --- /dev/null +++ b/.agents/skills/periphery-cleanup/SKILL.md @@ -0,0 +1,99 @@ +--- +name: periphery-cleanup +description: Dead-code sweep with Periphery — scan the Pro-configured project, delete unused code, guard false positives (keep-alive handles, future-use code), run unit tests, purge scan cache. Use when user want "clean up dead code", "run periphery", "remove unused code". +--- + +# Periphery cleanup + +Periphery = static analysis, find unused code. Scan build ALL schemes — slow (cold ~30-60 min). Maintenance thing, run rare. + +## Scan — always on the Pro variant + +Scan run on the Pro-configured project so every source get analysed (plain config leave hook implementations + their call sites out, flood report with false "unused"): + +```bash +git submodule update --init --recursive # once, if submodules missing +swift run pipeline configure-element-pro +periphery scan --relative-results --quiet > periphery-report.txt +``` + +Config live in `.periphery.yml` — schemes already cover every target, don't narrow. Two deliberate settings there: +- `retain_unused_protocol_func_params: true` — protocol signatures are contracts (hooks, delegates); params unused in every conformance stay. NEVER annotate protocol function parameters, config already handle them. +- `index_exclude: compound-ios/**` — Compound excluded: its Inspector app + package tests live outside this project's schemes, so their usage invisible → findings there unreliable (e.g. making things internal break the Inspector). Never act on Compound code from this scan. + +Report line format: `path:line:col: warning: ''`. Build fail → fix build first, scan need compiling project. + +## Comment hygiene — strip, scan, restore + +Every run: existing `periphery:ignore` comments hide drift — code change, comment stay, nobody notice it useless. So: + +1. **Strip + remember.** Before the scan, remove every `periphery:ignore` comment (both spellings: `periphery:ignore` and `periphery: ignore`) and stash them: `git diff > /tmp/periphery-comments.patch` right after stripping, or just rely on `git diff` against HEAD to recall what was where. +2. **Scan.** The report now show ground truth: every declaration that genuinely need protection re-flag. +3. **Restore only what re-flag.** For each finding that match the false-positive table, put the comment back (same reason strings). Findings that DON'T re-flag = comments that were stale → stay deleted. Anything newly flagged that isn't a false positive = real dead code → delete it. + +Result: comment set always minimal, always true. The clutter never accumulate. + +## Triage — kind → action + +| Warning | Action | +|---|---| +| Unused function / property / enum / struct / init | Check false-positive table FIRST. True dead → delete whole declaration + helpers/extensions only it used | +| Assign-only property | DANGER ZONE. Prime keep-alive suspect — read table below before touch | +| Unused parameter | Protocol params never appear (config retain them). ObjC selector / system callback → `ignore:parameters - `. Free signature → remove param + fix call sites | +| Redundant protocol conformance | `TestablePreview` → SKIP, always (see below). Others: verify nothing need conformance (generics, tests, mocks), then remove conformance only, keep type | +| Redundant public accessibility | Drop `public`, make internal — EXCEPT member that satisfy a public protocol in a public type (e.g. `previews`), Swift refuse internal there; skip or internalise whole type | +| Superfluous ignore comment | Declaration referenced now — comment dead, code alive. Remove comment ONLY, never declaration | + +Never touch `Generated/` directories, never edit `Localizable.strings`. Delete bottom-up per file — line numbers stay valid. + +## False positives — mark, no delete + +Stored-never-read variable often alive ON PURPOSE: keep task / SDK object / coordinator alive past declaration scope. Delete = app break silent (observation stop, flow deallocate, rust handle drop). Mark instead: `// periphery:ignore - ` line above declaration (NEVER `periphery:ignore:all` — whole files that shouldn't be reported, like hand-written mocks, belong in `report_exclude` in `.periphery.yml` instead). Comment go ABOVE any doc comment, never between doc and declaration. Reuse existing reasons from codebase: + +| Pattern | How recognise | Reason string | +|---|---|---| +| Rust SDK handle | `TaskHandle`, observation token from SDK, stored after `observe`/`subscribe` call | `required for instance retention in the rust codebase` | +| Keep-alive reference | child flow coordinator, service stored so updates keep flowing | `retaining purpose` or `used to avoid deallocation` or `keep alive to keep receiving updates.` | +| Cancellable task handle | `@CancellableTask` property, `Task` stored so reassign/nil cancel previous | `auto cancels when reassigned` | +| SDK enum exhaustiveness | unused `init` switching over SDK enum | `Unused, but added to detect new cases when updating the SDK.` | +| MVVM-C architecture | empty `ViewModelAction` enum from screen template, unused VM protocol — NEVER delete VM protocols, convention keep them | `required for the architecture` (keep the mark even if a superfluous-comment warning appear — it document intent) | +| Property wrapper internals | `@propertyWrapper`, `@dynamicMemberLookup` subscript | `property wrappers generate false positives` / `subscript are seen as false positives` | +| ObjC selector parameter | parameter only touched by runtime (`displayLink`, `sender` etc.) | `ignore:parameters - required for objc selector` | +| Underscored SwiftUI protocol | `_body` from `TextFieldStyle` etc. — called by SwiftUI, members inside resolve transitively | `called by SwiftUI via the TextFieldStyle protocol` | +| SDK delegate requirement | method required by rust SDK delegate protocol (e.g. `didRefreshTokens`) | `required by the SDK's delegate protocol` | +| Synthesized conformance | field only read via synthesized Hashable/Equatable/Codable (cache keys, diffing models) | `used via the synthesized Hashable conformance` | +| Encoded/decoded schema field | Codable field parsed or serialized but not consumed yet | `documents the schema, parsed but not consumed yet` / `part of the encoded payload` | +| Release-only code | compiled out in Debug scan (`#if !DEBUG` paths, nightly checks) | `only used in release builds` | +| `TestablePreview` conformance | flagged "Redundant protocol conformance" on every preview | NO marker, NO removal — Sourcery read conformance, generate snapshot + a11y tests from it. Remove = tests silently vanish. Skip finding, bulk noise | + +**Unsure if keep-alive?** Property type Task / AnyCancellable / TaskHandle / coordinator / SDK proxy, assigned inside async or stream setup → smell like keep-alive. ASK USER before delete. Show declaration, where assigned, your read on it. + +## Future-use code + +Unused but look intentional — API pair completeness, feature half-landed, "team will need soon". No silent delete, no silent keep. Present to user: what, where, opinion keep-or-delete. User say keep → mark `// periphery:ignore - might be useful to have`. + +## Mock cascade after protocol deletions + +Delete protocol member → Sourcery regenerate mock WITHOUT its `fooReturnValue` / `fooClosure` helpers → hand-written mock `Configuration` inits and test set-up lines still assigning those helpers break the build. Those lines are inert setup for API nothing call — more dead code, not evidence of use. After protocol deletions: grep non-Generated `Mocks/` + `UnitTests/` for `ReturnValue`, `Closure`, direct assignments to deleted members — delete them too. Compiler walk you to the stragglers; that expected, not a false positive. + +Careful with same-name members: one mock file often configure SEVERAL protocols (proxy-level `inviter` vs info-level `inviter`). Strip only lines whose target member actually deleted — the wrong one compile fine (member still exist) but silently un-configure previews; snapshot tests catch it, so run them before calling done. + +## Verify — on the PLAIN project + +Restore the plain configuration BEFORE running tests — snapshots are recorded against plain Element X; Pro branding fail ~8 preview tests falsely: + +```bash +git restore project.yml ElementX.xcodeproj/project.pbxproj "ElementX/Resources/AppIcon.icon/Assets/AppIcon.png" +xcodegen +swift run tools ci unit-tests +``` + +Sourcery regenerate mocks on build — deleted protocol members clean themselves. All tests pass before call done. Note: the CI helper pipe through `xcbeautify` — if not installed the exit code lie even when tests pass; check the `.xcresult` summary. + +## Purge cache — always + +Periphery DerivedData cache eat tens of GBs. Scan run rare → cache worthless between runs. Last step, no skip: + +```bash +rm -rf ~/Library/Caches/com.github.peripheryapp +``` diff --git a/.periphery.yml b/.periphery.yml index 2e46fd265..c023e7f4f 100644 --- a/.periphery.yml +++ b/.periphery.yml @@ -1,19 +1,31 @@ project: ElementX.xcodeproj +# Periphery scans all targets built by these schemes. The ElementX scheme also +# builds NSE, ShareExtension and MatrixRustSDKMocks as dependencies. Always run +# the scan with the project configured for the Pro variant so that all of the +# sources are analysed (see the periphery-cleanup skill). schemes: - ElementX - UnitTests - PreviewTests - UITests - IntegrationTests -targets: -- ElementX -- NSE -- ShareExtension -- UnitTests -- PreviewTests -- UITests -- IntegrationTests +- AccessibilityTests +# Compound is excluded: its Inspector app and package tests aren't part of any +# scheme in this project, so usage from them is invisible to the analysis. +index_exclude: +- "**/*?.build/**/*" +- "**/SourcePackages/checkouts/**" +- "compound-ios/**" report_exclude: - - ElementX/Sources/Mocks/Generated/GeneratedMocks.swift - - ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +- "**/Generated/**" +# Hand-written mocks: configuration surface is deliberately broader than any test uses. +- "**/Mocks/**" +- "ElementX/Sources/Services/AppLock/LAContextMock.swift" +# Pure payload schema, fields exist to be encoded. +- "ElementX/Sources/Services/Notification/Manager/APNSPayload.swift" +# Backports: everything gated on #available, cleaned up with each OS drop. +- "ElementX/Sources/Other/SwiftUI/Backports.swift" retain_swift_ui_previews: true +# Protocol signatures are contracts (hooks, delegates) — parameters unused in +# every current conformance are still part of the interface's design. +retain_unused_protocol_func_params: true diff --git a/AccessibilityTests/Sources/AccessibilityTests.swift b/AccessibilityTests/Sources/AccessibilityTests.swift index b6debf956..199311cb9 100644 --- a/AccessibilityTests/Sources/AccessibilityTests.swift +++ b/AccessibilityTests/Sources/AccessibilityTests.swift @@ -98,7 +98,6 @@ final class AccessibilityTests: XCTestCase { private static let partiallyUnsupportedDynamicTypeMessage = "Dynamic Type font sizes are partially unsupported" private static let notHumanReadableMessage = "Label not human-readable" - private static let elementHasNoDescription = "Element has no description" /// Use this array to filter add specific filters to ignore specific issues for certain elements private static let ignoredA11yIdentifiers: [String: [FilterType]] = [ diff --git a/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift b/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift index 693140736..9dae9ee0d 100644 --- a/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift +++ b/AccessibilityTests/Sources/GeneratedAccessibilityTests.swift @@ -747,10 +747,6 @@ extension AccessibilityTests { try await performAccessibilityAudit(named: "SwipeRightAction_Previews") } - func testSwipeToReplyView() async throws { - try await performAccessibilityAudit(named: "SwipeToReplyView_Previews") - } - func testTextRoomTimelineView() async throws { try await performAccessibilityAudit(named: "TextRoomTimelineView_Previews") } diff --git a/BuildExtensions/Sources/MacrosImplementation/UserPreferenceMacro.swift b/BuildExtensions/Sources/MacrosImplementation/UserPreferenceMacro.swift index 14d7ce8ce..d97cb8e96 100644 --- a/BuildExtensions/Sources/MacrosImplementation/UserPreferenceMacro.swift +++ b/BuildExtensions/Sources/MacrosImplementation/UserPreferenceMacro.swift @@ -14,7 +14,7 @@ import SwiftSyntaxMacros /// /// A `volatile` preference instead reads and writes through a generated in-memory store, so its /// value is never persisted and resets on each launch. -public enum UserPreferenceMacro { +enum UserPreferenceMacro { enum DiagnosticError: Error, CustomStringConvertible { case notAStoredProperty case missingTypeAnnotation @@ -85,9 +85,9 @@ public enum UserPreferenceMacro { } extension UserPreferenceMacro: AccessorMacro { - public static func expansion(of node: AttributeSyntax, - providingAccessorsOf declaration: some DeclSyntaxProtocol, - in context: some MacroExpansionContext) throws -> [AccessorDeclSyntax] { + static func expansion(of node: AttributeSyntax, + providingAccessorsOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext) throws -> [AccessorDeclSyntax] { let preference = try preference(for: declaration, node: node) if preference.isVolatile { @@ -137,9 +137,9 @@ extension UserPreferenceMacro: AccessorMacro { } extension UserPreferenceMacro: PeerMacro { - public static func expansion(of node: AttributeSyntax, - providingPeersOf declaration: some DeclSyntaxProtocol, - in context: some MacroExpansionContext) throws -> [DeclSyntax] { + static func expansion(of node: AttributeSyntax, + providingPeersOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext) throws -> [DeclSyntax] { let preference = try preference(for: declaration, node: node) let type = preference.type let name = preference.name diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 39a8eae0f..e258f17e6 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -133,7 +133,6 @@ 1318721F4E5F307586D98112 /* VoiceMessageButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8516302ACCA94A0E680AB3B /* VoiceMessageButton.swift */; }; 13C77FDF17C4C6627CFFC205 /* RoomTimelineItemFactoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D25A35764C7B3DB78954AB5 /* RoomTimelineItemFactoryProtocol.swift */; }; 13CBC470FB619A6393A21908 /* RoomNotificationSettingsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8296D6FB451E25CEC0767BBA /* RoomNotificationSettingsScreenCoordinator.swift */; }; - 1443CEEE42491CF7CD8A146A /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */; }; 1471A080552631358D152C18 /* AudioPlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDB3E65A79779EDA5D33D8A /* AudioPlayerState.swift */; }; 147597951DB07123A87AA1D1 /* landscape_test_image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 96CE9D6642DD487D8CC90C9C /* landscape_test_image.jpg */; }; 149D1942DC005D0485FB8D93 /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC1943ADE6A62ED5129D7C8 /* LoggingTests.swift */; }; @@ -371,7 +370,6 @@ 3B0F9B57D25B07E66F15762A /* MediaUploadPreviewScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2E7C987AE5DC9087BB19F7D /* MediaUploadPreviewScreenModels.swift */; }; 3B277D9538090766DA6C4566 /* StateRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2AF1828A5B76B7C371240FE /* StateRoomTimelineView.swift */; }; 3B5AB5CF8D8163599C5BF19B /* PillViewOnBubblePreviews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2005B4AD70A792340E2694F1 /* PillViewOnBubblePreviews.swift */; }; - 3B98049F56025726FB646ABD /* SwipeToReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0E0B55E2EE75AF67029924 /* SwipeToReplyView.swift */; }; 3BEBDCB42BABFA3B456FECA7 /* MapTilerURLBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D262A26713C18BB70C82CA5 /* MapTilerURLBuilderTests.swift */; }; 3C312A3AEDE58BB1C9BBB07C /* preview_avatar_room.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 12FD5280AF55AB7F50F8E47D /* preview_avatar_room.jpg */; }; 3C31E1A65EEB61E72E1113B4 /* AudioRecorderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBEC57C204D77908E355EF42 /* AudioRecorderProtocol.swift */; }; @@ -1311,7 +1309,6 @@ D4D7CCECC6C0AAFC42E165BB /* NotificationPermissionsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE9BBB18FB27F09032AD8769 /* NotificationPermissionsScreenViewModel.swift */; }; D4F3C5656DF09037825E9965 /* ChatsSpaceFiltersScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEF2C15634499348A512A93A /* ChatsSpaceFiltersScreenModels.swift */; }; D55AF9B5B55FEED04771A461 /* RoomFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A008E57D52B07B78DFAD1BB /* RoomFlowCoordinator.swift */; }; - D5681C80D8281560AACE0035 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045253F9967A535EE5B16691 /* Label.swift */; }; D5B1531A72387D432939D4E0 /* RoomDirectorySearchProxyProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0516C69708D5CBDE1A8E77EC /* RoomDirectorySearchProxyProtocol.swift */; }; D5C2DA52162A978743A183F2 /* SessionVerificationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AA084E10B80D64449C02A9 /* SessionVerificationTests.swift */; }; D5E771132BB36240DE38102F /* RoomMessageEventStringBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80E815FF3CC5E5A355E3A25E /* RoomMessageEventStringBuilder.swift */; }; @@ -1677,7 +1674,6 @@ 03DD998E523D4EC93C7ED703 /* RoomNotificationSettingsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsScreenViewModelProtocol.swift; sourceTree = ""; }; 03FABD73FD8086EFAB699F42 /* MediaUploadPreviewScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModelTests.swift; sourceTree = ""; }; 044E501B8331B339874D1B96 /* CompoundIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompoundIcon.swift; sourceTree = ""; }; - 045253F9967A535EE5B16691 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = ""; }; 046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryTests.swift; sourceTree = ""; }; 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04BB8DDE245ED86C489BA983 /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = ""; }; @@ -1719,7 +1715,6 @@ 0AB7A0C06CB527A1095DEB33 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = da; path = da.lproj/Localizable.stringsdict; sourceTree = ""; }; 0AC5E094DFE18C3AB7619D34 /* CreateRoomScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomScreenViewModelProtocol.swift; sourceTree = ""; }; 0AE4B7AD74E402BBC46A801A /* LeaveSpaceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeaveSpaceView.swift; sourceTree = ""; }; - 0B0E0B55E2EE75AF67029924 /* SwipeToReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeToReplyView.swift; sourceTree = ""; }; 0B32BBA8887BD7A5C4ECF16F /* RoomModerationRole.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomModerationRole.swift; sourceTree = ""; }; 0B5DF0E888F66652F8C4CEC5 /* LiveLocationManagerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationManagerMock.swift; sourceTree = ""; }; 0B987FC3FDBAA0E1C5AA235C /* PaginationIndicatorRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationIndicatorRoomTimelineItem.swift; sourceTree = ""; }; @@ -2431,7 +2426,6 @@ 858DA81F2ACF484B7CAD6AE4 /* KnockedRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnockedRoomProxy.swift; sourceTree = ""; }; 858F8D0B0D51CC41BAA18E24 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = ""; }; 859F51637DA710BBE7B70D6D /* ChatsSpaceFiltersScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatsSpaceFiltersScreenViewModel.swift; sourceTree = ""; }; - 85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestCase.swift; sourceTree = ""; }; 85E8591F06B2DAA284181308 /* HomeserverCapabilitiesProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeserverCapabilitiesProxyProtocol.swift; sourceTree = ""; }; 85EB16E7FE59A947CA441531 /* MediaProviderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaProviderProtocol.swift; sourceTree = ""; }; 8610C1D21565C950BCA6A454 /* AppLockSetupSettingsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupSettingsScreenViewModelProtocol.swift; sourceTree = ""; }; @@ -3835,7 +3829,6 @@ children = ( 307C3E5B9B189497D3250E23 /* AccessibleLongPress.swift */, 1D9F148717D74F73BE724434 /* LongPressWithFeedback.swift */, - 0B0E0B55E2EE75AF67029924 /* SwipeToReplyView.swift */, 2DA4F09CB613C54FDC73AE6A /* ThreadDecorator.swift */, F5D8FEB1FED10E995CB002F7 /* TimelineBubbleLayout.swift */, 1DA7E93C2E148B96EF6A8500 /* TimelineItemAccessibilityModifier.swift */, @@ -4348,7 +4341,6 @@ 04DF593C3F7AF4B2FBAEB05D /* FileManager.swift */, E3877D3CFAC1D33823359BAF /* HTMLParserStyle.swift */, 4E2245243369B99216C7D84E /* ImageCache.swift */, - 045253F9967A535EE5B16691 /* Label.swift */, F72EFC8C634469F9262659C7 /* NSItemProvider.swift */, 95BAC0F6C9644336E9567EE6 /* NSRegularExpresion.swift */, 5327E3B3C58BEB0E65F4CF98 /* Observable.swift */, @@ -4369,7 +4361,6 @@ 2BFDCA5A09EE70BC17F2EFA7 /* URLComponents.swift */, AE40D4A5DD857AC16EED945A /* URLSession.swift */, 897DF5E9A70CE05A632FC8AF /* UTType.swift */, - 85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */, E992D7B8BE54B2AB454613AF /* XCUIElement.swift */, ); path = Extensions; @@ -7619,16 +7610,16 @@ projectDirPath = ""; projectRoot = ""; targets = ( - C0FAEB81CFD9776CD78CE489 /* ElementX */, - FEB53A5BC378C913769656D8 /* NSE */, - 19F0C845D67E9BEA4BE7133E /* ShareExtension */, - 676A87694F0F247B2AF1A142 /* MatrixRustSDKMocks */, - 32C23C8D224D46EFE62AFAD0 /* UnitTests */, - 7A17BE29BAC81ADBAC6349D9 /* PreviewTests */, - 0E28CD62691FDBC63147D5E3 /* UITests */, - D3DB351B7FBE0F49649171FC /* IntegrationTests */, C0C687DE1D270F9895FEE186 /* AccessibilityTests */, + C0FAEB81CFD9776CD78CE489 /* ElementX */, + D3DB351B7FBE0F49649171FC /* IntegrationTests */, + 676A87694F0F247B2AF1A142 /* MatrixRustSDKMocks */, + FEB53A5BC378C913769656D8 /* NSE */, F8E276FD6DC43EADB85241BC /* Periphery */, + 7A17BE29BAC81ADBAC6349D9 /* PreviewTests */, + 19F0C845D67E9BEA4BE7133E /* ShareExtension */, + 0E28CD62691FDBC63147D5E3 /* UITests */, + 32C23C8D224D46EFE62AFAD0 /* UnitTests */, ); }; /* End PBXProject section */ @@ -8143,7 +8134,6 @@ 44BDD670FF9095ACE240A3A2 /* VoiceMessageMediaManagerTests.swift in Sources */, A3D7110C1E75E7B4A73BE71C /* VoiceMessageRecorderTests.swift in Sources */, 0B9436A91CFA658202400465 /* WaitingConfirmation.swift in Sources */, - 1443CEEE42491CF7CD8A146A /* XCTestCase.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8607,7 +8597,6 @@ 6681D6D3ADF69EBD2625F29A /* KnockedRoomProxyMock.swift in Sources */, 454F8DDC4442C0DE54094902 /* LABiometryType.swift in Sources */, E468CC731C3F4D678499E52F /* LAContextMock.swift in Sources */, - D5681C80D8281560AACE0035 /* Label.swift in Sources */, 33BA0964A308D2286B39976D /* LabsScreen.swift in Sources */, D150D6E96CA6CA09FA50E13C /* LabsScreenCoordinator.swift in Sources */, C900127318820AD04D6C90B8 /* LabsScreenModels.swift in Sources */, @@ -9150,7 +9139,6 @@ A7D48E44D485B143AADDB77D /* Strings+Untranslated.swift in Sources */, 066A1E9B94723EE9F3038044 /* Strings.swift in Sources */, FF34BF2AF731340AF9414A18 /* SwipeRightAction.swift in Sources */, - 3B98049F56025726FB646ABD /* SwipeToReplyView.swift in Sources */, C097D5453640E27D397943CB /* TargetConfiguration.swift in Sources */, E290C78E7F09F47FD2662986 /* Task.swift in Sources */, 1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */, diff --git a/ElementX/Sources/AppHooks/AppHooks.swift b/ElementX/Sources/AppHooks/AppHooks.swift index 1c311995f..ac89c84d0 100644 --- a/ElementX/Sources/AppHooks/AppHooks.swift +++ b/ElementX/Sources/AppHooks/AppHooks.swift @@ -93,6 +93,7 @@ final nonisolated class AppHooks: AppHooksProtocol { _clientBuilderHook.withLock { $0 } } + // periphery:ignore - might be useful to have func registerClientBuilderHook(_ hook: ClientBuilderHookProtocol) { _clientBuilderHook.withLock { $0 = hook } } @@ -108,9 +109,11 @@ final nonisolated class AppHooks: AppHooksProtocol { } nonisolated protocol AppHooksProtocol: Sendable { + // periphery:ignore - required for the architecture func setUp() } nonisolated extension AppHooksProtocol { + // periphery:ignore - required for the architecture func setUp() { } } diff --git a/ElementX/Sources/AppHooks/Hooks/RemoteSettingsHook.swift b/ElementX/Sources/AppHooks/Hooks/RemoteSettingsHook.swift index 03f5415a7..d9727fe34 100644 --- a/ElementX/Sources/AppHooks/Hooks/RemoteSettingsHook.swift +++ b/ElementX/Sources/AppHooks/Hooks/RemoteSettingsHook.swift @@ -56,11 +56,9 @@ struct DefaultRemoteSettingsHook: RemoteSettingsHookProtocol { } private struct ElementWellKnown: Decodable { - var version: Int? var enforceElementPro: Bool? enum CodingKeys: String, CodingKey { - case version case enforceElementPro = "enforce_element_pro" } } diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 052cefe79..bc63375bd 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -19,6 +19,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg private let stateMachine: AppCoordinatorStateMachine private let navigationRootCoordinator: NavigationRootCoordinator private let userSessionStore: UserSessionStoreProtocol + // periphery:ignore - retaining purpose private let targetConfiguration: Target.ConfigurationResult private let appMediator: AppMediator private let appSettings: AppSettings @@ -680,7 +681,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg appMediator: appMediator, appSettings: appSettings, appHooks: appHooks, - analytics: analyticsService, userIndicatorController: userIndicatorController) coordinator.delegate = self diff --git a/ElementX/Sources/Application/AppMediatorProtocol.swift b/ElementX/Sources/Application/AppMediatorProtocol.swift index c2401a18f..93c44b7de 100644 --- a/ElementX/Sources/Application/AppMediatorProtocol.swift +++ b/ElementX/Sources/Application/AppMediatorProtocol.swift @@ -16,10 +16,6 @@ protocol AppMediatorProtocol { var appState: UIApplication.State { get } - func beginBackgroundTask(expirationHandler handler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier - - func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier) - func open(_ url: URL) func openAppSettings() diff --git a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift index c31de9559..847f149a1 100644 --- a/ElementX/Sources/Application/FlowCoordinatorProtocol.swift +++ b/ElementX/Sources/Application/FlowCoordinatorProtocol.swift @@ -8,7 +8,6 @@ import Foundation -// periphery:ignore - markdown protocol protocol FlowCoordinatorProtocol { func start(animated: Bool) func handleAppRoute(_ appRoute: AppRoute, animated: Bool) diff --git a/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift b/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift index 5e2bc8f6e..cf20ed3c4 100644 --- a/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift +++ b/ElementX/Sources/Application/Navigation/NavigationCoordinators.swift @@ -85,7 +85,6 @@ import SwiftUI } } - // periphery:ignore - might be useful to have /// The currently displayed fullscreen cover coordinator var fullScreenCoverCoordinator: (any CoordinatorProtocol)? { fullScreenCoverModule?.coordinator @@ -626,7 +625,6 @@ private struct NavigationSplitCoordinatorView: View { } } - // periphery:ignore - might be useful to have /// Present a fullscreen cover on top of the stack. If this NavigationStackCoordinator is embedded within a NavigationSplitCoordinator /// then the presentation will be proxied to the split /// - Parameters: diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index 1360dd472..0e0cad12c 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -28,7 +28,6 @@ nonisolated protocol CommonSettingsProtocol: AnyObject, Sendable { var enableOnlySignedDeviceIsolationMode: Bool { get } var threadsEnabled: Bool { get } - var globalSearchEnabled: Bool { get } var hideQuietNotificationAlerts: Bool { get } } diff --git a/ElementX/Sources/Application/Settings/UserDefaultsProtocol.swift b/ElementX/Sources/Application/Settings/UserDefaultsProtocol.swift index aff158662..85f4685a5 100644 --- a/ElementX/Sources/Application/Settings/UserDefaultsProtocol.swift +++ b/ElementX/Sources/Application/Settings/UserDefaultsProtocol.swift @@ -8,7 +8,7 @@ import Foundation -public nonisolated protocol UserDefaultsProtocol: AnyObject { +nonisolated protocol UserDefaultsProtocol: AnyObject { func data(forKey key: String) -> Data? func object(forKey key: String) -> Any? func removeObject(forKey key: String) diff --git a/ElementX/Sources/Application/Settings/VolatileUserDefaults.swift b/ElementX/Sources/Application/Settings/VolatileUserDefaults.swift index f9dcc71fa..f0f43a08f 100644 --- a/ElementX/Sources/Application/Settings/VolatileUserDefaults.swift +++ b/ElementX/Sources/Application/Settings/VolatileUserDefaults.swift @@ -7,39 +7,39 @@ import Foundation -public final nonisolated class VolatileUserDefaults: UserDefaultsProtocol, Sendable { +final nonisolated class VolatileUserDefaults: UserDefaultsProtocol, Sendable { private let lock = NSLock() private nonisolated(unsafe) var _storage: [String: Any] - public private(set) var storage: [String: Any] { + private(set) var storage: [String: Any] { get { lock.withLock { _storage } } set { lock.withLock { _storage = newValue } } } - public init(initialValues: [String: Any] = [:]) { + init(initialValues: [String: Any] = [:]) { lock.lock() defer { lock.unlock() } _storage = initialValues } - public func data(forKey key: String) -> Data? { + func data(forKey key: String) -> Data? { storage[key] as? Data } - public func object(forKey key: String) -> Any? { + func object(forKey key: String) -> Any? { storage[key] } - public func removeObject(forKey key: String) { + func removeObject(forKey key: String) { storage.removeValue(forKey: key) } - public func set(_ value: Any?, forKey key: String) { + func set(_ value: Any?, forKey key: String) { storage[key] = value } - public func reset() { + func reset() { storage = [:] } } diff --git a/ElementX/Sources/Application/Windowing/WindowManager.swift b/ElementX/Sources/Application/Windowing/WindowManager.swift index 2981212f9..64cd9ee49 100644 --- a/ElementX/Sources/Application/Windowing/WindowManager.swift +++ b/ElementX/Sources/Application/Windowing/WindowManager.swift @@ -12,7 +12,6 @@ import SwiftUI class WindowManager: SecureWindowManagerProtocol { private let appDelegate: AppDelegate weak var mainScene: UIWindowScene? - weak var mainSession: UISceneSession? weak var delegate: SecureWindowManagerDelegate? private(set) var mainWindow: UIWindow! @@ -34,7 +33,6 @@ class WindowManager: SecureWindowManagerProtocol { [mainWindow, overlayWindow, alternateWindow] } - // periphery:ignore - auto cancels when reassigned /// The task used to switch windows, so that we don't get stuck in the wrong state with a quick switch. @CancellableTask private var switchTask: Task? /// A duration that allows window switching to wait a couple of frames to avoid a transition through black. @@ -62,7 +60,6 @@ class WindowManager: SecureWindowManagerProtocol { } mainScene = scene - mainSession = session // Restore the previous window size on macOS as this isn't automatic. if let previousSize = mainWindow?.frame.size { @@ -94,7 +91,6 @@ class WindowManager: SecureWindowManagerProtocol { func handleSceneDisconnection(_ scene: UIWindowScene) { if scene == mainScene { mainScene = nil - mainSession = nil // Leave the mainWindow so we can reapply it's size on macOS. } } diff --git a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift index 157e04b5c..be70f5e9e 100644 --- a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift @@ -22,7 +22,6 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { private let appMediator: AppMediatorProtocol private let appSettings: AppSettings private let appHooks: AppHooks - private let analytics: AnalyticsServiceProtocol private let userIndicatorController: UserIndicatorControllerProtocol enum State: StateType { @@ -108,7 +107,6 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { appMediator: AppMediatorProtocol, appSettings: AppSettings, appHooks: AppHooks, - analytics: AnalyticsServiceProtocol, userIndicatorController: UserIndicatorControllerProtocol) { self.authenticationService = authenticationService self.bugReportService = bugReportService @@ -116,7 +114,6 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { self.appMediator = appMediator self.appSettings = appSettings self.appHooks = appHooks - self.analytics = analytics self.userIndicatorController = userIndicatorController navigationStackCoordinator = NavigationStackCoordinator() @@ -443,8 +440,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { let parameters = LoginScreenCoordinatorParameters(authenticationService: authenticationService, loginHint: loginHint, userIndicatorController: userIndicatorController, - appSettings: appSettings, - analytics: analytics) + appSettings: appSettings) let coordinator = LoginScreenCoordinator(parameters: parameters) coordinator.actions diff --git a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift index a763244ec..b3cdb8acf 100644 --- a/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/ChatsTabFlowCoordinator.swift @@ -31,12 +31,10 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { private let stateMachine: ChatsTabFlowCoordinatorStateMachine - // periphery:ignore - retaining purpose private var roomFlowCoordinator: RoomFlowCoordinator? // periphery:ignore - retaining purpose private var spaceFlowCoordinator: SpaceFlowCoordinator? - // periphery:ignore - retaining purpose private var bugReportFlowCoordinator: BugReportFlowCoordinator? // periphery:ignore - retaining purpose private var encryptionResetFlowCoordinator: EncryptionResetFlowCoordinator? @@ -54,8 +52,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { actionsSubject.eraseToAnyPublisher() } - init(isNewLogin: Bool, - navigationSplitCoordinator: NavigationSplitCoordinator, + init(navigationSplitCoordinator: NavigationSplitCoordinator, flowParameters: CommonFlowParameters) { stateMachine = flowParameters.stateMachineFactory.makeChatsTabFlowStateMachine() self.navigationSplitCoordinator = navigationSplitCoordinator @@ -754,8 +751,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol { isPresentedModally: true, userSession: userSession, userIndicatorController: flowParameters.userIndicatorController, - analytics: flowParameters.analytics, - appSettings: flowParameters.appSettings) + analytics: flowParameters.analytics) let coordinator = UserProfileScreenCoordinator(parameters: parameters) coordinator.actionsPublisher.sink { [weak self] action in guard let self else { return } diff --git a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift index 7bcf797da..03715e74d 100644 --- a/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/OnboardingFlowCoordinator.swift @@ -349,7 +349,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol { } private func presentIdentityConfirmedScreen() { - let coordinator = IdentityConfirmedScreenCoordinator(parameters: .init()) + let coordinator = IdentityConfirmedScreenCoordinator() coordinator.actionsPublisher .sink { [weak self] action in guard let self else { return } diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index 776351069..ab90845b4 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -90,11 +90,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { private var pinnedEventsTimelineFlowCoordinator: PinnedEventsTimelineFlowCoordinator? // periphery:ignore - used to avoid deallocation private var mediaEventsTimelineFlowCoordinator: MediaEventsTimelineFlowCoordinator? - // periphery:ignore - used to avoid deallocation private var childRoomFlowCoordinator: RoomFlowCoordinator? // periphery:ignore - retaining purpose private var spaceFlowCoordinator: SpaceFlowCoordinator? - // periphery:ignore - retaining purpose private var membersFlowCoordinator: RoomMembersFlowCoordinator? private let stateMachine: StateMachine = .init(state: .initial) @@ -946,8 +944,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { analyticsService: flowParameters.analytics, userIndicatorController: flowParameters.userIndicatorController, notificationSettings: userSession.clientProxy.notificationSettings, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder()), - appSettings: flowParameters.appSettings) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder())) let coordinator = RoomDetailsScreenCoordinator(parameters: params) coordinator.actions.sink { [weak self] action in guard let self else { return } @@ -1025,8 +1022,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: flowParameters.appSettings), navigationStackCoordinator: stackCoordinator, userIndicatorController: flowParameters.userIndicatorController, - orientationManager: flowParameters.appMediator.windowManager, - appSettings: flowParameters.appSettings) + orientationManager: flowParameters.appMediator.windowManager) let roomDetailsEditCoordinator = RoomDetailsEditScreenCoordinator(parameters: roomDetailsEditParameters) roomDetailsEditCoordinator.actions.sink { [weak self] action in @@ -1123,7 +1119,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { let parameters = MediaUploadPreviewScreenCoordinatorParameters(mediaURLs: mediaURLs, caption: caption, title: title, - isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted, shouldShowCaptionWarning: flowParameters.appSettings.shouldShowMediaCaptionWarning, mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: flowParameters.appSettings), timelineController: timelineController, @@ -1170,7 +1165,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { } .store(in: &cancellables) - navigationStackCoordinator.setSheetCoordinator(coordinator) { [weak self] in + navigationStackCoordinator.setSheetCoordinator(coordinator, animated: animated) { [weak self] in self?.stateMachine.tryEvent(.dismissEmojiPicker) } } @@ -1203,7 +1198,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { stackCoordinator.setRootCoordinator(coordinator) - navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in + navigationStackCoordinator.setSheetCoordinator(stackCoordinator, animated: animated) { [weak self] in self?.stateMachine.tryEvent(.dismissMapNavigator) } } @@ -1351,8 +1346,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { roomType: roomType, isSkippable: false, userDiscoveryService: UserDiscoveryService(clientProxy: userSession.clientProxy), - userIndicatorController: flowParameters.userIndicatorController, - appSettings: flowParameters.appSettings) + userIndicatorController: flowParameters.userIndicatorController) let coordinator = InviteUsersScreenCoordinator(parameters: inviteParameters) stackCoordinator.setRootCoordinator(coordinator) diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinatorStateMachine.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinatorStateMachine.swift index 94bb357e5..ccf1d78fe 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinatorStateMachine.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinatorStateMachine.swift @@ -10,18 +10,6 @@ import Foundation import SwiftState extension RoomFlowCoordinator { - struct HashableRoomMemberWrapper: Hashable { - let value: RoomMemberProxyProtocol - - static func == (lhs: HashableRoomMemberWrapper, rhs: HashableRoomMemberWrapper) -> Bool { - lhs.value.userID == rhs.value.userID - } - - func hash(into hasher: inout Hasher) { - hasher.combine(value.userID) - } - } - enum PresentationAction: Hashable { case eventFocus(FocusEvent) case share(ShareExtensionPayload) diff --git a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift index 5de13ff4a..802da9b97 100644 --- a/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomMembersFlowCoordinator.swift @@ -39,8 +39,6 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { } enum Event: EventType { - case start - case presentRoomMembersList case presentRoomMemberDetails(userID: String) @@ -234,8 +232,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { roomProxy: roomProxy, userSession: flowParameters.userSession, userIndicatorController: flowParameters.userIndicatorController, - analytics: flowParameters.analytics, - appSettings: flowParameters.appSettings) + analytics: flowParameters.analytics) let coordinator = RoomMemberDetailsScreenCoordinator(parameters: params) coordinator.actions.sink { [weak self] action in @@ -264,8 +261,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { roomType: .existingRoom(roomProxy: roomProxy), isSkippable: false, userDiscoveryService: UserDiscoveryService(clientProxy: flowParameters.userSession.clientProxy), - userIndicatorController: flowParameters.userIndicatorController, - appSettings: flowParameters.appSettings) + userIndicatorController: flowParameters.userIndicatorController) let coordinator = InviteUsersScreenCoordinator(parameters: inviteParameters) stackCoordinator.setRootCoordinator(coordinator) @@ -292,8 +288,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol { isPresentedModally: false, userSession: flowParameters.userSession, userIndicatorController: flowParameters.userIndicatorController, - analytics: flowParameters.analytics, - appSettings: flowParameters.appSettings) + analytics: flowParameters.analytics) let coordinator = UserProfileScreenCoordinator(parameters: parameters) coordinator.actionsPublisher.sink { [weak self] action in guard let self else { return } diff --git a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift index 2eb212bfe..41457d0d9 100644 --- a/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SettingsFlowCoordinator.swift @@ -25,7 +25,6 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { // periphery:ignore - retaining purpose private var appLockSetupFlowCoordinator: AppLockSetupFlowCoordinator? - // periphery:ignore - retaining purpose private var bugReportFlowCoordinator: BugReportFlowCoordinator? // periphery:ignore - retaining purpose private var encryptionSettingsFlowCoordinator: EncryptionSettingsFlowCoordinator? @@ -60,7 +59,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { case .settings: presentSettingsScreen(animated: animated) case .chatBackupSettings: - startEncryptionSettingsFlow(animated: animated) + startEncryptionSettingsFlow() default: break } @@ -89,7 +88,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { case .logout: actionsSubject.send(.runLogoutFlow) case .secureBackup: - startEncryptionSettingsFlow(animated: true) + startEncryptionSettingsFlow() case .userDetails: presentUserDetailsEditScreen() case .linkNewDevice: @@ -141,7 +140,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { navigationStackCoordinator.push(coordinator) } - private func startEncryptionSettingsFlow(animated: Bool) { + private func startEncryptionSettingsFlow() { let coordinator = EncryptionSettingsFlowCoordinator(parameters: .init(userSession: flowParameters.userSession, appSettings: flowParameters.appSettings, appHooks: flowParameters.appHooks, @@ -165,8 +164,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol { userSession: flowParameters.userSession, mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: flowParameters.appSettings), navigationStackCoordinator: navigationStackCoordinator, - userIndicatorController: flowParameters.userIndicatorController, - appSettings: flowParameters.appSettings)) + userIndicatorController: flowParameters.userIndicatorController)) coordinator.actions .sink { [weak self] action in switch action { diff --git a/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift index 3fbfcc7d3..cc221ea68 100644 --- a/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpaceFlowCoordinator.swift @@ -45,6 +45,7 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol { private var membersFlowCoordinator: RoomMembersFlowCoordinator? private var settingsFlowCoordinator: SpaceSettingsFlowCoordinator? private var rolesAndPermissionsFlowCoordinator: RoomRolesAndPermissionsFlowCoordinator? + // periphery:ignore - retaining purpose private var createChildRoomFlowCoordinator: StartChatFlowCoordinator? indirect enum State: StateType { diff --git a/ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift index 6d4c6622c..be82e00c8 100644 --- a/ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift @@ -40,8 +40,6 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol { } enum Event: EventType { - case start - case presentSpaceSettings case presentEditDetailsScreen @@ -75,9 +73,6 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol { private let stateMachine: StateMachine private var cancellables = Set() - private var membersFlowCoordinator: RoomMembersFlowCoordinator? - private var rolesAndPermissionsFlowCoordinator: RoomRolesAndPermissionsFlowCoordinator? - private var childFlowCoordinator: FlowCoordinatorProtocol? private let actionsSubject: PassthroughSubject = .init() @@ -219,8 +214,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol { analyticsService: flowParameters.analytics, userIndicatorController: flowParameters.userIndicatorController, notificationSettings: flowParameters.userSession.clientProxy.notificationSettings, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: flowParameters.appSettings)) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))) var leftRoom = false coordinator.actions.sink { [weak self] action in @@ -259,8 +253,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol { mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: flowParameters.appSettings), navigationStackCoordinator: stackCoordinator, userIndicatorController: flowParameters.userIndicatorController, - orientationManager: flowParameters.appMediator.windowManager, - appSettings: flowParameters.appSettings) + orientationManager: flowParameters.appMediator.windowManager) let coordinator = RoomDetailsEditScreenCoordinator(parameters: parameters) diff --git a/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift index 418e925ec..ada30fc9f 100644 --- a/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/SpacesTabFlowCoordinator.swift @@ -24,7 +24,9 @@ class SpacesTabFlowCoordinator: FlowCoordinatorProtocol { private let sidebarNavigationStackCoordinator: NavigationStackCoordinator private let detailNavigationStackCoordinator: NavigationStackCoordinator + // periphery:ignore - retaining purpose private var spaceFlowCoordinator: SpaceFlowCoordinator? + // periphery:ignore - retaining purpose private var startChatFlowCoordinator: StartChatFlowCoordinator? enum State: StateType { @@ -146,7 +148,6 @@ class SpacesTabFlowCoordinator: FlowCoordinatorProtocol { private func presentSpacesScreen() { let parameters = SpacesScreenCoordinatorParameters(userSession: userSession, selectedSpacePublisher: selectedSpaceSubject.asCurrentValuePublisher(), - appSettings: flowParameters.appSettings, userIndicatorController: flowParameters.userIndicatorController) let coordinator = SpacesScreenCoordinator(parameters: parameters) coordinator.actionsPublisher diff --git a/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift index bcfd7d77c..13a928c62 100644 --- a/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/StartChatFlowCoordinator.swift @@ -185,7 +185,6 @@ class StartChatFlowCoordinator: FlowCoordinatorProtocol { let parameters = StartChatScreenCoordinatorParameters(userSession: flowParameters.userSession, userDiscoveryService: userDiscoveryService, userIndicatorController: flowParameters.userIndicatorController, - appSettings: flowParameters.appSettings, analytics: flowParameters.analytics) let coordinator = StartChatScreenCoordinator(parameters: parameters) @@ -273,8 +272,7 @@ class StartChatFlowCoordinator: FlowCoordinatorProtocol { roomType: .existingRoom(roomProxy: roomProxy), isSkippable: true, userDiscoveryService: userDiscoveryService, - userIndicatorController: flowParameters.userIndicatorController, - appSettings: flowParameters.appSettings) + userIndicatorController: flowParameters.userIndicatorController) let coordinator = InviteUsersScreenCoordinator(parameters: inviteParameters) coordinator.actions.sink { [weak self] action in guard let self else { return } diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index 5b2c0f474..51189af1d 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -42,7 +42,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { private let searchTabNavigationStackCoordinator: NavigationStackCoordinator? private let searchTabDetails: NavigationTabCoordinator.TabDetails? - // periphery:ignore - retaining purpose private var settingsFlowCoordinator: SettingsFlowCoordinator? enum State: StateType { @@ -84,8 +83,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { navigationRootCoordinator.setRootCoordinator(navigationTabCoordinator) let chatsSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: flowParameters.appSettings.hideBrandChrome)) - chatsTabFlowCoordinator = ChatsTabFlowCoordinator(isNewLogin: isNewLogin, - navigationSplitCoordinator: chatsSplitCoordinator, + chatsTabFlowCoordinator = ChatsTabFlowCoordinator(navigationSplitCoordinator: chatsSplitCoordinator, flowParameters: flowParameters) chatsTabDetails = .init(tag: HomeTab.chats, title: L10n.screenHomeTabChats, icon: \.chat, selectedIcon: \.chatSolid) chatsTabDetails.navigationSplitCoordinator = chatsSplitCoordinator diff --git a/ElementX/Sources/Mocks/BannedRoomProxyMock.swift b/ElementX/Sources/Mocks/BannedRoomProxyMock.swift index b8dbb7046..5e96998e9 100644 --- a/ElementX/Sources/Mocks/BannedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/BannedRoomProxyMock.swift @@ -33,9 +33,7 @@ extension RoomInfoProxyMock { id = configuration.id isEncrypted = false - creators = [] displayName = configuration.name - rawName = nil topic = nil avatarURL = configuration.avatarURL @@ -47,20 +45,11 @@ extension RoomInfoProxyMock { canonicalAlias = nil alternativeAliases = [] membership = .knocked - inviter = nil heroes = [] activeMembersCount = configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count - invitedMembersCount = configuration.members.filter { $0.membership == .invite }.count joinedMembersCount = configuration.members.filter { $0.membership == .join }.count - highlightCount = 0 - notificationCount = 0 - cachedUserDefinedNotificationMode = nil hasRoomCall = false activeRoomCallParticipants = [] - isMarkedUnread = false - unreadMessagesCount = 0 - unreadNotificationsCount = 0 - unreadMentionsCount = 0 pinnedEventIDs = [] joinRule = .knock historyVisibility = .shared diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index fafde662c..5df8a7c17 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -248,23 +248,6 @@ nonisolated class AnalyticsServiceMock: AnalyticsServiceProtocol, @unchecked Sen startIfEnabledCallsCountLock.withLock { startIfEnabledUnderlyingCallsCount += 1 } startIfEnabledClosure?() } - //MARK: - reset - - private let resetCallsCountLock = NSLock() - private nonisolated(unsafe) var resetUnderlyingCallsCount = 0 - var resetCallsCount: Int { - get { resetCallsCountLock.withLock { resetUnderlyingCallsCount } } - set { resetCallsCountLock.withLock { resetUnderlyingCallsCount = newValue } } - } - var resetCalled: Bool { - return resetCallsCount > 0 - } - nonisolated(unsafe) var resetClosure: (() -> Void)? - - func reset() { - resetCallsCountLock.withLock { resetUnderlyingCallsCount += 1 } - resetClosure?() - } //MARK: - resetConsentState private let resetConsentStateCallsCountLock = NSLock() @@ -1061,65 +1044,6 @@ nonisolated class AppMediatorMock: AppMediatorProtocol, @unchecked Sendable { } nonisolated(unsafe) var underlyingAppState: UIApplication.State! - //MARK: - beginBackgroundTask - - private let beginBackgroundTaskExpirationHandlerCallsCountLock = NSLock() - private nonisolated(unsafe) var beginBackgroundTaskExpirationHandlerUnderlyingCallsCount = 0 - var beginBackgroundTaskExpirationHandlerCallsCount: Int { - get { beginBackgroundTaskExpirationHandlerCallsCountLock.withLock { beginBackgroundTaskExpirationHandlerUnderlyingCallsCount } } - set { beginBackgroundTaskExpirationHandlerCallsCountLock.withLock { beginBackgroundTaskExpirationHandlerUnderlyingCallsCount = newValue } } - } - var beginBackgroundTaskExpirationHandlerCalled: Bool { - return beginBackgroundTaskExpirationHandlerCallsCount > 0 - } - - private let beginBackgroundTaskExpirationHandlerReturnValueLock = NSLock() - private nonisolated(unsafe) var beginBackgroundTaskExpirationHandlerUnderlyingReturnValue: UIBackgroundTaskIdentifier! - var beginBackgroundTaskExpirationHandlerReturnValue: UIBackgroundTaskIdentifier! { - get { beginBackgroundTaskExpirationHandlerReturnValueLock.withLock { beginBackgroundTaskExpirationHandlerUnderlyingReturnValue } } - set { beginBackgroundTaskExpirationHandlerReturnValueLock.withLock { beginBackgroundTaskExpirationHandlerUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var beginBackgroundTaskExpirationHandlerClosure: (((@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier)? - - func beginBackgroundTask(expirationHandler handler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier { - beginBackgroundTaskExpirationHandlerCallsCountLock.withLock { beginBackgroundTaskExpirationHandlerUnderlyingCallsCount += 1 } - if let beginBackgroundTaskExpirationHandlerClosure = beginBackgroundTaskExpirationHandlerClosure { - return beginBackgroundTaskExpirationHandlerClosure(handler) - } else { - return beginBackgroundTaskExpirationHandlerReturnValue - } - } - //MARK: - endBackgroundTask - - private let endBackgroundTaskCallsCountLock = NSLock() - private nonisolated(unsafe) var endBackgroundTaskUnderlyingCallsCount = 0 - var endBackgroundTaskCallsCount: Int { - get { endBackgroundTaskCallsCountLock.withLock { endBackgroundTaskUnderlyingCallsCount } } - set { endBackgroundTaskCallsCountLock.withLock { endBackgroundTaskUnderlyingCallsCount = newValue } } - } - var endBackgroundTaskCalled: Bool { - return endBackgroundTaskCallsCount > 0 - } - private let endBackgroundTaskReceivedIdentifierLock = NSLock() - private nonisolated(unsafe) var endBackgroundTaskUnderlyingReceivedIdentifier: UIBackgroundTaskIdentifier? - var endBackgroundTaskReceivedIdentifier: UIBackgroundTaskIdentifier? { - get { endBackgroundTaskReceivedIdentifierLock.withLock { endBackgroundTaskUnderlyingReceivedIdentifier } } - set { endBackgroundTaskReceivedIdentifierLock.withLock { endBackgroundTaskUnderlyingReceivedIdentifier = newValue } } - } - private let endBackgroundTaskReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var endBackgroundTaskUnderlyingReceivedInvocations: [UIBackgroundTaskIdentifier] = [] - var endBackgroundTaskReceivedInvocations: [UIBackgroundTaskIdentifier] { - get { endBackgroundTaskReceivedInvocationsLock.withLock { endBackgroundTaskUnderlyingReceivedInvocations } } - set { endBackgroundTaskReceivedInvocationsLock.withLock { endBackgroundTaskUnderlyingReceivedInvocations = newValue } } - } - nonisolated(unsafe) var endBackgroundTaskClosure: ((UIBackgroundTaskIdentifier) -> Void)? - - func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier) { - endBackgroundTaskCallsCountLock.withLock { endBackgroundTaskUnderlyingCallsCount += 1 } - endBackgroundTaskReceivedIdentifier = identifier - endBackgroundTaskReceivedInvocationsLock.withLock { endBackgroundTaskUnderlyingReceivedInvocations.append(identifier) } - endBackgroundTaskClosure?(identifier) - } //MARK: - open private let openCallsCountLock = NSLock() @@ -1319,11 +1243,6 @@ nonisolated class AudioPlayerMock: AudioPlayerProtocol, @unchecked Sendable { set(value) { underlyingState = value } } nonisolated(unsafe) var underlyingState: MediaPlayerState! - var playbackSpeed: Float { - get { return underlyingPlaybackSpeed } - set(value) { underlyingPlaybackSpeed = value } - } - nonisolated(unsafe) var underlyingPlaybackSpeed: Float! var actions: AnyPublisher { get { return underlyingActions } set(value) { underlyingActions = value } @@ -5127,7 +5046,6 @@ nonisolated class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Senda } nonisolated(unsafe) var underlyingTimeline: TimelineProxyProtocol! nonisolated(unsafe) var predecessorRoom: PredecessorRoom? - nonisolated(unsafe) var successorRoom: SuccessorRoom? var id: String { get { return underlyingId } set(value) { underlyingId = value } @@ -5425,48 +5343,6 @@ nonisolated class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Senda return enableEncryptionReturnValue } } - //MARK: - redact - - private let redactCallsCountLock = NSLock() - private nonisolated(unsafe) var redactUnderlyingCallsCount = 0 - var redactCallsCount: Int { - get { redactCallsCountLock.withLock { redactUnderlyingCallsCount } } - set { redactCallsCountLock.withLock { redactUnderlyingCallsCount = newValue } } - } - var redactCalled: Bool { - return redactCallsCount > 0 - } - private let redactReceivedEventIDLock = NSLock() - private nonisolated(unsafe) var redactUnderlyingReceivedEventID: String? - var redactReceivedEventID: String? { - get { redactReceivedEventIDLock.withLock { redactUnderlyingReceivedEventID } } - set { redactReceivedEventIDLock.withLock { redactUnderlyingReceivedEventID = newValue } } - } - private let redactReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var redactUnderlyingReceivedInvocations: [String] = [] - var redactReceivedInvocations: [String] { - get { redactReceivedInvocationsLock.withLock { redactUnderlyingReceivedInvocations } } - set { redactReceivedInvocationsLock.withLock { redactUnderlyingReceivedInvocations = newValue } } - } - - private let redactReturnValueLock = NSLock() - private nonisolated(unsafe) var redactUnderlyingReturnValue: Result! - var redactReturnValue: Result! { - get { redactReturnValueLock.withLock { redactUnderlyingReturnValue } } - set { redactReturnValueLock.withLock { redactUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var redactClosure: ((String) async -> Result)? - - @concurrent func redact(_ eventID: String) async -> Result { - redactCallsCountLock.withLock { redactUnderlyingCallsCount += 1 } - redactReceivedEventID = eventID - redactReceivedInvocationsLock.withLock { redactUnderlyingReceivedInvocations.append(eventID) } - if let redactClosure = redactClosure { - return await redactClosure(eventID) - } else { - return redactReturnValue - } - } //MARK: - reportContent private let reportContentReasonCallsCountLock = NSLock() @@ -5876,48 +5752,6 @@ nonisolated class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Senda return markAsReadReceiptTypeReturnValue } } - //MARK: - edit - - private let editEventIDNewContentCallsCountLock = NSLock() - private nonisolated(unsafe) var editEventIDNewContentUnderlyingCallsCount = 0 - var editEventIDNewContentCallsCount: Int { - get { editEventIDNewContentCallsCountLock.withLock { editEventIDNewContentUnderlyingCallsCount } } - set { editEventIDNewContentCallsCountLock.withLock { editEventIDNewContentUnderlyingCallsCount = newValue } } - } - var editEventIDNewContentCalled: Bool { - return editEventIDNewContentCallsCount > 0 - } - private let editEventIDNewContentReceivedArgumentsLock = NSLock() - private nonisolated(unsafe) var editEventIDNewContentUnderlyingReceivedArguments: (eventID: String, newContent: RoomMessageEventContentWithoutRelation)? - var editEventIDNewContentReceivedArguments: (eventID: String, newContent: RoomMessageEventContentWithoutRelation)? { - get { editEventIDNewContentReceivedArgumentsLock.withLock { editEventIDNewContentUnderlyingReceivedArguments } } - set { editEventIDNewContentReceivedArgumentsLock.withLock { editEventIDNewContentUnderlyingReceivedArguments = newValue } } - } - private let editEventIDNewContentReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var editEventIDNewContentUnderlyingReceivedInvocations: [(eventID: String, newContent: RoomMessageEventContentWithoutRelation)] = [] - var editEventIDNewContentReceivedInvocations: [(eventID: String, newContent: RoomMessageEventContentWithoutRelation)] { - get { editEventIDNewContentReceivedInvocationsLock.withLock { editEventIDNewContentUnderlyingReceivedInvocations } } - set { editEventIDNewContentReceivedInvocationsLock.withLock { editEventIDNewContentUnderlyingReceivedInvocations = newValue } } - } - - private let editEventIDNewContentReturnValueLock = NSLock() - private nonisolated(unsafe) var editEventIDNewContentUnderlyingReturnValue: Result! - var editEventIDNewContentReturnValue: Result! { - get { editEventIDNewContentReturnValueLock.withLock { editEventIDNewContentUnderlyingReturnValue } } - set { editEventIDNewContentReturnValueLock.withLock { editEventIDNewContentUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var editEventIDNewContentClosure: ((String, RoomMessageEventContentWithoutRelation) async -> Result)? - - @concurrent func edit(eventID: String, newContent: RoomMessageEventContentWithoutRelation) async -> Result { - editEventIDNewContentCallsCountLock.withLock { editEventIDNewContentUnderlyingCallsCount += 1 } - editEventIDNewContentReceivedArguments = (eventID: eventID, newContent: newContent) - editEventIDNewContentReceivedInvocationsLock.withLock { editEventIDNewContentUnderlyingReceivedInvocations.append((eventID: eventID, newContent: newContent)) } - if let editEventIDNewContentClosure = editEventIDNewContentClosure { - return await editEventIDNewContentClosure(eventID, newContent) - } else { - return editEventIDNewContentReturnValue - } - } //MARK: - sendTypingNotification private let sendTypingNotificationIsTypingCallsCountLock = NSLock() @@ -6409,34 +6243,6 @@ nonisolated class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Senda return flagAsFavouriteReturnValue } } - //MARK: - powerLevels - - private let powerLevelsCallsCountLock = NSLock() - private nonisolated(unsafe) var powerLevelsUnderlyingCallsCount = 0 - var powerLevelsCallsCount: Int { - get { powerLevelsCallsCountLock.withLock { powerLevelsUnderlyingCallsCount } } - set { powerLevelsCallsCountLock.withLock { powerLevelsUnderlyingCallsCount = newValue } } - } - var powerLevelsCalled: Bool { - return powerLevelsCallsCount > 0 - } - - private let powerLevelsReturnValueLock = NSLock() - private nonisolated(unsafe) var powerLevelsUnderlyingReturnValue: Result! - var powerLevelsReturnValue: Result! { - get { powerLevelsReturnValueLock.withLock { powerLevelsUnderlyingReturnValue } } - set { powerLevelsReturnValueLock.withLock { powerLevelsUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var powerLevelsClosure: (() async -> Result)? - - @concurrent func powerLevels() async -> Result { - powerLevelsCallsCountLock.withLock { powerLevelsUnderlyingCallsCount += 1 } - if let powerLevelsClosure = powerLevelsClosure { - return await powerLevelsClosure() - } else { - return powerLevelsReturnValue - } - } //MARK: - applyPowerLevelChanges private let applyPowerLevelChangesCallsCountLock = NSLock() @@ -6507,48 +6313,6 @@ nonisolated class JoinedRoomProxyMock: JoinedRoomProxyProtocol, @unchecked Senda return resetPowerLevelsReturnValue } } - //MARK: - suggestedRole - - private let suggestedRoleForCallsCountLock = NSLock() - private nonisolated(unsafe) var suggestedRoleForUnderlyingCallsCount = 0 - var suggestedRoleForCallsCount: Int { - get { suggestedRoleForCallsCountLock.withLock { suggestedRoleForUnderlyingCallsCount } } - set { suggestedRoleForCallsCountLock.withLock { suggestedRoleForUnderlyingCallsCount = newValue } } - } - var suggestedRoleForCalled: Bool { - return suggestedRoleForCallsCount > 0 - } - private let suggestedRoleForReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var suggestedRoleForUnderlyingReceivedUserID: String? - var suggestedRoleForReceivedUserID: String? { - get { suggestedRoleForReceivedUserIDLock.withLock { suggestedRoleForUnderlyingReceivedUserID } } - set { suggestedRoleForReceivedUserIDLock.withLock { suggestedRoleForUnderlyingReceivedUserID = newValue } } - } - private let suggestedRoleForReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var suggestedRoleForUnderlyingReceivedInvocations: [String] = [] - var suggestedRoleForReceivedInvocations: [String] { - get { suggestedRoleForReceivedInvocationsLock.withLock { suggestedRoleForUnderlyingReceivedInvocations } } - set { suggestedRoleForReceivedInvocationsLock.withLock { suggestedRoleForUnderlyingReceivedInvocations = newValue } } - } - - private let suggestedRoleForReturnValueLock = NSLock() - private nonisolated(unsafe) var suggestedRoleForUnderlyingReturnValue: Result! - var suggestedRoleForReturnValue: Result! { - get { suggestedRoleForReturnValueLock.withLock { suggestedRoleForUnderlyingReturnValue } } - set { suggestedRoleForReturnValueLock.withLock { suggestedRoleForUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var suggestedRoleForClosure: ((String) async -> Result)? - - @concurrent func suggestedRole(for userID: String) async -> Result { - suggestedRoleForCallsCountLock.withLock { suggestedRoleForUnderlyingCallsCount += 1 } - suggestedRoleForReceivedUserID = userID - suggestedRoleForReceivedInvocationsLock.withLock { suggestedRoleForUnderlyingReceivedInvocations.append(userID) } - if let suggestedRoleForClosure = suggestedRoleForClosure { - return await suggestedRoleForClosure(userID) - } else { - return suggestedRoleForReturnValue - } - } //MARK: - updatePowerLevelsForUsers private let updatePowerLevelsForUsersCallsCountLock = NSLock() @@ -8201,48 +7965,6 @@ nonisolated class MediaProviderMock: MediaProviderProtocol, @unchecked Sendable return imageFromSourceSizeReturnValue } } - //MARK: - loadImageFromSource - - private let loadImageFromSourceSizeCallsCountLock = NSLock() - private nonisolated(unsafe) var loadImageFromSourceSizeUnderlyingCallsCount = 0 - var loadImageFromSourceSizeCallsCount: Int { - get { loadImageFromSourceSizeCallsCountLock.withLock { loadImageFromSourceSizeUnderlyingCallsCount } } - set { loadImageFromSourceSizeCallsCountLock.withLock { loadImageFromSourceSizeUnderlyingCallsCount = newValue } } - } - var loadImageFromSourceSizeCalled: Bool { - return loadImageFromSourceSizeCallsCount > 0 - } - private let loadImageFromSourceSizeReceivedArgumentsLock = NSLock() - private nonisolated(unsafe) var loadImageFromSourceSizeUnderlyingReceivedArguments: (source: MediaSourceProxy, size: CGSize?)? - var loadImageFromSourceSizeReceivedArguments: (source: MediaSourceProxy, size: CGSize?)? { - get { loadImageFromSourceSizeReceivedArgumentsLock.withLock { loadImageFromSourceSizeUnderlyingReceivedArguments } } - set { loadImageFromSourceSizeReceivedArgumentsLock.withLock { loadImageFromSourceSizeUnderlyingReceivedArguments = newValue } } - } - private let loadImageFromSourceSizeReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var loadImageFromSourceSizeUnderlyingReceivedInvocations: [(source: MediaSourceProxy, size: CGSize?)] = [] - var loadImageFromSourceSizeReceivedInvocations: [(source: MediaSourceProxy, size: CGSize?)] { - get { loadImageFromSourceSizeReceivedInvocationsLock.withLock { loadImageFromSourceSizeUnderlyingReceivedInvocations } } - set { loadImageFromSourceSizeReceivedInvocationsLock.withLock { loadImageFromSourceSizeUnderlyingReceivedInvocations = newValue } } - } - - private let loadImageFromSourceSizeReturnValueLock = NSLock() - private nonisolated(unsafe) var loadImageFromSourceSizeUnderlyingReturnValue: Result! - var loadImageFromSourceSizeReturnValue: Result! { - get { loadImageFromSourceSizeReturnValueLock.withLock { loadImageFromSourceSizeUnderlyingReturnValue } } - set { loadImageFromSourceSizeReturnValueLock.withLock { loadImageFromSourceSizeUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var loadImageFromSourceSizeClosure: ((MediaSourceProxy, CGSize?) async -> Result)? - - @concurrent func loadImageFromSource(_ source: MediaSourceProxy, size: CGSize?) async -> Result { - loadImageFromSourceSizeCallsCountLock.withLock { loadImageFromSourceSizeUnderlyingCallsCount += 1 } - loadImageFromSourceSizeReceivedArguments = (source: source, size: size) - loadImageFromSourceSizeReceivedInvocationsLock.withLock { loadImageFromSourceSizeUnderlyingReceivedInvocations.append((source: source, size: size)) } - if let loadImageFromSourceSizeClosure = loadImageFromSourceSizeClosure { - return await loadImageFromSourceSizeClosure(source, size) - } else { - return loadImageFromSourceSizeReturnValue - } - } //MARK: - loadImageDataFromSource private let loadImageDataFromSourceCallsCountLock = NSLock() @@ -8453,90 +8175,6 @@ nonisolated class NSEUserSessionMock: NSEUserSessionProtocol, @unchecked Sendabl } nonisolated(unsafe) var underlyingThreadsEnabled: Bool! - //MARK: - notificationItemProxy - - private let notificationItemProxyRoomIDEventIDCallsCountLock = NSLock() - private nonisolated(unsafe) var notificationItemProxyRoomIDEventIDUnderlyingCallsCount = 0 - var notificationItemProxyRoomIDEventIDCallsCount: Int { - get { notificationItemProxyRoomIDEventIDCallsCountLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingCallsCount } } - set { notificationItemProxyRoomIDEventIDCallsCountLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingCallsCount = newValue } } - } - var notificationItemProxyRoomIDEventIDCalled: Bool { - return notificationItemProxyRoomIDEventIDCallsCount > 0 - } - private let notificationItemProxyRoomIDEventIDReceivedArgumentsLock = NSLock() - private nonisolated(unsafe) var notificationItemProxyRoomIDEventIDUnderlyingReceivedArguments: (roomID: String, eventID: String)? - var notificationItemProxyRoomIDEventIDReceivedArguments: (roomID: String, eventID: String)? { - get { notificationItemProxyRoomIDEventIDReceivedArgumentsLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReceivedArguments } } - set { notificationItemProxyRoomIDEventIDReceivedArgumentsLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReceivedArguments = newValue } } - } - private let notificationItemProxyRoomIDEventIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var notificationItemProxyRoomIDEventIDUnderlyingReceivedInvocations: [(roomID: String, eventID: String)] = [] - var notificationItemProxyRoomIDEventIDReceivedInvocations: [(roomID: String, eventID: String)] { - get { notificationItemProxyRoomIDEventIDReceivedInvocationsLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReceivedInvocations } } - set { notificationItemProxyRoomIDEventIDReceivedInvocationsLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReceivedInvocations = newValue } } - } - - private let notificationItemProxyRoomIDEventIDReturnValueLock = NSLock() - private nonisolated(unsafe) var notificationItemProxyRoomIDEventIDUnderlyingReturnValue: NotificationItemProxyProtocol? - var notificationItemProxyRoomIDEventIDReturnValue: NotificationItemProxyProtocol? { - get { notificationItemProxyRoomIDEventIDReturnValueLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReturnValue } } - set { notificationItemProxyRoomIDEventIDReturnValueLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var notificationItemProxyRoomIDEventIDClosure: ((String, String) async -> NotificationItemProxyProtocol?)? - - @concurrent func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? { - notificationItemProxyRoomIDEventIDCallsCountLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingCallsCount += 1 } - notificationItemProxyRoomIDEventIDReceivedArguments = (roomID: roomID, eventID: eventID) - notificationItemProxyRoomIDEventIDReceivedInvocationsLock.withLock { notificationItemProxyRoomIDEventIDUnderlyingReceivedInvocations.append((roomID: roomID, eventID: eventID)) } - if let notificationItemProxyRoomIDEventIDClosure = notificationItemProxyRoomIDEventIDClosure { - return await notificationItemProxyRoomIDEventIDClosure(roomID, eventID) - } else { - return notificationItemProxyRoomIDEventIDReturnValue - } - } - //MARK: - roomForIdentifier - - private let roomForIdentifierCallsCountLock = NSLock() - private nonisolated(unsafe) var roomForIdentifierUnderlyingCallsCount = 0 - var roomForIdentifierCallsCount: Int { - get { roomForIdentifierCallsCountLock.withLock { roomForIdentifierUnderlyingCallsCount } } - set { roomForIdentifierCallsCountLock.withLock { roomForIdentifierUnderlyingCallsCount = newValue } } - } - var roomForIdentifierCalled: Bool { - return roomForIdentifierCallsCount > 0 - } - private let roomForIdentifierReceivedRoomIDLock = NSLock() - private nonisolated(unsafe) var roomForIdentifierUnderlyingReceivedRoomID: String? - var roomForIdentifierReceivedRoomID: String? { - get { roomForIdentifierReceivedRoomIDLock.withLock { roomForIdentifierUnderlyingReceivedRoomID } } - set { roomForIdentifierReceivedRoomIDLock.withLock { roomForIdentifierUnderlyingReceivedRoomID = newValue } } - } - private let roomForIdentifierReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var roomForIdentifierUnderlyingReceivedInvocations: [String] = [] - var roomForIdentifierReceivedInvocations: [String] { - get { roomForIdentifierReceivedInvocationsLock.withLock { roomForIdentifierUnderlyingReceivedInvocations } } - set { roomForIdentifierReceivedInvocationsLock.withLock { roomForIdentifierUnderlyingReceivedInvocations = newValue } } - } - - private let roomForIdentifierReturnValueLock = NSLock() - private nonisolated(unsafe) var roomForIdentifierUnderlyingReturnValue: Room? - var roomForIdentifierReturnValue: Room? { - get { roomForIdentifierReturnValueLock.withLock { roomForIdentifierUnderlyingReturnValue } } - set { roomForIdentifierReturnValueLock.withLock { roomForIdentifierUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var roomForIdentifierClosure: ((String) -> Room?)? - - func roomForIdentifier(_ roomID: String) -> Room? { - roomForIdentifierCallsCountLock.withLock { roomForIdentifierUnderlyingCallsCount += 1 } - roomForIdentifierReceivedRoomID = roomID - roomForIdentifierReceivedInvocationsLock.withLock { roomForIdentifierUnderlyingReceivedInvocations.append(roomID) } - if let roomForIdentifierClosure = roomForIdentifierClosure { - return roomForIdentifierClosure(roomID) - } else { - return roomForIdentifierReturnValue - } - } } nonisolated class NetworkMonitorMock: NetworkMonitorProtocol, @unchecked Sendable { var reachabilityPublisher: CurrentValuePublisher { @@ -8571,21 +8209,11 @@ nonisolated class NotificationItemProxyMock: NotificationItemProxyProtocol, @unc } nonisolated(unsafe) var underlyingRoomDisplayName: String! nonisolated(unsafe) var roomAvatarMediaSource: MediaSourceProxy? - var roomJoinedMembers: Int { - get { return underlyingRoomJoinedMembers } - set(value) { underlyingRoomJoinedMembers = value } - } - nonisolated(unsafe) var underlyingRoomJoinedMembers: Int! var isRoomSpace: Bool { get { return underlyingIsRoomSpace } set(value) { underlyingIsRoomSpace = value } } nonisolated(unsafe) var underlyingIsRoomSpace: Bool! - var isRoomDirect: Bool { - get { return underlyingIsRoomDirect } - set(value) { underlyingIsRoomDirect = value } - } - nonisolated(unsafe) var underlyingIsRoomDirect: Bool! var isRoomPrivate: Bool { get { return underlyingIsRoomPrivate } set(value) { underlyingIsRoomPrivate = value } @@ -10509,426 +10137,6 @@ nonisolated class RoomPowerLevelsProxyMock: RoomPowerLevelsProxyProtocol, @unche return canOwnUserEditRolesAndPermissionsReturnValue } } - //MARK: - canUser - - private let canUserUserIDSendMessageCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendMessageUnderlyingCallsCount = 0 - var canUserUserIDSendMessageCallsCount: Int { - get { canUserUserIDSendMessageCallsCountLock.withLock { canUserUserIDSendMessageUnderlyingCallsCount } } - set { canUserUserIDSendMessageCallsCountLock.withLock { canUserUserIDSendMessageUnderlyingCallsCount = newValue } } - } - var canUserUserIDSendMessageCalled: Bool { - return canUserUserIDSendMessageCallsCount > 0 - } - private let canUserUserIDSendMessageReceivedArgumentsLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendMessageUnderlyingReceivedArguments: (userID: String, messageType: MessageLikeEventType)? - var canUserUserIDSendMessageReceivedArguments: (userID: String, messageType: MessageLikeEventType)? { - get { canUserUserIDSendMessageReceivedArgumentsLock.withLock { canUserUserIDSendMessageUnderlyingReceivedArguments } } - set { canUserUserIDSendMessageReceivedArgumentsLock.withLock { canUserUserIDSendMessageUnderlyingReceivedArguments = newValue } } - } - private let canUserUserIDSendMessageReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendMessageUnderlyingReceivedInvocations: [(userID: String, messageType: MessageLikeEventType)] = [] - var canUserUserIDSendMessageReceivedInvocations: [(userID: String, messageType: MessageLikeEventType)] { - get { canUserUserIDSendMessageReceivedInvocationsLock.withLock { canUserUserIDSendMessageUnderlyingReceivedInvocations } } - set { canUserUserIDSendMessageReceivedInvocationsLock.withLock { canUserUserIDSendMessageUnderlyingReceivedInvocations = newValue } } - } - - private let canUserUserIDSendMessageReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendMessageUnderlyingReturnValue: Result! - var canUserUserIDSendMessageReturnValue: Result! { - get { canUserUserIDSendMessageReturnValueLock.withLock { canUserUserIDSendMessageUnderlyingReturnValue } } - set { canUserUserIDSendMessageReturnValueLock.withLock { canUserUserIDSendMessageUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserUserIDSendMessageClosure: ((String, MessageLikeEventType) -> Result)? - - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result { - canUserUserIDSendMessageCallsCountLock.withLock { canUserUserIDSendMessageUnderlyingCallsCount += 1 } - canUserUserIDSendMessageReceivedArguments = (userID: userID, messageType: messageType) - canUserUserIDSendMessageReceivedInvocationsLock.withLock { canUserUserIDSendMessageUnderlyingReceivedInvocations.append((userID: userID, messageType: messageType)) } - if let canUserUserIDSendMessageClosure = canUserUserIDSendMessageClosure { - return canUserUserIDSendMessageClosure(userID, messageType) - } else { - return canUserUserIDSendMessageReturnValue - } - } - //MARK: - canUser - - private let canUserUserIDSendStateEventCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendStateEventUnderlyingCallsCount = 0 - var canUserUserIDSendStateEventCallsCount: Int { - get { canUserUserIDSendStateEventCallsCountLock.withLock { canUserUserIDSendStateEventUnderlyingCallsCount } } - set { canUserUserIDSendStateEventCallsCountLock.withLock { canUserUserIDSendStateEventUnderlyingCallsCount = newValue } } - } - var canUserUserIDSendStateEventCalled: Bool { - return canUserUserIDSendStateEventCallsCount > 0 - } - private let canUserUserIDSendStateEventReceivedArgumentsLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendStateEventUnderlyingReceivedArguments: (userID: String, event: StateEventType)? - var canUserUserIDSendStateEventReceivedArguments: (userID: String, event: StateEventType)? { - get { canUserUserIDSendStateEventReceivedArgumentsLock.withLock { canUserUserIDSendStateEventUnderlyingReceivedArguments } } - set { canUserUserIDSendStateEventReceivedArgumentsLock.withLock { canUserUserIDSendStateEventUnderlyingReceivedArguments = newValue } } - } - private let canUserUserIDSendStateEventReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendStateEventUnderlyingReceivedInvocations: [(userID: String, event: StateEventType)] = [] - var canUserUserIDSendStateEventReceivedInvocations: [(userID: String, event: StateEventType)] { - get { canUserUserIDSendStateEventReceivedInvocationsLock.withLock { canUserUserIDSendStateEventUnderlyingReceivedInvocations } } - set { canUserUserIDSendStateEventReceivedInvocationsLock.withLock { canUserUserIDSendStateEventUnderlyingReceivedInvocations = newValue } } - } - - private let canUserUserIDSendStateEventReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserUserIDSendStateEventUnderlyingReturnValue: Result! - var canUserUserIDSendStateEventReturnValue: Result! { - get { canUserUserIDSendStateEventReturnValueLock.withLock { canUserUserIDSendStateEventUnderlyingReturnValue } } - set { canUserUserIDSendStateEventReturnValueLock.withLock { canUserUserIDSendStateEventUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserUserIDSendStateEventClosure: ((String, StateEventType) -> Result)? - - func canUser(userID: String, sendStateEvent event: StateEventType) -> Result { - canUserUserIDSendStateEventCallsCountLock.withLock { canUserUserIDSendStateEventUnderlyingCallsCount += 1 } - canUserUserIDSendStateEventReceivedArguments = (userID: userID, event: event) - canUserUserIDSendStateEventReceivedInvocationsLock.withLock { canUserUserIDSendStateEventUnderlyingReceivedInvocations.append((userID: userID, event: event)) } - if let canUserUserIDSendStateEventClosure = canUserUserIDSendStateEventClosure { - return canUserUserIDSendStateEventClosure(userID, event) - } else { - return canUserUserIDSendStateEventReturnValue - } - } - //MARK: - canUserInvite - - private let canUserInviteUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserInviteUserIDUnderlyingCallsCount = 0 - var canUserInviteUserIDCallsCount: Int { - get { canUserInviteUserIDCallsCountLock.withLock { canUserInviteUserIDUnderlyingCallsCount } } - set { canUserInviteUserIDCallsCountLock.withLock { canUserInviteUserIDUnderlyingCallsCount = newValue } } - } - var canUserInviteUserIDCalled: Bool { - return canUserInviteUserIDCallsCount > 0 - } - private let canUserInviteUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserInviteUserIDUnderlyingReceivedUserID: String? - var canUserInviteUserIDReceivedUserID: String? { - get { canUserInviteUserIDReceivedUserIDLock.withLock { canUserInviteUserIDUnderlyingReceivedUserID } } - set { canUserInviteUserIDReceivedUserIDLock.withLock { canUserInviteUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserInviteUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserInviteUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserInviteUserIDReceivedInvocations: [String] { - get { canUserInviteUserIDReceivedInvocationsLock.withLock { canUserInviteUserIDUnderlyingReceivedInvocations } } - set { canUserInviteUserIDReceivedInvocationsLock.withLock { canUserInviteUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserInviteUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserInviteUserIDUnderlyingReturnValue: Result! - var canUserInviteUserIDReturnValue: Result! { - get { canUserInviteUserIDReturnValueLock.withLock { canUserInviteUserIDUnderlyingReturnValue } } - set { canUserInviteUserIDReturnValueLock.withLock { canUserInviteUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserInviteUserIDClosure: ((String) -> Result)? - - func canUserInvite(userID: String) -> Result { - canUserInviteUserIDCallsCountLock.withLock { canUserInviteUserIDUnderlyingCallsCount += 1 } - canUserInviteUserIDReceivedUserID = userID - canUserInviteUserIDReceivedInvocationsLock.withLock { canUserInviteUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserInviteUserIDClosure = canUserInviteUserIDClosure { - return canUserInviteUserIDClosure(userID) - } else { - return canUserInviteUserIDReturnValue - } - } - //MARK: - canUserRedactOther - - private let canUserRedactOtherUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserRedactOtherUserIDUnderlyingCallsCount = 0 - var canUserRedactOtherUserIDCallsCount: Int { - get { canUserRedactOtherUserIDCallsCountLock.withLock { canUserRedactOtherUserIDUnderlyingCallsCount } } - set { canUserRedactOtherUserIDCallsCountLock.withLock { canUserRedactOtherUserIDUnderlyingCallsCount = newValue } } - } - var canUserRedactOtherUserIDCalled: Bool { - return canUserRedactOtherUserIDCallsCount > 0 - } - private let canUserRedactOtherUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserRedactOtherUserIDUnderlyingReceivedUserID: String? - var canUserRedactOtherUserIDReceivedUserID: String? { - get { canUserRedactOtherUserIDReceivedUserIDLock.withLock { canUserRedactOtherUserIDUnderlyingReceivedUserID } } - set { canUserRedactOtherUserIDReceivedUserIDLock.withLock { canUserRedactOtherUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserRedactOtherUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserRedactOtherUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserRedactOtherUserIDReceivedInvocations: [String] { - get { canUserRedactOtherUserIDReceivedInvocationsLock.withLock { canUserRedactOtherUserIDUnderlyingReceivedInvocations } } - set { canUserRedactOtherUserIDReceivedInvocationsLock.withLock { canUserRedactOtherUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserRedactOtherUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserRedactOtherUserIDUnderlyingReturnValue: Result! - var canUserRedactOtherUserIDReturnValue: Result! { - get { canUserRedactOtherUserIDReturnValueLock.withLock { canUserRedactOtherUserIDUnderlyingReturnValue } } - set { canUserRedactOtherUserIDReturnValueLock.withLock { canUserRedactOtherUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserRedactOtherUserIDClosure: ((String) -> Result)? - - func canUserRedactOther(userID: String) -> Result { - canUserRedactOtherUserIDCallsCountLock.withLock { canUserRedactOtherUserIDUnderlyingCallsCount += 1 } - canUserRedactOtherUserIDReceivedUserID = userID - canUserRedactOtherUserIDReceivedInvocationsLock.withLock { canUserRedactOtherUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserRedactOtherUserIDClosure = canUserRedactOtherUserIDClosure { - return canUserRedactOtherUserIDClosure(userID) - } else { - return canUserRedactOtherUserIDReturnValue - } - } - //MARK: - canUserRedactOwn - - private let canUserRedactOwnUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserRedactOwnUserIDUnderlyingCallsCount = 0 - var canUserRedactOwnUserIDCallsCount: Int { - get { canUserRedactOwnUserIDCallsCountLock.withLock { canUserRedactOwnUserIDUnderlyingCallsCount } } - set { canUserRedactOwnUserIDCallsCountLock.withLock { canUserRedactOwnUserIDUnderlyingCallsCount = newValue } } - } - var canUserRedactOwnUserIDCalled: Bool { - return canUserRedactOwnUserIDCallsCount > 0 - } - private let canUserRedactOwnUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserRedactOwnUserIDUnderlyingReceivedUserID: String? - var canUserRedactOwnUserIDReceivedUserID: String? { - get { canUserRedactOwnUserIDReceivedUserIDLock.withLock { canUserRedactOwnUserIDUnderlyingReceivedUserID } } - set { canUserRedactOwnUserIDReceivedUserIDLock.withLock { canUserRedactOwnUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserRedactOwnUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserRedactOwnUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserRedactOwnUserIDReceivedInvocations: [String] { - get { canUserRedactOwnUserIDReceivedInvocationsLock.withLock { canUserRedactOwnUserIDUnderlyingReceivedInvocations } } - set { canUserRedactOwnUserIDReceivedInvocationsLock.withLock { canUserRedactOwnUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserRedactOwnUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserRedactOwnUserIDUnderlyingReturnValue: Result! - var canUserRedactOwnUserIDReturnValue: Result! { - get { canUserRedactOwnUserIDReturnValueLock.withLock { canUserRedactOwnUserIDUnderlyingReturnValue } } - set { canUserRedactOwnUserIDReturnValueLock.withLock { canUserRedactOwnUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserRedactOwnUserIDClosure: ((String) -> Result)? - - func canUserRedactOwn(userID: String) -> Result { - canUserRedactOwnUserIDCallsCountLock.withLock { canUserRedactOwnUserIDUnderlyingCallsCount += 1 } - canUserRedactOwnUserIDReceivedUserID = userID - canUserRedactOwnUserIDReceivedInvocationsLock.withLock { canUserRedactOwnUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserRedactOwnUserIDClosure = canUserRedactOwnUserIDClosure { - return canUserRedactOwnUserIDClosure(userID) - } else { - return canUserRedactOwnUserIDReturnValue - } - } - //MARK: - canUserKick - - private let canUserKickUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserKickUserIDUnderlyingCallsCount = 0 - var canUserKickUserIDCallsCount: Int { - get { canUserKickUserIDCallsCountLock.withLock { canUserKickUserIDUnderlyingCallsCount } } - set { canUserKickUserIDCallsCountLock.withLock { canUserKickUserIDUnderlyingCallsCount = newValue } } - } - var canUserKickUserIDCalled: Bool { - return canUserKickUserIDCallsCount > 0 - } - private let canUserKickUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserKickUserIDUnderlyingReceivedUserID: String? - var canUserKickUserIDReceivedUserID: String? { - get { canUserKickUserIDReceivedUserIDLock.withLock { canUserKickUserIDUnderlyingReceivedUserID } } - set { canUserKickUserIDReceivedUserIDLock.withLock { canUserKickUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserKickUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserKickUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserKickUserIDReceivedInvocations: [String] { - get { canUserKickUserIDReceivedInvocationsLock.withLock { canUserKickUserIDUnderlyingReceivedInvocations } } - set { canUserKickUserIDReceivedInvocationsLock.withLock { canUserKickUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserKickUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserKickUserIDUnderlyingReturnValue: Result! - var canUserKickUserIDReturnValue: Result! { - get { canUserKickUserIDReturnValueLock.withLock { canUserKickUserIDUnderlyingReturnValue } } - set { canUserKickUserIDReturnValueLock.withLock { canUserKickUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserKickUserIDClosure: ((String) -> Result)? - - func canUserKick(userID: String) -> Result { - canUserKickUserIDCallsCountLock.withLock { canUserKickUserIDUnderlyingCallsCount += 1 } - canUserKickUserIDReceivedUserID = userID - canUserKickUserIDReceivedInvocationsLock.withLock { canUserKickUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserKickUserIDClosure = canUserKickUserIDClosure { - return canUserKickUserIDClosure(userID) - } else { - return canUserKickUserIDReturnValue - } - } - //MARK: - canUserBan - - private let canUserBanUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserBanUserIDUnderlyingCallsCount = 0 - var canUserBanUserIDCallsCount: Int { - get { canUserBanUserIDCallsCountLock.withLock { canUserBanUserIDUnderlyingCallsCount } } - set { canUserBanUserIDCallsCountLock.withLock { canUserBanUserIDUnderlyingCallsCount = newValue } } - } - var canUserBanUserIDCalled: Bool { - return canUserBanUserIDCallsCount > 0 - } - private let canUserBanUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserBanUserIDUnderlyingReceivedUserID: String? - var canUserBanUserIDReceivedUserID: String? { - get { canUserBanUserIDReceivedUserIDLock.withLock { canUserBanUserIDUnderlyingReceivedUserID } } - set { canUserBanUserIDReceivedUserIDLock.withLock { canUserBanUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserBanUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserBanUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserBanUserIDReceivedInvocations: [String] { - get { canUserBanUserIDReceivedInvocationsLock.withLock { canUserBanUserIDUnderlyingReceivedInvocations } } - set { canUserBanUserIDReceivedInvocationsLock.withLock { canUserBanUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserBanUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserBanUserIDUnderlyingReturnValue: Result! - var canUserBanUserIDReturnValue: Result! { - get { canUserBanUserIDReturnValueLock.withLock { canUserBanUserIDUnderlyingReturnValue } } - set { canUserBanUserIDReturnValueLock.withLock { canUserBanUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserBanUserIDClosure: ((String) -> Result)? - - func canUserBan(userID: String) -> Result { - canUserBanUserIDCallsCountLock.withLock { canUserBanUserIDUnderlyingCallsCount += 1 } - canUserBanUserIDReceivedUserID = userID - canUserBanUserIDReceivedInvocationsLock.withLock { canUserBanUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserBanUserIDClosure = canUserBanUserIDClosure { - return canUserBanUserIDClosure(userID) - } else { - return canUserBanUserIDReturnValue - } - } - //MARK: - canUserTriggerRoomNotification - - private let canUserTriggerRoomNotificationUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = 0 - var canUserTriggerRoomNotificationUserIDCallsCount: Int { - get { canUserTriggerRoomNotificationUserIDCallsCountLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingCallsCount } } - set { canUserTriggerRoomNotificationUserIDCallsCountLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingCallsCount = newValue } } - } - var canUserTriggerRoomNotificationUserIDCalled: Bool { - return canUserTriggerRoomNotificationUserIDCallsCount > 0 - } - private let canUserTriggerRoomNotificationUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserTriggerRoomNotificationUserIDUnderlyingReceivedUserID: String? - var canUserTriggerRoomNotificationUserIDReceivedUserID: String? { - get { canUserTriggerRoomNotificationUserIDReceivedUserIDLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReceivedUserID } } - set { canUserTriggerRoomNotificationUserIDReceivedUserIDLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserTriggerRoomNotificationUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserTriggerRoomNotificationUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserTriggerRoomNotificationUserIDReceivedInvocations: [String] { - get { canUserTriggerRoomNotificationUserIDReceivedInvocationsLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReceivedInvocations } } - set { canUserTriggerRoomNotificationUserIDReceivedInvocationsLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserTriggerRoomNotificationUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserTriggerRoomNotificationUserIDUnderlyingReturnValue: Result! - var canUserTriggerRoomNotificationUserIDReturnValue: Result! { - get { canUserTriggerRoomNotificationUserIDReturnValueLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReturnValue } } - set { canUserTriggerRoomNotificationUserIDReturnValueLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserTriggerRoomNotificationUserIDClosure: ((String) -> Result)? - - func canUserTriggerRoomNotification(userID: String) -> Result { - canUserTriggerRoomNotificationUserIDCallsCountLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingCallsCount += 1 } - canUserTriggerRoomNotificationUserIDReceivedUserID = userID - canUserTriggerRoomNotificationUserIDReceivedInvocationsLock.withLock { canUserTriggerRoomNotificationUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserTriggerRoomNotificationUserIDClosure = canUserTriggerRoomNotificationUserIDClosure { - return canUserTriggerRoomNotificationUserIDClosure(userID) - } else { - return canUserTriggerRoomNotificationUserIDReturnValue - } - } - //MARK: - canUserPinOrUnpin - - private let canUserPinOrUnpinUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserPinOrUnpinUserIDUnderlyingCallsCount = 0 - var canUserPinOrUnpinUserIDCallsCount: Int { - get { canUserPinOrUnpinUserIDCallsCountLock.withLock { canUserPinOrUnpinUserIDUnderlyingCallsCount } } - set { canUserPinOrUnpinUserIDCallsCountLock.withLock { canUserPinOrUnpinUserIDUnderlyingCallsCount = newValue } } - } - var canUserPinOrUnpinUserIDCalled: Bool { - return canUserPinOrUnpinUserIDCallsCount > 0 - } - private let canUserPinOrUnpinUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserPinOrUnpinUserIDUnderlyingReceivedUserID: String? - var canUserPinOrUnpinUserIDReceivedUserID: String? { - get { canUserPinOrUnpinUserIDReceivedUserIDLock.withLock { canUserPinOrUnpinUserIDUnderlyingReceivedUserID } } - set { canUserPinOrUnpinUserIDReceivedUserIDLock.withLock { canUserPinOrUnpinUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserPinOrUnpinUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserPinOrUnpinUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserPinOrUnpinUserIDReceivedInvocations: [String] { - get { canUserPinOrUnpinUserIDReceivedInvocationsLock.withLock { canUserPinOrUnpinUserIDUnderlyingReceivedInvocations } } - set { canUserPinOrUnpinUserIDReceivedInvocationsLock.withLock { canUserPinOrUnpinUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserPinOrUnpinUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserPinOrUnpinUserIDUnderlyingReturnValue: Result! - var canUserPinOrUnpinUserIDReturnValue: Result! { - get { canUserPinOrUnpinUserIDReturnValueLock.withLock { canUserPinOrUnpinUserIDUnderlyingReturnValue } } - set { canUserPinOrUnpinUserIDReturnValueLock.withLock { canUserPinOrUnpinUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserPinOrUnpinUserIDClosure: ((String) -> Result)? - - func canUserPinOrUnpin(userID: String) -> Result { - canUserPinOrUnpinUserIDCallsCountLock.withLock { canUserPinOrUnpinUserIDUnderlyingCallsCount += 1 } - canUserPinOrUnpinUserIDReceivedUserID = userID - canUserPinOrUnpinUserIDReceivedInvocationsLock.withLock { canUserPinOrUnpinUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserPinOrUnpinUserIDClosure = canUserPinOrUnpinUserIDClosure { - return canUserPinOrUnpinUserIDClosure(userID) - } else { - return canUserPinOrUnpinUserIDReturnValue - } - } - //MARK: - canUserJoinCall - - private let canUserJoinCallUserIDCallsCountLock = NSLock() - private nonisolated(unsafe) var canUserJoinCallUserIDUnderlyingCallsCount = 0 - var canUserJoinCallUserIDCallsCount: Int { - get { canUserJoinCallUserIDCallsCountLock.withLock { canUserJoinCallUserIDUnderlyingCallsCount } } - set { canUserJoinCallUserIDCallsCountLock.withLock { canUserJoinCallUserIDUnderlyingCallsCount = newValue } } - } - var canUserJoinCallUserIDCalled: Bool { - return canUserJoinCallUserIDCallsCount > 0 - } - private let canUserJoinCallUserIDReceivedUserIDLock = NSLock() - private nonisolated(unsafe) var canUserJoinCallUserIDUnderlyingReceivedUserID: String? - var canUserJoinCallUserIDReceivedUserID: String? { - get { canUserJoinCallUserIDReceivedUserIDLock.withLock { canUserJoinCallUserIDUnderlyingReceivedUserID } } - set { canUserJoinCallUserIDReceivedUserIDLock.withLock { canUserJoinCallUserIDUnderlyingReceivedUserID = newValue } } - } - private let canUserJoinCallUserIDReceivedInvocationsLock = NSLock() - private nonisolated(unsafe) var canUserJoinCallUserIDUnderlyingReceivedInvocations: [String] = [] - var canUserJoinCallUserIDReceivedInvocations: [String] { - get { canUserJoinCallUserIDReceivedInvocationsLock.withLock { canUserJoinCallUserIDUnderlyingReceivedInvocations } } - set { canUserJoinCallUserIDReceivedInvocationsLock.withLock { canUserJoinCallUserIDUnderlyingReceivedInvocations = newValue } } - } - - private let canUserJoinCallUserIDReturnValueLock = NSLock() - private nonisolated(unsafe) var canUserJoinCallUserIDUnderlyingReturnValue: Result! - var canUserJoinCallUserIDReturnValue: Result! { - get { canUserJoinCallUserIDReturnValueLock.withLock { canUserJoinCallUserIDUnderlyingReturnValue } } - set { canUserJoinCallUserIDReturnValueLock.withLock { canUserJoinCallUserIDUnderlyingReturnValue = newValue } } - } - nonisolated(unsafe) var canUserJoinCallUserIDClosure: ((String) -> Result)? - - func canUserJoinCall(userID: String) -> Result { - canUserJoinCallUserIDCallsCountLock.withLock { canUserJoinCallUserIDUnderlyingCallsCount += 1 } - canUserJoinCallUserIDReceivedUserID = userID - canUserJoinCallUserIDReceivedInvocationsLock.withLock { canUserJoinCallUserIDUnderlyingReceivedInvocations.append(userID) } - if let canUserJoinCallUserIDClosure = canUserJoinCallUserIDClosure { - return canUserJoinCallUserIDClosure(userID) - } else { - return canUserJoinCallUserIDReturnValue - } - } } nonisolated class RoomPreviewProxyMock: RoomPreviewProxyProtocol, @unchecked Sendable { var info: RoomPreviewInfoProxy { @@ -12208,11 +11416,6 @@ nonisolated class TimelineControllerFactoryMock: TimelineControllerFactoryProtoc } } nonisolated class TimelineControllerMock: TimelineControllerProtocol, @unchecked Sendable { - var roomID: String { - get { return underlyingRoomID } - set(value) { underlyingRoomID = value } - } - nonisolated(unsafe) var underlyingRoomID: String! var timelineKind: TimelineKind { get { return underlyingTimelineKind } set(value) { underlyingTimelineKind = value } diff --git a/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift b/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift index d15be42b8..6446fca12 100644 --- a/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift @@ -25,8 +25,8 @@ extension InvitedRoomProxyMock { convenience init(_ configuration: InvitedRoomProxyMockConfiguration) { self.init() id = configuration.id - inviter = configuration.inviter info = RoomInfoProxyMock(configuration) + inviter = configuration.inviter rejectInvitationReturnValue = .success(()) } @@ -38,9 +38,7 @@ extension RoomInfoProxyMock { id = configuration.id isEncrypted = false - creators = [] displayName = configuration.name - rawName = nil topic = nil avatarURL = configuration.avatarURL @@ -52,20 +50,11 @@ extension RoomInfoProxyMock { canonicalAlias = nil alternativeAliases = [] membership = .knocked - inviter = .init(configuration.inviter) heroes = [] activeMembersCount = configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count - invitedMembersCount = configuration.members.filter { $0.membership == .invite }.count joinedMembersCount = configuration.members.filter { $0.membership == .join }.count - highlightCount = 0 - notificationCount = 0 - cachedUserDefinedNotificationMode = nil hasRoomCall = false activeRoomCallParticipants = [] - isMarkedUnread = false - unreadMessagesCount = 0 - unreadNotificationsCount = 0 - unreadMentionsCount = 0 pinnedEventIDs = [] joinRule = .invite historyVisibility = .shared diff --git a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift index 3e349ef1f..cd0190b33 100644 --- a/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/JoinedRoomProxyMock.swift @@ -89,33 +89,18 @@ extension JoinedRoomProxyMock { applyPowerLevelChangesReturnValue = .success(()) resetPowerLevelsReturnValue = .success(()) - suggestedRoleForClosure = { [weak self] userID in - guard case .success(let member) = await self?.getMember(userID: userID) else { - return .failure(.sdkError(RoomProxyMockError.generic)) - } - return .success(member.role.rustRole) - } updatePowerLevelsForUsersReturnValue = .success(()) let powerLevelsProxyMock = RoomPowerLevelsProxyMock(configuration.powerLevelsConfiguration) - powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { [weak self] userID, _ in - .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) - } powerLevelsProxyMock.canOwnUserSendStateEventClosure = { [weak self] _ in self?.membersPublisher.value.first { $0.userID == configuration.ownUserID }?.role ?? .user != .user } - powerLevelsProxyMock.canUserKickUserIDClosure = { [weak self] userID in - .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) - } powerLevelsProxyMock.canOwnUserKickClosure = { [weak self] in self?.membersPublisher.value.first { $0.userID == configuration.ownUserID }?.role ?? .user != .user } - powerLevelsProxyMock.canUserBanUserIDClosure = { [weak self] userID in - .success(self?.membersPublisher.value.first { $0.userID == userID }?.role ?? .user != .user) - } powerLevelsProxyMock.canOwnUserBanClosure = { [weak self] in self?.membersPublisher.value.first { $0.userID == configuration.ownUserID }?.role ?? .user != .user } @@ -124,8 +109,6 @@ extension JoinedRoomProxyMock { self?.membersPublisher.value.first { $0.userID == configuration.ownUserID }?.role.isAdminOrHigher ?? false } - powerLevelsReturnValue = .success(powerLevelsProxyMock) - inviteUserIDReturnValue = .success(()) kickUserReasonReturnValue = .success(()) banUserReasonReturnValue = .success(()) @@ -165,9 +148,7 @@ extension RoomInfoProxyMock { id = configuration.id isEncrypted = configuration.isEncrypted - creators = [] displayName = configuration.name - rawName = configuration.name topic = configuration.topic avatarURL = configuration.avatarURL isDirect = configuration.isDirect @@ -177,21 +158,12 @@ extension RoomInfoProxyMock { canonicalAlias = configuration.canonicalAlias alternativeAliases = configuration.alternativeAliases membership = configuration.membership - inviter = configuration.inviter heroes = configuration.heroes.map(RoomHero.init) activeMembersCount = configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count - invitedMembersCount = configuration.members.filter { $0.membership == .invite }.count joinedMembersCount = configuration.members.filter { $0.membership == .join }.count isDM = isDirect && activeMembersCount <= 2 - highlightCount = 0 - notificationCount = 0 - cachedUserDefinedNotificationMode = .allMessages hasRoomCall = configuration.hasOngoingCall activeRoomCallParticipants = [] - isMarkedUnread = false - unreadMessagesCount = 0 - unreadNotificationsCount = 0 - unreadMentionsCount = 0 pinnedEventIDs = configuration.pinnedEventIDs joinRule = configuration.joinRule historyVisibility = configuration.historyVisibility diff --git a/ElementX/Sources/Mocks/KnockedRoomProxyMock.swift b/ElementX/Sources/Mocks/KnockedRoomProxyMock.swift index fe27aa387..bad61e220 100644 --- a/ElementX/Sources/Mocks/KnockedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/KnockedRoomProxyMock.swift @@ -33,9 +33,7 @@ extension RoomInfoProxyMock { id = configuration.id isEncrypted = false - creators = [] displayName = configuration.name - rawName = nil topic = nil avatarURL = configuration.avatarURL @@ -47,20 +45,11 @@ extension RoomInfoProxyMock { canonicalAlias = nil alternativeAliases = [] membership = .knocked - inviter = nil heroes = [] activeMembersCount = configuration.members.filter { $0.membership == .join || $0.membership == .invite }.count - invitedMembersCount = configuration.members.filter { $0.membership == .invite }.count joinedMembersCount = configuration.members.filter { $0.membership == .join }.count - highlightCount = 0 - notificationCount = 0 - cachedUserDefinedNotificationMode = nil hasRoomCall = false activeRoomCallParticipants = [] - isMarkedUnread = false - unreadMessagesCount = 0 - unreadNotificationsCount = 0 - unreadMentionsCount = 0 pinnedEventIDs = [] joinRule = .knock historyVisibility = .shared diff --git a/ElementX/Sources/Mocks/MediaProviderMock.swift b/ElementX/Sources/Mocks/MediaProviderMock.swift index cc7dca195..640e1f041 100644 --- a/ElementX/Sources/Mocks/MediaProviderMock.swift +++ b/ElementX/Sources/Mocks/MediaProviderMock.swift @@ -45,14 +45,6 @@ extension MediaProviderMock { return UIImage(systemName: "photo") } - loadImageFromSourceSizeClosure = { _, _ in - guard let image = UIImage(systemName: "photo") else { - fatalError() - } - - return .success(image) - } - loadImageDataFromSourceClosure = { _ in guard let image = UIImage(systemName: "photo"), let data = image.pngData() else { diff --git a/ElementX/Sources/Mocks/NotificationItemProxyMock.swift b/ElementX/Sources/Mocks/NotificationItemProxyMock.swift index 519ed3887..96f3bf56e 100644 --- a/ElementX/Sources/Mocks/NotificationItemProxyMock.swift +++ b/ElementX/Sources/Mocks/NotificationItemProxyMock.swift @@ -46,8 +46,6 @@ extension NotificationItemProxyMock { senderDisplayName = configuration.senderDisplayName roomAvatarMediaSource = configuration.roomAvatarMediaSource roomDisplayName = configuration.roomDisplayName - roomJoinedMembers = configuration.roomJoinedMembers - isRoomDirect = configuration.isRoomDirect isRoomPrivate = configuration.isRoomPrivate isNoisy = configuration.isNoisy hasMention = configuration.hasMention diff --git a/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift b/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift index 33c86fffc..c7157d514 100644 --- a/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift +++ b/ElementX/Sources/Mocks/RoomPowerLevelsProxyMock.swift @@ -39,17 +39,6 @@ import MatrixRustSDK canOwnUserPinOrUnpinReturnValue = configuration.canUserPin canOwnUserJoinCallReturnValue = configuration.canUserJoinCall canOwnUserEditRolesAndPermissionsReturnValue = configuration.canUserEditRoomsAndPermissions - - canUserUserIDSendMessageReturnValue = .success(configuration.canUserSendMessage) - canUserUserIDSendStateEventReturnValue = .success(configuration.canUserSendState) - canUserInviteUserIDReturnValue = .success(configuration.canUserInvite) - canUserRedactOtherUserIDReturnValue = .success(configuration.canUserRedactOther) - canUserRedactOwnUserIDReturnValue = .success(configuration.canUserRedactOwn) - canUserKickUserIDReturnValue = .success(configuration.canUserKick) - canUserBanUserIDReturnValue = .success(configuration.canUserBan) - canUserTriggerRoomNotificationUserIDReturnValue = .success(configuration.canUserTriggerRoomNotification) - canUserPinOrUnpinUserIDReturnValue = .success(configuration.canUserPin) - canUserJoinCallUserIDReturnValue = .success(configuration.canUserJoinCall) } } diff --git a/ElementX/Sources/Mocks/SignallingTimelineItemProviderMock.swift b/ElementX/Sources/Mocks/SignallingTimelineItemProviderMock.swift index 4cc6cedd0..a7cd533d4 100644 --- a/ElementX/Sources/Mocks/SignallingTimelineItemProviderMock.swift +++ b/ElementX/Sources/Mocks/SignallingTimelineItemProviderMock.swift @@ -5,8 +5,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - import Combine import Foundation import MatrixRustSDK diff --git a/ElementX/Sources/Mocks/TimelineControllerMock.swift b/ElementX/Sources/Mocks/TimelineControllerMock.swift index a4ed0b813..0a9660b19 100644 --- a/ElementX/Sources/Mocks/TimelineControllerMock.swift +++ b/ElementX/Sources/Mocks/TimelineControllerMock.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - import Combine import Foundation import MatrixRustSDK @@ -45,7 +43,6 @@ struct TimelineControllerMockConfiguration { let timelineItemsTimestamps = configuration.timelineItemsTimestamps callbacks = PassthroughSubject() - roomID = roomProxy?.id ?? "MockRoomIdentifier" timelineKind = configuration.timelineKind paginationState = configuration.paginationState timelineItems = configuration.timelineItems diff --git a/ElementX/Sources/Other/AccessibilityIdentifiers.swift b/ElementX/Sources/Other/AccessibilityIdentifiers.swift index 5129d513e..f1972a9d5 100644 --- a/ElementX/Sources/Other/AccessibilityIdentifiers.swift +++ b/ElementX/Sources/Other/AccessibilityIdentifiers.swift @@ -195,7 +195,6 @@ enum A11yIdentifiers { struct RoomDetailsScreen { let addTopic = "room_details-add_topic" let avatar = "room_details-avatar" - let dmAvatar = "room_details-dm_avatar" let people = "room_details-people" let notifications = "room_details-notifications" let pollsHistory = "room_details-polls_history" @@ -333,8 +332,6 @@ enum A11yIdentifiers { } struct SpacesScreen { - let userAvatar = "spaces_screen-user_avatar" - let roomNamePrefix = "spaces_screen-room_name" func spaceRoomName(_ name: String) -> String { "\(roomNamePrefix):\(name)" diff --git a/ElementX/Sources/Other/CallIntent.swift b/ElementX/Sources/Other/CallIntent.swift index 384ad1e01..1a7822629 100644 --- a/ElementX/Sources/Other/CallIntent.swift +++ b/ElementX/Sources/Other/CallIntent.swift @@ -13,7 +13,6 @@ nonisolated enum CallIntent: String, Codable, CaseIterable { } nonisolated extension CallIntent { - // periphery:ignore - Unused, but added to detect new cases when updating the SDK. init(rustCallIntent: MatrixRustSDK.RtcCallIntent) { switch rustCallIntent { case .audio: self = .audio @@ -21,6 +20,7 @@ nonisolated extension CallIntent { } } + // periphery:ignore - might be useful to have var rustCallIntent: MatrixRustSDK.RtcCallIntent { switch self { case .audio: .audio diff --git a/ElementX/Sources/Other/CancellableTask.swift b/ElementX/Sources/Other/CancellableTask.swift index 0ccc74f8d..b02ae16d6 100644 --- a/ElementX/Sources/Other/CancellableTask.swift +++ b/ElementX/Sources/Other/CancellableTask.swift @@ -8,7 +8,6 @@ import Foundation -// periphery:ignore - property wrappers generate false positives @propertyWrapper struct CancellableTask { private var storedValue: Task? diff --git a/ElementX/Sources/Other/Extensions/AVMetadataMachineReadableCodeObject.swift b/ElementX/Sources/Other/Extensions/AVMetadataMachineReadableCodeObject.swift index 7505da132..4df841731 100644 --- a/ElementX/Sources/Other/Extensions/AVMetadataMachineReadableCodeObject.swift +++ b/ElementX/Sources/Other/Extensions/AVMetadataMachineReadableCodeObject.swift @@ -97,10 +97,6 @@ private nonisolated extension [Bit] { try takeBits(8) } - mutating func takeUInt16() throws(BitError) -> UInt16 { - try takeBits16(16) - } - mutating func takeBinarySegment(_ version: Int) throws(BitError) -> [UInt8] { let characterCountLength = version > 9 ? 16 : 8 let charactersCount = try takeBits16(characterCountLength) diff --git a/ElementX/Sources/Other/Extensions/AttributedString.swift b/ElementX/Sources/Other/Extensions/AttributedString.swift index 8e5c89d91..e045cd297 100644 --- a/ElementX/Sources/Other/Extensions/AttributedString.swift +++ b/ElementX/Sources/Other/Extensions/AttributedString.swift @@ -45,18 +45,6 @@ nonisolated extension AttributedString { return components } - /// Replaces the specified placeholder with a string that links to the specified URL. - /// - Parameters: - /// - linkPlaceholder: The text in the string that will be replaced. Make sure this is unique within the string. - /// - string: The text for the link that will be substituted into the placeholder. - /// - url: The URL that the link should open. - mutating func replace(_ linkPlaceholder: String, with string: String, asLinkTo url: URL) { - // Replace the placeholder with a link. - var replacement = AttributedString(string) - replacement.link = url - replace(linkPlaceholder, with: replacement) - } - /// Replaces the specified placeholder with the supplied attributed string. /// - Parameters: /// - placeholder: The text in the string that will be replaced. Make sure this is unique within the string. diff --git a/ElementX/Sources/Other/Extensions/CompoundIcon.swift b/ElementX/Sources/Other/Extensions/CompoundIcon.swift index e4a852c33..f99067dc2 100644 --- a/ElementX/Sources/Other/Extensions/CompoundIcon.swift +++ b/ElementX/Sources/Other/Extensions/CompoundIcon.swift @@ -13,8 +13,4 @@ extension CompoundIcon { init(asset: ImageAsset) { self.init(customImage: asset.swiftUIImage) } - - init(asset: ImageAsset, size: CompoundIcon.Size, relativeTo font: Font) { - self.init(customImage: asset.swiftUIImage, size: size, relativeTo: font) - } } diff --git a/ElementX/Sources/Other/Extensions/ConfirmationDialog.swift b/ElementX/Sources/Other/Extensions/ConfirmationDialog.swift index 0a68653d4..215a2b33a 100644 --- a/ElementX/Sources/Other/Extensions/ConfirmationDialog.swift +++ b/ElementX/Sources/Other/Extensions/ConfirmationDialog.swift @@ -13,19 +13,6 @@ protocol ConfirmationDialogProtocol { } extension View { - func confirmationDialog(item: Binding, - titleVisibility: Visibility = .automatic, - @ViewBuilder actions: (Item) -> Actions) -> some View { - let binding = Binding(get: { - item.wrappedValue != nil - }, set: { newValue in - if !newValue { - item.wrappedValue = nil - } - }) - return confirmationDialog(item.wrappedValue?.title ?? "", isPresented: binding, titleVisibility: titleVisibility, presenting: item.wrappedValue, actions: actions) - } - // periphery: ignore - not used yet but might be useful func confirmationDialog(item: Binding, titleVisibility: Visibility = .automatic, diff --git a/ElementX/Sources/Other/Extensions/Label.swift b/ElementX/Sources/Other/Extensions/Label.swift deleted file mode 100644 index a2d734f9f..000000000 --- a/ElementX/Sources/Other/Extensions/Label.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright 2025 Element Creations Ltd. -// Copyright 2022-2025 New Vector Ltd. -// -// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. -// Please see LICENSE files in the repository root for full details. -// - -import Compound -import SwiftUI - -extension Label { - /// Creates a label using a local asset as a Compound icon and a title generated from a string. - /// The icon size will be 24pt, scaling relative to the `bodyLG` with Dynamic Type. - /// - Parameters: - /// - title: A string used as the label’s title. - /// - iconAsset: The asset to use as the custom Compound icon. - /// - /// The supplied asset should have a square frame or it may end up distorted. - init(_ title: some StringProtocol, iconAsset: ImageAsset) where Title == Text, Icon == CompoundIcon { - self.init { - Text(title) - } icon: { - CompoundIcon(customImage: iconAsset.swiftUIImage) - } - } - - /// Creates a label using a local asset as a Compound icon and a title generated from a string. - /// - Parameters: - /// - title: A string used as the label’s title. - /// - iconAsset: The asset to use as the custom Compound icon. - /// - size: The size of the icon. - /// - font: The font that the icon will scale relative to for Dynamic Type. - /// - /// The supplied asset should have a square frame or it may end up distorted. - init(_ title: some StringProtocol, - iconAsset: ImageAsset, - iconSize: CompoundIcon.Size, - relativeTo font: Font) where Title == Text, Icon == CompoundIcon { - self.init { - Text(title) - } icon: { - CompoundIcon(customImage: iconAsset.swiftUIImage, size: iconSize, relativeTo: font) - } - } -} diff --git a/ElementX/Sources/Other/Extensions/String.swift b/ElementX/Sources/Other/Extensions/String.swift index e0aa979eb..bd3e45a41 100644 --- a/ElementX/Sources/Other/Extensions/String.swift +++ b/ElementX/Sources/Other/Extensions/String.swift @@ -10,6 +10,7 @@ import SwiftUI import UniformTypeIdentifiers nonisolated extension String { + // periphery:ignore - might be useful to have /// Returns the string as an `AttributedString` with the specified character tinted in a different color. /// - Parameters: /// - character: The character to be tinted. diff --git a/ElementX/Sources/Other/Extensions/Task.swift b/ElementX/Sources/Other/Extensions/Task.swift index 1f2f6324c..ef974dfe1 100644 --- a/ElementX/Sources/Other/Extensions/Task.swift +++ b/ElementX/Sources/Other/Extensions/Task.swift @@ -10,6 +10,7 @@ import Combine import Foundation public extension Task where Success == Never, Failure == Never { + // periphery:ignore - might be useful to have /// Dispatches the given closure onto the given queue, wrapped within /// a continuation to make it non-blocking and awaitable. /// diff --git a/ElementX/Sources/Other/Extensions/XCTestCase.swift b/ElementX/Sources/Other/Extensions/XCTestCase.swift deleted file mode 100644 index 590d3e856..000000000 --- a/ElementX/Sources/Other/Extensions/XCTestCase.swift +++ /dev/null @@ -1,194 +0,0 @@ -// -// Copyright 2025 Element Creations Ltd. -// Copyright 2023-2025 New Vector Ltd. -// -// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. -// Please see LICENSE files in the repository root for full details. -// - -import Combine -import XCTest - -extension XCTestCase { - /// XCTest utility that assists in subscribing to a publisher and deferring the fulfilment and results until some other actions have been performed. - /// - Parameters: - /// - publisher: The publisher to wait on. - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - until: callback that evaluates outputs until some condition is reached - /// - Returns: The deferred fulfilment to be executed after some actions and that returns the result of the publisher. - func deferFulfillment(_ publisher: P, - timeout: TimeInterval = 10, - message: String? = nil, - until condition: @escaping (P.Output) -> Bool) -> DeferredFulfillment { - var result: Result? - let expectation = expectation(description: message ?? "Awaiting publisher") - var hasFullfilled = false - let cancellable = publisher - .sink { completion in - switch completion { - case .failure(let error): - result = .failure(error) - expectation.fulfill() - case .finished: - break - } - } receiveValue: { value in - if condition(value), !hasFullfilled { - result = .success(value) - expectation.fulfill() - hasFullfilled = true - } - } - - return DeferredFulfillment { - await self.fulfillment(of: [expectation], timeout: timeout) - cancellable.cancel() - let unwrappedResult = try XCTUnwrap(result, "Awaited publisher did not produce any output") - return try unwrappedResult.get() - } - } - - /// XCTest utility that assists in observing an async sequence, deferring the fulfilment and results until some condition has been met. - /// - Parameters: - /// - asyncSequence: The sequence to wait on. - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - until: callback that evaluates outputs until some condition is reached - /// - Returns: The deferred fulfilment to be executed after some actions and that returns the result of the sequence. - func deferFulfillment(_ asyncSequence: any AsyncSequence, - timeout: TimeInterval = 10, - message: String? = nil, - until condition: @escaping (Value) -> Bool) -> DeferredFulfillment { - var result: Result? - let expectation = expectation(description: message ?? "Awaiting sequence") - var hasFulfilled = false - - let task = Task { - for await value in asyncSequence { - if condition(value), !hasFulfilled { - result = .success(value) - expectation.fulfill() - hasFulfilled = true - } - } - } - - return DeferredFulfillment { - await self.fulfillment(of: [expectation], timeout: timeout) - task.cancel() - let unwrappedResult = try XCTUnwrap(result, "Awaited sequence did not produce any output") - return try unwrappedResult.get() - } - } - - /// XCTest utility that assists in subscribing to a publisher and deferring the fulfilment and results until some other actions have been performed. - /// - Parameters: - /// - publisher: The publisher to wait on. - /// - keyPath: the key path for the expected values - /// - transitionValues: the values through which the keypath needs to transition through - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - Returns: The deferred fulfilment to be executed after some actions and that returns the result of the publisher. - func deferFulfillment, V: Equatable>(_ publisher: P, - keyPath: K, - transitionValues: [V], - timeout: TimeInterval = 10, - message: String? = nil) -> DeferredFulfillment { - var expectedOrder = transitionValues - return deferFulfillment(publisher, timeout: timeout, message: message) { value in - let receivedValue = value[keyPath: keyPath] - if let index = expectedOrder.firstIndex(where: { $0 == receivedValue }), index == 0 { - expectedOrder.remove(at: index) - } - - return expectedOrder.isEmpty - } - } - - /// XCTest utility that assists in subscribing to an async sequence and deferring the fulfilment and results until some other actions have been performed. - /// - Parameters: - /// - asyncSequence: The sequence to wait on. - /// - transitionValues: the values through which the sequence needs to transition through - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - Returns: The deferred fulfilment to be executed after some actions and that returns the result of the sequence. - func deferFulfillment(_ asyncSequence: any AsyncSequence, - transitionValues: [Value], - timeout: TimeInterval = 10, - message: String? = nil) -> DeferredFulfillment { - var expectedOrder = transitionValues - return deferFulfillment(asyncSequence, timeout: timeout, message: message) { value in - if let index = expectedOrder.firstIndex(where: { $0 == value }), index == 0 { - expectedOrder.remove(at: index) - } - - return expectedOrder.isEmpty - } - } - - /// XCTest utility that assists in subscribing to a publisher and deferring the failure for a particular value until some other actions have been performed. - /// - Parameters: - /// - publisher: The publisher to wait on. - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - until: callback that evaluates outputs until some condition is reached - /// - Returns: The deferred fulfilment to be executed after some actions. The publisher's result is not returned from this fulfilment. - func deferFailure(_ publisher: P, - timeout: TimeInterval, - message: String? = nil, - until condition: @escaping (P.Output) -> Bool) -> DeferredFulfillment where P.Failure == Never { - let expectation = expectation(description: message ?? "Awaiting publisher") - expectation.isInverted = true - var hasFulfilled = false - let cancellable = publisher - .sink { value in - if condition(value), !hasFulfilled { - expectation.fulfill() - hasFulfilled = true - } - } - - return DeferredFulfillment { - await self.fulfillment(of: [expectation], timeout: timeout) - cancellable.cancel() - } - } - - /// XCTest utility that assists in subscribing to an async sequence and deferring the failure for a particular value until some other actions have been performed. - /// - Parameters: - /// - asyncSequence: The sequence to wait on. - /// - timeout: A timeout after which we give up. - /// - message: An optional custom expectation message - /// - until: callback that evaluates outputs until some condition is reached - /// - Returns: The deferred fulfilment to be executed after some actions. The sequence's result is not returned from this fulfilment. - func deferFailure(_ asyncSequence: any AsyncSequence, - timeout: TimeInterval, - message: String? = nil, - until condition: @escaping (Value) -> Bool) -> DeferredFulfillment { - let expectation = expectation(description: message ?? "Awaiting sequence") - expectation.isInverted = true - var hasFulfilled = false - - let task = Task { - for await value in asyncSequence { - if condition(value), !hasFulfilled { - expectation.fulfill() - hasFulfilled = true - } - } - } - - return DeferredFulfillment { - await self.fulfillment(of: [expectation], timeout: timeout) - task.cancel() - } - } - - struct DeferredFulfillment { - let closure: () async throws -> T - @discardableResult func fulfill() async throws -> T { - try await closure() - } - } -} diff --git a/ElementX/Sources/Other/HTMLParsing/ElementXAttributeScope.swift b/ElementX/Sources/Other/HTMLParsing/ElementXAttributeScope.swift index 8719c3648..7d427083c 100644 --- a/ElementX/Sources/Other/HTMLParsing/ElementXAttributeScope.swift +++ b/ElementX/Sources/Other/HTMLParsing/ElementXAttributeScope.swift @@ -43,6 +43,7 @@ enum RoomAliasAttribute: AttributedStringKey { enum EventOnRoomIDAttribute: AttributedStringKey { struct Value: Hashable { let roomID: String + // periphery:ignore - used via the synthesized Hashable conformance let eventID: String } @@ -52,6 +53,7 @@ enum EventOnRoomIDAttribute: AttributedStringKey { enum EventOnRoomAliasAttribute: AttributedStringKey { struct Value: Hashable { let alias: String + // periphery:ignore - used via the synthesized Hashable conformance let eventID: String } @@ -73,25 +75,32 @@ enum InlineCodeAttribute: AttributedStringKey { static let name = "MXInlineCodeAttribute" } -// periphery: ignore - required to make NSAttributedString to AttributedString conversion even if not used directly nonisolated extension AttributeScopes { struct ElementXAttributes: AttributeScope { let blockquote: BlockquoteAttribute let userID: UserIDAttribute + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly let userDisplayName: UserDisplayNameAttribute + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly let roomDisplayName: RoomDisplayNameAttribute let roomID: RoomIDAttribute let roomAlias: RoomAliasAttribute let eventOnRoomID: EventOnRoomIDAttribute let eventOnRoomAlias: EventOnRoomAliasAttribute + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly + let allUsersMention: AllUsersMentionAttribute let codeBlock: CodeBlockAttribute + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly let inlineCode: InlineCodeAttribute + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly + let swiftUI: SwiftUIAttributes + // periphery:ignore - required to make NSAttributedString to AttributedString conversion even if not used directly let uiKit: UIKitAttributes } diff --git a/ElementX/Sources/Other/InfoPlistReader.swift b/ElementX/Sources/Other/InfoPlistReader.swift index 9d54ab7b0..b7df0e6f4 100644 --- a/ElementX/Sources/Other/InfoPlistReader.swift +++ b/ElementX/Sources/Other/InfoPlistReader.swift @@ -94,6 +94,7 @@ nonisolated struct InfoPlistReader { infoPlistValue(forKey: Keys.productionAppName) } + // periphery:ignore - only used in release builds /// Whether or not the build is from the Nightly stream. var isNightlyBuild: Bool { infoPlistValue(forKey: Keys.isNightlyBuild) @@ -105,10 +106,6 @@ nonisolated struct InfoPlistReader { customSchemeForName("Application") } - var elementCallScheme: String { - customSchemeForName("Element Call") - } - // MARK: - Mention Pills /// Mention Pills UTType diff --git a/ElementX/Sources/Other/Logging/MXLog.swift b/ElementX/Sources/Other/Logging/MXLog.swift index 05a94eb97..8f4cf9d04 100644 --- a/ElementX/Sources/Other/Logging/MXLog.swift +++ b/ElementX/Sources/Other/Logging/MXLog.swift @@ -96,6 +96,7 @@ nonisolated enum MXLog { #if DEBUG private static let devPrefix = URL.documentsDirectory.pathComponents[2].uppercased() + // periphery:ignore - used for debugging /// A helper method for print debugging, only available on debug builds. /// /// When running on the simulator this will log `[USERNAME] message` so that diff --git a/ElementX/Sources/Other/Pills/MessageText.swift b/ElementX/Sources/Other/Pills/MessageText.swift index 910cf4875..8a4c7dbec 100644 --- a/ElementX/Sources/Other/Pills/MessageText.swift +++ b/ElementX/Sources/Other/Pills/MessageText.swift @@ -78,7 +78,9 @@ struct MessageText: UIViewRepresentable { /// Cache key for `sizeThatFits`. Keyed on the reserved trailing size as well as the proposed /// width to account for any changes on the send info label that happen after the first rendering. private struct SizeCacheKey: Hashable { + // periphery:ignore - used via the synthesized Hashable conformance let width: Double + // periphery:ignore - used via the synthesized Hashable conformance let reservedSize: CGSize } diff --git a/ElementX/Sources/Other/Pills/PillView.swift b/ElementX/Sources/Other/Pills/PillView.swift index e2846e682..1617bf7f1 100644 --- a/ElementX/Sources/Other/Pills/PillView.swift +++ b/ElementX/Sources/Other/Pills/PillView.swift @@ -48,8 +48,6 @@ struct PillView: View { } struct PillView_Previews: PreviewProvider, TestablePreview { - static let mockMediaProvider = MediaProviderMock(.init()) - static var previews: some View { PillView(context: PillContext.mock(viewState: .mention(isOwnMention: false, displayText: PillUtilities.userPillDisplayText(username: "User", diff --git a/ElementX/Sources/Other/ScrollViewAdapter.swift b/ElementX/Sources/Other/ScrollViewAdapter.swift index ff1598376..841da1ab2 100644 --- a/ElementX/Sources/Other/ScrollViewAdapter.swift +++ b/ElementX/Sources/Other/ScrollViewAdapter.swift @@ -29,18 +29,10 @@ class ScrollViewAdapter: NSObject, UIScrollViewDelegate { .init(isScrollingSubject) } - private let isAtTopEdgeSubject: CurrentValueSubject = .init(false) - var isAtTopEdge: CurrentValuePublisher { - isAtTopEdgeSubject - .asCurrentValuePublisher() - } - // MARK: - UIScrollViewDelegate func scrollViewDidScroll(_ scrollView: UIScrollView) { didScrollSubject.send(()) - let insetContentOffset = scrollView.contentOffset.y + scrollView.contentInset.top - isAtTopEdgeSubject.send(insetContentOffset >= 3) } func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { diff --git a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModelV2.swift b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModelV2.swift index 8e82092ea..1535b58b9 100644 --- a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModelV2.swift +++ b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModelV2.swift @@ -68,6 +68,7 @@ class StateStoreViewModelV2 { /// Intentionally non-generic so that it doesn't grow uncontrollably let mediaProvider: MediaProviderProtocol? + // periphery:ignore - might be useful to have /// An optional content scanning service so that views can validate media themselves. /// `nil` when no content scanner is configured for the server, or when the screen /// intentionally doesn't provide one because it has no media to scan. diff --git a/ElementX/Sources/Other/SwiftUI/Views/LoadableImage.swift b/ElementX/Sources/Other/SwiftUI/Views/LoadableImage.swift index be7ef31d2..91738fe39 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/LoadableImage.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/LoadableImage.swift @@ -412,7 +412,6 @@ struct LoadableImage_Previews: PreviewProvider, TestablePreview { mediaProvider.imageFromSourceSizeClosure = { _, _ in nil } mediaProvider.loadFileFromSourceFilenameClosure = { _, _ in .failure(.failedRetrievingFile) } mediaProvider.loadImageDataFromSourceClosure = { _ in .failure(.failedRetrievingImage) } - mediaProvider.loadImageFromSourceSizeClosure = { _, _ in .failure(.failedRetrievingImage) } mediaProvider.loadThumbnailForSourceSourceSizeClosure = { _, _ in .failure(.failedRetrievingThumbnail) } mediaProvider.loadImageRetryingOnReconnectionSizeClosure = { _, _ in Task { throw MediaProviderError.failedRetrievingImage } diff --git a/ElementX/Sources/Other/SwiftUI/Views/TopBannerModifier.swift b/ElementX/Sources/Other/SwiftUI/Views/TopBannerModifier.swift index ac795fd44..138fbfc05 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/TopBannerModifier.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/TopBannerModifier.swift @@ -41,12 +41,6 @@ struct TopBannerLayer { } extension View { - /// Overlays the given banner view at the top edge of this view, using a - /// slide from the top edge when `isVisible` is toggled. - func topBanner(_ banner: some View, isVisible: Bool, footer: some View = EmptyView()) -> some View { - topBanners([TopBannerLayer(banner, isVisible: isVisible)], footer: footer) - } - /// Overlays the given Z-axis banner slots at the top edge of this view. /// Later items in the array are overlayed on top of earlier ones. Within /// each slot, visible vertical banners are stacked in a VStack and slide diff --git a/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift b/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift index 69befbd1b..89dfedd2a 100644 --- a/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift +++ b/ElementX/Sources/Other/TestablePreview/TestablePreviewsDictionary.swift @@ -182,7 +182,6 @@ enum TestablePreviewsDictionary { "StaticLocationSheet_Previews" : StaticLocationSheet_Previews.self, "StickerRoomTimelineView_Previews" : StickerRoomTimelineView_Previews.self, "SwipeRightAction_Previews" : SwipeRightAction_Previews.self, - "SwipeToReplyView_Previews" : SwipeToReplyView_Previews.self, "TextRoomTimelineView_Previews" : TextRoomTimelineView_Previews.self, "ThreadDecorator_Previews" : ThreadDecorator_Previews.self, "TimelineDeliveryStatusView_Previews" : TimelineDeliveryStatusView_Previews.self, diff --git a/ElementX/Sources/Screens/AppLock/AppLockSetupPINScreen/View/PINTextField.swift b/ElementX/Sources/Screens/AppLock/AppLockSetupPINScreen/View/PINTextField.swift index 8fe709a11..392ae447e 100644 --- a/ElementX/Sources/Screens/AppLock/AppLockSetupPINScreen/View/PINTextField.swift +++ b/ElementX/Sources/Screens/AppLock/AppLockSetupPINScreen/View/PINTextField.swift @@ -58,6 +58,7 @@ private struct PINTextFieldStyle: TextFieldStyle { let maxLength: Int let size: PINDigitField.Size + // periphery:ignore - called by SwiftUI via the TextFieldStyle protocol func _body(configuration: TextField<_Label>) -> some View { HStack(spacing: 8) { ForEach(0.. = .init() private var cancellables = Set() @@ -45,13 +39,10 @@ final class LoginScreenCoordinator: CoordinatorProtocol { // MARK: - Setup init(parameters: LoginScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = LoginScreenViewModel(authenticationService: parameters.authenticationService, loginHint: parameters.loginHint, userIndicatorController: parameters.userIndicatorController, - appSettings: parameters.appSettings, - analytics: parameters.analytics) + appSettings: parameters.appSettings) } // MARK: - Public diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenModels.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenModels.swift index 43d3fe049..f3c646c59 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenModels.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenModels.swift @@ -63,14 +63,10 @@ enum LoginScreenViewAction { } enum LoginScreenErrorType: Hashable { - /// A specific error message shown in an alert. - case alert(String) /// An alert that informs the user to check their username/password. case credentialsAlert /// An alert that informs the user that their account has been deactivated. case deactivatedAlert - /// An alert that informs the user about a bad well-known file. - case invalidWellKnownAlert(String) /// An alert that allows the user to learn about sliding sync. case slidingSyncAlert /// An alert that informs the user that Element Pro should be used for a particular server. diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenViewModel.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenViewModel.swift index e785349b8..eb8de2de5 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginScreenViewModel.swift @@ -15,7 +15,6 @@ class LoginScreenViewModel: LoginScreenViewModelType, LoginScreenViewModelProtoc private let authenticationService: AuthenticationServiceProtocol private let userIndicatorController: UserIndicatorControllerProtocol private let appSettings: AppSettings - private let analytics: AnalyticsServiceProtocol private var actionsSubject: PassthroughSubject = .init() var actions: AnyPublisher { @@ -25,12 +24,10 @@ class LoginScreenViewModel: LoginScreenViewModelType, LoginScreenViewModelProtoc init(authenticationService: AuthenticationServiceProtocol, loginHint: String?, userIndicatorController: UserIndicatorControllerProtocol, - appSettings: AppSettings, - analytics: AnalyticsServiceProtocol) { + appSettings: AppSettings) { self.authenticationService = authenticationService self.userIndicatorController = userIndicatorController self.appSettings = appSettings - self.analytics = analytics let username = switch loginHint { case .some(let hint) where hint.hasPrefix("mxid:"): String(hint.dropFirst(5)) // MSC4198 diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift index 234cb1244..765b7406a 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift @@ -156,8 +156,7 @@ struct LoginScreen_Previews: PreviewProvider, TestablePreview { let viewModel = LoginScreenViewModel(authenticationService: authenticationService, loginHint: nil, userIndicatorController: UserIndicatorControllerMock(), - appSettings: .volatile(), - analytics: AnalyticsServiceMock(.init())) + appSettings: .volatile()) if withCredentials { viewModel.context.username = "alice" diff --git a/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenCoordinator.swift b/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenCoordinator.swift index 7864a0268..d61df55b4 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenCoordinator.swift @@ -25,11 +25,7 @@ enum ServerSelectionScreenCoordinatorAction { /// Note: This code was brought over from Riot, we should move the authentication service logic into the view model. final class ServerSelectionScreenCoordinator: CoordinatorProtocol { private let parameters: ServerSelectionScreenCoordinatorParameters - private let userIndicatorController: UserIndicatorControllerProtocol private var viewModel: ServerSelectionScreenViewModelProtocol - private var authenticationService: AuthenticationServiceProtocol { - parameters.authenticationService - } private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() @@ -44,7 +40,6 @@ final class ServerSelectionScreenCoordinator: CoordinatorProtocol { authenticationFlow: parameters.authenticationFlow, appSettings: parameters.appSettings, userIndicatorController: parameters.userIndicatorController) - userIndicatorController = parameters.userIndicatorController } // MARK: - Public diff --git a/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenModels.swift b/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenModels.swift index eb7e88e38..dec2f392b 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenModels.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelectionScreen/ServerSelectionScreenModels.swift @@ -57,8 +57,6 @@ enum ServerSelectionScreenViewAction { } enum ServerSelectionScreenErrorType: Hashable { - /// An error message to be shown in the text field footer. - case footerMessage(String) /// An alert that informs the user about a bad well-known file. case invalidWellKnownAlert(String) /// An alert that allows the user to learn about sliding sync. diff --git a/ElementX/Sources/Screens/Authentication/StartScreen/AuthenticationStartScreenViewModel.swift b/ElementX/Sources/Screens/Authentication/StartScreen/AuthenticationStartScreenViewModel.swift index e824c0df9..2483296b3 100644 --- a/ElementX/Sources/Screens/Authentication/StartScreen/AuthenticationStartScreenViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/StartScreen/AuthenticationStartScreenViewModel.swift @@ -15,7 +15,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType private let authenticationService: AuthenticationServiceProtocol private let provisioningParameters: AccountProvisioningParameters? private let appMediator: AppMediatorProtocol - private let appSettings: AppSettings private let userIndicatorController: UserIndicatorControllerProtocol private let canReportProblem: Bool @@ -37,7 +36,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType self.authenticationService = authenticationService self.provisioningParameters = provisioningParameters self.appMediator = appMediator - self.appSettings = appSettings self.userIndicatorController = userIndicatorController canReportProblem = isBugReportServiceEnabled diff --git a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift index 5721ec4b0..3d5e61380 100644 --- a/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift +++ b/ElementX/Sources/Screens/BugReportScreen/BugReportScreenViewModel.swift @@ -18,7 +18,6 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie private let logFiles: [URL] private let actionsSubject: PassthroughSubject = .init() - // periphery:ignore - when set to nil this is automatically cancelled @CancellableTask private var uploadTask: Task? var actions: AnyPublisher { diff --git a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift index cbbdbbd39..9d591288e 100644 --- a/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift +++ b/ElementX/Sources/Screens/CallScreen/View/CallScreen.swift @@ -179,6 +179,7 @@ private struct CallView: UIViewRepresentable { } } + // periphery:ignore:parameters userContentController - delegate convention func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { guard let handlerID = CallScreenJavaScriptMessageName(rawValue: message.name) else { return @@ -290,10 +291,6 @@ private struct CallView: UIViewRepresentable { return .success(()) } - func stopPictureInPicture() { - pictureInPictureController?.stopPictureInPicture() - } - nonisolated func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) { Task { @MainActor in // We move the view via the delegate so it works when you background the app without calling requestPictureInPicture diff --git a/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModel.swift b/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModel.swift index ae091d4e4..a50853bf6 100644 --- a/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModel.swift +++ b/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModel.swift @@ -11,8 +11,6 @@ import SwiftUI typealias ChatsSpaceFiltersScreenViewModelType = StateStoreViewModelV2 class ChatsSpaceFiltersScreenViewModel: ChatsSpaceFiltersScreenViewModelType, ChatsSpaceFiltersScreenViewModelProtocol, Identifiable { - private let spaceService: SpaceServiceProxyProtocol - private let actionsSubject: PassthroughSubject = .init() var actionsPublisher: AnyPublisher { actionsSubject.eraseToAnyPublisher() @@ -22,8 +20,6 @@ class ChatsSpaceFiltersScreenViewModel: ChatsSpaceFiltersScreenViewModelType, Ch init(spaceService: SpaceServiceProxyProtocol, mediaProvider: MediaProviderProtocol) { - self.spaceService = spaceService - super.init(initialViewState: ChatsSpaceFiltersScreenViewState(bindings: .init()), mediaProvider: mediaProvider) diff --git a/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModelProtocol.swift b/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModelProtocol.swift index 6fcdbd238..ef1b4e505 100644 --- a/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModelProtocol.swift +++ b/ElementX/Sources/Screens/ChatsSpaceFiltersScreen/ChatsSpaceFiltersScreenViewModelProtocol.swift @@ -7,6 +7,7 @@ import Combine +// periphery:ignore - required for the architecture protocol ChatsSpaceFiltersScreenViewModelProtocol { var actionsPublisher: AnyPublisher { get } var context: ChatsSpaceFiltersScreenViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift index 6ea8962f5..0765760bc 100644 --- a/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift +++ b/ElementX/Sources/Screens/CreateRoomScreen/CreateRoomScreenModels.swift @@ -53,16 +53,6 @@ struct CreateRoomScreenViewState: BindableState { } var aliasErrors: Set = [] - var aliasErrorDescription: String? { - if aliasErrors.contains(.alreadyExists) { - L10n.errorRoomAddressAlreadyExists - } else if aliasErrors.contains(.invalidSymbols) { - L10n.errorRoomAddressInvalidSymbols - } else { - nil - } - } - var availableAccessTypes: [CreateRoomScreenAccessType] { var availableAccessTypes: [CreateRoomScreenAccessType] = [] if isSpace { diff --git a/ElementX/Sources/Screens/DeclineAndBlockScreen/DeclineAndBlockScreenCoordinator.swift b/ElementX/Sources/Screens/DeclineAndBlockScreen/DeclineAndBlockScreenCoordinator.swift index f32cf8446..adab8634d 100644 --- a/ElementX/Sources/Screens/DeclineAndBlockScreen/DeclineAndBlockScreenCoordinator.swift +++ b/ElementX/Sources/Screens/DeclineAndBlockScreen/DeclineAndBlockScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a reportInvite remove this comment once generating the final file - import Combine import SwiftUI @@ -23,7 +21,6 @@ enum DeclineAndBlockScreenCoordinatorAction { } final class DeclineAndBlockScreenCoordinator: CoordinatorProtocol { - private let parameters: DeclineAndBlockScreenCoordinatorParameters private let viewModel: DeclineAndBlockScreenViewModelProtocol private var cancellables = Set() @@ -34,8 +31,6 @@ final class DeclineAndBlockScreenCoordinator: CoordinatorProtocol { } init(parameters: DeclineAndBlockScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = DeclineAndBlockScreenViewModel(userID: parameters.userID, roomID: parameters.roomID, clientProxy: parameters.clientProxy, diff --git a/ElementX/Sources/Screens/EditRoomAddressScreen/EditRoomAddressScreenCoordinator.swift b/ElementX/Sources/Screens/EditRoomAddressScreen/EditRoomAddressScreenCoordinator.swift index 61b7dbe05..470b39c9f 100644 --- a/ElementX/Sources/Screens/EditRoomAddressScreen/EditRoomAddressScreenCoordinator.swift +++ b/ElementX/Sources/Screens/EditRoomAddressScreen/EditRoomAddressScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE in the repository root for full details. // -// periphery:ignore:all - this is just a editRoomAddress remove this comment once generating the final file - import Combine import SwiftUI diff --git a/ElementX/Sources/Screens/EmojiPickerScreen/EmojiPickerScreenCoordinator.swift b/ElementX/Sources/Screens/EmojiPickerScreen/EmojiPickerScreenCoordinator.swift index 932474b65..d52fc74b0 100644 --- a/ElementX/Sources/Screens/EmojiPickerScreen/EmojiPickerScreenCoordinator.swift +++ b/ElementX/Sources/Screens/EmojiPickerScreen/EmojiPickerScreenCoordinator.swift @@ -21,7 +21,6 @@ enum EmojiPickerScreenCoordinatorAction { } final class EmojiPickerScreenCoordinator: CoordinatorProtocol { - private let parameters: EmojiPickerScreenCoordinatorParameters private var viewModel: EmojiPickerScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() @@ -32,8 +31,6 @@ final class EmojiPickerScreenCoordinator: CoordinatorProtocol { } init(parameters: EmojiPickerScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = EmojiPickerScreenViewModel(itemID: parameters.itemID, selectedEmojis: parameters.selectedEmojis, emojiProvider: parameters.emojiProvider, diff --git a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenCoordinator.swift b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenCoordinator.swift index af72ac438..7f5d7c938 100644 --- a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenCoordinator.swift +++ b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenCoordinator.swift @@ -18,7 +18,6 @@ enum EncryptionResetPasswordScreenCoordinatorAction { } final class EncryptionResetPasswordScreenCoordinator: CoordinatorProtocol { - private let parameters: EncryptionResetPasswordScreenCoordinatorParameters private let viewModel: EncryptionResetPasswordScreenViewModelProtocol private var cancellables = Set() @@ -29,8 +28,6 @@ final class EncryptionResetPasswordScreenCoordinator: CoordinatorProtocol { } init(parameters: EncryptionResetPasswordScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = EncryptionResetPasswordScreenViewModel(passwordPublisher: parameters.passwordPublisher) } diff --git a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenModels.swift b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenModels.swift index 4412cedec..a91858810 100644 --- a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenModels.swift +++ b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetPasswordScreen/EncryptionResetPasswordScreenModels.swift @@ -18,7 +18,6 @@ struct EncryptionResetPasswordScreenViewState: BindableState { struct EncryptionResetPasswordScreenViewStateBindings { var password: String - var alertInfo: AlertInfo? } enum EncryptionResetPasswordScreenViewAction { diff --git a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenCoordinator.swift b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenCoordinator.swift index 43348c89d..b6ccf890a 100644 --- a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenCoordinator.swift +++ b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenCoordinator.swift @@ -22,7 +22,6 @@ struct EncryptionResetScreenCoordinatorParameters { } final class EncryptionResetScreenCoordinator: CoordinatorProtocol { - private let parameters: EncryptionResetScreenCoordinatorParameters private let viewModel: EncryptionResetScreenViewModelProtocol private var cancellables = Set() @@ -33,7 +32,6 @@ final class EncryptionResetScreenCoordinator: CoordinatorProtocol { } init(parameters: EncryptionResetScreenCoordinatorParameters) { - self.parameters = parameters viewModel = EncryptionResetScreenViewModel(clientProxy: parameters.clientProxy, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenModels.swift b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenModels.swift index ec401e32d..7dc553549 100644 --- a/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenModels.swift +++ b/ElementX/Sources/Screens/EncryptionReset/EncryptionResetScreen/EncryptionResetScreenModels.swift @@ -17,25 +17,6 @@ enum EncryptionResetScreenViewModelAction { } struct EncryptionResetScreenViewState: BindableState { - private let listItem3AttributedText = { - let boldPlaceholder = "{bold}" - var finalString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3(boldPlaceholder)) - var boldString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3ResetAll) - boldString.bold() - finalString.replace(boldPlaceholder, with: boldString) - return finalString - }() - - var listItems: [AttributedString] { - [ - AttributedString(L10n.screenCreateNewRecoveryKeyListItem1(InfoPlistReader.main.productionAppName)), - AttributedString(L10n.screenCreateNewRecoveryKeyListItem2), - listItem3AttributedText, - AttributedString(L10n.screenCreateNewRecoveryKeyListItem4), - AttributedString(L10n.screenCreateNewRecoveryKeyListItem5) - ] - } - var bindings: EncryptionResetScreenViewStateBindings } diff --git a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewDataSource.swift b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewDataSource.swift index c8319dc70..892748e14 100644 --- a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewDataSource.swift +++ b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewDataSource.swift @@ -24,7 +24,6 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource { private(set) var previewItems: [TimelineMediaPreviewItem.Media] let previewItemsPaginationPublisher = PassthroughSubject() - private let initialItem: EventBasedMessageTimelineItemProtocol /// The index of the initial item inside of `previewItems` that is to be shown. let initialItemIndex: Int @@ -41,7 +40,6 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource { initialPadding: Int = 100, paginationState: TimelinePaginationState) { previewItems = itemViewStates.compactMap(TimelineMediaPreviewItem.Media.init) - self.initialItem = initialItem if let initialItemArrayIndex = previewItems.firstIndex(where: { $0.id == initialItem.id.eventOrTransactionID }) { initialItemIndex = initialItemArrayIndex + initialPadding diff --git a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModels.swift b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModels.swift index 158b92330..fc9bc24fd 100644 --- a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModels.swift +++ b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModels.swift @@ -74,10 +74,6 @@ struct TimelineMediaPreviewViewStateBindings { var redactConfirmationItem: TimelineMediaPreviewItem.Media? } -enum TimelineMediaPreviewAlertType { - case authorizationRequired -} - enum TimelineMediaPreviewViewAction { case updateCurrentItem(TimelineMediaPreviewItem) case showItemDetails(TimelineMediaPreviewItem.Media) diff --git a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModifier.swift b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModifier.swift index 16c2341a3..6aec307d3 100644 --- a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModifier.swift +++ b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewModifier.swift @@ -62,7 +62,6 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable { private var hasBeenPresented = false private var dismissalObserver: AnyCancellable? - private var cancellables: Set = [] init(viewModel: TimelineMediaPreviewViewModel, dismissalPublisher: PassthroughSubject, diff --git a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewViewModel.swift b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewViewModel.swift index ca77a2722..aa13a2927 100644 --- a/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewViewModel.swift +++ b/ElementX/Sources/Screens/FilePreviewScreen/TimelineMediaPreviewViewModel.swift @@ -196,7 +196,6 @@ class TimelineMediaPreviewViewModel: TimelineMediaPreviewViewModelType { canCurrentUserRedactOthers: timelineContext.viewState.canCurrentUserRedactOthers, canCurrentUserPin: timelineContext.viewState.canCurrentUserPin, pinnedEventIDs: timelineContext.viewState.pinnedEventIDs, - isDM: timelineContext.viewState.isDM, isViewSourceEnabled: timelineContext.viewState.isViewSourceEnabled, areThreadsEnabled: timelineContext.viewState.areThreadsEnabled, timelineKind: timelineContext.viewState.timelineKind, diff --git a/ElementX/Sources/Screens/FilePreviewScreen/View/TimelineMediaPreviewController.swift b/ElementX/Sources/Screens/FilePreviewScreen/View/TimelineMediaPreviewController.swift index 060824322..f0e788f13 100644 --- a/ElementX/Sources/Screens/FilePreviewScreen/View/TimelineMediaPreviewController.swift +++ b/ElementX/Sources/Screens/FilePreviewScreen/View/TimelineMediaPreviewController.swift @@ -335,10 +335,6 @@ private struct DetailsButton: View { context.viewState.currentItem } - var isHidden: Bool { - currentItem.mediaItem == nil - } - var body: some View { if let mediaItem = currentItem.mediaItem { Button { context.send(viewAction: .showItemDetails(mediaItem)) } label: { diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenContent.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenContent.swift index 1ea1ce934..a661fbb8b 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenContent.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenContent.swift @@ -11,8 +11,6 @@ import SentrySwiftUI import SwiftUI struct HomeScreenContent: View { - @Environment(\.verticalSizeClass) private var verticalSizeClass - @ObservedObject var context: HomeScreenViewModel.Context let scrollViewAdapter: ScrollViewAdapter diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift index 753a6178b..667c7f831 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreenRoomCell.swift @@ -266,17 +266,6 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview { HomeScreenRoom(summary: summary) } - static func makeViewModel(roomSummaryProvider: RoomSummaryProviderProtocol) -> HomeScreenViewModel { - let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "John Doe", roomSummaryProvider: roomSummaryProvider)))) - - return HomeScreenViewModel(userSession: userSession, - selectedRoomPublisher: CurrentValueSubject(nil).asCurrentValuePublisher(), - appSettings: .volatile(), - analyticsService: AnalyticsServiceMock(.init()), - notificationManager: NotificationManagerMock(), - userIndicatorController: UserIndicatorControllerMock()) - } - static func makeRoom(lastMessageState: RoomSummary.LastMessageState? = nil, heroes: [UserProfile] = []) -> HomeScreenRoom { let name = if heroes.count == 1 { diff --git a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenCoordinator.swift b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenCoordinator.swift index 95e043132..d779a6124 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenCoordinator.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenCoordinator.swift @@ -15,7 +15,6 @@ struct InviteUsersScreenCoordinatorParameters { let isSkippable: Bool let userDiscoveryService: UserDiscoveryServiceProtocol let userIndicatorController: UserIndicatorControllerProtocol - let appSettings: AppSettings } enum InviteUsersScreenCoordinatorAction { @@ -37,8 +36,7 @@ final class InviteUsersScreenCoordinator: CoordinatorProtocol { roomType: parameters.roomType, isSkippable: parameters.isSkippable, userDiscoveryService: parameters.userDiscoveryService, - userIndicatorController: parameters.userIndicatorController, - appSettings: parameters.appSettings) + userIndicatorController: parameters.userIndicatorController) } func start() { diff --git a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenModels.swift b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenModels.swift index 81405188b..26e34551d 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenModels.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenModels.swift @@ -9,7 +9,6 @@ import Foundation import MatrixRustSDK -// periphery:ignore - for generic conformance enum InviteUsersScreenErrorType: Error { case unknown } diff --git a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenViewModel.swift b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenViewModel.swift index 5fe05d688..d18283a75 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenViewModel.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/InviteUsersScreenViewModel.swift @@ -17,7 +17,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr private let roomType: InviteUsersScreenRoomType private let userDiscoveryService: UserDiscoveryServiceProtocol private let userIndicatorController: UserIndicatorControllerProtocol - private let appSettings: AppSettings private var suggestedUsers = [UserProfile]() @@ -30,13 +29,11 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr roomType: InviteUsersScreenRoomType, isSkippable: Bool, userDiscoveryService: UserDiscoveryServiceProtocol, - userIndicatorController: UserIndicatorControllerProtocol, - appSettings: AppSettings) { + userIndicatorController: UserIndicatorControllerProtocol) { clientProxy = userSession.clientProxy self.roomType = roomType self.userDiscoveryService = userDiscoveryService self.userIndicatorController = userIndicatorController - self.appSettings = appSettings let mandatoryInvitees: [UserProfile] = if case .draft(let invitees) = roomType { invitees @@ -194,7 +191,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr } } - // periphery:ignore - automatically cancelled when set to nil @CancellableTask private var fetchUsersTask: Task? diff --git a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersConfirmationSheetView.swift b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersConfirmationSheetView.swift index 4f6ed2570..346bcae47 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersConfirmationSheetView.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersConfirmationSheetView.swift @@ -64,8 +64,7 @@ struct InviteUsersConfirmationSheetView_Previews: PreviewProvider, TestablePrevi roomType: .existingRoom(roomProxy: JoinedRoomProxyMock(.init(members: []))), isSkippable: true, userDiscoveryService: UserDiscoveryServiceMock(), - userIndicatorController: UserIndicatorControllerMock(), - appSettings: .volatile()) + userIndicatorController: UserIndicatorControllerMock()) viewModel.state.usersToConfirm = [.mockAlice, .mockCharlie, .mockBob, .mockDan] diff --git a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreen.swift b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreen.swift index be84fe34a..ec7fa0da1 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreen.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreen.swift @@ -212,8 +212,7 @@ struct InviteUsersScreen_Previews: PreviewProvider, TestablePreview { roomType: roomType ?? .existingRoom(roomProxy: JoinedRoomProxyMock(.init(members: []))), isSkippable: isSkippable, userDiscoveryService: userDiscoveryService, - userIndicatorController: UserIndicatorControllerMock(), - appSettings: .volatile()) + userIndicatorController: UserIndicatorControllerMock()) if let searchQuery { viewModel.context.searchQuery = searchQuery diff --git a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreenSelectedItem.swift b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreenSelectedItem.swift index 9174b3559..a39859036 100644 --- a/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreenSelectedItem.swift +++ b/ElementX/Sources/Screens/InviteUsersScreen/View/InviteUsersScreenSelectedItem.swift @@ -48,13 +48,6 @@ struct InviteUsersScreenSelectedItem: View { avatarImage.overlayRemoveItemButton(action: dismissAction) } } - - var closeButtonLabel: some View { - CompoundIcon(\.close, size: .custom(12), relativeTo: .compound.bodySM) - .foregroundStyle(.compound.iconOnSolidPrimary) - .padding(2) - .background(.compound.iconPrimary, in: Circle()) - } } struct InviteUsersScreenSelectedItem_Previews: PreviewProvider, TestablePreview { diff --git a/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenModels.swift b/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenModels.swift index cca26f2bb..6209cd4da 100644 --- a/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenModels.swift +++ b/ElementX/Sources/Screens/JoinRoomScreen/JoinRoomScreenModels.swift @@ -48,6 +48,7 @@ struct JoinRoomScreenRoomDetails { let isDirect: Bool? let isSpace: Bool? + // periphery:ignore - might be useful to have let childrenCount: Int? let spaceVisibility: SpaceServiceRoomVisibility? } diff --git a/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenCoordinator.swift b/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenCoordinator.swift index bcd9e6ec7..4d2a547a6 100644 --- a/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenCoordinator.swift +++ b/ElementX/Sources/Screens/KnockRequestsListScreen/KnockRequestsListScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a knockRequestsList remove this comment once generating the final file - import Combine import SwiftUI @@ -17,6 +15,7 @@ struct KnockRequestsListScreenCoordinatorParameters { let userIndicatorController: UserIndicatorControllerProtocol } +// periphery:ignore - required for the architecture enum KnockRequestsListScreenCoordinatorAction { } final class KnockRequestsListScreenCoordinator: CoordinatorProtocol { @@ -24,7 +23,9 @@ final class KnockRequestsListScreenCoordinator: CoordinatorProtocol { private var cancellables = Set() + // periphery:ignore - required for the architecture private let actionsSubject: PassthroughSubject = .init() + // periphery:ignore - required for the architecture var actionsPublisher: AnyPublisher { actionsSubject.eraseToAnyPublisher() } @@ -35,7 +36,11 @@ final class KnockRequestsListScreenCoordinator: CoordinatorProtocol { userIndicatorController: parameters.userIndicatorController) } - func start() { } + func start() { + viewModel.actionsPublisher + .sink { _ in } + .store(in: &cancellables) + } func toPresentable() -> AnyView { AnyView(KnockRequestsListScreen(context: viewModel.context)) diff --git a/ElementX/Sources/Screens/LabsScreen/LabsScreenCoordinator.swift b/ElementX/Sources/Screens/LabsScreen/LabsScreenCoordinator.swift index 9b473d115..129d379c5 100644 --- a/ElementX/Sources/Screens/LabsScreen/LabsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/LabsScreen/LabsScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a labs remove this comment once generating the final file - import Combine import SwiftUI diff --git a/ElementX/Sources/Screens/LabsScreen/LabsScreenModels.swift b/ElementX/Sources/Screens/LabsScreen/LabsScreenModels.swift index 70e30d8be..6dff16fef 100644 --- a/ElementX/Sources/Screens/LabsScreen/LabsScreenModels.swift +++ b/ElementX/Sources/Screens/LabsScreen/LabsScreenModels.swift @@ -20,7 +20,6 @@ struct LabsScreenViewState: BindableState { var bindings: LabsScreenViewStateBindings } -// periphery: ignore - subscripts are seen as false positive @dynamicMemberLookup struct LabsScreenViewStateBindings { private let labsOptions: LabsOptionsProtocol diff --git a/ElementX/Sources/Screens/ManageAuthorizedSpacesScreen/ManageAuthorizedSpacesScreenCoordinator.swift b/ElementX/Sources/Screens/ManageAuthorizedSpacesScreen/ManageAuthorizedSpacesScreenCoordinator.swift index e4ac410f8..47fa9a53d 100644 --- a/ElementX/Sources/Screens/ManageAuthorizedSpacesScreen/ManageAuthorizedSpacesScreenCoordinator.swift +++ b/ElementX/Sources/Screens/ManageAuthorizedSpacesScreen/ManageAuthorizedSpacesScreenCoordinator.swift @@ -5,8 +5,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a manageAuthorizedSpaces remove this comment once generating the final file - import Combine import SwiftUI diff --git a/ElementX/Sources/Screens/ManageRoomMemberSheet/ManageRoomMemberSheetViewModelProtocol.swift b/ElementX/Sources/Screens/ManageRoomMemberSheet/ManageRoomMemberSheetViewModelProtocol.swift index ed940c937..8b40f6bae 100644 --- a/ElementX/Sources/Screens/ManageRoomMemberSheet/ManageRoomMemberSheetViewModelProtocol.swift +++ b/ElementX/Sources/Screens/ManageRoomMemberSheet/ManageRoomMemberSheetViewModelProtocol.swift @@ -8,6 +8,7 @@ import Combine +// periphery:ignore - required for the architecture protocol ManageRoomMemberSheetViewModelProtocol { var actions: AnyPublisher { get } var context: ManageRoomMemberSheetViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenCoordinator.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenCoordinator.swift index f523126f0..f51d4402c 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenCoordinator.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenCoordinator.swift @@ -30,7 +30,6 @@ enum MediaEventsTimelineScreenCoordinatorAction { } final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol { - private let parameters: MediaEventsTimelineScreenCoordinatorParameters private let viewModel: MediaEventsTimelineScreenViewModelProtocol private var cancellables = Set() @@ -41,8 +40,6 @@ final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol { } init(parameters: MediaEventsTimelineScreenCoordinatorParameters) { - self.parameters = parameters - let mediaTimelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy, timelineController: parameters.mediaTimelineController, userSession: parameters.userSession, diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenViewModel.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenViewModel.swift index 00a2509ce..70e9f372e 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenViewModel.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/MediaEventsTimelineScreenViewModel.swift @@ -29,8 +29,6 @@ class MediaEventsTimelineScreenViewModel: MediaEventsTimelineScreenViewModelType } } - private var mediaPreviewCancellable: AnyCancellable? - private let actionsSubject: PassthroughSubject = .init() var actionsPublisher: AnyPublisher { actionsSubject.eraseToAnyPublisher() diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VideoMediaEventsTimelineView.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VideoMediaEventsTimelineView.swift index be32fa3d0..0ed59afef 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VideoMediaEventsTimelineView.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VideoMediaEventsTimelineView.swift @@ -84,7 +84,7 @@ struct VideoMediaEventsTimelineView_Previews: PreviewProvider, TestablePreview { .background(.black) } - private static func makeTimelineItem(caption: String? = nil, isEdited: Bool = false) -> VideoRoomTimelineItem { + private static func makeTimelineItem() -> VideoRoomTimelineItem { VideoRoomTimelineItem(id: .randomEvent, timestamp: .mock, isOutgoing: false, diff --git a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenCoordinator.swift b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenCoordinator.swift index 9550b225b..c72a03334 100644 --- a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenCoordinator.swift +++ b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenCoordinator.swift @@ -13,7 +13,6 @@ struct MediaUploadPreviewScreenCoordinatorParameters { let mediaURLs: [URL] let caption: NSAttributedString? let title: String? - let isRoomEncrypted: Bool let shouldShowCaptionWarning: Bool let mediaUploadingPreprocessor: MediaUploadingPreprocessor let timelineController: TimelineControllerProtocol @@ -38,7 +37,6 @@ final class MediaUploadPreviewScreenCoordinator: CoordinatorProtocol { viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: parameters.mediaURLs, caption: parameters.caption, title: parameters.title, - isRoomEncrypted: parameters.isRoomEncrypted, shouldShowCaptionWarning: parameters.shouldShowCaptionWarning, mediaUploadingPreprocessor: parameters.mediaUploadingPreprocessor, timelineController: parameters.timelineController, diff --git a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenModels.swift b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenModels.swift index d46c408ca..194d04050 100644 --- a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenModels.swift +++ b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenModels.swift @@ -17,7 +17,6 @@ struct MediaUploadPreviewScreenViewState: BindableState { let mediaURLs: [URL] let title: String? let shouldShowCaptionWarning: Bool - let isRoomEncrypted: Bool var shouldDisableInteraction = false var mediaEditVersion = 0 diff --git a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift index db0ab9031..6205d3ef8 100644 --- a/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift +++ b/ElementX/Sources/Screens/MediaUploadPreviewScreen/MediaUploadPreviewScreenViewModel.swift @@ -32,7 +32,6 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType, init(mediaURLs: [URL], caption: NSAttributedString?, title: String?, - isRoomEncrypted: Bool, shouldShowCaptionWarning: Bool, mediaUploadingPreprocessor: MediaUploadingPreprocessor, timelineController: TimelineControllerProtocol, @@ -50,7 +49,6 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType, super.init(initialViewState: MediaUploadPreviewScreenViewState(mediaURLs: mediaURLs, title: title, shouldShowCaptionWarning: shouldShowCaptionWarning, - isRoomEncrypted: isRoomEncrypted, bindings: .init(caption: caption ?? NSAttributedString()))) } diff --git a/ElementX/Sources/Screens/MediaUploadPreviewScreen/View/MediaUploadPreviewScreen.swift b/ElementX/Sources/Screens/MediaUploadPreviewScreen/View/MediaUploadPreviewScreen.swift index 3bb7f0e99..130dcc9b2 100644 --- a/ElementX/Sources/Screens/MediaUploadPreviewScreen/View/MediaUploadPreviewScreen.swift +++ b/ElementX/Sources/Screens/MediaUploadPreviewScreen/View/MediaUploadPreviewScreen.swift @@ -388,12 +388,10 @@ private struct ImageEditorView: UIViewControllerRepresentable { struct MediaUploadPreviewScreen_Previews: PreviewProvider, TestablePreview { static let snapshotURL = URL.picturesDirectory - static let testURL = Bundle.main.url(forResource: "AppIcon60x60@2x", withExtension: "png") static let viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: [snapshotURL], caption: nil, title: "App Icon.png", - isRoomEncrypted: true, shouldShowCaptionWarning: true, mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: .volatile()), timelineController: TimelineControllerMock(.init()), diff --git a/ElementX/Sources/Screens/Onboarding/IdentityConfirmationScreen/IdentityConfirmationScreenCoordinator.swift b/ElementX/Sources/Screens/Onboarding/IdentityConfirmationScreen/IdentityConfirmationScreenCoordinator.swift index 8402fe73a..95277a21e 100644 --- a/ElementX/Sources/Screens/Onboarding/IdentityConfirmationScreen/IdentityConfirmationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Onboarding/IdentityConfirmationScreen/IdentityConfirmationScreenCoordinator.swift @@ -25,7 +25,6 @@ enum IdentityConfirmationScreenCoordinatorAction { } final class IdentityConfirmationScreenCoordinator: CoordinatorProtocol { - private let parameters: IdentityConfirmationScreenCoordinatorParameters private let viewModel: IdentityConfirmationScreenViewModelProtocol private var cancellables = Set() @@ -36,8 +35,6 @@ final class IdentityConfirmationScreenCoordinator: CoordinatorProtocol { } init(parameters: IdentityConfirmationScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = IdentityConfirmationScreenViewModel(userSession: parameters.userSession, appSettings: parameters.appSettings, userIndicatorController: parameters.userIndicatorController) diff --git a/ElementX/Sources/Screens/Onboarding/IdentityConfirmedScreen/IdentityConfirmedScreenCoordinator.swift b/ElementX/Sources/Screens/Onboarding/IdentityConfirmedScreen/IdentityConfirmedScreenCoordinator.swift index ca20087fd..67f59f57d 100644 --- a/ElementX/Sources/Screens/Onboarding/IdentityConfirmedScreen/IdentityConfirmedScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Onboarding/IdentityConfirmedScreen/IdentityConfirmedScreenCoordinator.swift @@ -9,14 +9,11 @@ import Combine import SwiftUI -struct IdentityConfirmedScreenCoordinatorParameters { } - enum IdentityConfirmedScreenCoordinatorAction { case done } final class IdentityConfirmedScreenCoordinator: CoordinatorProtocol { - private let parameters: IdentityConfirmedScreenCoordinatorParameters private let viewModel: IdentityConfirmedScreenViewModelProtocol private var cancellables = Set() @@ -26,9 +23,7 @@ final class IdentityConfirmedScreenCoordinator: CoordinatorProtocol { actionsSubject.eraseToAnyPublisher() } - init(parameters: IdentityConfirmedScreenCoordinatorParameters) { - self.parameters = parameters - + init() { viewModel = IdentityConfirmedScreenViewModel() } diff --git a/ElementX/Sources/Screens/ReportRoomScreen/ReportRoomScreenCoordinator.swift b/ElementX/Sources/Screens/ReportRoomScreen/ReportRoomScreenCoordinator.swift index 29c9479f7..9c226bc14 100644 --- a/ElementX/Sources/Screens/ReportRoomScreen/ReportRoomScreenCoordinator.swift +++ b/ElementX/Sources/Screens/ReportRoomScreen/ReportRoomScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a reportRoom remove this comment once generating the final file - import Combine import SwiftUI @@ -21,7 +19,6 @@ enum ReportRoomScreenCoordinatorAction { } final class ReportRoomScreenCoordinator: CoordinatorProtocol { - private let parameters: ReportRoomScreenCoordinatorParameters private let viewModel: ReportRoomScreenViewModelProtocol private var cancellables = Set() @@ -32,8 +29,6 @@ final class ReportRoomScreenCoordinator: CoordinatorProtocol { } init(parameters: ReportRoomScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = ReportRoomScreenViewModel(roomProxy: parameters.roomProxy, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/ResolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenCoordinator.swift b/ElementX/Sources/Screens/ResolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenCoordinator.swift index b5a765333..71a2c6a18 100644 --- a/ElementX/Sources/Screens/ResolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenCoordinator.swift +++ b/ElementX/Sources/Screens/ResolveVerifiedUserSendFailureScreen/ResolveVerifiedUserSendFailureScreenCoordinator.swift @@ -21,7 +21,6 @@ enum ResolveVerifiedUserSendFailureScreenCoordinatorAction { } final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol { - private let parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters private let viewModel: ResolveVerifiedUserSendFailureScreenViewModelProtocol private var cancellables = Set() @@ -32,8 +31,6 @@ final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol } init(parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: parameters.failure, sendHandle: parameters.sendHandle, roomProxy: parameters.roomProxy, diff --git a/ElementX/Sources/Screens/RoomChangeRolesScreen/RoomChangeRolesScreenCoordinator.swift b/ElementX/Sources/Screens/RoomChangeRolesScreen/RoomChangeRolesScreenCoordinator.swift index aaf15b511..d324fe7c2 100644 --- a/ElementX/Sources/Screens/RoomChangeRolesScreen/RoomChangeRolesScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomChangeRolesScreen/RoomChangeRolesScreenCoordinator.swift @@ -22,7 +22,6 @@ enum RoomChangeRolesScreenCoordinatorAction { } final class RoomChangeRolesScreenCoordinator: CoordinatorProtocol { - private let parameters: RoomChangeRolesScreenCoordinatorParameters private let viewModel: RoomChangeRolesScreenViewModelProtocol private var cancellables = Set() @@ -33,8 +32,6 @@ final class RoomChangeRolesScreenCoordinator: CoordinatorProtocol { } init(parameters: RoomChangeRolesScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = RoomChangeRolesScreenViewModel(mode: parameters.mode, roomProxy: parameters.roomProxy, mediaProvider: parameters.mediaProvider, diff --git a/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenCoordinator.swift b/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenCoordinator.swift index 43d5a9e98..694106e18 100644 --- a/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomDetailsEditScreen/RoomDetailsEditScreenCoordinator.swift @@ -16,7 +16,6 @@ struct RoomDetailsEditScreenCoordinatorParameters { weak var navigationStackCoordinator: NavigationStackCoordinator? let userIndicatorController: UserIndicatorControllerProtocol let orientationManager: OrientationManagerProtocol - let appSettings: AppSettings } enum RoomDetailsEditScreenCoordinatorAction { diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenCoordinator.swift b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenCoordinator.swift index 92e26f16a..8006c3d06 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenCoordinator.swift @@ -16,7 +16,6 @@ struct RoomDetailsScreenCoordinatorParameters { let userIndicatorController: UserIndicatorControllerProtocol let notificationSettings: NotificationSettingsProxyProtocol let attributedStringBuilder: AttributedStringBuilderProtocol - let appSettings: AppSettings } enum RoomDetailsScreenCoordinatorAction { @@ -56,8 +55,7 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol { analyticsService: parameters.analyticsService, userIndicatorController: parameters.userIndicatorController, notificationSettingsProxy: parameters.notificationSettings, - attributedStringBuilder: parameters.attributedStringBuilder, - appSettings: parameters.appSettings) + attributedStringBuilder: parameters.attributedStringBuilder) } // MARK: - Public diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift index 1030b9733..3721bd06f 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/RoomDetailsScreenViewModel.swift @@ -18,7 +18,6 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr private let userIndicatorController: UserIndicatorControllerProtocol private let notificationSettingsProxy: NotificationSettingsProxyProtocol private let attributedStringBuilder: AttributedStringBuilderProtocol - private let appSettings: AppSettings private var pinnedEventsTimelineItemProvider: TimelineItemProviderProtocol? { didSet { @@ -49,15 +48,13 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr analyticsService: AnalyticsServiceProtocol, userIndicatorController: UserIndicatorControllerProtocol, notificationSettingsProxy: NotificationSettingsProxyProtocol, - attributedStringBuilder: AttributedStringBuilderProtocol, - appSettings: AppSettings) { + attributedStringBuilder: AttributedStringBuilderProtocol) { self.roomProxy = roomProxy self.userSession = userSession self.analyticsService = analyticsService self.userIndicatorController = userIndicatorController self.notificationSettingsProxy = notificationSettingsProxy self.attributedStringBuilder = attributedStringBuilder - self.appSettings = appSettings let topic = attributedStringBuilder.fromPlain(roomProxy.infoPublisher.value.topic) diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift index 166635172..7e3a78218 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift @@ -444,8 +444,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxy, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) } private static func makeSimpleRoomViewModel() -> RoomDetailsScreenViewModel { @@ -472,8 +471,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxy, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) } private static func makeDMViewModel(verificationState: UserIdentityVerificationState) -> RoomDetailsScreenViewModel { @@ -510,7 +508,6 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxy, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) } } diff --git a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenCoordinator.swift b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenCoordinator.swift index 68f5767a1..efea2c911 100644 --- a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenCoordinator.swift @@ -15,7 +15,6 @@ struct RoomMemberDetailsScreenCoordinatorParameters { let userSession: UserSessionProtocol let userIndicatorController: UserIndicatorControllerProtocol let analytics: AnalyticsServiceProtocol - let appSettings: AppSettings } enum RoomMemberDetailsScreenCoordinatorAction { @@ -40,8 +39,7 @@ final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol { roomProxy: parameters.roomProxy, userSession: parameters.userSession, userIndicatorController: parameters.userIndicatorController, - analytics: parameters.analytics, - appSettings: parameters.appSettings) + analytics: parameters.analytics) } func start() { diff --git a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift index 8b574a259..e982e643e 100644 --- a/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomMemberDetailsScreen/RoomMemberDetailsScreenViewModel.swift @@ -16,7 +16,6 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro private let userSession: UserSessionProtocol private let userIndicatorController: UserIndicatorControllerProtocol private let analytics: AnalyticsServiceProtocol - private let appSettings: AppSettings private var actionsSubject: PassthroughSubject = .init() @@ -30,13 +29,11 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro roomProxy: JoinedRoomProxyProtocol, userSession: UserSessionProtocol, userIndicatorController: UserIndicatorControllerProtocol, - analytics: AnalyticsServiceProtocol, - appSettings: AppSettings) { + analytics: AnalyticsServiceProtocol) { self.roomProxy = roomProxy self.userSession = userSession self.userIndicatorController = userIndicatorController self.analytics = analytics - self.appSettings = appSettings let initialViewState = RoomMemberDetailsScreenViewState(userID: userID, bindings: .init()) diff --git a/ElementX/Sources/Screens/RoomMemberDetailsScreen/View/RoomMemberDetailsScreen.swift b/ElementX/Sources/Screens/RoomMemberDetailsScreen/View/RoomMemberDetailsScreen.swift index 3f99c1e9e..50c39a033 100644 --- a/ElementX/Sources/Screens/RoomMemberDetailsScreen/View/RoomMemberDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomMemberDetailsScreen/View/RoomMemberDetailsScreen.swift @@ -240,7 +240,6 @@ struct RoomMemberDetailsScreen_Previews: PreviewProvider, TestablePreview { roomProxy: roomProxyMock, userSession: UserSessionMock(.init(clientProxy: clientProxyMock)), userIndicatorController: UserIndicatorControllerMock(), - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) } } diff --git a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenModels.swift b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenModels.swift index 502916f5b..8da1b775b 100644 --- a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenModels.swift +++ b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenModels.swift @@ -104,8 +104,4 @@ enum RoomMembersListScreenViewAction { case invite } -enum RoomMembersListScreenAlertType: Hashable { - case unbanConfirmation(RoomMemberDetails) - case kickConfirmation - case banConfirmation -} +enum RoomMembersListScreenAlertType: Hashable { } diff --git a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift index bc1fb4df5..ae8df8ba5 100644 --- a/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomMemberListScreen/RoomMembersListScreenViewModel.swift @@ -218,22 +218,6 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe private func hideLoadingIndicator(_ identifier: String) { userIndicatorController.retractIndicatorWithId(identifier) } - - private func showManageMemberIndicator(title: String) { - userIndicatorController.submitIndicator(UserIndicator(id: title, - type: .toast(progress: .indeterminate), - title: title, - persistent: true)) - } - - private func hideManageMemberIndicator(title: String) { - userIndicatorController.retractIndicatorWithId(title) - } - - private func showManageMemberFailure(title: String) { - userIndicatorController.retractIndicatorWithId(title) - userIndicatorController.submitIndicator(UserIndicator(title: L10n.commonFailed, icon: \.close)) - } } private nonisolated struct RoomMembersDetails { diff --git a/ElementX/Sources/Screens/RoomMemberListScreen/View/RoomMembersListScreen.swift b/ElementX/Sources/Screens/RoomMemberListScreen/View/RoomMembersListScreen.swift index 3c1886151..dfdfc3a6b 100644 --- a/ElementX/Sources/Screens/RoomMemberListScreen/View/RoomMembersListScreen.swift +++ b/ElementX/Sources/Screens/RoomMemberListScreen/View/RoomMembersListScreen.swift @@ -216,8 +216,7 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview { static func makeViewModel(withInvites: Bool = false, withBanned: Bool = true, isAdmin: Bool = false, - initialMode: RoomMembersListScreenMode = .members, - searchQuery: String = "") -> RoomMembersListScreenViewModel { + initialMode: RoomMembersListScreenMode = .members) -> RoomMembersListScreenViewModel { let mockAdmin = RoomMemberProxyMock.mockAdmin let ownUserID = isAdmin ? mockAdmin.userID : RoomMemberProxyMock.mockMe.userID diff --git a/ElementX/Sources/Screens/RoomNotificationSettingsScreen/RoomNotificationSettingsScreenViewModel.swift b/ElementX/Sources/Screens/RoomNotificationSettingsScreen/RoomNotificationSettingsScreenViewModel.swift index 064e42948..34b801a83 100644 --- a/ElementX/Sources/Screens/RoomNotificationSettingsScreen/RoomNotificationSettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomNotificationSettingsScreen/RoomNotificationSettingsScreenViewModel.swift @@ -16,7 +16,6 @@ class RoomNotificationSettingsScreenViewModel: RoomNotificationSettingsScreenVie private let notificationSettingsProxy: NotificationSettingsProxyProtocol private let roomProxy: JoinedRoomProxyProtocol - // periphery:ignore - cancellable tasks cancel when reassigned @CancellableTask private var fetchNotificationSettingsTask: Task? var actions: AnyPublisher { diff --git a/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift b/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift index e16dc0c58..267c1d6fd 100644 --- a/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomRolesAndPermissionsScreen/RoomRolesAndPermissionsScreenViewModel.swift @@ -15,7 +15,6 @@ class RoomRolesAndPermissionsScreenViewModel: RoomRolesAndPermissionsScreenViewM private let roomProxy: JoinedRoomProxyProtocol private let userIndicatorController: UserIndicatorControllerProtocol private let analytics: AnalyticsServiceProtocol - private var ownUser: RoomMemberDetails? private var actionsSubject: PassthroughSubject = .init() var actionsPublisher: AnyPublisher { diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift index a647b955a..19f936bdb 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/CompletionSuggestionService.swift @@ -72,7 +72,7 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol { // MARK: - Private private func updateRoomInfo(_ roomInfo: RoomInfoProxyProtocol) { - if let powerLevels = roomProxy.infoPublisher.value.powerLevels { + if let powerLevels = roomInfo.powerLevels { canMentionAllUsers = powerLevels.canOwnUserTriggerRoomNotification() } } diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarModels.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarModels.swift index fcccee9ac..95534e82d 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarModels.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarModels.swift @@ -75,8 +75,6 @@ struct ComposerToolbarViewState: BindableState { /// Could be false if sending is disabled in the room var canSend = true var suggestions: [SuggestionItem] = [] - var audioPlayerState: AudioPlayerState - var audioRecorderState: AudioRecorderState var isRoomEncrypted: Bool var isLocationSharingEnabled: Bool diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift index 018da435e..3674ca1e2 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModel.swift @@ -35,7 +35,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool } private struct WysiwygLinkData { - let action: LinkAction let range: NSRange var url: String var text: String @@ -65,8 +64,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool attributedStringBuilder = AttributedStringBuilder(cacheKey: "Composer", mentionBuilder: mentionBuilder) super.init(initialViewState: ComposerToolbarViewState(wysiwygViewModel: wysiwygViewModel, - audioPlayerState: .init(id: .recorderPreview, title: L10n.commonVoiceMessage, duration: 0), - audioRecorderState: .init(), isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted, isLocationSharingEnabled: appSettings.mapTilerSettings.publisher.value.isEnabled, bindings: .init()), @@ -580,10 +577,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool switch mode { case .default: break - case .recordVoiceMessage(let audioRecorderState): - state.audioRecorderState = audioRecorderState - case .previewVoiceMessage(let audioPlayerState, _, _): - state.audioPlayerState = audioPlayerState + case .recordVoiceMessage, .previewVoiceMessage: + break case .edit, .reply: // Focus composer when switching to reply/edit state.bindings.composerFocused = true @@ -645,8 +640,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool private func createLinkAlert() { let linkAction = wysiwygViewModel.getLinkAction() - currentLinkData = WysiwygLinkData(action: linkAction, - range: wysiwygViewModel.attributedContent.selection, + currentLinkData = WysiwygLinkData(range: wysiwygViewModel.attributedContent.selection, url: linkAction.url ?? "", text: "") diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModelProtocol.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModelProtocol.swift index eb10f85d4..fa1f96878 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModelProtocol.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/ComposerToolbarViewModelProtocol.swift @@ -9,7 +9,6 @@ import Combine import WysiwygComposer -// periphery: ignore - markdown protocol protocol ComposerToolbarViewModelProtocol { var actions: AnyPublisher { get } var context: ComposerToolbarViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposer.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposer.swift index 90c049526..9625ac07b 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposer.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposer.swift @@ -33,7 +33,6 @@ struct MessageComposer: View { let onAppearAction: () -> Void @State private var composerTranslation: CGFloat = 0 - private let composerShape = RoundedRectangle(cornerRadius: 21, style: .circular) var body: some View { VStack(spacing: 0) { diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift index c3c723fb3..bbee74233 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/MessageComposerTextField.swift @@ -151,7 +151,6 @@ private struct UITextViewWrapper: UIViewRepresentable { func makeCoordinator() -> Coordinator { Coordinator(text: $text, selectedRange: $selectedRange, - maxHeight: maxHeight, keyHandler: keyHandler, pasteHandler: pasteHandler) } @@ -160,19 +159,15 @@ private struct UITextViewWrapper: UIViewRepresentable { private var text: Binding private var selectedRange: Binding - private let maxHeight: CGFloat - private let keyHandler: GenericKeyHandler private let pasteHandler: PasteHandler init(text: Binding, selectedRange: Binding, - maxHeight: CGFloat, keyHandler: @escaping GenericKeyHandler, pasteHandler: @escaping PasteHandler) { self.text = text self.selectedRange = selectedRange - self.maxHeight = maxHeight self.keyHandler = keyHandler self.pasteHandler = pasteHandler } @@ -211,7 +206,6 @@ private protocol ElementTextViewDelegate: AnyObject { private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate { private(set) var timelineContext: TimelineViewModel.Context? - private var presendCallback: Binding<(() -> Void)?> private var pillViews = NSHashTable.weakObjects() weak var elementDelegate: ElementTextViewDelegate? @@ -219,7 +213,6 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate { init(timelineContext: TimelineViewModel.Context?, presendCallback: Binding<(() -> Void)?>) { self.timelineContext = timelineContext - self.presendCallback = presendCallback super.init(frame: .zero, textContainer: nil) @@ -241,10 +234,12 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate { UIKeyCommand(input: "\r", modifierFlags: [], action: #selector(enterKeyPressed))] } + // periphery:ignore:parameters sender - required for objc selector @objc func shiftEnterKeyPressed(sender: UIKeyCommand) { elementDelegate?.textViewDidReceiveShiftEnterKeyPress(self) } + // periphery:ignore:parameters sender - required for objc selector @objc func enterKeyPressed(sender: UIKeyCommand) { elementDelegate?.textViewDidReceiveKeyPress(self, key: .keyboardReturnOrEnter) } @@ -318,14 +313,6 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate { pillViews.add(pillView) } - func flushPills() { - for view in pillViews.allObjects { - view.alpha = 0.0 - view.removeFromSuperview() - } - pillViews.removeAllObjects() - } - // MARK: - Private private func acceptCurrentSuggestion() { diff --git a/ElementX/Sources/Screens/RoomScreen/View/SwipeRightAction.swift b/ElementX/Sources/Screens/RoomScreen/View/SwipeRightAction.swift index 86738764e..08aefb23b 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/SwipeRightAction.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/SwipeRightAction.swift @@ -98,55 +98,6 @@ struct SwipeRightAction: ViewModifier { }) } - private var oldGesture: some Gesture { - DragGesture() - .updating($dragGestureActive) { _, state, _ in - // Available actions should be computed on the fly so we use a gesture state change - // to ask whether the move should be started or not. - state = true - } - .onChanged { value in - guard canStartAction, value.translation.width > value.translation.height else { - return - } - - // Due to https://forums.developer.apple.com/forums/thread/760035 we had to make - // the drag a simultaneous gesture otherwise it was impossible to scroll the timeline. - // Therefore we need to prevent the animation to run if the user is to scrolling vertically. - // It would be nice if we could somehow abort the gesture in this case. - let width: CGFloat = if value.translation.width > abs(value.translation.height) { - value.translation.width - } else { - 0.0 - } - - // We want to add a spring like behaviour to the drag in which the view - // moves slower the more it's dragged. We use a circular easing function - // to generate those values up to the `swipeThreshold` - // The final translation will be between 0 and `swipeThreshold` with the action being enabled from - // `actionThreshold` onwards - let screenWidthNormalisedTranslation = max(0.0, min(width, swipeThreshold)) / swipeThreshold - let easedTranslation = circularEaseOut(screenWidthNormalisedTranslation) - xOffset = easedTranslation * xOffsetThreshold - - if xOffset > actionThreshold { - if !hasReachedActionThreshold { - feedbackGenerator.impactOccurred() - hasReachedActionThreshold = true - } - } else { - hasReachedActionThreshold = false - } - } - .onEnded { _ in - if xOffset > actionThreshold { - action() - } - - xOffset = 0.0 - } - } - /// Used to compute the horizontal translation amount. /// The more it's dragged the less it moves on a circular ease out curve private func circularEaseOut(_ value: Double) -> Double { diff --git a/ElementX/Sources/Screens/RoomSelectionScreen/RoomSelectionScreenViewModel.swift b/ElementX/Sources/Screens/RoomSelectionScreen/RoomSelectionScreenViewModel.swift index a9144567a..5e775a6e3 100644 --- a/ElementX/Sources/Screens/RoomSelectionScreen/RoomSelectionScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomSelectionScreen/RoomSelectionScreenViewModel.swift @@ -12,7 +12,6 @@ import SwiftUI typealias RoomSelectionScreenViewModelType = StateStoreViewModel class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelectionScreenViewModelProtocol { - private let clientProxy: ClientProxyProtocol private let roomSummaryProvider: RoomSummaryProviderProtocol private var actionsSubject: PassthroughSubject = .init() @@ -23,7 +22,6 @@ class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelect init(userSession: UserSessionProtocol, roomSummaryProvider: RoomSummaryProviderProtocol) { - clientProxy = userSession.clientProxy self.roomSummaryProvider = roomSummaryProvider super.init(initialViewState: RoomSelectionScreenViewState(), mediaProvider: userSession.mediaProvider) diff --git a/ElementX/Sources/Screens/RoomThreadListScreen/RoomThreadListScreenCoordinator.swift b/ElementX/Sources/Screens/RoomThreadListScreen/RoomThreadListScreenCoordinator.swift index 79b4715cf..886f92425 100644 --- a/ElementX/Sources/Screens/RoomThreadListScreen/RoomThreadListScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomThreadListScreen/RoomThreadListScreenCoordinator.swift @@ -18,7 +18,6 @@ enum RoomThreadListScreenCoordinatorAction { } final class RoomThreadListScreenCoordinator: CoordinatorProtocol { - private let parameters: RoomThreadListScreenCoordinatorParameters private let viewModel: RoomThreadListScreenViewModelProtocol private var cancellables = Set() @@ -29,8 +28,6 @@ final class RoomThreadListScreenCoordinator: CoordinatorProtocol { } init(parameters: RoomThreadListScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = RoomThreadListScreenViewModel(threadListServiceProxy: parameters.threadListServiceProxy, mediaProvider: parameters.mediaProvider) } diff --git a/ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift b/ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift index 91bc813f6..f57806f71 100644 --- a/ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift +++ b/ElementX/Sources/Screens/SearchScreen/SearchScreenViewModel.swift @@ -14,7 +14,6 @@ typealias SearchScreenViewModelType = StateStoreViewModelV2? private var loadingObservationTask: Task? private var setQueryTask: Task? @@ -30,7 +29,6 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro initialSearchQuery: String = "", initialSearchMode: SearchScreenMode = .rooms) { self.roomSummaryProvider = roomSummaryProvider - self.clientProxy = clientProxy searchService = clientProxy.searchService super.init(initialViewState: SearchScreenViewState(bindings: .init(searchQuery: initialSearchQuery, searchMode: initialSearchMode)), diff --git a/ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift b/ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift index dfacbc0ad..8472bb6f4 100644 --- a/ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift +++ b/ElementX/Sources/Screens/SearchScreen/View/SearchScreen.swift @@ -144,7 +144,6 @@ struct SearchScreen: View { ForEach(context.viewState.rooms) { room in SearchScreenRoomCell(room: room, context: context, - isLast: room == context.viewState.rooms.last, isSelected: isHardwareKeyboardConnected && selectedID == room.id) .onAppear { if room == context.viewState.rooms.first { @@ -227,7 +226,6 @@ private extension View { private struct SearchScreenRoomCell: View { let room: SearchScreenRoom let context: SearchScreenViewModel.Context - let isLast: Bool let isSelected: Bool @Environment(\.dynamicTypeSize) private var dynamicTypeSize diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift index 89c3d3cb4..90998c0ab 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift @@ -17,7 +17,6 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat private let backupUploadStateSubject: CurrentValueSubject = .init(.waiting) - // periphery:ignore - auto cancels when reassigned @CancellableTask private var keyUploadWaitingTask: Task? @CancellableTask diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift index ead23aeca..7dc06fc24 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift @@ -21,7 +21,6 @@ enum SecureBackupScreenCoordinatorAction { } final class SecureBackupScreenCoordinator: CoordinatorProtocol { - private let parameters: SecureBackupScreenCoordinatorParameters private var viewModel: SecureBackupScreenViewModelProtocol private var cancellables = Set() @@ -32,8 +31,6 @@ final class SecureBackupScreenCoordinator: CoordinatorProtocol { } init(parameters: SecureBackupScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SecureBackupScreenViewModel(secureBackupController: parameters.clientProxy.secureBackupController, userIndicatorController: parameters.userIndicatorController, chatBackupDetailsURL: parameters.appSettings.chatBackupDetailsURL) diff --git a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenModels.swift b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenModels.swift index 2656a01f4..e0b01de3e 100644 --- a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenModels.swift +++ b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenModels.swift @@ -15,8 +15,6 @@ enum SecurityAndPrivacyScreenViewModelAction { } struct SecurityAndPrivacyScreenViewState: BindableState { - let serverName: String - var currentSettings: SecurityAndPrivacySettings var bindings: SecurityAndPrivacyScreenViewStateBindings let strings: SecurityAndPrivacyScreenStrings @@ -153,14 +151,12 @@ struct SecurityAndPrivacyScreenViewState: BindableState { } } - init(serverName: String, - accessType: SecurityAndPrivacyRoomAccessType, + init(accessType: SecurityAndPrivacyRoomAccessType, isEncryptionEnabled: Bool, historyVisibility: SecurityAndPrivacyHistoryVisibility, isSpace: Bool, isKnockingEnabled: Bool, historySharingDetailsURL: URL) { - self.serverName = serverName self.isKnockingEnabled = isKnockingEnabled self.isSpace = isSpace diff --git a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift index 3398cf595..d33d80d03 100644 --- a/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift +++ b/ElementX/Sources/Screens/SecurityAndPrivacyScreen/SecurityAndPrivacyScreenViewModel.swift @@ -32,8 +32,7 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType, self.userIndicatorController = userIndicatorController self.appSettings = appSettings - super.init(initialViewState: SecurityAndPrivacyScreenViewState(serverName: clientProxy.userIDServerName ?? "", - accessType: roomProxy.infoPublisher.value.joinRule.toSecurityAndPrivacyRoomAccessType, + super.init(initialViewState: SecurityAndPrivacyScreenViewState(accessType: roomProxy.infoPublisher.value.joinRule.toSecurityAndPrivacyRoomAccessType, isEncryptionEnabled: roomProxy.infoPublisher.value.isEncrypted, historyVisibility: roomProxy.infoPublisher.value.historyVisibility.toSecurityAndPrivacyHistoryVisibility, isSpace: roomProxy.infoPublisher.value.isSpace, diff --git a/ElementX/Sources/Screens/Settings/AdvancedSettingsScreen/AdvancedSettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/AdvancedSettingsScreen/AdvancedSettingsScreenModels.swift index 48b455549..41adad23d 100644 --- a/ElementX/Sources/Screens/Settings/AdvancedSettingsScreen/AdvancedSettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/AdvancedSettingsScreen/AdvancedSettingsScreenModels.swift @@ -34,7 +34,6 @@ struct AdvancedSettingsScreenViewState: BindableState { var bindings: AdvancedSettingsScreenViewStateBindings } -// periphery:ignore - subscript are seen as false positives @dynamicMemberLookup struct AdvancedSettingsScreenViewStateBindings { private let advancedSettings: AdvancedSettingsProtocol diff --git a/ElementX/Sources/Screens/Settings/DeactivateAccountScreen/DeactivateAccountScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/DeactivateAccountScreen/DeactivateAccountScreenCoordinator.swift index 2ea55babd..1b8b93ed9 100644 --- a/ElementX/Sources/Screens/Settings/DeactivateAccountScreen/DeactivateAccountScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/DeactivateAccountScreen/DeactivateAccountScreenCoordinator.swift @@ -19,7 +19,6 @@ enum DeactivateAccountScreenCoordinatorAction { } final class DeactivateAccountScreenCoordinator: CoordinatorProtocol { - private let parameters: DeactivateAccountScreenCoordinatorParameters private let viewModel: DeactivateAccountScreenViewModelProtocol private var cancellables = Set() @@ -30,8 +29,6 @@ final class DeactivateAccountScreenCoordinator: CoordinatorProtocol { } init(parameters: DeactivateAccountScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = DeactivateAccountScreenViewModel(clientProxy: parameters.clientProxy, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift index e113d3835..4f692d588 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenCoordinator.swift @@ -25,7 +25,6 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol { init(appSettings: AppSettings, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) { viewModel = DeveloperOptionsScreenViewModel(developerOptions: appSettings, - elementCallBaseURL: appSettings.elementCallBaseURL, appHooks: appHooks, clientProxy: clientProxy) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 539afbfa5..c5ddd12a6 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -13,7 +13,6 @@ enum DeveloperOptionsScreenViewModelAction { } struct DeveloperOptionsScreenViewState: BindableState { - let elementCallBaseURL: URL let appHooks: AppHooks var storeSizes: [StoreSize]? let shouldShowClearCache: Bool @@ -31,7 +30,6 @@ struct DeveloperOptionsScreenViewState: BindableState { } } -// periphery: ignore - subscripts are seen as false positive @dynamicMemberLookup struct DeveloperOptionsScreenViewStateBindings { private let developerOptions: DeveloperOptionsProtocol diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift index 9d9ea1977..b97fb5a0c 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenViewModel.swift @@ -20,10 +20,9 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve private let clientProxy: ClientProxyProtocol? - init(developerOptions: DeveloperOptionsProtocol, elementCallBaseURL: URL, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) { + init(developerOptions: DeveloperOptionsProtocol, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) { self.clientProxy = clientProxy - super.init(initialViewState: .init(elementCallBaseURL: elementCallBaseURL, - appHooks: appHooks, + super.init(initialViewState: .init(appHooks: appHooks, shouldShowClearCache: clientProxy != nil, isPresentedModally: clientProxy == nil, bindings: .init(developerOptions: developerOptions))) diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index cc93ec787..121c1829b 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -259,7 +259,6 @@ private extension Set { struct DeveloperOptionsScreen_Previews: PreviewProvider { static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: AppSettings.volatile(), - elementCallBaseURL: AppSettings.volatile().elementCallBaseURL, appHooks: AppHooks(), clientProxy: ClientProxyMock(.init())) diff --git a/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenCoordinator.swift index ff78f492f..436fb5ef9 100644 --- a/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenCoordinator.swift @@ -10,7 +10,7 @@ import Combine import SwiftUI final class LegalInformationScreenCoordinator: CoordinatorProtocol { - private let viewModel: LegalInformationScreenViewModel + private let viewModel: LegalInformationScreenViewModelProtocol init(appSettings: AppSettings) { viewModel = LegalInformationScreenViewModel(appSettings: appSettings) diff --git a/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenViewModelProtocol.swift b/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenViewModelProtocol.swift index c39061edb..14d73575e 100644 --- a/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenViewModelProtocol.swift +++ b/ElementX/Sources/Screens/Settings/LegalInformationScreen/LegalInformationScreenViewModelProtocol.swift @@ -8,7 +8,6 @@ import Combine -// periphery:ignore - markdown protocol protocol LegalInformationScreenViewModelProtocol { var context: LegalInformationScreenViewModelType.Context { get } } diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsEditScreen/NotificationSettingsEditScreenViewModel.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsEditScreen/NotificationSettingsEditScreenViewModel.swift index 8d4fd2b11..0e533eb99 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsEditScreen/NotificationSettingsEditScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsEditScreen/NotificationSettingsEditScreenViewModel.swift @@ -18,9 +18,7 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie private let userSession: UserSessionProtocol private let roomSummaryProvider: RoomSummaryProviderProtocol? - // periphery:ignore - cancellable tasks get cancelled when reassigned @CancellableTask private var fetchDefaultRoomNotificationModesTask: Task? - // periphery:ignore - cancellable tasks get cancelled when reassigned @CancellableTask private var updateRoomsWithUserDefinedModeTask: Task? var actions: AnyPublisher { diff --git a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift index 04d1b47e0..3a3622c7e 100644 --- a/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/NotificationSettingsScreen/NotificationSettingsScreenViewModel.swift @@ -17,7 +17,6 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy private let userNotificationCenter: UserNotificationCenterProtocol private let notificationSettingsProxy: NotificationSettingsProxyProtocol private let userIndicatorController: UserIndicatorControllerProtocol - // periphery:ignore - cancellable tasks get cancelled when reassigned @CancellableTask private var fetchSettingsTask: Task? private let notificationTonePreviewer: AudioPlayerProtocol private let notificationToneManager: NotificationToneManagerProtocol diff --git a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift index 7c30fe451..af26667ee 100644 --- a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift @@ -15,7 +15,6 @@ struct UserDetailsEditScreenCoordinatorParameters { let mediaUploadingPreprocessor: MediaUploadingPreprocessor weak var navigationStackCoordinator: NavigationStackCoordinator? let userIndicatorController: UserIndicatorControllerProtocol - let appSettings: AppSettings } enum UserDetailsEditScreenCoordinatorAction { @@ -27,8 +26,8 @@ final class UserDetailsEditScreenCoordinator: CoordinatorProtocol { private var viewModel: UserDetailsEditScreenViewModelProtocol private var cancellables = Set() - private let actionsSubject: PassthroughSubject = .init() - var actions: AnyPublisher { + private let actionsSubject: PassthroughSubject = .init() + var actions: AnyPublisher { actionsSubject.eraseToAnyPublisher() } diff --git a/ElementX/Sources/Screens/Spaces/LeaveSpace/LeaveSpaceViewModel.swift b/ElementX/Sources/Screens/Spaces/LeaveSpace/LeaveSpaceViewModel.swift index 381752d41..d2203f623 100644 --- a/ElementX/Sources/Screens/Spaces/LeaveSpace/LeaveSpaceViewModel.swift +++ b/ElementX/Sources/Screens/Spaces/LeaveSpace/LeaveSpaceViewModel.swift @@ -17,11 +17,9 @@ class LeaveSpaceViewModel: LeaveSpaceViewModelType { } private let userIndicatorController: UserIndicatorControllerProtocol - private let mediaProvider: MediaProviderProtocol init(spaceName: String, canEditRolesAndPermissions: Bool, leaveHandle: LeaveSpaceHandleProxy, userIndicatorController: UserIndicatorControllerProtocol, mediaProvider: MediaProviderProtocol) { self.userIndicatorController = userIndicatorController - self.mediaProvider = mediaProvider super.init(initialViewState: LeaveSpaceViewState(spaceName: spaceName, canEditRolesAndPermissions: canEditRolesAndPermissions, leaveHandle: leaveHandle), mediaProvider: mediaProvider) } diff --git a/ElementX/Sources/Screens/Spaces/SpaceScreen/SpaceScreenCoordinator.swift b/ElementX/Sources/Screens/Spaces/SpaceScreen/SpaceScreenCoordinator.swift index 13557069d..0a21b5664 100644 --- a/ElementX/Sources/Screens/Spaces/SpaceScreen/SpaceScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Spaces/SpaceScreen/SpaceScreenCoordinator.swift @@ -6,8 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery:ignore:all - this is just a space remove this comment once generating the final file - import Combine import SwiftUI @@ -33,7 +31,6 @@ enum SpaceScreenCoordinatorAction { } final class SpaceScreenCoordinator: CoordinatorProtocol { - private let parameters: SpaceScreenCoordinatorParameters private let viewModel: SpaceScreenViewModelProtocol private var cancellables = Set() @@ -44,8 +41,6 @@ final class SpaceScreenCoordinator: CoordinatorProtocol { } init(parameters: SpaceScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SpaceScreenViewModel(spaceRoomListProxy: parameters.spaceRoomListProxy, spaceServiceProxy: parameters.spaceServiceProxy, selectedSpaceRoomPublisher: parameters.selectedSpaceRoomPublisher, diff --git a/ElementX/Sources/Screens/Spaces/SpaceSettingsScreen/View/SpaceSettingsScreen.swift b/ElementX/Sources/Screens/Spaces/SpaceSettingsScreen/View/SpaceSettingsScreen.swift index 0cf2dfb01..72dc7e0b8 100644 --- a/ElementX/Sources/Screens/Spaces/SpaceSettingsScreen/View/SpaceSettingsScreen.swift +++ b/ElementX/Sources/Screens/Spaces/SpaceSettingsScreen/View/SpaceSettingsScreen.swift @@ -135,8 +135,7 @@ struct SpaceSettingsScreen_Previews: PreviewProvider, TestablePreview { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) } static var previews: some View { diff --git a/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenCoordinator.swift b/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenCoordinator.swift index 88abd654c..4f9384102 100644 --- a/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenCoordinator.swift @@ -12,7 +12,6 @@ import SwiftUI struct SpacesScreenCoordinatorParameters { let userSession: UserSessionProtocol let selectedSpacePublisher: CurrentValuePublisher - let appSettings: AppSettings let userIndicatorController: UserIndicatorControllerProtocol } @@ -23,7 +22,6 @@ enum SpacesScreenCoordinatorAction { } final class SpacesScreenCoordinator: CoordinatorProtocol { - private let parameters: SpacesScreenCoordinatorParameters private let viewModel: SpacesScreenViewModelProtocol private var cancellables = Set() @@ -34,11 +32,8 @@ final class SpacesScreenCoordinator: CoordinatorProtocol { } init(parameters: SpacesScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SpacesScreenViewModel(userSession: parameters.userSession, selectedSpacePublisher: parameters.selectedSpacePublisher, - appSettings: parameters.appSettings, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenViewModel.swift b/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenViewModel.swift index 64212baa4..45196bcf2 100644 --- a/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenViewModel.swift +++ b/ElementX/Sources/Screens/Spaces/SpacesScreen/SpacesScreenViewModel.swift @@ -13,7 +13,6 @@ typealias SpacesScreenViewModelType = StateStoreViewModelV2 = .init() @@ -23,10 +22,8 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro init(userSession: UserSessionProtocol, selectedSpacePublisher: CurrentValuePublisher, - appSettings: AppSettings, userIndicatorController: UserIndicatorControllerProtocol) { spaceServiceProxy = userSession.clientProxy.spaceService - self.appSettings = appSettings self.userIndicatorController = userIndicatorController super.init(initialViewState: SpacesScreenViewState(userProfile: userSession.clientProxy.userProfilePublisher.value, diff --git a/ElementX/Sources/Screens/Spaces/SpacesScreen/View/SpacesScreen.swift b/ElementX/Sources/Screens/Spaces/SpacesScreen/View/SpacesScreen.swift index f1aec6ee1..75ab1476a 100644 --- a/ElementX/Sources/Screens/Spaces/SpacesScreen/View/SpacesScreen.swift +++ b/ElementX/Sources/Screens/Spaces/SpacesScreen/View/SpacesScreen.swift @@ -151,7 +151,6 @@ struct SpacesScreen_Previews: PreviewProvider, TestablePreview { return SpacesScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy)), selectedSpacePublisher: .init(nil), - appSettings: appSettings, userIndicatorController: UserIndicatorControllerMock()) } } diff --git a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenCoordinator.swift b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenCoordinator.swift index 0607f6c33..c74166f82 100644 --- a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenCoordinator.swift +++ b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenCoordinator.swift @@ -13,7 +13,6 @@ struct StartChatScreenCoordinatorParameters { let userSession: UserSessionProtocol let userDiscoveryService: UserDiscoveryServiceProtocol let userIndicatorController: UserIndicatorControllerProtocol - let appSettings: AppSettings let analytics: AnalyticsServiceProtocol } @@ -25,7 +24,6 @@ enum StartChatScreenCoordinatorAction { } final class StartChatScreenCoordinator: CoordinatorProtocol { - private let parameters: StartChatScreenCoordinatorParameters private var viewModel: StartChatScreenViewModelProtocol private var cancellables = Set() @@ -35,13 +33,10 @@ final class StartChatScreenCoordinator: CoordinatorProtocol { } init(parameters: StartChatScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = StartChatScreenViewModel(userSession: parameters.userSession, analytics: parameters.analytics, userIndicatorController: parameters.userIndicatorController, - userDiscoveryService: parameters.userDiscoveryService, - appSettings: parameters.appSettings) + userDiscoveryService: parameters.userDiscoveryService) } func start() { diff --git a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenModels.swift b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenModels.swift index 39e3200e0..74d75b84f 100644 --- a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenModels.swift +++ b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenModels.swift @@ -10,7 +10,6 @@ import Foundation enum StartChatScreenErrorType: Error { case failedCreatingRoom - case unknown } enum StartChatScreenViewModelAction: Equatable { diff --git a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift index c43c6af37..ea852c294 100644 --- a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift +++ b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift @@ -17,7 +17,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie private let analytics: AnalyticsServiceProtocol private let userIndicatorController: UserIndicatorControllerProtocol private let userDiscoveryService: UserDiscoveryServiceProtocol - private let appSettings: AppSettings private var suggestedUsers = [UserProfile]() @@ -29,13 +28,11 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie init(userSession: UserSessionProtocol, analytics: AnalyticsServiceProtocol, userIndicatorController: UserIndicatorControllerProtocol, - userDiscoveryService: UserDiscoveryServiceProtocol, - appSettings: AppSettings) { + userDiscoveryService: UserDiscoveryServiceProtocol) { self.userSession = userSession self.analytics = analytics self.userIndicatorController = userIndicatorController self.userDiscoveryService = userDiscoveryService - self.appSettings = appSettings super.init(initialViewState: StartChatScreenViewState(userID: userSession.clientProxy.userID), mediaProvider: userSession.mediaProvider) @@ -92,7 +89,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie // MARK: - Private - // periphery:ignore - auto cancels when reassigned @CancellableTask private var resolveAliasTask: Task? private var internalRoomAddressState: JoinByAddressState = .example @@ -162,7 +158,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie } } - // periphery:ignore - auto cancels when reassigned @CancellableTask private var fetchUsersTask: Task? diff --git a/ElementX/Sources/Screens/StartChatScreen/View/JoinRoomByAddressView.swift b/ElementX/Sources/Screens/StartChatScreen/View/JoinRoomByAddressView.swift index 4ca1c3b9a..65d521594 100644 --- a/ElementX/Sources/Screens/StartChatScreen/View/JoinRoomByAddressView.swift +++ b/ElementX/Sources/Screens/StartChatScreen/View/JoinRoomByAddressView.swift @@ -12,8 +12,6 @@ import SwiftUI struct JoinRoomByAddressView: View { @ObservedObject var context: StartChatScreenViewModel.Context - @Environment(\.dismiss) private var dismiss - @State private var sheetHeight: CGFloat = .zero @FocusState private var textFieldFocus private let topPadding: CGFloat = 22 @@ -87,8 +85,7 @@ struct JoinRoomByAddressView_Previews: PreviewProvider, TestablePreview { return StartChatScreenViewModel(userSession: userSession, analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), - userDiscoveryService: userDiscoveryService, - appSettings: .volatile()) + userDiscoveryService: userDiscoveryService) }() static var previews: some View { diff --git a/ElementX/Sources/Screens/StartChatScreen/View/StartChatScreen.swift b/ElementX/Sources/Screens/StartChatScreen/View/StartChatScreen.swift index 89fe04616..08591b7c4 100644 --- a/ElementX/Sources/Screens/StartChatScreen/View/StartChatScreen.swift +++ b/ElementX/Sources/Screens/StartChatScreen/View/StartChatScreen.swift @@ -161,8 +161,7 @@ struct StartChatScreen_Previews: PreviewProvider, TestablePreview { return StartChatScreenViewModel(userSession: userSession, analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), - userDiscoveryService: userDiscoveryService, - appSettings: appSettings) + userDiscoveryService: userDiscoveryService) }() static var previews: some View { diff --git a/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenCoordinator.swift b/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenCoordinator.swift index 2ac6b7420..5a9b24b5c 100644 --- a/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenCoordinator.swift +++ b/ElementX/Sources/Screens/ThreadTimelineScreen/ThreadTimelineScreenCoordinator.swift @@ -43,7 +43,6 @@ enum ThreadTimelineScreenCoordinatorAction { } final class ThreadTimelineScreenCoordinator: CoordinatorProtocol { - private let parameters: ThreadTimelineScreenCoordinatorParameters private let viewModel: ThreadTimelineScreenViewModelProtocol private let timelineViewModel: TimelineViewModelProtocol private var composerViewModel: ComposerToolbarViewModelProtocol @@ -56,8 +55,6 @@ final class ThreadTimelineScreenCoordinator: CoordinatorProtocol { } init(parameters: ThreadTimelineScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = ThreadTimelineScreenViewModel(roomProxy: parameters.roomProxy, userSession: parameters.userSession) timelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy, diff --git a/ElementX/Sources/Screens/Timeline/TimelineTableViewController.swift b/ElementX/Sources/Screens/Timeline/TimelineTableViewController.swift index a1ed6f09f..4fe7a5f3d 100644 --- a/ElementX/Sources/Screens/Timeline/TimelineTableViewController.swift +++ b/ElementX/Sources/Screens/Timeline/TimelineTableViewController.swift @@ -17,7 +17,6 @@ import SwiftUI class TimelineItemCell: UITableViewCell { static let reuseIdentifier = "TimelineItemCell" - // periphery:ignore - retaining purpose var item: RoomTimelineItemViewState? override func prepareForReuse() { diff --git a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift index 9a05f3e4f..bacce1d17 100644 --- a/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift +++ b/ElementX/Sources/Screens/Timeline/TimelineViewModel.swift @@ -31,7 +31,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol { private let appSettings: AppSettings private let analyticsService: AnalyticsServiceProtocol private let emojiProvider: EmojiProviderProtocol - private let timelineControllerFactory: TimelineControllerFactoryProtocol private let timelineInteractionHandler: TimelineInteractionHandler @@ -68,7 +67,6 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol { self.userIndicatorController = userIndicatorController self.appMediator = appMediator self.emojiProvider = emojiProvider - self.timelineControllerFactory = timelineControllerFactory let voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: AudioRecorder(), mediaPlayerProvider: mediaPlayerProvider) diff --git a/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenu.swift b/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenu.swift index 77710c3ac..d16cb49b1 100644 --- a/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenu.swift +++ b/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenu.swift @@ -337,7 +337,6 @@ struct TimelineItemMenu_Previews: PreviewProvider, TestablePreview { canCurrentUserRedactOthers: false, canCurrentUserPin: true, pinnedEventIDs: [], - isDM: true, isViewSourceEnabled: true, areThreadsEnabled: true, timelineKind: .live, diff --git a/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenuActionProvider.swift b/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenuActionProvider.swift index d00a98f27..0a11ce98e 100644 --- a/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenuActionProvider.swift +++ b/ElementX/Sources/Screens/Timeline/View/ItemMenu/TimelineItemMenuActionProvider.swift @@ -15,7 +15,6 @@ struct TimelineItemMenuActionProvider { let canCurrentUserRedactOthers: Bool let canCurrentUserPin: Bool let pinnedEventIDs: Set - let isDM: Bool let isViewSourceEnabled: Bool let areThreadsEnabled: Bool let timelineKind: TimelineKind @@ -33,8 +32,8 @@ struct TimelineItemMenuActionProvider { return nil } - if let encryptedItem = timelineItem as? EncryptedRoomTimelineItem { - return makeEncryptedItemActions(encryptedItem) + if timelineItem is EncryptedRoomTimelineItem { + return makeEncryptedItemActions() } var actions: [TimelineItemMenuAction] = [] @@ -148,7 +147,7 @@ struct TimelineItemMenuActionProvider { return .init(isReactable: isReactable, actions: actions, secondaryActions: secondaryActions, emojiProvider: emojiProvider) } - private func makeEncryptedItemActions(_ encryptedItem: EncryptedRoomTimelineItem) -> TimelineItemMenuActions? { + private func makeEncryptedItemActions() -> TimelineItemMenuActions? { var actions: [TimelineItemMenuAction] = [.copyPermalink] if isViewSourceEnabled { diff --git a/ElementX/Sources/Screens/Timeline/View/Replies/TimelineReplyView.swift b/ElementX/Sources/Screens/Timeline/View/Replies/TimelineReplyView.swift index cc21a4182..8983848ba 100644 --- a/ElementX/Sources/Screens/Timeline/View/Replies/TimelineReplyView.swift +++ b/ElementX/Sources/Screens/Timeline/View/Replies/TimelineReplyView.swift @@ -17,6 +17,7 @@ enum TimelineReplyViewPlacement { struct TimelineReplyView: View { @Environment(\.timelineContext) private var timelineContext + // periphery:ignore - might be useful to have let placement: TimelineReplyViewPlacement let timelineItemReplyDetails: TimelineItemReplyDetails? var maxWidth: CGFloat? diff --git a/ElementX/Sources/Screens/Timeline/View/Style/SwipeToReplyView.swift b/ElementX/Sources/Screens/Timeline/View/Style/SwipeToReplyView.swift deleted file mode 100644 index 6db635c64..000000000 --- a/ElementX/Sources/Screens/Timeline/View/Style/SwipeToReplyView.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright 2025 Element Creations Ltd. -// Copyright 2023-2025 New Vector Ltd. -// -// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. -// Please see LICENSE files in the repository root for full details. -// - -import Compound -import SwiftUI - -struct SwipeToReplyView: View { - let timelineItem: RoomTimelineItemProtocol - - var body: some View { - CompoundIcon(\.reply) - .foregroundColor(.compound.iconPrimary) - .accessibilityHidden(true) - } -} - -struct SwipeToReplyView_Previews: PreviewProvider, TestablePreview { - static let timelineItem = TextRoomTimelineItem(id: .randomEvent, - timestamp: .mock, - isOutgoing: true, - isEditable: true, - canBeRepliedTo: true, - sender: .init(id: ""), - content: .init(body: "")) - - static var previews: some View { - SwipeToReplyView(timelineItem: timelineItem) - } -} diff --git a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift index b57a16d9e..8d23bfd23 100644 --- a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift +++ b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift @@ -166,7 +166,9 @@ struct TimelineItemBubbledStylerView: View { context.send(viewAction: .displayTimelineItemMenu(itemID: timelineItem.id)) } .swipeRightAction { - SwipeToReplyView(timelineItem: timelineItem) + CompoundIcon(\.reply) + .foregroundColor(.compound.iconPrimary) + .accessibilityHidden(true) } shouldStartAction: { timelineItem.canBeRepliedTo } action: { @@ -180,7 +182,6 @@ struct TimelineItemBubbledStylerView: View { canCurrentUserRedactOthers: context.viewState.canCurrentUserRedactOthers, canCurrentUserPin: context.viewState.canCurrentUserPin, pinnedEventIDs: context.viewState.pinnedEventIDs, - isDM: context.viewState.isDM, isViewSourceEnabled: context.viewState.isViewSourceEnabled, areThreadsEnabled: context.viewState.areThreadsEnabled, timelineKind: context.viewState.timelineKind, diff --git a/ElementX/Sources/Screens/Timeline/View/Supplementary/TimelineReactionsView.swift b/ElementX/Sources/Screens/Timeline/View/Supplementary/TimelineReactionsView.swift index 8e3ac7870..cd50d32e5 100644 --- a/ElementX/Sources/Screens/Timeline/View/Supplementary/TimelineReactionsView.swift +++ b/ElementX/Sources/Screens/Timeline/View/Supplementary/TimelineReactionsView.swift @@ -138,8 +138,6 @@ struct TimelineCollapseButtonLabel: View { } struct TimelineReactionButton: View { - @Environment(\.accessibilityVoiceOverEnabled) private var voiceOverEnabled - let reaction: AggregatedReaction let toggleReaction: (String) -> Void let showReactionSummary: (String) -> Void diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallInviteRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallInviteRoomTimelineView.swift index d2a6dcbea..3f11d94aa 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallInviteRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallInviteRoomTimelineView.swift @@ -11,8 +11,6 @@ import Foundation import SwiftUI struct CallInviteRoomTimelineView: View { - let timelineItem: CallInviteRoomTimelineItem - var body: some View { Label { Text(L10n.screenRoomTimelineLegacyCall) @@ -34,10 +32,6 @@ struct CallInviteRoomTimelineView_Previews: PreviewProvider, TestablePreview { } static var body: some View { - CallInviteRoomTimelineView(timelineItem: .init(id: .randomEvent, - timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, - sender: .init(id: "Bob"))) + CallInviteRoomTimelineView() } } diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallNotificationRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallNotificationRoomTimelineView.swift index eb86afb08..3455929f4 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallNotificationRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/CallNotificationRoomTimelineView.swift @@ -11,8 +11,6 @@ import Foundation import SwiftUI struct CallNotificationRoomTimelineView: View { - @Environment(\.timelineContext) private var context - let timelineItem: CallNotificationRoomTimelineItem var body: some View { @@ -76,8 +74,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi VStack(spacing: 0) { CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: false, isDeclinedByMe: false, isDeclined: false, @@ -87,8 +83,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: true, isDeclinedByMe: false, isDeclined: false, @@ -98,8 +92,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: false, isDeclinedByMe: true, isDeclined: true, @@ -109,8 +101,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: true, isDeclinedByMe: false, isDeclined: true, @@ -120,8 +110,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: true, isDeclinedByMe: true, isDeclined: true, @@ -131,8 +119,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: true, isDeclinedByMe: false, isDeclined: true, @@ -142,8 +128,6 @@ struct CallNotificationRoomTimelineView_Previews: PreviewProvider, TestablePrevi CallNotificationRoomTimelineView(timelineItem: .init(id: .randomEvent, timestamp: .mock, - isEditable: false, - canBeRepliedTo: false, isDM: true, isDeclinedByMe: true, isDeclined: true, diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift index bbf8b4c8b..a9e3a416e 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/LiveLocationRoomTimelineView.swift @@ -13,10 +13,8 @@ struct LiveLocationRoomTimelineView: View { @Environment(\.timelineContext) private var context: TimelineViewModel.Context! @State private var hasExpired: Bool let timelineItem: LiveLocationRoomTimelineItem - private let currentDate: Date init(currentDate: Date = .now, timelineItem: LiveLocationRoomTimelineItem, isStopped: Bool = false) { - self.currentDate = currentDate self.timelineItem = timelineItem _hasExpired = State(initialValue: isStopped || currentDate >= timelineItem.content.timeoutDate) } diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/PaginationIndicatorRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/PaginationIndicatorRoomTimelineView.swift index 0babd3ea1..e3f319484 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/PaginationIndicatorRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/PaginationIndicatorRoomTimelineView.swift @@ -9,8 +9,6 @@ import SwiftUI struct PaginationIndicatorRoomTimelineView: View { - let timelineItem: PaginationIndicatorRoomTimelineItem - var body: some View { ProgressView() .frame(maxWidth: .infinity) @@ -20,7 +18,6 @@ struct PaginationIndicatorRoomTimelineView: View { struct PaginationIndicatorRoomTimelineView_Previews: PreviewProvider, TestablePreview { static var previews: some View { - let item = PaginationIndicatorRoomTimelineItem(position: .start) - PaginationIndicatorRoomTimelineView(timelineItem: item) + PaginationIndicatorRoomTimelineView() } } diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ReadMarkerRoomTimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ReadMarkerRoomTimelineView.swift index 3c628708c..1e7b56565 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ReadMarkerRoomTimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/ReadMarkerRoomTimelineView.swift @@ -10,8 +10,6 @@ import Foundation import SwiftUI struct ReadMarkerRoomTimelineView: View { - let timelineItem: ReadMarkerRoomTimelineItem - var body: some View { VStack(alignment: .trailing, spacing: 2) { Text(L10n.screenRoomTimelineReadMarkerTitle) @@ -30,8 +28,6 @@ struct ReadMarkerRoomTimelineView: View { struct ReadMarkerRoomTimelineView_Previews: PreviewProvider, TestablePreview { static let viewModel = TimelineViewModel.mock - static let item = ReadMarkerRoomTimelineItem(id: .randomVirtual) - static var previews: some View { VStack(alignment: .leading, spacing: 0) { RoomTimelineItemView(viewState: .init(type: .separator(.init(id: .virtual(uniqueID: .init("Separator")), timestamp: .mock)), groupStyle: .single)) @@ -43,7 +39,7 @@ struct ReadMarkerRoomTimelineView_Previews: PreviewProvider, TestablePreview { sender: .init(id: "1", displayName: "Bob"), content: .init(body: "This is another message"))), groupStyle: .single)) - ReadMarkerRoomTimelineView(timelineItem: item) + ReadMarkerRoomTimelineView() RoomTimelineItemView(viewState: .init(type: .separator(.init(id: .virtual(uniqueID: .init("Separator")), timestamp: .mock)), groupStyle: .single)) RoomTimelineItemView(viewState: .init(type: .text(.init(id: .randomEvent, diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/TextBasedRoomTimelineViewProtocol.swift b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/TextBasedRoomTimelineViewProtocol.swift index db5d921cb..74c9d3643 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/TextBasedRoomTimelineViewProtocol.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineItemViews/TextBasedRoomTimelineViewProtocol.swift @@ -6,7 +6,6 @@ // Please see LICENSE files in the repository root for full details. // -// periphery: ignore - markdown protocol protocol TextBasedRoomTimelineViewProtocol { associatedtype TimelineItemType: TextBasedRoomTimelineItem diff --git a/ElementX/Sources/Screens/Timeline/View/TimelineView.swift b/ElementX/Sources/Screens/Timeline/View/TimelineView.swift index e82a2a9c6..d1b2f04e4 100644 --- a/ElementX/Sources/Screens/Timeline/View/TimelineView.swift +++ b/ElementX/Sources/Screens/Timeline/View/TimelineView.swift @@ -34,7 +34,6 @@ struct TimelineView: View { canCurrentUserRedactOthers: timelineContext.viewState.canCurrentUserRedactOthers, canCurrentUserPin: timelineContext.viewState.canCurrentUserPin, pinnedEventIDs: timelineContext.viewState.pinnedEventIDs, - isDM: timelineContext.viewState.isDM, isViewSourceEnabled: timelineContext.viewState.isViewSourceEnabled, areThreadsEnabled: timelineContext.viewState.areThreadsEnabled, timelineKind: timelineContext.viewState.timelineKind, diff --git a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenCoordinator.swift b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenCoordinator.swift index a3f818741..1cc9817fe 100644 --- a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenCoordinator.swift +++ b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenCoordinator.swift @@ -15,7 +15,6 @@ struct UserProfileScreenCoordinatorParameters { let userSession: UserSessionProtocol let userIndicatorController: UserIndicatorControllerProtocol let analytics: AnalyticsServiceProtocol - let appSettings: AppSettings } enum UserProfileScreenCoordinatorAction { @@ -39,8 +38,7 @@ final class UserProfileScreenCoordinator: CoordinatorProtocol { isPresentedModally: parameters.isPresentedModally, userSession: parameters.userSession, userIndicatorController: parameters.userIndicatorController, - analytics: parameters.analytics, - appSettings: parameters.appSettings) + analytics: parameters.analytics) } func start() { diff --git a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift index 5ecd408da..e7000d0ec 100644 --- a/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift +++ b/ElementX/Sources/Screens/UserProfileScreen/UserProfileScreenViewModel.swift @@ -16,7 +16,6 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr private let userSession: UserSessionProtocol private let userIndicatorController: UserIndicatorControllerProtocol private let analytics: AnalyticsServiceProtocol - private let appSettings: AppSettings private var actionsSubject: PassthroughSubject = .init() var actionsPublisher: AnyPublisher { @@ -27,12 +26,10 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr isPresentedModally: Bool, userSession: UserSessionProtocol, userIndicatorController: UserIndicatorControllerProtocol, - analytics: AnalyticsServiceProtocol, - appSettings: AppSettings) { + analytics: AnalyticsServiceProtocol) { self.userSession = userSession self.userIndicatorController = userIndicatorController self.analytics = analytics - self.appSettings = appSettings let initialViewState = UserProfileScreenViewState(userID: userID, isOwnUser: userID == userSession.clientProxy.userID, diff --git a/ElementX/Sources/Screens/UserProfileScreen/View/UserProfileScreen.swift b/ElementX/Sources/Screens/UserProfileScreen/View/UserProfileScreen.swift index 661e4e46a..47025bf2e 100644 --- a/ElementX/Sources/Screens/UserProfileScreen/View/UserProfileScreen.swift +++ b/ElementX/Sources/Screens/UserProfileScreen/View/UserProfileScreen.swift @@ -148,7 +148,6 @@ struct UserProfileScreen_Previews: PreviewProvider, TestablePreview { isPresentedModally: false, userSession: UserSessionMock(.init(clientProxy: clientProxyMock)), userIndicatorController: UserIndicatorControllerMock(), - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) } } diff --git a/ElementX/Sources/Services/AlertTones/NotificationToneManager.swift b/ElementX/Sources/Services/AlertTones/NotificationToneManager.swift index cd19d0a28..27f8735c7 100644 --- a/ElementX/Sources/Services/AlertTones/NotificationToneManager.swift +++ b/ElementX/Sources/Services/AlertTones/NotificationToneManager.swift @@ -23,8 +23,6 @@ nonisolated struct NotificationToneManager: NotificationToneManagerProtocol { /// The source file could not be accessed due to sandbox restrictions. case couldNotAccessSandboxedResource - /// `AVAudioConverter` could not be initialised for the given format pair. - case converterSetupFailed /// A tone with the same filename already exists in the library. case fileAlreadyExists /// An `AVAudioPCMBuffer` could not be allocated. diff --git a/ElementX/Sources/Services/Analytics/AnalyticsService.swift b/ElementX/Sources/Services/Analytics/AnalyticsService.swift index dd11bd405..f2044560c 100644 --- a/ElementX/Sources/Services/Analytics/AnalyticsService.swift +++ b/ElementX/Sources/Services/Analytics/AnalyticsService.swift @@ -57,7 +57,11 @@ class AnalyticsService: AnalyticsServiceProtocol { MXLog.info("Started.") } - func reset() { + /// Resets any IDs and event queues in the analytics client. This method should + /// be called on sign-out to ensure the next + /// account used isn't associated with the previous one. + /// Note: **MUST** be called before stopping PostHog or the reset is ignored. + private func reset() { client.reset() MXLog.info("Reset.") } diff --git a/ElementX/Sources/Services/Analytics/AnalyticsServiceProtocol.swift b/ElementX/Sources/Services/Analytics/AnalyticsServiceProtocol.swift index 28d1049cb..5f48f8faf 100644 --- a/ElementX/Sources/Services/Analytics/AnalyticsServiceProtocol.swift +++ b/ElementX/Sources/Services/Analytics/AnalyticsServiceProtocol.swift @@ -37,12 +37,6 @@ protocol AnalyticsServiceProtocol: AnyObject { /// Starts the analytics client if the user has opted in, otherwise does nothing. func startIfEnabled() - /// Resets any IDs and event queues in the analytics client. This method should - /// be called on sign-out to maintain opt-in status, whilst ensuring the next - /// account used isn't associated with the previous one. - /// Note: **MUST** be called before stopping PostHog or the reset is ignored. - func reset() - /// Resets the consent state for analytics. func resetConsentState() diff --git a/ElementX/Sources/Services/Analytics/Signposter.swift b/ElementX/Sources/Services/Analytics/Signposter.swift index 56879b324..bef146983 100644 --- a/ElementX/Sources/Services/Analytics/Signposter.swift +++ b/ElementX/Sources/Services/Analytics/Signposter.swift @@ -101,10 +101,6 @@ class Signposter { globalTags[tagName] = value } - func removeGlobalTag(_ tagName: TagName) { - globalTags[tagName] = nil - } - // MARK: - Private func sha512(_ string: String) -> String { diff --git a/ElementX/Sources/Services/Audio/Player/AudioPlayer.swift b/ElementX/Sources/Services/Audio/Player/AudioPlayer.swift index e97fe1809..c624e0326 100644 --- a/ElementX/Sources/Services/Audio/Player/AudioPlayer.swift +++ b/ElementX/Sources/Services/Audio/Player/AudioPlayer.swift @@ -42,7 +42,6 @@ class AudioPlayer: NSObject, AudioPlayerProtocol { private let audioSession = AVAudioSession.sharedInstance() - // periphery:ignore - when set to nil is automatically cancelled @CancellableTask private var releaseAudioSessionTask: Task? private let releaseAudioSessionTimeoutInterval = 5.0 diff --git a/ElementX/Sources/Services/Audio/Player/AudioPlayerProtocol.swift b/ElementX/Sources/Services/Audio/Player/AudioPlayerProtocol.swift index cef3b57ca..b90e18263 100644 --- a/ElementX/Sources/Services/Audio/Player/AudioPlayerProtocol.swift +++ b/ElementX/Sources/Services/Audio/Player/AudioPlayerProtocol.swift @@ -40,7 +40,6 @@ protocol AudioPlayerProtocol: AnyObject { var currentTime: TimeInterval { get } var playbackURL: URL? { get } var state: MediaPlayerState { get } - var playbackSpeed: Float { get } var actions: AnyPublisher { get } diff --git a/ElementX/Sources/Services/Audio/Recorder/AudioRecorder.swift b/ElementX/Sources/Services/Audio/Recorder/AudioRecorder.swift index 96ce631a9..0e5fa4d02 100644 --- a/ElementX/Sources/Services/Audio/Recorder/AudioRecorder.swift +++ b/ElementX/Sources/Services/Audio/Recorder/AudioRecorder.swift @@ -84,11 +84,6 @@ nonisolated class AudioRecorder: AudioRecorderProtocol, @unchecked Sendable { } } - func cancelRecording() async { - await stopRecording() - await deleteRecording() - } - func deleteRecording() async { await withCheckedContinuation { continuation in deleteRecording { diff --git a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift index 53f629f8f..f0ed5c513 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationServiceProtocol.swift @@ -35,7 +35,6 @@ enum AuthenticationServiceError: Error, Equatable { case accountDeactivated case failedLoggingIn case sessionTokenRefreshNotSupported - case failedUsingWebCredentials } protocol AuthenticationServiceProtocol: QRCodeLoginServiceProtocol { diff --git a/ElementX/Sources/Services/Authentication/ClassicApp/ClassicAppMXAccount.swift b/ElementX/Sources/Services/Authentication/ClassicApp/ClassicAppMXAccount.swift index 7deabf12f..791f757e3 100644 --- a/ElementX/Sources/Services/Authentication/ClassicApp/ClassicAppMXAccount.swift +++ b/ElementX/Sources/Services/Authentication/ClassicApp/ClassicAppMXAccount.swift @@ -82,23 +82,8 @@ final class ClassicAppMXAccount: NSObject, NSCoding { static let homeserverURL = "homeserverurl" // String? static let userID = "userid" // String? static let accessToken = "accesstoken" // String? - static let accessTokenExpiresAt = "accessTokenExpiresAt" // UInt64 - static let refreshToken = "refreshToken" // String? - static let identityServerURL = "identityserverurl" // String? - static let identityServerAccessToken = "identityserveraccesstoken" // String? - static let deviceID = "deviceId" // String? - static let allowedCertificate = "allowedCertificate" // Data? - static let threePIDs = "threePIDs" // [MXThirdPartyIdentifier]? - static let device = "device" // MXDevice? - static let antivirusServerURL = "antivirusserverurl" // String? - static let pushGatewayURL = "pushgatewayurl" // String? - static let hasPusherForPushNotifications = "_enablePushNotifications" // Bool - static let hasPusherForPushKitNotifications = "enablePushKitNotifications" // Bool - static let enableInAppNotifications = "enableInAppNotifications" // Bool static let isDisabled = "disabled" // Bool static let isSoftLogout = "isSoftLogout" // Bool - static let isWarnedAboutEncryption = "warnedAboutEncryption" // Bool - static let others = "others" // NSMutableDictionary } required init?(coder: NSCoder) { @@ -126,6 +111,7 @@ final class ClassicAppMXAccount: NSObject, NSCoding { /// `MXUser` represents a user in Matrix. final class ClassicAppMXUser: NSObject, NSCoding { + // periphery:ignore - documents the schema, parsed but not consumed yet /// The user id. let userID: String /// The user display name. @@ -139,10 +125,6 @@ final class ClassicAppMXUser: NSObject, NSCoding { static let userID = "userId" // String static let displayName = "displayname" // String? static let avatarURL = "avatarUrl" // String? - static let statusMessage = "statusMsg" // String? - static let currentlyActive = "currentlyActive" // Bool - static let lastActiveLocalTimestamp = "lastActiveLocalTS" // UInt64 - static let latestUpdateTimestamp = "latestUpdateTS" // UInt64 } required init?(coder aDecoder: NSCoder) { diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 743f3ec94..eaef5724d 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -21,7 +21,6 @@ class ClientProxy: ClientProxyProtocol { let mediaLoader: MediaLoaderProtocol let contentScanner: ContentScannerProxyProtocol? - private let clientQueue: DispatchQueue private var roomListService: RoomListService // periphery: ignore - only for retain @@ -217,8 +216,6 @@ class ClientProxy: ClientProxyProtocol { client.enableAutomaticBackpagination() } - clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent) - mediaLoader = MediaLoader(client: client) // Route media downloads through a content scanner when one has been configured for the server, @@ -247,7 +244,6 @@ class ClientProxy: ClientProxyProtocol { capabilities = HomeserverCapabilitiesProxy(underlyingCapabilities: client.homeserverCapabilities()) let configuredAppService = try await ClientProxyServices(client: client, - actionsSubject: actionsSubject, notificationSettings: notificationSettings, appSettings: appSettings) @@ -746,6 +742,7 @@ class ClientProxy: ClientProxyProtocol { } } + // periphery:ignore - might be useful to have func setUserStatus(_ status: UserStatus.Raw) async -> Result { do { try await client.setUserStatus(status: status.rustValue) @@ -757,6 +754,7 @@ class ClientProxy: ClientProxyProtocol { } } + // periphery:ignore - might be useful to have func removeUserStatus() async -> Result { do { try await client.clearUserStatus() @@ -1450,6 +1448,7 @@ private final class ClientDelegateWrapper: ClientDelegate { authErrorCallback(isSoftLogout) } + // periphery:ignore - required by the SDK's delegate protocol func didRefreshTokens() { MXLog.info("Delegating session updates to the ClientSessionDelegate.") } @@ -1480,7 +1479,6 @@ private struct ClientProxyServices { let eventStringBuilder: RoomEventStringBuilder init(client: ClientProtocol, - actionsSubject: PassthroughSubject, notificationSettings: NotificationSettingsProxyProtocol, appSettings: AppSettings) async throws { let syncService = try await client diff --git a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift index 5631c8552..b60554947 100644 --- a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift +++ b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift @@ -35,7 +35,6 @@ enum ClientProxyError: Error { case invalidMedia case invalidServerName - case invalidResponse case failedUploadingMedia(ErrorKind) case roomPreviewIsPrivate case failedRetrievingUserIdentity @@ -160,7 +159,6 @@ protocol ClientProxyProtocol: AnyObject { var capabilities: HomeserverCapabilitiesProxyProtocol { get } var isReportRoomSupported: Bool { get async } - var isLiveKitRTCSupported: Bool { get async } var isLoginWithQRCodeSupported: Bool { get async } diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift index 4b26e66c2..1c8fcb4f4 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift @@ -36,6 +36,7 @@ struct ElementCallWidgetMessage: Codable { let action: Action var data: Data = .init() + // periphery:ignore - part of the encoded payload let widgetId: String var requestId = "widgetapi-\(UUID())" diff --git a/ElementX/Sources/Services/Emojis/EmojiProviderProtocol.swift b/ElementX/Sources/Services/Emojis/EmojiProviderProtocol.swift index 1aa0c8b77..63ede7e5e 100644 --- a/ElementX/Sources/Services/Emojis/EmojiProviderProtocol.swift +++ b/ElementX/Sources/Services/Emojis/EmojiProviderProtocol.swift @@ -33,8 +33,6 @@ enum EmojiProviderState { } protocol EmojiProviderProtocol { - var state: EmojiProviderState { get } - func categories(searchString: String?) async -> [EmojiCategory] func frequentlyUsedSystemEmojis() -> [String] diff --git a/ElementX/Sources/Services/LinkMetadata/LinkMetadataProvider.swift b/ElementX/Sources/Services/LinkMetadata/LinkMetadataProvider.swift index 4e3dacaa0..b7844d2da 100644 --- a/ElementX/Sources/Services/LinkMetadata/LinkMetadataProvider.swift +++ b/ElementX/Sources/Services/LinkMetadata/LinkMetadataProvider.swift @@ -18,7 +18,7 @@ class LinkMetadataProvider: LinkMetadataProviderProtocol { do { let metadata = try await LPMetadataProvider().startFetchingMetadata(for: url) - let item = LinkMetadataProviderItem(url: url, metadata: metadata) + let item = LinkMetadataProviderItem(metadata: metadata) metadataItems[url] = item return .success(item) } catch { diff --git a/ElementX/Sources/Services/LinkMetadata/LinkMetadataProviderProtocol.swift b/ElementX/Sources/Services/LinkMetadata/LinkMetadataProviderProtocol.swift index b23663e52..08594a758 100644 --- a/ElementX/Sources/Services/LinkMetadata/LinkMetadataProviderProtocol.swift +++ b/ElementX/Sources/Services/LinkMetadata/LinkMetadataProviderProtocol.swift @@ -10,7 +10,6 @@ import Foundation import LinkPresentation struct LinkMetadataProviderItem { - let url: URL let metadata: LPLinkMetadata? } diff --git a/ElementX/Sources/Services/Location/LiveLocationShareProxy.swift b/ElementX/Sources/Services/Location/LiveLocationShareProxy.swift index 8add14a0e..ec2bfcee2 100644 --- a/ElementX/Sources/Services/Location/LiveLocationShareProxy.swift +++ b/ElementX/Sources/Services/Location/LiveLocationShareProxy.swift @@ -12,6 +12,7 @@ struct LiveLocationShare: Hashable, Identifiable { let userID: String let geoURI: GeoURI? let timestamp: Date + // periphery:ignore - used via the synthesized Hashable conformance let timeoutDate: Date var id: String { diff --git a/ElementX/Sources/Services/Media/Provider/MediaProviderProtocol.swift b/ElementX/Sources/Services/Media/Provider/MediaProviderProtocol.swift index b1450ff1a..c43e5207e 100644 --- a/ElementX/Sources/Services/Media/Provider/MediaProviderProtocol.swift +++ b/ElementX/Sources/Services/Media/Provider/MediaProviderProtocol.swift @@ -20,7 +20,6 @@ enum MediaProviderError: Error { // sourcery: AutoMockable nonisolated protocol MediaProviderProtocol: Sendable { func imageFromSource(_ source: MediaSourceProxy?, size: CGSize?) -> UIImage? - func loadImageFromSource(_ source: MediaSourceProxy, size: CGSize?) async -> Result func loadImageDataFromSource(_ source: MediaSourceProxy) async -> Result func loadImageRetryingOnReconnection(_ source: MediaSourceProxy, size: CGSize?) -> Task diff --git a/ElementX/Sources/Services/MediaPlayer/MediaPlayerProviderProtocol.swift b/ElementX/Sources/Services/MediaPlayer/MediaPlayerProviderProtocol.swift index da1ef7731..09bb81bdf 100644 --- a/ElementX/Sources/Services/MediaPlayer/MediaPlayerProviderProtocol.swift +++ b/ElementX/Sources/Services/MediaPlayer/MediaPlayerProviderProtocol.swift @@ -8,10 +8,6 @@ import Foundation -enum MediaPlayerProviderError: Error { - case unsupportedMediaType -} - protocol MediaPlayerProviderProtocol { var player: AudioPlayerProtocol { get } diff --git a/ElementX/Sources/Services/Room/JoinRule.swift b/ElementX/Sources/Services/Room/JoinRule.swift index 4fec6109a..50217c80a 100644 --- a/ElementX/Sources/Services/Room/JoinRule.swift +++ b/ElementX/Sources/Services/Room/JoinRule.swift @@ -9,7 +9,7 @@ import Foundation import MatrixRustSDK /// The rule used for users wishing to join a room. -public nonisolated enum JoinRule: Equatable, Hashable, Sendable { +nonisolated enum JoinRule: Equatable, Hashable, Sendable { /// Anyone can join the room without any prior action. case `public` /// A user who wishes to join the room must first receive an invite. @@ -52,7 +52,7 @@ public nonisolated enum JoinRule: Equatable, Hashable, Sendable { } /// An allow rule which defines a condition that allows joining a room. -public nonisolated enum AllowRule: Equatable, Hashable, Sendable { +nonisolated enum AllowRule: Equatable, Hashable, Sendable { /// Only a member of the `room_id` Room can join the one this rule is used in. case roomMembership(roomID: String) /// A custom allow rule implementation, containing its JSON representation as a `String`. diff --git a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift index 66c572999..550fe7a85 100644 --- a/ElementX/Sources/Services/Room/JoinedRoomProxy.swift +++ b/ElementX/Sources/Services/Room/JoinedRoomProxy.swift @@ -18,7 +18,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { private let analyticsService: AnalyticsServiceProtocol private let eventStringBuilder: RoomEventStringBuilder - // periphery:ignore - required for instance retention in the rust codebase private var roomInfoObservationToken: TaskHandle? // periphery:ignore - required for instance retention in the rust codebase private var typingNotificationObservationToken: TaskHandle? @@ -43,12 +42,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { /// The predecessor is set on room creation and never changes, so we lazily store it. lazy var predecessorRoom = room.predecessorRoom() - /// The successor may change over time, so we access it dynamically. - /// It's suggested to observe it through the `infoPublisher` - var successorRoom: SuccessorRoom? { - room.successorRoom() - } - let timeline: TimelineProxyProtocol private let infoSubject: CurrentValueSubject @@ -301,16 +294,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { } } - func redact(_ eventID: String) async -> Result { - do { - try await room.redact(eventId: eventID, reason: nil) - return .success(()) - } catch { - MXLog.error("Failed redacting eventID: \(eventID) with error: \(error)") - return .failure(.sdkError(error)) - } - } - func reportContent(_ eventID: String, reason: String?) async -> Result { do { try await room.reportContent(eventId: eventID, reason: reason) @@ -442,16 +425,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { } } - func edit(eventID: String, newContent: RoomMessageEventContentWithoutRelation) async -> Result { - do { - try await room.edit(eventId: eventID, newContent: newContent) - return .success(()) - } catch { - MXLog.error("Failed editing event id \(eventID), in room \(id) with error: \(error)") - return .failure(.sdkError(error)) - } - } - func sendTypingNotification(isTyping: Bool) async -> Result { do { try await room.typingNotice(isTyping: isTyping) @@ -581,15 +554,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { // MARK: - Power Levels - func powerLevels() async -> Result { - do { - return try await .success(RoomPowerLevelsProxy(room.getPowerLevels())) - } catch { - MXLog.error("Failed building the current power level settings: \(error)") - return .failure(.sdkError(error)) - } - } - func applyPowerLevelChanges(_ changes: RoomPowerLevelChanges) async -> Result { do { return try await .success(room.applyPowerLevelChanges(changes: changes)) @@ -609,15 +573,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol { } } - func suggestedRole(for userID: String) async -> Result { - do { - return try await .success(room.suggestedRoleForUser(userId: userID)) - } catch { - MXLog.error("Failed getting a user's role: \(error)") - return .failure(.sdkError(error)) - } - } - func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result { do { let updates = updates.map { UserPowerLevelUpdate(userId: $0.userID, powerLevel: $0.powerLevel) } diff --git a/ElementX/Sources/Services/Room/RoomInfoProxy.swift b/ElementX/Sources/Services/Room/RoomInfoProxy.swift index 79f9373d5..534e1c3c5 100644 --- a/ElementX/Sources/Services/Room/RoomInfoProxy.swift +++ b/ElementX/Sources/Services/Room/RoomInfoProxy.swift @@ -16,6 +16,8 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { roomInfo.id } + // periphery:ignore - might be useful to have + var creators: [String] { roomInfo.creators ?? [] } @@ -24,6 +26,8 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { roomInfo.displayName } + // periphery:ignore - might be useful to have + var rawName: String? { roomInfo.rawName } @@ -78,6 +82,8 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { roomInfo.membership } + // periphery:ignore - might be useful to have + var inviter: RoomMemberProxyProtocol? { roomInfo.inviter.map(RoomMemberProxy.init) } @@ -90,6 +96,8 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { Int(roomInfo.activeMembersCount) } + // periphery:ignore - might be useful to have + var invitedMembersCount: Int { Int(roomInfo.invitedMembersCount) } @@ -98,14 +106,20 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { Int(roomInfo.joinedMembersCount) } + // periphery:ignore - might be useful to have + var highlightCount: Int { Int(roomInfo.highlightCount) } + // periphery:ignore - might be useful to have + var notificationCount: Int { Int(roomInfo.notificationCount) } + // periphery:ignore - might be useful to have + var cachedUserDefinedNotificationMode: RoomNotificationMode? { roomInfo.cachedUserDefinedNotificationMode } @@ -129,18 +143,26 @@ nonisolated struct RoomInfoProxy: RoomInfoProxyProtocol { roomInfo.activeRoomCallParticipants } + // periphery:ignore - might be useful to have + var isMarkedUnread: Bool { roomInfo.isMarkedUnread } + // periphery:ignore - might be useful to have + var unreadMessagesCount: UInt { UInt(roomInfo.numUnreadMessages) } + // periphery:ignore - might be useful to have + var unreadNotificationsCount: UInt { UInt(roomInfo.numUnreadNotifications) } + // periphery:ignore - might be useful to have + var unreadMentionsCount: UInt { UInt(roomInfo.numUnreadMentions) } diff --git a/ElementX/Sources/Services/Room/RoomInfoProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomInfoProxyProtocol.swift index 85a33c4df..209218cda 100644 --- a/ElementX/Sources/Services/Room/RoomInfoProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomInfoProxyProtocol.swift @@ -27,8 +27,10 @@ nonisolated protocol BaseRoomInfoProxyProtocol: Sendable { // sourcery: AutoMockable nonisolated protocol RoomInfoProxyProtocol: BaseRoomInfoProxyProtocol { var id: String { get } + // periphery:ignore - might be useful to have var creators: [String] { get } var displayName: String? { get } + // periphery:ignore - might be useful to have var rawName: String? { get } var topic: String? { get } /// The room's avatar URL. Use this for editing and favour ``avatar`` for display. @@ -43,20 +45,29 @@ nonisolated protocol RoomInfoProxyProtocol: BaseRoomInfoProxyProtocol { var canonicalAlias: String? { get } var alternativeAliases: [String] { get } var membership: Membership { get } + // periphery:ignore - might be useful to have var inviter: RoomMemberProxyProtocol? { get } var activeMembersCount: Int { get } + // periphery:ignore - might be useful to have var invitedMembersCount: Int { get } var joinedMembersCount: Int { get } + // periphery:ignore - might be useful to have var highlightCount: Int { get } + // periphery:ignore - might be useful to have var notificationCount: Int { get } + // periphery:ignore - might be useful to have var cachedUserDefinedNotificationMode: RoomNotificationMode? { get } var hasRoomCall: Bool { get } var activeRoomCallIntent: CallIntent? { get } var activeRoomCallParticipants: [String] { get } + // periphery:ignore - might be useful to have var isMarkedUnread: Bool { get } + // periphery:ignore - might be useful to have var unreadMessagesCount: UInt { get } + // periphery:ignore - might be useful to have var unreadNotificationsCount: UInt { get } + // periphery:ignore - might be useful to have var unreadMentionsCount: UInt { get } var fullyReadEventID: String? { get } var pinnedEventIDs: Set { get } diff --git a/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxy.swift b/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxy.swift index 397ed821f..4dfbd276f 100644 --- a/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxy.swift +++ b/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxy.swift @@ -56,6 +56,7 @@ final nonisolated class RoomMemberProxy: RoomMemberProxyProtocol { .init(rustPowerLevel: member.powerLevel) } + // periphery:ignore - might be useful to have var isServiceMember: Bool { member.isServiceMember } diff --git a/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxyProtocol.swift index f889e16c9..a3e855d4f 100644 --- a/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomMember/RoomMemberProxyProtocol.swift @@ -26,6 +26,7 @@ nonisolated protocol RoomMemberProxyProtocol: AnyObject, Sendable { var powerLevel: RoomPowerLevel { get } + // periphery:ignore - might be useful to have var isServiceMember: Bool { get } } diff --git a/ElementX/Sources/Services/Room/RoomPowerLevel.swift b/ElementX/Sources/Services/Room/RoomPowerLevel.swift index 625a19307..75f97ebf4 100644 --- a/ElementX/Sources/Services/Room/RoomPowerLevel.swift +++ b/ElementX/Sources/Services/Room/RoomPowerLevel.swift @@ -20,10 +20,6 @@ nonisolated enum RoomPowerLevel: Hashable, Comparable { self = .value(value) } - init(value: Int64) { - self = .value(Int(value)) - } - var rustPowerLevel: PowerLevel { switch self { case .infinite: .infinite diff --git a/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift index 266d5accd..ffb7a4aa6 100644 --- a/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomPowerLevelProxyProtocol.swift @@ -24,17 +24,6 @@ protocol RoomPowerLevelsProxyProtocol: Sendable { func canOwnUserPinOrUnpin() -> Bool func canOwnUserJoinCall() -> Bool func canOwnUserEditRolesAndPermissions() -> Bool - - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result - func canUser(userID: String, sendStateEvent event: StateEventType) -> Result - func canUserInvite(userID: String) -> Result - func canUserRedactOther(userID: String) -> Result - func canUserRedactOwn(userID: String) -> Result - func canUserKick(userID: String) -> Result - func canUserBan(userID: String) -> Result - func canUserTriggerRoomNotification(userID: String) -> Result - func canUserPinOrUnpin(userID: String) -> Result - func canUserJoinCall(userID: String) -> Result } // MARK: - Helpers diff --git a/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift b/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift index d823793a4..76711de4c 100644 --- a/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift +++ b/ElementX/Sources/Services/Room/RoomPowerLevelsProxy.swift @@ -70,94 +70,4 @@ nonisolated struct RoomPowerLevelsProxy: RoomPowerLevelsProxyProtocol { func canOwnUserEditRolesAndPermissions() -> Bool { powerLevels.canOwnUserSendState(stateEvent: .roomPowerLevels) } - - func canUser(userID: String, sendMessage messageType: MessageLikeEventType) -> Result { - do { - return try .success(powerLevels.canUserSendMessage(userId: userID, message: messageType)) - } catch { - MXLog.error("Failed checking if the user can send message with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUser(userID: String, sendStateEvent event: StateEventType) -> Result { - do { - return try .success(powerLevels.canUserSendState(userId: userID, stateEvent: event)) - } catch { - MXLog.error("Failed checking if the user can send \(event) with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserInvite(userID: String) -> Result { - do { - return try .success(powerLevels.canUserInvite(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can invite with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserRedactOther(userID: String) -> Result { - do { - return try .success(powerLevels.canUserRedactOther(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can redact others with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserRedactOwn(userID: String) -> Result { - do { - return try .success(powerLevels.canUserRedactOwn(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can redact self with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserKick(userID: String) -> Result { - do { - return try .success(powerLevels.canUserKick(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can kick with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserBan(userID: String) -> Result { - do { - return try .success(powerLevels.canUserBan(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can ban with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserTriggerRoomNotification(userID: String) -> Result { - do { - return try .success(powerLevels.canUserTriggerRoomNotification(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserPinOrUnpin(userID: String) -> Result { - do { - return try .success(powerLevels.canUserPinUnpin(userId: userID)) - } catch { - MXLog.error("Failed checking if the user can pin or unnpin: \(error)") - return .failure(.sdkError(error)) - } - } - - func canUserJoinCall(userID: String) -> Result { - do { - return try .success(powerLevels.canUserSendState(userId: userID, stateEvent: .callMember)) - } catch { - MXLog.error("Failed checking if the user can trigger room notification with error: \(error)") - return .failure(.sdkError(error)) - } - } } diff --git a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift index e345cedd9..732d300f9 100644 --- a/ElementX/Sources/Services/Room/RoomProxyProtocol.swift +++ b/ElementX/Sources/Services/Room/RoomProxyProtocol.swift @@ -17,7 +17,6 @@ enum RoomProxyError: Error { case invalidURL case invalidMedia case eventNotFound - case missingTransactionID case failedCreatingPinnedTimeline case timelineError(TimelineProxyError) case liveLocationSessionIsNotActive @@ -57,22 +56,11 @@ protocol BannedRoomProxyProtocol: RoomProxyProtocol { func forgetRoom() async -> Result } -enum JoinedRoomProxyAction: Equatable { - case roomInfoUpdate -} - enum KnockRequestsState { case loading case loaded([KnockRequestProxyProtocol]) } -struct RTCDeclinedEvent { - /// The sender of the decline event - let sender: String - /// The rtc.notification event that is beeing declined - let notificationEventID: String -} - // sourcery: AutoMockable protocol JoinedRoomProxyProtocol: RoomProxyProtocol { var infoPublisher: CurrentValuePublisher { get } @@ -89,8 +77,6 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { var predecessorRoom: PredecessorRoom? { get } - var successorRoom: SuccessorRoom? { get } - func subscribeForUpdates() async func subscribeToRoomInfoUpdates() @@ -111,8 +97,6 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { func enableEncryption() async -> Result - func redact(_ eventID: String) async -> Result - func reportContent(_ eventID: String, reason: String?) async -> Result func reportRoom(reason: String) async -> Result @@ -135,8 +119,6 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { func markAsRead(receiptType: ReceiptType) async -> Result - func edit(eventID: String, newContent: RoomMessageEventContentWithoutRelation) async -> Result - /// https://spec.matrix.org/v1.9/client-server-api/#typing-notifications @discardableResult func sendTypingNotification(isTyping: Bool) async -> Result @@ -167,10 +149,8 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol { // MARK: - Power Levels - func powerLevels() async -> Result func applyPowerLevelChanges(_ changes: RoomPowerLevelChanges) async -> Result func resetPowerLevels() async -> Result - func suggestedRole(for userID: String) async -> Result func updatePowerLevelsForUsers(_ updates: [(userID: String, powerLevel: Int64)]) async -> Result // MARK: - Moderation diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift index a37669660..e72c100a9 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift @@ -106,6 +106,7 @@ nonisolated struct RoomEventStringBuilder { shouldPrefixSenderName: false) } + // periphery:ignore - might be useful to have static func threadListEventStringBuilder(userID: String) -> Self { RoomEventStringBuilder(stateEventStringBuilder: .init(userID: userID), messageEventStringBuilder: .init(attributedStringBuilder: AttributedStringBuilder(cacheKey: "threadList", mentionBuilder: PlainMentionBuilder()), diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummary.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummary.swift index b8be3c3c4..2b7bce69d 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummary.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummary.swift @@ -21,13 +21,6 @@ nonisolated struct RoomSummary { default: false } } - - var isKnock: Bool { - switch self { - case .knock: true - default: false - } - } } enum LastMessageState { case sending, failed } diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift index 582cfae0c..0f3924271 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift @@ -26,7 +26,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { private var roomList: RoomListProtocol? private var cancellables = Set() - private var roomListServiceStateCancellable: AnyCancellable? private var listUpdatesSubscriptionResult: RoomListEntriesWithDynamicAdaptersResult? private var stateUpdatesTaskHandle: TaskHandle? diff --git a/ElementX/Sources/Services/Room/RoomThreadListServiceProxy.swift b/ElementX/Sources/Services/Room/RoomThreadListServiceProxy.swift index 49b179419..d91aea739 100644 --- a/ElementX/Sources/Services/Room/RoomThreadListServiceProxy.swift +++ b/ElementX/Sources/Services/Room/RoomThreadListServiceProxy.swift @@ -13,19 +13,21 @@ class RoomThreadListProxy: RoomThreadListServiceProxyProtocol { private let threadListService: ThreadListServiceProtocol private let eventStringBuilder: RoomEventStringBuilder + // periphery:ignore - required for instance retention in the rust codebase private var itemUpdatesHandle: TaskHandle? private let itemsSubject = CurrentValueSubject<[RoomThreadListItem], Never>([]) var itemsPublisher: CurrentValuePublisher<[RoomThreadListItem], Never> { itemsSubject.asCurrentValuePublisher() } + // periphery:ignore - required for instance retention in the rust codebase private var paginationStateHandle: TaskHandle? private let paginationStateSubject: CurrentValueSubject var paginationStatePublisher: CurrentValuePublisher { paginationStateSubject.asCurrentValuePublisher() } - init(threadListService: ThreadListServiceProtocol, eventStringBuilder: RoomEventStringBuilder, paginationToken: String? = nil) { + init(threadListService: ThreadListServiceProtocol, eventStringBuilder: RoomEventStringBuilder) { self.threadListService = threadListService self.eventStringBuilder = eventStringBuilder diff --git a/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift b/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift index 3f9ebccdc..2e95a9f36 100644 --- a/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift +++ b/ElementX/Sources/Services/RoomDirectorySearch/RoomDirectorySearchProxy.swift @@ -29,6 +29,7 @@ final class RoomDirectorySearchProxy: RoomDirectorySearchProxyProtocol { /// main actor in FIFO order, guaranteeing one in-flight update at a time. private let updatesContinuation: AsyncStream<[RoomDirectorySearchEntryUpdate]>.Continuation + // periphery:ignore - required for instance retention in the rust codebase private var searchEntriesSubscription: TaskHandle? deinit { diff --git a/ElementX/Sources/Services/Search/SearchServiceProxy.swift b/ElementX/Sources/Services/Search/SearchServiceProxy.swift index 9aa17448f..09eb1f57b 100644 --- a/ElementX/Sources/Services/Search/SearchServiceProxy.swift +++ b/ElementX/Sources/Services/Search/SearchServiceProxy.swift @@ -12,7 +12,6 @@ class SearchServiceProxy: SearchServiceProxyProtocol { private let searchService: SearchServiceProtocol private let timelineItemFactory: RoomTimelineItemFactoryProtocol - // periphery:ignore - required for instance retention in the rust codebase private var resultsHandle: TaskHandle? private let resultsSubject = CurrentValueSubject<[SearchServiceResult], Never>([]) diff --git a/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift b/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift index c8eca8a85..27be262f4 100644 --- a/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift +++ b/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift @@ -19,10 +19,9 @@ class SecureBackupController: SecureBackupControllerProtocol { // periphery:ignore - retaining purpose private var backupStateListenerTaskHandle: TaskHandle? - // periphery:ignore - retaining purpose + // periphery:ignore - required for instance retention in the rust codebase private var recoveryStateListenerTaskHandle: TaskHandle? - // periphery:ignore - auto cancels when reassigned /// Used to dedupe remote backup state requests @CancellableTask private var remoteBackupStateTask: Task? diff --git a/ElementX/Sources/Services/Spaces/LeaveSpaceHandleProxy.swift b/ElementX/Sources/Services/Spaces/LeaveSpaceHandleProxy.swift index 929657815..82a1b5e2b 100644 --- a/ElementX/Sources/Services/Spaces/LeaveSpaceHandleProxy.swift +++ b/ElementX/Sources/Services/Spaces/LeaveSpaceHandleProxy.swift @@ -105,6 +105,7 @@ final class LeaveSpaceHandleProxy { @Observable class LeaveSpaceRoomDetails { let spaceServiceRoom: SpaceServiceRoom let canLeave: Bool + // periphery:ignore - might be useful to have let areCreatorsPrivileged: Bool var isSelected: Bool diff --git a/ElementX/Sources/Services/Spaces/SpaceRoomListProxy.swift b/ElementX/Sources/Services/Spaces/SpaceRoomListProxy.swift index 65568d7d4..90be6a36a 100644 --- a/ElementX/Sources/Services/Spaces/SpaceRoomListProxy.swift +++ b/ElementX/Sources/Services/Spaces/SpaceRoomListProxy.swift @@ -16,18 +16,21 @@ class SpaceRoomListProxy: SpaceRoomListProxyProtocol { private let spaceRoomList: SpaceRoomListProtocol + // periphery:ignore - required for instance retention in the rust codebase private var spaceServiceRoomHandle: TaskHandle? private let spaceServiceRoomSubject: CurrentValueSubject var spaceServiceRoomPublisher: CurrentValuePublisher { spaceServiceRoomSubject.asCurrentValuePublisher() } + // periphery:ignore - required for instance retention in the rust codebase private var spaceRoomsHandle: TaskHandle? private let spaceRoomsSubject = CurrentValueSubject<[SpaceServiceRoom], Never>([]) var spaceRoomsPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never> { spaceRoomsSubject.asCurrentValuePublisher() } + // periphery:ignore - required for instance retention in the rust codebase private var paginationStateHandle: TaskHandle? private let paginationStateSubject: CurrentValueSubject var paginationStatePublisher: CurrentValuePublisher { diff --git a/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift b/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift index 8f9acf4dc..498d33ad1 100644 --- a/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift +++ b/ElementX/Sources/Services/Spaces/SpaceServiceProxy.swift @@ -13,12 +13,14 @@ import MatrixRustSDK class SpaceServiceProxy: SpaceServiceProxyProtocol { private let spaceService: SpaceServiceProtocol + // periphery:ignore - required for instance retention in the rust codebase private var topLevelSpacesHandle: TaskHandle? private let spacesSubject = CurrentValueSubject<[SpaceServiceRoom], Never>([]) var topLevelSpacesPublisher: CurrentValuePublisher<[SpaceServiceRoom], Never> { spacesSubject.asCurrentValuePublisher() } + // periphery:ignore - required for instance retention in the rust codebase private var spaceFilterHandle: TaskHandle? private let spaceFilterSubject = CurrentValueSubject<[SpaceServiceFilter], Never>([]) var spaceFilterPublisher: CurrentValuePublisher<[SpaceServiceFilter], Never> { diff --git a/ElementX/Sources/Services/Spaces/SpaceServiceRoom.swift b/ElementX/Sources/Services/Spaces/SpaceServiceRoom.swift index 72965c95c..3c283a163 100644 --- a/ElementX/Sources/Services/Spaces/SpaceServiceRoom.swift +++ b/ElementX/Sources/Services/Spaces/SpaceServiceRoom.swift @@ -19,6 +19,7 @@ enum SpaceServiceRoomVisibility: Equatable { struct SpaceServiceRoom { var id: String var name: String + // periphery:ignore - might be useful to have var rawName: String? var avatarURL: URL? @@ -33,7 +34,9 @@ struct SpaceServiceRoom { var canonicalAlias: String? var joinRule: JoinRule? + // periphery:ignore - might be useful to have var worldReadable: Bool? + // periphery:ignore - might be useful to have var guestCanJoin: Bool var state: Membership? var via: [String] diff --git a/ElementX/Sources/Services/Timeline/Fixtures/TimelineFixtures.swift b/ElementX/Sources/Services/Timeline/Fixtures/TimelineFixtures.swift index 34bd02b91..c862718dc 100644 --- a/ElementX/Sources/Services/Timeline/Fixtures/TimelineFixtures.swift +++ b/ElementX/Sources/Services/Timeline/Fixtures/TimelineFixtures.swift @@ -126,11 +126,6 @@ enum TimelineFixtures { singleMessageChunkProxies.buildRoomTimelineItems() } - /// A single text item. - static var incomingMessage: RoomTimelineItemProtocol { - incomingMessageProxy.buildRoomTimelineItem() - } - /// A large chunk of events, containing 40 text items which should fill an iPad /// with enough items so that it won't perform another back pagination. static var largeChunk: [RoomTimelineItemProtocol] { diff --git a/ElementX/Sources/Services/Timeline/TimelineController/TimelineControllerProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineController/TimelineControllerProtocol.swift index 629eca07b..139a13dcc 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/TimelineControllerProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/TimelineControllerProtocol.swift @@ -44,7 +44,6 @@ enum TimelineControllerError: Error { /// timeline items, grouping together state events, donating intents to the larger system etc. @MainActor protocol TimelineControllerProtocol: Sendable { - var roomID: String { get } var timelineKind: TimelineKind { get } /// The currently known items, use only for setting up the intial state. diff --git a/ElementX/Sources/Services/Timeline/TimelineItemIdentifier.swift b/ElementX/Sources/Services/Timeline/TimelineItemIdentifier.swift index c76053a23..7efbceb90 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemIdentifier.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemIdentifier.swift @@ -26,6 +26,7 @@ nonisolated enum TimelineItemIdentifier: Hashable { self.init(rustValue.id) } + // periphery:ignore - might be useful to have var rustValue: TimelineUniqueId { .init(id: value) } @@ -69,6 +70,7 @@ nonisolated enum TimelineItemIdentifier: Hashable { return eventID } + // periphery:ignore - might be useful to have var transactionID: String? { guard case let .event(_, .transactionID(transactionID)) = self else { return nil } return transactionID diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift b/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift index 45df11153..7a7a6631c 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProvider.swift @@ -205,25 +205,6 @@ private nonisolated extension TimelineItemProxy { } } -private extension VirtualTimelineItem { - var description: String { - switch self { - case .dateDivider(let timestamp): - return "DayDiviver(\(timestamp))" - case .readMarker: - return "ReadMarker" - case .timelineStart: - return "TimelineStart" - } - } -} - -private extension Array where Element == TimelineDiff { - var debugDescription: String { - "[" + map(\.debugDescription).joined(separator: ",") + "]" - } -} - extension TimelineDiff: @retroactive CustomDebugStringConvertible { public var debugDescription: String { switch self { diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift index ac81b5a8d..5b51c1dea 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift @@ -236,8 +236,11 @@ nonisolated struct SendHandleProxy: Hashable { nonisolated struct VideoInfoProxy: Hashable { let source: MediaSourceProxy private(set) var duration: TimeInterval + // periphery:ignore - used via the synthesized Hashable conformance private(set) var size: CGSize? + // periphery:ignore - used via the synthesized Hashable conformance private(set) var aspectRatio: CGFloat? + // periphery:ignore - used via the synthesized Hashable conformance private(set) var mimeType: String? private(set) var fileSize: UInt? @@ -281,6 +284,7 @@ nonisolated struct ImageInfoProxy: Hashable { let source: MediaSourceProxy private(set) var size: CGSize? private(set) var aspectRatio: CGFloat? + // periphery:ignore - used via the synthesized Hashable conformance private(set) var mimeType: String? private(set) var fileSize: UInt? diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/DecorationTimelineItemProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineItems/DecorationTimelineItemProtocol.swift index 4c5f4db10..6dc5a9ff1 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/DecorationTimelineItemProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/DecorationTimelineItemProtocol.swift @@ -8,5 +8,4 @@ import Foundation -// periphery: ignore - markdown protocol nonisolated protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol { } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Messages/EmoteRoomTimelineItemContent.swift b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Messages/EmoteRoomTimelineItemContent.swift index 51962202b..9269a12b1 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Messages/EmoteRoomTimelineItemContent.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Messages/EmoteRoomTimelineItemContent.swift @@ -11,6 +11,7 @@ import UIKit nonisolated struct EmoteRoomTimelineItemContent: Hashable { let body: String var formattedBody: AttributedString? + // periphery:ignore - used via the synthesized Hashable conformance /// The original textual representation of the formatted body directly from the event (usually HTML code) var formattedBodyHTMLString: String? } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/CallNotificationRoomTimelineItem.swift b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/CallNotificationRoomTimelineItem.swift index 97b7f6dd1..0e738bde3 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/CallNotificationRoomTimelineItem.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/CallNotificationRoomTimelineItem.swift @@ -11,9 +11,6 @@ import Foundation nonisolated struct CallNotificationRoomTimelineItem: RoomTimelineItemProtocol, Equatable { let id: TimelineItemIdentifier let timestamp: Date - let isEditable: Bool - let canBeRepliedTo: Bool - let isDM: Bool let isDeclinedByMe: Bool let isDeclined: Bool diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/PollRoomTimelineItem.swift b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/PollRoomTimelineItem.swift index 97a0cb297..a7f86b500 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/PollRoomTimelineItem.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/Items/Other/PollRoomTimelineItem.swift @@ -25,6 +25,7 @@ nonisolated struct Poll: Hashable { let kind: Kind let maxSelections: Int let options: [Option] + // periphery:ignore - used via the synthesized Hashable conformance let votes: [String: [String]] let endDate: Date? /// Whether the poll has been created by the account owner diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index 0de2c4d22..2b1e2ae41 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -857,8 +857,6 @@ nonisolated struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { let isVoiceCall = callIntent == CallIntent.audio.rawValue return CallNotificationRoomTimelineItem(id: eventItemProxy.id, timestamp: eventItemProxy.timestamp, - isEditable: eventItemProxy.isEditable, - canBeRepliedTo: eventItemProxy.canBeRepliedTo, isDM: isDM, isDeclinedByMe: declinedBy.contains(userID), isDeclined: !declinedBy.isEmpty, diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift index 7740e88ae..aea7aa589 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift @@ -48,10 +48,10 @@ struct RoomTimelineItemView: View { RedactedRoomTimelineView(timelineItem: item) case .encrypted(let item): EncryptedRoomTimelineView(timelineItem: item) - case .readMarker(let item): - ReadMarkerRoomTimelineView(timelineItem: item) - case .paginationIndicator(let item): - PaginationIndicatorRoomTimelineView(timelineItem: item) + case .readMarker: + ReadMarkerRoomTimelineView() + case .paginationIndicator: + PaginationIndicatorRoomTimelineView() case .sticker(let item): StickerRoomTimelineView(timelineItem: item) case .unsupported(let item): @@ -71,8 +71,8 @@ struct RoomTimelineItemView: View { title: L10n.commonVoiceMessage, duration: 0) VoiceMessageRoomTimelineView(timelineItem: item, playerState: playerState) - case .callInvite(let item): - CallInviteRoomTimelineView(timelineItem: item) + case .callInvite: + CallInviteRoomTimelineView() case .callNotification(let item): CallNotificationRoomTimelineView(timelineItem: item) case .liveLocation(let item): @@ -86,7 +86,7 @@ struct RoomTimelineItemView: View { if let item = context?.viewState.linkMetadataProvider?.metadataItems[url] { linkMetadata[url] = item } else { - linkMetadata[url] = LinkMetadataProviderItem(url: url, metadata: nil) + linkMetadata[url] = LinkMetadataProviderItem(metadata: nil) } } return linkMetadata diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index ce423928c..31785952f 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -653,16 +653,4 @@ extension Array where Element == TimelineItemProxy { return nil } - - func firstEventTimelineItemUsingEventOrTransactionID(_ eventOrTransactionID: TimelineItemIdentifier.EventOrTransactionID) -> EventTimelineItem? { - for item in self { - if case let .event(eventTimelineItem) = item, - case let .event(_, identifier) = eventTimelineItem.id, - identifier == eventOrTransactionID { - return eventTimelineItem.item - } - } - - return nil - } } diff --git a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift index 496d7525f..3cef9a6ac 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift @@ -46,8 +46,6 @@ enum TimelineAllowedMessageType { enum TimelineProxyError: Error { case sdkError(Error) - - case failedRedacting } /// Element X proxies generally wrap the counterpart RustSDK objects while providing platform specific diff --git a/ElementX/Sources/Services/Users/UserProfile.swift b/ElementX/Sources/Services/Users/UserProfile.swift index cffe52c65..e101c89dc 100644 --- a/ElementX/Sources/Services/Users/UserProfile.swift +++ b/ElementX/Sources/Services/Users/UserProfile.swift @@ -127,6 +127,7 @@ nonisolated extension UserStatus.Raw { emoji = Character(rustStatus.emoji) } + // periphery:ignore - might be useful to have var rustValue: MatrixRustSDK.UserStatus { .init(emoji: String(emoji), text: text) } @@ -137,6 +138,7 @@ nonisolated extension UserStatus.Call { joinedDate = rustCall.callJoinedTs.map { Date(timeIntervalSince1970: Double($0)) } } + // periphery:ignore - might be useful to have var rustValue: MatrixRustSDK.UserCall { .init(callJoinedTs: joinedDate.map { UInt64($0.timeIntervalSince1970) }) } @@ -146,6 +148,7 @@ nonisolated extension UserStatus.Call { struct SearchUsersResults { let results: [UserProfile] + // periphery:ignore - documents the schema, parsed but not consumed yet let limited: Bool } diff --git a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift index 154e9d8f8..c72334dfc 100644 --- a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift +++ b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift @@ -21,8 +21,6 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol { actionsSubject.eraseToAnyPublisher() } - private let mp4accMimeType = "audio/m4a" - var isRecording: Bool { audioRecorder.isRecording } diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 956e489e9..034e0424f 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -178,7 +178,6 @@ class MockScreen: Identifiable { appMediator: AppMediatorMock(.init()), appSettings: appSettings, appHooks: AppHooks(), - analytics: analytics, userIndicatorController: userIndicatorController) flowCoordinator.start() retainedState.append(flowCoordinator) @@ -853,8 +852,7 @@ class MockScreen: Identifiable { mediaProvider: MediaProviderMock(.init()), appSettings: appSettings) - let flowCoordinator = ChatsTabFlowCoordinator(isNewLogin: false, - navigationSplitCoordinator: navigationSplitCoordinator, + let flowCoordinator = ChatsTabFlowCoordinator(navigationSplitCoordinator: navigationSplitCoordinator, flowParameters: CommonFlowParameters(userSession: UserSessionMock(.init(clientProxy: clientProxy)), bugReportService: BugReportServiceMock(.init()), elementCallService: ElementCallServiceMock(.init()), diff --git a/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift b/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift index 54d745f73..df4848aac 100644 --- a/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift +++ b/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift @@ -9,6 +9,7 @@ import SwiftUI class UnitTestsAppCoordinator: AppCoordinatorProtocol { + // periphery:ignore - retaining purpose private let targetConfiguration: Target.ConfigurationResult static let targetRageshakeURL = RemotePreference(.url("bugs.example.com/submit")) static let targetAppHooks = AppHooks() diff --git a/Enterprise b/Enterprise index 01818902e..ca26f2417 160000 --- a/Enterprise +++ b/Enterprise @@ -1 +1 @@ -Subproject commit 01818902ef130a039c7a7d16142257d7d9515e53 +Subproject commit ca26f2417d9f2276383d606cca9814365ab366d6 diff --git a/IntegrationTests/Sources/Common.swift b/IntegrationTests/Sources/Common.swift index c53d5b30e..a5045b3d8 100644 --- a/IntegrationTests/Sources/Common.swift +++ b/IntegrationTests/Sources/Common.swift @@ -64,7 +64,7 @@ extension XCUIApplication { throw IntegrationTestsError.webAuthenticationSessionFailure } - if !alerts.isEmpty { + if alerts.firstMatch.exists { alerts.firstMatch.buttons["OK"].firstMatch.tap() } } diff --git a/NSE/Sources/NSEUserSession.swift b/NSE/Sources/NSEUserSession.swift index 67ac784d5..7d5042bc6 100644 --- a/NSE/Sources/NSEUserSession.swift +++ b/NSE/Sources/NSEUserSession.swift @@ -14,13 +14,9 @@ nonisolated protocol NSEUserSessionProtocol { var inviteAvatarsVisibility: InviteAvatars { get async } var mediaPreviewVisibility: MediaPreviews { get async } var threadsEnabled: Bool { get } - - func notificationItemProxy(roomID: String, eventID: String) async -> NotificationItemProxyProtocol? - func roomForIdentifier(_ roomID: String) -> Room? } final nonisolated class NSEUserSession: NSEUserSessionProtocol { - private let sessionDirectories: SessionDirectories private let appSettings: CommonSettingsProtocol private let baseClient: Client private let notificationClient: NotificationClient @@ -61,7 +57,6 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol { clientSessionDelegate: ClientSessionDelegate, appHooks: AppHooks, appSettings: CommonSettingsProtocol) async throws { - sessionDirectories = credentials.restorationToken.sessionDirectories userID = credentials.userID self.appSettings = appSettings @@ -99,7 +94,6 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol { switch notificationStatus { case .event(let notification): return NotificationItemProxy(notificationItem: notification, - eventID: eventID, receiverID: userID, roomID: roomID) case .eventNotFound: @@ -114,7 +108,7 @@ final nonisolated class NSEUserSession: NSEUserSessionProtocol { } } catch { MXLog.error("Could not get notification's content creating an empty notification instead, error: \(error)") - return EmptyNotificationItemProxy(eventID: eventID, roomID: roomID, receiverID: userID) + return EmptyNotificationItemProxy(roomID: roomID, receiverID: userID) } } @@ -139,6 +133,7 @@ private final nonisolated class ClientDelegateWrapper: ClientDelegate { MXLog.error("Received authentication error, the NSE can't handle this.") } + // periphery:ignore - required by the SDK's delegate protocol func didRefreshTokens() { MXLog.info("Delegating session updates to the ClientSessionDelegate.") } diff --git a/NSE/Sources/NotificationItemProxy/NotificationItemProxy.swift b/NSE/Sources/NotificationItemProxy/NotificationItemProxy.swift index 47318be52..bc690fa1b 100644 --- a/NSE/Sources/NotificationItemProxy/NotificationItemProxy.swift +++ b/NSE/Sources/NotificationItemProxy/NotificationItemProxy.swift @@ -12,7 +12,6 @@ import UserNotifications nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol { let notificationItem: NotificationItem - let eventID: String let receiverID: String let roomID: String @@ -41,10 +40,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol { notificationItem.roomInfo.isSpace } - var isRoomDirect: Bool { - notificationItem.roomInfo.isDirect - } - var isDM: Bool { notificationItem.roomInfo.isDm } @@ -58,10 +53,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol { } } - var roomJoinedMembers: Int { - Int(notificationItem.roomInfo.joinedMembersCount) - } - var isNoisy: Bool { notificationItem.isNoisy ?? false } @@ -92,8 +83,6 @@ nonisolated struct NotificationItemProxy: NotificationItemProxyProtocol { } nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol { - let eventID: String - var event: NotificationEvent? { nil } @@ -122,10 +111,6 @@ nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol { false } - var isRoomDirect: Bool { - false - } - var isDM: Bool { false } @@ -142,10 +127,6 @@ nonisolated struct EmptyNotificationItemProxy: NotificationItemProxyProtocol { nil } - var roomJoinedMembers: Int { - 0 - } - var hasMention: Bool { false } diff --git a/NSE/Sources/NotificationItemProxy/NotificationItemProxyProtocol.swift b/NSE/Sources/NotificationItemProxy/NotificationItemProxyProtocol.swift index 1f5559b73..e5bd707a6 100644 --- a/NSE/Sources/NotificationItemProxy/NotificationItemProxyProtocol.swift +++ b/NSE/Sources/NotificationItemProxy/NotificationItemProxyProtocol.swift @@ -28,12 +28,8 @@ nonisolated protocol NotificationItemProxyProtocol: Sendable { var roomAvatarMediaSource: MediaSourceProxy? { get } - var roomJoinedMembers: Int { get } - var isRoomSpace: Bool { get } - var isRoomDirect: Bool { get } - var isRoomPrivate: Bool { get } var isDM: Bool { get } diff --git a/PreviewTests/Sources/GeneratedPreviewTests.swift b/PreviewTests/Sources/GeneratedPreviewTests.swift index a684e6c15..3b0e9e419 100644 --- a/PreviewTests/Sources/GeneratedPreviewTests.swift +++ b/PreviewTests/Sources/GeneratedPreviewTests.swift @@ -1306,13 +1306,6 @@ extension PreviewTests { } } - @Test - func swipeToReplyView() async throws { - for (index, preview) in SwipeToReplyView_Previews._allPreviews.enumerated() { - try await assertSnapshots(matching: preview, step: index) - } - } - @Test func textRoomTimelineView() async throws { for (index, preview) in TextRoomTimelineView_Previews._allPreviews.enumerated() { diff --git a/PreviewTests/Sources/PreviewTests.swift b/PreviewTests/Sources/PreviewTests.swift index 37572cee1..402955f35 100644 --- a/PreviewTests/Sources/PreviewTests.swift +++ b/PreviewTests/Sources/PreviewTests.swift @@ -18,7 +18,6 @@ struct PreviewTests { let device: String } - private let deviceConfig: ViewImageConfig = .iPhoneX private let simulatorDevice: String? = "iPhone14,6" // iPhone SE 3rd Generation private let requiredOSVersion = (major: 26, minor: 5) /// The key is the name we will give to the snapshot diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-en-GB-0.png deleted file mode 100644 index a751a28b1..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-en-GB-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cc2c6fd72c6e09e5802d88b7e03c93750b07cf7f9a09661caa7de7b91fa529cb -size 67239 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-pseudo-0.png deleted file mode 100644 index a751a28b1..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPad-pseudo-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cc2c6fd72c6e09e5802d88b7e03c93750b07cf7f9a09661caa7de7b91fa529cb -size 67239 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-en-GB-0.png deleted file mode 100644 index c943c2a5a..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-en-GB-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9ddf37cf721cec023c20ef7aacced5b0d1bec3e64fbcbb36e1d18a1726a145a9 -size 26166 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-pseudo-0.png deleted file mode 100644 index c943c2a5a..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/swipeToReplyView.iPhone-pseudo-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9ddf37cf721cec023c20ef7aacced5b0d1bec3e64fbcbb36e1d18a1726a145a9 -size 26166 diff --git a/ShareExtension/Sources/ShareExtensionViewController.swift b/ShareExtension/Sources/ShareExtensionViewController.swift index 741983c4b..7521a70f0 100644 --- a/ShareExtension/Sources/ShareExtensionViewController.swift +++ b/ShareExtension/Sources/ShareExtensionViewController.swift @@ -24,8 +24,6 @@ class ShareExtensionViewController: UIViewController { private let keychainController = KeychainController(service: .sessions, accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier) - private var cancellables: Set = [] - private let hostingController = UIHostingController(rootView: ShareExtensionView()) override func viewDidLoad() { diff --git a/Tools/Sources/Commands/SetupProject.swift b/Tools/Sources/Commands/SetupProject.swift index 3c388ee5a..192545088 100644 --- a/Tools/Sources/Commands/SetupProject.swift +++ b/Tools/Sources/Commands/SetupProject.swift @@ -19,7 +19,9 @@ struct SetupProject: ParsableCommand { func brewInstall() throws { // Uninstall SwiftFormat from HEAD first if it is installed. try Zsh.run(command: "if brew list --versions swiftformat | grep -q HEAD; then brew uninstall swiftformat; fi") - try Zsh.run(command: "brew install xcodegen swiftgen swiftformat git-lfs sourcery mint pkl kiliankoe/formulae/swift-outdated localazy/tools/localazy peripheryapp/periphery/periphery") + // Uninstall Periphery from the deprecated tap first if it is installed (superseded by the homebrew-core formula). + try Zsh.run(command: "if brew list --cask --versions periphery &> /dev/null; then brew uninstall --cask periphery; fi") + try Zsh.run(command: "brew install xcodegen swiftgen swiftformat git-lfs sourcery mint pkl kiliankoe/formulae/swift-outdated localazy/tools/localazy periphery") } func mintPackagesInstall() throws { diff --git a/UITests/Sources/Application.swift b/UITests/Sources/Application.swift index 07fc9e086..98eb75af6 100644 --- a/UITests/Sources/Application.swift +++ b/UITests/Sources/Application.swift @@ -111,15 +111,3 @@ extension XCUIApplication { Locale.current.language.region?.identifier ?? "" } } - -private extension UIImage { - /// Adjusts the image by cropping it with the given edge insets. - func inset(by insets: UIEdgeInsets) -> UIImage { - let insetRect = CGRect(origin: .zero, size: size).inset(by: insets) - let renderer = UIGraphicsImageRenderer(size: insetRect.size) - - return renderer.image { _ in - draw(at: CGPoint(x: -insets.left, y: -insets.top)) - } - } -} diff --git a/UITests/Sources/AuthenticationFlowCoordinatorTests.swift b/UITests/Sources/AuthenticationFlowCoordinatorTests.swift index 1171359e3..9035b784f 100644 --- a/UITests/Sources/AuthenticationFlowCoordinatorTests.swift +++ b/UITests/Sources/AuthenticationFlowCoordinatorTests.swift @@ -111,6 +111,7 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase { try await app.assertScreenshot() } + // periphery:ignore - might be useful to have /// Disabled for now as the looping isn't 100% fool-proof and we have OAuth on the integration tests /// so this mock version doesn't really add anything to the tests as a whole. func disabled_testSelectingOAuthServer() { diff --git a/UITests/Sources/StartChatTests.swift b/UITests/Sources/StartChatTests.swift index e0c4d92bb..170a29047 100644 --- a/UITests/Sources/StartChatTests.swift +++ b/UITests/Sources/StartChatTests.swift @@ -14,7 +14,6 @@ class StartChatTests: XCTestCase { static let startChat = 1 static let startChatWithResults = 2 static let createRoom = 3 - static let createRoomAvatarPicker = 4 static let createRoomFilled = 5 static let inviteUsers = 6 static let inviteUsersWithResults = 7 diff --git a/UITests/Sources/UserSessionScreenTests.swift b/UITests/Sources/UserSessionScreenTests.swift index e0a6759af..be039167e 100644 --- a/UITests/Sources/UserSessionScreenTests.swift +++ b/UITests/Sources/UserSessionScreenTests.swift @@ -20,7 +20,6 @@ class UserSessionScreenTests: XCTestCase { enum Step { static let homeScreen = 1 static let roomScreen = 2 - static let composerAttachments = 3 static let homeScreenWithTabBar = 4 static let spacesScreen = 5 static let spaceScreen = 6 diff --git a/UnitTests/Sources/AttributedStringBuilderTests.swift b/UnitTests/Sources/AttributedStringBuilderTests.swift index b67fb7fe0..d606982ab 100644 --- a/UnitTests/Sources/AttributedStringBuilderTests.swift +++ b/UnitTests/Sources/AttributedStringBuilderTests.swift @@ -12,7 +12,6 @@ import Testing struct AttributedStringBuilderTests { private let attributedStringBuilder: AttributedStringBuilder - private let maxHeaderPointSize = ceil(UIFont.preferredFont(forTextStyle: .body).pointSize * 1.2) init() async throws { attributedStringBuilder = AttributedStringBuilder(mentionBuilder: MentionBuilder()) diff --git a/UnitTests/Sources/AudioPlayerStateTests.swift b/UnitTests/Sources/AudioPlayerStateTests.swift index c65190728..e3eeb98d1 100644 --- a/UnitTests/Sources/AudioPlayerStateTests.swift +++ b/UnitTests/Sources/AudioPlayerStateTests.swift @@ -30,7 +30,6 @@ struct AudioPlayerStateTests { audioPlayerMock.state = .stopped audioPlayerMock.currentTime = 0.0 audioPlayerMock.duration = 0.0 - audioPlayerMock.playbackSpeed = 1.0 audioPlayerMock.seekToClosure = { [audioPlayerSeekCallsSubject] progress in audioPlayerSeekCallsSubject?.send(progress) } diff --git a/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift b/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift index 867ccf39a..fd47902bc 100644 --- a/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift +++ b/UnitTests/Sources/ChatsTabFlowCoordinatorTests.swift @@ -20,8 +20,6 @@ struct ChatsTabFlowCoordinatorTests { var notificationManager: NotificationManagerMock! let stateMachineFactory = PublishedStateMachineFactory() - var cancellables = Set() - var detailCoordinator: CoordinatorProtocol? { splitCoordinator.detailCoordinator } @@ -53,8 +51,7 @@ struct ChatsTabFlowCoordinatorTests { userIndicatorController: UserIndicatorControllerMock(), notificationManager: notificationManager, stateMachineFactory: stateMachineFactory) - chatsTabFlowCoordinator = ChatsTabFlowCoordinator(isNewLogin: false, - navigationSplitCoordinator: splitCoordinator, + chatsTabFlowCoordinator = ChatsTabFlowCoordinator(navigationSplitCoordinator: splitCoordinator, flowParameters: flowParameters) let deferred = deferFulfillment(stateMachineFactory.chatsTabFlowStatePublisher) { $0 == .roomList(detailState: nil) } diff --git a/UnitTests/Sources/CreateRoomViewModelTests.swift b/UnitTests/Sources/CreateRoomViewModelTests.swift index 5139da1b7..a3e0cc801 100644 --- a/UnitTests/Sources/CreateRoomViewModelTests.swift +++ b/UnitTests/Sources/CreateRoomViewModelTests.swift @@ -19,8 +19,6 @@ final class CreateRoomScreenViewModelTests { private let appSettings: AppSettings - private let usersSubject = CurrentValueSubject<[UserProfile], Never>([]) - var context: CreateRoomScreenViewModel.Context { viewModel.context } diff --git a/UnitTests/Sources/InviteUsersViewModelTests.swift b/UnitTests/Sources/InviteUsersViewModelTests.swift index a956be1b2..9057542ca 100644 --- a/UnitTests/Sources/InviteUsersViewModelTests.swift +++ b/UnitTests/Sources/InviteUsersViewModelTests.swift @@ -170,8 +170,7 @@ final class InviteUsersScreenViewModelTests { roomType: .draft(mandatoryInvitees: [.mockAlice]), isSkippable: false, userDiscoveryService: userDiscoveryService, - userIndicatorController: UserIndicatorControllerMock(), - appSettings: .volatile()) + userIndicatorController: UserIndicatorControllerMock()) // The locked invitee starts pre-selected and locked. #expect(context.viewState.selectedUsers.map(\.id) == [UserProfile.mockAlice.id]) @@ -235,8 +234,7 @@ final class InviteUsersScreenViewModelTests { roomType: .existingRoom(roomProxy: roomProxy), isSkippable: isSkippable, userDiscoveryService: userDiscoveryService, - userIndicatorController: UserIndicatorControllerMock(), - appSettings: .volatile()) + userIndicatorController: UserIndicatorControllerMock()) viewModel.state.usersSection = .init(type: .suggestions, users: [.mockAlice, .mockBob, .mockCharlie]) self.viewModel = viewModel } diff --git a/UnitTests/Sources/LoggingTests.swift b/UnitTests/Sources/LoggingTests.swift index 629824c07..7b4929508 100644 --- a/UnitTests/Sources/LoggingTests.swift +++ b/UnitTests/Sources/LoggingTests.swift @@ -14,10 +14,6 @@ import Testing @MainActor final class LoggingTests { - private enum Constants { - static let genericFailure = "Test failed" - } - deinit { Tracing.logsDirectoryOverride = nil do { diff --git a/UnitTests/Sources/LoginScreenViewModelTests.swift b/UnitTests/Sources/LoginScreenViewModelTests.swift index 0d1d03335..d3e5b8379 100644 --- a/UnitTests/Sources/LoginScreenViewModelTests.swift +++ b/UnitTests/Sources/LoginScreenViewModelTests.swift @@ -246,7 +246,6 @@ struct LoginScreenViewModelTests { viewModel = LoginScreenViewModel(authenticationService: service, loginHint: loginHint, userIndicatorController: UserIndicatorControllerMock(), - appSettings: appSettings, - analytics: AnalyticsServiceMock(.init())) + appSettings: appSettings) } } diff --git a/UnitTests/Sources/MediaPlayerProviderTests.swift b/UnitTests/Sources/MediaPlayerProviderTests.swift index 858e9b6a7..21320f048 100644 --- a/UnitTests/Sources/MediaPlayerProviderTests.swift +++ b/UnitTests/Sources/MediaPlayerProviderTests.swift @@ -15,10 +15,6 @@ import Testing struct MediaPlayerProviderTests { private var mediaPlayerProvider: MediaPlayerProvider - private let oggMimeType = "audio/ogg" - private let someURL = URL.mockMXCAudio - private let someOtherURL = URL.mockMXCFile - init() async { mediaPlayerProvider = MediaPlayerProvider() } @@ -41,7 +37,6 @@ struct MediaPlayerProviderTests { func detachAllStates() { let audioPlayer = AudioPlayerMock() audioPlayer.actions = PassthroughSubject().eraseToAnyPublisher() - audioPlayer.playbackSpeed = 1.0 let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.randomEvent), title: "", duration: 0), count: 10) for audioPlayerState in audioPlayerStates { @@ -62,7 +57,6 @@ struct MediaPlayerProviderTests { func detachAllStatesWithException() { let audioPlayer = AudioPlayerMock() audioPlayer.actions = PassthroughSubject().eraseToAnyPublisher() - audioPlayer.playbackSpeed = 1.0 let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.randomEvent), title: "", duration: 0), count: 10) for audioPlayerState in audioPlayerStates { diff --git a/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift b/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift index efc49841b..fe525e686 100644 --- a/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift +++ b/UnitTests/Sources/MediaUploadPreviewScreenViewModelTests.swift @@ -292,7 +292,6 @@ final class MediaUploadPreviewScreenViewModelTests { viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: urls, caption: nil, title: "Some File", - isRoomEncrypted: true, shouldShowCaptionWarning: true, mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: appSettings), timelineController: TimelineControllerMock(.init(timelineProxy: timelineProxy)), diff --git a/UnitTests/Sources/RestorationTokenTests.swift b/UnitTests/Sources/RestorationTokenTests.swift index 12ce46e2c..219e39e1f 100644 --- a/UnitTests/Sources/RestorationTokenTests.swift +++ b/UnitTests/Sources/RestorationTokenTests.swift @@ -157,6 +157,7 @@ struct SessionV1: Equatable { } enum SlidingSyncVersionV1: Equatable { + // periphery:ignore - documents a structure the app used to write case none case proxy(url: String) case native diff --git a/UnitTests/Sources/RoomDetailsScreenViewModelTests.swift b/UnitTests/Sources/RoomDetailsScreenViewModelTests.swift index 82cc6d46c..280c129bc 100644 --- a/UnitTests/Sources/RoomDetailsScreenViewModelTests.swift +++ b/UnitTests/Sources/RoomDetailsScreenViewModelTests.swift @@ -33,8 +33,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) } @Test @@ -46,8 +45,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState.bindings.leaveRoomAlertItem)) { $0 != nil } context.send(viewAction: .processTapLeave) @@ -66,8 +64,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState.bindings.leaveRoomAlertItem)) { $0 != nil } context.send(viewAction: .processTapLeave) @@ -87,8 +84,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) context.send(viewAction: .processTapLeave) #expect(context.leaveRoomAlertItem?.state == .empty) @@ -145,8 +141,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil } @@ -166,8 +161,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil } @@ -198,8 +192,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil } @@ -229,8 +222,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil } @@ -261,8 +253,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferredRecipient = deferFulfillment(viewModel.context.observe(\.viewState.dmRecipientInfo)) { $0 != nil } @@ -294,8 +285,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -311,8 +301,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -346,13 +335,9 @@ struct RoomDetailsScreenViewModelTests { roomProxyMock = JoinedRoomProxyMock(configuration) let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init()) - powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in - .success(event == .roomAvatar) - } powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in event == .roomAvatar } - roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock) let roomInfoProxyMock = RoomInfoProxyMock(configuration) roomInfoProxyMock.powerLevels = powerLevelsProxyMock @@ -363,8 +348,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -385,13 +369,9 @@ struct RoomDetailsScreenViewModelTests { roomProxyMock = JoinedRoomProxyMock(configuration) let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init()) - powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in - .success(event == .roomName) - } powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in event == .roomName } - roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock) let roomInfoProxyMock = RoomInfoProxyMock(configuration) roomInfoProxyMock.powerLevels = powerLevelsProxyMock @@ -402,8 +382,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -424,13 +403,9 @@ struct RoomDetailsScreenViewModelTests { roomProxyMock = JoinedRoomProxyMock(configuration) let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init()) - powerLevelsProxyMock.canUserUserIDSendStateEventClosure = { _, event in - .success(event == .roomTopic) - } powerLevelsProxyMock.canOwnUserSendStateEventClosure = { event in event == .roomTopic } - roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock) let roomInfoProxyMock = RoomInfoProxyMock(configuration) roomInfoProxyMock.powerLevels = powerLevelsProxyMock @@ -441,8 +416,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -461,8 +435,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -481,8 +454,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()), - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) _ = await context.observe(\.viewState).debounce(for: .milliseconds(100)).first() @@ -499,8 +471,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) var deferred = deferFulfillment(context.observe(\.viewState.notificationSettingsState)) { $0.isError } @@ -707,8 +678,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState)) { state in state.knockRequestsCount == 2 && state.canSeeKnockingRequests @@ -728,8 +698,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState)) { state in state.knockRequestsCount == 0 && state.canSeeKnockingRequests @@ -751,8 +720,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState)) { state in state.knockRequestsCount == 2 && @@ -774,8 +742,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferred = deferFulfillment(context.observe(\.viewState)) { state in state.knockRequestsCount == 2 && @@ -801,8 +768,7 @@ struct RoomDetailsScreenViewModelTests { analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), notificationSettingsProxy: notificationSettingsProxyMock, - attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()), - appSettings: .volatile()) + attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder())) let deferredShared = deferFulfillment(context.observe(\.viewState), message: "The pill should be shown for rooms with shared history visibility") { state in diff --git a/UnitTests/Sources/RoomFlowCoordinatorTests.swift b/UnitTests/Sources/RoomFlowCoordinatorTests.swift index fb0d4e0a5..37b839d31 100644 --- a/UnitTests/Sources/RoomFlowCoordinatorTests.swift +++ b/UnitTests/Sources/RoomFlowCoordinatorTests.swift @@ -471,10 +471,6 @@ final class RoomFlowCoordinatorTests { try await processRouteOrClear(route: nil, expectedActions: expectedActions) } - private func process(route: AppRoute, expectedActions: [RoomFlowCoordinatorAction]) async throws { - try await processRouteOrClear(route: route, expectedActions: expectedActions) - } - private func processRouteOrClear(route: AppRoute?, expectedActions: [RoomFlowCoordinatorAction]) async throws { guard !expectedActions.isEmpty else { return diff --git a/UnitTests/Sources/RoomMemberDetailsViewModelTests.swift b/UnitTests/Sources/RoomMemberDetailsViewModelTests.swift index f4266fadf..9268d27c7 100644 --- a/UnitTests/Sources/RoomMemberDetailsViewModelTests.swift +++ b/UnitTests/Sources/RoomMemberDetailsViewModelTests.swift @@ -11,7 +11,6 @@ import Testing @MainActor struct RoomMemberDetailsViewModelTests { - var clientProxy: ClientProxy! var viewModel: RoomMemberDetailsScreenViewModelProtocol! var roomProxyMock: JoinedRoomProxyMock! var roomMemberProxyMock: RoomMemberProxyMock! @@ -212,7 +211,6 @@ struct RoomMemberDetailsViewModelTests { roomProxy: roomProxyMock, userSession: userSession, userIndicatorController: UserIndicatorControllerMock(), - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) } } diff --git a/UnitTests/Sources/RoomScreenViewModelTests.swift b/UnitTests/Sources/RoomScreenViewModelTests.swift index 00cb9f77d..7744059a5 100644 --- a/UnitTests/Sources/RoomScreenViewModelTests.swift +++ b/UnitTests/Sources/RoomScreenViewModelTests.swift @@ -15,8 +15,6 @@ import Testing @MainActor final class RoomScreenViewModelTests { - private var viewModel: RoomScreenViewModel! - private let appSettings: AppSettings init() async throws { @@ -47,7 +45,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel // check if in the default state is not showing but is indeed loading var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in @@ -128,7 +125,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel // check if the banner is now in a loaded state and is showing the counter var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in @@ -189,7 +185,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel // check if the banner is now in a loaded state and is showing the counter var deferred = deferFulfillment(viewModel.context.$viewState) { viewState in @@ -230,9 +225,7 @@ final class RoomScreenViewModelTests { let roomProxyMock = JoinedRoomProxyMock(configuration) let powerLevelsMock = RoomPowerLevelsProxyMock(.init()) - powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(false) powerLevelsMock.canOwnUserJoinCallReturnValue = false - roomProxyMock.powerLevelsReturnValue = .success(powerLevelsMock) let roomInfoProxyMock = RoomInfoProxyMock(configuration) roomInfoProxyMock.powerLevels = powerLevelsMock @@ -248,7 +241,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel #expect(viewModel.state.roomTitle == "StartingName") #expect(viewModel.state.roomAvatar == .room(id: "TestID", name: "StartingName", avatarURL: nil)) @@ -265,7 +257,6 @@ final class RoomScreenViewModelTests { configuration.name = "NewName" configuration.avatarURL = .mockMXCAvatar configuration.hasOngoingCall = true - powerLevelsMock.canUserJoinCallUserIDReturnValue = .success(true) infoSubject.send(RoomInfoProxyMock(configuration)) @@ -285,7 +276,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel #expect(viewModel.state.shouldShowCallButton) // When a call starts in this room. @@ -330,7 +320,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel viewModel.stop() } } @@ -351,7 +340,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel var deferred = deferFulfillment(viewModel.context.$viewState) { state in state.shouldSeeKnockRequests && @@ -385,7 +373,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel var deferred = deferFulfillment(viewModel.context.$viewState) { state in state.shouldSeeKnockRequests && @@ -414,7 +401,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel // Loading state just does not appear at all let deferred = deferFulfillment(viewModel.context.$viewState) { !$0.shouldSeeKnockRequests } @@ -434,7 +420,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel let deferred = deferFulfillment(viewModel.context.$viewState) { state in state.unseenKnockRequests == [.init(displayName: "Alice", avatarURL: nil, userID: "@alice:matrix.org", reason: "Hello World!", eventID: "1")] && @@ -461,7 +446,6 @@ final class RoomScreenViewModelTests { appHooks: AppHooks(), analyticsService: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock()) - self.viewModel = viewModel let deferredInvisible = deferFailure(viewModel.context.$viewState, timeout: .seconds(1), diff --git a/UnitTests/Sources/SecurityAndPrivacyScreenViewModelTests.swift b/UnitTests/Sources/SecurityAndPrivacyScreenViewModelTests.swift index 5080d9f89..c4797a14c 100644 --- a/UnitTests/Sources/SecurityAndPrivacyScreenViewModelTests.swift +++ b/UnitTests/Sources/SecurityAndPrivacyScreenViewModelTests.swift @@ -14,7 +14,6 @@ import Testing @MainActor final class SecurityAndPrivacyScreenViewModelTests { var viewModel: SecurityAndPrivacyScreenViewModelProtocol! - var spaceServiceProxy: SpaceServiceProxyMock! var roomProxy: JoinedRoomProxyMock! var context: SecurityAndPrivacyScreenViewModelType.Context { diff --git a/UnitTests/Sources/SpaceListScreenViewModelTests.swift b/UnitTests/Sources/SpaceListScreenViewModelTests.swift index 7e3a12964..6fc6de992 100644 --- a/UnitTests/Sources/SpaceListScreenViewModelTests.swift +++ b/UnitTests/Sources/SpaceListScreenViewModelTests.swift @@ -42,7 +42,6 @@ final class SpacesScreenViewModelTests { viewModel = SpacesScreenViewModel(userSession: userSession, selectedSpacePublisher: .init(nil), - appSettings: appSettings, userIndicatorController: UserIndicatorControllerMock()) } diff --git a/UnitTests/Sources/StartChatViewModelTests.swift b/UnitTests/Sources/StartChatViewModelTests.swift index 990c79633..d5058e6b9 100644 --- a/UnitTests/Sources/StartChatViewModelTests.swift +++ b/UnitTests/Sources/StartChatViewModelTests.swift @@ -29,8 +29,7 @@ struct StartChatScreenViewModelTests { viewModel = StartChatScreenViewModel(userSession: userSession, analytics: AnalyticsServiceMock(.init()), userIndicatorController: UserIndicatorControllerMock(), - userDiscoveryService: userDiscoveryService, - appSettings: appSettings) + userDiscoveryService: userDiscoveryService) } @Test diff --git a/UnitTests/Sources/TestUtilities/WaitingConfirmation.swift b/UnitTests/Sources/TestUtilities/WaitingConfirmation.swift index c46b1f958..2f80e9db3 100644 --- a/UnitTests/Sources/TestUtilities/WaitingConfirmation.swift +++ b/UnitTests/Sources/TestUtilities/WaitingConfirmation.swift @@ -125,6 +125,7 @@ func waitForConfirmation(_ comment: Comment? = nil, } } +// periphery:ignore:parameters isolation - inherits the caller's actor isolation /// Runs the body on the given actor, so that it can safely touch the caller's isolated state. /// /// Swift Testing's `confirmation` runs its closure on the concurrent executor regardless of the diff --git a/UnitTests/Sources/TimelineViewModelTests.swift b/UnitTests/Sources/TimelineViewModelTests.swift index 0081041f6..c5c6e1127 100644 --- a/UnitTests/Sources/TimelineViewModelTests.swift +++ b/UnitTests/Sources/TimelineViewModelTests.swift @@ -523,9 +523,7 @@ final class TimelineViewModelTests { try await deferred.fulfill() let powerLevelsProxyMock = RoomPowerLevelsProxyMock(.init()) - powerLevelsProxyMock.canUserPinOrUnpinUserIDReturnValue = .success(false) powerLevelsProxyMock.canOwnUserPinOrUnpinReturnValue = false - roomProxyMock.powerLevelsReturnValue = .success(powerLevelsProxyMock) let roomInfoProxyMock = RoomInfoProxyMock(configuration) roomInfoProxyMock.powerLevels = powerLevelsProxyMock diff --git a/UnitTests/Sources/UserPreferenceTests.swift b/UnitTests/Sources/UserPreferenceTests.swift index b2615782f..0bdd8dc33 100644 --- a/UnitTests/Sources/UserPreferenceTests.swift +++ b/UnitTests/Sources/UserPreferenceTests.swift @@ -159,7 +159,9 @@ private final class TestPreferences { } private struct CodableTestType: Equatable, Codable { + // periphery:ignore - used via the synthesized Codable conformance let a: String + // periphery:ignore - used via the synthesized Codable conformance let b: [Int] } diff --git a/UnitTests/Sources/UserProfileScreenViewModelTests.swift b/UnitTests/Sources/UserProfileScreenViewModelTests.swift index 893814cf5..9410aafe7 100644 --- a/UnitTests/Sources/UserProfileScreenViewModelTests.swift +++ b/UnitTests/Sources/UserProfileScreenViewModelTests.swift @@ -23,8 +23,7 @@ struct UserProfileScreenViewModelTests { isPresentedModally: false, userSession: UserSessionMock(.init(clientProxy: clientProxy)), userIndicatorController: userIndicatorController, - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) let context = viewModel.context let waitForMemberToLoad = deferFulfillment(context.observe(\.viewState.userProfile)) { $0 != nil } @@ -47,8 +46,7 @@ struct UserProfileScreenViewModelTests { isPresentedModally: false, userSession: UserSessionMock(.init(clientProxy: clientProxy)), userIndicatorController: userIndicatorController, - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) let context = viewModel.context let waitForMemberToLoad = deferFulfillment(context.observe(\.viewState.userProfile)) { $0 != nil } @@ -73,8 +71,7 @@ struct UserProfileScreenViewModelTests { isPresentedModally: false, userSession: UserSessionMock(.init(clientProxy: clientProxy)), userIndicatorController: userIndicatorController, - analytics: AnalyticsServiceMock(.init()), - appSettings: .volatile()) + analytics: AnalyticsServiceMock(.init())) let context = viewModel.context diff --git a/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift b/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift index 168f8272d..6a3d50cb9 100644 --- a/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift +++ b/UnitTests/Sources/UserSessionFlowCoordinatorTests.swift @@ -20,8 +20,6 @@ struct UserSessionFlowCoordinatorTests { private let networkReachabilitySubject: CurrentValueSubject = .init(.reachable) private let homeserverReachabilitySubject: CurrentValueSubject = .init(.reachable) - private var cancellables = Set() - private var tabCoordinator: NavigationTabCoordinator? { rootCoordinator?.rootCoordinator as? NavigationTabCoordinator } diff --git a/UnitTests/Sources/VoiceMessageRecorderTests.swift b/UnitTests/Sources/VoiceMessageRecorderTests.swift index 50c7d7d4e..cdac077d9 100644 --- a/UnitTests/Sources/VoiceMessageRecorderTests.swift +++ b/UnitTests/Sources/VoiceMessageRecorderTests.swift @@ -42,7 +42,6 @@ struct VoiceMessageRecorderTests { audioPlayer = AudioPlayerMock() audioPlayer.actions = audioPlayerActions audioPlayer.state = .stopped - audioPlayer.playbackSpeed = 1.0 mediaPlayerProvider = MediaPlayerProviderMock() mediaPlayerProvider.player = audioPlayer diff --git a/UnitTests/SupportingFiles/target.yml b/UnitTests/SupportingFiles/target.yml index 2388cd86e..60bcdf410 100644 --- a/UnitTests/SupportingFiles/target.yml +++ b/UnitTests/SupportingFiles/target.yml @@ -60,7 +60,6 @@ targets: - path: ../../DevelopmentAssets/ClassicAppFixtures buildPhase: resources # Necessary to add binary files to the target. - path: ../../ElementX/Sources/Other/Extensions/Publisher.swift - - path: ../../ElementX/Sources/Other/Extensions/XCTestCase.swift - path: ../../ElementX/Sources/Other/InfoPlistReader.swift - path: ../../Tools/Scripts/Templates/SimpleScreenExample/Tests/Unit