mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Use the UIColors directly instead of wrapping the SwiftUI Colors. (#3324)
This commit is contained in:
parent
d73681221d
commit
c264e9e590
@ -60,6 +60,12 @@ custom_rules:
|
|||||||
message: "Please use explicit spacing in HStacks."
|
message: "Please use explicit spacing in HStacks."
|
||||||
severity: warning
|
severity: warning
|
||||||
|
|
||||||
|
compound_color_conversion:
|
||||||
|
regex: "UIColor\\(\\.compound"
|
||||||
|
match_kinds: identifier
|
||||||
|
message: "Please use the UIColor token directly to ensure the colour scheme is honoured."
|
||||||
|
severity: warning
|
||||||
|
|
||||||
print_deprecation:
|
print_deprecation:
|
||||||
regex: "\\b(print)\\b"
|
regex: "\\b(print)\\b"
|
||||||
match_kinds: identifier
|
match_kinds: identifier
|
||||||
|
@ -7887,7 +7887,7 @@
|
|||||||
repositoryURL = "https://github.com/element-hq/compound-ios";
|
repositoryURL = "https://github.com/element-hq/compound-ios";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = revision;
|
kind = revision;
|
||||||
revision = 0d6248492aa577b3747a34c50104cc738b628478;
|
revision = 92110afc158ac6ee7c68d5e975144bafa6c58396;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
F76A08D0EA29A07A54F4EB4D /* XCRemoteSwiftPackageReference "swift-collections" */ = {
|
F76A08D0EA29A07A54F4EB4D /* XCRemoteSwiftPackageReference "swift-collections" */ = {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/compound-ios",
|
"location" : "https://github.com/element-hq/compound-ios",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "0d6248492aa577b3747a34c50104cc738b628478"
|
"revision" : "92110afc158ac6ee7c68d5e975144bafa6c58396"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// Please see LICENSE in the repository root for full details.
|
// Please see LICENSE in the repository root for full details.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Compound
|
||||||
import DTCoreText
|
import DTCoreText
|
||||||
import Foundation
|
import Foundation
|
||||||
import LRUCache
|
import LRUCache
|
||||||
@ -267,7 +268,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
|||||||
attributedString.enumerateAttribute(.backgroundColor, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
|
attributedString.enumerateAttribute(.backgroundColor, in: .init(location: 0, length: attributedString.length), options: []) { value, range, _ in
|
||||||
if let value = value as? UIColor,
|
if let value = value as? UIColor,
|
||||||
value == temporaryCodeBlockMarkingColor {
|
value == temporaryCodeBlockMarkingColor {
|
||||||
attributedString.addAttribute(.backgroundColor, value: UIColor(.compound._bgCodeBlock) as Any, range: range)
|
attributedString.addAttribute(.backgroundColor, value: UIColor.compound._bgCodeBlock as Any, range: range)
|
||||||
attributedString.removeAttribute(.link, range: range)
|
attributedString.removeAttribute(.link, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
// Please see LICENSE in the repository root for full details.
|
// Please see LICENSE in the repository root for full details.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Compound
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct MessageComposerTextField: View {
|
struct MessageComposerTextField: View {
|
||||||
@ -96,7 +98,7 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
|||||||
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
|
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
|
||||||
// Prevent the textView from inheriting attributes from mention pills
|
// Prevent the textView from inheriting attributes from mention pills
|
||||||
textView.typingAttributes = [.font: font,
|
textView.typingAttributes = [.font: font,
|
||||||
.foregroundColor: UIColor(.compound.textPrimary)]
|
.foregroundColor: UIColor.compound.textPrimary]
|
||||||
|
|
||||||
if textView.attributedText != text {
|
if textView.attributedText != text {
|
||||||
// Remember the selection if only the attributes have changed.
|
// Remember the selection if only the attributes have changed.
|
||||||
@ -311,7 +313,7 @@ struct MessageComposerTextField_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
init(text: String) {
|
init(text: String) {
|
||||||
_text = .init(initialValue: .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body),
|
_text = .init(initialValue: .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body),
|
||||||
.foregroundColor: UIColor(.compound.textPrimary)]))
|
.foregroundColor: UIColor.compound.textPrimary]))
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Combine
|
import Combine
|
||||||
|
import Compound
|
||||||
import HTMLParser
|
import HTMLParser
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import WysiwygComposer
|
import WysiwygComposer
|
||||||
@ -207,14 +208,14 @@ enum ComposerConstant {
|
|||||||
private extension HTMLParserStyle {
|
private extension HTMLParserStyle {
|
||||||
static let elementX = HTMLParserStyle(textColor: UIColor.label,
|
static let elementX = HTMLParserStyle(textColor: UIColor.label,
|
||||||
linkColor: UIColor.link,
|
linkColor: UIColor.link,
|
||||||
codeBlockStyle: BlockStyle(backgroundColor: UIColor(.compound._bgCodeBlock),
|
codeBlockStyle: BlockStyle(backgroundColor: UIColor.compound._bgCodeBlock,
|
||||||
borderColor: UIColor(.compound.borderInteractiveSecondary),
|
borderColor: UIColor.compound.borderInteractiveSecondary,
|
||||||
borderWidth: 1.0,
|
borderWidth: 1.0,
|
||||||
cornerRadius: 2.0,
|
cornerRadius: 2.0,
|
||||||
padding: BlockStyle.Padding(horizontal: 10, vertical: 12),
|
padding: BlockStyle.Padding(horizontal: 10, vertical: 12),
|
||||||
type: .background),
|
type: .background),
|
||||||
quoteBlockStyle: BlockStyle(backgroundColor: UIColor(.compound.iconTertiary),
|
quoteBlockStyle: BlockStyle(backgroundColor: UIColor.compound.iconTertiary,
|
||||||
borderColor: UIColor(.compound.borderInteractiveSecondary),
|
borderColor: UIColor.compound.borderInteractiveSecondary,
|
||||||
borderWidth: 0.0,
|
borderWidth: 0.0,
|
||||||
cornerRadius: 0.0,
|
cornerRadius: 0.0,
|
||||||
padding: BlockStyle.Padding(horizontal: 25, vertical: 12),
|
padding: BlockStyle.Padding(horizontal: 25, vertical: 12),
|
||||||
|
@ -173,7 +173,7 @@ class TimelineTableViewController: UIViewController {
|
|||||||
tableView.separatorStyle = .none
|
tableView.separatorStyle = .none
|
||||||
tableView.allowsSelection = false
|
tableView.allowsSelection = false
|
||||||
tableView.keyboardDismissMode = .onDrag
|
tableView.keyboardDismissMode = .onDrag
|
||||||
tableView.backgroundColor = UIColor(.compound.bgCanvasDefault)
|
tableView.backgroundColor = .compound.bgCanvasDefault
|
||||||
tableView.transform = CGAffineTransform(scaleX: 1, y: -1)
|
tableView.transform = CGAffineTransform(scaleX: 1, y: -1)
|
||||||
view.addSubview(tableView)
|
view.addSubview(tableView)
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ packages:
|
|||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
revision: 0d6248492aa577b3747a34c50104cc738b628478
|
revision: 92110afc158ac6ee7c68d5e975144bafa6c58396
|
||||||
# path: ../compound-ios
|
# path: ../compound-ios
|
||||||
AnalyticsEvents:
|
AnalyticsEvents:
|
||||||
url: https://github.com/matrix-org/matrix-analytics-events
|
url: https://github.com/matrix-org/matrix-analytics-events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user