mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
28c3ffef88
commit
17390d9067
@ -8269,8 +8269,8 @@ Sorry for the inconvenience.";
|
|||||||
"EmojiSearch.SearchTopicIconsPlaceholder" = "Search Topic Icons";
|
"EmojiSearch.SearchTopicIconsPlaceholder" = "Search Topic Icons";
|
||||||
"EmojiSearch.SearchTopicIconsEmptyResult" = "No emoji found";
|
"EmojiSearch.SearchTopicIconsEmptyResult" = "No emoji found";
|
||||||
|
|
||||||
"Username.UsernamePurchaseAvailable" = "Sorry, this username is occupied by someone. But it's available for purchase on [fragment.com]().";
|
"Username.UsernamePurchaseAvailable" = "**This username is already taken.** However, it is being resold via auction. [Learn more...]()";
|
||||||
"Channel.Username.UsernamePurchaseAvailable" = "Sorry, this link is occupied by someone. But it's available for purchase on [fragment.com]().";
|
"Channel.Username.UsernamePurchaseAvailable" = "**This username is already taken.** However, it is being resold via auction. [Learn more...]()";
|
||||||
|
|
||||||
"DownloadList.IncreaseSpeed" = "Increase Speed";
|
"DownloadList.IncreaseSpeed" = "Increase Speed";
|
||||||
"Conversation.IncreaseSpeed" = "Increase Speed";
|
"Conversation.IncreaseSpeed" = "Increase Speed";
|
||||||
|
@ -761,12 +761,13 @@ func chatForumTopicMenuItems(context: AccountContext, peerId: PeerId, threadId:
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
// items.append(.separator)
|
if canOpenClose {
|
||||||
// items.append(.action(ContextMenuActionItem(text: strings.ChatList_Context_Select, textColor: .primary, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
items.append(.separator)
|
||||||
// f(.default)
|
items.append(.action(ContextMenuActionItem(text: strings.ChatList_Context_Select, textColor: .primary, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.contextMenu.primaryColor) }, action: { _, f in
|
||||||
//
|
f(.default)
|
||||||
//
|
chatListController?.selectPeerThread(peerId: peerId, threadId: threadId)
|
||||||
// })))
|
})))
|
||||||
|
}
|
||||||
|
|
||||||
return .single(items)
|
return .single(items)
|
||||||
}
|
}
|
||||||
|
@ -527,21 +527,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
navigationController.replaceController(strongSelf, with: chatController, animated: true)
|
navigationController.replaceController(strongSelf, with: chatController, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let channel = peerView.peers[peerView.peerId] as? TelegramChannel {
|
|
||||||
switch channel.participationStatus {
|
|
||||||
case .member:
|
|
||||||
strongSelf.setToolbar(nil, transition: .animated(duration: 0.4, curve: .spring))
|
|
||||||
default:
|
|
||||||
let actionTitle: String
|
|
||||||
if channel.flags.contains(.requestToJoin) {
|
|
||||||
actionTitle = strongSelf.presentationData.strings.Group_ApplyToJoin
|
|
||||||
} else {
|
|
||||||
actionTitle = strongSelf.presentationData.strings.Channel_JoinChannel
|
|
||||||
}
|
|
||||||
strongSelf.setToolbar(Toolbar(leftAction: nil, rightAction: nil, middleAction: ToolbarAction(title: actionTitle, isEnabled: true)), transition: .animated(duration: 0.4, curve: .spring))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1781,11 +1766,20 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let peerView: Signal<PeerView?, NoError>
|
||||||
|
if case let .forum(peerId) = location {
|
||||||
|
peerView = context.account.viewTracker.peerView(peerId)
|
||||||
|
|> map(Optional.init)
|
||||||
|
} else {
|
||||||
|
peerView = .single(nil)
|
||||||
|
}
|
||||||
|
|
||||||
let previousToolbarValue = Atomic<Toolbar?>(value: nil)
|
let previousToolbarValue = Atomic<Toolbar?>(value: nil)
|
||||||
self.stateDisposable.set(combineLatest(queue: .mainQueue(),
|
self.stateDisposable.set(combineLatest(queue: .mainQueue(),
|
||||||
self.presentationDataValue.get(),
|
self.presentationDataValue.get(),
|
||||||
peerIdsAndOptions
|
peerIdsAndOptions,
|
||||||
).start(next: { [weak self] presentationData, peerIdsAndOptions in
|
peerView
|
||||||
|
).start(next: { [weak self] presentationData, peerIdsAndOptions, peerView in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1838,6 +1832,19 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
toolbar = Toolbar(leftAction: leftAction, rightAction: ToolbarAction(title: presentationData.strings.Common_Delete, isEnabled: options.delete), middleAction: middleAction)
|
toolbar = Toolbar(leftAction: leftAction, rightAction: ToolbarAction(title: presentationData.strings.Common_Delete, isEnabled: options.delete), middleAction: middleAction)
|
||||||
}
|
}
|
||||||
|
} else if let peerView = peerView, let channel = peerView.peers[peerView.peerId] as? TelegramChannel {
|
||||||
|
switch channel.participationStatus {
|
||||||
|
case .member:
|
||||||
|
strongSelf.setToolbar(nil, transition: .animated(duration: 0.4, curve: .spring))
|
||||||
|
default:
|
||||||
|
let actionTitle: String
|
||||||
|
if channel.flags.contains(.requestToJoin) {
|
||||||
|
actionTitle = strongSelf.presentationData.strings.Group_ApplyToJoin
|
||||||
|
} else {
|
||||||
|
actionTitle = strongSelf.presentationData.strings.Channel_JoinChannel
|
||||||
|
}
|
||||||
|
strongSelf.setToolbar(Toolbar(leftAction: nil, rightAction: nil, middleAction: ToolbarAction(title: actionTitle, isEnabled: true)), transition: .animated(duration: 0.4, curve: .spring))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var transition: ContainedViewLayoutTransition = .immediate
|
var transition: ContainedViewLayoutTransition = .immediate
|
||||||
let previousToolbar = previousToolbarValue.swap(toolbar)
|
let previousToolbar = previousToolbarValue.swap(toolbar)
|
||||||
@ -3823,6 +3830,15 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
self.present(actionSheet, in: .window(.root))
|
self.present(actionSheet, in: .window(.root))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func selectPeerThread(peerId: EnginePeer.Id, threadId: Int64) {
|
||||||
|
self.chatListDisplayNode.containerNode.updateState({ state in
|
||||||
|
var state = state
|
||||||
|
state.selectedThreadIds.insert(threadId)
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
self.chatListDisplayNode.containerNode.didBeginSelectingChats?()
|
||||||
|
}
|
||||||
|
|
||||||
private func commitDeletePeerThread(peerId: EnginePeer.Id, threadId: Int64, completion: @escaping () -> Void) {
|
private func commitDeletePeerThread(peerId: EnginePeer.Id, threadId: Int64, completion: @escaping () -> Void) {
|
||||||
self.forEachController({ controller in
|
self.forEachController({ controller in
|
||||||
if let controller = controller as? UndoOverlayController {
|
if let controller = controller as? UndoOverlayController {
|
||||||
|
@ -1427,29 +1427,41 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let _ = (ChatInterfaceState.update(engine: strongSelf.context.engine, peerId: peerId, threadId: nil, { currentState in
|
let _ = (ChatInterfaceState.update(engine: strongSelf.context.engine, peerId: peerId, threadId: threadId, { currentState in
|
||||||
return currentState.withUpdatedForwardMessageIds(Array(messageIds))
|
return currentState.withUpdatedForwardMessageIds(Array(messageIds))
|
||||||
})
|
})
|
||||||
|> deliverOnMainQueue).start(completed: {
|
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let controller = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peerId), subject: nil, botStart: nil, mode: .standard(previewing: false))
|
let proceed: (ChatController) -> Void = { chatController in
|
||||||
controller.purposefulAction = { [weak self] in
|
chatController.purposefulAction = { [weak self] in
|
||||||
self?.cancel?()
|
self?.cancel?()
|
||||||
}
|
|
||||||
|
|
||||||
if let navigationController = strongSelf.navigationController, let peerSelectionControllerIndex = navigationController.viewControllers.firstIndex(where: { $0 is PeerSelectionController }) {
|
|
||||||
var viewControllers = navigationController.viewControllers
|
|
||||||
viewControllers.insert(controller, at: peerSelectionControllerIndex)
|
|
||||||
navigationController.setViewControllers(viewControllers, animated: false)
|
|
||||||
Queue.mainQueue().after(0.2) {
|
|
||||||
peerSelectionController?.dismiss()
|
|
||||||
}
|
}
|
||||||
} else {
|
if let navigationController = strongSelf.navigationController {
|
||||||
strongSelf.navigationController?.pushViewController(controller, animated: false, completion: {
|
var viewControllers = navigationController.viewControllers
|
||||||
if let peerSelectionController = peerSelectionController {
|
if threadId != nil {
|
||||||
peerSelectionController.dismiss()
|
viewControllers.insert(chatController, at: viewControllers.count - 2)
|
||||||
|
} else {
|
||||||
|
viewControllers.insert(chatController, at: viewControllers.count - 1)
|
||||||
}
|
}
|
||||||
|
navigationController.setViewControllers(viewControllers, animated: false)
|
||||||
|
|
||||||
|
strongSelf.activeActionDisposable.set((chatController.ready.get()
|
||||||
|
|> filter { $0 }
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak navigationController] _ in
|
||||||
|
viewControllers.removeAll(where: { $0 is PeerSelectionController })
|
||||||
|
navigationController?.setViewControllers(viewControllers, animated: true)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let threadId = threadId {
|
||||||
|
let _ = (strongSelf.context.sharedContext.chatControllerForForumThread(context: strongSelf.context, peerId: peerId, threadId: threadId)
|
||||||
|
|> deliverOnMainQueue).start(next: { chatController in
|
||||||
|
proceed(chatController)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
proceed(strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(id: peerId), subject: nil, botStart: nil, mode: .standard(previewing: false)))
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.updateState { state in
|
strongSelf.updateState { state in
|
||||||
|
@ -1959,9 +1959,9 @@ public final class ChatListNode: ListView {
|
|||||||
}
|
}
|
||||||
self.view.addGestureRecognizer(selectionRecognizer)
|
self.view.addGestureRecognizer(selectionRecognizer)
|
||||||
|
|
||||||
if case .forum = location {
|
// if case .forum = location {
|
||||||
self.isSelectionGestureEnabled = false
|
// self.isSelectionGestureEnabled = false
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
@ -109,7 +109,6 @@ public class ItemListActivityTextItemNode: ListViewItemNode {
|
|||||||
let verticalInset: CGFloat = 7.0
|
let verticalInset: CGFloat = 7.0
|
||||||
|
|
||||||
let titleFont = Font.regular(item.presentationData.fontSize.itemListBaseHeaderFontSize)
|
let titleFont = Font.regular(item.presentationData.fontSize.itemListBaseHeaderFontSize)
|
||||||
let titleBoldFont = Font.semibold(item.presentationData.fontSize.itemListBaseHeaderFontSize)
|
|
||||||
|
|
||||||
var activityWidth: CGFloat = 0.0
|
var activityWidth: CGFloat = 0.0
|
||||||
if item.displayActivity {
|
if item.displayActivity {
|
||||||
@ -128,7 +127,7 @@ public class ItemListActivityTextItemNode: ListViewItemNode {
|
|||||||
textColor = UIColor(rgb: 0xef8c00)
|
textColor = UIColor(rgb: 0xef8c00)
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributedString = parseMarkdownIntoAttributedString(item.text, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: titleFont, textColor: textColor), bold: MarkdownAttributeSet(font: titleBoldFont, textColor: textColor), link: MarkdownAttributeSet(font: titleFont, textColor: item.presentationData.theme.list.itemAccentColor), linkAttribute: { contents in
|
let attributedString = parseMarkdownIntoAttributedString(item.text, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: titleFont, textColor: textColor), bold: MarkdownAttributeSet(font: titleFont, textColor: item.presentationData.theme.list.freeTextErrorColor), link: MarkdownAttributeSet(font: titleFont, textColor: item.presentationData.theme.list.itemAccentColor), linkAttribute: { contents in
|
||||||
return (TelegramTextAttributes.URL, contents)
|
return (TelegramTextAttributes.URL, contents)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ private enum ChannelVisibilityEntry: ItemListNodeEntry {
|
|||||||
case .taken:
|
case .taken:
|
||||||
textColor = .destructive
|
textColor = .destructive
|
||||||
case .purchaseAvailable:
|
case .purchaseAvailable:
|
||||||
textColor = .warning
|
textColor = .generic
|
||||||
}
|
}
|
||||||
case .checking:
|
case .checking:
|
||||||
textColor = .generic
|
textColor = .generic
|
||||||
|
@ -219,7 +219,7 @@ private enum UsernameSetupEntry: ItemListNodeEntry {
|
|||||||
case .available:
|
case .available:
|
||||||
textColor = .constructive
|
textColor = .constructive
|
||||||
case .purchaseAvailable:
|
case .purchaseAvailable:
|
||||||
textColor = .warning
|
textColor = .generic
|
||||||
case .invalid, .taken:
|
case .invalid, .taken:
|
||||||
textColor = .destructive
|
textColor = .destructive
|
||||||
}
|
}
|
||||||
|
@ -683,12 +683,16 @@ public final class TelegramMediaFile: Media, Equatable, Codable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var isMusic: Bool {
|
public var isMusic: Bool {
|
||||||
|
var hasNonVoiceAudio = false
|
||||||
|
var hasVideo = false
|
||||||
for attribute in self.attributes {
|
for attribute in self.attributes {
|
||||||
if case .Audio(false, _, _, _, _) = attribute {
|
if case .Audio(false, _, _, _, _) = attribute {
|
||||||
return true
|
hasNonVoiceAudio = true
|
||||||
|
} else if case .Video = attribute {
|
||||||
|
hasVideo = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return hasNonVoiceAudio && !hasVideo
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isVoice: Bool {
|
public var isVoice: Bool {
|
||||||
|
@ -2147,29 +2147,40 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
|
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
|
||||||
c.dismiss(completion: {
|
c.dismiss(completion: {
|
||||||
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||||
let currentPeerId = strongSelf.peerId
|
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(EnginePeer(currentPeer)), subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: {
|
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).start()
|
||||||
var viewControllers = navigationController.viewControllers
|
} else {
|
||||||
var indexesToRemove = Set<Int>()
|
let targetLocation: NavigateToChatControllerParams.Location
|
||||||
var keptCurrentChatController = false
|
if case let .replyThread(message) = strongSelf.chatLocation {
|
||||||
var index: Int = viewControllers.count - 1
|
targetLocation = .replyThread(message)
|
||||||
for controller in viewControllers.reversed() {
|
} else {
|
||||||
if let controller = controller as? ChatController, case let .peer(peerId) = controller.chatLocation {
|
targetLocation = .peer(EnginePeer(currentPeer))
|
||||||
if peerId == currentPeerId && !keptCurrentChatController {
|
}
|
||||||
keptCurrentChatController = true
|
|
||||||
} else {
|
let currentPeerId = strongSelf.peerId
|
||||||
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: targetLocation, subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: {
|
||||||
|
var viewControllers = navigationController.viewControllers
|
||||||
|
var indexesToRemove = Set<Int>()
|
||||||
|
var keptCurrentChatController = false
|
||||||
|
var index: Int = viewControllers.count - 1
|
||||||
|
for controller in viewControllers.reversed() {
|
||||||
|
if let controller = controller as? ChatController, case let .peer(peerId) = controller.chatLocation {
|
||||||
|
if peerId == currentPeerId && !keptCurrentChatController {
|
||||||
|
keptCurrentChatController = true
|
||||||
|
} else {
|
||||||
|
indexesToRemove.insert(index)
|
||||||
|
}
|
||||||
|
} else if controller is PeerInfoScreen {
|
||||||
indexesToRemove.insert(index)
|
indexesToRemove.insert(index)
|
||||||
}
|
}
|
||||||
} else if controller is PeerInfoScreen {
|
index -= 1
|
||||||
indexesToRemove.insert(index)
|
|
||||||
}
|
}
|
||||||
index -= 1
|
for i in indexesToRemove.sorted().reversed() {
|
||||||
}
|
viewControllers.remove(at: i)
|
||||||
for i in indexesToRemove.sorted().reversed() {
|
}
|
||||||
viewControllers.remove(at: i)
|
navigationController.setViewControllers(viewControllers, animated: false)
|
||||||
}
|
}))
|
||||||
navigationController.setViewControllers(viewControllers, animated: false)
|
}
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
@ -2298,36 +2309,40 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
items.append(.action(ContextMenuActionItem(text: strings.SharedMedia_ViewInChat, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/GoToMessage"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||||
c.dismiss(completion: {
|
c.dismiss(completion: {
|
||||||
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||||
let targetLocation: NavigateToChatControllerParams.Location
|
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
|
||||||
if case let .replyThread(message) = strongSelf.chatLocation {
|
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).start()
|
||||||
targetLocation = .replyThread(message)
|
|
||||||
} else {
|
} else {
|
||||||
targetLocation = .peer(EnginePeer(currentPeer))
|
let targetLocation: NavigateToChatControllerParams.Location
|
||||||
}
|
if case let .replyThread(message) = strongSelf.chatLocation {
|
||||||
|
targetLocation = .replyThread(message)
|
||||||
let currentPeerId = strongSelf.peerId
|
} else {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: targetLocation, subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: {
|
targetLocation = .peer(EnginePeer(currentPeer))
|
||||||
var viewControllers = navigationController.viewControllers
|
}
|
||||||
var indexesToRemove = Set<Int>()
|
|
||||||
var keptCurrentChatController = false
|
let currentPeerId = strongSelf.peerId
|
||||||
var index: Int = viewControllers.count - 1
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: targetLocation, subject: .message(id: .id(message.id), highlight: true, timecode: nil), keepStack: .always, useExisting: false, purposefulAction: {
|
||||||
for controller in viewControllers.reversed() {
|
var viewControllers = navigationController.viewControllers
|
||||||
if let controller = controller as? ChatController, case let .peer(peerId) = controller.chatLocation {
|
var indexesToRemove = Set<Int>()
|
||||||
if peerId == currentPeerId && !keptCurrentChatController {
|
var keptCurrentChatController = false
|
||||||
keptCurrentChatController = true
|
var index: Int = viewControllers.count - 1
|
||||||
} else {
|
for controller in viewControllers.reversed() {
|
||||||
|
if let controller = controller as? ChatController, case let .peer(peerId) = controller.chatLocation {
|
||||||
|
if peerId == currentPeerId && !keptCurrentChatController {
|
||||||
|
keptCurrentChatController = true
|
||||||
|
} else {
|
||||||
|
indexesToRemove.insert(index)
|
||||||
|
}
|
||||||
|
} else if controller is PeerInfoScreen {
|
||||||
indexesToRemove.insert(index)
|
indexesToRemove.insert(index)
|
||||||
}
|
}
|
||||||
} else if controller is PeerInfoScreen {
|
index -= 1
|
||||||
indexesToRemove.insert(index)
|
|
||||||
}
|
}
|
||||||
index -= 1
|
for i in indexesToRemove.sorted().reversed() {
|
||||||
}
|
viewControllers.remove(at: i)
|
||||||
for i in indexesToRemove.sorted().reversed() {
|
}
|
||||||
viewControllers.remove(at: i)
|
navigationController.setViewControllers(viewControllers, animated: false)
|
||||||
}
|
}))
|
||||||
navigationController.setViewControllers(viewControllers, animated: false)
|
}
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user