From b38473022e9ad7776ce7fb4a1676fcc988b3e3e4 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 23 Feb 2022 20:52:55 +0300 Subject: [PATCH] Attachment menu improvements --- .../Sources/AttachmentController.swift | 3 ++- .../Sources/LegacyMediaPickerGallery.swift | 9 +++++---- .../Sources/PeerReportController.swift | 2 +- .../ReportPersonal.imageset/Contents.json | 20 +++++++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 submodules/TelegramUI/Images.xcassets/Chat/Context Menu/ReportPersonal.imageset/Contents.json diff --git a/submodules/AttachmentUI/Sources/AttachmentController.swift b/submodules/AttachmentUI/Sources/AttachmentController.swift index 95c5d74c56..d2b9df3430 100644 --- a/submodules/AttachmentUI/Sources/AttachmentController.swift +++ b/submodules/AttachmentUI/Sources/AttachmentController.swift @@ -220,6 +220,7 @@ public class AttachmentController: ViewController { guard self.currentType != type else { if let controller = self.currentController { controller.scrollToTopWithTabBar?() + controller.requestAttachmentMenuExpansion() } return } @@ -255,7 +256,7 @@ public class AttachmentController: ViewController { strongSelf.container.container.view.layer.animatePosition(from: CGPoint(x: ascending ? 70.0 : -70.0, y: 0.0), to: CGPoint(), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, additive: true) snapshotView?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { [weak snapshotView] _ in snapshotView?.removeFromSuperview() - previousController?.prepareForReuse() + previousController?.resetForReuse() }) }) } diff --git a/submodules/MediaPickerUI/Sources/LegacyMediaPickerGallery.swift b/submodules/MediaPickerUI/Sources/LegacyMediaPickerGallery.swift index 85e8baf38b..f999855e59 100644 --- a/submodules/MediaPickerUI/Sources/LegacyMediaPickerGallery.swift +++ b/submodules/MediaPickerUI/Sources/LegacyMediaPickerGallery.swift @@ -193,7 +193,7 @@ func presentLegacyMediaPickerGallery(context: AccountContext, peer: EnginePeer?, model.interfaceView.doneLongPressed = { [weak selectionContext, weak editingContext, weak legacyController, weak model] item in if let legacyController = legacyController, let item = item as? TGMediaPickerGalleryItem, let model = model, let selectionContext = selectionContext { var effectiveHasSchedule = hasSchedule - + if let editingContext = editingContext { for item in selectionContext.selectedItems() { if let editableItem = item as? TGMediaEditableItem, let timer = editingContext.timer(for: editableItem)?.intValue, timer > 0 { @@ -202,9 +202,8 @@ func presentLegacyMediaPickerGallery(context: AccountContext, peer: EnginePeer?, } } } - + let legacySheetController = LegacyController(presentation: .custom, theme: presentationData.theme, initialLayout: nil) - let controller = TGMediaPickerSendActionSheetController(context: legacyController.context, isDark: true, sendButtonFrame: model.interfaceView.doneButtonFrame, canSendSilently: hasSilentPosting, canSchedule: effectiveHasSchedule, reminder: reminder, hasTimer: hasTimer) let dismissImpl = { [weak model] in model?.dismiss(true, false) @@ -241,8 +240,10 @@ func presentLegacyMediaPickerGallery(context: AccountContext, peer: EnginePeer?, legacySheetController?.dismiss() } legacySheetController.bind(controller: controller) - present(legacySheetController, nil) + + let hapticFeedback = HapticFeedback() + hapticFeedback.impact() } } model.interfaceView.setThumbnailSignalForItem { item in diff --git a/submodules/PeerInfoUI/Sources/PeerReportController.swift b/submodules/PeerInfoUI/Sources/PeerReportController.swift index 99497fe7a6..a8c0e71276 100644 --- a/submodules/PeerInfoUI/Sources/PeerReportController.swift +++ b/submodules/PeerInfoUI/Sources/PeerReportController.swift @@ -66,7 +66,7 @@ public func presentPeerReportOptions(context: AccountContext, parent: ViewContro icon = UIImage(bundleImageName: "Chat/Context Menu/ReportDrugs") case .personalDetails: title = presentationData.strings.ReportPeer_ReasonPersonalDetails - icon = UIImage(bundleImageName: "Chat/Context Menu/User") + icon = UIImage(bundleImageName: "Chat/Context Menu/ReportPersonal") case .other: title = presentationData.strings.ReportPeer_ReasonOther icon = UIImage(bundleImageName: "Chat/Context Menu/Report") diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/ReportPersonal.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/ReportPersonal.imageset/Contents.json new file mode 100644 index 0000000000..a19a549220 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/ReportPersonal.imageset/Contents.json @@ -0,0 +1,20 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +}