[WIP] Stickers

This commit is contained in:
Ilya Laktyushin
2024-03-16 15:36:51 +04:00
parent db1d4422cb
commit bb1b425217
32 changed files with 1272 additions and 282 deletions

View File

@@ -2113,6 +2113,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
let mode: ContactMultiselectionControllerMode
if case let .chatList(peerIds) = source {
//TODO:localize
mode = .premiumGifting(topSectionTitle: "🎂 BIRTHDAY TODAY", topSectionPeers: peerIds)
} else {
mode = .premiumGifting(topSectionTitle: nil, topSectionPeers: [])
@@ -2317,7 +2318,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, @escaping () -> Void) -> 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 {
@@ -2326,8 +2327,12 @@ public final class SharedAccountContextImpl: SharedAccountContext {
} else if let asset = source as? PHAsset {
subject = .asset(asset)
mode = .addingToPack
} else if let image = source as? UIImage {
subject = .image(image, PixelDimensions(image.size), nil, .bottomRight)
mode = .addingToPack
} else {
fatalError()
subject = .empty(PixelDimensions(width: 1080, height: 1920))
mode = .addingToPack
}
let controller = MediaEditorScreen(
context: context,
@@ -2368,7 +2373,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
return storyMediaPickerController(context: context, getSourceRect: getSourceRect, completion: completion, dismissed: dismissed, groupsPresented: groupsPresented)
}
public func makeStickerMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any, UIView, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController {
public func makeStickerMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any?, UIView?, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController {
return stickerMediaPickerController(context: context, getSourceRect: getSourceRect, completion: completion, dismissed: dismissed)
}