mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add a message property to user indicator's and have it be rendered properly on modal indicator.s
This commit is contained in:
committed by
Stefan Ceriu
parent
d4506ef79c
commit
72b99d89dd
@@ -33,6 +33,7 @@ struct UserIndicator: Equatable, Identifiable {
|
|||||||
var id: String = UUID().uuidString
|
var id: String = UUID().uuidString
|
||||||
var type: UserIndicatorType = .toast
|
var type: UserIndicatorType = .toast
|
||||||
var title: String
|
var title: String
|
||||||
|
var message: String?
|
||||||
var iconName: String?
|
var iconName: String?
|
||||||
var persistent = false
|
var persistent = false
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,18 @@ struct UserIndicatorModalView: View {
|
|||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
if let iconName = indicator.iconName {
|
if let iconName = indicator.iconName {
|
||||||
Image(systemName: iconName)
|
Image(systemName: iconName)
|
||||||
.font(.compound.bodyLG)
|
.font(titleFont)
|
||||||
.foregroundColor(.compound.iconPrimary)
|
.foregroundColor(.compound.iconPrimary)
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(indicator.title)
|
Text(indicator.title)
|
||||||
.font(.compound.bodyLG)
|
.font(titleFont)
|
||||||
|
.foregroundColor(.compound.textPrimary)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let message = indicator.message {
|
||||||
|
Text(message)
|
||||||
|
.font(.compound.bodyMD)
|
||||||
.foregroundColor(.compound.textPrimary)
|
.foregroundColor(.compound.textPrimary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,16 +60,23 @@ struct UserIndicatorModalView: View {
|
|||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
.interactiveDismissDisabled(indicator.interactiveDismissDisabled)
|
.interactiveDismissDisabled(indicator.interactiveDismissDisabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var titleFont: Font {
|
||||||
|
if indicator.message != nil {
|
||||||
|
.compound.headingMDBold
|
||||||
|
} else {
|
||||||
|
.compound.bodyLG
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview {
|
struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
Group {
|
VStack(spacing: 0) {
|
||||||
UserIndicatorModalView(indicator: UserIndicator(type: .modal,
|
UserIndicatorModalView(indicator: UserIndicator(type: .modal,
|
||||||
title: "Successfully logged in",
|
title: "Successfully logged in",
|
||||||
iconName: "checkmark")
|
iconName: "checkmark")
|
||||||
)
|
)
|
||||||
.previewDisplayName("Spinner")
|
|
||||||
|
|
||||||
UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .published(CurrentValueSubject<Double, Never>(0.5).asCurrentValuePublisher()),
|
UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .published(CurrentValueSubject<Double, Never>(0.5).asCurrentValuePublisher()),
|
||||||
interactiveDismissDisabled: false,
|
interactiveDismissDisabled: false,
|
||||||
@@ -70,7 +84,6 @@ struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview {
|
|||||||
title: "Successfully logged in",
|
title: "Successfully logged in",
|
||||||
iconName: "checkmark")
|
iconName: "checkmark")
|
||||||
)
|
)
|
||||||
.previewDisplayName("Progress Bar")
|
|
||||||
|
|
||||||
UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .none,
|
UserIndicatorModalView(indicator: UserIndicator(type: .modal(progress: .none,
|
||||||
interactiveDismissDisabled: false,
|
interactiveDismissDisabled: false,
|
||||||
@@ -78,7 +91,12 @@ struct UserIndicatorModalView_Previews: PreviewProvider, TestablePreview {
|
|||||||
title: "Successfully logged in",
|
title: "Successfully logged in",
|
||||||
iconName: "checkmark")
|
iconName: "checkmark")
|
||||||
)
|
)
|
||||||
.previewDisplayName("No progress")
|
|
||||||
|
UserIndicatorModalView(indicator: UserIndicator(type: .modal,
|
||||||
|
title: "Successfully logged in",
|
||||||
|
message: "You can now be happy.",
|
||||||
|
iconName: "checkmark")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d681ba65fbd9d56483b2fd90f87de7a5234cbb5510c22be154093354aabbb8c7
|
|
||||||
size 90434
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:d681ba65fbd9d56483b2fd90f87de7a5234cbb5510c22be154093354aabbb8c7
|
|
||||||
size 90434
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:71c1e2e09b6212572ca3f443f9bb4ebeb2e4cf2182d818702fd11cb1587db9a0
|
|
||||||
size 42593
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:71c1e2e09b6212572ca3f443f9bb4ebeb2e4cf2182d818702fd11cb1587db9a0
|
|
||||||
size 42593
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:46ae1f8079fb0d6fecf0f06c47f61c2f37d014f0d615aab79fd7c75639c5415f
|
|
||||||
size 91303
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:46ae1f8079fb0d6fecf0f06c47f61c2f37d014f0d615aab79fd7c75639c5415f
|
|
||||||
size 91303
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:57244d7c4e1affdbd4c25aeca1df48d547cb640a95a0262d45fa1384d6cdc260
|
|
||||||
size 42509
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:57244d7c4e1affdbd4c25aeca1df48d547cb640a95a0262d45fa1384d6cdc260
|
|
||||||
size 42509
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:f6a2f85477fa536362b84331e745b5c84853f45cd3d21b74d4cba470aebc75b3
|
|
||||||
size 92654
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:f6a2f85477fa536362b84331e745b5c84853f45cd3d21b74d4cba470aebc75b3
|
|
||||||
size 92654
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9d526453ba493b0723873363408a530c42ae1511dcb9af505f3aaf5a9c1d9953
|
|
||||||
size 43297
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:9d526453ba493b0723873363408a530c42ae1511dcb9af505f3aaf5a9c1d9953
|
|
||||||
size 43297
|
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:848c3e89b4a3152582fc18b711f4b277e5d03100c5d8425cd7cb1047f15e5b93
|
||||||
|
size 150863
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:848c3e89b4a3152582fc18b711f4b277e5d03100c5d8425cd7cb1047f15e5b93
|
||||||
|
size 150863
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:470b1e405d1e4da29dfabd05153174d9aa682f9655013b29639f7176991e2d63
|
||||||
|
size 87919
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:470b1e405d1e4da29dfabd05153174d9aa682f9655013b29639f7176991e2d63
|
||||||
|
size 87919
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:1a1ddb695450412ad2cea3b0109bb944319a3cde7f6b5fa10b5b66e39b484883
|
|
||||||
size 98613
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:1a1ddb695450412ad2cea3b0109bb944319a3cde7f6b5fa10b5b66e39b484883
|
|
||||||
size 98613
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:7383c3645e8e3fce81afdd844bcfc2a0b87553e3d980ce0cd559cf37647e996a
|
|
||||||
size 54716
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:7383c3645e8e3fce81afdd844bcfc2a0b87553e3d980ce0cd559cf37647e996a
|
|
||||||
size 54716
|
|
||||||
Reference in New Issue
Block a user