Various fixes

This commit is contained in:
Ilya Laktyushin 2026-03-27 01:46:27 +01:00
parent ed55943a44
commit a1c4e02a06
5 changed files with 6 additions and 6 deletions

View file

@ -66,7 +66,7 @@ public enum LegacyICloudFilePickerMode {
}
}
public func legacyICloudFilePicker(theme: PresentationTheme, mode: LegacyICloudFilePickerMode = .default, url: URL? = nil, documentTypes: [String] = ["public.item"], forceDarkTheme: Bool = false, dismissed: @escaping () -> Void = {}, completion: @escaping ([URL]) -> Void) -> ViewController {
public func legacyICloudFilePicker(theme: PresentationTheme, mode: LegacyICloudFilePickerMode = .default, hasMultiselection: Bool = false, url: URL? = nil, documentTypes: [String] = ["public.item"], forceDarkTheme: Bool = false, dismissed: @escaping () -> Void = {}, completion: @escaping ([URL]) -> Void) -> ViewController {
var dismissImpl: (() -> Void)?
let legacyController = LegacyICloudFileController(presentation: .modal(animateIn: true), theme: theme, completion: { urls in
dismissImpl?()
@ -89,7 +89,7 @@ public func legacyICloudFilePicker(theme: PresentationTheme, mode: LegacyICloudF
dismissImpl?()
}
controller.delegate = legacyController
if #available(iOSApplicationExtension 11.0, iOS 11.0, *), case .default = mode {
if #available(iOSApplicationExtension 11.0, iOS 11.0, *), hasMultiselection {
controller.allowsMultipleSelection = true
}

View file

@ -152,7 +152,7 @@ public func presentPollAttachmentScreen(
attachmentController?.dismiss(animated: true)
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
let controller = legacyICloudFilePicker(theme: presentationData.theme, mode: .import, documentTypes: ["public.item"], completion: { urls in
let controller = legacyICloudFilePicker(theme: presentationData.theme, documentTypes: ["public.item"], completion: { urls in
guard let url = urls.first else {
return
}

View file

@ -2496,7 +2496,7 @@ final class StoryItemSetContainerSendMessage: @unchecked(Sendable) {
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
component.controller()?.present(legacyICloudFilePicker(theme: presentationData.theme, completion: { [weak self, weak view] urls in
component.controller()?.present(legacyICloudFilePicker(theme: presentationData.theme, hasMultiselection: true, completion: { [weak self, weak view] urls in
if let strongSelf = self, let view, !urls.isEmpty {
var signals: [Signal<ICloudFileDescription?, NoError>] = []
for url in urls {

View file

@ -1201,7 +1201,7 @@ extension ChatControllerImpl {
let (accountPeer, limits, premiumLimits) = result
let isPremium = accountPeer?.isPremium ?? false
strongSelf.present(legacyICloudFilePicker(theme: strongSelf.presentationData.theme, documentTypes: documentTypes, completion: { [weak self] urls in
strongSelf.present(legacyICloudFilePicker(theme: strongSelf.presentationData.theme, hasMultiselection: true, documentTypes: documentTypes, completion: { [weak self] urls in
if let strongSelf = self, !urls.isEmpty {
var signals: [Signal<ICloudFileDescription?, NoError>] = []
for url in urls {

View file

@ -33,7 +33,7 @@ private func generateBackground(theme: PresentationTheme) -> UIImage? {
return generateImage(CGSize(width: 20.0, height: 10.0 + 8.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setShadow(offset: CGSize(width: 0.0, height: -4.0), blur: 30.0, color: UIColor(white: 0.0, alpha: 0.2).cgColor)
context.setFillColor(theme.list.plainBackgroundColor.cgColor)
context.setFillColor(theme.list.modalPlainBackgroundColor.cgColor)
context.fill(CGRect(origin: CGPoint(x: 0.0, y: 8.0), size: CGSize(width: 20.0, height: 20.0)))
})?.stretchableImage(withLeftCapWidth: 10, topCapHeight: 10 + 8)
}