mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Use generated UIColors everywhere. (#1405)
- Fix destructive buttons in the menu.
This commit is contained in:
@@ -37,9 +37,7 @@ struct Application: App {
|
||||
.statusBarHidden(shouldHideStatusBar)
|
||||
.introspect(.window, on: .iOS(.v16)) { window in
|
||||
// Workaround for SwiftUI not consistently applying the tint colour to Alerts/Confirmation Dialogs.
|
||||
window.tintColor = UIColor(named: "colorGray1400",
|
||||
in: Bundle(identifier: "CompoundDesignTokens-CompoundDesignTokens-resources"),
|
||||
compatibleWith: nil)
|
||||
window.tintColor = .compound.textActionPrimary
|
||||
}
|
||||
.task {
|
||||
appCoordinator.start()
|
||||
|
||||
@@ -117,7 +117,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
attributedString.enumerateAttribute(.backgroundColor, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
|
||||
if let value = value as? UIColor,
|
||||
value == temporaryCodeBlockMarkingColor {
|
||||
attributedString.addAttribute(.backgroundColor, value: UIColor(.compound._bgCodeBlock) as Any, range: range)
|
||||
attributedString.addAttribute(.backgroundColor, value: UIColor.compound._bgCodeBlock as Any, range: range)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
||||
textView.isMultiline = $isMultiline
|
||||
textView.delegate = context.coordinator
|
||||
textView.elementDelegate = context.coordinator
|
||||
textView.textColor = UIColor(.compound.textPrimary)
|
||||
textView.textColor = .compound.textPrimary
|
||||
textView.isEditable = true
|
||||
textView.font = font
|
||||
textView.isSelectable = true
|
||||
|
||||
@@ -31,13 +31,23 @@ struct TimelineItemMacContextMenu: View {
|
||||
TimelineItemMenuAction.react.label
|
||||
}
|
||||
}
|
||||
|
||||
ForEach(menuActions.actions) { action in
|
||||
Button { send(action) } label: { action.label }
|
||||
Button(role: action.isDestructive ? .destructive : nil) {
|
||||
send(action)
|
||||
} label: {
|
||||
action.label
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
ForEach(menuActions.debugActions) { action in
|
||||
Button { send(action) } label: { action.label }
|
||||
Button(role: action.isDestructive ? .destructive : nil) {
|
||||
send(action)
|
||||
} label: {
|
||||
action.label
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,17 @@ enum TimelineItemMenuAction: Identifiable, Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
/// The item's label.
|
||||
/// Whether or not the action is destructive.
|
||||
var isDestructive: Bool {
|
||||
switch self {
|
||||
case .redact, .report:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/// The action's label.
|
||||
var label: some View {
|
||||
switch self {
|
||||
case .copy: return Label(L10n.actionCopy, systemImage: "doc.on.doc")
|
||||
@@ -232,7 +242,9 @@ public struct TimelineItemMenu: View {
|
||||
|
||||
private func viewsForActions(_ actions: [TimelineItemMenuAction]) -> some View {
|
||||
ForEach(actions, id: \.self) { action in
|
||||
Button { send(action) } label: {
|
||||
Button(role: action.isDestructive ? .destructive : nil) {
|
||||
send(action)
|
||||
} label: {
|
||||
action.label
|
||||
.labelStyle(FixedIconSizeLabelStyle())
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Reference in New Issue
Block a user