diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 43278c91f9..def75aab30 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -33,9 +33,8 @@ class NCFiles: NCCollectionViewCommon { if let userInfo = notification.userInfo, let account = userInfo["account"] as? String, self.controller?.account == account { - // (+) - self.mainNavigationController?.menuPlusButton.backgroundColor = NCBrandColor.shared.getElement(account: account) - self.mainNavigationController?.menuPlusButton.tintColor = .white + // re-tint the + button + self.mainNavigationController?.menuPlusButton.setPlusButtonColor(NCBrandColor.shared.getElement(account: account)) } } } @@ -64,9 +63,8 @@ class NCFiles: NCCollectionViewCommon { } if let userInfo = notification.userInfo, let account = userInfo["account"] as? String { - // (+) - self.mainNavigationController?.menuPlusButton.backgroundColor = NCBrandColor.shared.getElement(account: account) - self.mainNavigationController?.menuPlusButton.tintColor = .white + // re-tint the + button for the new account + self.mainNavigationController?.menuPlusButton.setPlusButtonColor(NCBrandColor.shared.getElement(account: account)) } self.navigationController?.popToRootViewController(animated: false) @@ -144,11 +142,9 @@ class NCFiles: NCCollectionViewCommon { // disable + button if no create permission let color = NCBrandColor.shared.getElement(account: self.session.account) - // (+) if let menuPlusButton = self.mainNavigationController?.menuPlusButton { menuPlusButton.isEnabled = metadataFolder.isCreatable - menuPlusButton.backgroundColor = metadataFolder.isCreatable ? color : .lightGray - menuPlusButton.tintColor = .white + menuPlusButton.setPlusButtonColor(metadataFolder.isCreatable ? color : .lightGray) } } diff --git a/iOSClient/Main/NCMainNavigationController.swift b/iOSClient/Main/NCMainNavigationController.swift index 10c8041a5c..e4b9979b6a 100644 --- a/iOSClient/Main/NCMainNavigationController.swift +++ b/iOSClient/Main/NCMainNavigationController.swift @@ -116,19 +116,26 @@ class NCMainNavigationController: UINavigationController, UINavigationController // PLUS BUTTON MENU let buttonSize: CGFloat = 44 - let plusConfiguration = UIImage.SymbolConfiguration(pointSize: 22, weight: .regular) + let plusConfiguration = UIImage.SymbolConfiguration(pointSize: 18, weight: .regular) let plusImage = UIImage(systemName: "plus", withConfiguration: plusConfiguration)?.withRenderingMode(.alwaysTemplate) - menuPlusButton.setImage(plusImage, for: .normal) - menuPlusButton.tintColor = .white - menuPlusButton.contentHorizontalAlignment = .center - menuPlusButton.contentVerticalAlignment = .center - menuPlusButton.backgroundColor = NCBrandColor.shared.getElement(account: session.account) - menuPlusButton.layer.cornerRadius = buttonSize / 2 - menuPlusButton.layer.masksToBounds = false - menuPlusButton.layer.shadowColor = UIColor.black.cgColor - menuPlusButton.layer.shadowOpacity = 0.18 - menuPlusButton.layer.shadowRadius = 8 - menuPlusButton.layer.shadowOffset = CGSize(width: 0, height: 4) + + if #available(iOS 26.0, *) { + var glassConfiguration = UIButton.Configuration.prominentGlass() + glassConfiguration.image = plusImage + menuPlusButton.configuration = glassConfiguration + } else { + menuPlusButton.setImage(plusImage, for: .normal) + menuPlusButton.contentHorizontalAlignment = .center + menuPlusButton.contentVerticalAlignment = .center + menuPlusButton.layer.cornerRadius = buttonSize / 2 + menuPlusButton.layer.masksToBounds = false + menuPlusButton.layer.shadowColor = UIColor.black.cgColor + menuPlusButton.layer.shadowOpacity = 0.18 + menuPlusButton.layer.shadowRadius = 8 + menuPlusButton.layer.shadowOffset = CGSize(width: 0, height: 4) + } + + menuPlusButton.setPlusButtonColor(NCBrandColor.shared.getElement(account: session.account)) menuPlusButton.showsMenuAsPrimaryAction = true menuPlusButton.translatesAutoresizingMaskIntoConstraints = false menuPlusButton.accessibilityLabel = NSLocalizedString("_add_", comment: "") @@ -443,3 +450,14 @@ class NCMainNavigationController: UINavigationController, UINavigationController } } } + +extension UIButton { + func setPlusButtonColor(_ color: UIColor) { + if #available(iOS 26.0, *) { + tintColor = color + } else { + backgroundColor = color + tintColor = .white + } + } +} diff --git a/iOSClient/Menu/NCContextMenuPlus.swift b/iOSClient/Menu/NCContextMenuPlus.swift index f8871856a0..094f644a4f 100644 --- a/iOSClient/Menu/NCContextMenuPlus.swift +++ b/iOSClient/Menu/NCContextMenuPlus.swift @@ -434,8 +434,7 @@ class NCContextMenuPlus: NSObject { menuPlusButton.menu = plusMenu menuPlusButton.showsMenuAsPrimaryAction = true - menuPlusButton.backgroundColor = NCBrandColor.shared.getElement(account: session.account) - menuPlusButton.tintColor = .white + menuPlusButton.setPlusButtonColor(NCBrandColor.shared.getElement(account: session.account)) menuPlusButton.alpha = 1 // E2EE Offline disable