Skip to content

Commit

Permalink
Merge commit '762c2d0e92b99c89734c16ed750d121ec4a8f4a7' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
laktyushin committed Aug 12, 2024
2 parents ab4a155 + 762c2d0 commit 0a31b63
Show file tree
Hide file tree
Showing 125 changed files with 2,497 additions and 734 deletions.
78 changes: 78 additions & 0 deletions Telegram/Telegram-iOS/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -9197,6 +9197,8 @@ Sorry for the inconvenience.";

"WebApp.LaunchMoreInfo" = "More about this bot";
"WebApp.LaunchConfirmation" = "To launch this web app, you will connect to its website.";
"WebApp.LaunchTermsConfirmation" = "By launching this mini app, you agree to the [Terms of Service for Mini Apps]().";
"WebApp.LaunchTermsConfirmation_URL" = "https://telegram.org/tos/mini-apps";
"WebApp.LaunchOpenApp" = "Open App";

"WallpaperPreview.PreviewInNightMode" = "Preview this wallpaper in night mode.";
Expand Down Expand Up @@ -12517,6 +12519,7 @@ Sorry for the inconvenience.";
"Notification.StarsGift.Title_any" = "%@ Stars";
"Notification.StarsGift.Subtitle" = "Use Stars to unlock content and services on Telegram.";
"Notification.StarsGift.SubtitleYou" = "With Stars, %@ will be able to unlock content and services on Telegram.";
"Notification.StarsGift.UnknownUser" = "Unknown user";

"Bot.Settings" = "Bot Settings";

Expand Down Expand Up @@ -12545,6 +12548,11 @@ Sorry for the inconvenience.";
"WebBrowser.LinkForwardTooltip.ManyChats.One" = "Link forwarded to **%@** and %@ others";
"WebBrowser.LinkForwardTooltip.SavedMessages.One" = "Link forwarded to **Saved Messages**";

"WebBrowser.FileForwardTooltip.Chat.One" = "Document forwarded to **%@**";
"WebBrowser.FileForwardTooltip.TwoChats.One" = "Document forwarded to **%@** and **%@**";
"WebBrowser.FileForwardTooltip.ManyChats.One" = "Document forwarded to **%@** and %@ others";
"WebBrowser.FileForwardTooltip.SavedMessages.One" = "Document forwarded to **Saved Messages**";

"Stars.Intro.StarsSent_1" = "%@ Star sent.";
"Stars.Intro.StarsSent_any" = "%@ Stars sent.";
"Stars.Intro.StarsSent.ViewChat" = "View Chat";
Expand Down Expand Up @@ -12699,6 +12707,7 @@ Sorry for the inconvenience.";
"Stars.Transaction.Subscription.JoinChannel" = "Join Channel";
"Stars.Transaction.Subscription.JoinAgainChannel" = "Join Channel";
"Stars.Transaction.Subscription.LeftChannel" = "You left channel but you can still get back until %@";
"Stars.Transaction.Subscription.Expired" = "Your subscription expired on %@.";
"Stars.Transaction.Subscription.PerMonth" = "%@ / month";
"Stars.Transaction.Subscription.PerMonthUsd" = "appx. %@ per month";
"Stars.Transaction.Subscription.Subscription" = "Subscription";
Expand All @@ -12721,6 +12730,7 @@ Sorry for the inconvenience.";
"Stars.Intro.Subscriptions.Expires" = "expires on %@";
"Stars.Intro.Subscriptions.Expired" = "expired on %@";
"Stars.Intro.Subscriptions.Cancelled" = "cancelled";
"Stars.Intro.Subscriptions.ExpiredStatus" = "expired";
"Stars.Intro.Subscriptions.ShowMore" = "Show More";

"Stars.Intro.Transaction.SubscriptionFee.Title" = "Monthly Subscription Fee";
Expand All @@ -12736,3 +12746,71 @@ Sorry for the inconvenience.";
"Stars.Transfer.Subscribe.Successful.Text" = "%1$@ transferred to %2$@.";

"Gallery.Ad" = "Ad";

"Chat.SensitiveContent" = "18+ Content";

"Settings.SensitiveContent" = "Show 18+ Content";
"Settings.SensitiveContentInfo" = "Do not hide media that contain content suitable only for adults.";

"SensitiveContent.Title" = "18+ Content";
"SensitiveContent.Text" = "This media may contain sensitive content suitable only for adults.\nDo you still want to view it?";
"SensitiveContent.ShowAlways" = "Always show 18+ media";
"SensitiveContent.ViewAnyway" = "View Anyway";
"SensitiveContent.SettingsInfo" = "You can update the visibility of sensitive media in [Data and Storage > Show 18+ Content]().";

"SensitiveContent.Enable.Title" = "18+ Content";
"SensitiveContent.Enable.Text" = "Confirm that you are over 18 years old and update settings to see potentially explicit and sensitive content.";
"SensitiveContent.Enable.Confirm" = "Confirm";

"Notification.Refund" = "You received a refund of {amount} from {name}";

"InviteLink.SubscriptionFee.Title" = "SUBSCRIPTION FEE";
"InviteLink.SubscriptionFee.PerMonth" = "%@ / month";
"InviteLink.SubscriptionFee.NoOneJoined" = "No one joined yet";
"InviteLink.SubscriptionFee.ApproximateIncome" = "You get approximately %@ monthly";

"InviteLink.PerMonth" = "per month";

"InviteLink.Create.Fee" = "Require Monthly Fee";
"InviteLink.Create.FeePerMonth" = "%@ / month";
"InviteLink.Create.FeePlaceholder" = "Stars amount per month";
"InviteLink.Create.FeeInfo" = "Charge a subscription fee from people joining your channel via this link. [Learn More >]()";
"InviteLink.Create.FeeEditInfo" = "If you need to change the subscription fee, create a new invite link with a different price.";
"InviteLink.Create.RequestApprovalFeeUnavailable" = "You can't enable admin approval for links that require a monthly fee.";

"WebApp.PrivacyPolicy_URL" = "https://telegram.org/privacy-tpa";

"ChatList.SubscriptionsLowBalance.Stars_1" = "%@ Star needed";
"ChatList.SubscriptionsLowBalance.Stars_any" = "%@ Stars needed";

"ChatList.SubscriptionsLowBalance.Single.Title" = "%1$@ for %2$@";
"ChatList.SubscriptionsLowBalance.Single.Text" = "Insufficient funds to cover your subscription.";

"ChatList.SubscriptionsLowBalance.Multiple.Title" = "%@ for your subscriptions";
"ChatList.SubscriptionsLowBalance.Multiple.Text" = "Insufficient funds to cover your subscriptions.";

"ChatList.Search.SectionApps" = "APPS";

"Channel.ShowAuthors" = "Show Authors' Profiles";
"Channel.ShowAuthorsFooter" = "Add names and photos of admins to the messages they post, linking to their profiles.";

"SendStarReactions.Title" = "React with Stars";
"SendStarReactions.Balance" = "Balance";
"SendStarReactions.UserLabelAnonymous" = "Anonymous";
"SendStarReactions.SliderTop" = "TOP";
"SendStarReactions.TextSentStars_1" = "You sent **1** star to support this post.";
"SendStarReactions.TextSentStars_any" = "You sent **%d** stars to support this post.";
"SendStarReactions.TextGeneric" = "Choose how many stars you want to send to **%@** to support this post.";
"SendStarReactions.SectionTop" = "Top Senders";
"SendStarReactions.ShowMyselfInTop" = "Show me in Top Senders";
"SendStarReactions.SendButtonTitle" = "Send # %@";
"SendStarReactions.TermsOfServiceFooter" = "By sending Stars you agree to the [Terms of Service](https://telegram.org/tos/stars)";

"PeerInfo.AllowedReactions.StarReactions" = "Enable Paid Reactions";
"PeerInfo.AllowedReactions.StarReactionsFooter" = "Switch this on to let your subscribers set paid reactions with Telegram Stars, which you will be able to withdraw later as TON. [Learn More >](https://telegram.org/privacy)";

"Chat.ToastStarsSent.Title_1" = "Star sent!";
"Chat.ToastStarsSent.Title_any" = "Stars sent!";
"Chat.ToastStarsSent.Text" = "You have reacted with %1$@ %2$@.";
"Chat.ToastStarsSent.TextStarAmount_1" = "star";
"Chat.ToastStarsSent.TextStarAmount_any" = "stars";
6 changes: 4 additions & 2 deletions submodules/AccountContext/Sources/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ public protocol SharedAccountContext: AnyObject {

func makeProxySettingsController(sharedContext: SharedAccountContext, account: UnauthorizedAccount) -> ViewController

func makeDataAndStorageController(context: AccountContext, sensitiveContent: Bool) -> ViewController

func makeInstalledStickerPacksController(context: AccountContext, mode: InstalledStickerPacksControllerMode, forceTheme: PresentationTheme?) -> ViewController

func makeChannelStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, peerId: EnginePeer.Id, boosts: Bool, boostStatus: ChannelBoostStatus?) -> ViewController
Expand All @@ -1004,8 +1006,8 @@ public protocol SharedAccountContext: AnyObject {

func makeStarsTransactionsScreen(context: AccountContext, starsContext: StarsContext) -> ViewController
func makeStarsPurchaseScreen(context: AccountContext, starsContext: StarsContext, options: [Any], purpose: StarsPurchasePurpose, completion: @escaping (Int64) -> Void) -> ViewController
func makeStarsTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, source: BotPaymentInvoiceSource, extendedMedia: [TelegramExtendedMedia], inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?)?, NoError>, completion: @escaping (Bool) -> Void) -> ViewController
func makeStarsSubscriptionTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, link: String, inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?)?, NoError>, navigateToPeer: @escaping (EnginePeer) -> Void) -> ViewController
func makeStarsTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, source: BotPaymentInvoiceSource, extendedMedia: [TelegramExtendedMedia], inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?, EnginePeer?)?, NoError>, completion: @escaping (Bool) -> Void) -> ViewController
func makeStarsSubscriptionTransferScreen(context: AccountContext, starsContext: StarsContext, invoice: TelegramMediaInvoice, link: String, inputData: Signal<(StarsContext.State, BotPaymentForm, EnginePeer?, EnginePeer?)?, NoError>, navigateToPeer: @escaping (EnginePeer) -> Void) -> ViewController
func makeStarsTransactionScreen(context: AccountContext, transaction: StarsContext.State.Transaction, peer: EnginePeer) -> ViewController
func makeStarsReceiptScreen(context: AccountContext, receipt: BotPaymentReceipt) -> ViewController
func makeStarsSubscriptionScreen(context: AccountContext, subscription: StarsContext.State.Subscription, update: @escaping (Bool) -> Void) -> ViewController
Expand Down
10 changes: 9 additions & 1 deletion submodules/AccountContext/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public final class ChatMessageItemAssociatedData: Equatable {
public let deviceContactsNumbers: Set<String>
public let isStandalone: Bool
public let isInline: Bool
public let showSensitiveContent: Bool

public init(
automaticDownloadPeerType: MediaAutoDownloadPeerType,
Expand Down Expand Up @@ -94,7 +95,8 @@ public final class ChatMessageItemAssociatedData: Equatable {
chatThemes: [TelegramTheme] = [],
deviceContactsNumbers: Set<String> = Set(),
isStandalone: Bool = false,
isInline: Bool = false
isInline: Bool = false,
showSensitiveContent: Bool = false
) {
self.automaticDownloadPeerType = automaticDownloadPeerType
self.automaticDownloadPeerId = automaticDownloadPeerId
Expand Down Expand Up @@ -127,6 +129,7 @@ public final class ChatMessageItemAssociatedData: Equatable {
self.deviceContactsNumbers = deviceContactsNumbers
self.isStandalone = isStandalone
self.isInline = isInline
self.showSensitiveContent = showSensitiveContent
}

public static func == (lhs: ChatMessageItemAssociatedData, rhs: ChatMessageItemAssociatedData) -> Bool {
Expand Down Expand Up @@ -217,6 +220,9 @@ public final class ChatMessageItemAssociatedData: Equatable {
if lhs.isInline != rhs.isInline {
return false
}
if lhs.showSensitiveContent != rhs.showSensitiveContent {
return false
}
return true
}
}
Expand Down Expand Up @@ -1045,6 +1051,8 @@ public protocol ChatController: ViewController {
func updateIsScrollingLockedAtTop(isScrollingLockedAtTop: Bool)

func playShakeAnimation()

func removeAd(opaqueId: Data)
}

public protocol ChatMessagePreviewItemNode: AnyObject {
Expand Down
16 changes: 15 additions & 1 deletion submodules/AccountContext/Sources/GalleryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,32 @@ public final class GalleryControllerActionInteraction {
public let openPeer: (EnginePeer) -> Void
public let openHashtag: (String?, String) -> Void
public let openBotCommand: (String) -> Void
public let openAd: (MessageId) -> Void
public let addContact: (String) -> Void
public let storeMediaPlaybackState: (MessageId, Double?, Double) -> Void
public let editMedia: (MessageId, [UIView], @escaping () -> Void) -> Void
public let updateCanReadHistory: (Bool) -> Void

public init(openUrl: @escaping (String, Bool) -> Void, openUrlIn: @escaping (String) -> Void, openPeerMention: @escaping (String) -> Void, openPeer: @escaping (EnginePeer) -> Void, openHashtag: @escaping (String?, String) -> Void, openBotCommand: @escaping (String) -> Void, addContact: @escaping (String) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void, editMedia: @escaping (MessageId, [UIView], @escaping () -> Void) -> Void, updateCanReadHistory: @escaping (Bool) -> Void) {
public init(
openUrl: @escaping (String, Bool) -> Void,
openUrlIn: @escaping (String) -> Void,
openPeerMention: @escaping (String) -> Void,
openPeer: @escaping (EnginePeer) -> Void,
openHashtag: @escaping (String?, String) -> Void,
openBotCommand: @escaping (String) -> Void,
openAd: @escaping (MessageId) -> Void,
addContact: @escaping (String) -> Void,
storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void,
editMedia: @escaping (MessageId, [UIView], @escaping () -> Void) -> Void,
updateCanReadHistory: @escaping (Bool) -> Void)
{
self.openUrl = openUrl
self.openUrlIn = openUrlIn
self.openPeerMention = openPeerMention
self.openPeer = openPeer
self.openHashtag = openHashtag
self.openBotCommand = openBotCommand
self.openAd = openAd
self.addContact = addContact
self.storeMediaPlaybackState = storeMediaPlaybackState
self.editMedia = editMedia
Expand Down
4 changes: 2 additions & 2 deletions submodules/AccountContext/Sources/OpenChatMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class OpenChatMessageParams {
public let navigationController: NavigationController?
public let modal: Bool
public let dismissInput: () -> Void
public let present: (ViewController, Any?) -> Void
public let present: (ViewController, Any?, PresentationContextType) -> Void
public let transitionNode: (MessageId, Media, Bool) -> (ASDisplayNode, CGRect, () -> (UIView?, UIView?))?
public let addToTransitionSurface: (UIView) -> Void
public let openUrl: (String) -> Void
Expand Down Expand Up @@ -63,7 +63,7 @@ public final class OpenChatMessageParams {
navigationController: NavigationController?,
modal: Bool = false,
dismissInput: @escaping () -> Void,
present: @escaping (ViewController, Any?) -> Void,
present: @escaping (ViewController, Any?, PresentationContextType) -> Void,
transitionNode: @escaping (MessageId, Media, Bool) -> (ASDisplayNode, CGRect, () -> (UIView?, UIView?))?,
addToTransitionSurface: @escaping (UIView) -> Void,
openUrl: @escaping (String) -> Void,
Expand Down
13 changes: 9 additions & 4 deletions submodules/AdUI/Sources/AdInfoScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public final class AdInfoScreen: ViewController {
self.controller = controller
self.context = context

self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
self.presentationData = controller.presentationData

self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 1
Expand Down Expand Up @@ -211,11 +211,16 @@ public final class AdInfoScreen: ViewController {
}

private let context: AccountContext
private var presentationData: PresentationData
fileprivate var presentationData: PresentationData

public init(context: AccountContext) {
public init(context: AccountContext, forceDark: Bool = false) {
self.context = context
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }

var presentationData = context.sharedContext.currentPresentationData.with { $0 }
if forceDark {
presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)
}
self.presentationData = presentationData

super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))

Expand Down
20 changes: 12 additions & 8 deletions submodules/AvatarNode/Sources/AvatarNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ private func calculateColors(context: AccountContext?, explicitColorIndex: Int?,
colors = AvatarNode.repostColors
} else if case .repliesIcon = icon {
colors = AvatarNode.savedMessagesColors
} else if case .anonymousSavedMessagesIcon = icon {
colors = AvatarNode.savedMessagesColors
} else if case let .anonymousSavedMessagesIcon(isColored) = icon {
if isColored {
colors = AvatarNode.savedMessagesColors
} else {
colors = AvatarNode.grayscaleColors
}
} else if case .myNotesIcon = icon {
colors = AvatarNode.savedMessagesColors
} else if case .editAvatarIcon = icon, let theme {
Expand Down Expand Up @@ -178,7 +182,7 @@ private enum AvatarNodeIcon: Equatable {
case none
case savedMessagesIcon
case repliesIcon
case anonymousSavedMessagesIcon
case anonymousSavedMessagesIcon(isColored: Bool)
case myNotesIcon
case archivedChatsIcon(hiddenByDefault: Bool)
case editAvatarIcon
Expand All @@ -192,7 +196,7 @@ public enum AvatarNodeImageOverride: Equatable {
case image(TelegramMediaImageRepresentation)
case savedMessagesIcon
case repliesIcon
case anonymousSavedMessagesIcon
case anonymousSavedMessagesIcon(isColored: Bool)
case myNotesIcon
case archivedChatsIcon(hiddenByDefault: Bool)
case editAvatarIcon(forceNone: Bool)
Expand Down Expand Up @@ -506,9 +510,9 @@ public final class AvatarNode: ASDisplayNode {
case .repliesIcon:
representation = nil
icon = .repliesIcon
case .anonymousSavedMessagesIcon:
case let .anonymousSavedMessagesIcon(isColored):
representation = nil
icon = .anonymousSavedMessagesIcon
icon = .anonymousSavedMessagesIcon(isColored: isColored)
case .myNotesIcon:
representation = nil
icon = .myNotesIcon
Expand Down Expand Up @@ -681,9 +685,9 @@ public final class AvatarNode: ASDisplayNode {
case .repliesIcon:
representation = nil
icon = .repliesIcon
case .anonymousSavedMessagesIcon:
case let .anonymousSavedMessagesIcon(isColored):
representation = nil
icon = .anonymousSavedMessagesIcon
icon = .anonymousSavedMessagesIcon(isColored: isColored)
case .myNotesIcon:
representation = nil
icon = .myNotesIcon
Expand Down
2 changes: 2 additions & 0 deletions submodules/BrowserUI/Sources/BrowserDocumentContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import UrlEscaping
final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate, WKUIDelegate, UIScrollViewDelegate {
private let context: AccountContext
private var presentationData: PresentationData
let file: TelegramMediaFile

private let webView: WKWebView

Expand Down Expand Up @@ -50,6 +51,7 @@ final class BrowserDocumentContent: UIView, BrowserContent, WKNavigationDelegate
self.context = context
self.uuid = UUID()
self.presentationData = presentationData
self.file = file

let configuration = WKWebViewConfiguration()
self.webView = WKWebView(frame: CGRect(), configuration: configuration)
Expand Down
Loading

0 comments on commit 0a31b63

Please sign in to comment.