diff --git a/ElementX/Sources/Other/UserIndicator/UserIndicator.swift b/ElementX/Sources/Other/UserIndicator/UserIndicator.swift index 77c21de1b..8b0aea7ef 100644 --- a/ElementX/Sources/Other/UserIndicator/UserIndicator.swift +++ b/ElementX/Sources/Other/UserIndicator/UserIndicator.swift @@ -33,6 +33,7 @@ struct UserIndicator: Equatable, Identifiable { var id: String = UUID().uuidString var type: UserIndicatorType = .toast var title: String + var message: String? var iconName: String? var persistent = false diff --git a/ElementX/Sources/Other/UserIndicator/UserIndicatorModalView.swift b/ElementX/Sources/Other/UserIndicator/UserIndicatorModalView.swift index 1927a90f1..51a62a975 100644 --- a/ElementX/Sources/Other/UserIndicator/UserIndicatorModalView.swift +++ b/ElementX/Sources/Other/UserIndicator/UserIndicatorModalView.swift @@ -24,11 +24,18 @@ struct UserIndicatorModalView: View { HStack(spacing: 8) { if let iconName = indicator.iconName { Image(systemName: iconName) - .font(.compound.bodyLG) + .font(titleFont) .foregroundColor(.compound.iconPrimary) } + Text(indicator.title) - .font(.compound.bodyLG) + .font(titleFont) + .foregroundColor(.compound.textPrimary) + } + + if let message = indicator.message { + Text(message) + .font(.compound.bodyMD) .foregroundColor(.compound.textPrimary) } } @@ -53,16 +60,23 @@ struct UserIndicatorModalView: View { .ignoresSafeArea() .interactiveDismissDisabled(indicator.interactiveDismissDisabled) } + + private var titleFont: Font { + if indicator.message != nil { + .compound.headingMDBold + } else { + .compound.bodyLG + } + } } struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview { static var previews: some View { - Group { + VStack(spacing: 0) { UserIndicatorModalView(indicator: UserIndicator(type: .modal, title: "Successfully logged in", iconName: "checkmark") ) - .previewDisplayName("Spinner") UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .published(CurrentValueSubject(0.5).asCurrentValuePublisher()), interactiveDismissDisabled: false, @@ -70,7 +84,6 @@ struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview { title: "Successfully logged in", iconName: "checkmark") ) - .previewDisplayName("Progress Bar") UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .none, interactiveDismissDisabled: false, @@ -78,7 +91,12 @@ struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview { title: "Successfully logged in", iconName: "checkmark") ) - .previewDisplayName("No progress") + + UserIndicatorModalView(indicator: UserIndicator(type: .modal, + title: "Successfully logged in", + message: "You can now be happy.", + iconName: "checkmark") + ) } } } diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-en-GB.png deleted file mode 100644 index 1b627d7f8..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d681ba65fbd9d56483b2fd90f87de7a5234cbb5510c22be154093354aabbb8c7 -size 90434 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-pseudo.png deleted file mode 100644 index 1b627d7f8..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPad-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d681ba65fbd9d56483b2fd90f87de7a5234cbb5510c22be154093354aabbb8c7 -size 90434 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-en-GB.png deleted file mode 100644 index c7ee6abca..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71c1e2e09b6212572ca3f443f9bb4ebeb2e4cf2182d818702fd11cb1587db9a0 -size 42593 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-pseudo.png deleted file mode 100644 index c7ee6abca..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.No-progress-iPhone-16-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71c1e2e09b6212572ca3f443f9bb4ebeb2e4cf2182d818702fd11cb1587db9a0 -size 42593 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-en-GB.png deleted file mode 100644 index 9d48066c8..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:46ae1f8079fb0d6fecf0f06c47f61c2f37d014f0d615aab79fd7c75639c5415f -size 91303 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-pseudo.png deleted file mode 100644 index 9d48066c8..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPad-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:46ae1f8079fb0d6fecf0f06c47f61c2f37d014f0d615aab79fd7c75639c5415f -size 91303 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-en-GB.png deleted file mode 100644 index e4e3f8335..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57244d7c4e1affdbd4c25aeca1df48d547cb640a95a0262d45fa1384d6cdc260 -size 42509 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-pseudo.png deleted file mode 100644 index e4e3f8335..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Progress-Bar-iPhone-16-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57244d7c4e1affdbd4c25aeca1df48d547cb640a95a0262d45fa1384d6cdc260 -size 42509 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-en-GB.png deleted file mode 100644 index 963819cbd..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f6a2f85477fa536362b84331e745b5c84853f45cd3d21b74d4cba470aebc75b3 -size 92654 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-pseudo.png deleted file mode 100644 index 963819cbd..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPad-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f6a2f85477fa536362b84331e745b5c84853f45cd3d21b74d4cba470aebc75b3 -size 92654 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-en-GB.png deleted file mode 100644 index 9f6a53683..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-en-GB.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d526453ba493b0723873363408a530c42ae1511dcb9af505f3aaf5a9c1d9953 -size 43297 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-pseudo.png deleted file mode 100644 index 9f6a53683..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.Spinner-iPhone-16-pseudo.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d526453ba493b0723873363408a530c42ae1511dcb9af505f3aaf5a9c1d9953 -size 43297 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-en-GB-0.png new file mode 100644 index 000000000..ca1cc78c5 --- /dev/null +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-en-GB-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:848c3e89b4a3152582fc18b711f4b277e5d03100c5d8425cd7cb1047f15e5b93 +size 150863 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-pseudo-0.png new file mode 100644 index 000000000..ca1cc78c5 --- /dev/null +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPad-pseudo-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:848c3e89b4a3152582fc18b711f4b277e5d03100c5d8425cd7cb1047f15e5b93 +size 150863 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-en-GB-0.png new file mode 100644 index 000000000..68156040a --- /dev/null +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-en-GB-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:470b1e405d1e4da29dfabd05153174d9aa682f9655013b29639f7176991e2d63 +size 87919 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-pseudo-0.png new file mode 100644 index 000000000..68156040a --- /dev/null +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorModalView.iPhone-16-pseudo-0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:470b1e405d1e4da29dfabd05153174d9aa682f9655013b29639f7176991e2d63 +size 87919 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-en-GB-0.png deleted file mode 100644 index 58d6b5632..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-en-GB-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1a1ddb695450412ad2cea3b0109bb944319a3cde7f6b5fa10b5b66e39b484883 -size 98613 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-pseudo-0.png deleted file mode 100644 index 58d6b5632..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPad-pseudo-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1a1ddb695450412ad2cea3b0109bb944319a3cde7f6b5fa10b5b66e39b484883 -size 98613 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-en-GB-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-en-GB-0.png deleted file mode 100644 index 4fa8ed3f4..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-en-GB-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7383c3645e8e3fce81afdd844bcfc2a0b87553e3d980ce0cd559cf37647e996a -size 54716 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-pseudo-0.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-pseudo-0.png deleted file mode 100644 index 4fa8ed3f4..000000000 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/userIndicatorToastView.iPhone-16-pseudo-0.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7383c3645e8e3fce81afdd844bcfc2a0b87553e3d980ce0cd559cf37647e996a -size 54716