diff --git a/TelegramUI/AuthorizationSequenceCodeEntryController.swift b/TelegramUI/AuthorizationSequenceCodeEntryController.swift index 45f6e59f25..eef0423adf 100644 --- a/TelegramUI/AuthorizationSequenceCodeEntryController.swift +++ b/TelegramUI/AuthorizationSequenceCodeEntryController.swift @@ -127,7 +127,7 @@ final class AuthorizationSequenceCodeEntryController: ViewController { if let termsOfService = self.termsOfService { var acceptImpl: (() -> Void)? var declineImpl: (() -> Void)? - let controller = TermsOfServiceController(theme: TermsOfServiceControllerTheme(authTheme: self.theme), strings: self.strings, text: termsOfService.text, entities: termsOfService.entities, ageConfirmation: termsOfService.ageConfirmation, signingUp: true, accept: { + let controller = TermsOfServiceController(theme: TermsOfServiceControllerTheme(authTheme: self.theme), strings: self.strings, text: termsOfService.text, entities: termsOfService.entities, ageConfirmation: termsOfService.ageConfirmation, signingUp: true, accept: { _ in acceptImpl?() }, decline: { declineImpl?() diff --git a/TelegramUI/ChatController.swift b/TelegramUI/ChatController.swift index c8db2e7ecd..fe7984db7f 100644 --- a/TelegramUI/ChatController.swift +++ b/TelegramUI/ChatController.swift @@ -814,6 +814,19 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin return canReplyInChat(strongSelf.presentationInterfaceState) } return false + }, navigateToFirstDateMessage: { [weak self] timestamp in + guard let `self` = self else {return} + switch self.chatLocation { + case let .peer(peerId): + self.messageIndexDisposable.set((searchMessageIdByTimestamp(account: self.account, peerId: peerId, timestamp: timestamp - Int32(NSTimeZone.local.secondsFromGMT())) |> deliverOnMainQueue).start(next: { [weak self] messageId in + guard let `self` = self else {return} + if let messageId = messageId { + self.navigateToMessage(from: nil, to: .id(messageId), scrollPosition: .bottom(0)) + } + })) + default: + break + } }, requestMessageUpdate: { [weak self] id in if let strongSelf = self { strongSelf.chatDisplayNode.historyNode.requestMessageUpdate(id) @@ -3750,7 +3763,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin self.navigateToMessage(from: nil, to: messageLocation, rememberInStack: false, animated: animated, completion: completion) } - private func navigateToMessage(from fromId: MessageId?, to messageLocation: NavigateToMessageLocation, rememberInStack: Bool = true, animated: Bool = true, completion: (() -> Void)? = nil) { + private func navigateToMessage(from fromId: MessageId?, to messageLocation: NavigateToMessageLocation, scrollPosition: ListViewScrollPosition = .center(.bottom), rememberInStack: Bool = true, animated: Bool = true, completion: (() -> Void)? = nil) { if self.isNodeLoaded { var fromIndex: MessageIndex? @@ -3771,7 +3784,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin if let message = self.chatDisplayNode.historyNode.messageInCurrentHistoryView(messageLocation.messageId) { self.loadingMessage.set(false) self.messageIndexDisposable.set(nil) - self.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: MessageIndex(message), animated: animated) + self.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: MessageIndex(message), animated: animated, scrollPosition: scrollPosition) completion?() } else { self.loadingMessage.set(true) @@ -3802,7 +3815,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin |> take(1) self.messageIndexDisposable.set((signal |> deliverOnMainQueue).start(next: { [weak self] index in if let strongSelf = self, let index = index { - strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated) + strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated, scrollPosition: scrollPosition) completion?() } }, completed: { [weak self] in @@ -3849,7 +3862,7 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin self.messageIndexDisposable.set((signal |> deliverOnMainQueue).start(next: { [weak self] index in if let strongSelf = self { if let index = index { - strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated) + strongSelf.chatDisplayNode.historyNode.scrollToMessage(from: fromIndex, to: index, animated: animated, scrollPosition: scrollPosition) completion?() } else { (strongSelf.navigationController as? NavigationController)?.pushViewController(ChatController(account: strongSelf.account, chatLocation: .peer(messageLocation.messageId.peerId), messageId: messageLocation.messageId)) diff --git a/TelegramUI/ChatControllerInteraction.swift b/TelegramUI/ChatControllerInteraction.swift index 056558924b..28e931a8ea 100644 --- a/TelegramUI/ChatControllerInteraction.swift +++ b/TelegramUI/ChatControllerInteraction.swift @@ -67,6 +67,7 @@ public final class ChatControllerInteraction { let openSearch: () -> Void let setupReply: (MessageId) -> Void let canSetupReply: (Message) -> Bool + let navigateToFirstDateMessage:(Int32)->Void let requestMessageUpdate: (MessageId) -> Void let cancelInteractiveKeyboardGestures: () -> Void @@ -77,7 +78,7 @@ public final class ChatControllerInteraction { var contextHighlightedState: ChatInterfaceHighlightedState? var automaticMediaDownloadSettings: AutomaticMediaDownloadSettings - init(openMessage: @escaping (Message) -> Bool, openPeer: @escaping (PeerId?, ChatControllerInteractionNavigateToPeer, Message?) -> Void, openPeerMention: @escaping (String) -> Void, openMessageContextMenu: @escaping (Message, ASDisplayNode, CGRect) -> Void, navigateToMessage: @escaping (MessageId, MessageId) -> Void, clickThroughMessage: @escaping () -> Void, toggleMessagesSelection: @escaping ([MessageId], Bool) -> Void, sendMessage: @escaping (String) -> Void, sendSticker: @escaping (FileMediaReference) -> Void, sendGif: @escaping (FileMediaReference) -> Void, requestMessageActionCallback: @escaping (MessageId, MemoryBuffer?, Bool) -> Void, activateSwitchInline: @escaping (PeerId?, String) -> Void, openUrl: @escaping (String, Bool) -> Void, shareCurrentLocation: @escaping () -> Void, shareAccountContact: @escaping () -> Void, sendBotCommand: @escaping (MessageId?, String) -> Void, openInstantPage: @escaping (Message) -> Void, openHashtag: @escaping (String?, String) -> Void, updateInputState: @escaping ((ChatTextInputState) -> ChatTextInputState) -> Void, updateInputMode: @escaping ((ChatInputMode) -> ChatInputMode) -> Void, openMessageShareMenu: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, navigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, callPeer: @escaping (PeerId) -> Void, longTap: @escaping (ChatControllerInteractionLongTapAction) -> Void, openCheckoutOrReceipt: @escaping (MessageId) -> Void, openSearch: @escaping () -> Void, setupReply: @escaping (MessageId) -> Void, canSetupReply: @escaping (Message) -> Bool, requestMessageUpdate: @escaping (MessageId) -> Void, cancelInteractiveKeyboardGestures: @escaping () -> Void, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings) { + init(openMessage: @escaping (Message) -> Bool, openPeer: @escaping (PeerId?, ChatControllerInteractionNavigateToPeer, Message?) -> Void, openPeerMention: @escaping (String) -> Void, openMessageContextMenu: @escaping (Message, ASDisplayNode, CGRect) -> Void, navigateToMessage: @escaping (MessageId, MessageId) -> Void, clickThroughMessage: @escaping () -> Void, toggleMessagesSelection: @escaping ([MessageId], Bool) -> Void, sendMessage: @escaping (String) -> Void, sendSticker: @escaping (FileMediaReference) -> Void, sendGif: @escaping (FileMediaReference) -> Void, requestMessageActionCallback: @escaping (MessageId, MemoryBuffer?, Bool) -> Void, activateSwitchInline: @escaping (PeerId?, String) -> Void, openUrl: @escaping (String, Bool) -> Void, shareCurrentLocation: @escaping () -> Void, shareAccountContact: @escaping () -> Void, sendBotCommand: @escaping (MessageId?, String) -> Void, openInstantPage: @escaping (Message) -> Void, openHashtag: @escaping (String?, String) -> Void, updateInputState: @escaping ((ChatTextInputState) -> ChatTextInputState) -> Void, updateInputMode: @escaping ((ChatInputMode) -> ChatInputMode) -> Void, openMessageShareMenu: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, navigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, callPeer: @escaping (PeerId) -> Void, longTap: @escaping (ChatControllerInteractionLongTapAction) -> Void, openCheckoutOrReceipt: @escaping (MessageId) -> Void, openSearch: @escaping () -> Void, setupReply: @escaping (MessageId) -> Void, canSetupReply: @escaping (Message) -> Bool, navigateToFirstDateMessage: @escaping(Int32)->Void, requestMessageUpdate: @escaping (MessageId) -> Void, cancelInteractiveKeyboardGestures: @escaping () -> Void, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings) { self.openMessage = openMessage self.openPeer = openPeer self.openPeerMention = openPeerMention @@ -108,6 +109,7 @@ public final class ChatControllerInteraction { self.openSearch = openSearch self.setupReply = setupReply self.canSetupReply = canSetupReply + self.navigateToFirstDateMessage = navigateToFirstDateMessage self.requestMessageUpdate = requestMessageUpdate self.cancelInteractiveKeyboardGestures = cancelInteractiveKeyboardGestures diff --git a/TelegramUI/ChatHistoryGridNode.swift b/TelegramUI/ChatHistoryGridNode.swift index 614409fcac..1f9f6b86cb 100644 --- a/TelegramUI/ChatHistoryGridNode.swift +++ b/TelegramUI/ChatHistoryGridNode.swift @@ -301,7 +301,7 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode { self._chatHistoryLocation.set(ChatHistoryLocation.Scroll(index: .upperBound, anchorIndex: .upperBound, sourceIndex: .lowerBound, scrollPosition: .top(0.0), animated: true)) } - public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex) { + public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex, scrollPosition: ListViewScrollPosition = .center(.bottom)) { self._chatHistoryLocation.set(ChatHistoryLocation.Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: .center(.bottom), animated: true)) } diff --git a/TelegramUI/ChatHistoryListNode.swift b/TelegramUI/ChatHistoryListNode.swift index 453aad28e1..44faf0b9bd 100644 --- a/TelegramUI/ChatHistoryListNode.swift +++ b/TelegramUI/ChatHistoryListNode.swift @@ -774,8 +774,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { } } - public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex, animated: Bool, highlight: Bool = true) { - self._chatHistoryLocation.set(ChatHistoryLocation.Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: .center(.bottom), animated: animated)) + public func scrollToMessage(from fromIndex: MessageIndex, to toIndex: MessageIndex, animated: Bool, highlight: Bool = true, scrollPosition: ListViewScrollPosition = .center(.bottom)) { + self._chatHistoryLocation.set(ChatHistoryLocation.Scroll(index: .message(toIndex), anchorIndex: .message(toIndex), sourceIndex: .message(fromIndex), scrollPosition: scrollPosition, animated: animated)) } public func anchorMessageInCurrentHistoryView() -> Message? { diff --git a/TelegramUI/ChatMessageDateHeader.swift b/TelegramUI/ChatMessageDateHeader.swift index e00e26f352..19f4315a9a 100644 --- a/TelegramUI/ChatMessageDateHeader.swift +++ b/TelegramUI/ChatMessageDateHeader.swift @@ -19,12 +19,12 @@ final class ChatMessageDateHeader: ListViewItemHeader { let id: Int64 let theme: ChatPresentationThemeData let strings: PresentationStrings - - init(timestamp: Int32, theme: ChatPresentationThemeData, strings: PresentationStrings) { + let action:((Int32)->Void)? + init(timestamp: Int32, theme: ChatPresentationThemeData, strings: PresentationStrings, action:((Int32)->Void)? = nil) { self.timestamp = timestamp self.theme = theme self.strings = strings - + self.action = action if timestamp == Int32.max { self.roundedTimestamp = timestamp / (granularity) * (granularity) } else { @@ -38,7 +38,7 @@ final class ChatMessageDateHeader: ListViewItemHeader { let height: CGFloat = 34.0 func node() -> ListViewItemHeaderNode { - return ChatMessageDateHeaderNode(localTimestamp: self.roundedTimestamp, theme: self.theme, strings: self.strings) + return ChatMessageDateHeaderNode(localTimestamp: self.roundedTimestamp, theme: self.theme, strings: self.strings, action: self.action) } } @@ -86,11 +86,13 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { private var flashingOnScrolling = false private var stickDistanceFactor: CGFloat = 0.0 + private var action:((Int32)->Void)? = nil - init(localTimestamp: Int32, theme: ChatPresentationThemeData, strings: PresentationStrings) { + init(localTimestamp: Int32, theme: ChatPresentationThemeData, strings: PresentationStrings, action:((Int32)->Void)? = nil) { self.localTimestamp = localTimestamp self.theme = theme self.strings = strings + self.action = action self.labelNode = TextNode() self.labelNode.isLayerBacked = true @@ -158,7 +160,10 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { print("position \(position.x), \(position.y)") } }*/ + + } + override func didLoad() { super.didLoad() @@ -229,6 +234,8 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { } } } + + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { if !self.bounds.contains(point) { @@ -243,13 +250,15 @@ final class ChatMessageDateHeaderNode: ListViewItemHeaderNode { return nil } + + override func touchesCancelled(_ touches: Set?, with event: UIEvent?) { super.touchesCancelled(touches, with: event) } @objc func tapGesture(_ recognizer: UITapGestureRecognizer) { if case .ended = recognizer.state { - + action?(self.localTimestamp) } } } diff --git a/TelegramUI/ChatMessageItem.swift b/TelegramUI/ChatMessageItem.swift index 9dfb97b459..449a753bb3 100644 --- a/TelegramUI/ChatMessageItem.swift +++ b/TelegramUI/ChatMessageItem.swift @@ -278,7 +278,35 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { self.effectiveAuthorId = effectiveAuthor?.id - self.header = ChatMessageDateHeader(timestamp: content.index.timestamp, theme: presentationData.theme, strings: presentationData.strings) + + self.header = ChatMessageDateHeader(timestamp: content.index.timestamp, theme: presentationData.theme, strings: presentationData.strings, action: { timestamp in + +// + var calendar = NSCalendar.current + + calendar.timeZone = TimeZone(abbreviation: "UTC")! + let date = Date(timeIntervalSince1970: TimeInterval(timestamp)) + let components = calendar.dateComponents([.year, .month, .day], from: date) + + if let date = calendar.date(from: components) { + controllerInteraction.navigateToFirstDateMessage(Int32(date.timeIntervalSince1970)) + } + + + /* + unsigned unitFlags = NSCalendarUnitDay| NSCalendarUnitYear | NSCalendarUnitMonth; + NSDateComponents *components = [cal components:unitFlags fromDate:date]; + NSDateComponents *comps = [[NSDateComponents alloc] init]; + comps.day = day; + comps.year = components.year; + comps.month = components.month; + return [cal dateFromComponents:comps]; + */ + + // item.chatInteraction?.jumpToDate(CalendarUtils.monthDay(components.day!, date: date)) + + + }) if displayAuthorInfo { let message = content.firstMessage @@ -302,6 +330,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { } } self.accessoryItem = accessoryItem + } public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { diff --git a/TelegramUI/ChatRecentActionsControllerNode.swift b/TelegramUI/ChatRecentActionsControllerNode.swift index 4e61d92100..139192f767 100644 --- a/TelegramUI/ChatRecentActionsControllerNode.swift +++ b/TelegramUI/ChatRecentActionsControllerNode.swift @@ -363,6 +363,8 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode { }, openCheckoutOrReceipt: { _ in }, openSearch: { }, setupReply: { _ in }, canSetupReply: { _ in return false + }, navigateToFirstDateMessage: { _ in + }, requestMessageUpdate: { _ in }, cancelInteractiveKeyboardGestures: { }, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings) diff --git a/TelegramUI/OverlayPlayerControllerNode.swift b/TelegramUI/OverlayPlayerControllerNode.swift index 8c9320911a..ba4f626f0a 100644 --- a/TelegramUI/OverlayPlayerControllerNode.swift +++ b/TelegramUI/OverlayPlayerControllerNode.swift @@ -65,6 +65,7 @@ final class OverlayPlayerControllerNode: ViewControllerTracingNode, UIGestureRec }, setupReply: { _ in }, canSetupReply: { _ in return false + }, navigateToFirstDateMessage: { _ in }, requestMessageUpdate: { _ in }, cancelInteractiveKeyboardGestures: { }, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings.defaultSettings) diff --git a/TelegramUI/PeerMediaCollectionController.swift b/TelegramUI/PeerMediaCollectionController.swift index 114dc59432..e9e20c2757 100644 --- a/TelegramUI/PeerMediaCollectionController.swift +++ b/TelegramUI/PeerMediaCollectionController.swift @@ -212,6 +212,7 @@ public class PeerMediaCollectionController: TelegramController { }, setupReply: { _ in }, canSetupReply: { _ in return false + }, navigateToFirstDateMessage: { _ in }, requestMessageUpdate: { _ in }, cancelInteractiveKeyboardGestures: { }, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings.defaultSettings) diff --git a/TelegramUI/PresentationStrings.swift b/TelegramUI/PresentationStrings.swift index a9d549a2fd..3969cbe54c 100644 --- a/TelegramUI/PresentationStrings.swift +++ b/TelegramUI/PresentationStrings.swift @@ -222,6 +222,11 @@ public final class PresentationStrings { public func PrivacyPolicy_AgeVerificationMessage(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(_PrivacyPolicy_AgeVerificationMessage, self._PrivacyPolicy_AgeVerificationMessage_r, [_0]) } + private let _Login_TermsOfService_ProceedBot: String + private let _Login_TermsOfService_ProceedBot_r: [(Int, NSRange)] + public func Login_TermsOfService_ProceedBot(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(_Login_TermsOfService_ProceedBot, self._Login_TermsOfService_ProceedBot_r, [_0]) + } public let NotificationsSound_None: String public let Channel_AdminLog_CanEditMessages: String private let _MESSAGE_CONTACT: String @@ -5541,6 +5546,8 @@ public final class PresentationStrings { self.SocksProxySetup_Hostname = getValue(dict, "SocksProxySetup.Hostname") self._PrivacyPolicy_AgeVerificationMessage = getValue(dict, "PrivacyPolicy.AgeVerificationMessage") self._PrivacyPolicy_AgeVerificationMessage_r = extractArgumentRanges(self._PrivacyPolicy_AgeVerificationMessage) + self._Login_TermsOfService_ProceedBot = getValue(dict, "Login.TermsOfService.ProceedBot") + self._Login_TermsOfService_ProceedBot_r = extractArgumentRanges(self._Login_TermsOfService_ProceedBot) self.NotificationsSound_None = getValue(dict, "NotificationsSound.None") self.Channel_AdminLog_CanEditMessages = getValue(dict, "Channel.AdminLog.CanEditMessages") self._MESSAGE_CONTACT = getValue(dict, "MESSAGE_CONTACT") diff --git a/TelegramUI/TermsOfServiceController.swift b/TelegramUI/TermsOfServiceController.swift index 9e6ba80589..a5fdc0016d 100644 --- a/TelegramUI/TermsOfServiceController.swift +++ b/TelegramUI/TermsOfServiceController.swift @@ -48,9 +48,10 @@ public class TermsOfServiceController: ViewController { private let entities: [MessageTextEntity] private let ageConfirmation: Int32? private let signingUp: Bool - private let accept: () -> Void + private let accept: (String?) -> Void private let decline: () -> Void private let openUrl: (String) -> Void + private var proccessBotNameAfterAccept: String? = nil private var didPlayPresentationAnimation = false @@ -66,7 +67,7 @@ public class TermsOfServiceController: ViewController { } } - public init(theme: TermsOfServiceControllerTheme, strings: PresentationStrings, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, signingUp: Bool, accept: @escaping () -> Void, decline: @escaping () -> Void, openUrl: @escaping (String) -> Void) { + public init(theme: TermsOfServiceControllerTheme, strings: PresentationStrings, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, signingUp: Bool, accept: @escaping (String?) -> Void, decline: @escaping () -> Void, openUrl: @escaping (String) -> Void) { self.theme = theme self.strings = strings self.text = text @@ -135,18 +136,21 @@ public class TermsOfServiceController: ViewController { theme = defaultDarkPresentationTheme } strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: theme), title: strongSelf.strings.PrivacyPolicy_AgeVerificationTitle, text: strongSelf.strings.PrivacyPolicy_AgeVerificationMessage("\(ageConfirmation)").0, actions: [TextAlertAction(type: .genericAction, title: strongSelf.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: strongSelf.strings.PrivacyPolicy_AgeVerificationAgree, action: { - self?.accept() + self?.accept(self?.proccessBotNameAfterAccept) })]), in: .window(.root)) } else { - strongSelf.accept() + strongSelf.accept(self?.proccessBotNameAfterAccept) } }, openUrl: self.openUrl, present: { [weak self] c, a in self?.present(c, in: .window(.root), with: a) + }, setToProcceedBot: { [weak self] botName in + self?.proccessBotNameAfterAccept = botName }) self.displayNodeDidLoad() } + override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { super.containerLayoutUpdated(layout, transition: transition) diff --git a/TelegramUI/TermsOfServiceControllerNode.swift b/TelegramUI/TermsOfServiceControllerNode.swift index 53c164d712..425c3cdfbb 100644 --- a/TelegramUI/TermsOfServiceControllerNode.swift +++ b/TelegramUI/TermsOfServiceControllerNode.swift @@ -39,7 +39,7 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode { } } - init(theme: TermsOfServiceControllerTheme, strings: PresentationStrings, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, leftAction: @escaping () -> Void, rightAction: @escaping () -> Void, openUrl: @escaping (String) -> Void, present: @escaping (ViewController, Any?) -> Void) { + init(theme: TermsOfServiceControllerTheme, strings: PresentationStrings, text: String, entities: [MessageTextEntity], ageConfirmation: Int32?, leftAction: @escaping () -> Void, rightAction: @escaping () -> Void, openUrl: @escaping (String) -> Void, present: @escaping (ViewController, Any?) -> Void, setToProcceedBot:@escaping(String)->Void) { self.theme = theme self.strings = strings self.text = text @@ -142,14 +142,10 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode { } let actionSheet = ActionSheetController(presentationTheme: theme) actionSheet.setItemGroups([ActionSheetItemGroup(items: [ - ActionSheetTextItem(title: mention.mention), - ActionSheetButtonItem(title: strongSelf.strings.Conversation_LinkDialogCopy, color: .accent, action: { [weak actionSheet] in - actionSheet?.dismissAnimated() - UIPasteboard.general.string = mention.mention - }) - ]), ActionSheetItemGroup(items: [ - ActionSheetButtonItem(title: strongSelf.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in + ActionSheetTextItem(title: strongSelf.strings.Login_TermsOfService_ProceedBot(mention.mention).0), + ActionSheetButtonItem(title: strongSelf.strings.Common_OK, color: .accent, action: { [weak actionSheet] in actionSheet?.dismissAnimated() + setToProcceedBot(mention.mention) }) ])]) strongSelf.present(actionSheet, nil) @@ -162,14 +158,10 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode { } let actionSheet = ActionSheetController(presentationTheme: theme) actionSheet.setItemGroups([ActionSheetItemGroup(items: [ - ActionSheetTextItem(title: mention), - ActionSheetButtonItem(title: strongSelf.strings.Conversation_LinkDialogCopy, color: .accent, action: { [weak actionSheet] in - actionSheet?.dismissAnimated() - UIPasteboard.general.string = mention - }) - ]), ActionSheetItemGroup(items: [ - ActionSheetButtonItem(title: strongSelf.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in + ActionSheetTextItem(title: strongSelf.strings.Login_TermsOfService_ProceedBot(mention).0), + ActionSheetButtonItem(title: strongSelf.strings.Common_OK, color: .accent, action: { [weak actionSheet] in actionSheet?.dismissAnimated() + setToProcceedBot(mention) }) ])]) strongSelf.present(actionSheet, nil) @@ -212,14 +204,10 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode { } let actionSheet = ActionSheetController(presentationTheme: theme) actionSheet.setItemGroups([ActionSheetItemGroup(items: [ - ActionSheetTextItem(title: mention.mention), - ActionSheetButtonItem(title: strongSelf.strings.Conversation_LinkDialogCopy, color: .accent, action: { [weak actionSheet] in - actionSheet?.dismissAnimated() - UIPasteboard.general.string = mention.mention - }) - ]), ActionSheetItemGroup(items: [ - ActionSheetButtonItem(title: strongSelf.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in + ActionSheetTextItem(title: strongSelf.strings.Login_TermsOfService_ProceedBot(mention.mention).0), + ActionSheetButtonItem(title: strongSelf.strings.Common_OK, color: .accent, action: { [weak actionSheet] in actionSheet?.dismissAnimated() + setToProcceedBot(mention.mention) }) ])]) strongSelf.present(actionSheet, nil) @@ -232,14 +220,10 @@ final class TermsOfServiceControllerNode: ViewControllerTracingNode { } let actionSheet = ActionSheetController(presentationTheme: theme) actionSheet.setItemGroups([ActionSheetItemGroup(items: [ - ActionSheetTextItem(title: mention), - ActionSheetButtonItem(title: strongSelf.strings.Conversation_LinkDialogCopy, color: .accent, action: { [weak actionSheet] in - actionSheet?.dismissAnimated() - UIPasteboard.general.string = mention - }) - ]), ActionSheetItemGroup(items: [ - ActionSheetButtonItem(title: strongSelf.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in + ActionSheetTextItem(title: strongSelf.strings.Login_TermsOfService_ProceedBot(mention).0), + ActionSheetButtonItem(title: strongSelf.strings.Common_OK, color: .accent, action: { [weak actionSheet] in actionSheet?.dismissAnimated() + setToProcceedBot(mention) }) ])]) strongSelf.present(actionSheet, nil) diff --git a/TelegramUI/ThemeSettingsChatPreviewItem.swift b/TelegramUI/ThemeSettingsChatPreviewItem.swift index 8373d032eb..6e4832b7fb 100644 --- a/TelegramUI/ThemeSettingsChatPreviewItem.swift +++ b/TelegramUI/ThemeSettingsChatPreviewItem.swift @@ -95,6 +95,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { }, presentGlobalOverlayController: { _, _ in }, callPeer: { _ in }, longTap: { _ in }, openCheckoutOrReceipt: { _ in }, openSearch: { }, setupReply: { _ in }, canSetupReply: { _ in return false + }, navigateToFirstDateMessage: { _ in }, requestMessageUpdate: { _ in }, cancelInteractiveKeyboardGestures: { }, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings.defaultSettings)