Cherry pick some missed Compound/layout changes that ended up in the Xcode 15 PR. (#2120)

Fix broken Settings screen snapshots.
This commit is contained in:
Doug 2023-11-20 11:06:24 +00:00 committed by GitHub
parent fc7b0038bc
commit f2391394a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 31 additions and 62 deletions

View File

@ -589,7 +589,6 @@
9BB91CABB10D8FE90C491BCD /* StaticLocationScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C833673B334A0651AB46F30B /* StaticLocationScreenViewModelTests.swift */; }; 9BB91CABB10D8FE90C491BCD /* StaticLocationScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C833673B334A0651AB46F30B /* StaticLocationScreenViewModelTests.swift */; };
9BD3A773186291560DF92B62 /* RoomTimelineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F2402D738694F98729A441 /* RoomTimelineProvider.swift */; }; 9BD3A773186291560DF92B62 /* RoomTimelineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F2402D738694F98729A441 /* RoomTimelineProvider.swift */; };
9BEA56957B3AF954E7321658 /* ComposerToolbarViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E44928D844E16EE48A311FCA /* ComposerToolbarViewModelProtocol.swift */; }; 9BEA56957B3AF954E7321658 /* ComposerToolbarViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E44928D844E16EE48A311FCA /* ComposerToolbarViewModelProtocol.swift */; };
9C45CE85325CD591DADBC4CA /* ElementXTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBFEAC3AC691CBB84983E275 /* ElementXTests.swift */; };
9C5A07E7C33F3F40287D7861 /* SettingsScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */; }; 9C5A07E7C33F3F40287D7861 /* SettingsScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */; };
9CCC77C31CB399661A034739 /* UserProperties+Element.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A6C4BE591FE5C38CE9C7EF3 /* UserProperties+Element.swift */; }; 9CCC77C31CB399661A034739 /* UserProperties+Element.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A6C4BE591FE5C38CE9C7EF3 /* UserProperties+Element.swift */; };
9D2E03DB175A6AB14589076D /* AnalyticsEvents in Frameworks */ = {isa = PBXBuildFile; productRef = 2A3F7BCCB18C15B30CCA39A9 /* AnalyticsEvents */; }; 9D2E03DB175A6AB14589076D /* AnalyticsEvents in Frameworks */ = {isa = PBXBuildFile; productRef = 2A3F7BCCB18C15B30CCA39A9 /* AnalyticsEvents */; };
@ -1812,7 +1811,6 @@
DA2AEC1AB349A341FE13DEC1 /* StartChatScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartChatScreenUITests.swift; sourceTree = "<group>"; }; DA2AEC1AB349A341FE13DEC1 /* StartChatScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartChatScreenUITests.swift; sourceTree = "<group>"; };
DAB8D7926A5684E18196B538 /* VoiceMessageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageCache.swift; sourceTree = "<group>"; }; DAB8D7926A5684E18196B538 /* VoiceMessageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageCache.swift; sourceTree = "<group>"; };
DB06F22CFA34885B40976061 /* RoomDetailsEditScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetailsEditScreen.swift; sourceTree = "<group>"; }; DB06F22CFA34885B40976061 /* RoomDetailsEditScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDetailsEditScreen.swift; sourceTree = "<group>"; };
DBFEAC3AC691CBB84983E275 /* ElementXTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementXTests.swift; sourceTree = "<group>"; };
DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNNotification+Creator.swift"; sourceTree = "<group>"; }; DC0AEA686E425F86F6BA0404 /* UNNotification+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNNotification+Creator.swift"; sourceTree = "<group>"; };
DC10CCC8D68B863E20660DBC /* MessageForwardingScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModelProtocol.swift; sourceTree = "<group>"; }; DC10CCC8D68B863E20660DBC /* MessageForwardingScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageForwardingScreenViewModelProtocol.swift; sourceTree = "<group>"; };
DCF239C619971FDE48132550 /* SecureBackupLogoutConfirmationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupLogoutConfirmationScreenModels.swift; sourceTree = "<group>"; }; DCF239C619971FDE48132550 /* SecureBackupLogoutConfirmationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupLogoutConfirmationScreenModels.swift; sourceTree = "<group>"; };
@ -3228,7 +3226,6 @@
69D42EE0102D2857933625DD /* CreateRoomViewModelTests.swift */, 69D42EE0102D2857933625DD /* CreateRoomViewModelTests.swift */,
3B5E97E9615A158C76B2AB77 /* DateTests.swift */, 3B5E97E9615A158C76B2AB77 /* DateTests.swift */,
6D0A27607AB09784C8501B5C /* DeveloperOptionsScreenViewModelTests.swift */, 6D0A27607AB09784C8501B5C /* DeveloperOptionsScreenViewModelTests.swift */,
DBFEAC3AC691CBB84983E275 /* ElementXTests.swift */,
A58E93D91DE3288010390DEE /* EmojiDetectionTests.swift */, A58E93D91DE3288010390DEE /* EmojiDetectionTests.swift */,
099F2D36C141D845A445B1E6 /* EmojiProviderTests.swift */, 099F2D36C141D845A445B1E6 /* EmojiProviderTests.swift */,
84B7A28A6606D58D1E38C55A /* ExpiringTaskRunnerTests.swift */, 84B7A28A6606D58D1E38C55A /* ExpiringTaskRunnerTests.swift */,
@ -5178,7 +5175,6 @@
D3FD96913D2B1AAA3149DAC7 /* CreateRoomViewModelTests.swift in Sources */, D3FD96913D2B1AAA3149DAC7 /* CreateRoomViewModelTests.swift in Sources */,
CD0088B763CD970CF1CBF8CB /* DateTests.swift in Sources */, CD0088B763CD970CF1CBF8CB /* DateTests.swift in Sources */,
864C69CF951BF36D25BE0C03 /* DeveloperOptionsScreenViewModelTests.swift in Sources */, 864C69CF951BF36D25BE0C03 /* DeveloperOptionsScreenViewModelTests.swift in Sources */,
9C45CE85325CD591DADBC4CA /* ElementXTests.swift in Sources */,
F697284B9B5F2C00CFEA3B12 /* EmojiDetectionTests.swift in Sources */, F697284B9B5F2C00CFEA3B12 /* EmojiDetectionTests.swift in Sources */,
25618589E0DE0F1E95FC7B5C /* EmojiProviderTests.swift in Sources */, 25618589E0DE0F1E95FC7B5C /* EmojiProviderTests.swift in Sources */,
71B62C48B8079D49F3FBC845 /* ExpiringTaskRunnerTests.swift in Sources */, 71B62C48B8079D49F3FBC845 /* ExpiringTaskRunnerTests.swift in Sources */,

View File

@ -33,6 +33,7 @@ struct MenuSheetLabelStyle: LabelStyle {
} }
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.fixedSize(horizontal: false, vertical: true)
.padding(16) .padding(16)
} }
} }

View File

@ -34,6 +34,7 @@ struct MessageComposer: View {
@FocusState private var focused: Bool @FocusState private var focused: Bool
@State private var composerTranslation: CGFloat = 0 @State private var composerTranslation: CGFloat = 0
private let composerShape = RoundedRectangle(cornerRadius: 21, style: .circular)
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
@ -41,16 +42,14 @@ struct MessageComposer: View {
resizeGrabber resizeGrabber
} }
let borderRadius: CGFloat = 21
mainContent mainContent
.padding(.horizontal, 12.0) .padding(.horizontal, 12.0)
.clipShape(RoundedRectangle(cornerRadius: borderRadius)) .clipShape(composerShape)
.background { .background {
let roundedRectangle = RoundedRectangle(cornerRadius: borderRadius)
ZStack { ZStack {
roundedRectangle composerShape
.fill(Color.compound.bgSubtleSecondary) .fill(Color.compound.bgSubtleSecondary)
roundedRectangle composerShape
.stroke(Color.compound._borderTextFieldFocused, lineWidth: 0.5) .stroke(Color.compound._borderTextFieldFocused, lineWidth: 0.5)
} }
} }
@ -135,8 +134,7 @@ private struct MessageComposerReplyHeader: View {
TimelineReplyView(placement: .composer, timelineItemReplyDetails: replyDetails) TimelineReplyView(placement: .composer, timelineItemReplyDetails: replyDetails)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.padding(4.0) .padding(4.0)
.background(Color.compound.bgCanvasDefault) .background(.compound.bgCanvasDefault, in: RoundedRectangle(cornerRadius: 13, style: .circular))
.cornerRadius(13.0)
.overlay(alignment: .topTrailing) { .overlay(alignment: .topTrailing) {
Button(action: action) { Button(action: action) {
CompoundIcon(\.close, size: .small, relativeTo: .compound.bodySMSemibold) CompoundIcon(\.close, size: .small, relativeTo: .compound.bodySMSemibold)

View File

@ -31,7 +31,7 @@ struct RoomHeaderView: View {
} }
// Leading align whilst using the principal toolbar position. // Leading align whilst using the principal toolbar position.
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
// Using a button stops is from getting truncated in the navigation bar // Using a button stops it from getting truncated in the navigation bar
.onTapGesture { .onTapGesture {
context.send(viewAction: .displayRoomDetails) context.send(viewAction: .displayRoomDetails)
} }

View File

@ -14,7 +14,7 @@
// limitations under the License. // limitations under the License.
// //
import Foundation import Compound
import SwiftUI import SwiftUI
struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol { struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
@ -28,16 +28,17 @@ struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
// Spacing: 6 = label spacing - formatted text padding // Spacing: 6 = label spacing - formatted text padding
HStack(alignment: .firstTextBaseline, spacing: 6.0) { Label {
Image(systemName: "info.bubble").padding(.top, 2.0)
.foregroundColor(.compound.iconSecondary)
if let attributedString = timelineItem.content.formattedBody { if let attributedString = timelineItem.content.formattedBody {
FormattedBodyText(attributedString: attributedString, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle)) FormattedBodyText(attributedString: attributedString, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle))
} else { } else {
FormattedBodyText(text: timelineItem.content.body, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle)) FormattedBodyText(text: timelineItem.content.body, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle))
} }
} icon: {
CompoundIcon(\.info, size: .small, relativeTo: .compound.bodyLG)
.foregroundColor(.compound.iconSecondary)
} }
.labelStyle(.custom(spacing: 6.0, alignment: .top))
.padding(.leading, 4) // Trailing padding is provided by FormattedBodyText .padding(.leading, 4) // Trailing padding is provided by FormattedBodyText
} }
} }

View File

@ -14,6 +14,7 @@
// limitations under the License. // limitations under the License.
// //
import Compound
import SwiftUI import SwiftUI
struct UnsupportedRoomTimelineView: View { struct UnsupportedRoomTimelineView: View {
@ -31,7 +32,7 @@ struct UnsupportedRoomTimelineView: View {
.font(.compound.bodySM) .font(.compound.bodySM)
} }
} icon: { } icon: {
Image(systemName: "exclamationmark.triangle") CompoundIcon(\.warning, size: .small, relativeTo: .compound.bodyLG)
} }
.labelStyle(RoomTimelineViewLabelStyle()) .labelStyle(RoomTimelineViewLabelStyle())
} }

View File

@ -1,28 +0,0 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
@testable import ElementX
import XCTest
class ElementXTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
}