Various fixes

This commit is contained in:
Ilya Laktyushin 2023-11-10 22:54:08 +04:00
parent 11d8158a62
commit b91f49d1cf
3 changed files with 29 additions and 16 deletions

View File

@ -1258,6 +1258,7 @@ public class StickerPickerScreen: ViewController {
guard let self, let controller = self.controller, let file = item.itemFile else {
return
}
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
if groupId == AnyHashable("featuredTop") {
let viewKey = PostboxViewKey.orderedItemList(id: Namespaces.OrderedItemList.CloudFeaturedStickerPacks)
let _ = (controller.context.account.postbox.combinedView(keys: [viewKey])
@ -1268,10 +1269,11 @@ public class StickerPickerScreen: ViewController {
}
for featuredStickerPack in view.items.lazy.map({ $0.contents.get(FeaturedStickerPackItem.self)! }) {
if featuredStickerPack.topItems.contains(where: { $0.file.fileId == file.fileId }) {
controller.push(FeaturedStickersScreen(
controller.pushController(FeaturedStickersScreen(
context: controller.context,
highlightedPackId: featuredStickerPack.info.id,
forceTheme: defaultDarkPresentationTheme,
forceTheme: defaultDarkColorPresentationTheme,
stickerActionTitle: presentationData.strings.StickerPack_AddSticker,
sendSticker: { [weak self] fileReference, _, _ in
guard let self, let controller = self.controller else {
return false
@ -2089,13 +2091,6 @@ private final class InteractiveStickerButtonContent: Component {
}
func update(component: InteractiveStickerButtonContent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
// if component.useOpaqueTheme {
// self.backgroundLayer.backgroundColor = component.theme.chat.inputMediaPanel.panelContentControlOpaqueSelectionColor.cgColor
// self.tintBackgroundLayer.backgroundColor = UIColor.white.cgColor
// } else {
// self.backgroundLayer.backgroundColor = component.theme.chat.inputMediaPanel.panelContentControlVibrantSelectionColor.cgColor
// self.tintBackgroundLayer.backgroundColor = UIColor(white: 1.0, alpha: 0.2).cgColor
// }
self.backgroundLayer.backgroundColor = UIColor(rgb: 0xffffff, alpha: 0.11).cgColor
let iconSize = self.icon.update(

View File

@ -319,7 +319,7 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode {
if let strongSelf = self, let info = info as? StickerPackCollectionInfo {
strongSelf.view.window?.endEditing(true)
let packReference: StickerPackReference = .id(id: info.id.id, accessHash: info.accessHash)
let controller = StickerPackScreen(context: strongSelf.context, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { fileReference, sourceNode, sourceRect in
let controller = StickerPackScreen(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, mainStickerPack: packReference, stickerPacks: [packReference], actionTitle: strongSelf.controller?.stickerActionTitle, parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { fileReference, sourceNode, sourceRect in
if let strongSelf = self {
return strongSelf.sendSticker?(fileReference, sourceNode, sourceRect) ?? false
} else {
@ -442,6 +442,15 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode {
self.loadMoreDisposable.dispose()
}
var updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? {
if let forceTheme = self.controller?.forceTheme {
let presentationData = self.presentationData.withUpdated(theme: forceTheme)
return (presentationData, .single(presentationData))
} else {
return nil
}
}
func updatePresentationData(presentationData: PresentationData) {
self.presentationData = presentationData
@ -543,7 +552,7 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode {
switch attribute {
case let .Sticker(_, packReference, _):
if let packReference = packReference {
let controller = StickerPackScreen(context: strongSelf.context, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { file, sourceNode, sourceRect in
let controller = StickerPackScreen(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, mainStickerPack: packReference, stickerPacks: [packReference], actionTitle: strongSelf.controller?.stickerActionTitle, parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { file, sourceNode, sourceRect in
if let strongSelf = self {
return strongSelf.sendSticker?(file, sourceNode, sourceRect) ?? false
} else {
@ -631,7 +640,7 @@ private final class FeaturedStickersScreenNode: ViewControllerTracingNode {
switch attribute {
case let .Sticker(_, packReference, _):
if let packReference = packReference {
let controller = StickerPackScreen(context: strongSelf.context, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { file, sourceNode, sourceRect in
let controller = StickerPackScreen(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, mainStickerPack: packReference, stickerPacks: [packReference], actionTitle: strongSelf.controller?.stickerActionTitle, parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { file, sourceNode, sourceRect in
if let strongSelf = self {
return strongSelf.sendSticker?(file, sourceNode, sourceRect) ?? false
} else {
@ -804,6 +813,7 @@ public final class FeaturedStickersScreen: ViewController {
private let context: AccountContext
fileprivate let highlightedPackId: ItemCollectionId?
private let sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)?
fileprivate var stickerActionTitle: String?
private var controllerNode: FeaturedStickersScreenNode {
return self.displayNode as! FeaturedStickersScreenNode
@ -820,10 +830,11 @@ public final class FeaturedStickersScreen: ViewController {
fileprivate var searchNavigationNode: SearchNavigationContentNode?
public init(context: AccountContext, highlightedPackId: ItemCollectionId?, forceTheme: PresentationTheme? = nil, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)? = nil) {
public init(context: AccountContext, highlightedPackId: ItemCollectionId?, forceTheme: PresentationTheme? = nil, stickerActionTitle: String? = nil, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)? = nil) {
self.context = context
self.highlightedPackId = highlightedPackId
self.sendSticker = sendSticker
self.stickerActionTitle = stickerActionTitle
var presentationData = context.sharedContext.currentPresentationData.with { $0 }
if let forceTheme {
@ -1181,7 +1192,7 @@ private final class FeaturedPaneSearchContentNode: ASDisplayNode {
if let strongSelf = self {
strongSelf.view.window?.endEditing(true)
let packReference: StickerPackReference = .id(id: info.id.id, accessHash: info.accessHash)
let controller = StickerPackScreen(context: strongSelf.context, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { [weak self] fileReference, sourceNode, sourceRect in
let controller = StickerPackScreen(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, mainStickerPack: packReference, stickerPacks: [packReference], actionTitle: strongSelf.controller?.stickerActionTitle, parentNavigationController: strongSelf.controller?.navigationController as? NavigationController, sendSticker: { [weak self] fileReference, sourceNode, sourceRect in
if let strongSelf = self {
return strongSelf.sendSticker?(fileReference, sourceNode, sourceRect) ?? false
} else {
@ -1219,6 +1230,11 @@ private final class FeaturedPaneSearchContentNode: ASDisplayNode {
self.installDisposable.dispose()
}
var updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: self.theme)
return (presentationData, .single(presentationData))
}
func updateText(_ text: String, languageCode: String?) {
let signal: Signal<([(String?, FoundStickerItem)], FoundStickerSets, Bool, FoundStickerSets?)?, NoError>
if !text.isEmpty {

View File

@ -3545,9 +3545,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
self.mediaEditor?.play()
}
}
controller.pushController = { [weak self] c in
self?.controller?.push(c)
}
self.stickerScreen = controller
self.controller?.present(controller, in: .window(.root))
return
self.controller?.present(controller, in: .current)
case .text:
self.mediaEditor?.stop()
self.insertTextEntity()