mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-06-20 18:24:43 +00:00
Various fixes
This commit is contained in:
@@ -9739,8 +9739,8 @@ Sorry for the inconvenience.";
|
||||
"Story.PrivacyTooltipSelectedContacts.Contacts_1" = "1 contact";
|
||||
"Story.PrivacyTooltipSelectedContacts.Contacts_any" = "%@ contacts";
|
||||
|
||||
"Story.Privacy.GrayListSelect" = "[Select people]() who will never see your stories.";
|
||||
"Story.Privacy.GrayListSelected" = "[%@]() will never see your stories.";
|
||||
"Story.Privacy.GrayListSelect" = "[Select people]() who will never see any of your stories.";
|
||||
"Story.Privacy.GrayListSelected" = "[%@]() will never see any of your stories.";
|
||||
"Story.Privacy.GrayListPeople_1" = "1 person";
|
||||
"Story.Privacy.GrayListPeople_any" = "%@ people";
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ private func generateIcon(style: DrawingLocationEntity.Style) -> UIImage? {
|
||||
let blue: UIColor
|
||||
|
||||
if case .black = style {
|
||||
green = UIColor(rgb: 0x39e69a)
|
||||
blue = UIColor(rgb: 0x1c9ae0)
|
||||
green = UIColor(rgb: 0x3EF588)
|
||||
blue = UIColor(rgb: 0x4FAAFF)
|
||||
} else {
|
||||
green = UIColor(rgb: 0x1eb67a)
|
||||
blue = UIColor(rgb: 0x1d9ae2)
|
||||
green = UIColor(rgb: 0x1EBD5E)
|
||||
blue = UIColor(rgb: 0x1C92FF)
|
||||
}
|
||||
|
||||
var locations: [CGFloat] = [0.0, 1.0]
|
||||
@@ -32,7 +32,7 @@ private func generateIcon(style: DrawingLocationEntity.Style) -> UIImage? {
|
||||
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
||||
let gradient = CGGradient(colorsSpace: colorSpace, colors: colorsArray, locations: &locations)!
|
||||
|
||||
context.drawLinearGradient(gradient, start: CGPoint(x: size.width, y: 0.0), end: CGPoint(x: 0.0, y: 0.0), options: CGGradientDrawingOptions())
|
||||
context.drawLinearGradient(gradient, start: CGPoint(x: size.width, y: size.height), end: CGPoint(x: 0.0, y: 0.0), options: CGGradientDrawingOptions())
|
||||
} else {
|
||||
context.setFillColor(UIColor.white.cgColor)
|
||||
context.fill(CGRect(origin: .zero, size: size))
|
||||
@@ -46,6 +46,8 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
}
|
||||
|
||||
let backgroundView: UIView
|
||||
let blurredBackgroundView: BlurredBackgroundView
|
||||
|
||||
let textView: DrawingTextView
|
||||
let iconView: UIImageView
|
||||
|
||||
@@ -53,6 +55,9 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
self.backgroundView = UIView()
|
||||
self.backgroundView.clipsToBounds = true
|
||||
|
||||
self.blurredBackgroundView = BlurredBackgroundView(color: UIColor(white: 0.0, alpha: 0.25), enableBlur: true)
|
||||
self.blurredBackgroundView.clipsToBounds = true
|
||||
|
||||
self.textView = DrawingTextView(frame: .zero)
|
||||
self.textView.clipsToBounds = false
|
||||
|
||||
@@ -79,6 +84,7 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
|
||||
self.textView.delegate = self
|
||||
self.addSubview(self.backgroundView)
|
||||
self.addSubview(self.blurredBackgroundView)
|
||||
self.addSubview(self.textView)
|
||||
self.addSubview(self.iconView)
|
||||
|
||||
@@ -94,7 +100,7 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
self.textView.setNeedsLayersUpdate()
|
||||
var result = self.textView.sizeThatFits(CGSize(width: self.locationEntity.width, height: .greatestFiniteMagnitude))
|
||||
self.textSize = result
|
||||
result.width = floorToScreenPixels(max(224.0, ceil(result.width) + 20.0) + result.height * 0.5)
|
||||
result.width = floorToScreenPixels(max(224.0, ceil(result.width) + 20.0) + result.height * 0.55)
|
||||
result.height = ceil(result.height * 1.2);
|
||||
return result;
|
||||
}
|
||||
@@ -112,9 +118,11 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
super.layoutSubviews()
|
||||
|
||||
let iconSize = min(76.0, floor(self.bounds.height * 0.6))
|
||||
self.iconView.frame = CGRect(origin: CGPoint(x: floor(iconSize * 0.2), y: floorToScreenPixels((self.bounds.height - iconSize) / 2.0)), size: CGSize(width: iconSize, height: iconSize))
|
||||
self.iconView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels(iconSize * 0.25), y: floorToScreenPixels((self.bounds.height - iconSize) / 2.0)), size: CGSize(width: iconSize, height: iconSize))
|
||||
self.textView.frame = CGRect(origin: CGPoint(x: self.bounds.width - self.textSize.width, y: floorToScreenPixels((self.bounds.height - self.textSize.height) / 2.0)), size: self.textSize)
|
||||
self.backgroundView.frame = self.bounds
|
||||
self.blurredBackgroundView.frame = self.bounds
|
||||
self.blurredBackgroundView.update(size: self.bounds.size, transition: .immediate)
|
||||
}
|
||||
|
||||
override func selectedTapAction() -> Bool {
|
||||
@@ -129,7 +137,7 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
case .black:
|
||||
updatedStyle = .transparent
|
||||
case .transparent:
|
||||
updatedStyle = .white
|
||||
updatedStyle = .blur
|
||||
case .blur:
|
||||
updatedStyle = .white
|
||||
}
|
||||
@@ -162,6 +170,7 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
|
||||
let font = Font.with(size: fontSize, design: .camera, weight: .semibold)
|
||||
text.addAttribute(.font, value: font, range: range)
|
||||
text.addAttribute(.kern, value: -1.5 as NSNumber, range: range)
|
||||
self.textView.font = font
|
||||
|
||||
let paragraphStyle = NSMutableParagraphStyle()
|
||||
@@ -192,15 +201,23 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
case .white:
|
||||
self.textView.textColor = .black
|
||||
self.backgroundView.backgroundColor = .white
|
||||
self.backgroundView.isHidden = false
|
||||
self.blurredBackgroundView.isHidden = true
|
||||
case .black:
|
||||
self.textView.textColor = .white
|
||||
self.backgroundView.backgroundColor = .black
|
||||
self.backgroundView.isHidden = false
|
||||
self.blurredBackgroundView.isHidden = true
|
||||
case .transparent:
|
||||
self.textView.textColor = .white
|
||||
self.backgroundView.backgroundColor = UIColor(rgb: 0x000000, alpha: 0.2)
|
||||
self.backgroundView.isHidden = false
|
||||
self.blurredBackgroundView.isHidden = true
|
||||
case .blur:
|
||||
self.textView.textColor = .white
|
||||
self.backgroundView.backgroundColor = UIColor(rgb: 0x000000, alpha: 0.2)
|
||||
self.backgroundView.isHidden = true
|
||||
self.backgroundView.backgroundColor = UIColor(rgb: 0xffffff)
|
||||
self.blurredBackgroundView.isHidden = false
|
||||
}
|
||||
self.textView.textAlignment = .left
|
||||
|
||||
@@ -214,8 +231,10 @@ public final class DrawingLocationEntityView: DrawingEntityView, UITextViewDeleg
|
||||
}
|
||||
|
||||
self.backgroundView.layer.cornerRadius = self.textSize.height * 0.18
|
||||
self.blurredBackgroundView.layer.cornerRadius = self.backgroundView.layer.cornerRadius
|
||||
if #available(iOS 13.0, *) {
|
||||
self.backgroundView.layer.cornerCurve = .continuous
|
||||
self.blurredBackgroundView.layer.cornerCurve = .continuous
|
||||
}
|
||||
|
||||
super.update(animated: animated)
|
||||
|
||||
@@ -775,6 +775,8 @@ private func apiInputPrivacyRules(privacy: EngineStoryPrivacy, transaction: Tran
|
||||
if !privacyUsers.isEmpty {
|
||||
if case .contacts = privacy.base {
|
||||
privacyRules.append(.inputPrivacyValueDisallowUsers(users: privacyUsers))
|
||||
} else if case .everyone = privacy.base {
|
||||
privacyRules.append(.inputPrivacyValueDisallowUsers(users: privacyUsers))
|
||||
} else {
|
||||
privacyRules.append(.inputPrivacyValueAllowUsers(users: privacyUsers))
|
||||
}
|
||||
|
||||
@@ -2919,8 +2919,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
controller.presentLocationPicker = { [weak self, weak controller] in
|
||||
if let self {
|
||||
controller?.dismiss(animated: true)
|
||||
let existingEntity = self.entitiesView.getView(where: { $0 is DrawingLocationEntityView })?.entity as? DrawingLocationEntity
|
||||
self.presentLocationPicker(existingEntity)
|
||||
self.presentLocationPicker()
|
||||
}
|
||||
}
|
||||
self.stickerScreen = controller
|
||||
|
||||
+26
-10
@@ -942,7 +942,7 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
let base: EngineStoryPrivacy.Base?
|
||||
switch categoryId {
|
||||
case .everyone:
|
||||
base = nil
|
||||
base = .everyone
|
||||
case .contacts:
|
||||
base = .contacts
|
||||
case .closeFriends:
|
||||
@@ -1740,7 +1740,7 @@ final class ShareWithPeersScreenComponent: Component {
|
||||
case .nobody:
|
||||
title = environment.strings.Story_Privacy_CategorySelectedContacts
|
||||
case .everyone:
|
||||
title = ""
|
||||
title = environment.strings.Story_Privacy_ExcludedPeople
|
||||
}
|
||||
case .search:
|
||||
title = ""
|
||||
@@ -2435,19 +2435,35 @@ public class ShareWithPeersScreen: ViewControllerComponentContainer {
|
||||
var categoryItems: [ShareWithPeersScreenComponent.CategoryItem] = []
|
||||
var optionItems: [ShareWithPeersScreenComponent.OptionItem] = []
|
||||
if case let .stories(editing) = stateContext.subject {
|
||||
categoryItems.append(ShareWithPeersScreenComponent.CategoryItem(
|
||||
id: .everyone,
|
||||
title: presentationData.strings.Story_Privacy_CategoryEveryone,
|
||||
icon: "Media Editor/Privacy/Everyone",
|
||||
iconColor: .blue,
|
||||
actionTitle: nil
|
||||
))
|
||||
|
||||
var peerNames = ""
|
||||
if let peers = stateContext.stateValue?.peers, !peers.isEmpty {
|
||||
peerNames = String(peers.map { $0.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) }.joined(separator: ", "))
|
||||
}
|
||||
|
||||
var everyoneSubtitle = presentationData.strings.Story_Privacy_ExcludePeople
|
||||
if initialPrivacy.base == .everyone, initialPrivacy.additionallyIncludePeers.count > 0 {
|
||||
if initialPrivacy.additionallyIncludePeers.count == 1 {
|
||||
if !peerNames.isEmpty {
|
||||
everyoneSubtitle = presentationData.strings.Story_Privacy_ExcludePeopleExceptNames(peerNames).string
|
||||
} else {
|
||||
everyoneSubtitle = presentationData.strings.Story_Privacy_ExcludePeopleExcept(1)
|
||||
}
|
||||
} else {
|
||||
if !peerNames.isEmpty {
|
||||
everyoneSubtitle = presentationData.strings.Story_Privacy_ExcludePeopleExceptNames(peerNames).string
|
||||
} else {
|
||||
everyoneSubtitle = presentationData.strings.Story_Privacy_ExcludePeopleExcept(Int32(initialPrivacy.additionallyIncludePeers.count))
|
||||
}
|
||||
}
|
||||
}
|
||||
categoryItems.append(ShareWithPeersScreenComponent.CategoryItem(
|
||||
id: .everyone,
|
||||
title: presentationData.strings.Story_Privacy_CategoryEveryone,
|
||||
icon: "Media Editor/Privacy/Everyone",
|
||||
iconColor: .blue,
|
||||
actionTitle: everyoneSubtitle
|
||||
))
|
||||
|
||||
var contactsSubtitle = presentationData.strings.Story_Privacy_ExcludePeople
|
||||
if initialPrivacy.base == .contacts, initialPrivacy.additionallyIncludePeers.count > 0 {
|
||||
if initialPrivacy.additionallyIncludePeers.count == 1 {
|
||||
|
||||
+1
-2
@@ -756,8 +756,7 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
|
||||
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
|
||||
if case .ended = recognizer.state, let component = self.component, let itemLayout = self.itemLayout {
|
||||
if let menuController = self.sendMessageContext.menuController {
|
||||
menuController.dismiss(animated: true)
|
||||
if let _ = self.sendMessageContext.menuController {
|
||||
return
|
||||
}
|
||||
if self.hasActiveDeactivateableInput() {
|
||||
|
||||
+5
-5
@@ -67,7 +67,7 @@ final class StoryItemSetContainerSendMessage {
|
||||
weak var actionSheet: ViewController?
|
||||
weak var statusController: ViewController?
|
||||
weak var lookupController: UIViewController?
|
||||
weak var menuController: UIViewController?
|
||||
weak var menuController: ViewController?
|
||||
var isViewingAttachedStickers = false
|
||||
|
||||
var currentTooltipUpdateTimer: Foundation.Timer?
|
||||
@@ -3122,9 +3122,9 @@ final class StoryItemSetContainerSendMessage {
|
||||
}
|
||||
|
||||
let referenceSize = view.controlsContainerView.frame.size
|
||||
let size = CGSize(width: 16.0, height: 16.0)
|
||||
var frame = CGRect(x: mediaArea.coordinates.x / 100.0 * referenceSize.width - size.width / 2.0, y: (mediaArea.coordinates.y - mediaArea.coordinates.height * 0.5) / 100.0 * referenceSize.height - size.height / 2.0, width: size.width, height: size.height)
|
||||
frame = frame.offsetBy(dx: 0.0, dy: view.controlsContainerView.frame.minY)
|
||||
let size = CGSize(width: 16.0, height: mediaArea.coordinates.height / 100.0 * referenceSize.height * 1.1)
|
||||
var frame = CGRect(x: mediaArea.coordinates.x / 100.0 * referenceSize.width - size.width / 2.0, y: mediaArea.coordinates.y / 100.0 * referenceSize.height - size.height / 2.0, width: size.width, height: size.height)
|
||||
frame = view.controlsContainerView.convert(frame, to: nil)
|
||||
|
||||
let node = controller.displayNode
|
||||
let menuController = ContextMenuController(actions: actions)
|
||||
@@ -3134,7 +3134,7 @@ final class StoryItemSetContainerSendMessage {
|
||||
in: .window(.root),
|
||||
with: ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak node] in
|
||||
if let node {
|
||||
return (node, frame, node, CGRect(origin: .zero, size: referenceSize))
|
||||
return (node, frame, node, CGRect(origin: .zero, size: referenceSize).insetBy(dx: 0.0, dy: 64.0))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user