From 32ace10858501b150860771727f5e876437c972e Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Fri, 26 Jul 2024 22:57:42 +0200 Subject: [PATCH] Various fixes --- .../Telegram-iOS/en.lproj/Localizable.strings | 2 + .../Sources/MediaPickerScreen.swift | 6 ++- .../Sources/MediaPickerTitleView.swift | 44 ++++++++++++++++-- .../Privacy.imageset/Contents.json | 2 +- .../Privacy.imageset/privacy (2).pdf | Bin 0 -> 2500 bytes .../Context Menu/Privacy.imageset/privacy.pdf | Bin 2542 -> 0 bytes 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy (2).pdf delete mode 100644 submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy.pdf diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index ae9452a0bf..6c71dc1d97 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -12670,3 +12670,5 @@ Sorry for the inconvenience."; "Conversation.OpenProfile" = "OPEN PROFILE"; "Stars.Intro.GiftStars" = "Gift Stars to Friends"; + +"MediaPicker.CreateSticker" = "Create a sticker from a photo"; diff --git a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift index d56dcdd359..40cd313cd8 100644 --- a/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift +++ b/submodules/MediaPickerUI/Sources/MediaPickerScreen.swift @@ -1799,9 +1799,13 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable { self.titleView.title = collection.localizedTitle ?? presentationData.strings.Attachment_Gallery } else { switch mode { - case .default, .createSticker: + case .default: self.titleView.title = presentationData.strings.MediaPicker_Recents self.titleView.isEnabled = true + case .createSticker: + self.titleView.title = presentationData.strings.MediaPicker_Recents + self.titleView.subtitle = presentationData.strings.MediaPicker_CreateSticker + self.titleView.isEnabled = true case .story: self.titleView.title = presentationData.strings.MediaPicker_Recents self.titleView.isEnabled = true diff --git a/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift b/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift index bd44af71bb..a9d360915b 100644 --- a/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift +++ b/submodules/MediaPickerUI/Sources/MediaPickerTitleView.swift @@ -10,12 +10,14 @@ final class MediaPickerTitleView: UIView { let contextSourceNode: ContextReferenceContentNode private let buttonNode: HighlightTrackingButtonNode private let titleNode: ImmediateTextNode + private let subtitleNode: ImmediateTextNode private let arrowNode: ASImageNode private let segmentedControlNode: SegmentedControlNode public var theme: PresentationTheme { didSet { self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: theme.rootController.navigationBar.primaryTextColor) + self.subtitleNode.attributedText = NSAttributedString(string: self.subtitle, font: Font.regular(12.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor) self.segmentedControlNode.updateTheme(SegmentedControlTheme(theme: self.theme)) } } @@ -23,7 +25,16 @@ final class MediaPickerTitleView: UIView { public var title: String = "" { didSet { if self.title != oldValue { - self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: theme.rootController.navigationBar.primaryTextColor) + self.titleNode.attributedText = NSAttributedString(string: self.title, font: NavigationBar.titleFont, textColor: self.theme.rootController.navigationBar.primaryTextColor) + self.setNeedsLayout() + } + } + } + + public var subtitle: String = "" { + didSet { + if self.subtitle != oldValue { + self.subtitleNode.attributedText = NSAttributedString(string: self.subtitle, font: Font.regular(12.0), textColor: self.theme.rootController.navigationBar.secondaryTextColor) self.setNeedsLayout() } } @@ -36,7 +47,7 @@ final class MediaPickerTitleView: UIView { } } - public func updateTitle(title: String, isEnabled: Bool, animated: Bool) { + public func updateTitle(title: String, subtitle: String = "", isEnabled: Bool, animated: Bool) { if animated { if self.title != title { if let snapshotView = self.titleNode.view.snapshotContentTree() { @@ -49,6 +60,17 @@ final class MediaPickerTitleView: UIView { self.titleNode.view.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) } } + if self.subtitle != subtitle { + if let snapshotView = self.subtitleNode.view.snapshotContentTree() { + snapshotView.frame = self.subtitleNode.frame + self.addSubview(snapshotView) + + snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in + snapshotView.removeFromSuperview() + }) + self.subtitleNode.view.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) + } + } if self.isEnabled != isEnabled { if let snapshotView = self.arrowNode.view.snapshotContentTree() { snapshotView.frame = self.arrowNode.frame @@ -62,6 +84,7 @@ final class MediaPickerTitleView: UIView { } } self.title = title + self.subtitle = subtitle self.isEnabled = isEnabled } @@ -76,6 +99,7 @@ final class MediaPickerTitleView: UIView { if self.segmentsHidden != oldValue { let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut) transition.updateAlpha(node: self.titleNode, alpha: self.segmentsHidden ? 1.0 : 0.0) + transition.updateAlpha(node: self.subtitleNode, alpha: self.segmentsHidden ? 1.0 : 0.0) transition.updateAlpha(node: self.arrowNode, alpha: self.segmentsHidden ? 1.0 : 0.0) transition.updateAlpha(node: self.segmentedControlNode, alpha: self.segmentsHidden ? 0.0 : 1.0) self.segmentedControlNode.isUserInteractionEnabled = !self.segmentsHidden @@ -115,6 +139,9 @@ final class MediaPickerTitleView: UIView { self.titleNode = ImmediateTextNode() self.titleNode.displaysAsynchronously = false + self.subtitleNode = ImmediateTextNode() + self.subtitleNode.displaysAsynchronously = false + self.arrowNode = ASImageNode() self.arrowNode.displaysAsynchronously = false self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/DownArrow"), color: theme.rootController.navigationBar.secondaryTextColor) @@ -145,6 +172,7 @@ final class MediaPickerTitleView: UIView { self.addSubnode(self.contextSourceNode) self.addSubnode(self.titleNode) + self.addSubnode(self.subtitleNode) self.addSubnode(self.arrowNode) self.addSubnode(self.buttonNode) self.addSubnode(self.segmentedControlNode) @@ -166,10 +194,18 @@ final class MediaPickerTitleView: UIView { self.segmentedControlNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - controlSize.width) / 2.0), y: floorToScreenPixels((size.height - controlSize.height) / 2.0)), size: controlSize) let titleSize = self.titleNode.updateLayout(CGSize(width: 210.0, height: 44.0)) - self.titleNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: floorToScreenPixels((size.height - titleSize.height) / 2.0)), size: titleSize) + let subtitleSize = self.subtitleNode.updateLayout(CGSize(width: 210.0, height: 44.0)) + + var totalHeight: CGFloat = titleSize.height + if subtitleSize.height > 0.0 { + totalHeight += subtitleSize.height + } + + self.titleNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: floorToScreenPixels((size.height - totalHeight) / 2.0)), size: titleSize) + self.subtitleNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - subtitleSize.width) / 2.0), y: floorToScreenPixels((size.height - totalHeight) / 2.0) + subtitleSize.height + 7.0), size: subtitleSize) if let arrowSize = self.arrowNode.image?.size { - self.arrowNode.frame = CGRect(origin: CGPoint(x: self.titleNode.frame.maxX + 5.0, y: floorToScreenPixels((size.height - arrowSize.height) / 2.0) + 1.0 - UIScreenPixel), size: arrowSize) + self.arrowNode.frame = CGRect(origin: CGPoint(x: self.titleNode.frame.maxX + 5.0, y: floorToScreenPixels((size.height - totalHeight) / 2.0) + titleSize.height / 2.0 - arrowSize.height / 2.0 + 1.0 - UIScreenPixel), size: arrowSize) } self.buttonNode.frame = CGRect(origin: .zero, size: size) } diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json index 638a59cc88..6e7b34e21d 100644 --- a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "privacy.pdf", + "filename" : "privacy (2).pdf", "idiom" : "universal" } ], diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy (2).pdf b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy (2).pdf new file mode 100644 index 0000000000000000000000000000000000000000..badb2fabc505b01ea105299eda4038ada4089b0d GIT binary patch literal 2500 zcmZXWdpy(a8^@gzL(UY@H_;|(#^!uBR!eP0t56w66Psrn=I~TfOXUc8IVd(6;+B3lM20@{QR<eP-_towqiM?R%EePF z20fSbQj^EG+1xnEU+FnE*weJSIJVd~pNZ)?b)@Mizws{?Z!}d~-tK>xFO;QsDF-jX zs7EVnJNZM)uVnRb8l zqc<->z ziH}OLor@jMrs8BI)b8AewB!COGDzKE>=C?WutWAjWEOOsB@Lmv+niujD9H_RraUL zP6Ow5&~D3i+&a7AGf#44cwopKRL}6I$aGkJ=-TNOk1@IXIlaP< z%WbQNWtpLmw}&Rm7@S>r_43GW{j;tk+dFlYEPdaGcvPI3a42Gwd&Tcg>2O+4QcY&1 z5ae1cQNzWShGFUK63@xhF3!dQHqm3oJc-kHK_6X#J8o+;`#JzQZNQnc zFeKj8SHCF#EX^zV@xfXy=f0w1r9}v+x|g|btlc(B^h6%MD8WBKwd9;zyE)wYV24cc z9;muEX$J4b6!RXxiHqDzR<6XkhZHR&VKLQmtl20B_|b>S;(y_jgSmFtiR1y@p&<=b zIpk>XEqfO+mWHI!^V`N!&E@OXKl21^RT%TVx`WKVl}!a6JthsInS0!sMrCmHB->3T zZNL%P7-sl5JIvuiM<;sTU>VKPZq~j+pHIq~O-SSWmCQd~U1@*6B5HLgD#wmhWTG-8XsSgswHWwGwNkkkF0gv!= zR|`T*RDDP-DR>tE@ZgbhxqLuj8gQ$_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