[WIP] Stickers editor

This commit is contained in:
Ilya Laktyushin
2024-03-15 10:55:40 +04:00
parent bd8d299a58
commit 6906df0243
31 changed files with 381 additions and 140 deletions

View File

@@ -2110,7 +2110,15 @@ public final class SharedAccountContextImpl: SharedAccountContext {
let limit: Int32 = 10
var reachedLimitImpl: ((Int32) -> Void)?
let controller = context.sharedContext.makeContactMultiselectionController(ContactMultiselectionControllerParams(context: context, mode: .premiumGifting, options: [], isPeerEnabled: { peer in
let mode: ContactMultiselectionControllerMode
if case let .chatList(peerIds) = source {
mode = .premiumGifting(topSectionTitle: "🎂 BIRTHDAY TODAY", topSectionPeers: peerIds)
} else {
mode = .premiumGifting(topSectionTitle: nil, topSectionPeers: [])
}
let controller = context.sharedContext.makeContactMultiselectionController(ContactMultiselectionControllerParams(context: context, mode: mode, options: [], isPeerEnabled: { peer in
if case let .user(user) = peer, user.botInfo == nil && !peer.isService && !user.flags.contains(.isSupport) {
return true
} else {
@@ -2309,7 +2317,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
return StickerPackScreen(context: context, updatedPresentationData: updatedPresentationData, mainStickerPack: mainStickerPack, stickerPacks: stickerPacks, loadedStickerPacks: loadedStickerPacks, isEditing: isEditing, parentNavigationController: parentNavigationController, sendSticker: sendSticker)
}
public func makeStickerEditorScreen(context: AccountContext, source: Any, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile) -> Void) -> ViewController {
public func makeStickerEditorScreen(context: AccountContext, source: Any, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, @escaping () -> Void) -> Void) -> ViewController {
let subject: MediaEditorScreen.Subject
let mode: MediaEditorScreen.Mode.StickerEditorMode
if let file = source as? TelegramMediaFile {
@@ -2342,9 +2350,10 @@ public final class SharedAccountContextImpl: SharedAccountContext {
}
return nil
}, completion: { result, commit in
commit({})
if case let .sticker(file) = result.media {
completion(file)
completion(file, {
commit({})
})
}
} as (MediaEditorScreen.Result, @escaping (@escaping () -> Void) -> Void) -> Void
)