mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
element-hq/element-x-ios/issues/2670 - Show invites as part of the room list
This commit is contained in:
parent
d34ec30ca6
commit
064626fbbe
@ -145,6 +145,7 @@
|
|||||||
21BF2B7CEDFE3CA67C5355AD /* test_image.png in Resources */ = {isa = PBXBuildFile; fileRef = C733D11B421CFE3A657EF230 /* test_image.png */; };
|
21BF2B7CEDFE3CA67C5355AD /* test_image.png in Resources */ = {isa = PBXBuildFile; fileRef = C733D11B421CFE3A657EF230 /* test_image.png */; };
|
||||||
21F29351EDD7B2A5534EE862 /* SecureBackupKeyBackupScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD558A898847C179E4B7A237 /* SecureBackupKeyBackupScreen.swift */; };
|
21F29351EDD7B2A5534EE862 /* SecureBackupKeyBackupScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD558A898847C179E4B7A237 /* SecureBackupKeyBackupScreen.swift */; };
|
||||||
22882C710BC99EC34A5024A0 /* UITestsScreenIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CEBE5EA91E8691EDF364EC2 /* UITestsScreenIdentifier.swift */; };
|
22882C710BC99EC34A5024A0 /* UITestsScreenIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CEBE5EA91E8691EDF364EC2 /* UITestsScreenIdentifier.swift */; };
|
||||||
|
22C5483D01EEB290B8339817 /* HomeScreenInviteCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8FC33C3F6BF597E095CE9FA /* HomeScreenInviteCell.swift */; };
|
||||||
2335D1AB954C151FD8779F45 /* RoomPermissionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0096BC5DA86AF6B6E5742AC /* RoomPermissionsTests.swift */; };
|
2335D1AB954C151FD8779F45 /* RoomPermissionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0096BC5DA86AF6B6E5742AC /* RoomPermissionsTests.swift */; };
|
||||||
234E2C782981003971ABE96E /* PermalinkBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754E66A8970963B15B2A41E /* PermalinkBuilder.swift */; };
|
234E2C782981003971ABE96E /* PermalinkBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754E66A8970963B15B2A41E /* PermalinkBuilder.swift */; };
|
||||||
23701DE32ACD6FD40AA992C3 /* MediaUploadingPreprocessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE203026B9AD3DB412439866 /* MediaUploadingPreprocessorTests.swift */; };
|
23701DE32ACD6FD40AA992C3 /* MediaUploadingPreprocessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE203026B9AD3DB412439866 /* MediaUploadingPreprocessorTests.swift */; };
|
||||||
@ -528,6 +529,7 @@
|
|||||||
7F61F9ACD5EC9E845EF3EFBF /* BugReportServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFFD3200F9960D4996159F10 /* BugReportServiceTests.swift */; };
|
7F61F9ACD5EC9E845EF3EFBF /* BugReportServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFFD3200F9960D4996159F10 /* BugReportServiceTests.swift */; };
|
||||||
7F7EA51A9A43125A8CB6AC90 /* NotificationSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D560DDA3B20C82766ACFAD /* NotificationSettingsScreenViewModel.swift */; };
|
7F7EA51A9A43125A8CB6AC90 /* NotificationSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D560DDA3B20C82766ACFAD /* NotificationSettingsScreenViewModel.swift */; };
|
||||||
7F941B063C94E1718DFC2CF3 /* RoomChangeRolesScreenRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E6EB7960BC9D0F7396B3BD /* RoomChangeRolesScreenRow.swift */; };
|
7F941B063C94E1718DFC2CF3 /* RoomChangeRolesScreenRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E6EB7960BC9D0F7396B3BD /* RoomChangeRolesScreenRow.swift */; };
|
||||||
|
7FED77802940EA7DF4D0D3A2 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 36DA824791172B9821EACBED /* PrivacyInfo.xcprivacy */; };
|
||||||
7FF6E1FBE6E9517FD29A1D8E /* RoomChangeRolesScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5C34C4E4268EF65D171EF /* RoomChangeRolesScreenModels.swift */; };
|
7FF6E1FBE6E9517FD29A1D8E /* RoomChangeRolesScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A5C34C4E4268EF65D171EF /* RoomChangeRolesScreenModels.swift */; };
|
||||||
8015842CB4DE1BE414D2CDED /* AppLockSetupBiometricsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C62E07C1164F5120727A2A8 /* AppLockSetupBiometricsScreenCoordinator.swift */; };
|
8015842CB4DE1BE414D2CDED /* AppLockSetupBiometricsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C62E07C1164F5120727A2A8 /* AppLockSetupBiometricsScreenCoordinator.swift */; };
|
||||||
804C15D8ADE0EA7A5268F58A /* OverridableAvatarImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD1C10E4957CB791FE0B8 /* OverridableAvatarImage.swift */; };
|
804C15D8ADE0EA7A5268F58A /* OverridableAvatarImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD1C10E4957CB791FE0B8 /* OverridableAvatarImage.swift */; };
|
||||||
@ -581,6 +583,7 @@
|
|||||||
8AB8ED1051216546CB35FA0E /* UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5E9C044BEB7C70B1378E91 /* UserSession.swift */; };
|
8AB8ED1051216546CB35FA0E /* UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5E9C044BEB7C70B1378E91 /* UserSession.swift */; };
|
||||||
8AC256AF0EC54658321C9241 /* LegalInformationScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5725BC6C63604CB769145B /* LegalInformationScreenViewModelTests.swift */; };
|
8AC256AF0EC54658321C9241 /* LegalInformationScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5725BC6C63604CB769145B /* LegalInformationScreenViewModelTests.swift */; };
|
||||||
8B1D5CE017EEC734CF5FE130 /* Encodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260004737C573A56FA01E86E /* Encodable.swift */; };
|
8B1D5CE017EEC734CF5FE130 /* Encodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260004737C573A56FA01E86E /* Encodable.swift */; };
|
||||||
|
8B408C574E35E1C9B43A50CE /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 048A21188AB19349D026BECD /* PrivacyInfo.xcprivacy */; };
|
||||||
8B41D0357B91CD3B6F6A3BCA /* EmoteRoomTimelineItemContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */; };
|
8B41D0357B91CD3B6F6A3BCA /* EmoteRoomTimelineItemContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */; };
|
||||||
8B76191B9DDD1AC90A6E3A35 /* MediaFileHandleProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC1D382565A4E9CAC2F14EA /* MediaFileHandleProxy.swift */; };
|
8B76191B9DDD1AC90A6E3A35 /* MediaFileHandleProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC1D382565A4E9CAC2F14EA /* MediaFileHandleProxy.swift */; };
|
||||||
8BC8EF6705A78946C1F22891 /* SoftLogoutScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71A7D4DDEEE5D2CA0C8D63CD /* SoftLogoutScreen.swift */; };
|
8BC8EF6705A78946C1F22891 /* SoftLogoutScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71A7D4DDEEE5D2CA0C8D63CD /* SoftLogoutScreen.swift */; };
|
||||||
@ -1971,6 +1974,7 @@
|
|||||||
D8E057FB1F07A5C201C89061 /* MockServerSelectionScreenState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockServerSelectionScreenState.swift; sourceTree = "<group>"; };
|
D8E057FB1F07A5C201C89061 /* MockServerSelectionScreenState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockServerSelectionScreenState.swift; sourceTree = "<group>"; };
|
||||||
D8E60332509665C00179ACF6 /* MessageForwardingScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModel.swift; sourceTree = "<group>"; };
|
D8E60332509665C00179ACF6 /* MessageForwardingScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModel.swift; sourceTree = "<group>"; };
|
||||||
D8F5F9E02B1AB5350B1815E7 /* TimelineStartRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStartRoomTimelineItem.swift; sourceTree = "<group>"; };
|
D8F5F9E02B1AB5350B1815E7 /* TimelineStartRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStartRoomTimelineItem.swift; sourceTree = "<group>"; };
|
||||||
|
D8FC33C3F6BF597E095CE9FA /* HomeScreenInviteCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenInviteCell.swift; sourceTree = "<group>"; };
|
||||||
D93C94C30E3135BC9290DE13 /* VoiceMessageRecorderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecorderTests.swift; sourceTree = "<group>"; };
|
D93C94C30E3135BC9290DE13 /* VoiceMessageRecorderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecorderTests.swift; sourceTree = "<group>"; };
|
||||||
D95E8C0EFEC0C6F96EDAA71A /* PreviewTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = PreviewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
D95E8C0EFEC0C6F96EDAA71A /* PreviewTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = PreviewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
DA14564EE143F73F7E4D1F79 /* RoomNotificationSettingsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsScreenModels.swift; sourceTree = "<group>"; };
|
DA14564EE143F73F7E4D1F79 /* RoomNotificationSettingsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomNotificationSettingsScreenModels.swift; sourceTree = "<group>"; };
|
||||||
@ -3147,6 +3151,7 @@
|
|||||||
B902EA6CD3296B0E10EE432B /* HomeScreen.swift */,
|
B902EA6CD3296B0E10EE432B /* HomeScreen.swift */,
|
||||||
A3B4B58B79A6FA250B24A1EC /* HomeScreenContent.swift */,
|
A3B4B58B79A6FA250B24A1EC /* HomeScreenContent.swift */,
|
||||||
C0FEA560929DD73FFEF8C3DF /* HomeScreenEmptyStateView.swift */,
|
C0FEA560929DD73FFEF8C3DF /* HomeScreenEmptyStateView.swift */,
|
||||||
|
D8FC33C3F6BF597E095CE9FA /* HomeScreenInviteCell.swift */,
|
||||||
24227FF9A2797F6EA7F69CDD /* HomeScreenInvitesButton.swift */,
|
24227FF9A2797F6EA7F69CDD /* HomeScreenInvitesButton.swift */,
|
||||||
05512FB13987D221B7205DE0 /* HomeScreenRecoveryKeyConfirmationBanner.swift */,
|
05512FB13987D221B7205DE0 /* HomeScreenRecoveryKeyConfirmationBanner.swift */,
|
||||||
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */,
|
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */,
|
||||||
@ -5414,6 +5419,7 @@
|
|||||||
5F5488FBC9CFEB6F433D74A4 /* Localizable.strings in Resources */,
|
5F5488FBC9CFEB6F433D74A4 /* Localizable.strings in Resources */,
|
||||||
0EA6537A07E2DC882AEA5962 /* Localizable.stringsdict in Resources */,
|
0EA6537A07E2DC882AEA5962 /* Localizable.stringsdict in Resources */,
|
||||||
6860721DB3091BE08164C132 /* MapAssets.xcassets in Resources */,
|
6860721DB3091BE08164C132 /* MapAssets.xcassets in Resources */,
|
||||||
|
8B408C574E35E1C9B43A50CE /* PrivacyInfo.xcprivacy in Resources */,
|
||||||
C3317EF833AB4060988DF098 /* SAS.strings in Resources */,
|
C3317EF833AB4060988DF098 /* SAS.strings in Resources */,
|
||||||
CE1694C7BB93C3311524EF28 /* Untranslated.strings in Resources */,
|
CE1694C7BB93C3311524EF28 /* Untranslated.strings in Resources */,
|
||||||
2797C9D9BA642370F1C85D78 /* Untranslated.stringsdict in Resources */,
|
2797C9D9BA642370F1C85D78 /* Untranslated.stringsdict in Resources */,
|
||||||
@ -5426,6 +5432,7 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
7FED77802940EA7DF4D0D3A2 /* PrivacyInfo.xcprivacy in Resources */,
|
||||||
D2D70B5DB1A5E4AF0CD88330 /* target.yml in Resources */,
|
D2D70B5DB1A5E4AF0CD88330 /* target.yml in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -5988,6 +5995,7 @@
|
|||||||
62C5876C4254C58C2086F0DE /* HomeScreenContent.swift in Sources */,
|
62C5876C4254C58C2086F0DE /* HomeScreenContent.swift in Sources */,
|
||||||
8CC12086CBF91A7E10CDC205 /* HomeScreenCoordinator.swift in Sources */,
|
8CC12086CBF91A7E10CDC205 /* HomeScreenCoordinator.swift in Sources */,
|
||||||
77BB228AEA861E50FFD6A228 /* HomeScreenEmptyStateView.swift in Sources */,
|
77BB228AEA861E50FFD6A228 /* HomeScreenEmptyStateView.swift in Sources */,
|
||||||
|
22C5483D01EEB290B8339817 /* HomeScreenInviteCell.swift in Sources */,
|
||||||
64C373ACCFA26D42BA45CFAD /* HomeScreenInvitesButton.swift in Sources */,
|
64C373ACCFA26D42BA45CFAD /* HomeScreenInvitesButton.swift in Sources */,
|
||||||
8810A2A30A68252EBB54EE05 /* HomeScreenModels.swift in Sources */,
|
8810A2A30A68252EBB54EE05 /* HomeScreenModels.swift in Sources */,
|
||||||
B04E9EB589CE99C3929E817A /* HomeScreenRecoveryKeyConfirmationBanner.swift in Sources */,
|
B04E9EB589CE99C3929E817A /* HomeScreenRecoveryKeyConfirmationBanner.swift in Sources */,
|
||||||
@ -7268,7 +7276,7 @@
|
|||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 1.1.56;
|
version = 1.1.57;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
|
||||||
|
@ -139,8 +139,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "1d47d496ca46e123e102e64d45635fab73de3d78",
|
"revision" : "e50657b5d9672d09e4ab0a6e8a3f8939eed49e04",
|
||||||
"version" : "1.1.56"
|
"version" : "1.1.57"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -263,7 +263,7 @@
|
|||||||
{
|
{
|
||||||
"identity" : "swiftui-introspect",
|
"identity" : "swiftui-introspect",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/siteline/SwiftUI-Introspect",
|
"location" : "https://github.com/siteline/SwiftUI-Introspect.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "b94da693e57eaf79d16464b8b7c90d09cba4e290",
|
"revision" : "b94da693e57eaf79d16464b8b7c90d09cba4e290",
|
||||||
"version" : "0.9.2"
|
"version" : "0.9.2"
|
||||||
|
@ -47,13 +47,9 @@ final class AppSettings {
|
|||||||
|
|
||||||
// Feature flags
|
// Feature flags
|
||||||
case shouldCollapseRoomStateEvents
|
case shouldCollapseRoomStateEvents
|
||||||
case userSuggestionsEnabled
|
|
||||||
case mentionsBadgeEnabled
|
|
||||||
case roomListFiltersEnabled
|
|
||||||
case markAsUnreadEnabled
|
|
||||||
case markAsFavouriteEnabled
|
|
||||||
case publicSearchEnabled
|
case publicSearchEnabled
|
||||||
case qrCodeLoginEnabled
|
case qrCodeLoginEnabled
|
||||||
|
case roomListInvitesEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
|
||||||
@ -287,6 +283,9 @@ final class AppSettings {
|
|||||||
@UserPreference(key: UserDefaultsKeys.qrCodeLoginEnabled, defaultValue: false, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.qrCodeLoginEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
var qrCodeLoginEnabled
|
var qrCodeLoginEnabled
|
||||||
|
|
||||||
|
@UserPreference(key: UserDefaultsKeys.roomListInvitesEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
|
var roomListInvitesEnabled
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MARK: - Shared
|
// MARK: - Shared
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated using Sourcery 2.1.8 — https://github.com/krzysztofzablocki/Sourcery
|
// Generated using Sourcery 2.2.2 — https://github.com/krzysztofzablocki/Sourcery
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
// swiftlint:disable all
|
// swiftlint:disable all
|
||||||
@ -478,16 +478,16 @@ class SDKClientMock: SDKClientProtocol {
|
|||||||
}
|
}
|
||||||
public var loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments: (username: String, password: String, initialDeviceName: String?, deviceId: String?)?
|
public var loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments: (username: String, password: String, initialDeviceName: String?, deviceId: String?)?
|
||||||
public var loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations: [(username: String, password: String, initialDeviceName: String?, deviceId: String?)] = []
|
public var loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations: [(username: String, password: String, initialDeviceName: String?, deviceId: String?)] = []
|
||||||
public var loginUsernamePasswordInitialDeviceNameDeviceIdClosure: ((String, String, String?, String?) throws -> Void)?
|
public var loginUsernamePasswordInitialDeviceNameDeviceIdClosure: ((String, String, String?, String?) async throws -> Void)?
|
||||||
|
|
||||||
public func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) throws {
|
public func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) async throws {
|
||||||
if let error = loginUsernamePasswordInitialDeviceNameDeviceIdThrowableError {
|
if let error = loginUsernamePasswordInitialDeviceNameDeviceIdThrowableError {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
loginUsernamePasswordInitialDeviceNameDeviceIdCallsCount += 1
|
loginUsernamePasswordInitialDeviceNameDeviceIdCallsCount += 1
|
||||||
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments = (username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId)
|
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments = (username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId)
|
||||||
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations.append((username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId))
|
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations.append((username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId))
|
||||||
try loginUsernamePasswordInitialDeviceNameDeviceIdClosure?(username, password, initialDeviceName, deviceId)
|
try await loginUsernamePasswordInitialDeviceNameDeviceIdClosure?(username, password, initialDeviceName, deviceId)
|
||||||
}
|
}
|
||||||
//MARK: - logout
|
//MARK: - logout
|
||||||
|
|
||||||
|
@ -79,6 +79,8 @@ extension RoomSummaryProviderMock {
|
|||||||
extension Array where Element == RoomSummary {
|
extension Array where Element == RoomSummary {
|
||||||
static let mockRooms: [Element] = [
|
static let mockRooms: [Element] = [
|
||||||
.filled(details: RoomSummaryDetails(id: "1",
|
.filled(details: RoomSummaryDetails(id: "1",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Foundation 🔭🪐🌌",
|
name: "Foundation 🔭🪐🌌",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -89,11 +91,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "2",
|
.filled(details: RoomSummaryDetails(id: "2",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Foundation and Empire",
|
name: "Foundation and Empire",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: URL.picturesDirectory,
|
avatarURL: URL.picturesDirectory,
|
||||||
@ -104,11 +107,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 2,
|
unreadNotificationsCount: 2,
|
||||||
notificationMode: .mute,
|
notificationMode: .mute,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "3",
|
.filled(details: RoomSummaryDetails(id: "3",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Second Foundation",
|
name: "Second Foundation",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -119,11 +123,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: .mentionsAndKeywordsOnly,
|
notificationMode: .mentionsAndKeywordsOnly,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "4",
|
.filled(details: RoomSummaryDetails(id: "4",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Foundation's Edge",
|
name: "Foundation's Edge",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -134,11 +139,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 2,
|
unreadNotificationsCount: 2,
|
||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "5",
|
.filled(details: RoomSummaryDetails(id: "5",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Foundation and Earth",
|
name: "Foundation and Earth",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -149,11 +155,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 1,
|
unreadNotificationsCount: 1,
|
||||||
notificationMode: .allMessages,
|
notificationMode: .allMessages,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: true,
|
hasOngoingCall: true,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "6",
|
.filled(details: RoomSummaryDetails(id: "6",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Prelude to Foundation",
|
name: "Prelude to Foundation",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -164,11 +171,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: .mute,
|
notificationMode: .mute,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: true,
|
hasOngoingCall: true,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "0",
|
.filled(details: RoomSummaryDetails(id: "0",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Unknown",
|
name: "Unknown",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -179,7 +187,6 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
@ -216,7 +223,10 @@ extension Array where Element == RoomSummary {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
static let mockInvites: [Element] = [
|
static let mockInvites: [Element] = [
|
||||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId1", name: "First room",
|
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId1",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: RoomMemberProxyMock.mockCharlie,
|
||||||
|
name: "First room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: URL.picturesDirectory,
|
avatarURL: URL.picturesDirectory,
|
||||||
lastMessage: nil,
|
lastMessage: nil,
|
||||||
@ -226,11 +236,12 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: "#footest:somewhere.org",
|
canonicalAlias: "#footest:somewhere.org",
|
||||||
inviter: RoomMemberProxyMock.mockCharlie,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)),
|
isFavourite: false)),
|
||||||
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId2",
|
.filled(details: RoomSummaryDetails(id: "someAwesomeRoomId2",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: RoomMemberProxyMock.mockCharlie,
|
||||||
name: "Second room",
|
name: "Second room",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -241,7 +252,6 @@ extension Array where Element == RoomSummary {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: RoomMemberProxyMock.mockCharlie,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false))
|
isFavourite: false))
|
||||||
|
@ -78,6 +78,7 @@ enum PermalinkBuilder {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Use a room's `matrixToPermalink` method instead")
|
||||||
static func permalinkTo(userIdentifier: String, baseURL: URL) throws -> URL {
|
static func permalinkTo(userIdentifier: String, baseURL: URL) throws -> URL {
|
||||||
guard MatrixEntityRegex.isMatrixUserIdentifier(userIdentifier) else {
|
guard MatrixEntityRegex.isMatrixUserIdentifier(userIdentifier) else {
|
||||||
throw PermalinkBuilderError.invalidUserIdentifier
|
throw PermalinkBuilderError.invalidUserIdentifier
|
||||||
|
@ -48,6 +48,9 @@ enum HomeScreenViewAction {
|
|||||||
case markRoomAsRead(roomIdentifier: String)
|
case markRoomAsRead(roomIdentifier: String)
|
||||||
case markRoomAsFavourite(roomIdentifier: String, isFavourite: Bool)
|
case markRoomAsFavourite(roomIdentifier: String, isFavourite: Bool)
|
||||||
case selectRoomDirectorySearch
|
case selectRoomDirectorySearch
|
||||||
|
|
||||||
|
case acceptInvite(roomIdentifier: String)
|
||||||
|
case declineInvite(roomIdentifier: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum HomeScreenRoomListMode: CustomStringConvertible {
|
enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||||
@ -130,6 +133,18 @@ struct HomeScreenViewStateBindings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct HomeScreenRoom: Identifiable, Equatable {
|
struct HomeScreenRoom: Identifiable, Equatable {
|
||||||
|
enum RoomType {
|
||||||
|
case placeholder
|
||||||
|
case room
|
||||||
|
case invite
|
||||||
|
}
|
||||||
|
|
||||||
|
struct InviterDetails: Equatable {
|
||||||
|
let userID: String
|
||||||
|
let displayName: String?
|
||||||
|
let avatarURL: URL?
|
||||||
|
}
|
||||||
|
|
||||||
static let placeholderLastMessage = AttributedString("Hidden last message")
|
static let placeholderLastMessage = AttributedString("Hidden last message")
|
||||||
|
|
||||||
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
||||||
@ -139,9 +154,9 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
|||||||
/// The real room identifier this item points to
|
/// The real room identifier this item points to
|
||||||
let roomId: String?
|
let roomId: String?
|
||||||
|
|
||||||
var name = ""
|
let type: RoomType
|
||||||
|
|
||||||
var badges: Badges
|
let badges: Badges
|
||||||
struct Badges: Equatable {
|
struct Badges: Equatable {
|
||||||
let isDotShown: Bool
|
let isDotShown: Bool
|
||||||
let isMentionShown: Bool
|
let isMentionShown: Bool
|
||||||
@ -149,28 +164,38 @@ struct HomeScreenRoom: Identifiable, Equatable {
|
|||||||
let isCallShown: Bool
|
let isCallShown: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let name: String
|
||||||
|
|
||||||
|
let isDirect: Bool
|
||||||
|
|
||||||
let isHighlighted: Bool
|
let isHighlighted: Bool
|
||||||
|
|
||||||
let isFavourite: Bool
|
let isFavourite: Bool
|
||||||
|
|
||||||
var timestamp: String?
|
let timestamp: String?
|
||||||
|
|
||||||
var lastMessage: AttributedString?
|
let lastMessage: AttributedString?
|
||||||
|
|
||||||
var avatarURL: URL?
|
let avatarURL: URL?
|
||||||
|
|
||||||
var isPlaceholder = false
|
let inviter: InviterDetails?
|
||||||
|
|
||||||
|
let canonicalAlias: String?
|
||||||
|
|
||||||
static func placeholder() -> HomeScreenRoom {
|
static func placeholder() -> HomeScreenRoom {
|
||||||
HomeScreenRoom(id: UUID().uuidString,
|
HomeScreenRoom(id: UUID().uuidString,
|
||||||
roomId: nil,
|
roomId: nil,
|
||||||
name: "Placeholder room name",
|
type: .placeholder,
|
||||||
badges: .init(isDotShown: false, isMentionShown: false, isMuteShown: false, isCallShown: false),
|
badges: .init(isDotShown: false, isMentionShown: false, isMuteShown: false, isCallShown: false),
|
||||||
|
name: "Placeholder room name",
|
||||||
|
isDirect: false,
|
||||||
isHighlighted: false,
|
isHighlighted: false,
|
||||||
isFavourite: false,
|
isFavourite: false,
|
||||||
timestamp: "Now",
|
timestamp: "Now",
|
||||||
lastMessage: placeholderLastMessage,
|
lastMessage: placeholderLastMessage,
|
||||||
isPlaceholder: true)
|
avatarURL: nil,
|
||||||
|
inviter: nil,
|
||||||
|
canonicalAlias: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,17 +211,28 @@ extension HomeScreenRoom {
|
|||||||
let isCallShown = details.hasOngoingCall
|
let isCallShown = details.hasOngoingCall
|
||||||
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
|
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
|
||||||
|
|
||||||
|
var inviter: InviterDetails?
|
||||||
|
if let roomMemberProxy = details.inviter {
|
||||||
|
inviter = .init(userID: roomMemberProxy.userID,
|
||||||
|
displayName: roomMemberProxy.displayName,
|
||||||
|
avatarURL: roomMemberProxy.avatarURL)
|
||||||
|
}
|
||||||
|
|
||||||
self.init(id: identifier,
|
self.init(id: identifier,
|
||||||
roomId: details.id,
|
roomId: details.id,
|
||||||
name: details.name,
|
type: details.isInvite ? .invite : .room,
|
||||||
badges: .init(isDotShown: isDotShown,
|
badges: .init(isDotShown: isDotShown,
|
||||||
isMentionShown: isMentionShown,
|
isMentionShown: isMentionShown,
|
||||||
isMuteShown: isMuteShown,
|
isMuteShown: isMuteShown,
|
||||||
isCallShown: isCallShown),
|
isCallShown: isCallShown),
|
||||||
|
name: details.name,
|
||||||
|
isDirect: details.isDirect,
|
||||||
isHighlighted: isHighlighted,
|
isHighlighted: isHighlighted,
|
||||||
isFavourite: details.isFavourite,
|
isFavourite: details.isFavourite,
|
||||||
timestamp: details.lastMessageFormattedTimestamp,
|
timestamp: details.lastMessageFormattedTimestamp,
|
||||||
lastMessage: details.lastMessage,
|
lastMessage: details.lastMessage,
|
||||||
avatarURL: details.avatarURL)
|
avatarURL: details.avatarURL,
|
||||||
|
inviter: inviter,
|
||||||
|
canonicalAlias: details.canonicalAlias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,12 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
}
|
}
|
||||||
case .selectRoomDirectorySearch:
|
case .selectRoomDirectorySearch:
|
||||||
actionsSubject.send(.presentRoomDirectorySearch)
|
actionsSubject.send(.presentRoomDirectorySearch)
|
||||||
|
case .acceptInvite(let roomIdentifier):
|
||||||
|
Task {
|
||||||
|
await acceptInvite(roomID: roomIdentifier)
|
||||||
|
}
|
||||||
|
case .declineInvite(let roomIdentifier):
|
||||||
|
showDeclineInviteConfirmationAlert(roomID: roomIdentifier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,4 +452,69 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: Invites
|
||||||
|
|
||||||
|
private func acceptInvite(roomID: String) async {
|
||||||
|
defer {
|
||||||
|
userIndicatorController.retractIndicatorWithId(roomID)
|
||||||
|
}
|
||||||
|
|
||||||
|
userIndicatorController.submitIndicator(UserIndicator(id: roomID, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||||
|
|
||||||
|
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||||
|
displayError()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
switch await roomProxy.acceptInvitation() {
|
||||||
|
case .success:
|
||||||
|
actionsSubject.send(.presentRoom(roomIdentifier: roomID))
|
||||||
|
analyticsService.trackJoinedRoom(isDM: roomProxy.isDirect, isSpace: roomProxy.isSpace, activeMemberCount: UInt(roomProxy.activeMembersCount))
|
||||||
|
case .failure:
|
||||||
|
displayError()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func showDeclineInviteConfirmationAlert(roomID: String) {
|
||||||
|
guard let room = state.rooms.first(where: { $0.id == roomID }) else {
|
||||||
|
displayError()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let roomPlaceholder = room.isDirect ? (room.inviter?.displayName ?? room.name) : room.name
|
||||||
|
let title = room.isDirect ? L10n.screenInvitesDeclineDirectChatTitle : L10n.screenInvitesDeclineChatTitle
|
||||||
|
let message = room.isDirect ? L10n.screenInvitesDeclineDirectChatMessage(roomPlaceholder) : L10n.screenInvitesDeclineChatMessage(roomPlaceholder)
|
||||||
|
|
||||||
|
state.bindings.alertInfo = .init(id: UUID(),
|
||||||
|
title: title,
|
||||||
|
message: message,
|
||||||
|
primaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil),
|
||||||
|
secondaryButton: .init(title: L10n.actionDecline, role: .destructive, action: { Task { await self.declineInvite(roomID: room.id) } }))
|
||||||
|
}
|
||||||
|
|
||||||
|
private func declineInvite(roomID: String) async {
|
||||||
|
defer {
|
||||||
|
userIndicatorController.retractIndicatorWithId(roomID)
|
||||||
|
}
|
||||||
|
|
||||||
|
userIndicatorController.submitIndicator(UserIndicator(id: roomID, type: .modal, title: L10n.commonLoading, persistent: true))
|
||||||
|
|
||||||
|
guard let roomProxy = await userSession.clientProxy.roomForIdentifier(roomID) else {
|
||||||
|
displayError()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = await roomProxy.rejectInvitation()
|
||||||
|
|
||||||
|
if case .failure = result {
|
||||||
|
displayError()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func displayError() {
|
||||||
|
state.bindings.alertInfo = .init(id: UUID(),
|
||||||
|
title: L10n.commonError,
|
||||||
|
message: L10n.errorUnknown)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,15 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
|||||||
case people
|
case people
|
||||||
case rooms
|
case rooms
|
||||||
case favourites
|
case favourites
|
||||||
|
case invites
|
||||||
|
|
||||||
|
static var availableFilters: [RoomListFilter] {
|
||||||
|
if ServiceLocator.shared.settings.roomListInvitesEnabled {
|
||||||
|
return RoomListFilter.allCases
|
||||||
|
} else {
|
||||||
|
return RoomListFilter.allCases.filter { !($0 == .invites) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var localizedName: String {
|
var localizedName: String {
|
||||||
switch self {
|
switch self {
|
||||||
@ -40,20 +49,24 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
|||||||
return L10n.screenRoomlistFilterUnreads
|
return L10n.screenRoomlistFilterUnreads
|
||||||
case .favourites:
|
case .favourites:
|
||||||
return L10n.screenRoomlistFilterFavourites
|
return L10n.screenRoomlistFilterFavourites
|
||||||
|
case .invites:
|
||||||
|
return L10n.screenRoomlistFilterInvites
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var incompatibleFilter: RoomListFilter? {
|
var incompatibleFilters: [RoomListFilter] {
|
||||||
switch self {
|
switch self {
|
||||||
case .people:
|
case .people:
|
||||||
return .rooms
|
return [.rooms, .invites]
|
||||||
case .rooms:
|
case .rooms:
|
||||||
return .people
|
return [.people, .invites]
|
||||||
case .unreads:
|
case .unreads:
|
||||||
return nil
|
return [.invites]
|
||||||
case .favourites:
|
case .favourites:
|
||||||
// When we will have Low Priority we may need to return it here
|
// When we will have Low Priority we may need to return it here
|
||||||
return nil
|
return [.invites]
|
||||||
|
case .invites:
|
||||||
|
return [.rooms, .people, .unreads, .favourites]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +80,8 @@ enum RoomListFilter: Int, CaseIterable, Identifiable {
|
|||||||
return .unread
|
return .unread
|
||||||
case .favourites:
|
case .favourites:
|
||||||
return .favourite
|
return .favourite
|
||||||
|
case .invites:
|
||||||
|
return .invite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,13 +94,13 @@ struct RoomListFiltersState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var availableFilters: [RoomListFilter] {
|
var availableFilters: [RoomListFilter] {
|
||||||
var availableFilters = OrderedSet(RoomListFilter.allCases)
|
var availableFilters = OrderedSet(RoomListFilter.availableFilters)
|
||||||
|
|
||||||
for filter in activeFilters {
|
for filter in activeFilters {
|
||||||
availableFilters.remove(filter)
|
availableFilters.remove(filter)
|
||||||
if let incompatibleFilter = filter.incompatibleFilter {
|
filter.incompatibleFilters.forEach { availableFilters.remove($0) }
|
||||||
availableFilters.remove(incompatibleFilter)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return availableFilters.elements
|
return availableFilters.elements
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,10 +109,12 @@ struct RoomListFiltersState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mutating func activateFilter(_ filter: RoomListFilter) {
|
mutating func activateFilter(_ filter: RoomListFilter) {
|
||||||
if let incompatibleFilter = filter.incompatibleFilter,
|
filter.incompatibleFilters.forEach { incompatibleFilter in
|
||||||
activeFilters.contains(incompatibleFilter) {
|
if activeFilters.contains(incompatibleFilter) {
|
||||||
fatalError("[RoomListFiltersState] adding mutually exclusive filters is not allowed")
|
fatalError("[RoomListFiltersState] adding mutually exclusive filters is not allowed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always want the most recently enabled filter to be at the bottom of the others.
|
// We always want the most recently enabled filter to be at the bottom of the others.
|
||||||
activeFilters.append(filter)
|
activeFilters.append(filter)
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ struct RoomListFiltersEmptyStateView: View {
|
|||||||
return L10n.screenRoomlistFilterRoomsEmptyStateTitle
|
return L10n.screenRoomlistFilterRoomsEmptyStateTitle
|
||||||
case .favourites:
|
case .favourites:
|
||||||
return L10n.screenRoomlistFilterFavouritesEmptyStateTitle
|
return L10n.screenRoomlistFilterFavouritesEmptyStateTitle
|
||||||
|
case .invites:
|
||||||
|
return L10n.screenRoomlistFilterInvitesEmptyStateTitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return L10n.screenRoomlistFilterMixedEmptyStateTitle
|
return L10n.screenRoomlistFilterMixedEmptyStateTitle
|
||||||
|
@ -0,0 +1,254 @@
|
|||||||
|
//
|
||||||
|
// Copyright 2024 New Vector Ltd
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Combine
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
struct HomeScreenInviteCell: View {
|
||||||
|
@Environment(\.dynamicTypeSize) var dynamicTypeSize
|
||||||
|
|
||||||
|
let room: HomeScreenRoom
|
||||||
|
let context: HomeScreenViewModel.Context
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
HStack(alignment: .top, spacing: 16) {
|
||||||
|
if dynamicTypeSize < .accessibility3 {
|
||||||
|
LoadableAvatarImage(url: room.avatarURL,
|
||||||
|
name: title,
|
||||||
|
contentID: room.id,
|
||||||
|
avatarSize: .custom(52),
|
||||||
|
imageProvider: context.imageProvider)
|
||||||
|
.dynamicTypeSize(dynamicTypeSize < .accessibility1 ? dynamicTypeSize : .accessibility1)
|
||||||
|
.accessibilityHidden(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
mainContent
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
.padding(.bottom, 16)
|
||||||
|
.padding(.trailing, 16)
|
||||||
|
.overlay(alignment: .bottom) {
|
||||||
|
separator
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.top, 12)
|
||||||
|
.padding(.leading, 16)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Private
|
||||||
|
|
||||||
|
private var mainContent: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
HStack(alignment: .firstTextBaseline, spacing: 16) {
|
||||||
|
textualContent
|
||||||
|
badge
|
||||||
|
}
|
||||||
|
|
||||||
|
inviterView
|
||||||
|
.padding(.top, 6)
|
||||||
|
.padding(.trailing, 16)
|
||||||
|
|
||||||
|
buttons
|
||||||
|
.padding(.top, 14)
|
||||||
|
.padding(.trailing, 22)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var inviterView: some View {
|
||||||
|
if let invitedText = attributedInviteText, let name = room.inviter?.displayName {
|
||||||
|
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
||||||
|
LoadableAvatarImage(url: room.inviter?.avatarURL,
|
||||||
|
name: name,
|
||||||
|
contentID: name,
|
||||||
|
avatarSize: .custom(16),
|
||||||
|
imageProvider: context.imageProvider)
|
||||||
|
.alignmentGuide(.firstTextBaseline) { $0[.bottom] * 0.8 }
|
||||||
|
|
||||||
|
Text(invitedText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var textualContent: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
Text(title)
|
||||||
|
.font(.compound.bodyLGSemibold)
|
||||||
|
.foregroundColor(.compound.textPrimary)
|
||||||
|
.lineLimit(2)
|
||||||
|
|
||||||
|
if let subtitle {
|
||||||
|
Text(subtitle)
|
||||||
|
.font(.compound.bodyMD)
|
||||||
|
.foregroundColor(.compound.textPlaceholder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var buttons: some View {
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Button(L10n.actionDecline) {
|
||||||
|
context.send(viewAction: .declineInvite(roomIdentifier: room.id))
|
||||||
|
}
|
||||||
|
.buttonStyle(.compound(.secondary, size: .medium))
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.invitesScreen.decline)
|
||||||
|
|
||||||
|
Button(L10n.actionAccept) {
|
||||||
|
context.send(viewAction: .acceptInvite(roomIdentifier: room.id))
|
||||||
|
}
|
||||||
|
.buttonStyle(.compound(.primary, size: .medium))
|
||||||
|
.accessibilityIdentifier(A11yIdentifiers.invitesScreen.accept)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var separator: some View {
|
||||||
|
Rectangle()
|
||||||
|
.fill(Color.compound.borderDisabled)
|
||||||
|
.frame(height: 1 / UIScreen.main.scale)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var title: String {
|
||||||
|
room.name
|
||||||
|
}
|
||||||
|
|
||||||
|
private var subtitle: String? {
|
||||||
|
room.isDirect ? room.inviter?.userID : room.canonicalAlias
|
||||||
|
}
|
||||||
|
|
||||||
|
private var attributedInviteText: AttributedString? {
|
||||||
|
guard
|
||||||
|
room.isDirect == false,
|
||||||
|
let inviterName = room.inviter?.displayName,
|
||||||
|
let inviterID = room.inviter?.userID
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = L10n.screenInvitesInvitedYou(inviterName, inviterID)
|
||||||
|
var attributedString = AttributedString(text)
|
||||||
|
attributedString.font = .compound.bodyMD
|
||||||
|
attributedString.foregroundColor = .compound.textPlaceholder
|
||||||
|
if let range = attributedString.range(of: inviterName) {
|
||||||
|
attributedString[range].foregroundColor = .compound.textPrimary
|
||||||
|
attributedString[range].font = .compound.bodyMDSemibold
|
||||||
|
}
|
||||||
|
return attributedString
|
||||||
|
}
|
||||||
|
|
||||||
|
private var badge: some View {
|
||||||
|
Circle()
|
||||||
|
.scaledFrame(size: 12)
|
||||||
|
.foregroundColor(.compound.iconAccentTertiary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HomeScreenInviteCell_Previews: PreviewProvider, TestablePreview {
|
||||||
|
static var previews: some View {
|
||||||
|
ScrollView {
|
||||||
|
VStack(spacing: 0) {
|
||||||
|
HomeScreenInviteCell(room: .dmInvite,
|
||||||
|
context: viewModel().context)
|
||||||
|
|
||||||
|
HomeScreenInviteCell(room: .dmInvite,
|
||||||
|
context: viewModel().context)
|
||||||
|
|
||||||
|
HomeScreenInviteCell(room: .roomInvite(),
|
||||||
|
context: viewModel().context)
|
||||||
|
|
||||||
|
HomeScreenInviteCell(room: .roomInvite(),
|
||||||
|
context: viewModel().context)
|
||||||
|
|
||||||
|
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org", avatarURL: .picturesDirectory),
|
||||||
|
context: viewModel().context)
|
||||||
|
|
||||||
|
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org"),
|
||||||
|
context: viewModel().context)
|
||||||
|
.dynamicTypeSize(.accessibility1)
|
||||||
|
.previewDisplayName("Aliased room (AX1)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func viewModel() -> HomeScreenViewModel {
|
||||||
|
let clientProxy = ClientProxyMock(.init())
|
||||||
|
|
||||||
|
let userSession = MockUserSession(clientProxy: clientProxy,
|
||||||
|
mediaProvider: MockMediaProvider(),
|
||||||
|
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||||
|
|
||||||
|
return HomeScreenViewModel(userSession: userSession,
|
||||||
|
analyticsService: ServiceLocator.shared.analytics,
|
||||||
|
appSettings: ServiceLocator.shared.settings,
|
||||||
|
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||||
|
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private extension HomeScreenRoom {
|
||||||
|
static var dmInvite: HomeScreenRoom {
|
||||||
|
let inviter = RoomMemberProxyMock()
|
||||||
|
inviter.displayName = "Jack"
|
||||||
|
inviter.userID = "@jack:somewhere.com"
|
||||||
|
|
||||||
|
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: inviter,
|
||||||
|
name: "Some Guy",
|
||||||
|
isDirect: true,
|
||||||
|
avatarURL: nil,
|
||||||
|
lastMessage: nil,
|
||||||
|
lastMessageFormattedTimestamp: nil,
|
||||||
|
unreadMessagesCount: 0,
|
||||||
|
unreadMentionsCount: 0,
|
||||||
|
unreadNotificationsCount: 0,
|
||||||
|
notificationMode: nil,
|
||||||
|
canonicalAlias: "#footest:somewhere.org",
|
||||||
|
hasOngoingCall: false,
|
||||||
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
|
|
||||||
|
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func roomInvite(alias: String? = nil, avatarURL: URL? = nil) -> HomeScreenRoom {
|
||||||
|
let inviter = RoomMemberProxyMock()
|
||||||
|
inviter.displayName = "Luca"
|
||||||
|
inviter.userID = "@jack:somewhi.nl"
|
||||||
|
inviter.avatarURL = avatarURL
|
||||||
|
|
||||||
|
let details = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: inviter,
|
||||||
|
name: "Awesome Room",
|
||||||
|
isDirect: false,
|
||||||
|
avatarURL: avatarURL,
|
||||||
|
lastMessage: nil,
|
||||||
|
lastMessageFormattedTimestamp: nil,
|
||||||
|
unreadMessagesCount: 0,
|
||||||
|
unreadMentionsCount: 0,
|
||||||
|
unreadNotificationsCount: 0,
|
||||||
|
notificationMode: nil,
|
||||||
|
canonicalAlias: alias,
|
||||||
|
hasOngoingCall: false,
|
||||||
|
isMarkedUnread: false,
|
||||||
|
isFavourite: false)
|
||||||
|
|
||||||
|
return .init(details: details, invalidated: false, hideUnreadMessagesBadge: false)
|
||||||
|
}
|
||||||
|
}
|
@ -35,10 +35,13 @@ struct HomeScreenRoomList: View {
|
|||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var content: some View {
|
private var content: some View {
|
||||||
ForEach(context.viewState.visibleRooms) { room in
|
ForEach(context.viewState.visibleRooms) { room in
|
||||||
if room.isPlaceholder {
|
switch room.type {
|
||||||
|
case .placeholder:
|
||||||
HomeScreenRoomCell(room: room, context: context, isSelected: false)
|
HomeScreenRoomCell(room: room, context: context, isSelected: false)
|
||||||
.redacted(reason: .placeholder)
|
.redacted(reason: .placeholder)
|
||||||
} else {
|
case .invite:
|
||||||
|
HomeScreenInviteCell(room: room, context: context)
|
||||||
|
case .room:
|
||||||
let isSelected = context.viewState.selectedRoomID == room.id
|
let isSelected = context.viewState.selectedRoomID == room.id
|
||||||
|
|
||||||
HomeScreenRoomCell(room: room, context: context, isSelected: isSelected)
|
HomeScreenRoomCell(room: room, context: context, isSelected: isSelected)
|
||||||
|
@ -181,6 +181,8 @@ private extension InvitesScreenRoomDetails {
|
|||||||
inviter.userID = "@jack:somewhere.com"
|
inviter.userID = "@jack:somewhere.com"
|
||||||
|
|
||||||
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: inviter,
|
||||||
name: "Some Guy",
|
name: "Some Guy",
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -191,7 +193,6 @@ private extension InvitesScreenRoomDetails {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: "#footest:somewhere.org",
|
canonicalAlias: "#footest:somewhere.org",
|
||||||
inviter: inviter,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)
|
isFavourite: false)
|
||||||
@ -205,6 +206,8 @@ private extension InvitesScreenRoomDetails {
|
|||||||
inviter.avatarURL = avatarURL
|
inviter.avatarURL = avatarURL
|
||||||
|
|
||||||
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
let dmRoom = RoomSummaryDetails(id: "@someone:somewhere.com",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: inviter,
|
||||||
name: "Awesome Room",
|
name: "Awesome Room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: avatarURL,
|
avatarURL: avatarURL,
|
||||||
@ -215,7 +218,6 @@ private extension InvitesScreenRoomDetails {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: alias,
|
canonicalAlias: alias,
|
||||||
inviter: inviter,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)
|
isFavourite: false)
|
||||||
|
@ -51,6 +51,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var elementCallBaseURL: URL { get set }
|
var elementCallBaseURL: URL { get set }
|
||||||
var publicSearchEnabled: Bool { get set }
|
var publicSearchEnabled: Bool { get set }
|
||||||
var qrCodeLoginEnabled: Bool { get set }
|
var qrCodeLoginEnabled: Bool { get set }
|
||||||
|
var roomListInvitesEnabled: Bool { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: DeveloperOptionsProtocol { }
|
extension AppSettings: DeveloperOptionsProtocol { }
|
||||||
|
@ -32,16 +32,15 @@ struct DeveloperOptionsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section("Room") {
|
|
||||||
Toggle(isOn: $context.shouldCollapseRoomStateEvents) {
|
|
||||||
Text("Collapse room state events")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Section("Room List") {
|
Section("Room List") {
|
||||||
Toggle(isOn: $context.hideUnreadMessagesBadge) {
|
Toggle(isOn: $context.hideUnreadMessagesBadge) {
|
||||||
Text("Hide grey dots")
|
Text("Hide grey dots")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toggle(isOn: $context.roomListInvitesEnabled) {
|
||||||
|
Text("Room list invites")
|
||||||
|
Text("Requires app reboot and, after disabling the feature, a cache clear.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section("Room Directory Search") {
|
Section("Room Directory Search") {
|
||||||
@ -56,6 +55,12 @@ struct DeveloperOptionsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section("Room") {
|
||||||
|
Toggle(isOn: $context.shouldCollapseRoomStateEvents) {
|
||||||
|
Text("Collapse room state events")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section("Element Call") {
|
Section("Element Call") {
|
||||||
TextField(context.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
TextField(context.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
||||||
.submitLabel(.done)
|
.submitLabel(.done)
|
||||||
|
@ -64,9 +64,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
|||||||
do {
|
do {
|
||||||
var homeserver = LoginHomeserver(address: homeserverAddress, loginMode: .unknown)
|
var homeserver = LoginHomeserver(address: homeserverAddress, loginMode: .unknown)
|
||||||
|
|
||||||
try await Task.dispatch(on: .global()) {
|
try await authenticationService.configureHomeserver(serverNameOrHomeserverUrl: homeserverAddress)
|
||||||
try self.authenticationService.configureHomeserver(serverNameOrHomeserverUrl: homeserverAddress)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let details = authenticationService.homeserverDetails() {
|
if let details = authenticationService.homeserverDetails() {
|
||||||
if details.supportsOidcLogin() {
|
if details.supportsOidcLogin() {
|
||||||
@ -94,9 +92,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
|||||||
|
|
||||||
func urlForOIDCLogin() async -> Result<OIDCAuthenticationDataProxy, AuthenticationServiceError> {
|
func urlForOIDCLogin() async -> Result<OIDCAuthenticationDataProxy, AuthenticationServiceError> {
|
||||||
do {
|
do {
|
||||||
let oidcData = try await Task.dispatch(on: .global()) {
|
let oidcData = try await authenticationService.urlForOidcLogin()
|
||||||
try self.authenticationService.urlForOidcLogin()
|
|
||||||
}
|
|
||||||
return .success(OIDCAuthenticationDataProxy(underlyingData: oidcData))
|
return .success(OIDCAuthenticationDataProxy(underlyingData: oidcData))
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed to get URL for OIDC login: \(error)")
|
MXLog.error("Failed to get URL for OIDC login: \(error)")
|
||||||
@ -106,9 +102,7 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
|||||||
|
|
||||||
func loginWithOIDCCallback(_ callbackURL: URL, data: OIDCAuthenticationDataProxy) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
func loginWithOIDCCallback(_ callbackURL: URL, data: OIDCAuthenticationDataProxy) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
||||||
do {
|
do {
|
||||||
let client = try await Task.dispatch(on: .global()) {
|
let client = try await authenticationService.loginWithOidcCallback(authenticationData: data.underlyingData, callbackUrl: callbackURL.absoluteString)
|
||||||
try self.authenticationService.loginWithOidcCallback(authenticationData: data.underlyingData, callbackUrl: callbackURL.absoluteString)
|
|
||||||
}
|
|
||||||
return await userSession(for: client)
|
return await userSession(for: client)
|
||||||
} catch AuthenticationError.OidcCancelled {
|
} catch AuthenticationError.OidcCancelled {
|
||||||
return .failure(.oidcError(.userCancellation))
|
return .failure(.oidcError(.userCancellation))
|
||||||
@ -120,12 +114,10 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
|||||||
|
|
||||||
func login(username: String, password: String, initialDeviceName: String?, deviceID: String?) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
func login(username: String, password: String, initialDeviceName: String?, deviceID: String?) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
||||||
do {
|
do {
|
||||||
let client = try await Task.dispatch(on: .global()) {
|
let client = try await authenticationService.login(username: username,
|
||||||
try self.authenticationService.login(username: username,
|
password: password,
|
||||||
password: password,
|
initialDeviceName: initialDeviceName,
|
||||||
initialDeviceName: initialDeviceName,
|
deviceId: deviceID)
|
||||||
deviceId: deviceID)
|
|
||||||
}
|
|
||||||
|
|
||||||
let refreshToken = try? await Task.dispatch(on: .global()) {
|
let refreshToken = try? await Task.dispatch(on: .global()) {
|
||||||
try client.session().refreshToken
|
try client.session().refreshToken
|
||||||
|
@ -676,6 +676,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
.syncService()
|
.syncService()
|
||||||
.withCrossProcessLock(appIdentifier: "MainApp")
|
.withCrossProcessLock(appIdentifier: "MainApp")
|
||||||
.withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
.withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
|
||||||
|
.withUnifiedInvitesInRoomList(withUnifiedInvites: appSettings.roomListInvitesEnabled)
|
||||||
.finish()
|
.finish()
|
||||||
let roomListService = syncService.roomListService()
|
let roomListService = syncService.roomListService()
|
||||||
|
|
||||||
|
@ -19,6 +19,10 @@ import MatrixRustSDK
|
|||||||
|
|
||||||
struct RoomSummaryDetails {
|
struct RoomSummaryDetails {
|
||||||
let id: String
|
let id: String
|
||||||
|
|
||||||
|
let isInvite: Bool
|
||||||
|
let inviter: RoomMemberProxyProtocol?
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
let isDirect: Bool
|
let isDirect: Bool
|
||||||
let avatarURL: URL?
|
let avatarURL: URL?
|
||||||
@ -29,7 +33,7 @@ struct RoomSummaryDetails {
|
|||||||
let unreadNotificationsCount: UInt
|
let unreadNotificationsCount: UInt
|
||||||
let notificationMode: RoomNotificationModeProxy?
|
let notificationMode: RoomNotificationModeProxy?
|
||||||
let canonicalAlias: String?
|
let canonicalAlias: String?
|
||||||
let inviter: RoomMemberProxyProtocol?
|
|
||||||
let hasOngoingCall: Bool
|
let hasOngoingCall: Bool
|
||||||
|
|
||||||
let isMarkedUnread: Bool
|
let isMarkedUnread: Bool
|
||||||
@ -70,6 +74,7 @@ extension RoomSummaryDetails {
|
|||||||
inviter = nil
|
inviter = nil
|
||||||
hasOngoingCall = false
|
hasOngoingCall = false
|
||||||
|
|
||||||
|
isInvite = false
|
||||||
isMarkedUnread = false
|
isMarkedUnread = false
|
||||||
isFavourite = false
|
isFavourite = false
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
let notificationMode = roomInfo.userDefinedNotificationMode.flatMap { RoomNotificationModeProxy.from(roomNotificationMode: $0) }
|
let notificationMode = roomInfo.userDefinedNotificationMode.flatMap { RoomNotificationModeProxy.from(roomNotificationMode: $0) }
|
||||||
|
|
||||||
let details = RoomSummaryDetails(id: roomInfo.id,
|
let details = RoomSummaryDetails(id: roomInfo.id,
|
||||||
|
isInvite: roomInfo.membership == .invited,
|
||||||
|
inviter: inviterProxy,
|
||||||
name: roomInfo.name ?? roomInfo.id,
|
name: roomInfo.name ?? roomInfo.id,
|
||||||
isDirect: roomInfo.isDirect,
|
isDirect: roomInfo.isDirect,
|
||||||
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
avatarURL: roomInfo.avatarUrl.flatMap(URL.init(string:)),
|
||||||
@ -250,7 +252,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
unreadNotificationsCount: UInt(roomInfo.numUnreadNotifications),
|
||||||
notificationMode: notificationMode,
|
notificationMode: notificationMode,
|
||||||
canonicalAlias: roomInfo.canonicalAlias,
|
canonicalAlias: roomInfo.canonicalAlias,
|
||||||
inviter: inviterProxy,
|
|
||||||
hasOngoingCall: roomInfo.hasRoomCall,
|
hasOngoingCall: roomInfo.hasRoomCall,
|
||||||
isMarkedUnread: roomInfo.isMarkedUnread,
|
isMarkedUnread: roomInfo.isMarkedUnread,
|
||||||
isFavourite: roomInfo.isFavourite)
|
isFavourite: roomInfo.isFavourite)
|
||||||
|
@ -135,11 +135,12 @@ class UserSessionStore: UserSessionStoreProtocol {
|
|||||||
let completeBuilder = builder
|
let completeBuilder = builder
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let client: Client = try await Task.dispatch(on: .global()) {
|
let client = try await completeBuilder.build()
|
||||||
let client = try completeBuilder.build()
|
|
||||||
|
try await Task.dispatch(on: .global()) {
|
||||||
try client.restoreSession(session: credentials.restorationToken.session)
|
try client.restoreSession(session: credentials.restorationToken.session)
|
||||||
return client
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return await .success(setupProxyForClient(client))
|
return await .success(setupProxyForClient(client))
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed restoring login with error: \(error)")
|
MXLog.error("Failed restoring login with error: \(error)")
|
||||||
|
@ -102,7 +102,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
|||||||
if let existingSession = userSessions[credentials.userID] {
|
if let existingSession = userSessions[credentials.userID] {
|
||||||
userSession = existingSession
|
userSession = existingSession
|
||||||
} else {
|
} else {
|
||||||
userSession = try NSEUserSession(credentials: credentials, clientSessionDelegate: keychainController)
|
userSession = try await NSEUserSession(credentials: credentials, clientSessionDelegate: keychainController)
|
||||||
userSessions[credentials.userID] = userSession
|
userSessions[credentials.userID] = userSession
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ final class NSEUserSession {
|
|||||||
backgroundTaskService: nil)
|
backgroundTaskService: nil)
|
||||||
private let delegateHandle: TaskHandle?
|
private let delegateHandle: TaskHandle?
|
||||||
|
|
||||||
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate) throws {
|
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate) async throws {
|
||||||
userID = credentials.userID
|
userID = credentials.userID
|
||||||
if credentials.restorationToken.passphrase != nil {
|
if credentials.restorationToken.passphrase != nil {
|
||||||
MXLog.info("Restoring client with encrypted store.")
|
MXLog.info("Restoring client with encrypted store.")
|
||||||
@ -47,7 +47,7 @@ final class NSEUserSession {
|
|||||||
clientBuilder = clientBuilder.proxy(url: proxy)
|
clientBuilder = clientBuilder.proxy(url: proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
baseClient = try clientBuilder.build()
|
baseClient = try await clientBuilder.build()
|
||||||
delegateHandle = baseClient.setDelegate(delegate: ClientDelegateWrapper())
|
delegateHandle = baseClient.setDelegate(delegate: ClientDelegateWrapper())
|
||||||
try baseClient.restoreSession(session: credentials.restorationToken.session)
|
try baseClient.restoreSession(session: credentials.restorationToken.session)
|
||||||
|
|
||||||
|
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPad-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPad-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPhone-15-en-GB.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPhone-15-en-GB.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPhone-15-pseudo.1.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/__Snapshots__/PreviewTests/test_homeScreenInviteCell-iPhone-15-pseudo.1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPhone-15-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_roomListFiltersEmptyStateView-iPhone-15-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Incomplete.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Incomplete.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Not-set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Not-set-up.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-en-GB.Set-up.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Incomplete.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Incomplete.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Not-set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Not-set-up.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPad-pseudo.Set-up.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPhone-15-en-GB.Set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPhone-15-en-GB.Set-up.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPhone-15-pseudo.Set-up.png
(Stored with Git LFS)
BIN
PreviewTests/__Snapshots__/PreviewTests/test_secureBackupRecoveryKeyScreen-iPhone-15-pseudo.Set-up.png
(Stored with Git LFS)
Binary file not shown.
@ -31,6 +31,8 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
notificationMode: RoomNotificationModeProxy,
|
notificationMode: RoomNotificationModeProxy,
|
||||||
hasOngoingCall: Bool) {
|
hasOngoingCall: Bool) {
|
||||||
roomSummaryDetails = RoomSummaryDetails(id: "Test room",
|
roomSummaryDetails = RoomSummaryDetails(id: "Test room",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: "Test room",
|
name: "Test room",
|
||||||
isDirect: false,
|
isDirect: false,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -41,7 +43,6 @@ class HomeScreenRoomTests: XCTestCase {
|
|||||||
unreadNotificationsCount: unreadNotificationsCount,
|
unreadNotificationsCount: unreadNotificationsCount,
|
||||||
notificationMode: notificationMode,
|
notificationMode: notificationMode,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: hasOngoingCall,
|
hasOngoingCall: hasOngoingCall,
|
||||||
isMarkedUnread: isMarkedUnread,
|
isMarkedUnread: isMarkedUnread,
|
||||||
isFavourite: false)
|
isFavourite: false)
|
||||||
|
@ -87,6 +87,8 @@ class LoggingTests: XCTestCase {
|
|||||||
let roomName = "Private Conversation"
|
let roomName = "Private Conversation"
|
||||||
let lastMessage = "Secret information"
|
let lastMessage = "Secret information"
|
||||||
let roomSummary = RoomSummaryDetails(id: "myroomid",
|
let roomSummary = RoomSummaryDetails(id: "myroomid",
|
||||||
|
isInvite: false,
|
||||||
|
inviter: nil,
|
||||||
name: roomName,
|
name: roomName,
|
||||||
isDirect: true,
|
isDirect: true,
|
||||||
avatarURL: nil,
|
avatarURL: nil,
|
||||||
@ -97,7 +99,6 @@ class LoggingTests: XCTestCase {
|
|||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
notificationMode: nil,
|
notificationMode: nil,
|
||||||
canonicalAlias: nil,
|
canonicalAlias: nil,
|
||||||
inviter: nil,
|
|
||||||
hasOngoingCall: false,
|
hasOngoingCall: false,
|
||||||
isMarkedUnread: false,
|
isMarkedUnread: false,
|
||||||
isFavourite: false)
|
isFavourite: false)
|
||||||
|
@ -28,7 +28,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
|||||||
func testInitialState() {
|
func testInitialState() {
|
||||||
XCTAssertFalse(state.isFiltering)
|
XCTAssertFalse(state.isFiltering)
|
||||||
XCTAssertEqual(state.activeFilters, [])
|
XCTAssertEqual(state.activeFilters, [])
|
||||||
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases)
|
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases.filter { $0 != .invites })
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSetAndUnsetFilters() {
|
func testSetAndUnsetFilters() {
|
||||||
@ -39,7 +39,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
|||||||
state.deactivateFilter(.unreads)
|
state.deactivateFilter(.unreads)
|
||||||
XCTAssertFalse(state.isFiltering)
|
XCTAssertFalse(state.isFiltering)
|
||||||
XCTAssertEqual(state.activeFilters, [])
|
XCTAssertEqual(state.activeFilters, [])
|
||||||
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases)
|
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases.filter { $0 != .invites })
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMutuallyExclusiveFilters() {
|
func testMutuallyExclusiveFilters() {
|
||||||
@ -51,7 +51,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
|||||||
state.deactivateFilter(.people)
|
state.deactivateFilter(.people)
|
||||||
XCTAssertFalse(state.isFiltering)
|
XCTAssertFalse(state.isFiltering)
|
||||||
XCTAssertEqual(state.activeFilters, [])
|
XCTAssertEqual(state.activeFilters, [])
|
||||||
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases)
|
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases.filter { $0 != .invites })
|
||||||
|
|
||||||
state.activateFilter(.rooms)
|
state.activateFilter(.rooms)
|
||||||
XCTAssertTrue(state.isFiltering)
|
XCTAssertTrue(state.isFiltering)
|
||||||
@ -80,7 +80,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
|||||||
state.clearFilters()
|
state.clearFilters()
|
||||||
XCTAssertFalse(state.isFiltering)
|
XCTAssertFalse(state.isFiltering)
|
||||||
XCTAssertEqual(state.activeFilters, [])
|
XCTAssertEqual(state.activeFilters, [])
|
||||||
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases)
|
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases.filter { $0 != .invites })
|
||||||
}
|
}
|
||||||
|
|
||||||
func testOrder() {
|
func testOrder() {
|
||||||
@ -90,7 +90,7 @@ final class RoomListFiltersStateTests: XCTestCase {
|
|||||||
|
|
||||||
state.deactivateFilter(.favourites)
|
state.deactivateFilter(.favourites)
|
||||||
XCTAssertEqual(state.activeFilters, [])
|
XCTAssertEqual(state.activeFilters, [])
|
||||||
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases)
|
XCTAssertEqual(state.availableFilters, RoomListFilter.allCases.filter { $0 != .invites })
|
||||||
|
|
||||||
state.activateFilter(.rooms)
|
state.activateFilter(.rooms)
|
||||||
XCTAssertEqual(state.activeFilters, [.rooms])
|
XCTAssertEqual(state.activeFilters, [.rooms])
|
||||||
|
@ -48,7 +48,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.1.56
|
exactVersion: 1.1.57
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
|
Loading…
x
Reference in New Issue
Block a user