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.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 makeChatRecentActionsController(context: AccountContext, peer: Peer, adminPeerId: PeerId?) -> 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 makeSetupTwoFactorAuthController(context: AccountContext) -> ViewController
|
||||
func makeStorageManagementController(context: AccountContext) -> ViewController
|
||||
|
@ -724,7 +724,7 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
|
||||
hideChatListContacts(context: context)
|
||||
} : nil), directionHint: entry.directionHint)
|
||||
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 {
|
||||
case .activate:
|
||||
switch notice {
|
||||
@ -1060,7 +1060,7 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
|
||||
hideChatListContacts(context: context)
|
||||
} : nil), directionHint: entry.directionHint)
|
||||
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 {
|
||||
case .activate:
|
||||
switch notice {
|
||||
|
@ -12,7 +12,7 @@ import Markdown
|
||||
import AccountContext
|
||||
import MergedAvatarsNode
|
||||
|
||||
class ChatListStorageInfoItem: ListViewItem {
|
||||
class ChatListNoticeItem: ListViewItem {
|
||||
enum Action {
|
||||
case activate
|
||||
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) {
|
||||
async {
|
||||
let node = ChatListStorageInfoItemNode()
|
||||
let node = ChatListNoticeItemNode()
|
||||
|
||||
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) {
|
||||
Queue.mainQueue().async {
|
||||
assert(node() is ChatListStorageInfoItemNode)
|
||||
if let nodeValue = node() as? ChatListStorageInfoItemNode {
|
||||
assert(node() is ChatListNoticeItemNode)
|
||||
if let nodeValue = node() as? ChatListNoticeItemNode {
|
||||
|
||||
let layout = nodeValue.asyncLayout()
|
||||
async {
|
||||
@ -84,7 +84,7 @@ private let separatorHeight = 1.0 / UIScreen.main.scale
|
||||
private let titleFont = Font.semibold(15.0)
|
||||
private let textFont = Font.regular(15.0)
|
||||
|
||||
class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
|
||||
private let contentContainer: ASDisplayNode
|
||||
private let titleNode: TextNode
|
||||
private let textNode: TextNode
|
||||
@ -100,7 +100,7 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
private var okButton: HighlightableButtonNode?
|
||||
private var cancelButton: HighlightableButtonNode?
|
||||
|
||||
private var item: ChatListStorageInfoItem?
|
||||
private var item: ChatListNoticeItem?
|
||||
|
||||
override var apparentHeight: CGFloat {
|
||||
didSet {
|
||||
@ -145,11 +145,11 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
|
||||
let layout = self.asyncLayout()
|
||||
let (_, apply) = layout(item as! ChatListStorageInfoItem, params, nextItem == nil)
|
||||
let (_, apply) = layout(item as! ChatListNoticeItem, params, nextItem == nil)
|
||||
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 makeTitleLayout = TextNode.asyncLayout(self.titleNode)
|
||||
@ -321,9 +321,19 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
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)
|
||||
}
|
||||
|
||||
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 {
|
||||
strongSelf.arrowNode.isHidden = true
|
||||
strongSelf.closeButton?.isHidden = true
|
||||
|
||||
let okButton: HighlightableButtonNode
|
||||
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)
|
||||
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 {
|
||||
strongSelf.arrowNode.isHidden = false
|
||||
strongSelf.arrowNode.isHidden = hasCloseButton
|
||||
|
||||
if let okButton = strongSelf.okButton {
|
||||
strongSelf.okButton = nil
|
||||
@ -390,40 +400,29 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
strongSelf.cancelButtonText = nil
|
||||
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 let current = strongSelf.closeButton {
|
||||
closeButton = current
|
||||
if hasCloseButton {
|
||||
let closeButton: HighlightableButtonNode
|
||||
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 {
|
||||
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
|
||||
strongSelf.closeButton?.removeFromSupernode()
|
||||
strongSelf.closeButton = nil
|
||||
}
|
||||
|
||||
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
|
@ -97,9 +97,6 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
private let angleLayer = SimpleShapeLayer()
|
||||
private let bin = ComponentView<Empty>()
|
||||
|
||||
private let stickerOverlayLayer = SimpleShapeLayer()
|
||||
private let stickerFrameLayer = SimpleShapeLayer()
|
||||
|
||||
public var onInteractionUpdated: (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.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.leftEdgeView)
|
||||
self.addSubview(self.rightEdgeView)
|
||||
@ -160,25 +150,12 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
self.addSubview(self.xAxisView)
|
||||
self.addSubview(self.yAxisView)
|
||||
self.layer.addSublayer(self.angleLayer)
|
||||
|
||||
if isStickerEditor {
|
||||
self.layer.addSublayer(self.stickerOverlayLayer)
|
||||
self.layer.addSublayer(self.stickerFrameLayer)
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
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() {
|
||||
super.layoutSubviews()
|
||||
|
||||
@ -214,25 +191,6 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
self.angleLayer.path = anglePath
|
||||
self.angleLayer.lineWidth = 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] {
|
||||
|
@ -345,7 +345,8 @@ class PremiumCoinComponent: Component {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,30 @@ public func makePrivacyAndSecurityController(context: AccountContext) -> ViewCon
|
||||
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) {
|
||||
let signal = settings.get()
|
||||
|> take(1)
|
||||
|
@ -2146,7 +2146,9 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
private let gradientView: UIImageView
|
||||
private var gradientColorsDisposable: Disposable?
|
||||
|
||||
private let stickerTransparentView: UIImageView
|
||||
private var stickerBackgroundView: UIImageView?
|
||||
private var stickerOverlayLayer: SimpleShapeLayer?
|
||||
private var stickerFrameLayer: SimpleShapeLayer?
|
||||
|
||||
fileprivate let entitiesContainerView: UIView
|
||||
let entitiesView: DrawingEntitiesView
|
||||
@ -2216,9 +2218,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
}
|
||||
|
||||
self.gradientView = UIImageView()
|
||||
self.stickerTransparentView = UIImageView()
|
||||
self.stickerTransparentView.clipsToBounds = true
|
||||
|
||||
|
||||
var isStickerEditor = false
|
||||
if case .stickerEditor = controller.mode {
|
||||
isStickerEditor = true
|
||||
@ -2255,7 +2255,9 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
|
||||
if case .stickerEditor = controller.mode {
|
||||
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.fill(CGRect(origin: .zero, size: size))
|
||||
context.setFillColor(UIColor(rgb: 0x2b2b2d).cgColor)
|
||||
@ -2269,10 +2271,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
}
|
||||
context.fillPath()
|
||||
})
|
||||
self.stickerTransparentView.layer.magnificationFilter = .nearest
|
||||
self.stickerTransparentView.layer.shouldRasterize = true
|
||||
self.stickerTransparentView.layer.rasterizationScale = UIScreenScale
|
||||
self.previewContainerView.addSubview(self.stickerTransparentView)
|
||||
stickerBackgroundView.layer.magnificationFilter = .nearest
|
||||
stickerBackgroundView.layer.shouldRasterize = true
|
||||
stickerBackgroundView.layer.rasterizationScale = UIScreenScale
|
||||
self.stickerBackgroundView = stickerBackgroundView
|
||||
self.previewContainerView.addSubview(stickerBackgroundView)
|
||||
} else {
|
||||
self.previewContainerView.addSubview(self.gradientView)
|
||||
}
|
||||
@ -2281,6 +2284,24 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
self.previewContainerView.addSubview(self.entitiesContainerView)
|
||||
self.entitiesContainerView.addSubview(self.entitiesView)
|
||||
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.subjectDisposable = (
|
||||
@ -4408,8 +4429,25 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
transition.setFrame(view: self.selectionContainerView, frame: CGRect(origin: .zero, size: previewFrame.size))
|
||||
|
||||
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)))
|
||||
self.stickerTransparentView.layer.cornerRadius = stickerFrameWidth / 8.0
|
||||
if let stickerBackgroundView = self.stickerBackgroundView, let stickerOverlayLayer = self.stickerOverlayLayer, let stickerFrameLayer = self.stickerFrameLayer {
|
||||
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)
|
||||
|
||||
@ -5886,11 +5924,13 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
)
|
||||
peekController.appeared = { [weak self] in
|
||||
if let self {
|
||||
self.node.entitiesView.alpha = 0.0
|
||||
self.node.previewView.alpha = 0.0
|
||||
}
|
||||
}
|
||||
peekController.disappeared = { [weak self] in
|
||||
if let self {
|
||||
self.node.entitiesView.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) {
|
||||
//TODO:localize
|
||||
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
|
||||
|
||||
var dismissImpl: (() -> Void)?
|
||||
|
@ -32,6 +32,8 @@ private final class PeerInfoScreenCommentItemNode: PeerInfoScreenItemNode {
|
||||
private var item: PeerInfoScreenCommentItem?
|
||||
private var presentationData: PresentationData?
|
||||
|
||||
private var chevronImage: UIImage?
|
||||
|
||||
override init() {
|
||||
self.textNode = ImmediateTextNode()
|
||||
self.textNode.displaysAsynchronously = false
|
||||
@ -66,6 +68,7 @@ private final class PeerInfoScreenCommentItemNode: PeerInfoScreenItemNode {
|
||||
return 10.0
|
||||
}
|
||||
|
||||
let themeUpdated = self.presentationData?.theme !== presentationData.theme
|
||||
self.item = item
|
||||
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
|
||||
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.activateArea.accessibilityLabel = attributedText.string
|
||||
|
||||
|
@ -587,6 +587,7 @@ private final class PeerInfoInteraction {
|
||||
let openEditing: () -> Void
|
||||
let updateBirthdate: (TelegramBirthday??) -> Void
|
||||
let updateIsEditingBirthdate: (Bool) -> Void
|
||||
let openBioPrivacy: () -> Void
|
||||
let openBirthdatePrivacy: () -> Void
|
||||
let openPremiumGift: () -> Void
|
||||
let editingOpenPersonalChannel: () -> Void
|
||||
@ -647,6 +648,7 @@ private final class PeerInfoInteraction {
|
||||
openEditing: @escaping () -> Void,
|
||||
updateBirthdate: @escaping (TelegramBirthday??) -> Void,
|
||||
updateIsEditingBirthdate: @escaping (Bool) -> Void,
|
||||
openBioPrivacy: @escaping () -> Void,
|
||||
openBirthdatePrivacy: @escaping () -> Void,
|
||||
openPremiumGift: @escaping () -> Void,
|
||||
editingOpenPersonalChannel: @escaping () -> Void
|
||||
@ -706,6 +708,7 @@ private final class PeerInfoInteraction {
|
||||
self.openEditing = openEditing
|
||||
self.updateBirthdate = updateBirthdate
|
||||
self.updateIsEditingBirthdate = updateIsEditingBirthdate
|
||||
self.openBioPrivacy = openBioPrivacy
|
||||
self.openBirthdatePrivacy = openBirthdatePrivacy
|
||||
self.openPremiumGift = openPremiumGift
|
||||
self.editingOpenPersonalChannel = editingOpenPersonalChannel
|
||||
@ -1030,7 +1033,9 @@ private func settingsEditingItems(data: PeerInfoScreenData?, state: PeerInfoStat
|
||||
}, action: {
|
||||
interaction.dismissInput()
|
||||
}, 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
|
||||
if let self {
|
||||
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() {
|
||||
guard let _ = self.data?.globalSettings?.privacySettings else {
|
||||
return
|
||||
|
@ -1845,6 +1845,10 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
public func makePrivacyAndSecurityController(context: AccountContext) -> ViewController {
|
||||
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) {
|
||||
SettingsUI.makeBirthdayPrivacyController(context: context, settings: settings, openedFromBirthdayScreen: openedFromBirthdayScreen, present: present)
|
||||
|
Loading…
x
Reference in New Issue
Block a user