Upgrade peek controller to modern context menu implementation

This commit is contained in:
Ilya Laktyushin
2021-05-07 21:16:24 +04:00
parent b1e91b3c72
commit 4a465a5893
42 changed files with 728 additions and 981 deletions

View File

@@ -17,7 +17,7 @@ swift_library(
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/ShareController:ShareController",
"//submodules/ItemListUI:ItemListUI",
"//submodules/ItemListUI:ItemListUI",
"//submodules/StickerResources:StickerResources",
"//submodules/AlertUI:AlertUI",
"//submodules/PresentationDataUtils:PresentationDataUtils",
@@ -28,6 +28,7 @@ swift_library(
"//submodules/TelegramAnimatedStickerNode:TelegramAnimatedStickerNode",
"//submodules/ShimmerEffect:ShimmerEffect",
"//submodules/UndoUI:UndoUI",
"//submodules/ContextUI:ContextUI",
],
visibility = [
"//visibility:public",

View File

@@ -12,6 +12,7 @@ import MergeLists
import ActivityIndicator
import TextFormat
import AccountContext
import ContextUI
private struct StickerPackPreviewGridEntry: Comparable, Identifiable {
let index: Int
@@ -189,7 +190,7 @@ final class ImportStickerPackControllerNode: ViewControllerTracingNode, UIScroll
return nil
}, present: { [weak self] content, sourceNode in
if let strongSelf = self {
let controller = PeekController(theme: PeekControllerTheme(presentationTheme: strongSelf.presentationData.theme), content: content, sourceNode: {
let controller = PeekController(presentationData: strongSelf.presentationData, content: content, sourceNode: {
return sourceNode
})
controller.visibilityUpdated = { [weak self] visible in

View File

@@ -9,13 +9,14 @@ import SwiftSignalKit
import StickerResources
import AnimatedStickerNode
import TelegramAnimatedStickerNode
import ContextUI
public final class StickerPreviewPeekContent: PeekControllerContent {
let account: Account
public let item: ImportStickerPack.Sticker
let menu: [PeekControllerMenuItem]
let menu: [ContextMenuItem]
public init(account: Account, item: ImportStickerPack.Sticker, menu: [PeekControllerMenuItem]) {
public init(account: Account, item: ImportStickerPack.Sticker, menu: [ContextMenuItem]) {
self.account = account
self.item = item
self.menu = menu
@@ -25,11 +26,11 @@ public final class StickerPreviewPeekContent: PeekControllerContent {
return .freeform
}
public func menuActivation() -> PeerkControllerMenuActivation {
public func menuActivation() -> PeerControllerMenuActivation {
return .press
}
public func menuItems() -> [PeekControllerMenuItem] {
public func menuItems() -> [ContextMenuItem] {
return self.menu
}