Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: close button - WPB-15211 #2388

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions WireUI/Sources/WireDesign/Icons/Image+ImageResource.swift

This file was deleted.

23 changes: 0 additions & 23 deletions WireUI/Sources/WireDesign/Icons/UImage+ImageResource.swift

This file was deleted.

10 changes: 3 additions & 7 deletions WireUI/Sources/WireFolderPickerUI/FolderPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,10 @@ public struct FolderPicker: View {
.toolbar {
if showCloseButton {
ToolbarItem(placement: .topBarTrailing) {
CloseButton(
action: didTapClose,
accessibilityLabel: String(
localized: "folderPicker.close.label",
table: "Accessibility",
bundle: .module
CloseButton(action: didTapClose)
.accessibilityLabel(
Text("folderPicker.close.label", tableName: "Accessibility", bundle: .module)
)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ public struct FolderPicker: View {
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
CloseButton(
action: didTapClose,
accessibilityLabel: String(
localized: "folderPicker.close.label",
table: "Accessibility",
bundle: .module
CloseButton(action: didTapClose)
.accessibilityLabel(
Text("folderPicker.close.label", tableName: "Accessibility", bundle: .module)
)
)
}
ToolbarItem(placement: .navigationBarTrailing) {
NavigationLink {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@ import WireDesign
public struct CloseButton: View {

private let action: () -> Void
private let accessibilityLabel: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the intention here of having the accessibilityLabel as part of the CloseButton came from Agis - the idea was to force us to always use an accessibilityLabel.

I'm OK to remove it, but I can't really think of any cons keeping it.


public var body: some View {
Button(action: action) {
Image.close
Image(.close)
}
.buttonStyle(.plain)
.foregroundColor(Color(uiColor: SemanticColors.Icon.foregroundDefaultBlack))
.accessibilityLabel(Text(accessibilityLabel))
.accessibilityIdentifier("close")
}

public init(action: @escaping @MainActor () -> Void, accessibilityLabel: String) {
public init(action: @escaping @MainActor () -> Void) {
self.action = action
self.accessibilityLabel = accessibilityLabel
}

}
Expand All @@ -46,7 +43,7 @@ public struct CloseButton: View {
Text("Hello, World!")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
CloseButton(action: { print("Close") }, accessibilityLabel: "Close")
CloseButton { print("Close") }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public extension UIBarButtonItem {
///
/// - Returns: A UIBarButtonItem configured as a close button.
static func closeButton(action: UIAction, accessibilityLabel: String) -> UIBarButtonItem {
let closeImage = UIImage.close
let closeImage = UIImage(resource: .close)

let closeItem = UIBarButtonItem(title: accessibilityLabel, primaryAction: action)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/openid/AppAuth-iOS.git",
"state": {
"branch": null,
"revision": "c89ed571ae140f8eb1142735e6e23d7bb8c34cb2",
"version": "1.7.5"
"revision": "2781038865a80e2c425a1da12cc1327bcd56501f",
"version": "1.7.6"
}
},
{
Expand Down Expand Up @@ -141,8 +141,8 @@
"repositoryURL": "https://github.com/apple/swift-log",
"state": {
"branch": null,
"revision": "9cb486020ebf03bfa5b5df985387a14a98744537",
"version": "1.6.1"
"revision": "96a2f8a0fa41e9e09af4585e2724c4e825410b91",
"version": "1.6.2"
}
},
{
Expand Down
Loading