mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-02 02:43:07 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
914c9934fd
@ -10792,8 +10792,6 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = pane
|
|
||||||
|
|
||||||
var items: [ContextMenuItem] = []
|
var items: [ContextMenuItem] = []
|
||||||
|
|
||||||
let strings = self.presentationData.strings
|
let strings = self.presentationData.strings
|
||||||
@ -10831,14 +10829,16 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: "Select", icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: "Select", icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.contextMenu.primaryColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, a in
|
}, action: { [weak pane] _, a in
|
||||||
if ignoreNextActions {
|
if ignoreNextActions {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ignoreNextActions = true
|
ignoreNextActions = true
|
||||||
a(.default)
|
a(.default)
|
||||||
|
|
||||||
let _ = self
|
if let pane {
|
||||||
|
pane.setIsSelectionModeActive(true)
|
||||||
|
}
|
||||||
})))
|
})))
|
||||||
|
|
||||||
let contextController = ContextController(presentationData: self.presentationData, source: .reference(PeerInfoContextReferenceContentSource(controller: controller, sourceNode: source)), items: .single(ContextController.Items(content: .list(items))), gesture: gesture)
|
let contextController = ContextController(presentationData: self.presentationData, source: .reference(PeerInfoContextReferenceContentSource(controller: controller, sourceNode: source)), items: .single(ContextController.Items(content: .list(items))), gesture: gesture)
|
||||||
|
@ -3132,7 +3132,7 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||||||
parentController.cancelItemSelection()
|
parentController.cancelItemSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = self.context.engine.messages.deleteBotPreviews(peerId: peerId, ids: mappedItemIds)
|
let _ = self.context.engine.messages.deleteBotPreviews(peerId: peerId, ids: mappedItemIds).startStandalone()
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
||||||
@ -3459,6 +3459,52 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, ASScr
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
|
let selectionPanelSize = selectionPanel.update(
|
||||||
|
transition: selectionPanelTransition,
|
||||||
|
component: AnyComponent(BottomActionsPanelComponent(
|
||||||
|
theme: presentationData.theme,
|
||||||
|
insets: UIEdgeInsets(top: 0.0, left: sideInset, bottom: bottomInset, right: sideInset),
|
||||||
|
items: selectionItems
|
||||||
|
)),
|
||||||
|
environment: {},
|
||||||
|
containerSize: size
|
||||||
|
)
|
||||||
|
let selectionPanelFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - selectionPanelSize.height), size: selectionPanelSize)
|
||||||
|
if let selectionPanelView = selectionPanel.view {
|
||||||
|
if selectionPanelView.superview == nil {
|
||||||
|
self.view.addSubview(selectionPanelView)
|
||||||
|
transition.animatePositionAdditive(layer: selectionPanelView.layer, offset: CGPoint(x: 0.0, y: selectionPanelFrame.height))
|
||||||
|
}
|
||||||
|
selectionPanelTransition.setFrame(view: selectionPanelView, frame: selectionPanelFrame)
|
||||||
|
}
|
||||||
|
bottomInset = selectionPanelSize.height
|
||||||
|
} else if self.isProfileEmbedded, let selectedIds = self.itemInteraction.selectedIds, self.canManageStories, case .botPreview = self.scope {
|
||||||
|
let selectionPanel: ComponentView<Empty>
|
||||||
|
var selectionPanelTransition = ComponentTransition(transition)
|
||||||
|
if let current = self.selectionPanel {
|
||||||
|
selectionPanel = current
|
||||||
|
} else {
|
||||||
|
selectionPanelTransition = selectionPanelTransition.withAnimation(.none)
|
||||||
|
selectionPanel = ComponentView()
|
||||||
|
self.selectionPanel = selectionPanel
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectionItems: [BottomActionsPanelComponent.Item] = []
|
||||||
|
|
||||||
|
selectionItems.append(BottomActionsPanelComponent.Item(
|
||||||
|
id: "delete",
|
||||||
|
color: .destructive,
|
||||||
|
title: presentationData.strings.StoryList_ActionPanel_Delete,
|
||||||
|
isEnabled: !selectedIds.isEmpty,
|
||||||
|
action: { [weak self] in
|
||||||
|
guard let self, let selectedIds = self.itemInteraction.selectedIds else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.presentDeleteConfirmation(ids: selectedIds)
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
let selectionPanelSize = selectionPanel.update(
|
let selectionPanelSize = selectionPanel.update(
|
||||||
transition: selectionPanelTransition,
|
transition: selectionPanelTransition,
|
||||||
component: AnyComponent(BottomActionsPanelComponent(
|
component: AnyComponent(BottomActionsPanelComponent(
|
||||||
@ -4054,7 +4100,9 @@ private final class BottomActionsPanelComponent: Component {
|
|||||||
|
|
||||||
let itemCenterX: CGFloat = CGFloat(i) * (floor((availableSize.width - sideInset * 2.0) / CGFloat(itemsAndSizes.count - 1)))
|
let itemCenterX: CGFloat = CGFloat(i) * (floor((availableSize.width - sideInset * 2.0) / CGFloat(itemsAndSizes.count - 1)))
|
||||||
let itemX: CGFloat
|
let itemX: CGFloat
|
||||||
if i == 0 {
|
if itemsAndSizes.count == 1 {
|
||||||
|
itemX = floor((availableSize.width - itemSize.width) * 0.5)
|
||||||
|
} else if i == 0 {
|
||||||
itemX = sideInset
|
itemX = sideInset
|
||||||
} else if i == itemsAndSizes.count - 1 {
|
} else if i == itemsAndSizes.count - 1 {
|
||||||
itemX = availableSize.width - sideInset - itemSize.width
|
itemX = availableSize.width - sideInset - itemSize.width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user