mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Various improvements
This commit is contained in:
parent
cd2816025c
commit
e85b6cac30
@ -366,6 +366,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
self.animationCache = context.animationCache
|
self.animationCache = context.animationCache
|
||||||
self.animationRenderer = context.animationRenderer
|
self.animationRenderer = context.animationRenderer
|
||||||
|
|
||||||
|
let groupCallPanelSource: GroupCallPanelSource
|
||||||
switch self.location {
|
switch self.location {
|
||||||
case .chatList:
|
case .chatList:
|
||||||
self.titleView = ChatListTitleView(
|
self.titleView = ChatListTitleView(
|
||||||
@ -375,8 +376,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
animationCache: self.animationCache,
|
animationCache: self.animationCache,
|
||||||
animationRenderer: self.animationRenderer
|
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)
|
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)
|
self.moreBarButton = MoreHeaderButton(color: self.presentationData.theme.rootController.navigationBar.buttonColor)
|
||||||
@ -387,7 +390,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
|
|
||||||
self.tabContainerNode = ChatListFilterTabContainerNode()
|
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
|
self.tabBarItemContextActionType = .always
|
||||||
|
|
||||||
|
|||||||
@ -2067,7 +2067,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: 32.0, height: 32.0)
|
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 {
|
} else if let avatarIconView = strongSelf.avatarIconView {
|
||||||
strongSelf.avatarIconView = nil
|
strongSelf.avatarIconView = nil
|
||||||
avatarIconView.removeFromSuperview()
|
avatarIconView.removeFromSuperview()
|
||||||
|
|||||||
@ -342,10 +342,16 @@ public enum ChatHistoryNodeHistoryState: Equatable {
|
|||||||
|
|
||||||
public final class ChatPresentationInterfaceState: Equatable {
|
public final class ChatPresentationInterfaceState: Equatable {
|
||||||
public struct ThreadData: Equatable {
|
public struct ThreadData: Equatable {
|
||||||
|
public var title: String
|
||||||
|
public var icon: Int64?
|
||||||
|
public var iconColor: Int32
|
||||||
public var isOwn: Bool
|
public var isOwn: Bool
|
||||||
public var isClosed: 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.isOwn = isOwn
|
||||||
self.isClosed = isClosed
|
self.isClosed = isClosed
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1253,7 +1253,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
|
|||||||
if let fileId = threadInfo.icon, fileId != 0 {
|
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)
|
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 {
|
} 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(
|
let avatarIconComponent = EmojiStatusComponent(
|
||||||
|
|||||||
@ -230,41 +230,6 @@
|
|||||||
return controller;
|
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
|
- (void)_displayCameraWithView:(TGAttachmentCameraView *)cameraView menuController:(TGMenuSheetController *)menuController
|
||||||
{
|
{
|
||||||
[[[LegacyComponentsGlobals provider] accessChecker] checkCameraAuthorizationStatusForIntent:TGCameraAccessIntentDefault completion:^(BOOL allowed) {
|
[[[LegacyComponentsGlobals provider] accessChecker] checkCameraAuthorizationStatusForIntent:TGCameraAccessIntentDefault completion:^(BOOL allowed) {
|
||||||
|
|||||||
@ -821,6 +821,8 @@
|
|||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
|
if (_dismissed)
|
||||||
|
return;
|
||||||
if (![self inFormSheet] && (self.navigationController != nil || self.dontHideStatusBar))
|
if (![self inFormSheet] && (self.navigationController != nil || self.dontHideStatusBar))
|
||||||
{
|
{
|
||||||
if (animated)
|
if (animated)
|
||||||
@ -849,6 +851,8 @@
|
|||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
|
if (_dismissed)
|
||||||
|
return;
|
||||||
if (self.navigationController != nil)
|
if (self.navigationController != nil)
|
||||||
{
|
{
|
||||||
_viewFillingWholeScreen = true;
|
_viewFillingWholeScreen = true;
|
||||||
@ -875,6 +879,7 @@
|
|||||||
else
|
else
|
||||||
[_context forceSetStatusBarHidden:[self prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone];
|
[_context forceSetStatusBarHidden:[self prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone];
|
||||||
|
|
||||||
|
TGDispatchAfter(0.1, dispatch_get_main_queue(), ^{
|
||||||
if (animated)
|
if (animated)
|
||||||
{
|
{
|
||||||
[UIView animateWithDuration:0.3 animations:^
|
[UIView animateWithDuration:0.3 animations:^
|
||||||
@ -886,6 +891,7 @@
|
|||||||
{
|
{
|
||||||
[_context setApplicationStatusBarAlpha:1.0f];
|
[_context setApplicationStatusBarAlpha:1.0f];
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
self.navigationController.interactivePopGestureRecognizer.enabled = true;
|
self.navigationController.interactivePopGestureRecognizer.enabled = true;
|
||||||
}
|
}
|
||||||
@ -898,20 +904,6 @@
|
|||||||
[super viewWillDisappear:animated];
|
[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
|
- (void)updateDoneButtonEnabled:(bool)enabled animated:(bool)animated
|
||||||
{
|
{
|
||||||
[_portraitToolbarView setEditButtonsEnabled:enabled animated:animated];
|
[_portraitToolbarView setEditButtonsEnabled:enabled animated:animated];
|
||||||
|
|||||||
@ -551,7 +551,7 @@ public final class ShareController: ViewController {
|
|||||||
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
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 {
|
guard let strongSelf = self else {
|
||||||
return .complete()
|
return .complete()
|
||||||
}
|
}
|
||||||
@ -581,42 +581,62 @@ public final class ShareController: ViewController {
|
|||||||
switch subject {
|
switch subject {
|
||||||
case let .url(url):
|
case let .url(url):
|
||||||
for peerId in peerIds {
|
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] = []
|
var messages: [EnqueueMessage] = []
|
||||||
if !text.isEmpty {
|
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 {
|
} 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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
case let .text(string):
|
case let .text(string):
|
||||||
for peerId in peerIds {
|
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] = []
|
var messages: [EnqueueMessage] = []
|
||||||
if !text.isEmpty {
|
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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
case let .quote(string, url):
|
case let .quote(string, url):
|
||||||
for peerId in peerIds {
|
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] = []
|
var messages: [EnqueueMessage] = []
|
||||||
if !text.isEmpty {
|
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])
|
let attributedText = NSMutableAttributedString(string: string, attributes: [ChatTextInputAttributes.italic: true as NSNumber])
|
||||||
attributedText.append(NSAttributedString(string: "\n\n\(url)"))
|
attributedText.append(NSAttributedString(string: "\n\n\(url)"))
|
||||||
let entities = generateChatInputTextEntities(attributedText)
|
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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
case let .image(representations):
|
case let .image(representations):
|
||||||
for peerId in peerIds {
|
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] = []
|
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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
@ -627,29 +647,44 @@ public final class ShareController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for peerId in peerIds {
|
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] = []
|
var messages: [EnqueueMessage] = []
|
||||||
if !text.isEmpty && !sendTextAsCaption {
|
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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
case let .mapMedia(media):
|
case let .mapMedia(media):
|
||||||
for peerId in peerIds {
|
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] = []
|
var messages: [EnqueueMessage] = []
|
||||||
if !text.isEmpty {
|
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)
|
messages = transformMessages(messages, showNames: showNames, silently: silently)
|
||||||
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
shareSignals.append(enqueueMessages(account: strongSelf.currentAccount, peerId: peerId, messages: messages))
|
||||||
}
|
}
|
||||||
case let .messages(messages):
|
case let .messages(messages):
|
||||||
for peerId in peerIds {
|
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] = []
|
var messagesToEnqueue: [EnqueueMessage] = []
|
||||||
if !text.isEmpty {
|
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 {
|
for message in messages {
|
||||||
messagesToEnqueue.append(.forward(source: message.id, grouping: .auto, attributes: [], correlationId: nil))
|
messagesToEnqueue.append(.forward(source: message.id, grouping: .auto, attributes: [], correlationId: nil))
|
||||||
|
|||||||
@ -59,7 +59,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
|
|
||||||
var dismiss: ((Bool) -> Void)?
|
var dismiss: ((Bool) -> Void)?
|
||||||
var cancel: (() -> 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 shareExternal: ((Bool) -> Signal<ShareExternalState, NoError>)?
|
||||||
var switchToAnotherAccount: (() -> Void)?
|
var switchToAnotherAccount: (() -> Void)?
|
||||||
var debugAction: (() -> Void)?
|
var debugAction: (() -> Void)?
|
||||||
@ -245,7 +245,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
|
self.controllerInteraction = ShareControllerInteraction(togglePeer: { [weak self] peer, search in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
var added = false
|
var added = false
|
||||||
var openedTopic = false
|
var openedTopicList = false
|
||||||
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.peerId) {
|
if strongSelf.controllerInteraction!.selectedPeerIds.contains(peer.peerId) {
|
||||||
strongSelf.controllerInteraction!.selectedTopics[peer.peerId] = nil
|
strongSelf.controllerInteraction!.selectedTopics[peer.peerId] = nil
|
||||||
strongSelf.peersContentNode?.update()
|
strongSelf.peersContentNode?.update()
|
||||||
@ -258,7 +258,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
strongSelf.peersContentNode?.update()
|
strongSelf.peersContentNode?.update()
|
||||||
} else {
|
} else {
|
||||||
strongSelf.transitionToPeerTopics(peer)
|
strongSelf.transitionToPeerTopics(peer)
|
||||||
openedTopic = true
|
openedTopicList = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.peerId)
|
strongSelf.controllerInteraction!.selectedPeerIds.insert(peer.peerId)
|
||||||
@ -277,7 +277,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
strongSelf.peersContentNode?.updateFoundPeers()
|
strongSelf.peersContentNode?.updateFoundPeers()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !openedTopic {
|
if !openedTopicList {
|
||||||
strongSelf.setActionNodesHidden(strongSelf.controllerInteraction!.selectedPeers.isEmpty && strongSelf.presetText == nil, inputField: true, actions: strongSelf.defaultAction == nil)
|
strongSelf.setActionNodesHidden(strongSelf.controllerInteraction!.selectedPeers.isEmpty && strongSelf.presetText == nil, inputField: true, actions: strongSelf.defaultAction == nil)
|
||||||
|
|
||||||
strongSelf.updateButton()
|
strongSelf.updateButton()
|
||||||
@ -302,6 +302,9 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
strongSelf.controllerInteraction?.selectedPeerIds.insert(peer.peerId)
|
strongSelf.controllerInteraction?.selectedPeerIds.insert(peer.peerId)
|
||||||
strongSelf.controllerInteraction?.selectedTopics[peer.peerId] = (threadId, threadData)
|
strongSelf.controllerInteraction?.selectedTopics[peer.peerId] = (threadId, threadData)
|
||||||
strongSelf.peersContentNode?.update()
|
strongSelf.peersContentNode?.update()
|
||||||
|
|
||||||
|
strongSelf.setActionNodesHidden(strongSelf.controllerInteraction!.selectedPeers.isEmpty && strongSelf.presetText == nil, inputField: true, actions: strongSelf.defaultAction == nil)
|
||||||
|
|
||||||
strongSelf.peersContentNode?.updateSelectedPeers(animated: false)
|
strongSelf.peersContentNode?.updateSelectedPeers(animated: false)
|
||||||
strongSelf.updateButton()
|
strongSelf.updateButton()
|
||||||
Queue.mainQueue().after(0.01, {
|
Queue.mainQueue().after(0.01, {
|
||||||
@ -412,7 +415,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
})
|
})
|
||||||
|
|
||||||
if let (layout, navigationBarHeight, _) = self.containerLayout {
|
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 {
|
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)
|
transition.updateAlpha(node: self.actionsBackgroundNode, alpha: 0.0)
|
||||||
|
|
||||||
let peerIds: [PeerId]
|
let peerIds: [PeerId]
|
||||||
|
var topicIds: [PeerId: Int64] = [:]
|
||||||
if let peerId = peerId {
|
if let peerId = peerId {
|
||||||
peerIds = [peerId]
|
peerIds = [peerId]
|
||||||
} else {
|
} else {
|
||||||
peerIds = self.controllerInteraction!.selectedPeers.map { $0.peerId }
|
peerIds = self.controllerInteraction!.selectedPeers.map { $0.peerId }
|
||||||
|
topicIds = self.controllerInteraction!.selectedTopics.mapValues { $0.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
if let context = self.context {
|
if let context = self.context {
|
||||||
donateSendMessageIntent(account: context.account, sharedContext: self.sharedContext, intentContext: .share, peerIds: peerIds)
|
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
|
var wasDone = false
|
||||||
let timestamp = CACurrentMediaTime()
|
let timestamp = CACurrentMediaTime()
|
||||||
let doneImpl: (Bool) -> Void = { [weak self] shouldDelay in
|
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),
|
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),
|
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)] } ?? [],
|
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,
|
isMuted: false,
|
||||||
draft: nil,
|
draft: nil,
|
||||||
threadData: data,
|
threadData: data,
|
||||||
|
|||||||
@ -367,15 +367,21 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
node = itemNode
|
node = itemNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return node?.frame
|
return node?.frame.offsetBy(dx: 0.0, dy: -10.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateMaskImage() -> UIImage? {
|
func generateMaskImage() -> UIImage? {
|
||||||
return generateImage(CGSize(width: 100.0, height: 100.0), contextGenerator: { size, context in
|
return generateImage(CGSize(width: 100.0, height: 100.0), contextGenerator: { size, context in
|
||||||
context.clear(CGRect(origin: .zero, size: size))
|
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.setFillColor(UIColor.white.cgColor)
|
||||||
context.setShadow(offset: .zero, blur: 40.0, color: 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)
|
})?.stretchableImage(withLeftCapWidth: 49, topCapHeight: 49)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +496,7 @@ final class SharePeersContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
let distance = sourceCenter.distance(to: itemNode.position)
|
let distance = sourceCenter.distance(to: itemNode.position)
|
||||||
let newDistance = distance * 2.8
|
let newDistance = distance * 2.8
|
||||||
let newPosition = snapshotView.center.offsetBy(distance: newDistance, inDirection: angle)
|
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)
|
snapshotView.layer.animateScale(from: 1.0, to: 1.35, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,7 @@ final class ShareTopicGridItemNode: GridItemNode {
|
|||||||
|
|
||||||
let iconContent: EmojiStatusComponent.Content
|
let iconContent: EmojiStatusComponent.Content
|
||||||
if let fileId = item.threadInfo.info.icon {
|
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 {
|
} else {
|
||||||
iconContent = .topic(title: String(item.threadInfo.info.title.prefix(1)), color: item.threadInfo.info.iconColor, size: CGSize(width: 64.0, height: 64.0))
|
iconContent = .topic(title: String(item.threadInfo.info.title.prefix(1)), color: item.threadInfo.info.iconColor, size: CGSize(width: 64.0, height: 64.0))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,12 +343,12 @@ final class ShareTopicsContainerNode: ASDisplayNode, ShareContentContainerNode {
|
|||||||
self.contentSubtitleNode.layer.animateScale(from: 1.0, to: 0.85, duration: 0.2)
|
self.contentSubtitleNode.layer.animateScale(from: 1.0, to: 0.85, duration: 0.2)
|
||||||
|
|
||||||
self.contentGridNode.alpha = 0.0
|
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()
|
completion()
|
||||||
})
|
})
|
||||||
|
|
||||||
self.contentGridNode.forEachItemNode { itemNode in
|
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)
|
itemNode.layer.animateScale(from: 1.0, to: 0.2, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6168,7 +6168,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
guard let data = view.info?.data.get(MessageHistoryThreadData.self) else {
|
guard let data = view.info?.data.get(MessageHistoryThreadData.self) else {
|
||||||
return nil
|
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
|
|> distinctUntilChanged
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -779,7 +779,6 @@ private final class ChatEmptyNodeCloudChatContent: ASDisplayNode, ChatEmptyNodeC
|
|||||||
|
|
||||||
final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent, UIGestureRecognizerDelegate {
|
final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent, UIGestureRecognizerDelegate {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private let fileId: Int64?
|
|
||||||
|
|
||||||
private let titleNode: ImmediateTextNode
|
private let titleNode: ImmediateTextNode
|
||||||
private let textNode: ImmediateTextNode
|
private let textNode: ImmediateTextNode
|
||||||
@ -789,9 +788,8 @@ final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent,
|
|||||||
|
|
||||||
private let iconView: ComponentView<Empty>
|
private let iconView: ComponentView<Empty>
|
||||||
|
|
||||||
init(context: AccountContext, fileId: Int64?) {
|
init(context: AccountContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.fileId = fileId
|
|
||||||
|
|
||||||
self.titleNode = ImmediateTextNode()
|
self.titleNode = ImmediateTextNode()
|
||||||
self.titleNode.maximumNumberOfLines = 0
|
self.titleNode.maximumNumberOfLines = 0
|
||||||
@ -833,16 +831,13 @@ final class ChatEmptyNodeTopicChatContent: ASDisplayNode, ChatEmptyNodeContent,
|
|||||||
inset = 15.0
|
inset = 15.0
|
||||||
}
|
}
|
||||||
|
|
||||||
let title = ""
|
|
||||||
let iconContent: EmojiStatusComponent.Content
|
let iconContent: EmojiStatusComponent.Content
|
||||||
if let fileId = self.fileId {
|
if let fileId = interfaceState.threadData?.icon {
|
||||||
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 54.0, height: 54.0), placeholderColor: .clear, themeColor: serviceColor.primaryText, loopMode: .count(2))
|
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 96.0, height: 96.0), placeholderColor: .clear, themeColor: serviceColor.primaryText, loopMode: .count(2))
|
||||||
} else {
|
} else {
|
||||||
let colorIndex: Int32 = 0
|
let title = interfaceState.threadData?.title ?? ""
|
||||||
// if case let .replyThread(replyThreadMessage) = interfaceState.chatLocation {
|
let iconColor = interfaceState.threadData?.iconColor ?? 0
|
||||||
// colorIndex = Int(clamping: abs(replyThreadMessage.effectiveTopId.id))
|
iconContent = .topic(title: String(title.prefix(1)), color: iconColor, size: CGSize(width: 64.0, height: 64.0))
|
||||||
// }
|
|
||||||
iconContent = .topic(title: String(title.prefix(1)), color: colorIndex, size: CGSize(width: 64.0, height: 64.0))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let insets = UIEdgeInsets(top: inset, left: inset, bottom: inset, right: inset)
|
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)
|
node = ChatEmptyNodeGreetingChatContent(context: self.context, interaction: self.interaction)
|
||||||
updateGreetingSticker = true
|
updateGreetingSticker = true
|
||||||
case .topic:
|
case .topic:
|
||||||
node = ChatEmptyNodeTopicChatContent(context: self.context, fileId: nil)
|
node = ChatEmptyNodeTopicChatContent(context: self.context)
|
||||||
}
|
}
|
||||||
self.content = (contentType, node)
|
self.content = (contentType, node)
|
||||||
self.addSubnode(node)
|
self.addSubnode(node)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user