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
ac19cc508b
commit
b8382386c2
@ -11669,3 +11669,5 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"Business.Links" = "Links to Chat";
|
"Business.Links" = "Links to Chat";
|
||||||
"Business.LinksInfo" = "Create links that start a chat with you, suggesting the first message.";
|
"Business.LinksInfo" = "Create links that start a chat with you, suggesting the first message.";
|
||||||
|
|
||||||
|
"Settings.About.PrivacyHelp" = "You can add a few lines about yourself. Choose who can see your bio in [Settings]().";
|
||||||
|
@ -952,6 +952,7 @@ public protocol SharedAccountContext: AnyObject {
|
|||||||
func makeCreateGroupController(context: AccountContext, peerIds: [PeerId], initialTitle: String?, mode: CreateGroupMode, completion: ((PeerId, @escaping () -> Void) -> Void)?) -> ViewController
|
func makeCreateGroupController(context: AccountContext, peerIds: [PeerId], initialTitle: String?, mode: CreateGroupMode, completion: ((PeerId, @escaping () -> Void) -> Void)?) -> ViewController
|
||||||
func makeChatRecentActionsController(context: AccountContext, peer: Peer, adminPeerId: PeerId?) -> ViewController
|
func makeChatRecentActionsController(context: AccountContext, peer: Peer, adminPeerId: PeerId?) -> ViewController
|
||||||
func makePrivacyAndSecurityController(context: AccountContext) -> ViewController
|
func makePrivacyAndSecurityController(context: AccountContext) -> ViewController
|
||||||
|
func makeBioPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, present: @escaping (ViewController) -> Void)
|
||||||
func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void)
|
func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void)
|
||||||
func makeSetupTwoFactorAuthController(context: AccountContext) -> ViewController
|
func makeSetupTwoFactorAuthController(context: AccountContext) -> ViewController
|
||||||
func makeStorageManagementController(context: AccountContext) -> ViewController
|
func makeStorageManagementController(context: AccountContext) -> ViewController
|
||||||
|
@ -724,7 +724,7 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
|
|||||||
hideChatListContacts(context: context)
|
hideChatListContacts(context: context)
|
||||||
} : nil), directionHint: entry.directionHint)
|
} : nil), directionHint: entry.directionHint)
|
||||||
case let .Notice(presentationData, notice):
|
case let .Notice(presentationData, notice):
|
||||||
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListStorageInfoItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
|
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListNoticeItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
|
||||||
switch action {
|
switch action {
|
||||||
case .activate:
|
case .activate:
|
||||||
switch notice {
|
switch notice {
|
||||||
@ -1060,7 +1060,7 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
|
|||||||
hideChatListContacts(context: context)
|
hideChatListContacts(context: context)
|
||||||
} : nil), directionHint: entry.directionHint)
|
} : nil), directionHint: entry.directionHint)
|
||||||
case let .Notice(presentationData, notice):
|
case let .Notice(presentationData, notice):
|
||||||
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListStorageInfoItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
|
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListNoticeItem(context: context, theme: presentationData.theme, strings: presentationData.strings, notice: notice, action: { [weak nodeInteraction] action in
|
||||||
switch action {
|
switch action {
|
||||||
case .activate:
|
case .activate:
|
||||||
switch notice {
|
switch notice {
|
||||||
|
@ -12,7 +12,7 @@ import Markdown
|
|||||||
import AccountContext
|
import AccountContext
|
||||||
import MergedAvatarsNode
|
import MergedAvatarsNode
|
||||||
|
|
||||||
class ChatListStorageInfoItem: ListViewItem {
|
class ChatListNoticeItem: ListViewItem {
|
||||||
enum Action {
|
enum Action {
|
||||||
case activate
|
case activate
|
||||||
case hide
|
case hide
|
||||||
@ -43,7 +43,7 @@ class ChatListStorageInfoItem: ListViewItem {
|
|||||||
|
|
||||||
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
||||||
async {
|
async {
|
||||||
let node = ChatListStorageInfoItemNode()
|
let node = ChatListNoticeItemNode()
|
||||||
|
|
||||||
let (nodeLayout, apply) = node.asyncLayout()(self, params, false)
|
let (nodeLayout, apply) = node.asyncLayout()(self, params, false)
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ class ChatListStorageInfoItem: ListViewItem {
|
|||||||
|
|
||||||
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||||
Queue.mainQueue().async {
|
Queue.mainQueue().async {
|
||||||
assert(node() is ChatListStorageInfoItemNode)
|
assert(node() is ChatListNoticeItemNode)
|
||||||
if let nodeValue = node() as? ChatListStorageInfoItemNode {
|
if let nodeValue = node() as? ChatListNoticeItemNode {
|
||||||
|
|
||||||
let layout = nodeValue.asyncLayout()
|
let layout = nodeValue.asyncLayout()
|
||||||
async {
|
async {
|
||||||
@ -84,7 +84,7 @@ private let separatorHeight = 1.0 / UIScreen.main.scale
|
|||||||
private let titleFont = Font.semibold(15.0)
|
private let titleFont = Font.semibold(15.0)
|
||||||
private let textFont = Font.regular(15.0)
|
private let textFont = Font.regular(15.0)
|
||||||
|
|
||||||
class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
|
||||||
private let contentContainer: ASDisplayNode
|
private let contentContainer: ASDisplayNode
|
||||||
private let titleNode: TextNode
|
private let titleNode: TextNode
|
||||||
private let textNode: TextNode
|
private let textNode: TextNode
|
||||||
@ -100,7 +100,7 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
|||||||
private var okButton: HighlightableButtonNode?
|
private var okButton: HighlightableButtonNode?
|
||||||
private var cancelButton: HighlightableButtonNode?
|
private var cancelButton: HighlightableButtonNode?
|
||||||
|
|
||||||
private var item: ChatListStorageInfoItem?
|
private var item: ChatListNoticeItem?
|
||||||
|
|
||||||
override var apparentHeight: CGFloat {
|
override var apparentHeight: CGFloat {
|
||||||
didSet {
|
didSet {
|
||||||
@ -145,11 +145,11 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
|
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
|
||||||
let layout = self.asyncLayout()
|
let layout = self.asyncLayout()
|
||||||
let (_, apply) = layout(item as! ChatListStorageInfoItem, params, nextItem == nil)
|
let (_, apply) = layout(item as! ChatListNoticeItem, params, nextItem == nil)
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
func asyncLayout() -> (_ item: ChatListStorageInfoItem, _ params: ListViewItemLayoutParams, _ isLast: Bool) -> (ListViewItemNodeLayout, () -> Void) {
|
func asyncLayout() -> (_ item: ChatListNoticeItem, _ params: ListViewItemLayoutParams, _ isLast: Bool) -> (ListViewItemNodeLayout, () -> Void) {
|
||||||
let previousItem = self.item
|
let previousItem = self.item
|
||||||
|
|
||||||
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
||||||
@ -321,9 +321,19 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if let image = strongSelf.arrowNode.image {
|
if let image = strongSelf.arrowNode.image {
|
||||||
strongSelf.arrowNode.frame = CGRect(origin: CGPoint(x: layout.size.width - sideInset - image.size.width + 8.0, y: floor((layout.size.height - image.size.height) / 2.0)), size: image.size)
|
strongSelf.arrowNode.frame = CGRect(origin: CGPoint(x: layout.size.width - sideInset - image.size.width + 8.0, y: floor((layout.size.height - image.size.height) / 2.0)), size: image.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasCloseButton = false
|
||||||
|
if case .xmasPremiumGift = item.notice {
|
||||||
|
hasCloseButton = true
|
||||||
|
} else if case .setupBirthday = item.notice {
|
||||||
|
hasCloseButton = true
|
||||||
|
} else if case .birthdayPremiumGift = item.notice {
|
||||||
|
hasCloseButton = true
|
||||||
|
}
|
||||||
|
|
||||||
if let okButtonLayout, let cancelButtonLayout {
|
if let okButtonLayout, let cancelButtonLayout {
|
||||||
strongSelf.arrowNode.isHidden = true
|
strongSelf.arrowNode.isHidden = true
|
||||||
|
strongSelf.closeButton?.isHidden = true
|
||||||
|
|
||||||
let okButton: HighlightableButtonNode
|
let okButton: HighlightableButtonNode
|
||||||
if let current = strongSelf.okButton {
|
if let current = strongSelf.okButton {
|
||||||
@ -372,7 +382,7 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
|||||||
okButtonText.frame = CGRect(origin: CGPoint(x: floor((okButtonFrame.width - okButtonLayout.0.size.width) * 0.5), y: floor((okButtonFrame.height - okButtonLayout.0.size.height) * 0.5)), size: okButtonLayout.0.size)
|
okButtonText.frame = CGRect(origin: CGPoint(x: floor((okButtonFrame.width - okButtonLayout.0.size.width) * 0.5), y: floor((okButtonFrame.height - okButtonLayout.0.size.height) * 0.5)), size: okButtonLayout.0.size)
|
||||||
cancelButtonText.frame = CGRect(origin: CGPoint(x: floor((cancelButtonFrame.width - cancelButtonLayout.0.size.width) * 0.5), y: floor((cancelButtonFrame.height - cancelButtonLayout.0.size.height) * 0.5)), size: cancelButtonLayout.0.size)
|
cancelButtonText.frame = CGRect(origin: CGPoint(x: floor((cancelButtonFrame.width - cancelButtonLayout.0.size.width) * 0.5), y: floor((cancelButtonFrame.height - cancelButtonLayout.0.size.height) * 0.5)), size: cancelButtonLayout.0.size)
|
||||||
} else {
|
} else {
|
||||||
strongSelf.arrowNode.isHidden = false
|
strongSelf.arrowNode.isHidden = hasCloseButton
|
||||||
|
|
||||||
if let okButton = strongSelf.okButton {
|
if let okButton = strongSelf.okButton {
|
||||||
strongSelf.okButton = nil
|
strongSelf.okButton = nil
|
||||||
@ -390,40 +400,29 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
|||||||
strongSelf.cancelButtonText = nil
|
strongSelf.cancelButtonText = nil
|
||||||
cancelButtonText.removeFromSupernode()
|
cancelButtonText.removeFromSupernode()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let arrowIsHidden = strongSelf.arrowNode.isHidden
|
|
||||||
var hasCloseButton = false
|
|
||||||
if case .xmasPremiumGift = item.notice {
|
|
||||||
hasCloseButton = true
|
|
||||||
} else if case .setupBirthday = item.notice {
|
|
||||||
hasCloseButton = true
|
|
||||||
} else if case .birthdayPremiumGift = item.notice {
|
|
||||||
hasCloseButton = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if hasCloseButton {
|
|
||||||
strongSelf.arrowNode.isHidden = true
|
|
||||||
|
|
||||||
let closeButton: HighlightableButtonNode
|
if hasCloseButton {
|
||||||
if let current = strongSelf.closeButton {
|
let closeButton: HighlightableButtonNode
|
||||||
closeButton = current
|
if let current = strongSelf.closeButton {
|
||||||
|
closeButton = current
|
||||||
|
} else {
|
||||||
|
closeButton = HighlightableButtonNode()
|
||||||
|
closeButton.hitTestSlop = UIEdgeInsets(top: -8.0, left: -8.0, bottom: -8.0, right: -8.0)
|
||||||
|
closeButton.addTarget(self, action: #selector(strongSelf.closePressed), forControlEvents: [.touchUpInside])
|
||||||
|
strongSelf.contentContainer.addSubnode(closeButton)
|
||||||
|
strongSelf.closeButton = closeButton
|
||||||
|
}
|
||||||
|
|
||||||
|
if themeUpdated {
|
||||||
|
closeButton.setImage(PresentationResourcesItemList.itemListCloseIconImage(item.theme), for: .normal)
|
||||||
|
}
|
||||||
|
|
||||||
|
let closeButtonSize = closeButton.measure(CGSize(width: 100.0, height: 100.0))
|
||||||
|
closeButton.frame = CGRect(origin: CGPoint(x: layout.size.width - sideInset - closeButtonSize.width, y: floor((layout.size.height - closeButtonSize.height) / 2.0)), size: closeButtonSize)
|
||||||
} else {
|
} else {
|
||||||
closeButton = HighlightableButtonNode()
|
strongSelf.closeButton?.removeFromSupernode()
|
||||||
closeButton.hitTestSlop = UIEdgeInsets(top: -8.0, left: -8.0, bottom: -8.0, right: -8.0)
|
strongSelf.closeButton = nil
|
||||||
closeButton.addTarget(self, action: #selector(strongSelf.closePressed), forControlEvents: [.touchUpInside])
|
|
||||||
strongSelf.contentContainer.addSubnode(closeButton)
|
|
||||||
strongSelf.closeButton = closeButton
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if themeUpdated {
|
|
||||||
closeButton.setImage(PresentationResourcesItemList.itemListCloseIconImage(item.theme), for: .normal)
|
|
||||||
}
|
|
||||||
|
|
||||||
let closeButtonSize = closeButton.measure(CGSize(width: 100.0, height: 100.0))
|
|
||||||
closeButton.frame = CGRect(origin: CGPoint(x: layout.size.width - sideInset - closeButtonSize.width, y: floor((layout.size.height - closeButtonSize.height) / 2.0)), size: closeButtonSize)
|
|
||||||
} else {
|
|
||||||
strongSelf.arrowNode.isHidden = arrowIsHidden
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.contentSize = layout.contentSize
|
strongSelf.contentSize = layout.contentSize
|
@ -97,9 +97,6 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
private let angleLayer = SimpleShapeLayer()
|
private let angleLayer = SimpleShapeLayer()
|
||||||
private let bin = ComponentView<Empty>()
|
private let bin = ComponentView<Empty>()
|
||||||
|
|
||||||
private let stickerOverlayLayer = SimpleShapeLayer()
|
|
||||||
private let stickerFrameLayer = SimpleShapeLayer()
|
|
||||||
|
|
||||||
public var onInteractionUpdated: (Bool) -> Void = { _ in }
|
public var onInteractionUpdated: (Bool) -> Void = { _ in }
|
||||||
public var edgePreviewUpdated: (Bool) -> Void = { _ in }
|
public var edgePreviewUpdated: (Bool) -> Void = { _ in }
|
||||||
|
|
||||||
@ -145,13 +142,6 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
self.angleLayer.opacity = 0.0
|
self.angleLayer.opacity = 0.0
|
||||||
self.angleLayer.lineDashPattern = [12, 12] as [NSNumber]
|
self.angleLayer.lineDashPattern = [12, 12] as [NSNumber]
|
||||||
|
|
||||||
self.stickerOverlayLayer.fillColor = UIColor(rgb: 0x000000, alpha: 0.7).cgColor
|
|
||||||
|
|
||||||
self.stickerFrameLayer.fillColor = UIColor.clear.cgColor
|
|
||||||
self.stickerFrameLayer.strokeColor = UIColor(rgb: 0xffffff, alpha: 0.55).cgColor
|
|
||||||
self.stickerFrameLayer.lineDashPattern = [24, 24] as [NSNumber]
|
|
||||||
self.stickerFrameLayer.lineCap = .round
|
|
||||||
|
|
||||||
self.addSubview(self.topEdgeView)
|
self.addSubview(self.topEdgeView)
|
||||||
self.addSubview(self.leftEdgeView)
|
self.addSubview(self.leftEdgeView)
|
||||||
self.addSubview(self.rightEdgeView)
|
self.addSubview(self.rightEdgeView)
|
||||||
@ -160,25 +150,12 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
self.addSubview(self.xAxisView)
|
self.addSubview(self.xAxisView)
|
||||||
self.addSubview(self.yAxisView)
|
self.addSubview(self.yAxisView)
|
||||||
self.layer.addSublayer(self.angleLayer)
|
self.layer.addSublayer(self.angleLayer)
|
||||||
|
|
||||||
if isStickerEditor {
|
|
||||||
self.layer.addSublayer(self.stickerOverlayLayer)
|
|
||||||
self.layer.addSublayer(self.stickerFrameLayer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func addSubview(_ view: UIView) {
|
|
||||||
super.addSubview(view)
|
|
||||||
if self.stickerOverlayLayer.superlayer != nil, view is DrawingEntityView {
|
|
||||||
self.layer.addSublayer(self.stickerOverlayLayer)
|
|
||||||
self.layer.addSublayer(self.stickerFrameLayer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func layoutSubviews() {
|
public override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
@ -214,25 +191,6 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
self.angleLayer.path = anglePath
|
self.angleLayer.path = anglePath
|
||||||
self.angleLayer.lineWidth = width
|
self.angleLayer.lineWidth = width
|
||||||
self.angleLayer.bounds = CGRect(origin: .zero, size: CGSize(width: 3000.0, height: width))
|
self.angleLayer.bounds = CGRect(origin: .zero, size: CGSize(width: 3000.0, height: width))
|
||||||
|
|
||||||
let frameWidth = floor(self.bounds.width * 0.97)
|
|
||||||
let frameRect = CGRect(origin: CGPoint(x: floor((self.bounds.width - frameWidth) / 2.0), y: floor((self.bounds.height - frameWidth) / 2.0)), size: CGSize(width: frameWidth, height: frameWidth))
|
|
||||||
|
|
||||||
self.stickerOverlayLayer.frame = self.bounds
|
|
||||||
|
|
||||||
let overlayOuterRect = UIBezierPath(rect: self.bounds)
|
|
||||||
let overlayInnerRect = UIBezierPath(cgPath: CGPath(roundedRect: frameRect, cornerWidth: frameWidth / 8.0, cornerHeight: frameWidth / 8.0, transform: nil))
|
|
||||||
let overlayLineWidth: CGFloat = 2.0 * 2.2
|
|
||||||
|
|
||||||
overlayOuterRect.append(overlayInnerRect)
|
|
||||||
overlayOuterRect.usesEvenOddFillRule = true
|
|
||||||
|
|
||||||
self.stickerOverlayLayer.path = overlayOuterRect.cgPath
|
|
||||||
self.stickerOverlayLayer.fillRule = .evenOdd
|
|
||||||
|
|
||||||
self.stickerFrameLayer.frame = self.bounds
|
|
||||||
self.stickerFrameLayer.lineWidth = overlayLineWidth
|
|
||||||
self.stickerFrameLayer.path = CGPath(roundedRect: frameRect.insetBy(dx: -overlayLineWidth / 2.0, dy: -overlayLineWidth / 2.0), cornerWidth: frameWidth / 8.0 * 1.02, cornerHeight: frameWidth / 8.0 * 1.02, transform: nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public var entities: [DrawingEntity] {
|
public var entities: [DrawingEntity] {
|
||||||
|
@ -345,7 +345,8 @@ class PremiumCoinComponent: Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(iOS 17.0, *), let material = node.geometry?.materials.first {
|
// if #available(iOS 17.0, *), let material = node.geometry?.materials.first {
|
||||||
|
if let material = node.geometry?.materials.first {
|
||||||
material.metalness.intensity = 0.3
|
material.metalness.intensity = 0.3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,30 @@ public func makePrivacyAndSecurityController(context: AccountContext) -> ViewCon
|
|||||||
return privacyAndSecurityController(context: context, focusOnItemTag: PrivacyAndSecurityEntryTag.autoArchive)
|
return privacyAndSecurityController(context: context, focusOnItemTag: PrivacyAndSecurityEntryTag.autoArchive)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func makeBioPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, present: @escaping (ViewController) -> Void) {
|
||||||
|
let signal = settings.get()
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue
|
||||||
|
|
||||||
|
let _ = signal.startStandalone(next: { info in
|
||||||
|
if let info = info {
|
||||||
|
present(selectivePrivacySettingsController(context: context, kind: .bio, current: info.bio, updated: { updated, _, _, _ in
|
||||||
|
let applySetting: Signal<Void, NoError> = settings.get()
|
||||||
|
|> filter { $0 != nil }
|
||||||
|
|> take(1)
|
||||||
|
|> deliverOnMainQueue
|
||||||
|
|> mapToSignal { value -> Signal<Void, NoError> in
|
||||||
|
if let value = value {
|
||||||
|
settings.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: updated, birthday: value.birthday, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
|
||||||
|
}
|
||||||
|
return .complete()
|
||||||
|
}
|
||||||
|
let _ = applySetting.startStandalone()
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void) {
|
public func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void) {
|
||||||
let signal = settings.get()
|
let signal = settings.get()
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|
@ -2146,7 +2146,9 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
private let gradientView: UIImageView
|
private let gradientView: UIImageView
|
||||||
private var gradientColorsDisposable: Disposable?
|
private var gradientColorsDisposable: Disposable?
|
||||||
|
|
||||||
private let stickerTransparentView: UIImageView
|
private var stickerBackgroundView: UIImageView?
|
||||||
|
private var stickerOverlayLayer: SimpleShapeLayer?
|
||||||
|
private var stickerFrameLayer: SimpleShapeLayer?
|
||||||
|
|
||||||
fileprivate let entitiesContainerView: UIView
|
fileprivate let entitiesContainerView: UIView
|
||||||
let entitiesView: DrawingEntitiesView
|
let entitiesView: DrawingEntitiesView
|
||||||
@ -2216,9 +2218,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.gradientView = UIImageView()
|
self.gradientView = UIImageView()
|
||||||
self.stickerTransparentView = UIImageView()
|
|
||||||
self.stickerTransparentView.clipsToBounds = true
|
|
||||||
|
|
||||||
var isStickerEditor = false
|
var isStickerEditor = false
|
||||||
if case .stickerEditor = controller.mode {
|
if case .stickerEditor = controller.mode {
|
||||||
isStickerEditor = true
|
isStickerEditor = true
|
||||||
@ -2255,7 +2255,9 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
|
|
||||||
if case .stickerEditor = controller.mode {
|
if case .stickerEditor = controller.mode {
|
||||||
let rowsCount = 40
|
let rowsCount = 40
|
||||||
self.stickerTransparentView.image = generateImage(CGSize(width: rowsCount, height: rowsCount), opaque: true, scale: 1.0, rotatedContext: { size, context in
|
let stickerBackgroundView = UIImageView()
|
||||||
|
stickerBackgroundView.clipsToBounds = true
|
||||||
|
stickerBackgroundView.image = generateImage(CGSize(width: rowsCount, height: rowsCount), opaque: true, scale: 1.0, rotatedContext: { size, context in
|
||||||
context.setFillColor(UIColor.black.cgColor)
|
context.setFillColor(UIColor.black.cgColor)
|
||||||
context.fill(CGRect(origin: .zero, size: size))
|
context.fill(CGRect(origin: .zero, size: size))
|
||||||
context.setFillColor(UIColor(rgb: 0x2b2b2d).cgColor)
|
context.setFillColor(UIColor(rgb: 0x2b2b2d).cgColor)
|
||||||
@ -2269,10 +2271,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
}
|
}
|
||||||
context.fillPath()
|
context.fillPath()
|
||||||
})
|
})
|
||||||
self.stickerTransparentView.layer.magnificationFilter = .nearest
|
stickerBackgroundView.layer.magnificationFilter = .nearest
|
||||||
self.stickerTransparentView.layer.shouldRasterize = true
|
stickerBackgroundView.layer.shouldRasterize = true
|
||||||
self.stickerTransparentView.layer.rasterizationScale = UIScreenScale
|
stickerBackgroundView.layer.rasterizationScale = UIScreenScale
|
||||||
self.previewContainerView.addSubview(self.stickerTransparentView)
|
self.stickerBackgroundView = stickerBackgroundView
|
||||||
|
self.previewContainerView.addSubview(stickerBackgroundView)
|
||||||
} else {
|
} else {
|
||||||
self.previewContainerView.addSubview(self.gradientView)
|
self.previewContainerView.addSubview(self.gradientView)
|
||||||
}
|
}
|
||||||
@ -2281,6 +2284,24 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
self.previewContainerView.addSubview(self.entitiesContainerView)
|
self.previewContainerView.addSubview(self.entitiesContainerView)
|
||||||
self.entitiesContainerView.addSubview(self.entitiesView)
|
self.entitiesContainerView.addSubview(self.entitiesView)
|
||||||
self.entitiesView.addSubview(self.drawingView)
|
self.entitiesView.addSubview(self.drawingView)
|
||||||
|
|
||||||
|
if case .stickerEditor = controller.mode {
|
||||||
|
let stickerOverlayLayer = SimpleShapeLayer()
|
||||||
|
stickerOverlayLayer.fillColor = UIColor(rgb: 0x000000, alpha: 0.7).cgColor
|
||||||
|
stickerOverlayLayer.fillRule = .evenOdd
|
||||||
|
self.stickerOverlayLayer = stickerOverlayLayer
|
||||||
|
self.previewContainerView.layer.addSublayer(stickerOverlayLayer)
|
||||||
|
|
||||||
|
let stickerFrameLayer = SimpleShapeLayer()
|
||||||
|
stickerFrameLayer.fillColor = UIColor.clear.cgColor
|
||||||
|
stickerFrameLayer.strokeColor = UIColor(rgb: 0xffffff, alpha: 0.55).cgColor
|
||||||
|
stickerFrameLayer.lineDashPattern = [12, 12] as [NSNumber]
|
||||||
|
stickerFrameLayer.lineCap = .round
|
||||||
|
|
||||||
|
self.stickerFrameLayer = stickerFrameLayer
|
||||||
|
self.previewContainerView.layer.addSublayer(stickerFrameLayer)
|
||||||
|
}
|
||||||
|
|
||||||
self.previewContainerView.addSubview(self.selectionContainerView)
|
self.previewContainerView.addSubview(self.selectionContainerView)
|
||||||
|
|
||||||
self.subjectDisposable = (
|
self.subjectDisposable = (
|
||||||
@ -4408,8 +4429,25 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
transition.setFrame(view: self.selectionContainerView, frame: CGRect(origin: .zero, size: previewFrame.size))
|
transition.setFrame(view: self.selectionContainerView, frame: CGRect(origin: .zero, size: previewFrame.size))
|
||||||
|
|
||||||
let stickerFrameWidth = floor(previewSize.width * 0.97)
|
let stickerFrameWidth = floor(previewSize.width * 0.97)
|
||||||
transition.setFrame(view: self.stickerTransparentView, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((previewSize.width - stickerFrameWidth) / 2.0), y: floorToScreenPixels((previewSize.height - stickerFrameWidth) / 2.0)), size: CGSize(width: stickerFrameWidth, height: stickerFrameWidth)))
|
if let stickerBackgroundView = self.stickerBackgroundView, let stickerOverlayLayer = self.stickerOverlayLayer, let stickerFrameLayer = self.stickerFrameLayer {
|
||||||
self.stickerTransparentView.layer.cornerRadius = stickerFrameWidth / 8.0
|
stickerOverlayLayer.frame = CGRect(origin: .zero, size: previewSize)
|
||||||
|
|
||||||
|
let stickerFrameRect = CGRect(origin: CGPoint(x: floor((previewSize.width - stickerFrameWidth) / 2.0), y: floor((previewSize.height - stickerFrameWidth) / 2.0)), size: CGSize(width: stickerFrameWidth, height: stickerFrameWidth))
|
||||||
|
|
||||||
|
let overlayOuterRect = UIBezierPath(rect: CGRect(origin: .zero, size: previewSize))
|
||||||
|
let overlayInnerRect = UIBezierPath(cgPath: CGPath(roundedRect: stickerFrameRect, cornerWidth: stickerFrameWidth / 8.0, cornerHeight: stickerFrameWidth / 8.0, transform: nil))
|
||||||
|
let overlayLineWidth: CGFloat = 2.0 - UIScreenPixel
|
||||||
|
overlayOuterRect.append(overlayInnerRect)
|
||||||
|
overlayOuterRect.usesEvenOddFillRule = true
|
||||||
|
stickerOverlayLayer.path = overlayOuterRect.cgPath
|
||||||
|
|
||||||
|
stickerFrameLayer.frame = stickerOverlayLayer.frame
|
||||||
|
stickerFrameLayer.lineWidth = overlayLineWidth
|
||||||
|
stickerFrameLayer.path = CGPath(roundedRect: stickerFrameRect.insetBy(dx: -overlayLineWidth / 2.0, dy: -overlayLineWidth / 2.0), cornerWidth: stickerFrameWidth / 8.0 * 1.02, cornerHeight: stickerFrameWidth / 8.0 * 1.02, transform: nil)
|
||||||
|
|
||||||
|
transition.setFrame(view: stickerBackgroundView, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((previewSize.width - stickerFrameWidth) / 2.0), y: floorToScreenPixels((previewSize.height - stickerFrameWidth) / 2.0)), size: CGSize(width: stickerFrameWidth, height: stickerFrameWidth)))
|
||||||
|
stickerBackgroundView.layer.cornerRadius = stickerFrameWidth / 8.0
|
||||||
|
}
|
||||||
|
|
||||||
self.interaction?.containerLayoutUpdated(layout: layout, transition: transition)
|
self.interaction?.containerLayoutUpdated(layout: layout, transition: transition)
|
||||||
|
|
||||||
@ -5886,11 +5924,13 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
)
|
)
|
||||||
peekController.appeared = { [weak self] in
|
peekController.appeared = { [weak self] in
|
||||||
if let self {
|
if let self {
|
||||||
|
self.node.entitiesView.alpha = 0.0
|
||||||
self.node.previewView.alpha = 0.0
|
self.node.previewView.alpha = 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
peekController.disappeared = { [weak self] in
|
peekController.disappeared = { [weak self] in
|
||||||
if let self {
|
if let self {
|
||||||
|
self.node.entitiesView.alpha = 1.0
|
||||||
self.node.previewView.alpha = 1.0
|
self.node.previewView.alpha = 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5905,6 +5945,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func presentCreateStickerPack(file: TelegramMediaFile, completion: @escaping () -> Void) {
|
private func presentCreateStickerPack(file: TelegramMediaFile, completion: @escaping () -> Void) {
|
||||||
|
//TODO:localize
|
||||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
|
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
|
||||||
|
|
||||||
var dismissImpl: (() -> Void)?
|
var dismissImpl: (() -> Void)?
|
||||||
|
@ -32,6 +32,8 @@ private final class PeerInfoScreenCommentItemNode: PeerInfoScreenItemNode {
|
|||||||
private var item: PeerInfoScreenCommentItem?
|
private var item: PeerInfoScreenCommentItem?
|
||||||
private var presentationData: PresentationData?
|
private var presentationData: PresentationData?
|
||||||
|
|
||||||
|
private var chevronImage: UIImage?
|
||||||
|
|
||||||
override init() {
|
override init() {
|
||||||
self.textNode = ImmediateTextNode()
|
self.textNode = ImmediateTextNode()
|
||||||
self.textNode.displaysAsynchronously = false
|
self.textNode.displaysAsynchronously = false
|
||||||
@ -66,6 +68,7 @@ private final class PeerInfoScreenCommentItemNode: PeerInfoScreenItemNode {
|
|||||||
return 10.0
|
return 10.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let themeUpdated = self.presentationData?.theme !== presentationData.theme
|
||||||
self.item = item
|
self.item = item
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
|
|
||||||
@ -79,8 +82,16 @@ private final class PeerInfoScreenCommentItemNode: PeerInfoScreenItemNode {
|
|||||||
|
|
||||||
let attributedText = parseMarkdownIntoAttributedString(item.text, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: textFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: presentationData.theme.list.itemAccentColor), linkAttribute: { contents in
|
let attributedText = parseMarkdownIntoAttributedString(item.text, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: textFont, textColor: textColor), bold: MarkdownAttributeSet(font: textFont, textColor: textColor), link: MarkdownAttributeSet(font: textFont, textColor: presentationData.theme.list.itemAccentColor), linkAttribute: { contents in
|
||||||
return (TelegramTextAttributes.URL, contents)
|
return (TelegramTextAttributes.URL, contents)
|
||||||
}))
|
})).mutableCopy() as! NSMutableAttributedString
|
||||||
|
if let range = attributedText.string.range(of: ">") {
|
||||||
|
if themeUpdated || self.chevronImage == nil {
|
||||||
|
self.chevronImage = generateTintedImage(image: UIImage(bundleImageName: "Contact List/SubtitleArrow"), color: presentationData.theme.list.itemAccentColor)
|
||||||
|
}
|
||||||
|
if let chevronImage = self.chevronImage {
|
||||||
|
attributedText.addAttribute(.attachment, value: chevronImage, range: NSRange(range, in: attributedText.string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.textNode.attributedText = attributedText
|
self.textNode.attributedText = attributedText
|
||||||
self.activateArea.accessibilityLabel = attributedText.string
|
self.activateArea.accessibilityLabel = attributedText.string
|
||||||
|
|
||||||
|
@ -587,6 +587,7 @@ private final class PeerInfoInteraction {
|
|||||||
let openEditing: () -> Void
|
let openEditing: () -> Void
|
||||||
let updateBirthdate: (TelegramBirthday??) -> Void
|
let updateBirthdate: (TelegramBirthday??) -> Void
|
||||||
let updateIsEditingBirthdate: (Bool) -> Void
|
let updateIsEditingBirthdate: (Bool) -> Void
|
||||||
|
let openBioPrivacy: () -> Void
|
||||||
let openBirthdatePrivacy: () -> Void
|
let openBirthdatePrivacy: () -> Void
|
||||||
let openPremiumGift: () -> Void
|
let openPremiumGift: () -> Void
|
||||||
let editingOpenPersonalChannel: () -> Void
|
let editingOpenPersonalChannel: () -> Void
|
||||||
@ -647,6 +648,7 @@ private final class PeerInfoInteraction {
|
|||||||
openEditing: @escaping () -> Void,
|
openEditing: @escaping () -> Void,
|
||||||
updateBirthdate: @escaping (TelegramBirthday??) -> Void,
|
updateBirthdate: @escaping (TelegramBirthday??) -> Void,
|
||||||
updateIsEditingBirthdate: @escaping (Bool) -> Void,
|
updateIsEditingBirthdate: @escaping (Bool) -> Void,
|
||||||
|
openBioPrivacy: @escaping () -> Void,
|
||||||
openBirthdatePrivacy: @escaping () -> Void,
|
openBirthdatePrivacy: @escaping () -> Void,
|
||||||
openPremiumGift: @escaping () -> Void,
|
openPremiumGift: @escaping () -> Void,
|
||||||
editingOpenPersonalChannel: @escaping () -> Void
|
editingOpenPersonalChannel: @escaping () -> Void
|
||||||
@ -706,6 +708,7 @@ private final class PeerInfoInteraction {
|
|||||||
self.openEditing = openEditing
|
self.openEditing = openEditing
|
||||||
self.updateBirthdate = updateBirthdate
|
self.updateBirthdate = updateBirthdate
|
||||||
self.updateIsEditingBirthdate = updateIsEditingBirthdate
|
self.updateIsEditingBirthdate = updateIsEditingBirthdate
|
||||||
|
self.openBioPrivacy = openBioPrivacy
|
||||||
self.openBirthdatePrivacy = openBirthdatePrivacy
|
self.openBirthdatePrivacy = openBirthdatePrivacy
|
||||||
self.openPremiumGift = openPremiumGift
|
self.openPremiumGift = openPremiumGift
|
||||||
self.editingOpenPersonalChannel = editingOpenPersonalChannel
|
self.editingOpenPersonalChannel = editingOpenPersonalChannel
|
||||||
@ -1030,7 +1033,9 @@ private func settingsEditingItems(data: PeerInfoScreenData?, state: PeerInfoStat
|
|||||||
}, action: {
|
}, action: {
|
||||||
interaction.dismissInput()
|
interaction.dismissInput()
|
||||||
}, maxLength: Int(data.globalSettings?.userLimits.maxAboutLength ?? 70)))
|
}, maxLength: Int(data.globalSettings?.userLimits.maxAboutLength ?? 70)))
|
||||||
items[.bio]!.append(PeerInfoScreenCommentItem(id: ItemBioHelp, text: presentationData.strings.Settings_About_Help))
|
items[.bio]!.append(PeerInfoScreenCommentItem(id: ItemBioHelp, text: presentationData.strings.Settings_About_PrivacyHelp, linkAction: { _ in
|
||||||
|
interaction.openBioPrivacy()
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2683,6 +2688,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
openBioPrivacy: { [weak self] in
|
||||||
|
if let self {
|
||||||
|
self.openBioPrivacy()
|
||||||
|
}
|
||||||
|
},
|
||||||
openBirthdatePrivacy: { [weak self] in
|
openBirthdatePrivacy: { [weak self] in
|
||||||
if let self {
|
if let self {
|
||||||
self.openBirthdatePrivacy()
|
self.openBirthdatePrivacy()
|
||||||
@ -7577,6 +7587,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func openBioPrivacy() {
|
||||||
|
guard let _ = self.data?.globalSettings?.privacySettings else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.context.sharedContext.makeBioPrivacyController(context: self.context, settings: self.privacySettings, present: { [weak self] c in
|
||||||
|
self?.controller?.push(c)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
private func openBirthdatePrivacy() {
|
private func openBirthdatePrivacy() {
|
||||||
guard let _ = self.data?.globalSettings?.privacySettings else {
|
guard let _ = self.data?.globalSettings?.privacySettings else {
|
||||||
return
|
return
|
||||||
|
@ -1845,6 +1845,10 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
public func makePrivacyAndSecurityController(context: AccountContext) -> ViewController {
|
public func makePrivacyAndSecurityController(context: AccountContext) -> ViewController {
|
||||||
return SettingsUI.makePrivacyAndSecurityController(context: context)
|
return SettingsUI.makePrivacyAndSecurityController(context: context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func makeBioPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, present: @escaping (ViewController) -> Void) {
|
||||||
|
SettingsUI.makeBioPrivacyController(context: context, settings: settings, present: present)
|
||||||
|
}
|
||||||
|
|
||||||
public func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void) {
|
public func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void) {
|
||||||
SettingsUI.makeBirthdayPrivacyController(context: context, settings: settings, openedFromBirthdayScreen: openedFromBirthdayScreen, present: present)
|
SettingsUI.makeBirthdayPrivacyController(context: context, settings: settings, openedFromBirthdayScreen: openedFromBirthdayScreen, present: present)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user