[PM-26184] Consolidate icons to BitwardenResources (#2005)

This commit is contained in:
Katherine Bertelsen 2025-10-01 08:00:12 -05:00 committed by GitHub
parent b3a248500e
commit 31ac0c45d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
402 changed files with 365 additions and 821 deletions

View File

@ -1,3 +1,4 @@
import BitwardenResources
import SwiftUI
// MARK: - AccessoryButtonStyle
@ -31,14 +32,14 @@ extension ButtonStyle where Self == AccessoryButtonStyle {
#if DEBUG
#Preview("Enabled") {
Button {} label: {
Asset.Images.bwiProvider.swiftUIImage
SharedAsset.Icons.copy24.swiftUIImage
}
.buttonStyle(.accessory)
}
#Preview("Disabled") {
Button {} label: {
Asset.Images.bwiProvider.swiftUIImage
SharedAsset.Icons.copy24.swiftUIImage
}
.buttonStyle(.accessory)
.disabled(true)

View File

@ -76,10 +76,10 @@ public enum UI {
UISearchBar.appearance().tintColor = Asset.Colors.primaryBitwarden.color
// Explicitly tint the image so that it does not assume the tint color assigned to the entire search bar.
let image = Asset.Images.cancelRound.image
let image = SharedAsset.Icons.circleX16.image
let tintedImage = image.withTintColor(Asset.Colors.textSecondary.color, renderingMode: .alwaysOriginal)
UISearchBar.appearance().setImage(tintedImage, for: .clear, state: .normal)
UISearchBar.appearance().setImage(Asset.Images.magnifyingGlass.image, for: .search, state: .normal)
UISearchBar.appearance().setImage(SharedAsset.Icons.search16.image, for: .search, state: .normal)
// Adjust the appearance of `UITextView` for `BitwardenMultilineTextField` instances on
// iOS 15.

View File

@ -15,7 +15,7 @@ extension View {
/// - Returns: A `Button` configured for adding an item.
///
func addToolbarButton(hidden: Bool = false, action: @escaping () -> Void) -> some View {
toolbarButton(asset: Asset.Images.plus, label: Localizations.add, action: action)
toolbarButton(asset: SharedAsset.Icons.plus16, label: Localizations.add, action: action)
.hidden(hidden)
.accessibilityIdentifier("AddItemButton")
}
@ -26,7 +26,7 @@ extension View {
/// - Returns: A `Button` configured for cancelling an operation in a view.
///
func cancelToolbarButton(action: @escaping () -> Void) -> some View {
toolbarButton(asset: Asset.Images.cancel, label: Localizations.cancel, action: action)
toolbarButton(asset: SharedAsset.Icons.close16, label: Localizations.cancel, action: action)
.accessibilityIdentifier("CancelButton")
}
@ -36,7 +36,7 @@ extension View {
/// - Returns: A `Button` configured for closing a view.
///
func closeToolbarButton(action: @escaping () -> Void) -> some View {
toolbarButton(asset: Asset.Images.cancel, label: Localizations.close, action: action)
toolbarButton(asset: SharedAsset.Icons.close16, label: Localizations.close, action: action)
.accessibilityIdentifier("CloseButton")
}
@ -58,7 +58,7 @@ extension View {
/// - action: The action to perform when the button is tapped.
/// - Returns: A `Button` for displaying an image in a toolbar.
///
func toolbarButton(asset: ImageAsset, label: String, action: @escaping () -> Void) -> some View {
func toolbarButton(asset: SharedImageAsset, label: String, action: @escaping () -> Void) -> some View {
Button(action: action) {
Image(asset: asset, label: Text(label))
.imageStyle(.toolbarIcon)
@ -96,7 +96,7 @@ extension View {
Menu {
content()
} label: {
Image(asset: Asset.Images.verticalKabob, label: Text(Localizations.options))
Image(asset: SharedAsset.Icons.ellipsisVertical24, label: Text(Localizations.options))
.imageStyle(.toolbarIcon)
.accessibilityIdentifier("HeaderBarOptionsButton")
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "bw-logo.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "bwi-provider.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "cancel-round.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "cancel.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,12 +0,0 @@
{
"images" : [
{
"filename" : "chevron-down.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "clock.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "collections.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "copy.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "credit-card.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "doc.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "down-angle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "external-link-2.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "external-link.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "folder-closed.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "gear.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "globe.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "hidden.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "horizontal-kabob.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "id.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "magnifying-glass.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "pencil.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "right-angle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "trash.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "up-angle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "vertical-kabob.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -1,16 +0,0 @@
{
"images" : [
{
"filename" : "visible.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}

View File

@ -26,7 +26,7 @@ struct AccessoryButton: View {
var action: Action
/// The image to display in the button.
var asset: ImageAsset
var asset: SharedImageAsset
var body: some View {
switch action {
@ -59,7 +59,7 @@ struct AccessoryButton: View {
/// - accessibilityLabel: The accessibility label of the button.
/// - action: The action to perform when the user triggers the button.
///
init(asset: ImageAsset, accessibilityLabel: String, action: @escaping () -> Void) {
init(asset: SharedImageAsset, accessibilityLabel: String, action: @escaping () -> Void) {
self.accessibilityLabel = accessibilityLabel
self.action = .sync(action)
self.asset = asset
@ -73,7 +73,7 @@ struct AccessoryButton: View {
/// - accessibilityLabel: The accessibility label of the button.
/// - action: The action to perform when the user triggers the button.
///
init(asset: ImageAsset, accessibilityLabel: String, action: @escaping () async -> Void) {
init(asset: SharedImageAsset, accessibilityLabel: String, action: @escaping () async -> Void) {
self.accessibilityLabel = accessibilityLabel
self.action = .async(action)
self.asset = asset
@ -83,5 +83,5 @@ struct AccessoryButton: View {
// MARK: Previews
#Preview {
AccessoryButton(asset: Asset.Images.copy, accessibilityLabel: Localizations.copy) {}
AccessoryButton(asset: SharedAsset.Icons.copy16, accessibilityLabel: Localizations.copy) {}
}

View File

@ -176,7 +176,7 @@ private enum MenuPreviewOptions: CaseIterable, Menuable {
selection: .constant(.dog)
) {
Button {} label: {
Asset.Images.camera.swiftUIImage
SharedAsset.Icons.camera16.swiftUIImage
}
.buttonStyle(.accessory)
}

View File

@ -59,8 +59,8 @@ struct BitwardenTextField<TrailingContent: View>: View {
if let isPasswordVisible, canViewPassword {
AccessoryButton(
asset: isPasswordVisible.wrappedValue
? Asset.Images.hidden
: Asset.Images.visible,
? SharedAsset.Icons.eyeSlash24
: SharedAsset.Icons.eye24,
accessibilityLabel: isPasswordVisible.wrappedValue
? Localizations.passwordIsVisibleTapToHide
: Localizations.passwordIsNotVisibleTapToShow
@ -110,7 +110,7 @@ struct BitwardenTextField<TrailingContent: View>: View {
Button {
text = ""
} label: {
Asset.Images.cancelRound.swiftUIImage
SharedAsset.Icons.circleX16.swiftUIImage
.foregroundColor(Asset.Colors.primaryBitwarden.swiftUIColor)
.frame(width: 14, height: 14)
}
@ -239,7 +239,7 @@ extension BitwardenTextField where TrailingContent == EmptyView {
title: "Title",
text: .constant("Text field text")
) {
AccessoryButton(asset: Asset.Images.gear, accessibilityLabel: "") {}
AccessoryButton(asset: SharedAsset.Icons.cog16, accessibilityLabel: "") {}
}
.padding()
}
@ -254,7 +254,7 @@ extension BitwardenTextField where TrailingContent == EmptyView {
footer: "Text field footer",
isPasswordVisible: .constant(false)
) {
AccessoryButton(asset: Asset.Images.gear, accessibilityLabel: "") {}
AccessoryButton(asset: SharedAsset.Icons.cog16, accessibilityLabel: "") {}
}
.padding()
}

View File

@ -50,7 +50,7 @@ struct ExpandableHeaderView<Content: View>: View {
HStack(spacing: 8) {
SectionHeaderView("\(title) (\(count))")
Asset.Images.chevronDown.swiftUIImage
SharedAsset.Icons.chevronDown16.swiftUIImage
.imageStyle(.accessoryIcon(scaleWithFont: true))
.rotationEffect(isExpanded ? Angle(degrees: 180) : .zero)
}

View File

@ -22,7 +22,7 @@ struct SearchNoResultsView<Content: View>: View {
}
VStack(spacing: 35) {
Image(decorative: Asset.Images.magnifyingGlass)
Image(decorative: SharedAsset.Icons.search24)
.resizable()
.frame(width: 74, height: 74)
.foregroundColor(Asset.Colors.textSecondary.swiftUIColor)

View File

@ -36,7 +36,7 @@ struct SelectLanguageView: View {
@ViewBuilder
private func checkmarkView(_ languageOption: LanguageOption) -> some View {
if languageOption == store.state.currentLanguage {
Image(asset: Asset.Images.check)
Image(asset: SharedAsset.Icons.check24)
.imageStyle(.rowIcon)
}
}

View File

@ -1,3 +1,4 @@
import BitwardenResources
import SwiftUI
// MARK: - SettingsListItem
@ -101,7 +102,7 @@ struct SettingsListItem<Content: View>: View {
}
SettingsListItem("Account Security") {} trailingContent: {
Image(asset: Asset.Images.externalLink)
Image(asset: SharedAsset.Icons.externalLink16)
}
SettingsListItem("Account Security") {}

View File

@ -76,7 +76,7 @@ struct SettingsView: View {
/// The chevron shown in the settings list item.
private var chevron: some View {
Image(asset: Asset.Images.rightAngle)
Image(asset: SharedAsset.Icons.chevronRight16)
.resizable()
.scaledFrame(width: 12, height: 12)
.foregroundColor(Color(asset: Asset.Colors.textSecondary))
@ -164,7 +164,7 @@ struct SettingsView: View {
SettingsListItem(store.state.version, hasDivider: false) {
store.send(.versionTapped)
} trailingContent: {
Asset.Images.copy.swiftUIImage
SharedAsset.Icons.copy16.swiftUIImage
.imageStyle(.rowIcon)
}
}
@ -253,7 +253,7 @@ struct SettingsView: View {
SettingsListItem(name, hasDivider: hasDivider) {
store.send(action)
} trailingContent: {
Asset.Images.externalLink2.swiftUIImage
SharedAsset.Icons.externalLink16.swiftUIImage
.imageStyle(.rowIcon)
}
}
@ -282,7 +282,7 @@ struct SettingsView: View {
.frame(maxWidth: .infinity, alignment: .leading)
.multilineTextAlignment(.leading)
Asset.Images.externalLink2.swiftUIImage
SharedAsset.Icons.externalLink16.swiftUIImage
.imageStyle(.rowIcon)
}
.padding(16)

View File

@ -25,8 +25,8 @@ public enum TabRoute: Equatable, Hashable {
extension TabRoute: TabRepresentable {
public var image: UIImage? {
switch self {
case .itemList: return Asset.Images.recoveryCodes.image
case .settings: return Asset.Images.gearFilled.image
case .itemList: return SharedAsset.Icons.recoveryCodes.image
case .settings: return SharedAsset.Icons.gearFilled24.image
}
}
@ -39,8 +39,8 @@ extension TabRoute: TabRepresentable {
public var selectedImage: UIImage? {
switch self {
case .itemList: return Asset.Images.recoveryCodes.image
case .settings: return Asset.Images.gearFilled.image
case .itemList: return SharedAsset.Icons.recoveryCodes.image
case .settings: return SharedAsset.Icons.gearFilled24.image
}
}

View File

@ -109,7 +109,7 @@ struct EditAuthenticatorItemView: View {
Text(Localizations.advanced)
.styleGuide(.body)
Asset.Images.downAngle.swiftUIImage
SharedAsset.Icons.chevronDown16.swiftUIImage
.imageStyle(.accessoryIcon)
.rotationEffect(store.state.isAdvancedExpanded ? Angle(degrees: 180) : .zero)
}

View File

@ -55,7 +55,7 @@ struct ItemListCardView<ImageContent: View>: View {
Button {
closeTapped()
} label: {
Image(decorative: Asset.Images.cancel)
Image(decorative: SharedAsset.Icons.close16)
.padding(16) // Add padding to increase tappable area...
}
.padding(-16) // ...but remove it to not affect layout.
@ -104,7 +104,7 @@ struct ItemListCardView_Previews: PreviewProvider {
.allowAuthenticatorAppSyncingInSettingsToViewAllYourVerificationCodesHere,
buttonText: Localizations.takeMeToTheAppSettings,
leftImage: {
Image(decorative: Asset.Images.syncArrow)
Image(decorative: SharedAsset.Icons.arrowSync24)
.foregroundColor(Asset.Colors.primaryBitwardenLight.swiftUIColor)
.frame(width: 24, height: 24)
},
@ -118,7 +118,7 @@ struct ItemListCardView_Previews: PreviewProvider {
.allowAuthenticatorAppSyncingInSettingsToViewAllYourVerificationCodesHere,
buttonText: Localizations.takeMeToTheAppSettings,
leftImage: {
Image(decorative: Asset.Images.syncArrow)
Image(decorative: SharedAsset.Icons.arrowSync24)
.foregroundColor(Asset.Colors.primaryBitwardenLight.swiftUIColor)
.frame(width: 24, height: 24)
},

View File

@ -135,7 +135,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
bodyText: Localizations.storeAllOfYourLoginsAndSyncVerificationCodesDirectlyWithTheAuthenticatorApp,
buttonText: Localizations.downloadTheBitwardenApp,
leftImage: {
Image(decorative: Asset.Images.bwLogo)
Image(decorative: SharedAsset.Icons.shield24)
.foregroundColor(Asset.Colors.primaryBitwardenLight.swiftUIColor)
.frame(width: 24, height: 24)
},
@ -159,7 +159,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
.allowAuthenticatorAppSyncingInSettingsToViewAllYourVerificationCodesHere,
buttonText: Localizations.takeMeToTheAppSettings,
leftImage: {
Image(decorative: Asset.Images.syncArrow)
Image(decorative: SharedAsset.Icons.arrowSync24)
.foregroundColor(Asset.Colors.primaryBitwardenLight.swiftUIColor)
.frame(width: 24, height: 24)
},
@ -216,7 +216,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
HStack(spacing: 4) {
Text(Localizations.copy)
Spacer()
Image(decorative: Asset.Images.copy)
Image(decorative: SharedAsset.Icons.copy16)
.imageStyle(.accessoryIcon(scaleWithFont: true))
}
}
@ -228,7 +228,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
HStack(spacing: 4) {
Text(Localizations.edit)
Spacer()
Image(decorative: Asset.Images.pencil)
Image(decorative: SharedAsset.Icons.pencil24)
.imageStyle(.accessoryIcon(scaleWithFont: true))
}
}
@ -240,7 +240,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
HStack(spacing: 4) {
Text(Localizations.copyToBitwardenVault)
Spacer()
Image(decorative: Asset.Images.rightArrow)
Image(decorative: SharedAsset.Icons.arrowRight16)
.imageStyle(.accessoryIcon(scaleWithFont: true))
}
}
@ -254,7 +254,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod
HStack(spacing: 4) {
Text(Localizations.delete)
Spacer()
Image(decorative: Asset.Images.trash)
Image(decorative: SharedAsset.Icons.trash16)
.imageStyle(.accessoryIcon(scaleWithFont: true))
}
}

View File

@ -1,4 +1,5 @@
import BitwardenKit
import BitwardenResources
import BitwardenSdk
import SwiftUI
@ -64,11 +65,11 @@ struct ItemListItemRowView: View {
///
@ViewBuilder
private func decorativeImage(_ item: ItemListItem, iconBaseURL: URL?, showWebIcons: Bool) -> some View {
placeholderDecorativeImage(Asset.Images.globe)
placeholderDecorativeImage(SharedAsset.Icons.globe24)
}
/// The placeholder image for the decorative image.
private func placeholderDecorativeImage(_ icon: ImageAsset) -> some View {
private func placeholderDecorativeImage(_ icon: SharedImageAsset) -> some View {
Image(decorative: icon)
.resizable()
.scaledToFit()

Some files were not shown because too many files have changed in this diff Show More