Skip to content

Commit

Permalink
- fix #1329
Browse files Browse the repository at this point in the history
- fix #1330
  • Loading branch information
felix-schwarz committed Apr 23, 2024
1 parent 0942617 commit 49045a8
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 10 deletions.
3 changes: 2 additions & 1 deletion ownCloud/Client/Viewer/DisplayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class DisplayViewController: UIViewController, Themeable, OCQueryDelegate {
let itemName = item?.name ?? ""
let actionsBarButtonItem = UIBarButtonItem(image: UIImage(named: "more-dots"), style: .plain, target: self, action: #selector(actionsBarButtonPressed))
actionsBarButtonItem.tag = moreButtonTag
actionsBarButtonItem.accessibilityLabel = itemName + " " + "Actions".localized
actionsBarButtonItem.accessibilityLabel = "Actions".localized

return actionsBarButtonItem
}
Expand Down Expand Up @@ -699,6 +699,7 @@ class DisplayViewController: UIViewController, Themeable, OCQueryDelegate {

// Use existing local copy
itemDirectURL = file.url
state = .downloadFinished
didUpdate = true

// Modify item's last used timestamp
Expand Down
15 changes: 14 additions & 1 deletion ownCloud/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
"Search for users or groups" = "Suche nach Benutzern oder Gruppen";
"Enter the user or group you want to invite." = "Geben Sie den Benutzer oder die Gruppe ein, die Sie einladen möchten.";

"Reveal" = "Zeigen";

"Pending" = "Ausstehend";
"Show parent paths" = "Übergeordnete Pfade anzeigen";
"Reveal in folder" = "Im Ordner anzeigen";
Expand Down Expand Up @@ -265,6 +267,7 @@
"Upload videos via WiFi only" = "Videos nur über WLAN hochladen";
"Upload pictures via WiFi only" = "Fotos nur über WLAN hochladen";
"More" = "Mehr";
"More for {{title}}" = "Mehr zu {{title}}";
"Documentation" = "Dokumentation";
"Send feedback" = "Feedback senden";
"Recommend to a friend" = "Weiterempfehlen";
Expand Down Expand Up @@ -448,7 +451,7 @@

"Select one or more items." = "Wähle ein oder mehrere Elemente";

"Add item" = "Eintrag hinzufügen";
"Add item" = "Element hinzufügen";

/* App Provider */
"New document" = "Neues Dokument";
Expand Down Expand Up @@ -650,6 +653,9 @@
"Documents" = "Dokumente";
"Audio" = "Audio";

/* Sidebar */
"Show/Hide sidebar" = "Seiteleiste zeigen/verstecken";

/* Favorites view */
"No favorites found" = "Keine Favoriten gefunden";
"If you make an item a favorite, it will turn up here." = "Wenn Sie ein Element favorisieren, wird es hier erscheinen.";
Expand Down Expand Up @@ -743,6 +749,13 @@
"Locations" = "Umgebungen";
"Downloaded Files" = "Heruntergeladene Dateien";

/* Item and cloud status */
"In the cloud" = "In der Cloud";
"Local copy" = "Lokale Kopie";
"Local version" = "Lokale Version";
"Available offline" = "Offline verfügbar";
"Shared" = "Geteilt";

/* Single Account */
"You are connected as\n%@" = "Sie sind verbunden als\n%@";

Expand Down
13 changes: 13 additions & 0 deletions ownCloud/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
"Search for users or groups" = "Search for users or groups";
"Enter the user or group you want to invite." = "Enter the user or group you want to invite.";

"Reveal" = "Reveal";

"Pending" = "Pending";
"Show parent paths" = "Show parent paths";
"Reveal in folder" = "Reveal in folder";
Expand Down Expand Up @@ -265,6 +267,7 @@
"Upload videos via WiFi only" = "Upload videos via WiFi only";
"Upload pictures via WiFi only" = "Upload pictures via WiFi only";
"More" = "More";
"More for {{title}}" = "More for {{title}}";
"Documentation" = "Documentation";
"Send feedback" = "Send feedback";
"Recommend to a friend" = "Recommend to a friend";
Expand Down Expand Up @@ -649,6 +652,9 @@
"Documents" = "Documents";
"Audio" = "Audio";

/* Sidebar */
"Show/Hide sidebar" = "Show/Hide sidebar";

/* Favorites view */
"No favorites found" = "No favorites found";
"If you make an item a favorite, it will turn up here." = "If you make an item a favorite, it will turn up here.";
Expand Down Expand Up @@ -742,6 +748,13 @@
"Locations" = "Locations";
"Downloaded Files" = "Downloaded Files";

/* Item and cloud status */
"In the cloud" = "In the cloud";
"Local copy" = "Local copy";
"Local version" = "Local version";
"Available offline" = "Available offline";
"Shared" = "Shared";

/* Single Account */
"You are connected as\n%@" = "You are connected as\n%@";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ class OCItemUniversalItemListCellHelper {
}

extension OCItem: UniversalItemListCellContentProvider {
func cloudStatus(in core: OCCore?) -> (icon: UIImage?, iconAlpha: CGFloat) {
func cloudStatus(in core: OCCore?) -> (icon: UIImage?, iconAlpha: CGFloat, accessibilityLabel: String?) {
var cloudStatusIcon : UIImage?
var cloudStatusIconAlpha : CGFloat = 1.0
var accessibilityLabel: String?
let availableOfflineCoverage : OCCoreAvailableOfflineCoverage = core?.availableOfflinePolicyCoverage(of: self) ?? .none

switch availableOfflineCoverage {
Expand All @@ -124,23 +125,28 @@ extension OCItem: UniversalItemListCellContentProvider {
case .cloudOnly:
cloudStatusIcon = OCItem.cloudOnlyStatusIcon
cloudStatusIconAlpha = 1.0
accessibilityLabel = "In the cloud".localized

case .localCopy:
cloudStatusIcon = (downloadTriggerIdentifier == OCItemDownloadTriggerID.availableOffline) ? OCItem.cloudAvailableOfflineStatusIcon : nil
accessibilityLabel = "Local copy".localized

case .locallyModified, .localOnly:
cloudStatusIcon = OCItem.cloudLocalOnlyStatusIcon
cloudStatusIconAlpha = 1.0
accessibilityLabel = "Local version".localized
}
} else {
if availableOfflineCoverage == .none {
cloudStatusIcon = nil
accessibilityLabel = nil
} else {
cloudStatusIcon = OCItem.cloudAvailableOfflineStatusIcon
accessibilityLabel = "Available offline".localized
}
}

return (cloudStatusIcon, cloudStatusIconAlpha)
return (cloudStatusIcon, cloudStatusIconAlpha, accessibilityLabel)
}

func content(for cell: UniversalItemListCell?, thumbnailSize: CGSize, context: ClientContext?, configuration: CollectionViewCellConfiguration?) -> (content: UniversalItemListCell.Content, hasMessageForItem: Bool) {
Expand Down Expand Up @@ -172,24 +178,24 @@ extension OCItem: UniversalItemListCellContentProvider {
var detailItems: [SegmentViewItem] = []

// - Cloud status
let (cloudStatusIcon, cloudStatusIconAlpha) = cloudStatus(in: context?.core)
let (cloudStatusIcon, cloudStatusIconAlpha, accessibilityLabel) = cloudStatus(in: context?.core)

if let cloudStatusIcon {
let segmentItem = SegmentViewItem(with: cloudStatusIcon.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary])
let segmentItem = SegmentViewItem(with: cloudStatusIcon.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary], accessibilityLabel: accessibilityLabel)
segmentItem.insets = .zero
segmentItem.alpha = cloudStatusIconAlpha
detailItems.append(segmentItem)
}

// - Sharing
if isSharedWithUser || sharedByUserOrGroup {
let segmentItem = SegmentViewItem(with: OCItem.groupIcon?.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary])
let segmentItem = SegmentViewItem(with: OCItem.groupIcon?.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary], accessibilityLabel: "Shared".localized)
segmentItem.insets = .zero
detailItems.append(segmentItem)
}

if sharedByPublicLink {
let segmentItem = SegmentViewItem(with: OCItem.linkIcon?.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary])
let segmentItem = SegmentViewItem(with: OCItem.linkIcon?.scaledImageFitting(in: CGSize(width: 32, height: 16)), style: .plain, lines: [.singleLine, .primary], accessibilityLabel: "Shared by link".localized)
segmentItem.insets = .zero
detailItems.append(segmentItem)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ open class UniversalItemListCell: ThemeableCollectionViewListCell {
var title: NSAttributedString? {
didSet {
titleLabel.attributedText = title
if let titleString = title?.string {
moreButtonAccessibilityLabel = "More for {{title}}".localized(["title" : titleString])
moreButton?.accessibilityLabel = moreButtonAccessibilityLabel
}
}
}
var primaryDetailSegments: [SegmentViewItem]? {
Expand Down Expand Up @@ -652,13 +656,14 @@ open class UniversalItemListCell: ThemeableCollectionViewListCell {
// MARK: - Accessories
// - More ...
open var moreButton: UIButton?
private var moreButtonAccessibilityLabel: String?
open lazy var moreButtonAccessory: UICellAccessory = {
let button = UIButton()

button.setImage(UIImage(named: "more-dots"), for: .normal)
button.contentMode = .center
button.isPointerInteractionEnabled = true
button.accessibilityLabel = "More".localized
button.accessibilityLabel = moreButtonAccessibilityLabel ?? "More".localized
button.addTarget(self, action: #selector(moreButtonTapped), for: .primaryActionTriggered)

button.frame = CGRect(x: 0, y: 0, width: 32, height: 42) // Avoid _UITemporaryLayoutWidths auto-layout warnings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ open class BrowserNavigationViewController: EmbeddingViewController, Themeable,
func buildSideBarToggleBarButtonItem() -> UIBarButtonItem {
let buttonItem = UIBarButtonItem(image: OCSymbol.icon(forSymbolName: "sidebar.leading"), style: .plain, target: self, action: #selector(showHideSideBar))
buttonItem.tag = BarButtonTags.showHideSideBar.rawValue
buttonItem.accessibilityLabel = "Show/Hide sidebar".localized
return buttonItem
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class SegmentViewItem: NSObject {
return _view
}

public init(with icon: UIImage? = nil, iconRenderingMode: UIImage.RenderingMode? = nil, title: String? = nil, style: Style = .plain, titleTextStyle: UIFont.TextStyle? = nil, titleTextWeight: UIFont.Weight? = nil, linebreakMode: NSLineBreakMode? = nil, lines: [Line]? = nil, view: UIView? = nil, representedObject: AnyObject? = nil, weakRepresentedObject: AnyObject? = nil, gestureRecognizers: [UIGestureRecognizer]? = nil) {
public init(with icon: UIImage? = nil, iconRenderingMode: UIImage.RenderingMode? = nil, title: String? = nil, style: Style = .plain, titleTextStyle: UIFont.TextStyle? = nil, titleTextWeight: UIFont.Weight? = nil, linebreakMode: NSLineBreakMode? = nil, lines: [Line]? = nil, accessibilityLabel: String? = nil, view: UIView? = nil, representedObject: AnyObject? = nil, weakRepresentedObject: AnyObject? = nil, gestureRecognizers: [UIGestureRecognizer]? = nil) {
self.style = style

super.init()
Expand All @@ -90,6 +90,7 @@ public class SegmentViewItem: NSObject {
self.titleTextWeight = titleTextWeight
self.titleLinebreakMode = linebreakMode
self.lines = lines
self.accessibilityLabel = accessibilityLabel
self.embedView = view
self.representedObject = representedObject
self.weakRepresentedObject = weakRepresentedObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public class SegmentViewItemView: ThemeView, ThemeCSSAutoSelector {
iconView?.setContentHuggingPriority(.required, for: .vertical)
iconView?.setContentCompressionResistancePriority(.required, for: .horizontal)
iconView?.setContentCompressionResistancePriority(.required, for: .vertical)
if let accessibilityLabel = item.accessibilityLabel {
iconView?.isAccessibilityElement = true
iconView?.accessibilityLabel = accessibilityLabel
}
views.append(iconView!)
}

Expand Down

0 comments on commit 49045a8

Please sign in to comment.