Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6246,7 +6246,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand All @@ -6273,7 +6273,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 33.1.2;
MARKETING_VERSION = 33.1.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -6314,7 +6314,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand All @@ -6339,7 +6339,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 33.1.2;
MARKETING_VERSION = 33.1.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class NCMediaViewerFloatingTitleView: UIView {
private var navigationBarConstraints: [NSLayoutConstraint] = []
private var centerXConstraint: NSLayoutConstraint?
private var heightConstraint: NSLayoutConstraint?
private var lastLayoutWidth: CGFloat = 0

private let titleButton: UIButton = {
let button: UIButton
Expand Down Expand Up @@ -54,12 +55,25 @@ final class NCMediaViewerFloatingTitleView: UIView {
override func layoutSubviews() {
super.layoutSubviews()

guard bounds.width != lastLayoutWidth else {
return
}

lastLayoutWidth = bounds.width

let leadingInset = titleButton.configuration?.contentInsets.leading ?? 0
let trailingInset = titleButton.configuration?.contentInsets.trailing ?? 0

titleButton.titleLabel?.preferredMaxLayoutWidth = max(0, bounds.width - leadingInset - trailingInset)
titleButton.titleLabel?.numberOfLines = 1
titleButton.titleLabel?.lineBreakMode = .byTruncatingMiddle

var configuration = titleButton.configuration
configuration?.titleAlignment = .center
configuration?.titleLineBreakMode = .byTruncatingMiddle

titleButton.configuration = configuration
titleButton.titleLabel?.numberOfLines = 1

titleButton.invalidateIntrinsicContentSize()
}

func attach(to navigationBar: UINavigationBar, widthMultiplier: CGFloat = 0.36, verticalOffset: CGFloat = 0) {
Expand All @@ -80,7 +94,7 @@ final class NCMediaViewerFloatingTitleView: UIView {
topConstraint,
heightConstraint,
widthAnchor.constraint(
lessThanOrEqualTo: navigationBar.widthAnchor,
equalTo: navigationBar.widthAnchor,
multiplier: widthMultiplier
)
]
Expand All @@ -91,6 +105,7 @@ final class NCMediaViewerFloatingTitleView: UIView {
navigationBar.bringSubviewToFront(self)
updateNavigationItemHeight()
updateHorizontalAlignment()
setNeedsLayout()
}

func updateHorizontalAlignment() {
Expand Down Expand Up @@ -146,6 +161,9 @@ final class NCMediaViewerFloatingTitleView: UIView {
}
titleButton.configuration = configuration

lastLayoutWidth = 0
setNeedsLayout()

isHidden = primaryText?.isEmpty ?? true

accessibilityLabel = [
Expand Down
Loading