First round of icon updates. (#2076)

Update Compound too.
This commit is contained in:
Doug
2023-11-13 16:44:29 +00:00
committed by GitHub
parent acd079199a
commit 4257c20bc9
84 changed files with 182 additions and 176 deletions
+4 -3
View File
@@ -33,10 +33,10 @@ internal enum Asset {
internal enum Images {
internal static let appLogo = ImageAsset(name: "images/app-logo")
internal static let serverSelectionIcon = ImageAsset(name: "images/server-selection-icon")
internal static let circle = ImageAsset(name: "images/circle")
internal static let closeCircle = ImageAsset(name: "images/close-circle")
internal static let addLocation = ImageAsset(name: "images/add-location")
internal static let attachment = ImageAsset(name: "images/attachment")
internal static let photosLibrary = ImageAsset(name: "images/photos-library")
internal static let takePhoto = ImageAsset(name: "images/take-photo")
internal static let textFormatting = ImageAsset(name: "images/text-formatting")
internal static let bold = ImageAsset(name: "images/bold")
@@ -57,10 +57,11 @@ internal enum Asset {
internal static let textFormat = ImageAsset(name: "images/text-format")
internal static let underline = ImageAsset(name: "images/underline")
internal static let unindent = ImageAsset(name: "images/unindent")
internal static let document = ImageAsset(name: "images/document")
internal static let decryptionError = ImageAsset(name: "images/decryption-error")
internal static let endedPoll = ImageAsset(name: "images/ended-poll")
internal static let compose = ImageAsset(name: "images/compose")
internal static let settingsIconWithBadge = ImageAsset(name: "images/settings-icon-with-badge")
internal static let signOut = ImageAsset(name: "images/sign-out")
internal static let launchBackground = ImageAsset(name: "images/launch-background")
internal static let locationMarker = ImageAsset(name: "images/location-marker")
internal static let locationPin = ImageAsset(name: "images/location-pin")
@@ -68,10 +69,10 @@ internal enum Asset {
internal static let locationPointer = ImageAsset(name: "images/location-pointer")
internal static let mediaPause = ImageAsset(name: "images/media-pause")
internal static let mediaPlay = ImageAsset(name: "images/media-play")
internal static let microphone = ImageAsset(name: "images/microphone")
internal static let secureBackupIcon = ImageAsset(name: "images/secure-backup-icon")
internal static let secureBackupOff = ImageAsset(name: "images/secure-backup-off")
internal static let secureBackupOn = ImageAsset(name: "images/secure-backup-on")
internal static let shareIos = ImageAsset(name: "images/share-ios")
internal static let addReaction = ImageAsset(name: "images/add-reaction")
internal static let copy = ImageAsset(name: "images/copy")
internal static let editOutline = ImageAsset(name: "images/edit-outline")
+2 -5
View File
@@ -310,6 +310,8 @@ public enum L10n {
}
/// Report a bug
public static var commonReportABug: String { return L10n.tr("Localizable", "common_report_a_bug") }
/// Report a problem
public static var commonReportAProblem: String { return L10n.tr("Localizable", "common_report_a_problem") }
/// Report submitted
public static var commonReportSubmitted: String { return L10n.tr("Localizable", "common_report_submitted") }
/// Rich text editor
@@ -1569,11 +1571,6 @@ public enum L10n {
/// Edit poll
public static var editPoll: String { return L10n.tr("Localizable", "action.edit_poll") }
}
public enum Common {
/// Report a problem
public static var reportAProblem: String { return L10n.tr("Localizable", "common.report_a_problem") }
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces
@@ -35,7 +35,7 @@ struct BugReportScreen: View {
.disabled(context.viewState.shouldDisableInteraction)
.scrollDismissesKeyboard(.immediately)
.compoundList()
.navigationTitle(L10n.commonReportABug)
.navigationTitle(L10n.commonReportAProblem)
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.interactiveDismissDisabled()
@@ -44,7 +44,7 @@ struct RoomAttachmentPicker: View {
context.showAttachmentPopover = false
context.send(viewAction: .displayMediaPicker)
} label: {
Label(L10n.screenRoomAttachmentSourceGallery, iconAsset: Asset.Images.photosLibrary)
Label(L10n.screenRoomAttachmentSourceGallery, icon: \.image)
.labelStyle(.menuSheet)
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerPhotoLibrary)
@@ -226,7 +226,7 @@ struct HomeScreen: View {
Button {
context.send(viewAction: .startChat)
} label: {
CompoundIcon(customImage: Asset.Images.compose.swiftUIImage)
CompoundIcon(\.edit)
}
.accessibilityLabel(L10n.actionStartChat)
.accessibilityIdentifier(A11yIdentifiers.homeScreen.startChat)
@@ -36,7 +36,7 @@ struct HomeScreenEmptyStateView: View {
.padding(.bottom, 12)
Button { context.send(viewAction: .startChat) } label: {
Label(L10n.actionStartChat, iconAsset: Asset.Images.compose)
Label(L10n.actionStartChat, icon: \.edit)
.font(.compound.bodyLGSemibold)
.foregroundColor(.compound.textOnSolidPrimary)
.padding(.vertical, 6)
@@ -39,13 +39,13 @@ struct HomeScreenRoomList: View {
Button {
context.send(viewAction: .showRoomDetails(roomIdentifier: room.id))
} label: {
Label(L10n.commonSettings, systemImage: "gearshape")
Label(L10n.commonSettings, icon: \.settings)
}
Button(role: .destructive) {
context.send(viewAction: .leaveRoom(roomIdentifier: room.id))
} label: {
Label(L10n.actionLeaveRoom, systemImage: "rectangle.portrait.and.arrow.right")
Label(L10n.actionLeaveRoom, icon: \.leave)
}
}
}
@@ -18,7 +18,7 @@ import Compound
import SwiftUI
struct HomeScreenUserMenuButton: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.colorScheme) private var colorScheme
@ObservedObject var context: HomeScreenViewModel.Context
@@ -42,19 +42,19 @@ struct HomeScreenUserMenuButton: View {
}
Section {
MatrixUserShareLink(userID: context.viewState.userID) {
Label(L10n.actionInvite, systemImage: "square.and.arrow.up")
Label(L10n.actionInvite, iconAsset: Asset.Images.shareIos)
}
Button {
context.send(viewAction: .userMenu(action: .feedback))
} label: {
Label(L10n.commonReportABug, systemImage: "ladybug")
Label(L10n.commonReportAProblem, icon: \.chatProblem)
}
}
Section {
Button(role: .destructive) {
context.send(viewAction: .userMenu(action: .logout))
} label: {
Label(L10n.screenSignoutPreferenceItem, systemImage: "rectangle.portrait.and.arrow.right")
Label(L10n.screenSignoutPreferenceItem, iconAsset: Asset.Images.signOut)
}
}
} label: {
@@ -122,15 +122,12 @@ struct RoomDetailsEditScreen: View {
}
private var avatarOverlayIcon: some View {
Image(systemName: "camera")
.font(.system(size: 14, weight: .semibold))
.padding(3)
.imageScale(.small)
CompoundIcon(customImage: Asset.Images.editing.swiftUIImage, size: .xSmall, relativeTo: .compound.bodyLG)
.foregroundColor(.white)
.padding(3)
.background {
Circle()
.foregroundColor(.black)
.aspectRatio(1, contentMode: .fill)
}
}
@@ -14,6 +14,7 @@
// limitations under the License.
//
import Compound
import SwiftUI
enum TimelineReplyViewPlacement {
@@ -43,7 +44,7 @@ struct TimelineReplyView: View {
ReplyView(sender: sender,
plainBody: content.body,
formattedBody: nil,
icon: .init(kind: .systemIcon("doc.text.fill"), cornerRadii: iconCornerRadii))
icon: .init(kind: .iconAsset(Asset.Images.document), cornerRadii: iconCornerRadii))
case .image(let content):
ReplyView(sender: sender,
plainBody: content.body,
@@ -66,12 +67,12 @@ struct TimelineReplyView: View {
ReplyView(sender: sender,
plainBody: L10n.commonVoiceMessage,
formattedBody: nil,
icon: .init(kind: .icon(Asset.Images.microphone.name), cornerRadii: iconCornerRadii))
icon: .init(kind: .icon(\.micOnOutline), cornerRadii: iconCornerRadii))
case .location:
ReplyView(sender: sender,
plainBody: L10n.commonSharedLocation,
formattedBody: nil,
icon: .init(kind: .icon(Asset.Images.locationMarker.name), cornerRadii: iconCornerRadii))
icon: .init(kind: .iconAsset(Asset.Images.addLocation), cornerRadii: iconCornerRadii))
}
default:
LoadingReplyView()
@@ -100,7 +101,8 @@ struct TimelineReplyView: View {
enum Kind {
case mediaSource(MediaSourceProxy)
case systemIcon(String)
case icon(String)
case iconAsset(ImageAsset)
case icon(KeyPath<CompoundIcons, Image>)
}
let kind: Kind
@@ -191,11 +193,13 @@ struct TimelineReplyView: View {
.resizable()
.aspectRatio(contentMode: .fit)
.padding(8.0)
case .icon(let iconName):
Image(iconName)
case .iconAsset(let asset):
Image(asset: asset)
.resizable()
.aspectRatio(contentMode: .fit)
.padding(8.0)
case .icon(let keyPath):
CompoundIcon(keyPath, size: .small, relativeTo: .body)
}
}
}
@@ -14,13 +14,14 @@
// limitations under the License.
//
import Compound
import SwiftUI
struct SwipeToReplyView: View {
let timelineItem: RoomTimelineItemProtocol
var body: some View {
Image(systemName: "arrowshape.turn.up.left")
CompoundIcon(customImage: Asset.Images.reply.swiftUIImage)
.foregroundColor(.compound.iconPrimary)
.accessibilityHidden(true)
}
@@ -14,7 +14,9 @@
// limitations under the License.
//
import Compound
import SwiftUI
struct TimelineDeliveryStatusView: View {
enum Status {
case sending
@@ -23,20 +25,18 @@ struct TimelineDeliveryStatusView: View {
let deliveryStatus: Status
private var systemImageName: String {
private var icon: CompoundIcon {
switch deliveryStatus {
case .sending:
return "circle"
return CompoundIcon(customImage: Asset.Images.circle.swiftUIImage, size: .xSmall, relativeTo: .compound.bodyMD)
case .sent:
return "checkmark.circle"
return CompoundIcon(\.checkCircle, size: .xSmall, relativeTo: .compound.bodyMD)
}
}
var body: some View {
Image(systemName: systemImageName)
.resizable()
icon
.foregroundColor(.compound.iconSecondary)
.frame(width: 16.0, height: 16.0)
}
}
@@ -54,12 +54,12 @@ struct EncryptedRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static var body: some View {
VStack(alignment: .leading, spacing: 20.0) {
EncryptedRoomTimelineView(timelineItem: itemWith(text: "Text",
EncryptedRoomTimelineView(timelineItem: itemWith(text: L10n.commonWaitingForDecryptionKey,
timestamp: "Now",
isOutgoing: false,
senderId: "Bob"))
EncryptedRoomTimelineView(timelineItem: itemWith(text: "Some other text",
EncryptedRoomTimelineView(timelineItem: itemWith(text: L10n.commonWaitingForDecryptionKey,
timestamp: "Later",
isOutgoing: true,
senderId: "Anne"))
@@ -132,7 +132,7 @@ struct SettingsScreen: View {
})
.accessibilityIdentifier(A11yIdentifiers.settingsScreen.screenLock)
ListRow(label: .default(title: L10n.commonReportABug,
ListRow(label: .default(title: L10n.commonReportAProblem,
systemIcon: .ladybug),
kind: .navigationLink {
context.send(viewAction: .reportBug)
@@ -89,15 +89,12 @@ struct UserDetailsEditScreen: View {
}
private var avatarOverlayIcon: some View {
Image(systemName: "camera")
.font(.system(size: 14, weight: .semibold))
.padding(3)
.imageScale(.small)
CompoundIcon(customImage: Asset.Images.editing.swiftUIImage, size: .xSmall, relativeTo: .compound.bodyLG)
.foregroundColor(.white)
.padding(4)
.background {
Circle()
.foregroundColor(.black)
.aspectRatio(1, contentMode: .fill)
}
}