mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Update the section order in RoomDetailsScreen to match the latest Figma. (#5653)
Also make sure we snapshot the entire thing.
This commit is contained in:
@@ -25,18 +25,20 @@ struct RoomDetailsScreen: View {
|
||||
// The invitation flow is different for DMs
|
||||
if context.viewState.dmRecipientInfo != nil {
|
||||
inviteToNewRoomSection
|
||||
|
||||
profileSection
|
||||
} else {
|
||||
peopleSection
|
||||
}
|
||||
|
||||
configurationSection
|
||||
|
||||
if context.viewState.dmRecipientInfo == nil {
|
||||
peopleSection
|
||||
}
|
||||
|
||||
securitySection
|
||||
|
||||
if let recipient = context.viewState.dmRecipientInfo?.member {
|
||||
ignoreUserSection(user: recipient)
|
||||
} else if context.viewState.reportRoomEnabled {
|
||||
reportRoomSection
|
||||
}
|
||||
|
||||
leaveRoomSection
|
||||
@@ -171,10 +173,33 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
|
||||
private var inviteToNewRoomSection: some View {
|
||||
ListRow(label: .default(title: L10n.actionInvite, icon: \.userAdd),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapInvite)
|
||||
})
|
||||
Section {
|
||||
ListRow(label: .default(title: L10n.actionInvite, icon: \.userAdd),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapInvite)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private var profileSection: some View {
|
||||
Section {
|
||||
if context.viewState.dmRecipientInfo != nil {
|
||||
let details: ListRowDetails? = switch context.viewState.dmRecipientInfo?.verificationState {
|
||||
case .verified:
|
||||
.icon(CompoundIcon(\.verified).foregroundStyle(.compound.iconSuccessPrimary))
|
||||
case .verificationViolation:
|
||||
.icon(CompoundIcon(\.infoSolid).foregroundStyle(.compound.iconCriticalPrimary))
|
||||
case .notVerified, .none:
|
||||
nil
|
||||
}
|
||||
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsProfileRowTitle, icon: \.userProfile),
|
||||
details: details,
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapRecipientProfile)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var configurationSection: some View {
|
||||
@@ -202,28 +227,6 @@ struct RoomDetailsScreen: View {
|
||||
context.send(viewAction: .processTapSecurityAndPrivacy)
|
||||
})
|
||||
}
|
||||
|
||||
if context.viewState.dmRecipientInfo != nil {
|
||||
switch context.viewState.dmRecipientInfo?.verificationState {
|
||||
case .verified:
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsProfileRowTitle, icon: \.userProfile),
|
||||
details: .icon(CompoundIcon(\.verified).foregroundStyle(.compound.iconSuccessPrimary)),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapRecipientProfile)
|
||||
})
|
||||
case .verificationViolation:
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsProfileRowTitle, icon: \.userProfile),
|
||||
details: .icon(CompoundIcon(\.infoSolid).foregroundStyle(.compound.iconCriticalPrimary)),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapRecipientProfile)
|
||||
})
|
||||
default:
|
||||
ListRow(label: .default(title: L10n.screenRoomDetailsProfileRowTitle, icon: \.userProfile),
|
||||
kind: .navigationLink {
|
||||
context.send(viewAction: .processTapRecipientProfile)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,21 +296,6 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var leaveRoomSection: some View {
|
||||
Section {
|
||||
if context.viewState.reportRoomEnabled {
|
||||
ListRow(label: .action(title: L10n.actionReportRoom,
|
||||
icon: \.chatProblem,
|
||||
role: .destructive),
|
||||
kind: .button { context.send(viewAction: .processTapReport) })
|
||||
}
|
||||
ListRow(label: .action(title: L10n.screenRoomDetailsLeaveRoomTitle,
|
||||
icon: \.leave,
|
||||
role: .destructive),
|
||||
kind: .button { context.send(viewAction: .processTapLeave) })
|
||||
}
|
||||
}
|
||||
|
||||
private func ignoreUserSection(user: RoomMemberDetails) -> some View {
|
||||
Section {
|
||||
ListRow(label: .default(title: user.isIgnored ? L10n.screenDmDetailsUnblockUser : L10n.screenDmDetailsBlockUser,
|
||||
@@ -321,6 +309,26 @@ struct RoomDetailsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var reportRoomSection: some View {
|
||||
Section {
|
||||
if context.viewState.reportRoomEnabled {
|
||||
ListRow(label: .action(title: L10n.actionReportRoom,
|
||||
icon: \.chatProblem,
|
||||
role: .destructive),
|
||||
kind: .button { context.send(viewAction: .processTapReport) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var leaveRoomSection: some View {
|
||||
Section {
|
||||
ListRow(label: .action(title: L10n.screenRoomDetailsLeaveRoomTitle,
|
||||
icon: \.leave,
|
||||
role: .destructive),
|
||||
kind: .button { context.send(viewAction: .processTapLeave) })
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func leaveRoomAlertActions(_ item: LeaveRoomAlertItem) -> some View {
|
||||
Button(item.cancelTitle, role: .cancel) { }
|
||||
@@ -363,26 +371,38 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
RoomDetailsScreen(context: genericJoinedRoomViewModel.context)
|
||||
.snapshotPreferences(expect: genericJoinedRoomViewModel.context.observe(\.viewState.permalink).map { $0 != nil })
|
||||
.previewDisplayName("Generic Room - Joined History Visibility")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1400)
|
||||
|
||||
RoomDetailsScreen(context: genericWorldReadableRoomViewModel.context)
|
||||
.snapshotPreferences(expect: genericWorldReadableRoomViewModel.context.observe(\.viewState.permalink).map { $0 != nil })
|
||||
.previewDisplayName("Generic Room - World Readable History Visibility")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1400)
|
||||
|
||||
RoomDetailsScreen(context: simpleRoomViewModel.context)
|
||||
.snapshotPreferences(expect: simpleRoomViewModel.context.observe(\.viewState.permalink).map { $0 != nil })
|
||||
.previewDisplayName("Simple Room")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1200)
|
||||
|
||||
RoomDetailsScreen(context: dmRoomViewModel.context)
|
||||
.snapshotPreferences(expect: dmRoomViewModel.context.observe(\.viewState.accountOwner).map { $0 != nil })
|
||||
.previewDisplayName("DM Room")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1350)
|
||||
|
||||
RoomDetailsScreen(context: dmRoomVerifiedViewModel.context)
|
||||
.snapshotPreferences(expect: dmRoomVerifiedViewModel.context.observe(\.viewState.dmRecipientInfo?.verificationState).map { $0 == .verified })
|
||||
.previewDisplayName("DM Room Verified")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1350)
|
||||
|
||||
RoomDetailsScreen(context: dmRoomVerificationViolationViewModel.context)
|
||||
.snapshotPreferences(expect: dmRoomVerificationViolationViewModel.context.observe(\.viewState.accountOwner).map { $0 != nil })
|
||||
.previewDisplayName("DM Room Verification Violation")
|
||||
.previewLayout(.sizeThatFits)
|
||||
.frame(height: 1350)
|
||||
}
|
||||
|
||||
private static func makeGenericRoomViewModel(historyVisibility: RoomHistoryVisibility) -> RoomDetailsScreenViewModel {
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6bcc46e5933065a1b02dff5c2bf8abc09c626cf6adb6b91acca6c0d27bf8d967
|
||||
size 236706
|
||||
oid sha256:8b14155e85a7cc54bc8a725bdf8c3749855481f2e397a33cbabde31f78cbf803
|
||||
size 342957
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f892f94486579fcebfdb3bd5723c233130b10fdabbadac17f687fcedab365085
|
||||
size 244369
|
||||
oid sha256:32e461c7bc625460e2e1a7f4ebd9e8bfef15c75a1bb7a2d43017539197a8f6b8
|
||||
size 364892
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ebb51488b9ce71449d0f8ee04bba5f260f924c61186b41c0d6fe8903b06de6b9
|
||||
size 174363
|
||||
oid sha256:a913d2c96b1588b1f4d23e2a1b969b0e6eb4ba69e0c8ecd325ab58c204843cfc
|
||||
size 256133
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f87dbe6bdd53d79ef618cb86707360df944aeb0ad5916f64a9826eaae400e2b0
|
||||
size 185369
|
||||
oid sha256:385ab1f7d46d2802af3e1355c27c9a508ad5a25c8adfa1fe24a5b82f9f2ecb5f
|
||||
size 289887
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6bcc46e5933065a1b02dff5c2bf8abc09c626cf6adb6b91acca6c0d27bf8d967
|
||||
size 236706
|
||||
oid sha256:85c2832e61b1bd00d79590e9e1ef1e4a5771471f626b18639b7c36766913aedc
|
||||
size 343049
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f892f94486579fcebfdb3bd5723c233130b10fdabbadac17f687fcedab365085
|
||||
size 244369
|
||||
oid sha256:7e0c06901f35f99c5b9258d75541534063b81ed63c07117edee7fe74191026f6
|
||||
size 364976
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ebb51488b9ce71449d0f8ee04bba5f260f924c61186b41c0d6fe8903b06de6b9
|
||||
size 174363
|
||||
oid sha256:6ac686f08264fe86397a14376c6fb72c91c3b7a0aa45a2b239888f9eb79c7b46
|
||||
size 256227
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f87dbe6bdd53d79ef618cb86707360df944aeb0ad5916f64a9826eaae400e2b0
|
||||
size 185369
|
||||
oid sha256:292423ef85a07295833d543e81a8dd070fc1bf998bc60b140e3d7fcb0ba796ec
|
||||
size 289962
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6bcc46e5933065a1b02dff5c2bf8abc09c626cf6adb6b91acca6c0d27bf8d967
|
||||
size 236706
|
||||
oid sha256:2cad77eb980232b8545beb5aa7c642dae663d4a865e207fc202f76275007d8a9
|
||||
size 341896
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f892f94486579fcebfdb3bd5723c233130b10fdabbadac17f687fcedab365085
|
||||
size 244369
|
||||
oid sha256:7b2a0a7f4765f076201a3c316979860764a59f582d911e131149eaf1972ac035
|
||||
size 363985
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ebb51488b9ce71449d0f8ee04bba5f260f924c61186b41c0d6fe8903b06de6b9
|
||||
size 174363
|
||||
oid sha256:a69215f91b5f1847e2a49d36d481e5c320c1a335a1e022e98e44e5e6076ce7ae
|
||||
size 255336
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f87dbe6bdd53d79ef618cb86707360df944aeb0ad5916f64a9826eaae400e2b0
|
||||
size 185369
|
||||
oid sha256:850094cadb99651cb0961f7e5b17ff8e3292d3317387e47cba9d9f78f946de38
|
||||
size 289139
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9fc594844aca516b3cb8eb67f7a951f92391cc57acb594712847de3a6eabb12
|
||||
size 173968
|
||||
oid sha256:9a6a34174e034efdf652f2bf11c45d9212ca0b4a1cb7c554373ef5e4763e1f3e
|
||||
size 286690
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8ce07690f3417273d141fd68dbe0fead5d3fb6c8db60fcdb19b31f2d6106381e
|
||||
size 183259
|
||||
oid sha256:db87488dec81d25929aa12f27f53938a2e90e3ca8aeaa2cf79cfdd433f9473e8
|
||||
size 314703
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa42b98af47e9bd9a6f795d6db5b02942135f337d756f4f5299136a8b879d1df
|
||||
size 111455
|
||||
oid sha256:c858ecd5a8a5673b52b80bf89aa2ff0b0fe7f808c110086463821b9552b93512
|
||||
size 190378
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7a439438ee7fbaf43994e90b6178d20828630900381a9d9191386079a1e4c9a3
|
||||
size 117682
|
||||
oid sha256:2f6f666272889a37462c6f75c95fb39c76d3ec77e153b090e5dab869a3ee599a
|
||||
size 218998
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f6627c8721d7195ef8f5ad95b5244a3cf9ffd612daf9a24acdb6d6c7a08c0dd4
|
||||
size 172990
|
||||
oid sha256:c86e11787cb3088824e4c0fcad83f2603255d8a06a01b195ceea009bd77b3b7a
|
||||
size 285627
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b18096c132b604c2cd9e3f267f5b9bda919817c72bdd19b1f5161f04037c472e
|
||||
size 181127
|
||||
oid sha256:77fef29e3ec16bbb055b62bf89b75c57787d16e6dbbb33f19b5c48c31cd731cb
|
||||
size 312342
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:93d9c3ab04d41c58dae8e86a578dc43323c5dd9fa726eb9d1a8fef760c649eb4
|
||||
size 110101
|
||||
oid sha256:3bb46878ab087ff47a2feca5f0e4de5e41c3f3ca9997a1eff821d87ce76d9bbf
|
||||
size 189621
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:831525144ba59762b8af4a66bf75a5fee529a0b320a9fbae8d43bd78e5dab67a
|
||||
size 114746
|
||||
oid sha256:94d729ac1691766d058a2e01f8b6fef29e74094a16a1608bd91c190f840276df
|
||||
size 221014
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:55de7743388afee5766c4e09863b665d35b2ebab0aa2a29ef5ddb2320be6128e
|
||||
size 141887
|
||||
oid sha256:ea745146a6ee9a9f7e37386170949dc782236a31a94e39b29b165d07b8572b8c
|
||||
size 207409
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:00adafe48e2eacdefbf20ad88f16a9b042f47086771f97a6191ad3560f69ba94
|
||||
size 150994
|
||||
oid sha256:3c235c804882a22a8b18417aadc073ba6958dbcf510c0e91f40e00218e0a67a1
|
||||
size 221696
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:666881f02873f1b08dc11d4b579a0b32bea32b3f0d917940ba2743d06f3af7ac
|
||||
size 89659
|
||||
oid sha256:92317c42a2fdc1b49b488cfa9a17d97f6b2ddbf920f3f1db75e17c3bba9678b0
|
||||
size 131127
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5206a8ac32a1fa1e74b6b0b9241dcd8f52a0f285e01370490745d88f87446b3d
|
||||
size 103136
|
||||
oid sha256:c2f7c4f11656197f05aedf1b88819ae4cd39bc2f72d9a97cbdf9d37519f67e02
|
||||
size 155949
|
||||
|
||||
Reference in New Issue
Block a user