Various fixes

This commit is contained in:
Ilya Laktyushin 2024-04-30 12:58:20 +04:00
parent 9723a875b2
commit 2b6a8e202e
33 changed files with 263 additions and 65 deletions

View File

@ -5630,6 +5630,7 @@ Sorry for the inconvenience.";
"Conversation.ContextMenuOpenProfile" = "Open Profile";
"Conversation.ContextMenuSendMessage" = "Send Message";
"Conversation.ContextMenuMention" = "Mention";
"Conversation.ContextMenuSearchMessages" = "Search Messages";
"Conversation.ContextMenuOpenChannelProfile" = "Open Profile";
"Conversation.ContextMenuOpenChannel" = "Open Channel";
@ -12047,6 +12048,7 @@ Sorry for the inconvenience.";
"MediaEditor.CreateNewPack" = "New Sticker Set";
"MediaEditor.ReplaceSticker" = "Replace Sticker";
"MediaEditor.AddToStickerPack" = "Add to Sticker Set";
"MediaEditor.SetAsIntroSticker" = "Set as Greeting Sticker";
"MediaEditor.NewStickerPack.Title" = "New Sticker Set";
"MediaEditor.NewStickerPack.Text" = "Choose a name for your sticker set.";
@ -12182,3 +12184,9 @@ Sorry for the inconvenience.";
"Chat.NextSuggestedChannelSwipeAction" = "Release to go to the next channel";
"Chat.NextUnreadTopicSwipeProgress" = "Pull up to go to the next topic";
"Chat.NextUnreadTopicSwipeAction" = "Release to go to the next topic";
"EmojiPacksSettings.ArchivedPacks" = "Archived Stickers";
"EmojiPacksSettings.ArchivedPacks.Info" = "You can have up to 200 sticker sets installed.\nUnused stickers are archived when you add more.";
"EmojiPacks.UnarchiveEmojiPacksConfirmation_1" = "Unarchive %@ Pack";
"EmojiPacks.UnarchiveEmojiPacksConfirmation_any" = "Unarchive %@ Packs";

View File

@ -990,7 +990,7 @@ public protocol SharedAccountContext: AnyObject {
func navigateToChatController(_ params: NavigateToChatControllerParams)
func navigateToForumChannel(context: AccountContext, peerId: EnginePeer.Id, navigationController: NavigationController)
func navigateToForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError>
func navigateToForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, scrollToEndIfExists: Bool, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError>
func chatControllerForForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64) -> Signal<ChatController, NoError>
func openStorageUsage(context: AccountContext)
func openLocationScreen(context: AccountContext, messageId: MessageId, navigationController: NavigationController)
@ -1019,11 +1019,11 @@ public protocol SharedAccountContext: AnyObject {
func makePremiumPrivacyControllerController(context: AccountContext, subject: PremiumPrivacySubject, peerId: EnginePeer.Id) -> ViewController
func makePremiumBoostLevelsController(context: AccountContext, peerId: EnginePeer.Id, subject: BoostSubject, boostStatus: ChannelBoostStatus, myBoostStatus: MyBoostStatus, forceDark: Bool, openStats: (() -> Void)?) -> ViewController
func makeStickerPackScreen(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, mainStickerPack: StickerPackReference, stickerPacks: [StickerPackReference], loadedStickerPacks: [LoadedStickerPack], isEditing: Bool, expandIfNeeded: Bool, parentNavigationController: NavigationController?, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)?) -> ViewController
func makeStickerPackScreen(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, mainStickerPack: StickerPackReference, stickerPacks: [StickerPackReference], loadedStickerPacks: [LoadedStickerPack], isEditing: Bool, expandIfNeeded: Bool, parentNavigationController: NavigationController?, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)?, actionPerformed: ((Bool) -> Void)?) -> ViewController
func makeMediaPickerScreen(context: AccountContext, hasSearch: Bool, completion: @escaping (Any) -> Void) -> ViewController
func makeStickerEditorScreen(context: AccountContext, source: Any?, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, [String], @escaping () -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController
func makeStickerEditorScreen(context: AccountContext, source: Any?, intro: Bool, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, [String], @escaping () -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController
func makeStickerMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect?, completion: @escaping (Any?, UIView?, CGRect, UIImage?, Bool, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void) -> ViewController
func makeStoryMediaPickerScreen(context: AccountContext, getSourceRect: @escaping () -> CGRect, completion: @escaping (Any, UIView, CGRect, UIImage?, @escaping (Bool?) -> (UIView, CGRect)?, @escaping () -> Void) -> Void, dismissed: @escaping () -> Void, groupsPresented: @escaping () -> Void) -> ViewController

View File

@ -473,9 +473,7 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
if let statusBarHeight = layout.statusBarHeight {
containerTopInset += statusBarHeight
}
let effectiveStatusBarHeight: CGFloat? = nil
var safeInsets = layout.safeInsets
safeInsets.left += overflowInset
safeInsets.right += overflowInset
@ -487,7 +485,7 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
var additionalInsets = layout.additionalInsets
additionalInsets.bottom = topInset
containerLayout = ContainerViewLayout(size: CGSize(width: layout.size.width + overflowInset * 2.0, height: layout.size.height - containerTopInset), metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(top: 0.0, left: intrinsicInsets.left, bottom: intrinsicInsets.bottom, right: intrinsicInsets.right), safeInsets: UIEdgeInsets(top: 0.0, left: safeInsets.left, bottom: safeInsets.bottom, right: safeInsets.right), additionalInsets: additionalInsets, statusBarHeight: effectiveStatusBarHeight, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver)
containerLayout = ContainerViewLayout(size: CGSize(width: layout.size.width + overflowInset * 2.0, height: layout.size.height - containerTopInset), metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(top: 0.0, left: intrinsicInsets.left, bottom: intrinsicInsets.bottom, right: intrinsicInsets.right), safeInsets: UIEdgeInsets(top: 0.0, left: safeInsets.left, bottom: safeInsets.bottom, right: safeInsets.right), additionalInsets: additionalInsets, statusBarHeight: nil, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver)
let unscaledFrame = CGRect(origin: CGPoint(x: 0.0, y: containerTopInset - coveredByModalTransition * 10.0), size: containerLayout.size)
let maxScale: CGFloat = (containerLayout.size.width - 16.0 * 2.0) / containerLayout.size.width
containerScale = 1.0 * (1.0 - coveredByModalTransition) + maxScale * coveredByModalTransition

View File

@ -691,7 +691,7 @@ public class AttachmentController: ViewController {
} else {
ContainedViewLayoutTransition.animated(duration: 0.3, curve: .linear).updateAlpha(node: self.dim, alpha: 1.0)
let targetPosition = CGPoint(x: layout.size.width / 2.0, y: layout.size.height / 2.0)
let targetPosition = self.container.position
let startPosition = targetPosition.offsetBy(dx: 0.0, dy: layout.size.height)
self.container.position = startPosition

View File

@ -1054,7 +1054,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
if case let .channel(channel) = peer, channel.flags.contains(.isForum), let threadId {
let _ = self.context.sharedContext.navigateToForumThread(context: self.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .never).startStandalone()
let _ = self.context.sharedContext.navigateToForumThread(context: self.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: scrollToEndIfExists, keepStack: .never).startStandalone()
self.chatListDisplayNode.clearHighlightAnimated(true)
} else {
var navigationAnimationOptions: NavigationAnimationOptions = []
@ -1201,7 +1201,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
navigationAnimationOptions = .removeOnMasterDetails
}
if case let .channel(channel) = actualPeer, channel.flags.contains(.isForum), let threadId {
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: nil, keepStack: .never).startStandalone()
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .never).startStandalone()
} else {
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(actualPeer), subject: .message(id: .id(messageId), highlight: ChatControllerSubject.MessageHighlight(quote: nil), timecode: nil), purposefulAction: {
if deactivateOnAction {
@ -1234,7 +1234,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
navigationAnimationOptions = .removeOnMasterDetails
}
if case let .channel(channel) = peer, channel.flags.contains(.isForum), let threadId {
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .never).startStandalone()
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .never).startStandalone()
} else {
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer), purposefulAction: { [weak self] in
self?.deactivateSearch(animated: false)
@ -1312,7 +1312,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
let _ = (context.engine.peers.createForumChannelTopic(id: peerId, title: title, iconColor: iconColor, iconFileId: fileId)
|> deliverOnMainQueue).startStandalone(next: { topicId in
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: topicId, messageId: nil, navigationController: navigationController, activateInput: .text, keepStack: .never).startStandalone()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: topicId, messageId: nil, navigationController: navigationController, activateInput: .text, scrollToEndIfExists: false, keepStack: .never).startStandalone()
}, error: { _ in
controller?.isInProgress = false
})
@ -3566,7 +3566,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
let _ = (context.engine.peers.createForumChannelTopic(id: peerId, title: title, iconColor: iconColor, iconFileId: fileId)
|> deliverOnMainQueue).startStandalone(next: { topicId in
if let navigationController = (sourceController.navigationController as? NavigationController) {
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: topicId, messageId: nil, navigationController: navigationController, activateInput: .text, keepStack: .never).startStandalone()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: topicId, messageId: nil, navigationController: navigationController, activateInput: .text, scrollToEndIfExists: false, keepStack: .never).startStandalone()
}
}, error: { _ in
controller?.isInProgress = false

View File

@ -4060,7 +4060,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.textNode.textNode.alpha = 0.0
strongSelf.authorNode.alpha = 0.0
strongSelf.compoundHighlightingNode?.alpha = 0.0
strongSelf.dustNode?.alpha = 0.0
strongSelf.forwardedIconNode.alpha = 0.0
if animated || animateContent {
@ -4072,13 +4071,13 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.forwardedIconNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15)
}
}
strongSelf.dustNode?.alpha = 0.0
} else {
if !strongSelf.inputActivitiesNode.alpha.isZero {
strongSelf.inputActivitiesNode.alpha = 0.0
strongSelf.textNode.textNode.alpha = 1.0
strongSelf.authorNode.alpha = 1.0
strongSelf.compoundHighlightingNode?.alpha = 1.0
strongSelf.dustNode?.alpha = 1.0
strongSelf.forwardedIconNode.alpha = 1.0
if animated || animateContent {
strongSelf.inputActivitiesNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, completion: { value in
@ -4095,6 +4094,7 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
strongSelf.inputActivitiesNode.removeFromSupernode()
}
}
strongSelf.dustNode?.alpha = 1.0
}
if let inputActivitiesSize = inputActivitiesSize {
let inputActivitiesFrame = CGRect(origin: CGPoint(x: contentRect.minX, y: authorNodeFrame.minY + UIScreenPixel), size: inputActivitiesSize)

View File

@ -469,7 +469,7 @@ public func legacyAttachmentMenu(context: AccountContext, peer: Peer?, threadTit
present(legacyController, nil)
TGPhotoVideoEditor.present(with: legacyController.context, controller: emptyController, caption: NSAttributedString(), withItem: item, paint: false, adjustments: false, recipientName: recipientName, stickersContext: paintStickersContext, from: .zero, mainSnapshot: nil, snapshots: [], immediate: false, appeared: {
TGPhotoVideoEditor.present(with: legacyController.context, controller: emptyController, caption: initialCaption, withItem: item, paint: false, adjustments: false, recipientName: recipientName, stickersContext: paintStickersContext, from: .zero, mainSnapshot: nil, snapshots: [], immediate: false, appeared: {
}, completion: { result, editingContext in
let nativeGenerator = legacyAssetPickerItemGenerator()
var selectableResult: TGMediaSelectableItem?

View File

@ -1715,7 +1715,9 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
return false
})
if let resultItemNode = resultItemNode {
controller.ensureItemNodeVisible(resultItemNode)
Queue.mainQueue().after(0.1) {
controller.ensureItemNodeVisible(resultItemNode, atTop: true)
}
}
})
}

View File

@ -914,7 +914,7 @@ public func chatMessagePhotoThumbnail(account: Account, userLocation: MediaResou
var blurredThumbnailImage: CGImage?
if let thumbnailImage = thumbnailImage {
if thumbnailIsBlurred {
if thumbnailIsBlurred || blurred {
let thumbnailSize = CGSize(width: thumbnailImage.width, height: thumbnailImage.height)
let thumbnailContextSize = thumbnailSize.aspectFitted(blurred ? CGSize(width: 50.0, height: 50.0) : CGSize(width: 150.0, height: 150.0))
if let thumbnailContext = DrawingContext(size: thumbnailContextSize, scale: 1.0) {
@ -925,6 +925,10 @@ public func chatMessagePhotoThumbnail(account: Account, userLocation: MediaResou
imageFastBlur(Int32(thumbnailContextSize.width), Int32(thumbnailContextSize.height), Int32(thumbnailContext.bytesPerRow), thumbnailContext.bytes)
if blurred {
if !thumbnailIsBlurred {
telegramFastBlurMore(Int32(thumbnailContextSize.width), Int32(thumbnailContextSize.height), Int32(thumbnailContext.bytesPerRow), thumbnailContext.bytes)
telegramFastBlurMore(Int32(thumbnailContextSize.width), Int32(thumbnailContextSize.height), Int32(thumbnailContext.bytesPerRow), thumbnailContext.bytes)
}
imageFastBlur(Int32(thumbnailContextSize.width), Int32(thumbnailContextSize.height), Int32(thumbnailContext.bytesPerRow), thumbnailContext.bytes)
adjustSaturationInContext(context: thumbnailContext, saturation: 1.7)
}

View File

@ -1805,7 +1805,9 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}
},
tapAction: { _, _ in
shareLink(link)
if !link.isEmpty {
shareLink(link)
}
}
),
environment: {},
@ -3161,6 +3163,8 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
let bottomSeparator = Child(Rectangle.self)
let button = Child(SolidRoundedButtonComponent.self)
var updatedInstalled: Bool?
return { context in
let environment = context.environment[EnvironmentType.self].value
let state = context.state
@ -3368,8 +3372,15 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
if let emojiFile = state?.emojiFile, let controller = environment?.controller() as? PremiumIntroScreen, let navigationController = controller.navigationController as? NavigationController {
for attribute in emojiFile.attributes {
if case let .CustomEmoji(_, _, _, packReference) = attribute, let packReference = packReference {
let controller = accountContext.sharedContext.makeStickerPackScreen(context: accountContext, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: loadedEmojiPack.flatMap { [$0] } ?? [], isEditing: false, expandIfNeeded: false, parentNavigationController: navigationController, sendSticker: { _, _, _ in
var loadedPack: LoadedStickerPack?
if let loadedEmojiPack, case let .result(info, items, installed) = loadedEmojiPack {
loadedPack = .result(info: info, items: items, installed: updatedInstalled ?? installed)
}
let controller = accountContext.sharedContext.makeStickerPackScreen(context: accountContext, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: loadedPack.flatMap { [$0] } ?? [], isEditing: false, expandIfNeeded: false, parentNavigationController: navigationController, sendSticker: { _, _, _ in
return false
}, actionPerformed: { added in
updatedInstalled = added
})
presentController(controller)
break

View File

@ -5,11 +5,15 @@ import Postbox
import AccountContext
import OverlayStatusController
import UrlWhitelist
import TelegramPresentationData
public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url: String, concealed: Bool, skipUrlAuth: Bool = false, skipConcealedAlert: Bool = false, present: @escaping (ViewController) -> Void, openResolved: @escaping (ResolvedUrl) -> Void, progress: Promise<Bool>? = nil) -> Disposable {
public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url: String, concealed: Bool, skipUrlAuth: Bool = false, skipConcealedAlert: Bool = false, forceDark: Bool = false, present: @escaping (ViewController) -> Void, openResolved: @escaping (ResolvedUrl) -> Void, progress: Promise<Bool>? = nil, alertDisplayUpdated: ((ViewController?) -> Void)? = nil) -> Disposable {
var concealed = concealed
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
var presentationData = context.sharedContext.currentPresentationData.with { $0 }
if forceDark {
presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)
}
let openImpl: () -> Disposable = {
let disposable = MetaDisposable()
@ -87,9 +91,15 @@ public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url:
var displayUrl = rawDisplayUrl
displayUrl = displayUrl.replacingOccurrences(of: "\u{202e}", with: "")
let disposable = MetaDisposable()
present(textAlertController(context: context, title: nil, text: presentationData.strings.Generic_OpenHiddenLinkAlert(displayUrl).string, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Yes, action: {
let alertController = textAlertController(context: context, forceTheme: forceDark ? presentationData.theme : nil, title: nil, text: presentationData.strings.Generic_OpenHiddenLinkAlert(displayUrl).string, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Yes, action: {
disposable.set(openImpl())
})]))
})])
alertController.dismissed = { _ in
alertDisplayUpdated?(nil)
}
present(alertController)
alertDisplayUpdated?(alertController)
return disposable
} else {
return openImpl()

View File

@ -2187,6 +2187,12 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
continue
}
itemNode.layer.animateAlpha(from: itemNode.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
if let selectionView = itemNode.selectionView {
selectionView.layer.animateAlpha(from: selectionView.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
}
if let selectionTintView = itemNode.selectionTintView {
selectionTintView.layer.animateAlpha(from: selectionTintView.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
}
}
if let titleLabelView = self.titleLabelView {

View File

@ -210,11 +210,18 @@ private struct ArchivedStickerPacksControllerState: Equatable {
}
}
private func archivedStickerPacksControllerEntries(context: AccountContext, presentationData: PresentationData, state: ArchivedStickerPacksControllerState, packs: [ArchivedStickerPackItem]?, installedView: CombinedView, stickerSettings: StickerSettings) -> [ArchivedStickerPacksEntry] {
private func archivedStickerPacksControllerEntries(context: AccountContext, mode: ArchivedStickerPacksControllerMode, presentationData: PresentationData, state: ArchivedStickerPacksControllerState, packs: [ArchivedStickerPackItem]?, installedView: CombinedView, stickerSettings: StickerSettings) -> [ArchivedStickerPacksEntry] {
var entries: [ArchivedStickerPacksEntry] = []
if let packs = packs {
entries.append(.info(presentationData.theme, presentationData.strings.StickerPacksSettings_ArchivedPacks_Info + "\n\n"))
let info: String
switch mode {
case .emoji:
info = presentationData.strings.EmojiPacksSettings_ArchivedPacks_Info
default:
info = presentationData.strings.StickerPacksSettings_ArchivedPacks_Info
}
entries.append(.info(presentationData.theme, info + "\n\n"))
var installedIds = Set<ItemCollectionId>()
if let view = installedView.views[.itemCollectionIds(namespaces: [Namespaces.ItemCollection.CloudStickerPacks])] as? ItemCollectionIdsView, let ids = view.idsByNamespace[Namespaces.ItemCollection.CloudStickerPacks] {
@ -340,7 +347,18 @@ public func archivedStickerPacksController(context: AccountContext, mode: Archiv
}
}
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .stickersModified(title: presentationData.strings.StickerPackActionInfo_AddedTitle, text: presentationData.strings.StickerPackActionInfo_AddedText(info.title).string, undo: false, info: info, topItem: items.first, context: context), elevatedLayout: false, animateInAsReplacement: animateInAsReplacement, action: { _ in
let title: String
let text: String
switch mode {
case .emoji:
title = presentationData.strings.EmojiPackActionInfo_AddedTitle
text = presentationData.strings.EmojiPackActionInfo_AddedText(info.title).string
default:
title = presentationData.strings.StickerPackActionInfo_AddedTitle
text = presentationData.strings.StickerPackActionInfo_AddedText(info.title).string
}
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .stickersModified(title: title, text: text, undo: false, info: info, topItem: items.first, context: context), elevatedLayout: false, animateInAsReplacement: animateInAsReplacement, action: { _ in
return true
}), nil)
@ -495,8 +513,17 @@ public func archivedStickerPacksController(context: AccountContext, mode: Archiv
presentControllerImpl?(actionSheet, nil)
}), .init(title: presentationData.strings.StickerPacks_ActionUnarchive, isEnabled: selectedCount > 0, action: {
let actionSheet = ActionSheetController(presentationData: presentationData)
let text: String
switch mode {
case .emoji:
text = presentationData.strings.EmojiPacks_UnarchiveEmojiPacksConfirmation(selectedCount)
default:
text = presentationData.strings.StickerPacks_UnarchiveStickerPacksConfirmation(selectedCount)
}
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.StickerPacks_UnarchiveStickerPacksConfirmation(selectedCount), color: .destructive, action: { [weak actionSheet] in
items.append(ActionSheetButtonItem(title: text, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
updateState {
@ -550,9 +577,17 @@ public func archivedStickerPacksController(context: AccountContext, mode: Archiv
emptyStateItem = ItemListLoadingIndicatorEmptyStateItem(theme: presentationData.theme)
}
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(presentationData.strings.StickerPacksSettings_ArchivedPacks), leftNavigationButton: nil, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
let title: String
switch mode {
case .emoji:
title = presentationData.strings.EmojiPacksSettings_ArchivedPacks
default:
title = presentationData.strings.StickerPacksSettings_ArchivedPacks
}
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: archivedStickerPacksControllerEntries(context: context, presentationData: presentationData, state: state, packs: packs, installedView: installedView, stickerSettings: stickerSettings), style: .blocks, emptyStateItem: emptyStateItem, toolbarItem: toolbarItem, animateChanges: previous != nil && packs != nil && (previous! != 0 && previous! >= packs!.count - 10))
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(title), leftNavigationButton: nil, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: archivedStickerPacksControllerEntries(context: context, mode: mode, presentationData: presentationData, state: state, packs: packs, installedView: installedView, stickerSettings: stickerSettings), style: .blocks, emptyStateItem: emptyStateItem, toolbarItem: toolbarItem, animateChanges: previous != nil && packs != nil && (previous! != 0 && previous! >= packs!.count - 10))
return (controllerState, (listState, arguments))
} |> afterDisposed {
actionsDisposable.dispose()

View File

@ -1257,6 +1257,7 @@ private final class StickerPackContainer: ASDisplayNode {
let editorController = context.sharedContext.makeStickerEditorScreen(
context: context,
source: result,
intro: false,
transitionArguments: transitionView.flatMap { ($0, transitionRect, transitionImage) },
completion: { file, emoji, commit in
dismissImpl?()
@ -1361,6 +1362,7 @@ private final class StickerPackContainer: ASDisplayNode {
let controller = context.sharedContext.makeStickerEditorScreen(
context: context,
source: (initialFile, emoji),
intro: false,
transitionArguments: nil,
completion: { file, emoji, commit in
let sticker = ImportSticker(

View File

@ -304,7 +304,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
}, navigateToMessageStandalone: { _ in
}, navigateToThreadMessage: { [weak self] peerId, threadId, _ in
if let context = self?.context, let navigationController = self?.getNavigationController() {
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .always).startStandalone()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .always).startStandalone()
}
}, tapMessage: nil, clickThroughMessage: { }, toggleMessagesSelection: { _, _ in }, sendCurrentMessage: { _ in }, sendMessage: { _ in }, sendSticker: { _, _, _, _, _, _, _, _, _ in return false }, sendEmoji: { _, _, _ in }, sendGif: { _, _, _, _, _ in return false }, sendBotContextResultAsGif: { _, _, _, _, _, _ in return false
}, requestMessageActionCallback: { [weak self] messageId, _, _, _ in
@ -1181,7 +1181,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
}
case let .replyThread(messageId):
if let navigationController = strongSelf.getNavigationController() {
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .always).startStandalone()
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .always).startStandalone()
}
case let .stickerPack(name, type):
let _ = type

View File

@ -208,6 +208,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
hasTrending: hasTrending,
forceHasPremium: false,
hasEdit: hasEdit,
hasAdd: hasEdit,
subject: .chatStickers,
hideBackground: hideBackground
)
@ -1397,7 +1398,8 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
parentNavigationController: interaction.getNavigationController(),
sendSticker: { [weak interaction] fileReference, sourceView, sourceRect in
return interaction?.sendSticker(fileReference, false, false, nil, false, sourceView, sourceRect, nil, []) ?? false
}
},
actionPerformed: nil
)
interaction.presentController(controller, nil)
})
@ -2880,7 +2882,7 @@ public final class EmojiContentPeekBehaviorImpl: EmojiContentPeekBehavior {
let controller = strongSelf.context.sharedContext.makeStickerPackScreen(context: context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], isEditing: false, expandIfNeeded: false, parentNavigationController: interaction.navigationController(), sendSticker: { file, sourceView, sourceRect in
sendSticker(file, false, false, nil, false, sourceView, sourceRect, nil)
return true
})
}, actionPerformed: nil)
interaction.navigationController()?.view.window?.endEditing(true)
interaction.presentController(controller, nil)

View File

@ -1607,6 +1607,7 @@ public extension EmojiPagerContentComponent {
hasTrending: Bool,
forceHasPremium: Bool,
hasEdit: Bool = false,
hasAdd: Bool = false,
searchIsPlaceholderOnly: Bool = true,
subject: StickersSubject = .chatStickers,
hideBackground: Bool = false
@ -1890,7 +1891,7 @@ public extension EmojiPagerContentComponent {
}
}
if hasEdit && !addedCreateStickerButton, let groupIndex = itemGroupIndexById[groupId] {
if hasAdd && !addedCreateStickerButton, let groupIndex = itemGroupIndexById[groupId] {
let resultItem = EmojiPagerContentComponent.Item(
animationData: nil,
content: .icon(.add),

View File

@ -59,6 +59,7 @@ swift_library(
"//submodules/TelegramUI/Components/StickerPickerScreen",
"//submodules/UIKitRuntimeUtils",
"//submodules/TelegramUI/Components/MediaEditor/ImageObjectSeparation",
"//submodules/Components/HierarchyTrackingLayer",
],
visibility = [
"//visibility:public",

View File

@ -2410,6 +2410,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
case generic
case addingToPack
case editing
case businessIntro
}
case storyEditor
@ -6494,6 +6495,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
var file = stickerFile(resource: resource, thumbnailResource: thumbnailResource, size: Int64(0), dimensions: PixelDimensions(image.size), duration: self.preferredStickerDuration(), isVideo: isVideo)
var menuItems: [ContextMenuItem] = []
var hasEmojiSelection = true
if case let .stickerEditor(mode) = self.mode {
switch mode {
case .generic:
@ -6652,6 +6654,24 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
}
f(.default)
let _ = (imagesReady.get()
|> filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(next: { [weak self] _ in
guard let self else {
return
}
self.uploadSticker(file, action: .upload)
})
})))
case .businessIntro:
hasEmojiSelection = false
menuItems.append(.action(ContextMenuActionItem(text: presentationData.strings.MediaEditor_SetAsIntroSticker, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Sticker"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, f in
guard let self else {
return
}
f(.default)
let _ = (imagesReady.get()
|> filter { $0 }
|> take(1)
@ -6682,14 +6702,14 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
theme: presentationData.theme,
strings: presentationData.strings,
item: .portal(portalView),
isCreating: true,
isCreating: hasEmojiSelection,
selectedEmoji: self.stickerSelectedEmoji,
selectedEmojiUpdated: { [weak self] selectedEmoji in
if let self {
self.stickerSelectedEmoji = selectedEmoji
}
},
recommendedEmoji: stickerRecommendedEmoji,
recommendedEmoji: self.stickerRecommendedEmoji,
menu: menuItems,
openPremiumIntro: {}
),
@ -6936,7 +6956,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
case .addToStickerPack, .createStickerPack:
if let (packReference, packTitle) = packReferenceAndTitle, let navigationController = self.navigationController as? NavigationController {
Queue.mainQueue().after(0.2) {
let controller = self.context.sharedContext.makeStickerPackScreen(context: self.context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], isEditing: false, expandIfNeeded: true, parentNavigationController: navigationController, sendSticker: self.sendSticker)
let controller = self.context.sharedContext.makeStickerPackScreen(context: self.context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], isEditing: false, expandIfNeeded: true, parentNavigationController: navigationController, sendSticker: self.sendSticker, actionPerformed: nil)
(navigationController.viewControllers.last as? ViewController)?.present(controller, in: .window(.root))
Queue.mainQueue().after(0.1) {

View File

@ -135,10 +135,7 @@ final class StickerCutoutOutlineView: UIView {
private func animateBump(path: BezierPath) {
let boundingBox = path.path.cgPath.boundingBox
let pathCenter = CGPoint(x: boundingBox.midX, y: boundingBox.midY)
// let originalPosition = self.imageLayer.position
// let originalAnchorPoint = self.imageLayer.anchorPoint
let layerPathCenter = self.imageLayer.convert(pathCenter, from: self.imageLayer.superlayer)
self.imageLayer.anchorPoint = CGPoint(x: layerPathCenter.x / layer.bounds.width, y: layerPathCenter.y / layer.bounds.height)
self.imageLayer.position = layerPathCenter

View File

@ -2846,7 +2846,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
c.dismiss(completion: {
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).startStandalone()
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .default).startStandalone()
} else {
let targetLocation: NavigateToChatControllerParams.Location
if case let .replyThread(message) = strongSelf.chatLocation {
@ -3008,7 +3008,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
c.dismiss(completion: {
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).startStandalone()
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .default).startStandalone()
} else {
let targetLocation: NavigateToChatControllerParams.Location
if case let .replyThread(message) = strongSelf.chatLocation {

View File

@ -41,6 +41,7 @@ swift_library(
"//submodules/TelegramUI/Components/PeerAllowedReactionsScreen",
"//submodules/TelegramUI/Components/EmojiActionIconComponent",
"//submodules/TelegramUI/Components/TextFieldComponent",
"//submodules/TelegramUI/Components/CameraScreen",
],
visibility = [
"//visibility:public",

View File

@ -22,6 +22,7 @@ import EntityKeyboard
import PeerAllowedReactionsScreen
import EmojiActionIconComponent
import TextFieldComponent
import CameraScreen
final class BusinessIntroSetupScreenComponent: Component {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
@ -161,6 +162,56 @@ final class BusinessIntroSetupScreenComponent: Component {
return true
}
func openStickerEditor() {
guard let component = self.component, let environment = self.environment, let controller = environment.controller() as? BusinessIntroSetupScreen else {
return
}
let context = component.context
let navigationController = controller.navigationController as? NavigationController
var dismissImpl: (() -> Void)?
let mainController = context.sharedContext.makeStickerMediaPickerScreen(
context: context,
getSourceRect: { return .zero },
completion: { result, transitionView, transitionRect, transitionImage, fromCamera, completion, cancelled in
let editorController = context.sharedContext.makeStickerEditorScreen(
context: context,
source: result,
intro: true,
transitionArguments: transitionView.flatMap { ($0, transitionRect, transitionImage) },
completion: { [weak self] file, emoji, commit in
dismissImpl?()
guard let self else {
return
}
self.stickerFile = file
if !self.isUpdating {
self.state?.updated(transition: .spring(duration: 0.4))
}
commit()
},
cancelled: cancelled
)
navigationController?.pushViewController(editorController)
},
dismissed: {}
)
dismissImpl = { [weak mainController] in
if let mainController, let navigationController = mainController.navigationController {
var viewControllers = navigationController.viewControllers
viewControllers = viewControllers.filter { c in
return !(c is CameraScreen) && c !== mainController
}
navigationController.setViewControllers(viewControllers, animated: false)
}
}
navigationController?.pushViewController(mainController)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if !self.ignoreScrolling {
self.updateScrolling(transition: .immediate)
@ -229,6 +280,7 @@ final class BusinessIntroSetupScreenComponent: Component {
hasSearch: true,
hasTrending: false,
forceHasPremium: true,
hasAdd: true,
searchIsPlaceholderOnly: false,
subject: .greetingStickers
)
@ -245,6 +297,13 @@ final class BusinessIntroSetupScreenComponent: Component {
return
}
guard let itemFile = item.itemFile else {
if case .icon(.add) = item.content {
self.openStickerEditor()
self.displayStickerInput = false
if !self.isUpdating {
self.state?.updated(transition: .spring(duration: 0.4))
}
}
return
}

View File

@ -569,7 +569,7 @@ final class StoryItemContentComponent: Component {
return
}
if apply {
videoNode.seek(timestamp)
videoNode.seek(min(timestamp, self.effectiveDuration - 0.3))
}
self.isSeeking = true
self.updateVideoPlaybackProgress(timestamp)

View File

@ -4231,7 +4231,7 @@ public final class StoryItemSetContainerComponent: Component {
}
switch action {
case let .url(url, concealed):
let _ = openUserGeneratedUrl(context: component.context, peerId: component.slice.peer.id, url: url, concealed: concealed, skipUrlAuth: false, skipConcealedAlert: false, present: { [weak self] c in
let _ = openUserGeneratedUrl(context: component.context, peerId: component.slice.peer.id, url: url, concealed: concealed, skipUrlAuth: false, skipConcealedAlert: false, forceDark: true, present: { [weak self] c in
guard let self, let component = self.component, let controller = component.controller() else {
return
}
@ -4241,6 +4241,12 @@ public final class StoryItemSetContainerComponent: Component {
return
}
self.sendMessageContext.openResolved(view: self, result: resolved, forceExternal: false, concealed: concealed)
}, alertDisplayUpdated: { [weak self] alertController in
guard let self else {
return
}
self.sendMessageContext.statusController = alertController
self.updateIsProgressPaused()
})
case let .textMention(value):
self.sendMessageContext.openPeerMention(view: self, name: value)

View File

@ -149,13 +149,14 @@ private func chatForwardOptions(selfController: ChatControllerImpl, sourceNode:
for media in message.media {
if let media = media as? TelegramMediaFile, media.isMusic {
isMusic = true
if !message.text.isEmpty {
hasCaptions = true
}
} else if media is TelegramMediaDice {
isDice = true
} else {
} else if media is TelegramMediaImage || media is TelegramMediaFile {
if !message.text.isEmpty {
if media is TelegramMediaImage || media is TelegramMediaFile {
hasCaptions = true
}
hasCaptions = true
}
}
}

View File

@ -180,8 +180,12 @@ func isTopmostChatController(_ controller: ChatControllerImpl) -> Bool {
if let _ = controller.navigationController {
var hasOther = false
controller.window?.forEachController({ c in
if c is ChatControllerImpl && controller !== c {
hasOther = true
if c is ChatControllerImpl {
if controller !== c {
hasOther = true
} else {
hasOther = false
}
}
})
if hasOther {
@ -1702,7 +1706,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self?.navigateToMessage(from: nil, to: .id(id, NavigateToMessageParams(timestamp: nil, quote: nil)), forceInCurrentChat: false)
}, navigateToThreadMessage: { [weak self] peerId, threadId, messageId in
if let context = self?.context, let navigationController = self?.effectiveNavigationController {
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: nil, keepStack: .always).startStandalone()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: peerId, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .always).startStandalone()
}
}, tapMessage: nil, clickThroughMessage: { [weak self] in
self?.chatDisplayNode.dismissInput()
@ -3648,6 +3652,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}, delay: true)
})))
}
if !isChannel {
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.Conversation_ContextMenuSearchMessages, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Search"), color: theme.actionSheet.primaryTextColor)
}, action: { _, f in
f(.dismissWithoutContent)
guard let strongSelf = self else {
return
}
strongSelf.activateSearch(domain: .member(peer._asPeer()))
})))
}
strongSelf.chatDisplayNode.messageTransitionNode.dismissMessageReactionContexts()

View File

@ -446,7 +446,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
var messageMedia = message.media
var hasDice = false
if hideNames {
if hideNames || options.hideCaptions {
for media in message.media {
if options.hideCaptions {
if media is TelegramMediaImage || media is TelegramMediaFile {

View File

@ -354,7 +354,7 @@ public func isOverlayControllerForChatNotificationOverlayPresentation(_ controll
return false
}
public func navigateToForumThreadImpl(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError> {
public func navigateToForumThreadImpl(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, scrollToEndIfExists: Bool, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError> {
return fetchAndPreloadReplyThreadInfo(context: context, subject: .groupMessage(MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: threadId))), atMessageId: messageId, preload: false)
|> deliverOnMainQueue
|> beforeNext { [weak context, weak navigationController] result in
@ -375,7 +375,9 @@ public func navigateToForumThreadImpl(context: AccountContext, peerId: EnginePee
chatLocationContextHolder: result.contextHolder,
subject: messageId.flatMap { .message(id: .id($0), highlight: ChatControllerSubject.MessageHighlight(quote: nil), timecode: nil) },
activateInput: actualActivateInput,
keepStack: keepStack
keepStack: keepStack,
scrollToEndIfExists: scrollToEndIfExists,
animated: !scrollToEndIfExists
)
)
}

View File

@ -216,7 +216,7 @@ func openResolvedUrlImpl(
}
case let .replyThread(messageId):
if let navigationController = navigationController {
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .always).startStandalone()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .always).startStandalone()
}
case let .stickerPack(name, _):
dismissInput()

View File

@ -1526,8 +1526,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
navigateToForumChannelImpl(context: context, peerId: peerId, navigationController: navigationController)
}
public func navigateToForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError> {
return navigateToForumThreadImpl(context: context, peerId: peerId, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: activateInput, keepStack: keepStack)
public func navigateToForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, messageId: EngineMessage.Id?, navigationController: NavigationController, activateInput: ChatControllerActivateInput?, scrollToEndIfExists: Bool, keepStack: NavigateToChatKeepStack) -> Signal<Never, NoError> {
return navigateToForumThreadImpl(context: context, peerId: peerId, threadId: threadId, messageId: messageId, navigationController: navigationController, activateInput: activateInput, scrollToEndIfExists: scrollToEndIfExists, keepStack: keepStack)
}
public func chatControllerForForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64) -> Signal<ChatController, NoError> {
@ -2481,13 +2481,22 @@ public final class SharedAccountContextImpl: SharedAccountContext {
return controller
}
public func makeStickerPackScreen(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, mainStickerPack: StickerPackReference, stickerPacks: [StickerPackReference], loadedStickerPacks: [LoadedStickerPack], isEditing: Bool, expandIfNeeded: Bool, parentNavigationController: NavigationController?, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)?) -> ViewController {
return StickerPackScreen(context: context, updatedPresentationData: updatedPresentationData, mainStickerPack: mainStickerPack, stickerPacks: stickerPacks, loadedStickerPacks: loadedStickerPacks, isEditing: isEditing, expandIfNeeded: expandIfNeeded, parentNavigationController: parentNavigationController, sendSticker: sendSticker)
public func makeStickerPackScreen(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, mainStickerPack: StickerPackReference, stickerPacks: [StickerPackReference], loadedStickerPacks: [LoadedStickerPack], isEditing: Bool, expandIfNeeded: Bool, parentNavigationController: NavigationController?, sendSticker: ((FileMediaReference, UIView, CGRect) -> Bool)?, actionPerformed: ((Bool) -> Void)?) -> ViewController {
return StickerPackScreen(context: context, updatedPresentationData: updatedPresentationData, mainStickerPack: mainStickerPack, stickerPacks: stickerPacks, loadedStickerPacks: loadedStickerPacks, isEditing: isEditing, expandIfNeeded: expandIfNeeded, parentNavigationController: parentNavigationController, sendSticker: sendSticker, actionPerformed: { actions in
if let (_, _, action) = actions.first {
switch action {
case .add:
actionPerformed?(true)
case .remove:
actionPerformed?(false)
}
}
})
}
public func makeStickerEditorScreen(context: AccountContext, source: Any?, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, [String], @escaping () -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController {
public func makeStickerEditorScreen(context: AccountContext, source: Any?, intro: Bool, transitionArguments: (UIView, CGRect, UIImage?)?, completion: @escaping (TelegramMediaFile, [String], @escaping () -> Void) -> Void, cancelled: @escaping () -> Void) -> ViewController {
let subject: Signal<MediaEditorScreen.Subject?, NoError>
let mode: MediaEditorScreen.Mode.StickerEditorMode
var mode: MediaEditorScreen.Mode.StickerEditorMode
var fromCamera = false
if let (file, emoji) = source as? (TelegramMediaFile, [String]) {
subject = .single(.sticker(file, emoji))
@ -2516,6 +2525,9 @@ public final class SharedAccountContextImpl: SharedAccountContext {
subject = .single(.empty(PixelDimensions(width: 1080, height: 1920)))
mode = .addingToPack
}
if intro {
mode = .businessIntro
}
let editorController = MediaEditorScreen(
context: context,
mode: .stickerEditor(mode: mode),

View File

@ -82,7 +82,7 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: EnginePeer.Id?, n
}
case let .replyThread(messageId):
if let navigationController = controller.navigationController as? NavigationController {
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .always).start()
let _ = context.sharedContext.navigateToForumThread(context: context, peerId: messageId.peerId, threadId: Int64(messageId.id), messageId: nil, navigationController: navigationController, activateInput: nil, scrollToEndIfExists: false, keepStack: .always).start()
}
case let .stickerPack(name, _):
let packReference: StickerPackReference = .name(name)

View File

@ -1204,7 +1204,11 @@ public func resolveUrlImpl(context: AccountContext, peerId: PeerId?, url: String
var url = url
let lowercasedUrl = url.lowercased()
if (lowercasedUrl.hasPrefix(scheme) && (lowercasedUrl.hasSuffix(".\(basePath)") || lowercasedUrl.contains(".\(basePath)/") || lowercasedUrl.contains(".\(basePath)?"))) {
url = basePrefix + String(url[scheme.endIndex...]).replacingOccurrences(of: ".\(basePath)/", with: "").replacingOccurrences(of: ".\(basePath)", with: "")
let restUrl = String(url[scheme.endIndex...])
if let slashRange = restUrl.range(of: "/"), let baseRange = restUrl.range(of: basePath), slashRange.lowerBound < baseRange.lowerBound {
} else {
url = basePrefix + restUrl.replacingOccurrences(of: ".\(basePath)/", with: "/").replacingOccurrences(of: ".\(basePath)", with: "")
}
}
if url.lowercased().hasPrefix(basePrefix) {
if let internalUrl = parseInternalUrl(sharedContext: context.sharedContext, query: String(url[basePrefix.endIndex...])) {