mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge branch 'beta'
This commit is contained in:
commit
ef0bfbd941
@ -188,7 +188,10 @@ public final class AppLockContextImpl: AppLockContext {
|
||||
passcodeController.presentedOverCoveringView = true
|
||||
strongSelf.passcodeController = passcodeController
|
||||
if let rootViewController = strongSelf.rootController {
|
||||
rootViewController.dismiss(animated: false, completion: nil)
|
||||
if let presentedViewController = rootViewController.presentedViewController as? UIActivityViewController {
|
||||
} else {
|
||||
rootViewController.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
}
|
||||
strongSelf.window?.present(passcodeController, on: .passcode)
|
||||
}
|
||||
@ -209,7 +212,10 @@ public final class AppLockContextImpl: AppLockContext {
|
||||
window.coveringView = coveringView
|
||||
|
||||
if let rootViewController = strongSelf.rootController {
|
||||
rootViewController.dismiss(animated: false, completion: nil)
|
||||
if let presentedViewController = rootViewController.presentedViewController as? UIActivityViewController {
|
||||
} else {
|
||||
rootViewController.dismiss(animated: false, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1325,8 +1325,7 @@ public final class ContactListNode: ASDisplayNode {
|
||||
headerInsets.top -= navigationBarSearchContentHeight
|
||||
}
|
||||
|
||||
self.listNode.bounds = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: layout.size.height)
|
||||
self.listNode.position = CGPoint(x: layout.size.width / 2.0, y: layout.size.height / 2.0)
|
||||
transition.updateFrame(node: self.listNode, frame: CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: layout.size.height))
|
||||
|
||||
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
||||
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: layout.size, insets: insets, headerInsets: headerInsets, duration: duration, curve: curve)
|
||||
|
@ -87,6 +87,7 @@ final class NavigationModalContainer: ASDisplayNode, UIScrollViewDelegate, UIGes
|
||||
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
self.scrollNode.view.delaysContentTouches = false
|
||||
self.scrollNode.view.clipsToBounds = false
|
||||
self.scrollNode.view.delegate = self
|
||||
|
||||
let panRecognizer = InteractiveTransitionGestureRecognizer(target: self, action: #selector(self.panGesture(_:)), canBegin: { [weak self] in
|
||||
@ -299,13 +300,18 @@ final class NavigationModalContainer: ASDisplayNode, UIScrollViewDelegate, UIGes
|
||||
transition.updateFrame(node: self.dim, frame: CGRect(origin: CGPoint(), size: layout.size))
|
||||
self.ignoreScrolling = true
|
||||
self.scrollNode.view.isScrollEnabled = (layout.inputHeight == nil || layout.inputHeight == 0.0) && self.isInteractiveDimissEnabled
|
||||
transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(x: self.horizontalDismissOffset ?? 0.0, y: 0.0), size: layout.size))
|
||||
let previousBounds = self.scrollNode.bounds
|
||||
let scrollNodeFrame = CGRect(origin: CGPoint(x: self.horizontalDismissOffset ?? 0.0, y: 0.0), size: layout.size)
|
||||
self.scrollNode.frame = scrollNodeFrame
|
||||
self.scrollNode.view.contentSize = CGSize(width: layout.size.width, height: layout.size.height * 2.0)
|
||||
if !self.scrollNode.view.isDecelerating && !self.scrollNode.view.isDragging {
|
||||
let defaultBounds = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height), size: layout.size)
|
||||
if self.scrollNode.bounds != defaultBounds {
|
||||
self.scrollNode.bounds = defaultBounds
|
||||
}
|
||||
if previousBounds.minY != defaultBounds.minY {
|
||||
transition.animateOffsetAdditive(node: self.scrollNode, offset: previousBounds.minY - defaultBounds.minY)
|
||||
}
|
||||
}
|
||||
self.ignoreScrolling = false
|
||||
|
||||
|
@ -32,6 +32,13 @@ final class ChatAvatarNavigationNode: ASDisplayNode {
|
||||
let avatarNode: AvatarNode
|
||||
|
||||
var contextAction: ((ASDisplayNode, ContextGesture?) -> Void)?
|
||||
var contextActionIsEnabled: Bool = true {
|
||||
didSet {
|
||||
if self.contextActionIsEnabled != oldValue {
|
||||
self.containerNode.isGestureEnabled = self.contextActionIsEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
weak var chatController: ChatControllerImpl? {
|
||||
didSet {
|
||||
|
@ -1872,6 +1872,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if let peer = peerViewMainPeer(peerView) {
|
||||
strongSelf.chatTitleView?.titleContent = .peer(peerView: peerView, onlineMemberCount: onlineMemberCount, isScheduledMessages: isScheduledMessages)
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.avatarNode.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: peer, overrideImage: peer.isDeleted ? .deletedIcon : .none)
|
||||
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
|
||||
}
|
||||
|
||||
if strongSelf.peerView === peerView && strongSelf.reportIrrelvantGeoNotice == peerReportNotice && strongSelf.hasScheduledMessages == hasScheduledMessages {
|
||||
@ -7014,16 +7015,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
])])
|
||||
|
||||
self.present(actionSheet, in: .window(.root))
|
||||
|
||||
/*self.present(peerReportOptionsController(context: self.context, subject: .peer(peer.id), present: { [weak self] c, a in
|
||||
self?.present(c, in: .window(.root))
|
||||
}, completion: { [weak self] success in
|
||||
guard let strongSelf = self, success else {
|
||||
return
|
||||
}
|
||||
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: false).start()
|
||||
(strongSelf.navigationController as? NavigationController)?.filterController(strongSelf, animated: true)
|
||||
}), in: .window(.root))*/
|
||||
} else if let _ = peer as? TelegramUser {
|
||||
let presentationData = self.presentationData
|
||||
let controller = ActionSheetController(presentationData: presentationData)
|
||||
@ -7032,46 +7023,51 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
var reportSpam = true
|
||||
var deleteChat = true
|
||||
controller.setItemGroups([
|
||||
ActionSheetItemGroup(items: [
|
||||
ActionSheetTextItem(title: presentationData.strings.UserInfo_BlockConfirmationTitle(peer.compactDisplayTitle).0),
|
||||
ActionSheetCheckboxItem(title: presentationData.strings.Conversation_Moderate_Report, label: "", value: reportSpam, action: { [weak controller] checkValue in
|
||||
reportSpam = checkValue
|
||||
controller?.updateItem(groupIndex: 0, itemIndex: 1, { item in
|
||||
if let item = item as? ActionSheetCheckboxItem {
|
||||
return ActionSheetCheckboxItem(title: item.title, label: item.label, value: !item.value, action: item.action)
|
||||
}
|
||||
return item
|
||||
})
|
||||
}),
|
||||
ActionSheetCheckboxItem(title: presentationData.strings.ReportSpam_DeleteThisChat, label: "", value: deleteChat, action: { [weak controller] checkValue in
|
||||
deleteChat = checkValue
|
||||
controller?.updateItem(groupIndex: 0, itemIndex: 2, { item in
|
||||
if let item = item as? ActionSheetCheckboxItem {
|
||||
return ActionSheetCheckboxItem(title: item.title, label: item.label, value: !item.value, action: item.action)
|
||||
}
|
||||
return item
|
||||
})
|
||||
}),
|
||||
ActionSheetButtonItem(title: presentationData.strings.UserInfo_BlockActionTitle(peer.compactDisplayTitle).0, color: .destructive, action: { [weak self] in
|
||||
dismissAction()
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
let _ = requestUpdatePeerIsBlocked(account: strongSelf.context.account, peerId: peer.id, isBlocked: true).start()
|
||||
if let _ = chatPeer as? TelegramSecretChat {
|
||||
let _ = (strongSelf.context.account.postbox.transaction { transaction in
|
||||
terminateSecretChat(transaction: transaction, peerId: chatPeer.id)
|
||||
}).start()
|
||||
}
|
||||
if deleteChat {
|
||||
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: reportSpam).start()
|
||||
strongSelf.effectiveNavigationController?.filterController(strongSelf, animated: true)
|
||||
} else if reportSpam {
|
||||
let _ = TelegramCore.reportPeer(account: strongSelf.context.account, peerId: peer.id, reason: .spam).start()
|
||||
var items: [ActionSheetItem] = []
|
||||
if !peer.isDeleted {
|
||||
items.append(ActionSheetTextItem(title: presentationData.strings.UserInfo_BlockConfirmationTitle(peer.compactDisplayTitle).0))
|
||||
}
|
||||
items.append(contentsOf: [
|
||||
ActionSheetCheckboxItem(title: presentationData.strings.Conversation_Moderate_Report, label: "", value: reportSpam, action: { [weak controller] checkValue in
|
||||
reportSpam = checkValue
|
||||
controller?.updateItem(groupIndex: 0, itemIndex: 1, { item in
|
||||
if let item = item as? ActionSheetCheckboxItem {
|
||||
return ActionSheetCheckboxItem(title: item.title, label: item.label, value: !item.value, action: item.action)
|
||||
}
|
||||
return item
|
||||
})
|
||||
]),
|
||||
}),
|
||||
ActionSheetCheckboxItem(title: presentationData.strings.ReportSpam_DeleteThisChat, label: "", value: deleteChat, action: { [weak controller] checkValue in
|
||||
deleteChat = checkValue
|
||||
controller?.updateItem(groupIndex: 0, itemIndex: 2, { item in
|
||||
if let item = item as? ActionSheetCheckboxItem {
|
||||
return ActionSheetCheckboxItem(title: item.title, label: item.label, value: !item.value, action: item.action)
|
||||
}
|
||||
return item
|
||||
})
|
||||
}),
|
||||
ActionSheetButtonItem(title: presentationData.strings.UserInfo_BlockActionTitle(peer.compactDisplayTitle).0, color: .destructive, action: { [weak self] in
|
||||
dismissAction()
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
let _ = requestUpdatePeerIsBlocked(account: strongSelf.context.account, peerId: peer.id, isBlocked: true).start()
|
||||
if let _ = chatPeer as? TelegramSecretChat {
|
||||
let _ = (strongSelf.context.account.postbox.transaction { transaction in
|
||||
terminateSecretChat(transaction: transaction, peerId: chatPeer.id)
|
||||
}).start()
|
||||
}
|
||||
if deleteChat {
|
||||
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: reportSpam).start()
|
||||
strongSelf.effectiveNavigationController?.filterController(strongSelf, animated: true)
|
||||
} else if reportSpam {
|
||||
let _ = TelegramCore.reportPeer(account: strongSelf.context.account, peerId: peer.id, reason: .spam).start()
|
||||
}
|
||||
})
|
||||
] as [ActionSheetItem])
|
||||
|
||||
controller.setItemGroups([
|
||||
ActionSheetItemGroup(items: items),
|
||||
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
||||
])
|
||||
self.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||
|
@ -310,14 +310,14 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
if let statusApply = statusApply {
|
||||
if strongSelf.dateAndStatusNode.supernode == nil {
|
||||
strongSelf.imageNode.addSubnode(strongSelf.dateAndStatusNode)
|
||||
strongSelf.addSubnode(strongSelf.dateAndStatusNode)
|
||||
}
|
||||
var hasAnimation = true
|
||||
if case .None = animation {
|
||||
hasAnimation = false
|
||||
}
|
||||
statusApply(hasAnimation)
|
||||
strongSelf.dateAndStatusNode.frame = statusFrame
|
||||
strongSelf.dateAndStatusNode.frame = statusFrame.offsetBy(dx: imageFrame.minX, dy: imageFrame.minY)
|
||||
} else if strongSelf.dateAndStatusNode.supernode != nil {
|
||||
strongSelf.dateAndStatusNode.removeFromSupernode()
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ private enum ChatReportPeerTitleButton: Equatable {
|
||||
case addContact(String?)
|
||||
case shareMyPhoneNumber
|
||||
case reportSpam
|
||||
case reportUserSpam
|
||||
case reportIrrelevantGeoLocation
|
||||
|
||||
func title(strings: PresentationStrings) -> String {
|
||||
@ -29,6 +30,8 @@ private enum ChatReportPeerTitleButton: Equatable {
|
||||
return strings.Conversation_ShareMyPhoneNumber
|
||||
case .reportSpam:
|
||||
return strings.Conversation_ReportSpamAndLeave
|
||||
case .reportUserSpam:
|
||||
return strings.Conversation_ReportSpam
|
||||
case .reportIrrelevantGeoLocation:
|
||||
return strings.Conversation_ReportGroupLocation
|
||||
}
|
||||
@ -49,6 +52,16 @@ private func peerButtons(_ state: ChatPresentationInterfaceState) -> [ChatReport
|
||||
} else {
|
||||
buttons.append(.addContact(nil))
|
||||
}
|
||||
} else {
|
||||
if peerStatusSettings.contains(.canBlock) || peerStatusSettings.contains(.canReport) {
|
||||
if peer.isDeleted {
|
||||
buttons.append(.reportUserSpam)
|
||||
} else {
|
||||
if !state.peerIsBlocked {
|
||||
buttons.append(.block)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if buttons.isEmpty {
|
||||
if peerStatusSettings.contains(.canShareContact) {
|
||||
@ -134,7 +147,7 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
view.setTitle(button.title(strings: interfaceState.strings), for: [])
|
||||
view.titleLabel?.font = Font.regular(16.0)
|
||||
switch button {
|
||||
case .block, .reportSpam:
|
||||
case .block, .reportSpam, .reportUserSpam:
|
||||
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor, for: [])
|
||||
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor.withAlphaComponent(0.7), for: [.highlighted])
|
||||
default:
|
||||
@ -188,7 +201,7 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
switch button {
|
||||
case .shareMyPhoneNumber:
|
||||
self.interfaceInteraction?.shareAccountContact()
|
||||
case .block, .reportSpam:
|
||||
case .block, .reportSpam, .reportUserSpam:
|
||||
self.interfaceInteraction?.reportPeer()
|
||||
case .addContact:
|
||||
self.interfaceInteraction?.presentPeerContact()
|
||||
|
Loading…
x
Reference in New Issue
Block a user