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.SearchTopicIconsEmptyResult" = "No emoji found";
|
||||
|
||||
"Username.UsernamePurchaseAvailable" = "Sorry, this username is occupied by someone. But it's available for purchase on [fragment.com]().";
|
||||
"Channel.Username.UsernamePurchaseAvailable" = "Sorry, this link 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" = "**This username is already taken.** However, it is being resold via auction. [Learn more...]()";
|
||||
|
||||
"DownloadList.IncreaseSpeed" = "Increase Speed";
|
||||
"Conversation.IncreaseSpeed" = "Increase Speed";
|
||||
|
@ -761,12 +761,13 @@ func chatForumTopicMenuItems(context: AccountContext, peerId: PeerId, threadId:
|
||||
})))
|
||||
}
|
||||
|
||||
// items.append(.separator)
|
||||
// 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)
|
||||
//
|
||||
//
|
||||
// })))
|
||||
if canOpenClose {
|
||||
items.append(.separator)
|
||||
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)
|
||||
}
|
||||
|
@ -527,21 +527,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
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)
|
||||
self.stateDisposable.set(combineLatest(queue: .mainQueue(),
|
||||
self.presentationDataValue.get(),
|
||||
peerIdsAndOptions
|
||||
).start(next: { [weak self] presentationData, peerIdsAndOptions in
|
||||
peerIdsAndOptions,
|
||||
peerView
|
||||
).start(next: { [weak self] presentationData, peerIdsAndOptions, peerView in
|
||||
guard let strongSelf = self else {
|
||||
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)
|
||||
}
|
||||
} 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
|
||||
let previousToolbar = previousToolbarValue.swap(toolbar)
|
||||
@ -3823,6 +3830,15 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
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) {
|
||||
self.forEachController({ controller in
|
||||
if let controller = controller as? UndoOverlayController {
|
||||
|
@ -1427,29 +1427,41 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||
}
|
||||
} 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))
|
||||
})
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||
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))
|
||||
controller.purposefulAction = { [weak self] in
|
||||
let proceed: (ChatController) -> Void = { chatController in
|
||||
chatController.purposefulAction = { [weak self] in
|
||||
self?.cancel?()
|
||||
}
|
||||
|
||||
if let navigationController = strongSelf.navigationController, let peerSelectionControllerIndex = navigationController.viewControllers.firstIndex(where: { $0 is PeerSelectionController }) {
|
||||
if let navigationController = strongSelf.navigationController {
|
||||
var viewControllers = navigationController.viewControllers
|
||||
viewControllers.insert(controller, at: peerSelectionControllerIndex)
|
||||
navigationController.setViewControllers(viewControllers, animated: false)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
peerSelectionController?.dismiss()
|
||||
}
|
||||
if threadId != nil {
|
||||
viewControllers.insert(chatController, at: viewControllers.count - 2)
|
||||
} else {
|
||||
strongSelf.navigationController?.pushViewController(controller, animated: false, completion: {
|
||||
if let peerSelectionController = peerSelectionController {
|
||||
peerSelectionController.dismiss()
|
||||
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
|
||||
|
@ -1959,9 +1959,9 @@ public final class ChatListNode: ListView {
|
||||
}
|
||||
self.view.addGestureRecognizer(selectionRecognizer)
|
||||
|
||||
if case .forum = location {
|
||||
self.isSelectionGestureEnabled = false
|
||||
}
|
||||
// if case .forum = location {
|
||||
// self.isSelectionGestureEnabled = false
|
||||
// }
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
@ -109,7 +109,6 @@ public class ItemListActivityTextItemNode: ListViewItemNode {
|
||||
let verticalInset: CGFloat = 7.0
|
||||
|
||||
let titleFont = Font.regular(item.presentationData.fontSize.itemListBaseHeaderFontSize)
|
||||
let titleBoldFont = Font.semibold(item.presentationData.fontSize.itemListBaseHeaderFontSize)
|
||||
|
||||
var activityWidth: CGFloat = 0.0
|
||||
if item.displayActivity {
|
||||
@ -128,7 +127,7 @@ public class ItemListActivityTextItemNode: ListViewItemNode {
|
||||
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)
|
||||
}))
|
||||
|
||||
|
@ -688,7 +688,7 @@ private enum ChannelVisibilityEntry: ItemListNodeEntry {
|
||||
case .taken:
|
||||
textColor = .destructive
|
||||
case .purchaseAvailable:
|
||||
textColor = .warning
|
||||
textColor = .generic
|
||||
}
|
||||
case .checking:
|
||||
textColor = .generic
|
||||
|
@ -219,7 +219,7 @@ private enum UsernameSetupEntry: ItemListNodeEntry {
|
||||
case .available:
|
||||
textColor = .constructive
|
||||
case .purchaseAvailable:
|
||||
textColor = .warning
|
||||
textColor = .generic
|
||||
case .invalid, .taken:
|
||||
textColor = .destructive
|
||||
}
|
||||
|
@ -683,12 +683,16 @@ public final class TelegramMediaFile: Media, Equatable, Codable {
|
||||
}
|
||||
|
||||
public var isMusic: Bool {
|
||||
var hasNonVoiceAudio = false
|
||||
var hasVideo = false
|
||||
for attribute in self.attributes {
|
||||
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 {
|
||||
|
@ -2147,8 +2147,18 @@ 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
|
||||
c.dismiss(completion: {
|
||||
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
|
||||
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).start()
|
||||
} else {
|
||||
let targetLocation: NavigateToChatControllerParams.Location
|
||||
if case let .replyThread(message) = strongSelf.chatLocation {
|
||||
targetLocation = .replyThread(message)
|
||||
} else {
|
||||
targetLocation = .peer(EnginePeer(currentPeer))
|
||||
}
|
||||
|
||||
let currentPeerId = strongSelf.peerId
|
||||
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: {
|
||||
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
|
||||
@ -2171,6 +2181,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
navigationController.setViewControllers(viewControllers, animated: false)
|
||||
}))
|
||||
}
|
||||
}
|
||||
})
|
||||
})))
|
||||
|
||||
@ -2298,6 +2309,9 @@ 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
|
||||
c.dismiss(completion: {
|
||||
if let strongSelf = self, let currentPeer = strongSelf.data?.peer, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||
if let channel = currentPeer as? TelegramChannel, channel.flags.contains(.isForum), let threadId = message.threadId {
|
||||
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: currentPeer.id, threadId: threadId, messageId: message.id, navigationController: navigationController, activateInput: nil, keepStack: .default).start()
|
||||
} else {
|
||||
let targetLocation: NavigateToChatControllerParams.Location
|
||||
if case let .replyThread(message) = strongSelf.chatLocation {
|
||||
targetLocation = .replyThread(message)
|
||||
@ -2329,6 +2343,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
navigationController.setViewControllers(viewControllers, animated: false)
|
||||
}))
|
||||
}
|
||||
}
|
||||
})
|
||||
})))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user