diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 3d8ddc4eb..07610e3aa 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -6460,7 +6460,7 @@ repositoryURL = "https://github.com/vector-im/compound-ios"; requirement = { kind = revision; - revision = d6938dde5b345e5e7a8dea06a0481adaa5246327; + revision = 01b71e45542a73cb2dd8d5e56d289abff68fe715; }; }; 9A472EE0218FE7DCF5283429 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 5fb14e7b1..d55e2d174 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -13,7 +13,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vector-im/compound-ios", "state" : { - "revision" : "d6938dde5b345e5e7a8dea06a0481adaa5246327" + "revision" : "01b71e45542a73cb2dd8d5e56d289abff68fe715" } }, { diff --git a/ElementX/Sources/Other/Pills/PillView.swift b/ElementX/Sources/Other/Pills/PillView.swift index 1d9e04458..7f6d211a3 100644 --- a/ElementX/Sources/Other/Pills/PillView.swift +++ b/ElementX/Sources/Other/Pills/PillView.swift @@ -21,19 +21,27 @@ struct PillView: View { @ObservedObject var context: PillContext /// callback triggerd by changes in the display text let didChangeText: () -> Void + + var textColor: Color { + context.viewState.isOwnMention ? .compound.textOnSolidPrimary : .compound.textSuccessPrimary + } + + var backgroundColor: Color { + context.viewState.isOwnMention ? .compound._bgOwnPill : .compound._bgPill + } var body: some View { - HStack(spacing: 4) { - LoadableAvatarImage(url: context.viewState.avatarURL, name: context.viewState.name, contentID: context.viewState.contentID, avatarSize: .custom(24), imageProvider: imageProvider) + HStack(spacing: 2) { + LoadableAvatarImage(url: context.viewState.avatarURL, name: context.viewState.name, contentID: context.viewState.contentID, avatarSize: .custom(16), imageProvider: imageProvider) Text(context.viewState.displayText) .font(.compound.bodyLGSemibold) - .foregroundColor(.compound.textOnSolidPrimary) + .foregroundColor(textColor) .lineLimit(1) } - .padding(.horizontal, 8) - .padding(.vertical, 4) - // for now design has defined no color so we will just use gray - .background(Capsule().foregroundColor(context.viewState.isOwnMention ? .compound.bgCriticalPrimary : .gray)) + .padding(.leading, 4) + .padding(.trailing, 6) + .padding(.vertical, 1) + .background { Capsule().foregroundColor(backgroundColor) } .frame(maxWidth: PillConstants.maxWidth) .onChange(of: context.viewState.displayText) { _ in didChangeText() @@ -53,11 +61,9 @@ struct PillView_Previews: PreviewProvider, TestablePreview { .previewDisplayName("Loading Own") PillView(imageProvider: mockMediaProvider, context: PillContext.mock(type: .loadedUser(isOwn: false))) { } - // To simulate the trimming that happens at UIKit level .previewDisplayName("Loaded Long") PillView(imageProvider: mockMediaProvider, context: PillContext.mock(type: .loadedUser(isOwn: true))) { } - // To simulate the trimming that happens at UIKit level .previewDisplayName("Loaded Long Own") PillView(imageProvider: mockMediaProvider, context: PillContext.mock(type: .allUsers)) { } diff --git a/UnitTests/__Snapshots__/PreviewTests/test_messageText.Custom-Attachment.png b/UnitTests/__Snapshots__/PreviewTests/test_messageText.Custom-Attachment.png index 2ec551aea..64777479d 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_messageText.Custom-Attachment.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_messageText.Custom-Attachment.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7757fa407df9869e19ef6d59c487e0ce8fb848fbb0f864ec328ecfc86bdc1834 -size 62544 +oid sha256:1a15ca8e95ef692687c5b1eede5d0bd6f7fff14b544100928dd409cd6a48d66d +size 62925 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_pillView.All-Users.png b/UnitTests/__Snapshots__/PreviewTests/test_pillView.All-Users.png index 87c8579b4..fe8944ad2 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_pillView.All-Users.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_pillView.All-Users.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:424b4e9eb2c8a83401fec9d8c8c737c825a622e025c443563c4a23a17976ab1d -size 62173 +oid sha256:e28c9283ff63ad76753b6ad671d996034c07e453e44345cbac176dcf4b433c73 +size 61442 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long-Own.png b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long-Own.png index b144f79ff..418e7a8a9 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long-Own.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long-Own.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3cc84247a769c93950919a515079d0ff4a20293d9874df0905bcdf4264b78eb -size 66498 +oid sha256:b78e02b2c47f049fa5e9c5802d76572696d497cd9a09cdb4a05edcb60b1da2df +size 66669 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long.png b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long.png index 2459c06db..fea437b13 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loaded-Long.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b28152066f759f0fb99c4bfab9e51bb915a4f9d12c555c05063a00b13eec1476 -size 65700 +oid sha256:bd550435f2618862e8338704605a98f0471aa49a23425ccfbfc1487ad339279c +size 66822 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading-Own.png b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading-Own.png index 134e88148..a7b52a65f 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading-Own.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading-Own.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91680c015ee5ecbadadb799ff90f99a0112f00b7a95460d53bcd2d8f18177a1c -size 64987 +oid sha256:9fd608f61a0055a49ad6b93a2db812c9a6fb60444a12699bffd78b05d61f3ee5 +size 63623 diff --git a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading.png b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading.png index 5d3581b2b..a47eba4bc 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_pillView.Loading.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb935eb860e241bf52bc2b1bd45acf8361f661666721b3d512b6f5afd432cf70 -size 64239 +oid sha256:ffe228e557bf1c029f5b07c6e187db1413cedae314747241c7c03cbcb291b240 +size 63702 diff --git a/project.yml b/project.yml index 1e478ed65..72c680f04 100644 --- a/project.yml +++ b/project.yml @@ -49,7 +49,7 @@ packages: # path: ../matrix-rust-sdk Compound: url: https://github.com/vector-im/compound-ios - revision: d6938dde5b345e5e7a8dea06a0481adaa5246327 + revision: 01b71e45542a73cb2dd8d5e56d289abff68fe715 # path: ../compound-ios AnalyticsEvents: url: https://github.com/matrix-org/matrix-analytics-events