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
0ba39ad01e
commit
dea2cc2a7d
@ -8316,3 +8316,4 @@ Sorry for the inconvenience.";
|
||||
"ChatList.EmptyTopicsDescription" = "Older messages from this group have been moved to \"General\".";
|
||||
|
||||
"Stickers.EmojiPackInfoText" = "This message contains **%@** emoji.";
|
||||
"PeerInfo.TopicIconInfoText" = "This topic's icon is from **%@**.";
|
||||
|
@ -191,7 +191,7 @@ private let phonebookUsernamePrefix = "https://t.me/" + phonebookUsernamePathPre
|
||||
|
||||
public extension DeviceContactUrlData {
|
||||
convenience init(appProfile: PeerId) {
|
||||
self.init(label: "Telegram", value: "\(phonebookUsernamePrefix)\(appProfile.id)")
|
||||
self.init(label: "Telegram", value: "\(phonebookUsernamePrefix)\(appProfile.id._internalGetInt64Value())")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2298,7 +2298,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
isClosed = threadInfo.isClosed
|
||||
}
|
||||
if let threadInfo, threadInfo.id == 1 {
|
||||
peerRevealOptions = forumGeneralRevealOptions(strings: item.presentationData.strings, theme: item.presentationData.theme, isMuted: (currentMutedIconImage != nil), isClosed: isClosed, isEditing: item.editing, canOpenClose: canOpenClose, canHide: channel.flags.contains(.isCreator) || channel.hasPermission(.pinMessages), hiddenByDefault: threadInfo.isHidden)
|
||||
peerRevealOptions = forumGeneralRevealOptions(strings: item.presentationData.strings, theme: item.presentationData.theme, isMuted: (currentMutedIconImage != nil), isClosed: isClosed, isEditing: item.editing, canOpenClose: canOpenClose, canHide: channel.flags.contains(.isCreator) || channel.hasPermission(.manageTopics), hiddenByDefault: threadInfo.isHidden)
|
||||
} else {
|
||||
peerRevealOptions = forumThreadRevealOptions(strings: item.presentationData.strings, theme: item.presentationData.theme, isMuted: (currentMutedIconImage != nil), isClosed: isClosed, isEditing: item.editing, canOpenClose: canOpenClose, canDelete: canDelete)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
|
||||
func isViewVisibleInHierarchy(_ view: UIView, _ initial: Bool = true) -> Bool {
|
||||
public func isViewVisibleInHierarchy(_ view: UIView, _ initial: Bool = true) -> Bool {
|
||||
guard let window = view.window else {
|
||||
return false
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ private func messagesShouldBeMerged(accountPeerId: PeerId, _ lhs: Message, _ rhs
|
||||
}
|
||||
|
||||
var sameThread = true
|
||||
if lhs.threadId != rhs.threadId {
|
||||
if let lhsPeer = lhs.peers[lhs.id.peerId], let rhsPeer = rhs.peers[rhs.id.peerId], arePeersEqual(lhsPeer, rhsPeer), let channel = lhsPeer as? TelegramChannel, channel.flags.contains(.isForum), lhs.threadId != rhs.threadId {
|
||||
sameThread = false
|
||||
}
|
||||
|
||||
|
@ -97,15 +97,15 @@ private final class ChatTextInputMediaRecordingButtonPresenterControllerNode: Vi
|
||||
}
|
||||
|
||||
private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGModernConversationInputMicButtonPresentation {
|
||||
private let account: Account?
|
||||
private let statusBarHost: StatusBarHost?
|
||||
private let presentController: (ViewController) -> Void
|
||||
let container: ChatTextInputMediaRecordingButtonPresenterContainer
|
||||
private var presentationController: ChatTextInputMediaRecordingButtonPresenterController?
|
||||
private var timer: SwiftSignalKit.Timer?
|
||||
fileprivate weak var button: ChatTextInputMediaRecordingButton?
|
||||
|
||||
init(account: Account, presentController: @escaping (ViewController) -> Void) {
|
||||
self.account = account
|
||||
init(statusBarHost: StatusBarHost?, presentController: @escaping (ViewController) -> Void) {
|
||||
self.statusBarHost = statusBarHost
|
||||
self.presentController = presentController
|
||||
self.container = ChatTextInputMediaRecordingButtonPresenterContainer()
|
||||
}
|
||||
@ -128,11 +128,19 @@ private final class ChatTextInputMediaRecordingButtonPresenter : NSObject, TGMod
|
||||
}
|
||||
|
||||
func present() {
|
||||
if let keyboardWindow = LegacyComponentsGlobals.provider().applicationKeyboardWindow(), !keyboardWindow.isHidden {
|
||||
let windowIsVisible: (UIWindow) -> Bool = { window in
|
||||
print(window.alpha)
|
||||
print(window.isHidden)
|
||||
print(window.frame)
|
||||
print(window.subviews)
|
||||
return !window.frame.height.isZero
|
||||
}
|
||||
|
||||
if let statusBarHost = self.statusBarHost, let keyboardWindow = statusBarHost.keyboardWindow, let keyboardView = statusBarHost.keyboardView, !keyboardView.frame.height.isZero, isViewVisibleInHierarchy(keyboardView) {
|
||||
keyboardWindow.addSubview(self.container)
|
||||
|
||||
self.timer = SwiftSignalKit.Timer(timeout: 0.05, repeat: true, completion: { [weak self] in
|
||||
if let keyboardWindow = LegacyComponentsGlobals.provider().applicationKeyboardWindow(), !keyboardWindow.isHidden {
|
||||
if let keyboardWindow = LegacyComponentsGlobals.provider().applicationKeyboardWindow(), windowIsVisible(keyboardWindow) {
|
||||
} else {
|
||||
self?.present()
|
||||
}
|
||||
@ -174,7 +182,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
|
||||
private let strings: PresentationStrings
|
||||
|
||||
var mode: ChatTextInputMediaRecordingButtonMode = .audio
|
||||
var account: Account?
|
||||
var statusBarHost: StatusBarHost?
|
||||
let presentController: (ViewController) -> Void
|
||||
var recordingDisabled: () -> Void = { }
|
||||
var beginRecording: () -> Void = { }
|
||||
@ -473,7 +481,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
|
||||
}
|
||||
|
||||
func micButtonPresenter() -> TGModernConversationInputMicButtonPresentation! {
|
||||
let presenter = ChatTextInputMediaRecordingButtonPresenter(account: self.account!, presentController: self.presentController)
|
||||
let presenter = ChatTextInputMediaRecordingButtonPresenter(statusBarHost: self.statusBarHost, presentController: self.presentController)
|
||||
presenter.button = self
|
||||
self.currentPresenter = presenter.view()
|
||||
return presenter
|
||||
|
@ -613,7 +613,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
|
||||
override var context: AccountContext? {
|
||||
didSet {
|
||||
self.actionButtons.micButton.account = self.context?.account
|
||||
self.actionButtons.micButton.statusBarHost = self.context?.sharedContext.mainWindow?.statusBarHost
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3451,9 +3451,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
guard let strongSelf = self, let threadData = strongSelf.data?.threadData else {
|
||||
return
|
||||
}
|
||||
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: strongSelf.context.currentAppConfiguration.with { $0 })
|
||||
guard !premiumConfiguration.isPremiumDisabled else {
|
||||
return
|
||||
}
|
||||
|
||||
if let icon = threadData.info.icon, icon != 0 {
|
||||
let _ = (strongSelf.context.engine.stickers.resolveInlineStickers(fileIds: [icon])
|
||||
|> deliverOnMainQueue).start(next: { [weak self] files in
|
||||
|> deliverOnMainQueue).start(next: { [weak self] files in
|
||||
if let file = files.first?.value {
|
||||
var stickerPackReference: StickerPackReference?
|
||||
for attribute in file.attributes {
|
||||
@ -3467,7 +3473,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
let _ = (strongSelf.context.engine.stickers.loadedStickerPack(reference: stickerPackReference, forceActualized: false)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] stickerPack in
|
||||
if let strongSelf = self, case let .result(info, _, _) = stickerPack {
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .sticker(context: strongSelf.context, file: file, title: nil, text: strongSelf.presentationData.strings.Stickers_EmojiPackInfoText(info.title).string, undoText: strongSelf.presentationData.strings.Stickers_PremiumPackView, customAction: nil), elevatedLayout: false, action: { [weak self] action in
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .sticker(context: strongSelf.context, file: file, title: nil, text: strongSelf.presentationData.strings.PeerInfo_TopicIconInfoText(info.title).string, undoText: strongSelf.presentationData.strings.Stickers_PremiumPackView, customAction: nil), elevatedLayout: false, action: { [weak self] action in
|
||||
if let strongSelf = self, action == .undo {
|
||||
strongSelf.presentEmojiList(packReference: stickerPackReference)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user