Various improvements

This commit is contained in:
Ilya Laktyushin 2022-10-19 02:20:01 +03:00
parent cd2816025c
commit e85b6cac30
13 changed files with 111 additions and 104 deletions

View File

@ -366,6 +366,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.animationCache = context.animationCache
self.animationRenderer = context.animationRenderer
let groupCallPanelSource: GroupCallPanelSource
switch self.location {
case .chatList:
self.titleView = ChatListTitleView(
@ -375,8 +376,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
animationCache: self.animationCache,
animationRenderer: self.animationRenderer
)
case .forum:
groupCallPanelSource = .all
case let .forum(peerId):
self.chatTitleView = ChatTitleView(context: self.context, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, animationCache: self.context.animationCache, animationRenderer: self.context.animationRenderer)
groupCallPanelSource = .peer(peerId)
}
self.moreBarButton = MoreHeaderButton(color: self.presentationData.theme.rootController.navigationBar.buttonColor)
@ -386,8 +389,8 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.moreBarButtonItem = UIBarButtonItem(customDisplayNode: self.moreBarButton)!
self.tabContainerNode = ChatListFilterTabContainerNode()
super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), mediaAccessoryPanelVisibility: .always, locationBroadcastPanelSource: .summary, groupCallPanelSource: .all)
super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), mediaAccessoryPanelVisibility: .always, locationBroadcastPanelSource: .summary, groupCallPanelSource: groupCallPanelSource)
self.tabBarItemContextActionType = .always

View File

@ -2067,7 +2067,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
environment: {},
containerSize: CGSize(width: 32.0, height: 32.0)
)
transition.updateFrame(view: avatarIconView, frame: CGRect(origin: CGPoint(x: params.leftInset + floor((leftInset - params.leftInset - iconSize.width) / 2.0) + revealOffset, y: contentRect.origin.y + 2.0), size: iconSize))
transition.updateFrame(view: avatarIconView, frame: CGRect(origin: CGPoint(x: editingOffset + params.leftInset + floor((leftInset - params.leftInset - iconSize.width) / 2.0) + revealOffset, y: contentRect.origin.y + 2.0), size: iconSize))
} else if let avatarIconView = strongSelf.avatarIconView {
strongSelf.avatarIconView = nil
avatarIconView.removeFromSuperview()

View File

@ -342,10 +342,16 @@ public enum ChatHistoryNodeHistoryState: Equatable {
public final class ChatPresentationInterfaceState: Equatable {
public struct ThreadData: Equatable {
public var title: String
public var icon: Int64?
public var iconColor: Int32
public var isOwn: Bool
public var isClosed: Bool
public init(isOwn: Bool, isClosed: Bool) {
public init(title: String, icon: Int64?, iconColor: Int32, isOwn: Bool, isClosed: Bool) {
self.title = title
self.icon = icon
self.iconColor = iconColor
self.isOwn = isOwn
self.isClosed = isClosed
}

View File

@ -1253,7 +1253,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
if let fileId = threadInfo.icon, fileId != 0 {
avatarIconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 48.0, height: 48.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .forever)
} else {
avatarIconContent = .topic(title: String(threadInfo.title.prefix(1)), colorIndex: Int(clamping: abs(threadInfo.iconColor)), size: threadIconFrame.size)
avatarIconContent = .topic(title: String(threadInfo.title.prefix(1)), color: threadInfo.iconColor, size: threadIconFrame.size)
}
let avatarIconComponent = EmojiStatusComponent(

View File

@ -230,41 +230,6 @@
return controller;
}
- (TGMenuSheetController *)_presentLegacyAvatarMenu
{
NSMutableArray *actions = [[NSMutableArray alloc] init];
if ([PGCamera cameraAvailable]) {
[actions addObject:[[LegacyComponentsActionSheetAction alloc] initWithTitle:TGLocalized(@"Common.TakePhoto") action:@"camera"]];
}
[actions addObject:[[LegacyComponentsActionSheetAction alloc] initWithTitle:TGLocalized(@"Common.ChoosePhoto") action:@"choosePhoto"]];
if (_hasDeleteButton)
{
[actions addObject:[[LegacyComponentsActionSheetAction alloc] initWithTitle:TGLocalized(@"GroupInfo.SetGroupPhotoDelete") action:@"delete" type:LegacyComponentsActionSheetActionTypeDestructive]];
}
[actions addObject:[[LegacyComponentsActionSheetAction alloc] initWithTitle:TGLocalized(@"Common.Cancel") action:@"cancel" type:LegacyComponentsActionSheetActionTypeCancel]];
__weak TGMediaAvatarMenuMixin *weakSelf = self;
[_context presentActionSheet:actions view:_parentController.view sourceRect:self.sourceRect completion:^(LegacyComponentsActionSheetAction *actionData) {
__strong TGMediaAvatarMenuMixin *controller = weakSelf;
if (controller != nil) {
NSString *action = actionData.action;
if ([action isEqualToString:@"camera"])
[controller _displayCameraWithView:nil menuController:nil];
else if ([action isEqualToString:@"choosePhoto"])
[controller _displayMediaPicker];
else if ([action isEqualToString:@"delete"])
[controller _performDelete];
else if ([action isEqualToString:@"cancel"] && controller.didDismiss != nil)
controller.didDismiss();
}
}];
return nil;
}
- (void)_displayCameraWithView:(TGAttachmentCameraView *)cameraView menuController:(TGMenuSheetController *)menuController
{
[[[LegacyComponentsGlobals provider] accessChecker] checkCameraAuthorizationStatusForIntent:TGCameraAccessIntentDefault completion:^(BOOL allowed) {

View File

@ -821,6 +821,8 @@
- (void)viewWillAppear:(BOOL)animated
{
if (_dismissed)
return;
if (![self inFormSheet] && (self.navigationController != nil || self.dontHideStatusBar))
{
if (animated)
@ -849,6 +851,8 @@
- (void)viewDidAppear:(BOOL)animated
{
if (_dismissed)
return;
if (self.navigationController != nil)
{
_viewFillingWholeScreen = true;
@ -875,17 +879,19 @@
else
[_context forceSetStatusBarHidden:[self prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone];
if (animated)
{
[UIView animateWithDuration:0.3 animations:^
TGDispatchAfter(0.1, dispatch_get_main_queue(), ^{
if (animated)
{
[UIView animateWithDuration:0.3 animations:^
{
[_context setApplicationStatusBarAlpha:1.0f];
}];
}
else
{
[_context setApplicationStatusBarAlpha:1.0f];
}];
}
else
{
[_context setApplicationStatusBarAlpha:1.0f];
}
}
});
self.navigationController.interactivePopGestureRecognizer.enabled = true;
}
@ -898,20 +904,6 @@
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
//strange ios6 crashfix
if (iosMajorVersion() < 7 && !self.dontHideStatusBar)
{
TGDispatchAfter(0.5f, dispatch_get_main_queue(), ^
{
[_context forceSetStatusBarHidden:false withAnimation:UIStatusBarAnimationNone];
});
}
}
- (void)updateDoneButtonEnabled:(bool)enabled animated:(bool)animated
{
[_portraitToolbarView setEditButtonsEnabled:enabled animated:animated];

View File

@ -551,7 +551,7 @@ public final class ShareController: ViewController {
self?.presentingViewController?.dismiss(animated: false, completion: nil)
})
}
self.controllerNode.share = { [weak self] text, peerIds, showNames, silently in
self.controllerNode.share = { [weak self] text, peerIds, topicIds, showNames, silently in
guard let strongSelf = self else {
return .complete()
}
@ -577,46 +577,66 @@ public final class ShareController: ViewController {
})
}
}
switch subject {
case let .url(url):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
if !text.isEmpty {
messages.append(.message(text: url + "\n\n" + text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: url + "\n\n" + text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
} else {
messages.append(.message(text: url, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: url, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
case let .text(string):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
if !text.isEmpty {
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
messages.append(.message(text: string, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: string, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
case let .quote(string, url):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
if !text.isEmpty {
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
let attributedText = NSMutableAttributedString(string: string, attributes: [ChatTextInputAttributes.italic: true as NSNumber])
attributedText.append(NSAttributedString(string: "\n\n\(url)"))
let entities = generateChatInputTextEntities(attributedText)
messages.append(.message(text: attributedText.string, attributes: [TextEntitiesMessageAttribute(entities: entities)], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: attributedText.string, attributes: [TextEntitiesMessageAttribute(entities: entities)], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
case let .image(representations):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: .standalone(media: TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)), representations: representations.map({ $0.representation }), immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: [])), replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: .standalone(media: TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)), representations: representations.map({ $0.representation }), immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: [])), replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
@ -627,29 +647,44 @@ public final class ShareController: ViewController {
}
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
if !text.isEmpty && !sendTextAsCaption {
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
messages.append(.message(text: sendTextAsCaption ? text : "", attributes: [], inlineStickers: [:], mediaReference: mediaReference, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: sendTextAsCaption ? text : "", attributes: [], inlineStickers: [:], mediaReference: mediaReference, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
case let .mapMedia(media):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messages: [EnqueueMessage] = []
if !text.isEmpty {
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
messages.append(.message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: media), replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages.append(.message(text: "", attributes: [], inlineStickers: [:], mediaReference: .standalone(media: media), replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messages = transformMessages(messages, showNames: showNames, silently: silently)
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
}
case let .messages(messages):
for peerId in peerIds {
var replyToMessageId: MessageId?
if let topicId = topicIds[peerId] {
replyToMessageId = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: Int32(clamping: topicId))
}
var messagesToEnqueue: [EnqueueMessage] = []
if !text.isEmpty {
messagesToEnqueue.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
messagesToEnqueue.append(.message(text: text, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: replyToMessageId, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: []))
}
for message in messages {
messagesToEnqueue.append(.forward(source: message.id, grouping: .auto, attributes: [], correlationId: nil))

View File

@ -59,7 +59,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
var dismiss: ((Bool) -> Void)?
var cancel: (() -> Void)?
var share: ((String, [PeerId], Bool, Bool) -> Signal<ShareState, ShareControllerError>)?
var share: ((String, [PeerId], [PeerId: Int64], Bool, Bool) -> Signal<ShareState, ShareControllerError>)?
var shareExternal: ((Bool) -> Signal<ShareExternalState, NoError>)?
var switchToAnotherAccount: (() -> Void)?
var debugAction: (() -> Void)?
@ -245,7 +245,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
if let strongSelf = self {
var added = false
var openedTopic = false
var openedTopicList = false
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.peerId) {
strongSelf.controllerInteraction!.selectedTopics[peer.peerId] = nil
strongSelf.peersContentNode?.update()
@ -258,7 +258,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
strongSelf.peersContentNode?.update()
} else {
strongSelf.transitionToPeerTopics(peer)
openedTopic = true
openedTopicList = true
}
} else {
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.peerId)
@ -277,7 +277,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
strongSelf.peersContentNode?.updateFoundPeers()
}
if !openedTopic {
if !openedTopicList {
strongSelf.setActionNodesHidden(strongSelf.controllerInteraction!.selectedPeers.isEmpty && strongSelf.presetText == nil, inputField: true, actions: strongSelf.defaultAction == nil)
strongSelf.updateButton()
@ -302,6 +302,9 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
strongSelf.controllerInteraction?.selectedPeerIds.insert(peer.peerId)
strongSelf.controllerInteraction?.selectedTopics[peer.peerId] = (threadId, threadData)
strongSelf.peersContentNode?.update()
strongSelf.setActionNodesHidden(strongSelf.controllerInteraction!.selectedPeers.isEmpty && strongSelf.presetText == nil, inputField: true, actions: strongSelf.defaultAction == nil)
strongSelf.peersContentNode?.updateSelectedPeers(animated: false)
strongSelf.updateButton()
Queue.mainQueue().after(0.01, {
@ -412,7 +415,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
})
if let (layout, navigationBarHeight, _) = self.containerLayout {
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .animated(duration: 0.4, curve: .spring))
}
if let targetFrame = self.peersContentNode?.animateIn(peerId: peerId), let topicsContentNode = self.topicsContentNode {
@ -731,17 +734,19 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
transition.updateAlpha(node: self.actionsBackgroundNode, alpha: 0.0)
let peerIds: [PeerId]
var topicIds: [PeerId: Int64] = [:]
if let peerId = peerId {
peerIds = [peerId]
} else {
peerIds = self.controllerInteraction!.selectedPeers.map { $0.peerId }
topicIds = self.controllerInteraction!.selectedTopics.mapValues { $0.0 }
}
if let context = self.context {
donateSendMessageIntent(account: context.account, sharedContext: self.sharedContext, intentContext: .share, peerIds: peerIds)
}
if let signal = self.share?(self.inputFieldNode.text, peerIds, showNames, silently) {
if let signal = self.share?(self.inputFieldNode.text, peerIds, topicIds, showNames, silently) {
var wasDone = false
let timestamp = CACurrentMediaTime()
let doneImpl: (Bool) -> Void = { [weak self] shouldDelay in
@ -1231,7 +1236,7 @@ private func threadList(context: AccountContext, peerId: EnginePeer.Id) -> Signa
id: .forum(item.id),
index: .forum(pinnedIndex: pinnedIndex, timestamp: item.index.timestamp, threadId: item.id, namespace: item.index.id.namespace, id: item.index.id.id),
messages: item.topMessage.flatMap { [EngineMessage($0)] } ?? [],
readCounters: EnginePeerReadCounters(state: CombinedPeerReadState(states: [(Namespaces.Message.Cloud, .idBased(maxIncomingReadId: 1, maxOutgoingReadId: 1, maxKnownId: 1, count: data.incomingUnreadCount, markedUnread: false))])),
readCounters: nil,
isMuted: false,
draft: nil,
threadData: data,

View File

@ -367,15 +367,21 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
node = itemNode
}
}
return node?.frame
return node?.frame.offsetBy(dx: 0.0, dy: -10.0)
}
func generateMaskImage() -> UIImage? {
return generateImage(CGSize(width: 100.0, height: 100.0), contextGenerator: { size, context in
context.clear(CGRect(origin: .zero, size: size))
let path = UIBezierPath(roundedRect: CGRect(origin: .zero, size: size).insetBy(dx: 16.0, dy: 16.0), cornerRadius: 16.0)
context.setFillColor(UIColor.white.cgColor)
context.setShadow(offset: .zero, blur: 40.0, color: UIColor.white.cgColor)
context.fill(CGRect(origin: .zero, size: size).insetBy(dx: 16.0, dy: 16.0))
for _ in 0 ..< 10 {
context.addPath(path.cgPath)
context.fillPath()
}
})?.stretchableImage(withLeftCapWidth: 49, topCapHeight: 49)
}
@ -490,7 +496,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
let distance = sourceCenter.distance(to: itemNode.position)
let newDistance = distance * 2.8
let newPosition = snapshotView.center.offsetBy(distance: newDistance, inDirection: angle)
snapshotView.layer.animatePosition(from: snapshotView.center, to: newPosition, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
snapshotView.layer.animatePosition(from: snapshotView.center, to: newPosition, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
}
snapshotView.layer.animateScale(from: 1.0, to: 1.35, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
}

View File

@ -104,7 +104,7 @@ final class ShareTopicGridItemNode: GridItemNode {
let iconContent: EmojiStatusComponent.Content
if let fileId = item.threadInfo.info.icon {
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 54.0, height: 54.0), placeholderColor: item.theme.actionSheet.disabledActionTextColor, themeColor: item.theme.actionSheet.primaryTextColor, loopMode: .count(2))
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 96.0, height: 96.0), placeholderColor: item.theme.actionSheet.disabledActionTextColor, themeColor: item.theme.actionSheet.primaryTextColor, loopMode: .count(2))
} else {
iconContent = .topic(title: String(item.threadInfo.info.title.prefix(1)), color: item.threadInfo.info.iconColor, size: CGSize(width: 64.0, height: 64.0))
}

View File

@ -343,12 +343,12 @@ final class ShareTopicsContainerNode: ASDisplayNode, ShareContentContainerNode {
self.contentSubtitleNode.layer.animateScale(from: 1.0, to: 0.85, duration: 0.2)
self.contentGridNode.alpha = 0.0
self.contentGridNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in
self.contentGridNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, completion: { _ in
completion()
})
self.contentGridNode.forEachItemNode { itemNode in
itemNode.layer.animatePosition(from: itemNode.position, to: targetFrame.center, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
itemNode.layer.animatePosition(from: itemNode.position, to: targetFrame.center, duration: 0.45, timingFunction: kCAMediaTimingFunctionSpring)
itemNode.layer.animateScale(from: 1.0, to: 0.2, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
}
}

View File

@ -6168,7 +6168,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
guard let data = view.info?.data.get(MessageHistoryThreadData.self) else {
return nil
}
return ChatPresentationInterfaceState.ThreadData(isOwn: data.isOwnedByMe, isClosed: data.isClosed)
return ChatPresentationInterfaceState.ThreadData(title: data.info.title, icon: data.info.icon, iconColor: data.info.iconColor, isOwn: data.isOwnedByMe, isClosed: data.isClosed)
}
|> distinctUntilChanged
} else {

View File

@ -779,7 +779,6 @@ private final class ChatEmptyNodeCloudChatContent: ASDisplayNode, ChatEmptyNodeC
final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent, UIGestureRecognizerDelegate {
private let context: AccountContext
private let fileId: Int64?
private let titleNode: ImmediateTextNode
private let textNode: ImmediateTextNode
@ -789,9 +788,8 @@ final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent,
private let iconView: ComponentView<Empty>
init(context: AccountContext, fileId: Int64?) {
init(context: AccountContext) {
self.context = context
self.fileId = fileId
self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 0
@ -833,16 +831,13 @@ final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent,
inset = 15.0
}
let title = ""
let iconContent: EmojiStatusComponent.Content
if let fileId = self.fileId {
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 54.0, height: 54.0), placeholderColor: .clear, themeColor: serviceColor.primaryText, loopMode: .count(2))
if let fileId = interfaceState.threadData?.icon {
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 96.0, height: 96.0), placeholderColor: .clear, themeColor: serviceColor.primaryText, loopMode: .count(2))
} else {
let colorIndex: Int32 = 0
// if case let .replyThread(replyThreadMessage) = interfaceState.chatLocation {
// colorIndex = Int(clamping: abs(replyThreadMessage.effectiveTopId.id))
// }
iconContent = .topic(title: String(title.prefix(1)), color: colorIndex, size: CGSize(width: 64.0, height: 64.0))
let title = interfaceState.threadData?.title ?? ""
let iconColor = interfaceState.threadData?.iconColor ?? 0
iconContent = .topic(title: String(title.prefix(1)), color: iconColor, size: CGSize(width: 64.0, height: 64.0))
}
let insets = UIEdgeInsets(top: inset, left: inset, bottom: inset, right: inset)
@ -1035,7 +1030,7 @@ final class ChatEmptyNode: ASDisplayNode {
node = ChatEmptyNodeGreetingChatContent(context: self.context, interaction: self.interaction)
updateGreetingSticker = true
case .topic:
node = ChatEmptyNodeTopicChatContent(context: self.context, fileId: nil)
node = ChatEmptyNodeTopicChatContent(context: self.context)
}
self.content = (contentType, node)
self.addSubnode(node)