mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update localization
This commit is contained in:
parent
b746fd85e0
commit
fb64f6e54b
@ -10950,3 +10950,16 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"Chat.TagSearchShowMessages" = "Show Other Messages";
|
"Chat.TagSearchShowMessages" = "Show Other Messages";
|
||||||
"Chat.TagSearchHideMessages" = "Hide Other Messages";
|
"Chat.TagSearchHideMessages" = "Hide Other Messages";
|
||||||
|
|
||||||
|
"PrivacyInfo.UpgradeToPremium.Title" = "Upgrade to Premium";
|
||||||
|
"PrivacyInfo.UpgradeToPremium.ButtonTitle" = "Subscribe to Telegram Premium";
|
||||||
|
|
||||||
|
"PrivacyInfo.ShowLastSeen.Title" = "Show Your Last Seen";
|
||||||
|
"PrivacyInfo.ShowLastSeen.Text" = "To see **%@'s** Last Seen time, either start showing your own Last Seen Time...";
|
||||||
|
"PrivacyInfo.ShowLastSeen.ButtonTitle" = "Show My Last Seen to Everyone";
|
||||||
|
"PrivacyInfo.ShowLastSeen.PremiumInfo" = "Subscription will let you see **%@'s** Last Seen status without showing yours.";
|
||||||
|
|
||||||
|
"PrivacyInfo.ShowReadTime.Title" = "Show Your Read Time";
|
||||||
|
"PrivacyInfo.ShowReadTime.Text" = "To see when **%@** read the message, either start showing your own read time:";
|
||||||
|
"PrivacyInfo.ShowReadTime.ButtonTitle" = "Show My Read Time";
|
||||||
|
"PrivacyInfo.ShowReadTime.PremiumInfo" = "Subscription will let you see **%@'s** read time without showing yours.";
|
||||||
|
@ -2,6 +2,8 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Display
|
import Display
|
||||||
import ComponentFlow
|
import ComponentFlow
|
||||||
|
import SwiftSignalKit
|
||||||
|
import TelegramCore
|
||||||
import Markdown
|
import Markdown
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
@ -18,19 +20,23 @@ private final class SheetContent: CombinedComponent {
|
|||||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||||
|
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
|
let peerId: EnginePeer.Id
|
||||||
let subject: PremiumPrivacyScreen.Subject
|
let subject: PremiumPrivacyScreen.Subject
|
||||||
|
|
||||||
let action: () -> Void
|
let action: () -> Void
|
||||||
let openPremiumIntro: () -> Void
|
let openPremiumIntro: () -> Void
|
||||||
let dismiss: () -> Void
|
let dismiss: () -> Void
|
||||||
|
|
||||||
init(context: AccountContext,
|
init(
|
||||||
subject: PremiumPrivacyScreen.Subject,
|
context: AccountContext,
|
||||||
action: @escaping () -> Void,
|
peerId: EnginePeer.Id,
|
||||||
openPremiumIntro: @escaping () -> Void,
|
subject: PremiumPrivacyScreen.Subject,
|
||||||
dismiss: @escaping () -> Void
|
action: @escaping () -> Void,
|
||||||
|
openPremiumIntro: @escaping () -> Void,
|
||||||
|
dismiss: @escaping () -> Void
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
self.peerId = peerId
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
self.action = action
|
self.action = action
|
||||||
self.openPremiumIntro = openPremiumIntro
|
self.openPremiumIntro = openPremiumIntro
|
||||||
@ -50,10 +56,42 @@ private final class SheetContent: CombinedComponent {
|
|||||||
final class State: ComponentState {
|
final class State: ComponentState {
|
||||||
var cachedCloseImage: (UIImage, PresentationTheme)?
|
var cachedCloseImage: (UIImage, PresentationTheme)?
|
||||||
var cachedIconImage: UIImage?
|
var cachedIconImage: UIImage?
|
||||||
|
|
||||||
|
let playOnce = ActionSlot<Void>()
|
||||||
|
private var didPlayAnimation = false
|
||||||
|
|
||||||
|
private var disposable: Disposable?
|
||||||
|
|
||||||
|
private(set) var peer: EnginePeer?
|
||||||
|
|
||||||
|
init(context: AccountContext, peerId: EnginePeer.Id) {
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
self.disposable = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||||
|
guard let self, let peer else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.peer = peer
|
||||||
|
self.updated()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
self.disposable?.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
func playAnimationIfNeeded() {
|
||||||
|
guard !self.didPlayAnimation else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.didPlayAnimation = true
|
||||||
|
self.playOnce.invoke(Void())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeState() -> State {
|
func makeState() -> State {
|
||||||
return State()
|
return State(context: self.context, peerId: self.peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
static var body: Body {
|
static var body: Body {
|
||||||
@ -101,23 +139,23 @@ private final class SheetContent: CombinedComponent {
|
|||||||
let buttonTitle: String
|
let buttonTitle: String
|
||||||
let premiumString: String
|
let premiumString: String
|
||||||
|
|
||||||
let premiumTitleString = "Upgrade to Premium"
|
let premiumTitleString = strings.PrivacyInfo_UpgradeToPremium_Title
|
||||||
let premiumButtonTitle = "Subscribe to Telegram Premium"
|
let premiumButtonTitle = strings.PrivacyInfo_UpgradeToPremium_ButtonTitle
|
||||||
|
|
||||||
let peerName = "Name"
|
let peerName = state.peer?.compactDisplayTitle ?? ""
|
||||||
switch component.subject {
|
switch component.subject {
|
||||||
case .presence:
|
case .presence:
|
||||||
iconName = "PremiumPrivacyPresence"
|
iconName = "PremiumPrivacyPresence"
|
||||||
titleString = "Show Your Last Seen"
|
titleString = strings.PrivacyInfo_ShowLastSeen_Title
|
||||||
textString = "To see **\(peerName)'s** Last Seen time, either start showing your own Last Seen Time..."
|
textString = strings.PrivacyInfo_ShowLastSeen_Text(peerName).string
|
||||||
buttonTitle = "Show My Last Seen to Everyone"
|
buttonTitle = strings.PrivacyInfo_ShowLastSeen_ButtonTitle
|
||||||
premiumString = "Subscription will let you see **\(peerName)'s** Last Seen status without showing yours."
|
premiumString = strings.PrivacyInfo_ShowLastSeen_PremiumInfo(peerName).string
|
||||||
case .readTime:
|
case .readTime:
|
||||||
iconName = "PremiumPrivacyRead"
|
iconName = "PremiumPrivacyRead"
|
||||||
titleString = "Show Your Read Date"
|
titleString = strings.PrivacyInfo_ShowReadTime_Title
|
||||||
textString = "To see when **\(peerName)** read the message, either start showing your own read time:"
|
textString = strings.PrivacyInfo_ShowReadTime_Text(peerName).string
|
||||||
buttonTitle = "Show My Read Time"
|
buttonTitle = strings.PrivacyInfo_ShowReadTime_ButtonTitle
|
||||||
premiumString = "Subscription will let you see **\(peerName)'s** read time without showing yours."
|
premiumString = strings.PrivacyInfo_ShowReadTime_PremiumInfo(peerName).string
|
||||||
}
|
}
|
||||||
|
|
||||||
let spacing: CGFloat = 8.0
|
let spacing: CGFloat = 8.0
|
||||||
@ -163,15 +201,10 @@ private final class SheetContent: CombinedComponent {
|
|||||||
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + iconBackground.size.height / 2.0))
|
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + iconBackground.size.height / 2.0))
|
||||||
)
|
)
|
||||||
|
|
||||||
// let icon = icon.update(
|
|
||||||
// component: BundleIconComponent(name: iconName, tintColor: .white),
|
|
||||||
// availableSize: CGSize(width: 70.0, height: 70.0),
|
|
||||||
// transition: .immediate
|
|
||||||
// )
|
|
||||||
|
|
||||||
let icon = icon.update(
|
let icon = icon.update(
|
||||||
component: LottieComponent(
|
component: LottieComponent(
|
||||||
content: LottieComponent.AppBundleContent(name: iconName)
|
content: LottieComponent.AppBundleContent(name: iconName),
|
||||||
|
playOnce: state.playOnce
|
||||||
),
|
),
|
||||||
availableSize: CGSize(width: 70, height: 70),
|
availableSize: CGSize(width: 70, height: 70),
|
||||||
transition: .immediate
|
transition: .immediate
|
||||||
@ -343,6 +376,8 @@ private final class SheetContent: CombinedComponent {
|
|||||||
|
|
||||||
contentSize.height += environment.safeInsets.bottom
|
contentSize.height += environment.safeInsets.bottom
|
||||||
|
|
||||||
|
state.playAnimationIfNeeded()
|
||||||
|
|
||||||
return contentSize
|
return contentSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,17 +387,20 @@ private final class SheetContainerComponent: CombinedComponent {
|
|||||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||||
|
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
|
let peerId: EnginePeer.Id
|
||||||
let subject: PremiumPrivacyScreen.Subject
|
let subject: PremiumPrivacyScreen.Subject
|
||||||
let action: () -> Void
|
let action: () -> Void
|
||||||
let openPremiumIntro: () -> Void
|
let openPremiumIntro: () -> Void
|
||||||
|
|
||||||
init(
|
init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
|
peerId: EnginePeer.Id,
|
||||||
subject: PremiumPrivacyScreen.Subject,
|
subject: PremiumPrivacyScreen.Subject,
|
||||||
action: @escaping () -> Void,
|
action: @escaping () -> Void,
|
||||||
openPremiumIntro: @escaping () -> Void
|
openPremiumIntro: @escaping () -> Void
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
self.peerId = peerId
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
self.action = action
|
self.action = action
|
||||||
self.openPremiumIntro = openPremiumIntro
|
self.openPremiumIntro = openPremiumIntro
|
||||||
@ -372,6 +410,9 @@ private final class SheetContainerComponent: CombinedComponent {
|
|||||||
if lhs.context !== rhs.context {
|
if lhs.context !== rhs.context {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.peerId != rhs.peerId {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if lhs.subject != rhs.subject {
|
if lhs.subject != rhs.subject {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -393,6 +434,7 @@ private final class SheetContainerComponent: CombinedComponent {
|
|||||||
component: SheetComponent<EnvironmentType>(
|
component: SheetComponent<EnvironmentType>(
|
||||||
content: AnyComponent<EnvironmentType>(SheetContent(
|
content: AnyComponent<EnvironmentType>(SheetContent(
|
||||||
context: context.component.context,
|
context: context.component.context,
|
||||||
|
peerId: context.component.peerId,
|
||||||
subject: context.component.subject,
|
subject: context.component.subject,
|
||||||
action: context.component.action,
|
action: context.component.action,
|
||||||
openPremiumIntro: context.component.openPremiumIntro,
|
openPremiumIntro: context.component.openPremiumIntro,
|
||||||
@ -468,17 +510,20 @@ public class PremiumPrivacyScreen: ViewControllerComponentContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
|
private let peerId: EnginePeer.Id
|
||||||
private let subject: PremiumPrivacyScreen.Subject
|
private let subject: PremiumPrivacyScreen.Subject
|
||||||
private var action: (() -> Void)?
|
private var action: (() -> Void)?
|
||||||
private var openPremiumIntro: (() -> Void)?
|
private var openPremiumIntro: (() -> Void)?
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
subject: PremiumPrivacyScreen.Subject,
|
peerId: EnginePeer.Id,
|
||||||
|
subject: PremiumPrivacyScreen.Subject,
|
||||||
action: @escaping () -> Void,
|
action: @escaping () -> Void,
|
||||||
openPremiumIntro: @escaping () -> Void
|
openPremiumIntro: @escaping () -> Void
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
self.peerId = peerId
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
self.action = action
|
self.action = action
|
||||||
self.openPremiumIntro = openPremiumIntro
|
self.openPremiumIntro = openPremiumIntro
|
||||||
@ -487,6 +532,7 @@ public class PremiumPrivacyScreen: ViewControllerComponentContainer {
|
|||||||
context: context,
|
context: context,
|
||||||
component: SheetContainerComponent(
|
component: SheetContainerComponent(
|
||||||
context: context,
|
context: context,
|
||||||
|
peerId: peerId,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
action: action,
|
action: action,
|
||||||
openPremiumIntro: openPremiumIntro
|
openPremiumIntro: openPremiumIntro
|
||||||
|
@ -91,6 +91,7 @@ public final class LottieComponent: Component {
|
|||||||
public let size: CGSize?
|
public let size: CGSize?
|
||||||
public let renderingScale: CGFloat?
|
public let renderingScale: CGFloat?
|
||||||
public let loop: Bool
|
public let loop: Bool
|
||||||
|
public let playOnce: ActionSlot<Void>?
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
content: Content,
|
content: Content,
|
||||||
@ -99,7 +100,8 @@ public final class LottieComponent: Component {
|
|||||||
startingPosition: StartingPosition = .end,
|
startingPosition: StartingPosition = .end,
|
||||||
size: CGSize? = nil,
|
size: CGSize? = nil,
|
||||||
renderingScale: CGFloat? = nil,
|
renderingScale: CGFloat? = nil,
|
||||||
loop: Bool = false
|
loop: Bool = false,
|
||||||
|
playOnce: ActionSlot<Void>? = nil
|
||||||
) {
|
) {
|
||||||
self.content = content
|
self.content = content
|
||||||
self.color = color
|
self.color = color
|
||||||
@ -108,6 +110,7 @@ public final class LottieComponent: Component {
|
|||||||
self.size = size
|
self.size = size
|
||||||
self.renderingScale = renderingScale
|
self.renderingScale = renderingScale
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
|
self.playOnce = playOnce
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: LottieComponent, rhs: LottieComponent) -> Bool {
|
public static func ==(lhs: LottieComponent, rhs: LottieComponent) -> Bool {
|
||||||
@ -411,6 +414,13 @@ public final class LottieComponent: Component {
|
|||||||
self.component = component
|
self.component = component
|
||||||
self.state = state
|
self.state = state
|
||||||
|
|
||||||
|
component.playOnce?.connect { [weak self] in
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.playOnce()
|
||||||
|
}
|
||||||
|
|
||||||
let size = component.size ?? availableSize
|
let size = component.size ?? availableSize
|
||||||
|
|
||||||
var redrawImage = false
|
var redrawImage = false
|
||||||
|
@ -2115,6 +2115,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
|
|
||||||
let controller = PremiumPrivacyScreen(
|
let controller = PremiumPrivacyScreen(
|
||||||
context: context,
|
context: context,
|
||||||
|
peerId: peerId,
|
||||||
subject: mappedSubject,
|
subject: mappedSubject,
|
||||||
action: {
|
action: {
|
||||||
actionImpl?()
|
actionImpl?()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user