mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit 'bb28e0e4d354473b3bdab6bf208d0e5c941c46f7'
This commit is contained in:
commit
4c57aa9ff8
@ -6515,3 +6515,8 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"Conversation.InputMenu" = "Menu";
|
"Conversation.InputMenu" = "Menu";
|
||||||
"Conversation.MessageDoesntExist" = "Message doesn't exist";
|
"Conversation.MessageDoesntExist" = "Message doesn't exist";
|
||||||
|
|
||||||
|
"Settings.CheckPasswordTitle" = "Is %@ still your number?";
|
||||||
|
"Settings.CheckPasswordText" = "Your account is protected by 2-Step Verification. Do you still remember your password?";
|
||||||
|
"Settings.KeepPassword" = "Yes, definitely";
|
||||||
|
"Settings.TryEnterPassword" = "Not sure, let me try";
|
||||||
|
@ -170,10 +170,10 @@ public final class ShareInputFieldNode: ASDisplayNode, ASEditableTextNodeDelegat
|
|||||||
@objc public func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
|
@objc public func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
|
||||||
self.updateTextNodeText(animated: true)
|
self.updateTextNodeText(animated: true)
|
||||||
self.updateText?(editableTextNode.attributedText?.string ?? "")
|
self.updateText?(editableTextNode.attributedText?.string ?? "")
|
||||||
|
self.placeholderNode.isHidden = !(editableTextNode.textView.text ?? "").isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
public func editableTextNodeDidBeginEditing(_ editableTextNode: ASEditableTextNode) {
|
public func editableTextNodeDidBeginEditing(_ editableTextNode: ASEditableTextNode) {
|
||||||
self.placeholderNode.isHidden = true
|
|
||||||
self.clearButton.isHidden = false
|
self.clearButton.isHidden = false
|
||||||
|
|
||||||
if self.selectTextOnce {
|
if self.selectTextOnce {
|
||||||
|
@ -4526,9 +4526,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
strongSelf.chatDisplayNode.updatePlainInputSeparatorAlpha(plainInputSeparatorAlpha, transition: .animated(duration: 0.2, curve: .easeInOut))
|
strongSelf.chatDisplayNode.updatePlainInputSeparatorAlpha(plainInputSeparatorAlpha, transition: .animated(duration: 0.2, curve: .easeInOut))
|
||||||
}
|
}
|
||||||
|
|
||||||
self.chatDisplayNode.historyNode.scrolledToIndex = { [weak self] toIndex in
|
self.chatDisplayNode.historyNode.scrolledToIndex = { [weak self] toIndex, initial in
|
||||||
if let strongSelf = self, case let .message(index) = toIndex {
|
if let strongSelf = self, case let .message(index) = toIndex {
|
||||||
if let controllerInteraction = strongSelf.controllerInteraction {
|
if case let .message(messageId, _) = strongSelf.subject, initial, messageId != index.id {
|
||||||
|
strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .info(text: strongSelf.presentationData.strings.Conversation_MessageDoesntExist), elevatedLayout: false, action: { _ in return true }), in: .current)
|
||||||
|
} else if let controllerInteraction = strongSelf.controllerInteraction {
|
||||||
if let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(index.id) {
|
if let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(index.id) {
|
||||||
let highlightedState = ChatInterfaceHighlightedState(messageStableId: message.stableId)
|
let highlightedState = ChatInterfaceHighlightedState(messageStableId: message.stableId)
|
||||||
controllerInteraction.highlightedState = highlightedState
|
controllerInteraction.highlightedState = highlightedState
|
||||||
|
@ -545,7 +545,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
private var maxVisibleMessageIndexReported: MessageIndex?
|
private var maxVisibleMessageIndexReported: MessageIndex?
|
||||||
var maxVisibleMessageIndexUpdated: ((MessageIndex) -> Void)?
|
var maxVisibleMessageIndexUpdated: ((MessageIndex) -> Void)?
|
||||||
|
|
||||||
var scrolledToIndex: ((MessageHistoryAnchorIndex) -> Void)?
|
var scrolledToIndex: ((MessageHistoryAnchorIndex, Bool) -> Void)?
|
||||||
var scrolledToSomeIndex: (() -> Void)?
|
var scrolledToSomeIndex: (() -> Void)?
|
||||||
var beganDragging: (() -> Void)?
|
var beganDragging: (() -> Void)?
|
||||||
|
|
||||||
@ -1887,7 +1887,13 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
|
|
||||||
if let scrolledToIndex = transition.scrolledToIndex {
|
if let scrolledToIndex = transition.scrolledToIndex {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.scrolledToIndex?(scrolledToIndex)
|
let isInitial: Bool
|
||||||
|
if case .Initial = transition.reason {
|
||||||
|
isInitial = true
|
||||||
|
} else {
|
||||||
|
isInitial = false
|
||||||
|
}
|
||||||
|
strongSelf.scrolledToIndex?(scrolledToIndex, isInitial)
|
||||||
}
|
}
|
||||||
} else if transition.scrolledToSomeIndex {
|
} else if transition.scrolledToSomeIndex {
|
||||||
self?.scrolledToSomeIndex?()
|
self?.scrolledToSomeIndex?()
|
||||||
|
@ -264,6 +264,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
private var accessoryItemButtons: [(ChatTextInputAccessoryItem, AccessoryItemIconButtonNode)] = []
|
private var accessoryItemButtons: [(ChatTextInputAccessoryItem, AccessoryItemIconButtonNode)] = []
|
||||||
|
|
||||||
private var validLayout: (CGFloat, CGFloat, CGFloat, UIEdgeInsets, CGFloat, LayoutMetrics, Bool)?
|
private var validLayout: (CGFloat, CGFloat, CGFloat, UIEdgeInsets, CGFloat, LayoutMetrics, Bool)?
|
||||||
|
private var leftMenuInset: CGFloat = 0.0
|
||||||
|
|
||||||
var displayAttachmentMenu: () -> Void = { }
|
var displayAttachmentMenu: () -> Void = { }
|
||||||
var sendMessage: () -> Void = { }
|
var sendMessage: () -> Void = { }
|
||||||
@ -1034,7 +1035,13 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
var menuButtonExpanded = false
|
var menuButtonExpanded = false
|
||||||
if let peer = interfaceState.renderedPeer?.peer as? TelegramUser, let _ = peer.botInfo, interfaceState.hasBotCommands {
|
if let peer = interfaceState.renderedPeer?.peer as? TelegramUser, let _ = peer.botInfo, interfaceState.hasBotCommands {
|
||||||
hasMenuButton = true
|
hasMenuButton = true
|
||||||
if [.none, .inputButtons].contains(interfaceState.inputMode) {
|
|
||||||
|
var inputHasText = false
|
||||||
|
if let textInputNode = self.textInputNode, let attributedText = textInputNode.attributedText, attributedText.length != 0 {
|
||||||
|
inputHasText = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if [.none, .inputButtons].contains(interfaceState.inputMode) && !inputHasText {
|
||||||
menuButtonExpanded = true
|
menuButtonExpanded = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1055,6 +1062,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
} else {
|
} else {
|
||||||
leftMenuInset = 0.0
|
leftMenuInset = 0.0
|
||||||
}
|
}
|
||||||
|
self.leftMenuInset = leftMenuInset
|
||||||
|
|
||||||
let baseWidth = width - leftInset - leftMenuInset - rightInset
|
let baseWidth = width - leftInset - leftMenuInset - rightInset
|
||||||
let (accessoryButtonsWidth, textFieldHeight) = self.calculateTextFieldMetrics(width: baseWidth, maxHeight: maxHeight, metrics: metrics)
|
let (accessoryButtonsWidth, textFieldHeight) = self.calculateTextFieldMetrics(width: baseWidth, maxHeight: maxHeight, metrics: metrics)
|
||||||
@ -1664,7 +1672,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
composeButtonsOffset = 44.0
|
composeButtonsOffset = 44.0
|
||||||
}
|
}
|
||||||
|
|
||||||
let (_, textFieldHeight) = self.calculateTextFieldMetrics(width: width - leftInset - rightInset, maxHeight: maxHeight, metrics: metrics)
|
let (_, textFieldHeight) = self.calculateTextFieldMetrics(width: width - leftInset - rightInset - self.leftMenuInset, maxHeight: maxHeight, metrics: metrics)
|
||||||
let panelHeight = self.panelHeight(textFieldHeight: textFieldHeight, metrics: metrics)
|
let panelHeight = self.panelHeight(textFieldHeight: textFieldHeight, metrics: metrics)
|
||||||
var textFieldMinHeight: CGFloat = 33.0
|
var textFieldMinHeight: CGFloat = 33.0
|
||||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||||
@ -1851,7 +1859,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
|
|
||||||
private func updateTextHeight(animated: Bool) {
|
private func updateTextHeight(animated: Bool) {
|
||||||
if let (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, _) = self.validLayout {
|
if let (width, leftInset, rightInset, additionalSideInsets, maxHeight, metrics, _) = self.validLayout {
|
||||||
let (_, textFieldHeight) = self.calculateTextFieldMetrics(width: width - leftInset - rightInset - additionalSideInsets.right, maxHeight: maxHeight, metrics: metrics)
|
let (_, textFieldHeight) = self.calculateTextFieldMetrics(width: width - leftInset - rightInset - additionalSideInsets.right - self.leftMenuInset, maxHeight: maxHeight, metrics: metrics)
|
||||||
let panelHeight = self.panelHeight(textFieldHeight: textFieldHeight, metrics: metrics)
|
let panelHeight = self.panelHeight(textFieldHeight: textFieldHeight, metrics: metrics)
|
||||||
if !self.bounds.size.height.isEqual(to: panelHeight) {
|
if !self.bounds.size.height.isEqual(to: panelHeight) {
|
||||||
self.updateHeight(animated)
|
self.updateHeight(animated)
|
||||||
|
@ -481,7 +481,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
|||||||
}
|
}
|
||||||
case .importStickers:
|
case .importStickers:
|
||||||
dismissInput()
|
dismissInput()
|
||||||
if let navigationController = navigationController, let data = UIPasteboard.general.data(forPasteboardType: "org.telegram.third-party.stickerpack"), let stickerPack = ImportStickerPack(data: data), !stickerPack.stickers.isEmpty {
|
if let navigationController = navigationController, let data = UIPasteboard.general.data(forPasteboardType: "org.telegram.third-party.stickerset"), let stickerPack = ImportStickerPack(data: data), !stickerPack.stickers.isEmpty {
|
||||||
for controller in navigationController.overlayControllers {
|
for controller in navigationController.overlayControllers {
|
||||||
if controller is ImportStickerPackController {
|
if controller is ImportStickerPackController {
|
||||||
controller.dismiss()
|
controller.dismiss()
|
||||||
|
@ -112,6 +112,7 @@ final class PeerInfoState {
|
|||||||
|
|
||||||
final class TelegramGlobalSettings {
|
final class TelegramGlobalSettings {
|
||||||
let suggestPhoneNumberConfirmation: Bool
|
let suggestPhoneNumberConfirmation: Bool
|
||||||
|
let suggestPasswordConfirmation: Bool
|
||||||
let accountsAndPeers: [(Account, Peer, Int32)]
|
let accountsAndPeers: [(Account, Peer, Int32)]
|
||||||
let activeSessionsContext: ActiveSessionsContext?
|
let activeSessionsContext: ActiveSessionsContext?
|
||||||
let webSessionsContext: WebSessionsContext?
|
let webSessionsContext: WebSessionsContext?
|
||||||
@ -130,6 +131,7 @@ final class TelegramGlobalSettings {
|
|||||||
|
|
||||||
init(
|
init(
|
||||||
suggestPhoneNumberConfirmation: Bool,
|
suggestPhoneNumberConfirmation: Bool,
|
||||||
|
suggestPasswordConfirmation: Bool,
|
||||||
accountsAndPeers: [(Account, Peer, Int32)],
|
accountsAndPeers: [(Account, Peer, Int32)],
|
||||||
activeSessionsContext: ActiveSessionsContext?,
|
activeSessionsContext: ActiveSessionsContext?,
|
||||||
webSessionsContext: WebSessionsContext?,
|
webSessionsContext: WebSessionsContext?,
|
||||||
@ -147,6 +149,7 @@ final class TelegramGlobalSettings {
|
|||||||
enableQRLogin: Bool
|
enableQRLogin: Bool
|
||||||
) {
|
) {
|
||||||
self.suggestPhoneNumberConfirmation = suggestPhoneNumberConfirmation
|
self.suggestPhoneNumberConfirmation = suggestPhoneNumberConfirmation
|
||||||
|
self.suggestPasswordConfirmation = suggestPasswordConfirmation
|
||||||
self.accountsAndPeers = accountsAndPeers
|
self.accountsAndPeers = accountsAndPeers
|
||||||
self.activeSessionsContext = activeSessionsContext
|
self.activeSessionsContext = activeSessionsContext
|
||||||
self.webSessionsContext = webSessionsContext
|
self.webSessionsContext = webSessionsContext
|
||||||
@ -417,7 +420,7 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: PeerId, account
|
|||||||
enableQRLogin = true
|
enableQRLogin = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let globalSettings = TelegramGlobalSettings(suggestPhoneNumberConfirmation: suggestions.contains(.validatePhoneNumber), accountsAndPeers: accountsAndPeers, activeSessionsContext: accountSessions?.0, webSessionsContext: accountSessions?.2, otherSessionsCount: accountSessions?.1, proxySettings: proxySettings, notificationAuthorizationStatus: notificationsAuthorizationStatus, notificationWarningSuppressed: notificationsWarningSuppressed, notificationExceptions: notificationExceptions, inAppNotificationSettings: inAppNotificationSettings, privacySettings: privacySettings, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedStickerPacks: archivedStickerPacks, hasPassport: hasPassport, hasWatchApp: hasWatchApp, enableQRLogin: enableQRLogin)
|
let globalSettings = TelegramGlobalSettings(suggestPhoneNumberConfirmation: suggestions.contains(.validatePhoneNumber), suggestPasswordConfirmation: suggestions.contains(.validatePassword), accountsAndPeers: accountsAndPeers, activeSessionsContext: accountSessions?.0, webSessionsContext: accountSessions?.2, otherSessionsCount: accountSessions?.1, proxySettings: proxySettings, notificationAuthorizationStatus: notificationsAuthorizationStatus, notificationWarningSuppressed: notificationsWarningSuppressed, notificationExceptions: notificationExceptions, inAppNotificationSettings: inAppNotificationSettings, privacySettings: privacySettings, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedStickerPacks: archivedStickerPacks, hasPassport: hasPassport, hasWatchApp: hasWatchApp, enableQRLogin: enableQRLogin)
|
||||||
|
|
||||||
return PeerInfoScreenData(
|
return PeerInfoScreenData(
|
||||||
peer: peerView.peers[peerId],
|
peer: peerView.peers[peerId],
|
||||||
|
@ -707,6 +707,8 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
|
|||||||
items[.phone]!.append(PeerInfoScreenActionItem(id: 2, text: presentationData.strings.Settings_ChangePhoneNumber, action: {
|
items[.phone]!.append(PeerInfoScreenActionItem(id: 2, text: presentationData.strings.Settings_ChangePhoneNumber, action: {
|
||||||
interaction.openSettings(.phoneNumber)
|
interaction.openSettings(.phoneNumber)
|
||||||
}))
|
}))
|
||||||
|
} else if settings.suggestPasswordConfirmation {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !settings.accountsAndPeers.isEmpty {
|
if !settings.accountsAndPeers.isEmpty {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user