mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Psa improvements
This commit is contained in:
parent
2a06b2dede
commit
049cba24bf
@ -560,7 +560,6 @@
|
|||||||
"Message.StickerText" = "Sticker %@";
|
"Message.StickerText" = "Sticker %@";
|
||||||
"Message.Audio" = "Voice Message";
|
"Message.Audio" = "Voice Message";
|
||||||
"Message.ForwardedMessage" = "Forwarded Message\nFrom: %@";
|
"Message.ForwardedMessage" = "Forwarded Message\nFrom: %@";
|
||||||
"Message.GenericForwardedPsa" = "Public Service Announcement\nFrom: %@";
|
|
||||||
"Message.Animation" = "GIF";
|
"Message.Animation" = "GIF";
|
||||||
"Message.Game" = "Game";
|
"Message.Game" = "Game";
|
||||||
|
|
||||||
@ -3174,8 +3173,6 @@ Unused sets are archived when you add more.";
|
|||||||
"DialogList.AdNoticeAlert" = "The proxy you are using displays a sponsored channel in your chat list.";
|
"DialogList.AdNoticeAlert" = "The proxy you are using displays a sponsored channel in your chat list.";
|
||||||
"SocksProxySetup.AdNoticeHelp" = "This proxy may display a sponsored channel in your chat list. This doesn't reveal your Telegram traffic.";
|
"SocksProxySetup.AdNoticeHelp" = "This proxy may display a sponsored channel in your chat list. This doesn't reveal your Telegram traffic.";
|
||||||
|
|
||||||
"DialogList.PsaLabel" = "PSA";
|
|
||||||
|
|
||||||
"SocksProxySetup.ShareProxyList" = "Share Proxy List";
|
"SocksProxySetup.ShareProxyList" = "Share Proxy List";
|
||||||
|
|
||||||
"Privacy.SecretChatsTitle" = "SECRET CHATS";
|
"Privacy.SecretChatsTitle" = "SECRET CHATS";
|
||||||
@ -5488,3 +5485,13 @@ Any member of this group will be able to see messages in the channel.";
|
|||||||
"CreatePoll.ExplanationInfo" = "Users will see this comment after choosing a wrong answer, good for educational purposes.";
|
"CreatePoll.ExplanationInfo" = "Users will see this comment after choosing a wrong answer, good for educational purposes.";
|
||||||
|
|
||||||
"FeaturedStickers.OtherSection" = "OTHER STICKERS";
|
"FeaturedStickers.OtherSection" = "OTHER STICKERS";
|
||||||
|
|
||||||
|
"ChatList.GenericPsaAlert" = "This provides public service announcements in your chat list.";
|
||||||
|
"ChatList.PsaAlert.covid" = "This message provides you with a public service announcement in relation to the undergoing pandemics. Learn more about this initiative at https://telegram.org/blog/coronavirus";
|
||||||
|
"ChatList.GenericPsaLabel" = "PSA";
|
||||||
|
"ChatList.PsaLabel.covid" = "Covid-19";
|
||||||
|
"Chat.GenericPsaTooltip" = "This is a public service announcement";
|
||||||
|
"Chat.PsaTooltip.covid" = "This message provides you with a public service announcement in relation to the undergoing pandemics. Learn more about this initiative at https://telegram.org/blog/coronavirus";
|
||||||
|
|
||||||
|
"Message.GenericForwardedPsa" = "Public Service Announcement\nFrom: %@";
|
||||||
|
"Message.ForwardedPsa.covid" = "Covid-19 Notification\nFrom: %@";
|
||||||
|
@ -209,9 +209,9 @@ public final class NavigateToChatControllerParams {
|
|||||||
public let animated: Bool
|
public let animated: Bool
|
||||||
public let options: NavigationAnimationOptions
|
public let options: NavigationAnimationOptions
|
||||||
public let parentGroupId: PeerGroupId?
|
public let parentGroupId: PeerGroupId?
|
||||||
public let completion: () -> Void
|
public let completion: (ChatController) -> Void
|
||||||
|
|
||||||
public init(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContext, chatLocation: ChatLocation, subject: ChatControllerSubject? = nil, botStart: ChatControllerInitialBotStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: Bool = false, keepStack: NavigateToChatKeepStack = .default, useExisting: Bool = true, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, activateMessageSearch: Bool = false, animated: Bool = true, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, completion: @escaping () -> Void = {}) {
|
public init(navigationController: NavigationController, chatController: ChatController? = nil, context: AccountContext, chatLocation: ChatLocation, subject: ChatControllerSubject? = nil, botStart: ChatControllerInitialBotStart? = nil, updateTextInputState: ChatTextInputState? = nil, activateInput: Bool = false, keepStack: NavigateToChatKeepStack = .default, useExisting: Bool = true, purposefulAction: (() -> Void)? = nil, scrollToEndIfExists: Bool = false, activateMessageSearch: Bool = false, animated: Bool = true, options: NavigationAnimationOptions = [], parentGroupId: PeerGroupId? = nil, completion: @escaping (ChatController) -> Void = { _ in }) {
|
||||||
self.navigationController = navigationController
|
self.navigationController = navigationController
|
||||||
self.chatController = chatController
|
self.chatController = chatController
|
||||||
self.context = context
|
self.context = context
|
||||||
|
@ -371,6 +371,7 @@ public protocol ChatController: ViewController {
|
|||||||
|
|
||||||
func updatePresentationMode(_ mode: ChatControllerPresentationMode)
|
func updatePresentationMode(_ mode: ChatControllerPresentationMode)
|
||||||
func beginMessageSearch(_ query: String)
|
func beginMessageSearch(_ query: String)
|
||||||
|
func displayPromoAnnouncement(text: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ChatMessagePrevewItemNode: class {
|
public protocol ChatMessagePrevewItemNode: class {
|
||||||
|
@ -562,11 +562,11 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
strongSelf.toggleArchivedFolderHiddenByDefault()
|
strongSelf.toggleArchivedFolderHiddenByDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.chatListDisplayNode.containerNode.hidePsa = { [weak self] messageId in
|
self.chatListDisplayNode.containerNode.hidePsa = { [weak self] peerId in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
strongSelf.hidePsa(messageId)
|
strongSelf.hidePsa(peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.chatListDisplayNode.containerNode.deletePeerChat = { [weak self] peerId in
|
self.chatListDisplayNode.containerNode.deletePeerChat = { [weak self] peerId in
|
||||||
@ -579,29 +579,47 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
self.chatListDisplayNode.containerNode.peerSelected = { [weak self] peer, animated, promoInfo in
|
self.chatListDisplayNode.containerNode.peerSelected = { [weak self] peer, animated, promoInfo in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||||
if let promoInfo = promoInfo, case .proxy = promoInfo {
|
|
||||||
let _ = (ApplicationSpecificNotice.getProxyAdsAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager)
|
|
||||||
|> deliverOnMainQueue).start(next: { value in
|
|
||||||
guard let strongSelf = self else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !value {
|
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.DialogList_AdNoticeAlert, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
|
||||||
if let strongSelf = self {
|
|
||||||
let _ = ApplicationSpecificNotice.setProxyAdsAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager).start()
|
|
||||||
}
|
|
||||||
})]), in: .window(.root))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var scrollToEndIfExists = false
|
var scrollToEndIfExists = false
|
||||||
if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass {
|
if let layout = strongSelf.validLayout, case .regular = layout.metrics.widthClass {
|
||||||
scrollToEndIfExists = true
|
scrollToEndIfExists = true
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer.id), scrollToEndIfExists: scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : [], parentGroupId: strongSelf.groupId, completion: { [weak self] in
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer.id), scrollToEndIfExists: scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : [], parentGroupId: strongSelf.groupId, completion: { [weak self] controller in
|
||||||
self?.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
self?.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
||||||
|
if let promoInfo = promoInfo {
|
||||||
|
switch promoInfo {
|
||||||
|
case .proxy:
|
||||||
|
let _ = (ApplicationSpecificNotice.getProxyAdsAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager)
|
||||||
|
|> deliverOnMainQueue).start(next: { value in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !value {
|
||||||
|
controller.displayPromoAnnouncement(text: strongSelf.presentationData.strings.DialogList_AdNoticeAlert)
|
||||||
|
let _ = ApplicationSpecificNotice.setProxyAdsAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager).start()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
case let .psa(type, _):
|
||||||
|
let _ = (ApplicationSpecificNotice.getPsaAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager, peerId: peer.id)
|
||||||
|
|> deliverOnMainQueue).start(next: { value in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !value {
|
||||||
|
var text = strongSelf.presentationData.strings.ChatList_GenericPsaAlert
|
||||||
|
let key = "ChatList.PsaAlert.\(type)"
|
||||||
|
if let string = strongSelf.presentationData.strings.primaryComponent.dict[key] {
|
||||||
|
text = string
|
||||||
|
} else if let string = strongSelf.presentationData.strings.secondaryComponent?.dict[key] {
|
||||||
|
text = string
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.displayPromoAnnouncement(text: text)
|
||||||
|
let _ = ApplicationSpecificNotice.setPsaAcknowledgment(accountManager: strongSelf.context.sharedContext.accountManager, peerId: peer.id).start()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1989,30 +2007,15 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func hidePsa(_ id: MessageId) {
|
func hidePsa(_ id: PeerId) {
|
||||||
let _ = (self.context.account.postbox.transaction { transaction -> PeerId? in
|
self.chatListDisplayNode.containerNode.updateState { state in
|
||||||
var peerId: PeerId?
|
var state = state
|
||||||
for item in transaction.getAdditionalChatListItems() {
|
state.hiddenPsaPeerId = id
|
||||||
if let item = item as? PromoChatListItem {
|
state.peerIdWithRevealedOptions = nil
|
||||||
peerId = item.peerId
|
return state
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return peerId
|
|
||||||
}
|
}
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] _ in
|
|
||||||
guard let strongSelf = self else {
|
let _ = hideAccountPromoInfoChat(account: self.context.account, peerId: id).start()
|
||||||
return
|
|
||||||
}
|
|
||||||
strongSelf.chatListDisplayNode.containerNode.updateState { state in
|
|
||||||
var state = state
|
|
||||||
state.hiddenPsaPeerId = id.peerId
|
|
||||||
state.peerIdWithRevealedOptions = nil
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
|
|
||||||
let _ = hideAccountPromoInfoChat(account: strongSelf.context.account, peerId: id.peerId).start()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func deletePeerChat(peerId: PeerId) {
|
func deletePeerChat(peerId: PeerId) {
|
||||||
|
@ -194,7 +194,7 @@ private final class ChatListShimmerNode: ASDisplayNode {
|
|||||||
let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: 1), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [])
|
let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: 1), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [])
|
||||||
let timestamp1: Int32 = 100000
|
let timestamp1: Int32 = 100000
|
||||||
let peers = SimpleDictionary<PeerId, Peer>()
|
let peers = SimpleDictionary<PeerId, Peer>()
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
||||||
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in }, activateChatPreview: { _, _, gesture in
|
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in }, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
}, present: { _ in })
|
}, present: { _ in })
|
||||||
@ -475,8 +475,8 @@ final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
|||||||
itemNode.listNode.toggleArchivedFolderHiddenByDefault = { [weak self] in
|
itemNode.listNode.toggleArchivedFolderHiddenByDefault = { [weak self] in
|
||||||
self?.toggleArchivedFolderHiddenByDefault?()
|
self?.toggleArchivedFolderHiddenByDefault?()
|
||||||
}
|
}
|
||||||
itemNode.listNode.hidePsa = { [weak self] messageId in
|
itemNode.listNode.hidePsa = { [weak self] peerId in
|
||||||
self?.hidePsa?(messageId)
|
self?.hidePsa?(peerId)
|
||||||
}
|
}
|
||||||
itemNode.listNode.deletePeerChat = { [weak self] peerId in
|
itemNode.listNode.deletePeerChat = { [weak self] peerId in
|
||||||
self?.deletePeerChat?(peerId)
|
self?.deletePeerChat?(peerId)
|
||||||
@ -526,7 +526,7 @@ final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
|||||||
var presentAlert: ((String) -> Void)?
|
var presentAlert: ((String) -> Void)?
|
||||||
var present: ((ViewController) -> Void)?
|
var present: ((ViewController) -> Void)?
|
||||||
var toggleArchivedFolderHiddenByDefault: (() -> Void)?
|
var toggleArchivedFolderHiddenByDefault: (() -> Void)?
|
||||||
var hidePsa: ((MessageId) -> Void)?
|
var hidePsa: ((PeerId) -> Void)?
|
||||||
var deletePeerChat: ((PeerId) -> Void)?
|
var deletePeerChat: ((PeerId) -> Void)?
|
||||||
var peerSelected: ((Peer, Bool, ChatListNodeEntryPromoInfo?) -> Void)?
|
var peerSelected: ((Peer, Bool, ChatListNodeEntryPromoInfo?) -> Void)?
|
||||||
var groupSelected: ((PeerGroupId) -> Void)?
|
var groupSelected: ((PeerGroupId) -> Void)?
|
||||||
|
@ -415,7 +415,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: primaryPeer, chatPeer: chatPeer), status: .none, badge: badge, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: primaryPeer, chatPeer: chatPeer), status: .none, badge: badge, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
||||||
interaction.peerSelected(peer)
|
interaction.peerSelected(peer, nil)
|
||||||
}, contextAction: peerContextAction.flatMap { peerContextAction in
|
}, contextAction: peerContextAction.flatMap { peerContextAction in
|
||||||
return { node, gesture in
|
return { node, gesture in
|
||||||
if let chatPeer = chatPeer, chatPeer.id.namespace != Namespaces.Peer.SecretChat {
|
if let chatPeer = chatPeer, chatPeer.id.namespace != Namespaces.Peer.SecretChat {
|
||||||
@ -478,7 +478,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: peer.peer, chatPeer: peer.peer), status: .addressName(suffixString), badge: badge, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: peer.peer, chatPeer: peer.peer), status: .addressName(suffixString), badge: badge, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
||||||
interaction.peerSelected(peer.peer)
|
interaction.peerSelected(peer.peer, nil)
|
||||||
}, contextAction: peerContextAction.flatMap { peerContextAction in
|
}, contextAction: peerContextAction.flatMap { peerContextAction in
|
||||||
return { node, gesture in
|
return { node, gesture in
|
||||||
peerContextAction(peer.peer, .search, node, gesture)
|
peerContextAction(peer.peer, .search, node, gesture)
|
||||||
@ -997,7 +997,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
let previousSearchItems = Atomic<[ChatListSearchEntry]?>(value: nil)
|
let previousSearchItems = Atomic<[ChatListSearchEntry]?>(value: nil)
|
||||||
|
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {
|
let interaction = ChatListNodeInteraction(activateSearch: {
|
||||||
}, peerSelected: { [weak self] peer in
|
}, peerSelected: { [weak self] peer, _ in
|
||||||
self?.view.endEditing(true)
|
self?.view.endEditing(true)
|
||||||
openPeer(peer, false)
|
openPeer(peer, false)
|
||||||
let _ = addRecentlySearchedPeer(postbox: context.account.postbox, peerId: peer.id).start()
|
let _ = addRecentlySearchedPeer(postbox: context.account.postbox, peerId: peer.id).start()
|
||||||
|
@ -128,9 +128,9 @@ public class ChatListItem: ListViewItem, ChatListSearchItemNeighbour {
|
|||||||
if let message = message, let peer = peer.peer {
|
if let message = message, let peer = peer.peer {
|
||||||
self.interaction.messageSelected(peer, message, promoInfo)
|
self.interaction.messageSelected(peer, message, promoInfo)
|
||||||
} else if let peer = peer.peer {
|
} else if let peer = peer.peer {
|
||||||
self.interaction.peerSelected(peer)
|
self.interaction.peerSelected(peer, promoInfo)
|
||||||
} else if let peer = peer.peers[peer.peerId] {
|
} else if let peer = peer.peers[peer.peerId] {
|
||||||
self.interaction.peerSelected(peer)
|
self.interaction.peerSelected(peer, promoInfo)
|
||||||
}
|
}
|
||||||
case let .groupReference(groupId, _, _, _, _):
|
case let .groupReference(groupId, _, _, _, _):
|
||||||
self.interaction.groupSelected(groupId)
|
self.interaction.groupSelected(groupId)
|
||||||
@ -1006,8 +1006,15 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
switch promoInfo {
|
switch promoInfo {
|
||||||
case .proxy:
|
case .proxy:
|
||||||
dateAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_AdLabel, font: dateFont, textColor: theme.dateTextColor)
|
dateAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_AdLabel, font: dateFont, textColor: theme.dateTextColor)
|
||||||
case .psa:
|
case let .psa(type, _):
|
||||||
dateAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_PsaLabel, font: dateFont, textColor: theme.dateTextColor)
|
var text = item.presentationData.strings.ChatList_GenericPsaLabel
|
||||||
|
let key = "ChatList.PsaLabel.\(type)"
|
||||||
|
if let string = item.presentationData.strings.primaryComponent.dict[key] {
|
||||||
|
text = string
|
||||||
|
} else if let string = item.presentationData.strings.secondaryComponent?.dict[key] {
|
||||||
|
text = string
|
||||||
|
}
|
||||||
|
dateAttributedString = NSAttributedString(string: text, font: dateFont, textColor: theme.dateTextColor)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dateAttributedString = NSAttributedString(string: dateText, font: dateFont, textColor: theme.dateTextColor)
|
dateAttributedString = NSAttributedString(string: dateText, font: dateFont, textColor: theme.dateTextColor)
|
||||||
@ -1862,10 +1869,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
item.interaction.toggleArchivedFolderHiddenByDefault()
|
item.interaction.toggleArchivedFolderHiddenByDefault()
|
||||||
close = false
|
close = false
|
||||||
case RevealOptionKey.hidePsa.rawValue:
|
case RevealOptionKey.hidePsa.rawValue:
|
||||||
if let item = self.item, case let .peer(message, _, _, _, _, _, _, _, _, _, _, _) = item.content {
|
if let item = self.item, case let .peer(_, peer, _, _, _, _, _, _, _, _, _, _) = item.content {
|
||||||
if let message = message {
|
item.interaction.hidePsa(peer.peerId)
|
||||||
item.interaction.hidePsa(message.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
close = false
|
close = false
|
||||||
self.skipFadeout = true
|
self.skipFadeout = true
|
||||||
|
@ -49,7 +49,7 @@ final class ChatListHighlightedLocation {
|
|||||||
|
|
||||||
public final class ChatListNodeInteraction {
|
public final class ChatListNodeInteraction {
|
||||||
let activateSearch: () -> Void
|
let activateSearch: () -> Void
|
||||||
let peerSelected: (Peer) -> Void
|
let peerSelected: (Peer, ChatListNodeEntryPromoInfo?) -> Void
|
||||||
let disabledPeerSelected: (Peer) -> Void
|
let disabledPeerSelected: (Peer) -> Void
|
||||||
let togglePeerSelected: (PeerId) -> Void
|
let togglePeerSelected: (PeerId) -> Void
|
||||||
let additionalCategorySelected: (Int) -> Void
|
let additionalCategorySelected: (Int) -> Void
|
||||||
@ -63,14 +63,14 @@ public final class ChatListNodeInteraction {
|
|||||||
let updatePeerGrouping: (PeerId, Bool) -> Void
|
let updatePeerGrouping: (PeerId, Bool) -> Void
|
||||||
let togglePeerMarkedUnread: (PeerId, Bool) -> Void
|
let togglePeerMarkedUnread: (PeerId, Bool) -> Void
|
||||||
let toggleArchivedFolderHiddenByDefault: () -> Void
|
let toggleArchivedFolderHiddenByDefault: () -> Void
|
||||||
let hidePsa: (MessageId) -> Void
|
let hidePsa: (PeerId) -> Void
|
||||||
let activateChatPreview: (ChatListItem, ASDisplayNode, ContextGesture?) -> Void
|
let activateChatPreview: (ChatListItem, ASDisplayNode, ContextGesture?) -> Void
|
||||||
let present: (ViewController) -> Void
|
let present: (ViewController) -> Void
|
||||||
|
|
||||||
public var searchTextHighightState: String?
|
public var searchTextHighightState: String?
|
||||||
var highlightedChatLocation: ChatListHighlightedLocation?
|
var highlightedChatLocation: ChatListHighlightedLocation?
|
||||||
|
|
||||||
public init(activateSearch: @escaping () -> Void, peerSelected: @escaping (Peer) -> Void, disabledPeerSelected: @escaping (Peer) -> Void, togglePeerSelected: @escaping (PeerId) -> Void, additionalCategorySelected: @escaping (Int) -> Void, messageSelected: @escaping (Peer, Message, ChatListNodeEntryPromoInfo?) -> Void, groupSelected: @escaping (PeerGroupId) -> Void, addContact: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, setItemPinned: @escaping (PinnedItemId, Bool) -> Void, setPeerMuted: @escaping (PeerId, Bool) -> Void, deletePeer: @escaping (PeerId) -> Void, updatePeerGrouping: @escaping (PeerId, Bool) -> Void, togglePeerMarkedUnread: @escaping (PeerId, Bool) -> Void, toggleArchivedFolderHiddenByDefault: @escaping () -> Void, hidePsa: @escaping (MessageId) -> Void, activateChatPreview: @escaping (ChatListItem, ASDisplayNode, ContextGesture?) -> Void, present: @escaping (ViewController) -> Void) {
|
public init(activateSearch: @escaping () -> Void, peerSelected: @escaping (Peer, ChatListNodeEntryPromoInfo?) -> Void, disabledPeerSelected: @escaping (Peer) -> Void, togglePeerSelected: @escaping (PeerId) -> Void, additionalCategorySelected: @escaping (Int) -> Void, messageSelected: @escaping (Peer, Message, ChatListNodeEntryPromoInfo?) -> Void, groupSelected: @escaping (PeerGroupId) -> Void, addContact: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, setItemPinned: @escaping (PinnedItemId, Bool) -> Void, setPeerMuted: @escaping (PeerId, Bool) -> Void, deletePeer: @escaping (PeerId) -> Void, updatePeerGrouping: @escaping (PeerId, Bool) -> Void, togglePeerMarkedUnread: @escaping (PeerId, Bool) -> Void, toggleArchivedFolderHiddenByDefault: @escaping () -> Void, hidePsa: @escaping (PeerId) -> Void, activateChatPreview: @escaping (ChatListItem, ASDisplayNode, ContextGesture?) -> Void, present: @escaping (ViewController) -> Void) {
|
||||||
self.activateSearch = activateSearch
|
self.activateSearch = activateSearch
|
||||||
self.peerSelected = peerSelected
|
self.peerSelected = peerSelected
|
||||||
self.disabledPeerSelected = disabledPeerSelected
|
self.disabledPeerSelected = disabledPeerSelected
|
||||||
@ -266,7 +266,7 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
|
|||||||
|
|
||||||
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
||||||
if let chatPeer = chatPeer {
|
if let chatPeer = chatPeer {
|
||||||
nodeInteraction.peerSelected(chatPeer)
|
nodeInteraction.peerSelected(chatPeer, nil)
|
||||||
}
|
}
|
||||||
}, disabledAction: { _ in
|
}, disabledAction: { _ in
|
||||||
if let chatPeer = chatPeer {
|
if let chatPeer = chatPeer {
|
||||||
@ -333,7 +333,7 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
|
|||||||
|
|
||||||
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ContactsPeerItem(presentationData: ItemListPresentationData(theme: presentationData.theme, fontSize: presentationData.fontSize, strings: presentationData.strings), sortOrder: presentationData.nameSortOrder, displayOrder: presentationData.nameDisplayOrder, context: context, peerMode: .generalSearch, peer: .peer(peer: itemPeer, chatPeer: chatPeer), status: status, enabled: enabled, selection: editing ? .selectable(selected: selected) : .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: header, action: { _ in
|
||||||
if let chatPeer = chatPeer {
|
if let chatPeer = chatPeer {
|
||||||
nodeInteraction.peerSelected(chatPeer)
|
nodeInteraction.peerSelected(chatPeer, nil)
|
||||||
}
|
}
|
||||||
}, disabledAction: { _ in
|
}, disabledAction: { _ in
|
||||||
if let chatPeer = chatPeer {
|
if let chatPeer = chatPeer {
|
||||||
@ -429,7 +429,7 @@ public final class ChatListNode: ListView {
|
|||||||
public var presentAlert: ((String) -> Void)?
|
public var presentAlert: ((String) -> Void)?
|
||||||
public var present: ((ViewController) -> Void)?
|
public var present: ((ViewController) -> Void)?
|
||||||
public var toggleArchivedFolderHiddenByDefault: (() -> Void)?
|
public var toggleArchivedFolderHiddenByDefault: (() -> Void)?
|
||||||
public var hidePsa: ((MessageId) -> Void)?
|
public var hidePsa: ((PeerId) -> Void)?
|
||||||
public var activateChatPreview: ((ChatListItem, ASDisplayNode, ContextGesture?) -> Void)?
|
public var activateChatPreview: ((ChatListItem, ASDisplayNode, ContextGesture?) -> Void)?
|
||||||
|
|
||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
@ -534,9 +534,9 @@ public final class ChatListNode: ListView {
|
|||||||
if let strongSelf = self, let activateSearch = strongSelf.activateSearch {
|
if let strongSelf = self, let activateSearch = strongSelf.activateSearch {
|
||||||
activateSearch()
|
activateSearch()
|
||||||
}
|
}
|
||||||
}, peerSelected: { [weak self] peer in
|
}, peerSelected: { [weak self] peer, promoInfo in
|
||||||
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
||||||
peerSelected(peer, true, nil)
|
peerSelected(peer, true, promoInfo)
|
||||||
}
|
}
|
||||||
}, disabledPeerSelected: { [weak self] peer in
|
}, disabledPeerSelected: { [weak self] peer in
|
||||||
if let strongSelf = self, let disabledPeerSelected = strongSelf.disabledPeerSelected {
|
if let strongSelf = self, let disabledPeerSelected = strongSelf.disabledPeerSelected {
|
||||||
|
@ -226,7 +226,7 @@ public class ContactsController: ViewController {
|
|||||||
self?.deactivateSearch(animated: false)
|
self?.deactivateSearch(animated: false)
|
||||||
self?.switchToChatsController?()
|
self?.switchToChatsController?()
|
||||||
}
|
}
|
||||||
}, scrollToEndIfExists: scrollToEndIfExists, options: [.removeOnMasterDetails], completion: { [weak self] in
|
}, scrollToEndIfExists: scrollToEndIfExists, options: [.removeOnMasterDetails], completion: { [weak self] _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.contactsNode.contactListNode.listNode.clearHighlightAnimated(true)
|
strongSelf.contactsNode.contactListNode.listNode.clearHighlightAnimated(true)
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public func galleryItemForEntry(context: AccountContext, presentationData: Prese
|
|||||||
if let dimensions = file.dimensions {
|
if let dimensions = file.dimensions {
|
||||||
pixelsCount = Int(dimensions.width) * Int(dimensions.height)
|
pixelsCount = Int(dimensions.width) * Int(dimensions.height)
|
||||||
}
|
}
|
||||||
if true /*(file.size == nil || file.size! < 4 * 1024 * 1024) && pixelsCount < 4096 * 4096*/ {
|
if (file.size == nil || file.size! < 4 * 1024 * 1024) && pixelsCount < 4096 * 4096 {
|
||||||
return ChatImageGalleryItem(context: context, presentationData: presentationData, message: message, location: location, performAction: performAction, openActionOptions: openActionOptions)
|
return ChatImageGalleryItem(context: context, presentationData: presentationData, message: message, location: location, performAction: performAction, openActionOptions: openActionOptions)
|
||||||
} else {
|
} else {
|
||||||
return ChatDocumentGalleryItem(context: context, presentationData: presentationData, message: message, location: location)
|
return ChatDocumentGalleryItem(context: context, presentationData: presentationData, message: message, location: location)
|
||||||
|
@ -351,7 +351,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
}
|
}
|
||||||
self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))()
|
self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))()
|
||||||
|
|
||||||
if largestSize.width > 2600 || largestSize.height > 2600 {
|
/*if largestSize.width > 2600 || largestSize.height > 2600 {
|
||||||
self.dataDisposable.set((self.context.account.postbox.mediaBox.resourceData(fileReference.media.resource)
|
self.dataDisposable.set((self.context.account.postbox.mediaBox.resourceData(fileReference.media.resource)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] data in
|
|> deliverOnMainQueue).start(next: { [weak self] data in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
@ -362,9 +362,9 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
}
|
}
|
||||||
strongSelf.updateImageFromFile(path: data.path)
|
strongSelf.updateImageFromFile(path: data.path)
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {*/
|
||||||
self.imageNode.setSignal(chatMessageImageFile(account: context.account, fileReference: fileReference, thumbnail: false), dispatchOnDisplayLink: false)
|
self.imageNode.setSignal(chatMessageImageFile(account: context.account, fileReference: fileReference, thumbnail: false), dispatchOnDisplayLink: false)
|
||||||
}
|
//}
|
||||||
|
|
||||||
self.zoomableContent = (largestSize.cgSize, self.imageNode)
|
self.zoomableContent = (largestSize.cgSize, self.imageNode)
|
||||||
self.setupStatus(resource: fileReference.media.resource)
|
self.setupStatus(resource: fileReference.media.resource)
|
||||||
|
@ -48,7 +48,7 @@ public final class HashtagSearchController: TelegramBaseController {
|
|||||||
return result.messages.map({ .message($0, RenderedPeer(message: $0), result.readStates[$0.id.peerId], chatListPresentationData) })
|
return result.messages.map({ .message($0, RenderedPeer(message: $0), result.readStates[$0.id.peerId], chatListPresentationData) })
|
||||||
}
|
}
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {
|
let interaction = ChatListNodeInteraction(activateSearch: {
|
||||||
}, peerSelected: { peer in
|
}, peerSelected: { _, _ in
|
||||||
}, disabledPeerSelected: { _ in
|
}, disabledPeerSelected: { _ in
|
||||||
}, togglePeerSelected: { _ in
|
}, togglePeerSelected: { _ in
|
||||||
}, additionalCategorySelected: { _ in
|
}, additionalCategorySelected: { _ in
|
||||||
|
@ -2,6 +2,7 @@ import Foundation
|
|||||||
|
|
||||||
public protocol AdditionalChatListItem: PostboxCoding {
|
public protocol AdditionalChatListItem: PostboxCoding {
|
||||||
var peerId: PeerId { get }
|
var peerId: PeerId { get }
|
||||||
|
var includeIfNoHistory: Bool { get }
|
||||||
|
|
||||||
func isEqual(to other: AdditionalChatListItem) -> Bool
|
func isEqual(to other: AdditionalChatListItem) -> Bool
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,7 @@ final class ChatListTable: Table {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func getStandalone(peerId: PeerId, messageHistoryTable: MessageHistoryTable) -> ChatListIntermediateEntry? {
|
func getStandalone(peerId: PeerId, messageHistoryTable: MessageHistoryTable, includeIfNoHistory: Bool) -> ChatListIntermediateEntry? {
|
||||||
let index = self.indexTable.get(peerId: peerId)
|
let index = self.indexTable.get(peerId: peerId)
|
||||||
switch index.inclusion {
|
switch index.inclusion {
|
||||||
case .ifHasMessagesOrOneOf:
|
case .ifHasMessagesOrOneOf:
|
||||||
@ -674,8 +674,11 @@ final class ChatListTable: Table {
|
|||||||
}
|
}
|
||||||
if let topMessageIndex = index.topMessageIndex {
|
if let topMessageIndex = index.topMessageIndex {
|
||||||
return ChatListIntermediateEntry.message(ChatListIndex(pinningIndex: nil, messageIndex: topMessageIndex), topMessageIndex)
|
return ChatListIntermediateEntry.message(ChatListIndex(pinningIndex: nil, messageIndex: topMessageIndex), topMessageIndex)
|
||||||
|
} else if includeIfNoHistory {
|
||||||
|
return ChatListIntermediateEntry.message(ChatListIndex(pinningIndex: nil, messageIndex: MessageIndex(id: MessageId(peerId: peerId, namespace: 0, id: 1), timestamp: 1)), nil)
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getEntry(groupId: PeerGroupId, peerId: PeerId, messageHistoryTable: MessageHistoryTable, peerChatInterfaceStateTable: PeerChatInterfaceStateTable) -> ChatListIntermediateEntry? {
|
func getEntry(groupId: PeerGroupId, peerId: PeerId, messageHistoryTable: MessageHistoryTable, peerChatInterfaceStateTable: PeerChatInterfaceStateTable) -> ChatListIntermediateEntry? {
|
||||||
|
@ -363,7 +363,7 @@ final class MutableChatListView {
|
|||||||
self.additionalItems = items
|
self.additionalItems = items
|
||||||
self.additionalItemIds = Set(items.map { $0.peerId })
|
self.additionalItemIds = Set(items.map { $0.peerId })
|
||||||
for item in items {
|
for item in items {
|
||||||
if let entry = postbox.chatListTable.getStandalone(peerId: item.peerId, messageHistoryTable: postbox.messageHistoryTable) {
|
if let entry = postbox.chatListTable.getStandalone(peerId: item.peerId, messageHistoryTable: postbox.messageHistoryTable, includeIfNoHistory: item.includeIfNoHistory) {
|
||||||
self.additionalItemEntries.append(MutableChatListAdditionalItemEntry(
|
self.additionalItemEntries.append(MutableChatListAdditionalItemEntry(
|
||||||
entry: MutableChatListEntry(entry, cachedDataTable: postbox.cachedPeerDataTable, readStateTable: postbox.readStateTable, messageHistoryTable: postbox.messageHistoryTable),
|
entry: MutableChatListEntry(entry, cachedDataTable: postbox.cachedPeerDataTable, readStateTable: postbox.readStateTable, messageHistoryTable: postbox.messageHistoryTable),
|
||||||
info: item
|
info: item
|
||||||
@ -534,7 +534,7 @@ final class MutableChatListView {
|
|||||||
if updateAdditionalItems {
|
if updateAdditionalItems {
|
||||||
self.additionalItemEntries.removeAll()
|
self.additionalItemEntries.removeAll()
|
||||||
for item in self.additionalItems {
|
for item in self.additionalItems {
|
||||||
if let entry = postbox.chatListTable.getStandalone(peerId: item.peerId, messageHistoryTable: postbox.messageHistoryTable) {
|
if let entry = postbox.chatListTable.getStandalone(peerId: item.peerId, messageHistoryTable: postbox.messageHistoryTable, includeIfNoHistory: item.includeIfNoHistory) {
|
||||||
self.additionalItemEntries.append(MutableChatListAdditionalItemEntry(
|
self.additionalItemEntries.append(MutableChatListAdditionalItemEntry(
|
||||||
entry: MutableChatListEntry(entry, cachedDataTable: postbox.cachedPeerDataTable, readStateTable: postbox.readStateTable, messageHistoryTable: postbox.messageHistoryTable),
|
entry: MutableChatListEntry(entry, cachedDataTable: postbox.cachedPeerDataTable, readStateTable: postbox.readStateTable, messageHistoryTable: postbox.messageHistoryTable),
|
||||||
info: item
|
info: item
|
||||||
|
@ -213,7 +213,7 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
|
|||||||
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
var items: [ChatListItem] = []
|
var items: [ChatListItem] = []
|
||||||
|
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
||||||
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
||||||
}, activateChatPreview: { _, _, gesture in
|
}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
|
@ -766,7 +766,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
|
|||||||
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
var items: [ChatListItem] = []
|
var items: [ChatListItem] = []
|
||||||
|
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
||||||
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
||||||
}, activateChatPreview: { _, _, gesture in
|
}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
|
@ -350,7 +350,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
private func updateChatsLayout(layout: ContainerViewLayout, topInset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
var items: [ChatListItem] = []
|
var items: [ChatListItem] = []
|
||||||
|
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in
|
||||||
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
}, messageSelected: { _, _, _ in}, groupSelected: { _ in }, addContact: { _ in }, setPeerIdWithRevealedOptions: { _, _ in }, setItemPinned: { _, _ in }, setPeerMuted: { _, _ in }, deletePeer: { _ in }, updatePeerGrouping: { _, _ in }, togglePeerMarkedUnread: { _, _ in}, toggleArchivedFolderHiddenByDefault: {}, hidePsa: { _ in
|
||||||
}, activateChatPreview: { _, _, gesture in
|
}, activateChatPreview: { _, _, gesture in
|
||||||
gesture?.cancel()
|
gesture?.cancel()
|
||||||
|
@ -362,10 +362,7 @@ public final class AccountViewTracker {
|
|||||||
return account.postbox.transaction { transaction -> Void in
|
return account.postbox.transaction { transaction -> Void in
|
||||||
if let webpage = webpage {
|
if let webpage = webpage {
|
||||||
transaction.updateMessage(messageId, update: { currentMessage in
|
transaction.updateMessage(messageId, update: { currentMessage in
|
||||||
var storeForwardInfo: StoreMessageForwardInfo?
|
let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
|
||||||
if let forwardInfo = currentMessage.forwardInfo {
|
|
||||||
storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author?.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature, psaType: forwardInfo.psaType)
|
|
||||||
}
|
|
||||||
var media = currentMessage.media
|
var media = currentMessage.media
|
||||||
for i in 0 ..< media.count {
|
for i in 0 ..< media.count {
|
||||||
if let _ = media[i] as? TelegramMediaWebpage {
|
if let _ = media[i] as? TelegramMediaWebpage {
|
||||||
@ -452,7 +449,7 @@ public final class AccountViewTracker {
|
|||||||
if let message = messages[messageId] {
|
if let message = messages[messageId] {
|
||||||
for media in message.media {
|
for media in message.media {
|
||||||
if let poll = media as? TelegramMediaPoll {
|
if let poll = media as? TelegramMediaPoll {
|
||||||
if let deadlineTimeout = poll.deadlineTimeout, message.id.namespace == Namespaces.Message.Cloud {
|
if let _ = poll.deadlineTimeout, message.id.namespace == Namespaces.Message.Cloud {
|
||||||
let startDate: Int32
|
let startDate: Int32
|
||||||
if let forwardInfo = message.forwardInfo {
|
if let forwardInfo = message.forwardInfo {
|
||||||
startDate = forwardInfo.date
|
startDate = forwardInfo.date
|
||||||
@ -598,10 +595,7 @@ public final class AccountViewTracker {
|
|||||||
for i in 0 ..< messageIds.count {
|
for i in 0 ..< messageIds.count {
|
||||||
if i < viewCounts.count {
|
if i < viewCounts.count {
|
||||||
transaction.updateMessage(messageIds[i], update: { currentMessage in
|
transaction.updateMessage(messageIds[i], update: { currentMessage in
|
||||||
var storeForwardInfo: StoreMessageForwardInfo?
|
let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
|
||||||
if let forwardInfo = currentMessage.forwardInfo {
|
|
||||||
storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author?.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature, psaType: forwardInfo.psaType)
|
|
||||||
}
|
|
||||||
var attributes = currentMessage.attributes
|
var attributes = currentMessage.attributes
|
||||||
loop: for j in 0 ..< attributes.count {
|
loop: for j in 0 ..< attributes.count {
|
||||||
if let attribute = attributes[j] as? ViewCountMessageAttribute {
|
if let attribute = attributes[j] as? ViewCountMessageAttribute {
|
||||||
|
@ -15,6 +15,15 @@ public final class PromoChatListItem: AdditionalChatListItem {
|
|||||||
public let peerId: PeerId
|
public let peerId: PeerId
|
||||||
public let kind: Kind
|
public let kind: Kind
|
||||||
|
|
||||||
|
public var includeIfNoHistory: Bool {
|
||||||
|
switch self.kind {
|
||||||
|
case .proxy:
|
||||||
|
return false
|
||||||
|
case let .psa(_, message):
|
||||||
|
return message != nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public init(peerId: PeerId, kind: Kind) {
|
public init(peerId: PeerId, kind: Kind) {
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.kind = kind
|
self.kind = kind
|
||||||
@ -108,8 +117,8 @@ func managedPromoInfoUpdates(postbox: Postbox, network: Network, viewTracker: Ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
var additionalChatListItems: [AdditionalChatListItem] = []
|
var additionalChatListItems: [AdditionalChatListItem] = []
|
||||||
if let channel = transaction.getPeer(peer.peerId) as? TelegramChannel {
|
if let parsedPeer = transaction.getPeer(peer.peerId) {
|
||||||
additionalChatListItems.append(PromoChatListItem(peerId: channel.id, kind: kind))
|
additionalChatListItems.append(PromoChatListItem(peerId: parsedPeer.id, kind: kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.replaceAdditionalChatListItems(additionalChatListItems)
|
transaction.replaceAdditionalChatListItems(additionalChatListItems)
|
||||||
@ -139,7 +148,9 @@ func managedPromoInfoUpdates(postbox: Postbox, network: Network, viewTracker: Ac
|
|||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
let disposables = DisposableSet()
|
let disposables = DisposableSet()
|
||||||
for item in items {
|
for item in items {
|
||||||
disposables.add(viewTracker.polledChannel(peerId: item).start())
|
if item.namespace == Namespaces.Peer.CloudChannel {
|
||||||
|
disposables.add(viewTracker.polledChannel(peerId: item).start())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActionDisposable {
|
return ActionDisposable {
|
||||||
|
@ -163,7 +163,8 @@ private struct ApplicationSpecificNoticeKeys {
|
|||||||
private static let globalNamespace: Int32 = 2
|
private static let globalNamespace: Int32 = 2
|
||||||
private static let permissionsNamespace: Int32 = 3
|
private static let permissionsNamespace: Int32 = 3
|
||||||
private static let peerReportNamespace: Int32 = 4
|
private static let peerReportNamespace: Int32 = 4
|
||||||
private static let inlineBotLocationRequestNamespace: Int32 = 1
|
private static let inlineBotLocationRequestNamespace: Int32 = 5
|
||||||
|
private static let psaAcknowledgementNamespace: Int32 = 6
|
||||||
|
|
||||||
static func inlineBotLocationRequestNotice(peerId: PeerId) -> NoticeEntryKey {
|
static func inlineBotLocationRequestNotice(peerId: PeerId) -> NoticeEntryKey {
|
||||||
return NoticeEntryKey(namespace: noticeNamespace(namespace: inlineBotLocationRequestNamespace), key: noticeKey(peerId: peerId, key: 0))
|
return NoticeEntryKey(namespace: noticeNamespace(namespace: inlineBotLocationRequestNamespace), key: noticeKey(peerId: peerId, key: 0))
|
||||||
@ -205,6 +206,10 @@ private struct ApplicationSpecificNoticeKeys {
|
|||||||
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.proxyAdsAcknowledgment.key)
|
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.proxyAdsAcknowledgment.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func psaAdsAcknowledgment(peerId: PeerId) -> NoticeEntryKey {
|
||||||
|
return NoticeEntryKey(namespace: noticeNamespace(namespace: psaAcknowledgementNamespace), key: noticeKey(peerId: peerId, key: 0))
|
||||||
|
}
|
||||||
|
|
||||||
static func setPublicChannelLink() -> NoticeEntryKey {
|
static func setPublicChannelLink() -> NoticeEntryKey {
|
||||||
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.setPublicChannelLink.key)
|
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.setPublicChannelLink.key)
|
||||||
}
|
}
|
||||||
@ -454,6 +459,22 @@ public struct ApplicationSpecificNotice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func getPsaAcknowledgment(accountManager: AccountManager, peerId: PeerId) -> Signal<Bool, NoError> {
|
||||||
|
return accountManager.transaction { transaction -> Bool in
|
||||||
|
if let _ = transaction.getNotice(ApplicationSpecificNoticeKeys.psaAdsAcknowledgment(peerId: peerId)) as? ApplicationSpecificBoolNotice {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func setPsaAcknowledgment(accountManager: AccountManager, peerId: PeerId) -> Signal<Void, NoError> {
|
||||||
|
return accountManager.transaction { transaction -> Void in
|
||||||
|
transaction.setNotice(ApplicationSpecificNoticeKeys.psaAdsAcknowledgment(peerId: peerId), ApplicationSpecificBoolNotice())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static func getPasscodeLockTips(accountManager: AccountManager) -> Signal<Bool, NoError> {
|
public static func getPasscodeLockTips(accountManager: AccountManager) -> Signal<Bool, NoError> {
|
||||||
return accountManager.transaction { transaction -> Bool in
|
return accountManager.transaction { transaction -> Bool in
|
||||||
if let _ = transaction.getNotice(ApplicationSpecificNoticeKeys.passcodeLockTips()) as? ApplicationSpecificBoolNotice {
|
if let _ = transaction.getNotice(ApplicationSpecificNoticeKeys.passcodeLockTips()) as? ApplicationSpecificBoolNotice {
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -6463,6 +6463,80 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
self.present(tooltipScreen, in: .current)
|
self.present(tooltipScreen, in: .current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func displayPromoAnnouncement(text: String) {
|
||||||
|
let psaText: String = text
|
||||||
|
let psaEntities: [MessageTextEntity] = generateTextEntities(psaText, enabledTypes: .url)
|
||||||
|
|
||||||
|
var found = false
|
||||||
|
self.forEachController({ controller in
|
||||||
|
if let controller = controller as? TooltipScreen {
|
||||||
|
if controller.text == psaText {
|
||||||
|
found = true
|
||||||
|
controller.dismiss()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
if found {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let tooltipScreen = TooltipScreen(text: psaText, textEntities: psaEntities, icon: .info, location: .top, shouldDismissOnTouch: { point in
|
||||||
|
return .ignore
|
||||||
|
}, openActiveTextItem: { [weak self] item, action in
|
||||||
|
guard let strongSelf = self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch item {
|
||||||
|
case let .url(url):
|
||||||
|
switch action {
|
||||||
|
case .tap:
|
||||||
|
strongSelf.openUrl(url, concealed: false)
|
||||||
|
case .longTap:
|
||||||
|
strongSelf.controllerInteraction?.longTap(.url(url), nil)
|
||||||
|
}
|
||||||
|
case let .mention(peerId, mention):
|
||||||
|
switch action {
|
||||||
|
case .tap:
|
||||||
|
strongSelf.controllerInteraction?.openPeer(peerId, .default, nil)
|
||||||
|
case .longTap:
|
||||||
|
strongSelf.controllerInteraction?.longTap(.peerMention(peerId, mention), nil)
|
||||||
|
}
|
||||||
|
case let .textMention(mention):
|
||||||
|
switch action {
|
||||||
|
case .tap:
|
||||||
|
strongSelf.controllerInteraction?.openPeerMention(mention)
|
||||||
|
case .longTap:
|
||||||
|
strongSelf.controllerInteraction?.longTap(.mention(mention), nil)
|
||||||
|
}
|
||||||
|
case let .botCommand(command):
|
||||||
|
switch action {
|
||||||
|
case .tap:
|
||||||
|
strongSelf.controllerInteraction?.sendBotCommand(nil, command)
|
||||||
|
case .longTap:
|
||||||
|
strongSelf.controllerInteraction?.longTap(.command(command), nil)
|
||||||
|
}
|
||||||
|
case let .hashtag(hashtag):
|
||||||
|
switch action {
|
||||||
|
case .tap:
|
||||||
|
strongSelf.controllerInteraction?.openHashtag(nil, hashtag)
|
||||||
|
case .longTap:
|
||||||
|
strongSelf.controllerInteraction?.longTap(.hashtag(hashtag), nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
self.forEachController({ controller in
|
||||||
|
if let controller = controller as? TooltipScreen {
|
||||||
|
controller.dismiss()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
self.present(tooltipScreen, in: .current)
|
||||||
|
}
|
||||||
|
|
||||||
private func displayPsa(type: String, sourceNode: ASDisplayNode, isAutomatic: Bool) {
|
private func displayPsa(type: String, sourceNode: ASDisplayNode, isAutomatic: Bool) {
|
||||||
var maybeFoundItemNode: ChatMessageItemView?
|
var maybeFoundItemNode: ChatMessageItemView?
|
||||||
self.chatDisplayNode.historyNode.forEachItemNode { itemNode in
|
self.chatDisplayNode.historyNode.forEachItemNode { itemNode in
|
||||||
@ -6476,7 +6550,14 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let psaText: String = "This message provides you with a public service announcement in relation to the undergoing pandemics. Learn more about this initiative at https://telegram.org/blog/coronavirus"
|
var psaText = self.presentationData.strings.Chat_GenericPsaTooltip
|
||||||
|
let key = "Chat.PsaTooltip.\(type)"
|
||||||
|
if let string = self.presentationData.strings.primaryComponent.dict[key] {
|
||||||
|
psaText = string
|
||||||
|
} else if let string = self.presentationData.strings.secondaryComponent?.dict[key] {
|
||||||
|
psaText = string
|
||||||
|
}
|
||||||
|
|
||||||
let psaEntities: [MessageTextEntity] = generateTextEntities(psaText, enabledTypes: .url)
|
let psaEntities: [MessageTextEntity] = generateTextEntities(psaText, enabledTypes: .url)
|
||||||
|
|
||||||
var found = false
|
var found = false
|
||||||
|
@ -123,9 +123,30 @@ class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||||||
|
|
||||||
switch type {
|
switch type {
|
||||||
case let .bubble(incoming):
|
case let .bubble(incoming):
|
||||||
if let _ = psaType {
|
if let psaType = psaType {
|
||||||
titleColor = incoming ? presentationData.theme.theme.chat.message.incoming.polls.barPositive : presentationData.theme.theme.chat.message.outgoing.polls.barPositive
|
titleColor = incoming ? presentationData.theme.theme.chat.message.incoming.polls.barPositive : presentationData.theme.theme.chat.message.outgoing.polls.barPositive
|
||||||
completeSourceString = strings.Message_GenericForwardedPsa(peerString)
|
|
||||||
|
var customFormat: String?
|
||||||
|
let key = "Message.ForwardedPsa.\(psaType)"
|
||||||
|
if let string = presentationData.strings.primaryComponent.dict[key] {
|
||||||
|
customFormat = string
|
||||||
|
} else if let string = presentationData.strings.secondaryComponent?.dict[key] {
|
||||||
|
customFormat = string
|
||||||
|
}
|
||||||
|
|
||||||
|
if let customFormat = customFormat {
|
||||||
|
if let range = customFormat.range(of: "%@") {
|
||||||
|
let leftPart = String(customFormat[customFormat.startIndex ..< range.lowerBound])
|
||||||
|
let rightPart = String(customFormat[range.upperBound...])
|
||||||
|
|
||||||
|
let formattedText = leftPart + peerString + rightPart
|
||||||
|
completeSourceString = (formattedText, [(0, NSRange(location: leftPart.count, length: peerString.count))])
|
||||||
|
} else {
|
||||||
|
completeSourceString = (customFormat, [])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
completeSourceString = strings.Message_GenericForwardedPsa(peerString)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
titleColor = incoming ? presentationData.theme.theme.chat.message.incoming.accentTextColor : presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
titleColor = incoming ? presentationData.theme.theme.chat.message.incoming.accentTextColor : presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
||||||
completeSourceString = strings.Message_ForwardedMessage(peerString)
|
completeSourceString = strings.Message_ForwardedMessage(peerString)
|
||||||
@ -174,7 +195,7 @@ class ChatMessageForwardInfoNode: ASDisplayNode {
|
|||||||
|
|
||||||
var infoWidth: CGFloat = 0.0
|
var infoWidth: CGFloat = 0.0
|
||||||
if hasPsaInfo {
|
if hasPsaInfo {
|
||||||
infoWidth += 44.0
|
infoWidth += 32.0
|
||||||
}
|
}
|
||||||
|
|
||||||
let (textLayout, textApply) = textNodeLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .end, constrainedSize: CGSize(width: constrainedSize.width - credibilityIconWidth - infoWidth, height: constrainedSize.height), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (textLayout, textApply) = textNodeLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .end, constrainedSize: CGSize(width: constrainedSize.width - credibilityIconWidth - infoWidth, height: constrainedSize.height), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
@ -167,7 +167,7 @@ class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
let interaction = ChatListNodeInteraction(activateSearch: {
|
let interaction = ChatListNodeInteraction(activateSearch: {
|
||||||
}, peerSelected: { _ in
|
}, peerSelected: { _, _ in
|
||||||
}, disabledPeerSelected: { _ in
|
}, disabledPeerSelected: { _ in
|
||||||
}, togglePeerSelected: { _ in
|
}, togglePeerSelected: { _ in
|
||||||
}, additionalCategorySelected: { _ in
|
}, additionalCategorySelected: { _ in
|
||||||
|
@ -33,14 +33,14 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
|
|||||||
} else if params.scrollToEndIfExists && isFirst {
|
} else if params.scrollToEndIfExists && isFirst {
|
||||||
controller.scrollToEndOfHistory()
|
controller.scrollToEndOfHistory()
|
||||||
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
||||||
params.completion()
|
params.completion(controller)
|
||||||
} else if params.activateMessageSearch {
|
} else if params.activateMessageSearch {
|
||||||
controller.activateSearch()
|
controller.activateSearch()
|
||||||
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
||||||
params.completion()
|
params.completion(controller)
|
||||||
} else {
|
} else {
|
||||||
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
let _ = params.navigationController.popToViewController(controller, animated: params.animated)
|
||||||
params.completion()
|
params.completion(controller)
|
||||||
}
|
}
|
||||||
controller.purposefulAction = params.purposefulAction
|
controller.purposefulAction = params.purposefulAction
|
||||||
if params.activateInput {
|
if params.activateInput {
|
||||||
@ -83,7 +83,9 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
|
|||||||
resolvedKeepStack = false
|
resolvedKeepStack = false
|
||||||
}
|
}
|
||||||
if resolvedKeepStack {
|
if resolvedKeepStack {
|
||||||
params.navigationController.pushViewController(controller, animated: params.animated, completion: params.completion)
|
params.navigationController.pushViewController(controller, animated: params.animated, completion: {
|
||||||
|
params.completion(controller)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
let viewControllers = params.navigationController.viewControllers.filter({ controller in
|
let viewControllers = params.navigationController.viewControllers.filter({ controller in
|
||||||
if controller is ChatListController {
|
if controller is ChatListController {
|
||||||
@ -99,9 +101,13 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if viewControllers.isEmpty {
|
if viewControllers.isEmpty {
|
||||||
params.navigationController.replaceAllButRootController(controller, animated: params.animated, animationOptions: params.options, completion: params.completion)
|
params.navigationController.replaceAllButRootController(controller, animated: params.animated, animationOptions: params.options, completion: {
|
||||||
|
params.completion(controller)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
params.navigationController.replaceControllersAndPush(controllers: viewControllers, controller: controller, animated: params.animated, options: params.options, completion: params.completion)
|
params.navigationController.replaceControllersAndPush(controllers: viewControllers, controller: controller, animated: params.animated, options: params.options, completion: {
|
||||||
|
params.completion(controller)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if params.activateInput {
|
if params.activateInput {
|
||||||
|
Binary file not shown.
@ -449,12 +449,12 @@ public final class WalletStrings: Equatable {
|
|||||||
public var Wallet_SecureStorageReset_Title: String { return self._s[219]! }
|
public var Wallet_SecureStorageReset_Title: String { return self._s[219]! }
|
||||||
public var Wallet_Receive_CommentHeader: String { return self._s[220]! }
|
public var Wallet_Receive_CommentHeader: String { return self._s[220]! }
|
||||||
public var Wallet_Info_ReceiveGrams: String { return self._s[221]! }
|
public var Wallet_Info_ReceiveGrams: String { return self._s[221]! }
|
||||||
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
|
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
|
||||||
let form = getPluralizationForm(self.lc, value)
|
let form = getPluralizationForm(self.lc, value)
|
||||||
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||||
return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, stringValue)
|
return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, stringValue)
|
||||||
}
|
}
|
||||||
public func Wallet_Updated_HoursAgo(_ value: Int32) -> String {
|
public func Wallet_Updated_MinutesAgo(_ value: Int32) -> String {
|
||||||
let form = getPluralizationForm(self.lc, value)
|
let form = getPluralizationForm(self.lc, value)
|
||||||
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
let stringValue = walletStringsFormattedNumber(value, self.groupingSeparator)
|
||||||
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)
|
return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, stringValue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user