Skip to content
Open
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
4 changes: 2 additions & 2 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6667,7 +6667,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down Expand Up @@ -6735,7 +6735,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 102 additions & 4 deletions iOSClient/Main/NCPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class NCPhotosPickerViewController: NSObject {
configure.selectedColor = NCBrandColor.shared.getElement(account: controller.account)
configure.singleSelectedMode = singleSelectedMode
configure.allowedAlbumCloudShared = true
var dateScrubber = TLDateScrubberConfigure()
dateScrubber.minimumContentScreens = 2
if #available(iOS 26.0, *) {
dateScrubber.thumbColor = UIColor.secondarySystemBackground.withAlphaComponent(0.78)
dateScrubber.labelBackgroundColor = UIColor.secondarySystemBackground.withAlphaComponent(0.88)
dateScrubber.labelTextColor = .label
}
configure.dateScrubber = dateScrubber

pickerVC = customPhotoPickerViewController(withTLPHAssets: { assets in
pickerVC?.dismiss(animated: true) {
Expand Down Expand Up @@ -112,6 +120,8 @@ class NCPhotosPickerViewController: NSObject {
class customPhotoPickerViewController: TLPhotosPickerViewController {

var ncController: NCMainTabBarController?
private let navigationSymbolConfiguration = UIImage.SymbolConfiguration(pointSize: 14, weight: .medium)
private let navigationVerticalPadding: CGFloat = 10

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
Expand All @@ -124,19 +134,104 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
self.customNavItem.leftBarButtonItem?.tintColor = NCBrandColor.shared.iconImageColor
self.customNavItem.rightBarButtonItem?.tintColor = NCBrandColor.shared.iconImageColor
if #available(iOS 26.0, *) {
doneButton.image = UIImage(systemName: "checkmark")
cancelButton.image = UIImage(systemName: "xmark")
navigationBarTopConstraint.constant = self.navigationBarTopConstraint.constant + 10
doneButton.image = UIImage(systemName: "checkmark", withConfiguration: navigationSymbolConfiguration)
doneButton.accessibilityLabel = configure.doneTitle
configureAlbumTitleBackground()
configureAlbumPopupBackground()
configureNavigationScrollEdge()
}
}

@available(iOS 26.0, *)
private func configureAlbumPopupBackground() {
guard let popup = albumPopView.popupView else { return }
let corners = UICornerConfiguration.uniformCorners(radius: .fixed(24))
popup.backgroundColor = .clear
popup.cornerConfiguration = corners
albumPopView.tableView.backgroundColor = .clear
popArrowImageView.isHidden = true

let background = UIVisualEffectView(effect: UIGlassEffect(style: .regular))
background.cornerConfiguration = corners
background.isUserInteractionEnabled = false
background.translatesAutoresizingMaskIntoConstraints = false
popup.insertSubview(background, at: 0)

NSLayoutConstraint.activate([
background.leadingAnchor.constraint(equalTo: popup.leadingAnchor),
background.trailingAnchor.constraint(equalTo: popup.trailingAnchor),
background.topAnchor.constraint(equalTo: popup.topAnchor),
background.bottomAnchor.constraint(equalTo: popup.bottomAnchor)
])
}

@available(iOS 26.0, *)
private func configureAlbumTitleBackground() {
let background = UIVisualEffectView(effect: UIGlassEffect(style: .regular))
background.cornerConfiguration = .capsule()
background.isUserInteractionEnabled = false
background.translatesAutoresizingMaskIntoConstraints = false
titleView.insertSubview(background, at: 0)

NSLayoutConstraint.activate([
background.leadingAnchor.constraint(equalTo: titleView.leadingAnchor, constant: -10),
background.trailingAnchor.constraint(equalTo: titleView.trailingAnchor, constant: 10),
background.topAnchor.constraint(equalTo: titleView.topAnchor),
background.bottomAnchor.constraint(equalTo: titleView.bottomAnchor)
])
}

@available(iOS 26.0, *)
private func configureNavigationScrollEdge() {
guard let collectionTopConstraint = view.constraints.first(where: {
$0.firstItem === collectionView && $0.firstAttribute == .top &&
$0.secondItem === navigationBar && $0.secondAttribute == .bottom
}) else { return }

// The picker XIB starts the grid below the navigation bar.
collectionTopConstraint.isActive = false
collectionView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
navigationBarTopConstraint.constant = navigationVerticalPadding
navigationBar.isTranslucent = true
view.bringSubviewToFront(navigationBar)

collectionView.topEdgeEffect.style = .soft
let interaction = UIScrollEdgeElementContainerInteraction()
interaction.scrollView = collectionView
interaction.edge = .top
navigationBar.addInteraction(interaction)
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
applyCustomButtons()
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
if #available(iOS 26.0, *), let albumCell = cell as? TLCollectionTableViewCell {
albumCell.backgroundColor = .clear
albumCell.contentView.backgroundColor = .clear
albumCell.subTitleLabel.textColor = .secondaryLabel
albumCell.thumbImageView.layer.cornerRadius = 10
albumCell.thumbImageView.layer.cornerCurve = .continuous
albumCell.thumbImageView.clipsToBounds = true
}
return cell
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if #available(iOS 26.0, *), navigationBar.isTranslucent {
let topInset = navigationBar.frame.maxY - view.safeAreaInsets.top + navigationVerticalPadding
if collectionView.contentInset.top != topInset {
let isAtTop = collectionView.contentOffset.y <= -collectionView.adjustedContentInset.top + 1
collectionView.contentInset.top = topInset
if isAtTop && !collectionView.isDragging {
collectionView.contentOffset.y = -collectionView.adjustedContentInset.top
}
}
}
applyCustomButtons()
}

Expand All @@ -154,6 +249,10 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
action: #selector(customAction)
)
closeBtn.tintColor = NCBrandColor.shared.iconImageColor
closeBtn.accessibilityLabel = configure.cancelTitle
if #available(iOS 26.0, *) {
closeBtn.image = UIImage(systemName: "xmark", withConfiguration: navigationSymbolConfiguration)
}

var leftItems: [UIBarButtonItem] = [closeBtn]

Expand Down Expand Up @@ -195,7 +294,6 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
// MARK: - Document Picker

class NCDocumentPickerViewController: NSObject, UIDocumentPickerDelegate {

let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
let utilityFileSystem = NCUtilityFileSystem()
let database = NCManageDatabase.shared
Expand Down
Loading