diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 706b17304..6dcc13382 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -536,6 +536,7 @@ 61A36B9BB2ADE36CEFF5E98C /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E93A1BE7D8A2EBCAD51EEB4 /* Array.swift */; }; 62684AECDFC5C7DC989CBD9E /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = 7B6BC3219ADD8AA0311D2B86 /* SnapshotTesting */; }; 627139A3D79F032BA81E3A53 /* UserSessionFlowCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FA29BAE9B0F2D90E57B261C /* UserSessionFlowCoordinatorTests.swift */; }; + 62811275F1ED9EA55638838E /* RoomTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7728AA8046D460145EAC740 /* RoomTests.swift */; }; 6298AB0906DDD3525CD78C6B /* KZFileWatchers in Frameworks */ = {isa = PBXBuildFile; productRef = 81DB3AB6CE996AB3954F4F03 /* KZFileWatchers */; }; 62A7FC3A0191BC7181AA432B /* AudioRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907FA4DE17DEA1A3738EFB83 /* AudioRecorder.swift */; }; 62C5876C4254C58C2086F0DE /* HomeScreenContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3B4B58B79A6FA250B24A1EC /* HomeScreenContent.swift */; }; @@ -1101,6 +1102,7 @@ C7774720A4B2E34693E3227C /* RoomNotificationSettingsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8896CDD20CA2D87EA3B848A1 /* RoomNotificationSettingsScreen.swift */; }; C797C0B4CF45C66CD1921252 /* SoftLogoutScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC43313F21511C853D34544E /* SoftLogoutScreenViewModelTests.swift */; }; C7ABEBECDC513F7887DACF66 /* ProgressMaskModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68010886142843705E342645 /* ProgressMaskModifier.swift */; }; + C7CEFC1FB0547CFC8F5C84EF /* Room.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78C13EF5035879B6131030F /* Room.swift */; }; C7F20DBF873CC72FB482E326 /* test_rotated_image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 723B055A57857BFF0F18D9CB /* test_rotated_image.jpg */; }; C80E06ED97CE52704A46C148 /* ClientBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1C33355FFB0F0953C35036 /* ClientBuilder.swift */; }; C85C7A201E4CFDA477ACEBEB /* AppLockSetupSettingsScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8610C1D21565C950BCA6A454 /* AppLockSetupSettingsScreenViewModelProtocol.swift */; }; @@ -2438,6 +2440,7 @@ B6E89E530A8E92EC44301CA1 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = ""; }; B73587C2E3CF5998361AE516 /* HomeScreenRoomTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomTests.swift; sourceTree = ""; }; B746EFA112532A7B701FB914 /* RoomNotificationSettingsCustomSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsCustomSectionView.swift; sourceTree = ""; }; + B7728AA8046D460145EAC740 /* RoomTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTests.swift; sourceTree = ""; }; B7884BD256C091EB511B2EDF /* AppLockSetupPINScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupPINScreenViewModelProtocol.swift; sourceTree = ""; }; B788615712FED326F73D3F83 /* GlobalSearchScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenViewModelProtocol.swift; sourceTree = ""; }; B7F0192CE2F891141A25B49F /* UITestsSignalling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestsSignalling.swift; sourceTree = ""; }; @@ -2597,6 +2600,7 @@ D751AA05AD2182BFC4608DE6 /* ur */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ur; path = ur.lproj/Localizable.stringsdict; sourceTree = ""; }; D7673F2B0B038FAB2A8D16AD /* ElementTextFieldStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementTextFieldStyle.swift; sourceTree = ""; }; D77F75B3E9F99864048A422A /* DeactivateAccountScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeactivateAccountScreenViewModelTests.swift; sourceTree = ""; }; + D78C13EF5035879B6131030F /* Room.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Room.swift; sourceTree = ""; }; D79BB714D28C9F588DD69353 /* SecureBackupScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupScreenViewModelProtocol.swift; sourceTree = ""; }; D7B18089ED50324583BB2FB7 /* EditRoomAddressScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditRoomAddressScreenViewModelProtocol.swift; sourceTree = ""; }; D7BB243B26D54EF1A0C422C0 /* NotificationContentBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationContentBuilder.swift; sourceTree = ""; }; @@ -3842,6 +3846,7 @@ 858DA81F2ACF484B7CAD6AE4 /* KnockedRoomProxy.swift */, 8F062DD2CCD95DC33528A16F /* KnockRequestProxy.swift */, C07851F4EA81AA3339806A7B /* KnockRequestProxyProtocol.swift */, + D78C13EF5035879B6131030F /* Room.swift */, B6404166CBF5CC88673FF9E2 /* RoomDetails.swift */, 40A66E8BC8D9AE4A08EFB2DF /* RoomInfoProxy.swift */, 14517E5597594956FCE1950D /* RoomInfoProxyProtocol.swift */, @@ -4584,6 +4589,7 @@ AEEAFB646E583655652C3D04 /* RoomStateEventStringBuilderTests.swift */, F46E441BA50705E6CEC89FE0 /* RoomSummaryProviderTests.swift */, 046C0D3F53B0B5EF0A1F5BEA /* RoomSummaryTests.swift */, + B7728AA8046D460145EAC740 /* RoomTests.swift */, 2E88534A39781D76487D59DF /* SecureBackupKeyBackupScreenViewModelTests.swift */, 848F69921527D31CAACB93AF /* SecureBackupLogoutConfirmationScreenViewModelTests.swift */, C0FF08D0BD7D0B4B6877AB7D /* SecureBackupRecoveryKeyScreenViewModelTests.swift */, @@ -7323,6 +7329,7 @@ CC0D088F505F33A20DC5590F /* RoomStateEventStringBuilderTests.swift in Sources */, 6AB306367E56A6F6DFA0E2FF /* RoomSummaryProviderTests.swift in Sources */, 15913A5B07118C1268A840E4 /* RoomSummaryTests.swift in Sources */, + 62811275F1ED9EA55638838E /* RoomTests.swift in Sources */, 7691233E3572A9173FD96CB3 /* SecureBackupKeyBackupScreenViewModelTests.swift in Sources */, EB87DF90CF6F8D5D12404C6E /* SecureBackupLogoutConfirmationScreenViewModelTests.swift in Sources */, 06B31F84CE52A7A7C271267C /* SecureBackupRecoveryKeyScreenViewModelTests.swift in Sources */, @@ -7991,6 +7998,7 @@ ED3E91E6166E4923791ACA84 /* ResolveVerifiedUserSendFailureScreenViewModelProtocol.swift in Sources */, A494741843F087881299ACF0 /* RestorationToken.swift in Sources */, 194585F6CD77242B36D4ADF1 /* Result.swift in Sources */, + C7CEFC1FB0547CFC8F5C84EF /* Room.swift in Sources */, 6E391F7F628D984AF44385D9 /* RoomAttachmentPicker.swift in Sources */, 8587A53DE8EF94FD796DC375 /* RoomAvatarImage.swift in Sources */, F8C87130FD999F7F1076208C /* RoomChangePermissionsScreen.swift in Sources */, @@ -9314,7 +9322,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.09.01; + version = 25.09.10; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ec6104655..6f79ef209 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "37730751af3a42569677b04d3458629a4b8dc347", - "version" : "25.9.1" + "revision" : "eeddc5f05f0980bcf29e78f212d64152be343124", + "version" : "25.9.10" } }, { diff --git a/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift b/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift index ea5b2dd00..c4e7abb87 100644 --- a/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift +++ b/ElementX/Sources/Mocks/InvitedRoomProxyMock.swift @@ -80,7 +80,6 @@ private extension RoomMember { membership: proxy.membership, isNameAmbiguous: proxy.disambiguatedDisplayName != proxy.displayName, powerLevel: proxy.powerLevel.rustPowerLevel, - normalizedPowerLevel: proxy.powerLevel.rustPowerLevel, isIgnored: proxy.isIgnored, suggestedRoleForPowerLevel: proxy.role.rustRole, membershipChangeReason: proxy.membershipChangeReason) diff --git a/ElementX/Sources/Other/Logging/TraceLogPack.swift b/ElementX/Sources/Other/Logging/TraceLogPack.swift index 19061dac9..0d28d4ba5 100644 --- a/ElementX/Sources/Other/Logging/TraceLogPack.swift +++ b/ElementX/Sources/Other/Logging/TraceLogPack.swift @@ -9,7 +9,7 @@ import Foundation import MatrixRustSDK enum TraceLogPack: Codable, CaseIterable { - case eventCache, sendQueue, timeline, notificationClient + case eventCache, sendQueue, timeline, notificationClient, syncProfiling var title: String { switch self { @@ -17,6 +17,7 @@ enum TraceLogPack: Codable, CaseIterable { case .sendQueue: "Send queue" case .timeline: "Timeline" case .notificationClient: "Notification client" + case .syncProfiling: "Sync profiling" } } } @@ -29,6 +30,7 @@ extension TraceLogPack { case .sendQueue: self = .sendQueue case .timeline: self = .timeline case .notificationClient: self = .notificationClient + case .syncProfiling: self = .syncProfiling } } @@ -38,6 +40,7 @@ extension TraceLogPack { case .sendQueue: .sendQueue case .timeline: .timeline case .notificationClient: .notificationClient + case .syncProfiling: .syncProfiling } } } diff --git a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift index fb7ccbf8f..e3ad02c98 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallWidgetDriver.swift @@ -76,31 +76,32 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv } async let useEncryption = (try? room.latestEncryptionState() == .encrypted) ?? false - async let isDirect = room.isDirect() - let widgetSettings: WidgetSettings + async let intent = room.joinCallIntent + let widgetSettings: WidgetSettings do { widgetSettings = try await newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString, widgetId: widgetID, parentUrl: nil, - header: .appBar, - hideHeader: true, - preload: nil, fontScale: nil, - appPrompt: false, - confineToRoom: true, font: nil, encryption: useEncryption ? .perParticipantKeys : .unencrypted, - intent: .startCall, - hideScreensharing: false, posthogUserId: nil, posthogApiHost: analyticsConfiguration?.posthogAPIHost, posthogApiKey: analyticsConfiguration?.posthogAPIKey, rageshakeSubmitUrl: rageshakeURL, sentryDsn: analyticsConfiguration?.sentryDSN, - sentryEnvironment: nil, - controlledMediaDevices: !ProcessInfo.processInfo.isiOSAppOnMac, - sendNotificationType: isDirect ? .ring : .notification)) + sentryEnvironment: nil), + config: .init(intent: intent, + skipLobby: nil, + header: nil, + hideHeader: nil, + preload: nil, + appPrompt: nil, + confineToRoom: nil, + hideScreensharing: nil, + controlledAudioDevices: nil, + sendNotificationType: nil)) } catch { MXLog.error("Failed to build widget settings: \(error)") return .failure(.failedBuildingWidgetSettings) diff --git a/ElementX/Sources/Services/Room/Room.swift b/ElementX/Sources/Services/Room/Room.swift new file mode 100644 index 000000000..b2e7354d6 --- /dev/null +++ b/ElementX/Sources/Services/Room/Room.swift @@ -0,0 +1,21 @@ +// +// Copyright 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 MatrixRustSDK + +extension RoomProtocol { + var joinCallIntent: Intent { + get async { + switch await (hasActiveRoomCall(), isDirect()) { + case (true, true): .joinExistingDm + case (true, false): .joinExisting + case (false, true): .startCallDm + case (false, false): .startCall + } + } + } +} diff --git a/UnitTests/Sources/RoomTests.swift b/UnitTests/Sources/RoomTests.swift new file mode 100644 index 000000000..f544e4961 --- /dev/null +++ b/UnitTests/Sources/RoomTests.swift @@ -0,0 +1,34 @@ +// +// Copyright 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 MatrixRustSDK +import XCTest + +@testable import ElementX + +class RoomTests: XCTestCase { + func testCallIntent() async throws { + let room = RoomSDKMock() + room.hasActiveRoomCallReturnValue = false + room.isDirectReturnValue = false + + var callIntent = await room.joinCallIntent + XCTAssertEqual(callIntent, .startCall) + + room.isDirectReturnValue = true + callIntent = await room.joinCallIntent + XCTAssertEqual(callIntent, .startCallDm) + + room.hasActiveRoomCallReturnValue = true + callIntent = await room.joinCallIntent + XCTAssertEqual(callIntent, .joinExistingDm) + + room.isDirectReturnValue = false + callIntent = await room.joinCallIntent + XCTAssertEqual(callIntent, .joinExisting) + } +} diff --git a/project.yml b/project.yml index 98af43517..583993242 100644 --- a/project.yml +++ b/project.yml @@ -68,7 +68,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.09.01 + exactVersion: 25.09.10 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios