Attachment menu improvements

This commit is contained in:
Ilya Laktyushin 2022-02-23 20:52:55 +03:00
parent 4d538a0615
commit b38473022e
4 changed files with 28 additions and 6 deletions

View File

@ -220,6 +220,7 @@ public class AttachmentController: ViewController {
guard self.currentType != type else { guard self.currentType != type else {
if let controller = self.currentController { if let controller = self.currentController {
controller.scrollToTopWithTabBar?() controller.scrollToTopWithTabBar?()
controller.requestAttachmentMenuExpansion()
} }
return 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) 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?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { [weak snapshotView] _ in
snapshotView?.removeFromSuperview() snapshotView?.removeFromSuperview()
previousController?.prepareForReuse() previousController?.resetForReuse()
}) })
}) })
} }

View File

@ -193,7 +193,7 @@ func presentLegacyMediaPickerGallery(context: AccountContext, peer: EnginePeer?,
model.interfaceView.doneLongPressed = { [weak selectionContext, weak editingContext, weak legacyController, weak model] item in 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 { if let legacyController = legacyController, let item = item as? TGMediaPickerGalleryItem, let model = model, let selectionContext = selectionContext {
var effectiveHasSchedule = hasSchedule var effectiveHasSchedule = hasSchedule
if let editingContext = editingContext { if let editingContext = editingContext {
for item in selectionContext.selectedItems() { for item in selectionContext.selectedItems() {
if let editableItem = item as? TGMediaEditableItem, let timer = editingContext.timer(for: editableItem)?.intValue, timer > 0 { 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 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 controller = TGMediaPickerSendActionSheetController(context: legacyController.context, isDark: true, sendButtonFrame: model.interfaceView.doneButtonFrame, canSendSilently: hasSilentPosting, canSchedule: effectiveHasSchedule, reminder: reminder, hasTimer: hasTimer)
let dismissImpl = { [weak model] in let dismissImpl = { [weak model] in
model?.dismiss(true, false) model?.dismiss(true, false)
@ -241,8 +240,10 @@ func presentLegacyMediaPickerGallery(context: AccountContext, peer: EnginePeer?,
legacySheetController?.dismiss() legacySheetController?.dismiss()
} }
legacySheetController.bind(controller: controller) legacySheetController.bind(controller: controller)
present(legacySheetController, nil) present(legacySheetController, nil)
let hapticFeedback = HapticFeedback()
hapticFeedback.impact()
} }
} }
model.interfaceView.setThumbnailSignalForItem { item in model.interfaceView.setThumbnailSignalForItem { item in

View File

@ -66,7 +66,7 @@ public func presentPeerReportOptions(context: AccountContext, parent: ViewContro
icon = UIImage(bundleImageName: "Chat/Context Menu/ReportDrugs") icon = UIImage(bundleImageName: "Chat/Context Menu/ReportDrugs")
case .personalDetails: case .personalDetails:
title = presentationData.strings.ReportPeer_ReasonPersonalDetails title = presentationData.strings.ReportPeer_ReasonPersonalDetails
icon = UIImage(bundleImageName: "Chat/Context Menu/User") icon = UIImage(bundleImageName: "Chat/Context Menu/ReportPersonal")
case .other: case .other:
title = presentationData.strings.ReportPeer_ReasonOther title = presentationData.strings.ReportPeer_ReasonOther
icon = UIImage(bundleImageName: "Chat/Context Menu/Report") icon = UIImage(bundleImageName: "Chat/Context Menu/Report")

View File

@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}