From fa005f9b11a7ee060a82314b86e24df6357ca7db Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 14 Jul 2023 13:34:59 +0100 Subject: [PATCH 1/4] Use compound in Room Details screen. --- DesignKit/Package.swift | 2 +- ElementX.xcodeproj/project.pbxproj | 28 +++++--- .../xcshareddata/swiftpm/Package.resolved | 2 +- .../SwiftUI/Views/AvatarHeaderView.swift | 24 ++++--- .../View/RoomDetailsScreen.swift | 72 +++++++++++-------- project.yml | 2 +- 6 files changed, 78 insertions(+), 52 deletions(-) diff --git a/DesignKit/Package.swift b/DesignKit/Package.swift index b941ba7917..5ca6a5a68b 100644 --- a/DesignKit/Package.swift +++ b/DesignKit/Package.swift @@ -12,7 +12,7 @@ let package = Package( .library(name: "DesignKit", targets: ["DesignKit"]) ], dependencies: [ - .package(url: "https://github.com/vector-im/compound-ios.git", revision: "29233e1c95a17372d5e5afe689c31680bb07b1ea"), + .package(url: "https://github.com/vector-im/compound-ios.git", revision: "a750f299082c6a655633e0ede86beea5748da336"), .package(url: "https://github.com/vector-im/element-design-tokens.git", exact: "0.0.3"), .package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.9.0") ], diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index d20a1160bf..13b624817b 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -857,7 +857,7 @@ 127C8472672A5BA09EF1ACF8 /* CurrentValuePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentValuePublisher.swift; sourceTree = ""; }; 12EDAFB64FA5F6812D54F39A /* MigrationScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationScreenViewModel.swift; sourceTree = ""; }; 12F1E7F9C2BE8BB751037826 /* WaitlistScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenCoordinator.swift; sourceTree = ""; }; - 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = ""; }; + 1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = ""; }; 130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = ""; }; 13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; 1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = ""; }; @@ -998,7 +998,7 @@ 47111410B6E659A697D472B5 /* RoomProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProxyProtocol.swift; sourceTree = ""; }; 471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineView.swift; sourceTree = ""; }; 47873756E45B46683D97DC32 /* LegalInformationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreenModels.swift; sourceTree = ""; }; - 478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; path = DesignKit; sourceTree = SOURCE_ROOT; }; + 478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DesignKit; path = DesignKit; sourceTree = SOURCE_ROOT; }; 4798B3B7A1E8AE3901CEE8C6 /* FramePreferenceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FramePreferenceKey.swift; sourceTree = ""; }; 47EBB5D698CE9A25BB553A2D /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = ""; }; 47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModel.swift; sourceTree = ""; }; @@ -1011,7 +1011,7 @@ 4B41FABA2B0AEF4389986495 /* LoginMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginMode.swift; sourceTree = ""; }; 4B5046BB295AEAFA6FB81655 /* SessionVerificationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenModels.swift; sourceTree = ""; }; 4BD371B60E07A5324B9507EF /* AnalyticsSettingsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsSettingsScreenCoordinator.swift; sourceTree = ""; }; - 4CD6AC7546E8D7E5C73CEA48 /* ElementX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ElementX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4CD6AC7546E8D7E5C73CEA48 /* ElementX.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = ElementX.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CDDDDD9FE1A699D23A5E096 /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = ""; }; 4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenUITests.swift; sourceTree = ""; }; 4E2245243369B99216C7D84E /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = ""; }; @@ -1174,7 +1174,7 @@ 8D55702474F279D910D2D162 /* RoomStateEventStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateEventStringBuilder.swift; sourceTree = ""; }; 8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = ""; }; 8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = ""; }; - 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = ""; }; + 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = ""; }; 8E1BBA73B611EDEEA6E20E05 /* InvitesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenModels.swift; sourceTree = ""; }; 8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenUITests.swift; sourceTree = ""; }; 8F21ED7205048668BEB44A38 /* AppActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppActivityView.swift; sourceTree = ""; }; @@ -1284,7 +1284,7 @@ B4CFE236419E830E8946639C /* Analytics+SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Analytics+SwiftUI.swift"; sourceTree = ""; }; B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = ""; }; B5B243E7818E5E9F6A4EDC7A /* NoticeRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineView.swift; sourceTree = ""; }; - B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = ""; }; + B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = ""; }; B6311F21F911E23BE4DF51B4 /* ReadMarkerRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineView.swift; sourceTree = ""; }; B697816AF93DA06EC58C5D70 /* WaitlistScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitlistScreenViewModelProtocol.swift; sourceTree = ""; }; B6E89E530A8E92EC44301CA1 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = ""; }; @@ -1364,7 +1364,7 @@ CD6B0C4639E066915B5E6463 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = ""; }; CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = ""; }; CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = ""; }; - CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = ""; }; + CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = ""; }; CF48AF076424DBC1615C74AD /* AuthenticationServiceProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxy.swift; sourceTree = ""; }; D0140615D2232612C813FD6C /* EncryptedHistoryRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedHistoryRoomTimelineItem.swift; sourceTree = ""; }; D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = ""; }; @@ -1436,7 +1436,7 @@ ECF79FB25E2D4BD6F50CE7C9 /* RoomMembersListScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListScreenViewModel.swift; sourceTree = ""; }; ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = ""; }; ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = ""; }; - ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = ""; }; + ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = ""; }; ED983D4DCA5AFA6E1ED96099 /* StateRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineView.swift; sourceTree = ""; }; EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = ""; }; EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = ""; }; @@ -1450,7 +1450,7 @@ F174A5627CDB3CAF280D1880 /* EmojiPickerScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerScreenModels.swift; sourceTree = ""; }; F17EFA1D3D09FC2F9C5E1CB2 /* MediaProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaProvider.swift; sourceTree = ""; }; F1B8500C152BC59445647DA8 /* UnsupportedRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsupportedRoomTimelineItem.swift; sourceTree = ""; }; - F2D513D2477B57F90E98EEC0 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = portrait_test_video.mp4; sourceTree = ""; }; + F2D513D2477B57F90E98EEC0 /* portrait_test_video.mp4 */ = {isa = PBXFileReference; path = portrait_test_video.mp4; sourceTree = ""; }; F31F59030205A6F65B057E1A /* MatrixEntityRegexTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatrixEntityRegexTests.swift; sourceTree = ""; }; F348B5F2C12F9D4F4B4D3884 /* VideoRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoRoomTimelineItem.swift; sourceTree = ""; }; F36C0A6D59717193F49EA986 /* UserSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSessionTests.swift; sourceTree = ""; }; @@ -3624,6 +3624,14 @@ path = Timeline; sourceTree = ""; }; + "TEMP_3CC1686C-64CF-41C9-9090-B93E7FC08662" /* element-x-ios */ = { + isa = PBXGroup; + children = ( + 41553551C55AD59885840F0E /* secrets.xcconfig */, + ); + path = "element-x-ios"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -5343,7 +5351,7 @@ repositoryURL = "https://github.com/vector-im/compound-ios"; requirement = { kind = revision; - revision = 29233e1c95a17372d5e5afe689c31680bb07b1ea; + revision = a750f299082c6a655633e0ede86beea5748da336; }; }; 9A472EE0218FE7DCF5283429 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 680c906068..9501956ec6 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -13,7 +13,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vector-im/compound-ios", "state" : { - "revision" : "29233e1c95a17372d5e5afe689c31680bb07b1ea" + "revision" : "a750f299082c6a655633e0ede86beea5748da336" } }, { diff --git a/ElementX/Sources/Other/SwiftUI/Views/AvatarHeaderView.swift b/ElementX/Sources/Other/SwiftUI/Views/AvatarHeaderView.swift index 0330d20437..3ac27eb502 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/AvatarHeaderView.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/AvatarHeaderView.swift @@ -54,19 +54,21 @@ struct AvatarHeaderView: View { struct HeaderView_Previews: PreviewProvider { static var previews: some View { - AvatarHeaderView(avatarUrl: URL.picturesDirectory, - name: "Test", - id: "test", - avatarSize: .room(on: .details), - imageProvider: MockMediaProvider(), - subtitle: "test") { - HStack(spacing: 32) { - ShareLink(item: "test") { - Image(systemName: "square.and.arrow.up") + Form { + AvatarHeaderView(avatarUrl: URL.picturesDirectory, + name: "Test Room", + id: "test", + avatarSize: .room(on: .details), + imageProvider: MockMediaProvider(), + subtitle: "#test:matrix.org") { + HStack(spacing: 32) { + ShareLink(item: "test") { + Image(systemName: "square.and.arrow.up") + } + .buttonStyle(FormActionButtonStyle(title: "Test")) } - .buttonStyle(FormActionButtonStyle(title: "Test")) + .padding(.top, 32) } - .padding(.top, 32) } } } diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift index 328313ed78..389fdea1ce 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift @@ -68,8 +68,7 @@ struct RoomDetailsScreen: View { } // MARK: - Private - - @ViewBuilder + private var normalRoomHeaderSection: some View { AvatarHeaderView(avatarUrl: context.viewState.avatarURL, name: context.viewState.title, @@ -83,8 +82,7 @@ struct RoomDetailsScreen: View { } .accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.avatar) } - - @ViewBuilder + private func dmHeaderSection(recipient: RoomMemberDetails) -> some View { AvatarHeaderView(avatarUrl: recipient.avatarURL, name: recipient.name, @@ -132,9 +130,8 @@ struct RoomDetailsScreen: View { context.send(viewAction: .processTapAddTopic) } label: { Text(L10n.screenRoomDetailsAddTopicTitle) - .foregroundColor(.compound.textPrimary) - .font(.compound.bodyLG) } + .buttonStyle(.compoundForm()) .accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.addTopic) } } header: { @@ -152,8 +149,6 @@ struct RoomDetailsScreen: View { } label: { LabeledContent { Text(String(context.viewState.joinedMembersCount)) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodyLG) } label: { Label(L10n.commonPeople, systemImage: "person") } @@ -169,9 +164,8 @@ struct RoomDetailsScreen: View { .accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.invite) } } - .buttonStyle(FormButtonStyle(accessory: .navigationLink)) + .buttonStyle(.compoundForm(accessory: .navigationLink)) .compoundFormSection() - .foregroundColor(.compound.textPrimary) } @ViewBuilder @@ -187,8 +181,6 @@ struct RoomDetailsScreen: View { Image(systemName: "exclamationmark.circle") } else { Text(context.viewState.notificationSettingsState.label) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodyLG) } } label: { Label(L10n.screenRoomDetailsNotificationTitle, systemImage: "bell") @@ -196,9 +188,7 @@ struct RoomDetailsScreen: View { } .accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.notifications) } - .listRowSeparatorTint(.compound.borderDisabled) - .buttonStyle(FormButtonStyle(accessory: context.viewState.notificationSettingsState.isLoaded ? .navigationLink : nil)) - .foregroundColor(.compound.textPrimary) + .buttonStyle(.compoundForm(accessory: context.viewState.notificationSettingsState.isLoaded ? .navigationLink : nil)) .disabled(context.viewState.notificationSettingsState.isLoading) } @@ -222,16 +212,12 @@ struct RoomDetailsScreen: View { if context.viewState.isEncrypted { Section { Label { - VStack(alignment: .leading, spacing: 2) { - Text(L10n.screenRoomDetailsEncryptionEnabledTitle) - Text(L10n.screenRoomDetailsEncryptionEnabledSubtitle) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodySM) - } + Text(L10n.screenRoomDetailsEncryptionEnabledTitle) } icon: { Image(systemName: "lock.shield") } - .labelStyle(FormRowLabelStyle(alignment: .top)) + .labelStyle(.compoundFormRow(secondaryText: L10n.screenRoomDetailsEncryptionEnabledSubtitle, + alignment: .top)) } header: { Text(L10n.commonSecurity) .compoundFormSectionHeader() @@ -247,21 +233,26 @@ struct RoomDetailsScreen: View { } label: { Label(L10n.actionLeaveRoom, systemImage: "door.right.hand.open") } - .buttonStyle(FormButtonStyle(accessory: nil)) + .buttonStyle(.compoundForm()) } .compoundFormSection() } - - @ViewBuilder + private func ignoreUserSection(user: RoomMemberDetails) -> some View { Section { Button(role: user.isIgnored ? nil : .destructive) { context.send(viewAction: user.isIgnored ? .processTapUnignore : .processTapIgnore) } label: { - Label(user.isIgnored ? L10n.screenDmDetailsUnblockUser : L10n.screenDmDetailsBlockUser, - systemImage: "slash.circle") + LabeledContent { + if context.viewState.isProcessingIgnoreRequest { + ProgressView() + } + } label: { + Label(user.isIgnored ? L10n.screenDmDetailsUnblockUser : L10n.screenDmDetailsBlockUser, + systemImage: "slash.circle") + } } - .buttonStyle(FormButtonStyle(accessory: context.viewState.isProcessingIgnoreRequest ? .progressView : nil)) + .buttonStyle(.compoundForm()) .disabled(context.viewState.isProcessingIgnoreRequest) } .compoundFormSection() @@ -313,6 +304,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider { notificationSettingsProxyMockConfiguration.roomMode.isDefault = false let notificationSettingsProxy = NotificationSettingsProxyMock(with: notificationSettingsProxyMockConfiguration) let appSettings = AppSettings() + appSettings.notificationSettingsEnabled = true return RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com", roomProxy: roomProxy, @@ -333,6 +325,28 @@ struct RoomDetailsScreen_Previews: PreviewProvider { isDirect: true, isEncrypted: true, canonicalAlias: "#alias:domain.com", + members: members, + activeMembersCount: 2)) + let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init()) + let appSettings = AppSettings() + + return RoomDetailsScreenViewModel(accountUserID: "@owner:somewhere.com", + roomProxy: roomProxy, + mediaProvider: MockMediaProvider(), + userIndicatorController: ServiceLocator.shared.userIndicatorController, + notificationSettingsProxy: notificationSettingsProxy, + appSettings: appSettings) + }() + + static let simpleRoomViewModel = { + let members: [RoomMemberProxyMock] = [ + .mockAlice, + .mockBob, + .mockCharlie + ] + let roomProxy = RoomProxyMock(with: .init(displayName: "Room A", + isDirect: false, + isEncrypted: false, members: members)) let notificationSettingsProxy = NotificationSettingsProxyMock(with: .init()) let appSettings = AppSettings() @@ -350,5 +364,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider { .previewDisplayName("Generic Room") RoomDetailsScreen(context: dmRoomViewModel.context) .previewDisplayName("DM Room") + RoomDetailsScreen(context: simpleRoomViewModel.context) + .previewDisplayName("Simple Room") } } diff --git a/project.yml b/project.yml index c9e97455f4..df10cde44b 100644 --- a/project.yml +++ b/project.yml @@ -54,7 +54,7 @@ packages: minorVersion: 5.13.0 Compound: url: https://github.com/vector-im/compound-ios - revision: 29233e1c95a17372d5e5afe689c31680bb07b1ea + revision: a750f299082c6a655633e0ede86beea5748da336 # path: ../compound-ios Algorithms: url: https://github.com/apple/swift-algorithms From 3d86c7f9f12ea7284da96f558dc4e073c66acae7 Mon Sep 17 00:00:00 2001 From: Doug Date: Thu, 20 Jul 2023 11:31:39 +0100 Subject: [PATCH 2/4] Update some button styles and placeholder screen usages. --- ElementX/Sources/Application/AppCoordinator.swift | 2 +- .../Other/SwiftUI/Form Styles/FormButtonStyles.swift | 10 ++++++++-- UnitTests/Sources/RoomFlowCoordinatorTests.swift | 2 +- UnitTests/Sources/UserIndicatorControllerTests.swift | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 77b6cbd463..7667195e2d 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -503,7 +503,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, showLoadingIndicator() - navigationRootCoordinator.setRootCoordinator(SplashScreenCoordinator()) + navigationRootCoordinator.setRootCoordinator(PlaceholderScreenCoordinator()) stopSync() userSessionFlowCoordinator?.stop() diff --git a/ElementX/Sources/Other/SwiftUI/Form Styles/FormButtonStyles.swift b/ElementX/Sources/Other/SwiftUI/Form Styles/FormButtonStyles.swift index 4872b48633..a11d6e8a7c 100644 --- a/ElementX/Sources/Other/SwiftUI/Form Styles/FormButtonStyles.swift +++ b/ElementX/Sources/Other/SwiftUI/Form Styles/FormButtonStyles.swift @@ -152,15 +152,21 @@ struct FormButtonStyles_Previews: PreviewProvider { } .buttonStyle(FormButtonStyle()) + Button { } label: { + Label("Block user", systemImage: "circle.slash") + } + .buttonStyle(FormButtonStyle(accessory: .progressView)) + .disabled(true) + Button { } label: { Label("Show something", systemImage: "rectangle.portrait") } .buttonStyle(FormButtonStyle(accessory: .navigationLink)) Button(role: .destructive) { } label: { - Label("Show destruction", systemImage: "rectangle.portrait") + Label("Destroy", systemImage: "trash") } - .buttonStyle(FormButtonStyle(accessory: .navigationLink)) + .buttonStyle(FormButtonStyle()) ShareLink(item: "test") .buttonStyle(FormButtonStyle()) diff --git a/UnitTests/Sources/RoomFlowCoordinatorTests.swift b/UnitTests/Sources/RoomFlowCoordinatorTests.swift index 05eba3428c..9d27dac9cf 100644 --- a/UnitTests/Sources/RoomFlowCoordinatorTests.swift +++ b/UnitTests/Sources/RoomFlowCoordinatorTests.swift @@ -30,7 +30,7 @@ class RoomFlowCoordinatorTests: XCTestCase { let mediaProvider = MockMediaProvider() let userSession = MockUserSession(clientProxy: clientProxy, mediaProvider: mediaProvider) - let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: SplashScreenCoordinator()) + let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator()) navigationStackCoordinator = NavigationStackCoordinator() navigationSplitCoordinator.setDetailCoordinator(navigationStackCoordinator) diff --git a/UnitTests/Sources/UserIndicatorControllerTests.swift b/UnitTests/Sources/UserIndicatorControllerTests.swift index 24a830bbbf..7f2111eff5 100644 --- a/UnitTests/Sources/UserIndicatorControllerTests.swift +++ b/UnitTests/Sources/UserIndicatorControllerTests.swift @@ -25,7 +25,7 @@ class UserIndicatorControllerTests: XCTestCase { private var indicatorController: UserIndicatorController! override func setUp() { - indicatorController = UserIndicatorController(rootCoordinator: SplashScreenCoordinator()) + indicatorController = UserIndicatorController(rootCoordinator: PlaceholderScreenCoordinator()) } func testIndicatorQueueing() { From 03dd5660fd7aaa1af0af3e041cc8724528ea7a40 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 21 Jul 2023 12:19:09 +0100 Subject: [PATCH 3/4] Add compound style for topic. --- DesignKit/Package.swift | 2 +- ElementX.xcodeproj/project.pbxproj | 4 ++-- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 2 +- .../Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift | 3 +-- project.yml | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DesignKit/Package.swift b/DesignKit/Package.swift index 5ca6a5a68b..2bac0afcbe 100644 --- a/DesignKit/Package.swift +++ b/DesignKit/Package.swift @@ -12,7 +12,7 @@ let package = Package( .library(name: "DesignKit", targets: ["DesignKit"]) ], dependencies: [ - .package(url: "https://github.com/vector-im/compound-ios.git", revision: "a750f299082c6a655633e0ede86beea5748da336"), + .package(url: "https://github.com/vector-im/compound-ios.git", revision: "d9e119fbef20857eb790dd4aafbe16ff46011eca"), .package(url: "https://github.com/vector-im/element-design-tokens.git", exact: "0.0.3"), .package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.9.0") ], diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 13b624817b..e6a1395622 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3624,7 +3624,7 @@ path = Timeline; sourceTree = ""; }; - "TEMP_3CC1686C-64CF-41C9-9090-B93E7FC08662" /* element-x-ios */ = { + "TEMP_57725DF7-D55D-4DB9-8946-6ECB4F3AFE33" /* element-x-ios */ = { isa = PBXGroup; children = ( 41553551C55AD59885840F0E /* secrets.xcconfig */, @@ -5351,7 +5351,7 @@ repositoryURL = "https://github.com/vector-im/compound-ios"; requirement = { kind = revision; - revision = a750f299082c6a655633e0ede86beea5748da336; + revision = d9e119fbef20857eb790dd4aafbe16ff46011eca; }; }; 9A472EE0218FE7DCF5283429 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9501956ec6..19a5f52835 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -13,7 +13,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vector-im/compound-ios", "state" : { - "revision" : "a750f299082c6a655633e0ede86beea5748da336" + "revision" : "d9e119fbef20857eb790dd4aafbe16ff46011eca" } }, { diff --git a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift index 389fdea1ce..dee3c0f772 100644 --- a/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift +++ b/ElementX/Sources/Screens/RoomDetailsScreen/View/RoomDetailsScreen.swift @@ -121,8 +121,7 @@ struct RoomDetailsScreen: View { Section { if let topic = context.viewState.topic, !topic.isEmpty { Text(topic) - .foregroundColor(.compound.textSecondary) - .font(.compound.bodyMD) + .compoundFormSecondaryTextRow() .lineLimit(isTopicExpanded ? nil : 3) .onTapGesture { isTopicExpanded.toggle() } } else { diff --git a/project.yml b/project.yml index df10cde44b..9ff219b1d2 100644 --- a/project.yml +++ b/project.yml @@ -54,7 +54,7 @@ packages: minorVersion: 5.13.0 Compound: url: https://github.com/vector-im/compound-ios - revision: a750f299082c6a655633e0ede86beea5748da336 + revision: d9e119fbef20857eb790dd4aafbe16ff46011eca # path: ../compound-ios Algorithms: url: https://github.com/apple/swift-algorithms From 0d04e758036c79a604ad30bd8ba405bb9b9e7992 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 21 Jul 2023 12:24:05 +0100 Subject: [PATCH 4/4] Changelog --- changelog.d/pr-1369.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-1369.change diff --git a/changelog.d/pr-1369.change b/changelog.d/pr-1369.change new file mode 100644 index 0000000000..54b6be8f36 --- /dev/null +++ b/changelog.d/pr-1369.change @@ -0,0 +1 @@ +Update Room Details to use compound styles everywhere. \ No newline at end of file