Various fixes

This commit is contained in:
Ilya Laktyushin 2023-08-11 01:36:48 +02:00
parent b2955394c2
commit f869c0450b
6 changed files with 55 additions and 34 deletions

View File

@ -9756,10 +9756,35 @@ Sorry for the inconvenience.";
"Premium.New" = "NEW";
"MediaEditor.AddGif" = "Add GIF";
"MediaEditor.AddLocation" = "Add Location";
"Premium.Stories" = "Upgraded Stories";
"Premium.StoriesInfo" = "Priority order, stealth mode, permanent views history and more.";
"Premium.Stories.Title" = "Upgraded Stories";
"Premium.Stories.AdditionalTitle" = "Exclusive Features in Stories";
"Premium.Stories.Order.Title" = "Priority Order";
"Premium.Stories.Order.Text" = "Get more views as your stories are always displayed first.";
"Premium.Stories.Stealth.Title" = "Stealth Mode";
"Premium.Stories.Stealth.Text" = "Hide the fact that you viewed other people's stories.";
"Premium.Stories.Views.Title" = "Permanent Views History";
"Premium.Stories.Views.Text" = "Check who opens your stories — even after they expire.";
"Premium.Stories.Expiration.Title" = "Expiration Durations";
"Premium.Stories.Expiration.Text" = "Set custom expiration durations like 6 or 48 hours for your stories.";
"Premium.Stories.Save.Title" = "Save Stories to Gallery";
"Premium.Stories.Save.Text" = "Save other people's unprotected stories to your Gallery.";
"Premium.Stories.Captions.Title" = "Longer Captions";
"Premium.Stories.Captions.Text" = "Add ten times longer captions to your stories.";
"Premium.Stories.Format.Title" = "Links and Formatting";
"Premium.Stories.Format.Text" = "Add links and formatting in captions to your stories.";
"Premium.MaxExpiringStoriesText" = "You can post **%@** stories in **24** hours. Subscribe to **Telegram Premium** to increase this limit to **%@**.";
"Premium.MaxExpiringStoriesNoPremiumText" = "You have reached the limit of **%@** stories per **24** hours.";
"Premium.MaxExpiringStoriesFinalText" = "You have reached the limit of **%@** stories per **24** hours.";

View File

@ -2049,7 +2049,7 @@ final class StoryStickersContentView: UIView, EmojiCustomContentView {
self.locationAction()
}
func update(theme: PresentationTheme, useOpaqueTheme: Bool, availableSize: CGSize, transition: Transition) -> CGSize {
func update(theme: PresentationTheme, strings: PresentationStrings, useOpaqueTheme: Bool, availableSize: CGSize, transition: Transition) -> CGSize {
if useOpaqueTheme {
self.backgroundLayer.backgroundColor = theme.chat.inputMediaPanel.panelContentControlOpaqueSelectionColor.cgColor
self.tintBackgroundLayer.backgroundColor = UIColor.white.cgColor
@ -2065,7 +2065,7 @@ final class StoryStickersContentView: UIView, EmojiCustomContentView {
let titleSize = self.title.update(
transition: .immediate,
component: AnyComponent(Text(
text: "ADD LOCATION",
text: strings.MediaEditor_AddLocation.uppercased(),
font: Font.with(size: 23.0, design: .camera),
color: .white
)),

View File

@ -360,7 +360,8 @@ public enum PremiumPerk: CaseIterable {
.appIcons,
.animatedEmoji,
.emojiStatus,
.translation
.translation,
.stories
]
}
@ -1614,17 +1615,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
)
context.add(text
.position(CGPoint(x: size.width / 2.0, y: size.height + text.size.height / 2.0))
// .update(Transition.Update { _, view, _ in
// if let snapshot = view.snapshotView(afterScreenUpdates: false) {
// let transition = Transition(animation: .curve(duration: 0.2, curve: .easeInOut))
// view.superview?.addSubview(snapshot)
// transition.setAlpha(view: snapshot, alpha: 0.0, completion: { [weak snapshot] _ in
// snapshot?.removeFromSuperview()
// })
// snapshot.frame = view.frame
// transition.animateAlpha(view: view, from: 0.0, to: 1.0)
// }
// })
)
size.height += text.size.height
size.height += 21.0

View File

@ -309,7 +309,7 @@ private final class StoriesListComponent: CombinedComponent {
return { context in
let theme = context.component.theme
// let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let colors = [
UIColor(rgb: 0x0275f3),
@ -343,9 +343,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "order",
component: AnyComponent(ParagraphComponent(
title: "Priority Order",
title: strings.Premium_Stories_Order_Title,
titleColor: titleColor,
text: "Get more views as your stories are always displayed first.",
text: strings.Premium_Stories_Order_Text,
textColor: textColor,
iconName: "Premium/Stories/Order",
iconColor: colors[0]
@ -357,9 +357,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "stealth",
component: AnyComponent(ParagraphComponent(
title: "Stealth Mode",
title: strings.Premium_Stories_Stealth_Title,
titleColor: titleColor,
text: "Hide the fact that you viewed other people's stories.",
text: strings.Premium_Stories_Stealth_Text,
textColor: textColor,
iconName: "Premium/Stories/Stealth",
iconColor: colors[1]
@ -371,9 +371,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "views",
component: AnyComponent(ParagraphComponent(
title: "Permanent Views History",
title: strings.Premium_Stories_Views_Title,
titleColor: titleColor,
text: "Check who opens your stories — even after they expire.",
text: strings.Premium_Stories_Views_Text,
textColor: textColor,
iconName: "Premium/Stories/Views",
iconColor: colors[2]
@ -385,9 +385,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "expiration",
component: AnyComponent(ParagraphComponent(
title: "Expiration Durations",
title: strings.Premium_Stories_Expiration_Title,
titleColor: titleColor,
text: "Set custom expiration durations like 6 or 48 hours for your stories.",
text: strings.Premium_Stories_Expiration_Text,
textColor: textColor,
iconName: "Premium/Stories/Expire",
iconColor: colors[3]
@ -399,9 +399,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "save",
component: AnyComponent(ParagraphComponent(
title: "Save Stories to Gallery",
title: strings.Premium_Stories_Save_Title,
titleColor: titleColor,
text: "Save other people's unprotected stories to your Gallery.",
text: strings.Premium_Stories_Save_Text,
textColor: textColor,
iconName: "Premium/Stories/Save",
iconColor: colors[4]
@ -413,9 +413,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "captions",
component: AnyComponent(ParagraphComponent(
title: "Longer Captions",
title: strings.Premium_Stories_Captions_Title,
titleColor: titleColor,
text: "Add ten times longer captions to your stories.",
text: strings.Premium_Stories_Captions_Text,
textColor: textColor,
iconName: "Premium/Stories/Caption",
iconColor: colors[5]
@ -427,9 +427,9 @@ private final class StoriesListComponent: CombinedComponent {
AnyComponentWithIdentity(
id: "format",
component: AnyComponent(ParagraphComponent(
title: "Links and Formatting",
title: strings.Premium_Stories_Format_Title,
titleColor: titleColor,
text: "Add links and formatting in captions to your stories.",
text: strings.Premium_Stories_Format_Text,
textColor: textColor,
iconName: "Premium/Stories/Format",
iconColor: colors[6]
@ -581,7 +581,7 @@ final class StoriesPageComponent: CombinedComponent {
state.isDisplaying = environment.isDisplaying
let theme = context.component.theme
// let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let strings = context.component.context.sharedContext.currentPresentationData.with { $0 }.strings
let topInset: CGFloat = 56.0
@ -641,7 +641,7 @@ final class StoriesPageComponent: CombinedComponent {
let title = title.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(string: "Upgraded Stories", font: Font.semibold(20.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: strings.Premium_Stories_Title, font: Font.semibold(20.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center,
truncationType: .end,
maximumNumberOfLines: 1
@ -652,7 +652,7 @@ final class StoriesPageComponent: CombinedComponent {
let secondaryTitle = secondaryTitle.update(
component: MultilineTextComponent(
text: .plain(NSAttributedString(string: "Exclusive Features in Stories", font: Font.semibold(17.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
text: .plain(NSAttributedString(string: strings.Premium_Stories_AdditionalTitle, font: Font.semibold(17.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
horizontalAlignment: .center,
truncationType: .end,
maximumNumberOfLines: 1

View File

@ -2213,7 +2213,7 @@ public protocol EmojiContentPeekBehavior: AnyObject {
public protocol EmojiCustomContentView: UIView {
var tintContainerView: UIView { get }
func update(theme: PresentationTheme, useOpaqueTheme: Bool, availableSize: CGSize, transition: Transition) -> CGSize
func update(theme: PresentationTheme, strings: PresentationStrings, useOpaqueTheme: Bool, availableSize: CGSize, transition: Transition) -> CGSize
}
public final class EmojiPagerContentComponent: Component {
@ -6562,7 +6562,7 @@ public final class EmojiPagerContentComponent: Component {
}
}
let availableCustomContentSize = availableSize
let customContentViewSize = customContentView.update(theme: keyboardChildEnvironment.theme, useOpaqueTheme: useOpaqueTheme, availableSize: availableCustomContentSize, transition: customContentViewTransition)
let customContentViewSize = customContentView.update(theme: keyboardChildEnvironment.theme, strings: keyboardChildEnvironment.strings, useOpaqueTheme: useOpaqueTheme, availableSize: availableCustomContentSize, transition: customContentViewTransition)
customContentViewTransition.setFrame(view: customContentView, frame: CGRect(origin: CGPoint(x: 0.0, y: pagerEnvironment.containerInsets.top + (component.displaySearchWithPlaceholder != nil ? 54.0 : 0.0)), size: customContentViewSize))
customContentHeight = customContentViewSize.height

View File

@ -503,6 +503,12 @@ public final class MediaEditor {
}
if let player {
player.isMuted = self.values.videoIsMuted
if let trimRange = self.values.videoTrimRange {
self.player?.currentItem?.forwardPlaybackEndTime = CMTime(seconds: trimRange.upperBound, preferredTimescale: CMTimeScale(1000))
self.additionalPlayer?.currentItem?.forwardPlaybackEndTime = CMTime(seconds: trimRange.upperBound, preferredTimescale: CMTimeScale(1000))
}
if let initialSeekPosition = self.initialSeekPosition {
self.initialSeekPosition = nil
player.seek(to: CMTime(seconds: initialSeekPosition, preferredTimescale: CMTimeScale(1000)), toleranceBefore: .zero, toleranceAfter: .zero)