mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-16 21:54:01 +00:00
Merge commit 'd21d943d8d1780deb582ff26f1fc178b59a49794'
This commit is contained in:
commit
83be782893
@ -12589,6 +12589,12 @@ Sorry for the inconvenience.";
|
|||||||
"WebBrowser.ClearCookies.ClearConfirmation.Text" = "Are you sure you want to clear cookies?";
|
"WebBrowser.ClearCookies.ClearConfirmation.Text" = "Are you sure you want to clear cookies?";
|
||||||
"WebBrowser.ClearCookies.ClearConfirmation.Clear" = "Clear";
|
"WebBrowser.ClearCookies.ClearConfirmation.Clear" = "Clear";
|
||||||
|
|
||||||
|
"WebBrowser.ClearCache" = "Clear Cache";
|
||||||
|
"WebBrowser.ClearCache.ClearConfirmation.Text" = "Are you sure you want to clear cookies?";
|
||||||
|
"WebBrowser.ClearCache.ClearConfirmation.Clear" = "Clear";
|
||||||
|
"WebBrowser.ClearCache.Succeed" = "Cookies cleared.";
|
||||||
|
|
||||||
|
|
||||||
"WebBrowser.Done" = "Done";
|
"WebBrowser.Done" = "Done";
|
||||||
|
|
||||||
"AccessDenied.LocationWeather" = "Telegram needs access to your location so that you can add the weather widget to your stories.\n\nPlease go to Settings > Privacy > Location Services and set Telegram to ON.";
|
"AccessDenied.LocationWeather" = "Telegram needs access to your location so that you can add the weather widget to your stories.\n\nPlease go to Settings > Privacy > Location Services and set Telegram to ON.";
|
||||||
@ -12658,3 +12664,11 @@ Sorry for the inconvenience.";
|
|||||||
|
|
||||||
"Stars.Intro.Transaction.Gift.Title" = "Received Gift";
|
"Stars.Intro.Transaction.Gift.Title" = "Received Gift";
|
||||||
"Stars.Intro.Transaction.Gift.UnknownUser" = "Unknown User";
|
"Stars.Intro.Transaction.Gift.UnknownUser" = "Unknown User";
|
||||||
|
|
||||||
|
"WebApp.PrivacyPolicy" = "Privacy Policy";
|
||||||
|
|
||||||
|
"Conversation.OpenProfile" = "OPEN PROFILE";
|
||||||
|
|
||||||
|
"Stars.Intro.GiftStars" = "Gift Stars to Friends";
|
||||||
|
|
||||||
|
"MediaPicker.CreateSticker" = "Create a sticker from a photo";
|
||||||
|
|||||||
@ -139,6 +139,7 @@ public struct PremiumConfiguration {
|
|||||||
showPremiumGiftInAttachMenu: false,
|
showPremiumGiftInAttachMenu: false,
|
||||||
showPremiumGiftInTextField: false,
|
showPremiumGiftInTextField: false,
|
||||||
giveawayGiftsPurchaseAvailable: false,
|
giveawayGiftsPurchaseAvailable: false,
|
||||||
|
starsGiftsPurchaseAvailable: false,
|
||||||
boostsPerGiftCount: 3,
|
boostsPerGiftCount: 3,
|
||||||
audioTransciptionTrialMaxDuration: 300,
|
audioTransciptionTrialMaxDuration: 300,
|
||||||
audioTransciptionTrialCount: 2,
|
audioTransciptionTrialCount: 2,
|
||||||
@ -165,6 +166,7 @@ public struct PremiumConfiguration {
|
|||||||
public let showPremiumGiftInAttachMenu: Bool
|
public let showPremiumGiftInAttachMenu: Bool
|
||||||
public let showPremiumGiftInTextField: Bool
|
public let showPremiumGiftInTextField: Bool
|
||||||
public let giveawayGiftsPurchaseAvailable: Bool
|
public let giveawayGiftsPurchaseAvailable: Bool
|
||||||
|
public let starsGiftsPurchaseAvailable: Bool
|
||||||
public let boostsPerGiftCount: Int32
|
public let boostsPerGiftCount: Int32
|
||||||
public let audioTransciptionTrialMaxDuration: Int32
|
public let audioTransciptionTrialMaxDuration: Int32
|
||||||
public let audioTransciptionTrialCount: Int32
|
public let audioTransciptionTrialCount: Int32
|
||||||
@ -190,6 +192,7 @@ public struct PremiumConfiguration {
|
|||||||
showPremiumGiftInAttachMenu: Bool,
|
showPremiumGiftInAttachMenu: Bool,
|
||||||
showPremiumGiftInTextField: Bool,
|
showPremiumGiftInTextField: Bool,
|
||||||
giveawayGiftsPurchaseAvailable: Bool,
|
giveawayGiftsPurchaseAvailable: Bool,
|
||||||
|
starsGiftsPurchaseAvailable: Bool,
|
||||||
boostsPerGiftCount: Int32,
|
boostsPerGiftCount: Int32,
|
||||||
audioTransciptionTrialMaxDuration: Int32,
|
audioTransciptionTrialMaxDuration: Int32,
|
||||||
audioTransciptionTrialCount: Int32,
|
audioTransciptionTrialCount: Int32,
|
||||||
@ -214,6 +217,7 @@ public struct PremiumConfiguration {
|
|||||||
self.showPremiumGiftInAttachMenu = showPremiumGiftInAttachMenu
|
self.showPremiumGiftInAttachMenu = showPremiumGiftInAttachMenu
|
||||||
self.showPremiumGiftInTextField = showPremiumGiftInTextField
|
self.showPremiumGiftInTextField = showPremiumGiftInTextField
|
||||||
self.giveawayGiftsPurchaseAvailable = giveawayGiftsPurchaseAvailable
|
self.giveawayGiftsPurchaseAvailable = giveawayGiftsPurchaseAvailable
|
||||||
|
self.starsGiftsPurchaseAvailable = starsGiftsPurchaseAvailable
|
||||||
self.boostsPerGiftCount = boostsPerGiftCount
|
self.boostsPerGiftCount = boostsPerGiftCount
|
||||||
self.audioTransciptionTrialMaxDuration = audioTransciptionTrialMaxDuration
|
self.audioTransciptionTrialMaxDuration = audioTransciptionTrialMaxDuration
|
||||||
self.audioTransciptionTrialCount = audioTransciptionTrialCount
|
self.audioTransciptionTrialCount = audioTransciptionTrialCount
|
||||||
@ -246,6 +250,7 @@ public struct PremiumConfiguration {
|
|||||||
showPremiumGiftInAttachMenu: data["premium_gift_attach_menu_icon"] as? Bool ?? defaultValue.showPremiumGiftInAttachMenu,
|
showPremiumGiftInAttachMenu: data["premium_gift_attach_menu_icon"] as? Bool ?? defaultValue.showPremiumGiftInAttachMenu,
|
||||||
showPremiumGiftInTextField: data["premium_gift_text_field_icon"] as? Bool ?? defaultValue.showPremiumGiftInTextField,
|
showPremiumGiftInTextField: data["premium_gift_text_field_icon"] as? Bool ?? defaultValue.showPremiumGiftInTextField,
|
||||||
giveawayGiftsPurchaseAvailable: data["giveaway_gifts_purchase_available"] as? Bool ?? defaultValue.giveawayGiftsPurchaseAvailable,
|
giveawayGiftsPurchaseAvailable: data["giveaway_gifts_purchase_available"] as? Bool ?? defaultValue.giveawayGiftsPurchaseAvailable,
|
||||||
|
starsGiftsPurchaseAvailable: data["stars_gifts_enabled"] as? Bool ?? defaultValue.starsGiftsPurchaseAvailable,
|
||||||
boostsPerGiftCount: get(data["boosts_per_sent_gift"]) ?? defaultValue.boostsPerGiftCount,
|
boostsPerGiftCount: get(data["boosts_per_sent_gift"]) ?? defaultValue.boostsPerGiftCount,
|
||||||
audioTransciptionTrialMaxDuration: get(data["transcribe_audio_trial_duration_max"]) ?? defaultValue.audioTransciptionTrialMaxDuration,
|
audioTransciptionTrialMaxDuration: get(data["transcribe_audio_trial_duration_max"]) ?? defaultValue.audioTransciptionTrialMaxDuration,
|
||||||
audioTransciptionTrialCount: get(data["transcribe_audio_trial_weekly_number"]) ?? defaultValue.audioTransciptionTrialCount,
|
audioTransciptionTrialCount: get(data["transcribe_audio_trial_weekly_number"]) ?? defaultValue.audioTransciptionTrialCount,
|
||||||
|
|||||||
@ -249,8 +249,7 @@ final class AddressBarContentComponent: Component {
|
|||||||
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
if let component = self.component {
|
if let component = self.component {
|
||||||
let finalUrl = explicitUrl(textField.text ?? "")
|
let finalUrl = explicitUrl(textField.text ?? "")
|
||||||
// finalUrl = finalUrl.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed) ?? finalUrl
|
component.performAction.invoke(.navigateTo(finalUrl, true))
|
||||||
component.performAction.invoke(.navigateTo(finalUrl))
|
|
||||||
}
|
}
|
||||||
textField.endEditing(true)
|
textField.endEditing(true)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -390,7 +390,7 @@ final class BrowserAddressListComponent: Component {
|
|||||||
insets: component.insets,
|
insets: component.insets,
|
||||||
action: {
|
action: {
|
||||||
if let url = webPage?.content.url {
|
if let url = webPage?.content.url {
|
||||||
performAction.invoke(.navigateTo(url))
|
performAction.invoke(.navigateTo(url, false))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contextAction: { [weak self] webPage, message, sourceView, gesture in
|
contextAction: { [weak self] webPage, message, sourceView, gesture in
|
||||||
|
|||||||
@ -153,24 +153,26 @@ private final class BrowserScreenComponent: CombinedComponent {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if isTablet {
|
if isTablet {
|
||||||
// navigationLeftItems.append(
|
#if DEBUG
|
||||||
// AnyComponentWithIdentity(
|
navigationLeftItems.append(
|
||||||
// id: "minimize",
|
AnyComponentWithIdentity(
|
||||||
// component: AnyComponent(
|
id: "minimize",
|
||||||
// Button(
|
component: AnyComponent(
|
||||||
// content: AnyComponent(
|
Button(
|
||||||
// BundleIconComponent(
|
content: AnyComponent(
|
||||||
// name: "Media Gallery/PictureInPictureButton",
|
BundleIconComponent(
|
||||||
// tintColor: environment.theme.rootController.navigationBar.accentTextColor
|
name: "Media Gallery/PictureInPictureButton",
|
||||||
// )
|
tintColor: environment.theme.rootController.navigationBar.accentTextColor
|
||||||
// ),
|
)
|
||||||
// action: {
|
),
|
||||||
// performAction.invoke(.close)
|
action: {
|
||||||
// }
|
performAction.invoke(.close)
|
||||||
// )
|
}
|
||||||
// )
|
)
|
||||||
// )
|
)
|
||||||
// )
|
)
|
||||||
|
)
|
||||||
|
#endif
|
||||||
|
|
||||||
let canGoBack = context.component.contentState?.canGoBack ?? false
|
let canGoBack = context.component.contentState?.canGoBack ?? false
|
||||||
let canGoForward = context.component.contentState?.canGoForward ?? false
|
let canGoForward = context.component.contentState?.canGoForward ?? false
|
||||||
@ -483,7 +485,7 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||||||
case openBookmarks
|
case openBookmarks
|
||||||
case openAddressBar
|
case openAddressBar
|
||||||
case closeAddressBar
|
case closeAddressBar
|
||||||
case navigateTo(String)
|
case navigateTo(String, Bool)
|
||||||
case expand
|
case expand
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,9 +732,12 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||||||
updatedState.addressFocused = false
|
updatedState.addressFocused = false
|
||||||
return updatedState
|
return updatedState
|
||||||
})
|
})
|
||||||
case let .navigateTo(address):
|
case let .navigateTo(address, addToRecent):
|
||||||
if let content = self.content.last as? BrowserWebContent {
|
if let content = self.content.last as? BrowserWebContent {
|
||||||
content.navigateTo(address: address)
|
content.navigateTo(address: address)
|
||||||
|
if addToRecent {
|
||||||
|
content.addToRecentlyVisited()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.updatePresentationState(transition: .spring(duration: 0.4), { state in
|
self.updatePresentationState(transition: .spring(duration: 0.4), { state in
|
||||||
var updatedState = state
|
var updatedState = state
|
||||||
@ -988,7 +993,7 @@ public class BrowserScreen: ViewController, MinimizableController {
|
|||||||
}
|
}
|
||||||
let controller = BrowserBookmarksScreen(context: self.context, url: url, openUrl: { [weak self] url in
|
let controller = BrowserBookmarksScreen(context: self.context, url: url, openUrl: { [weak self] url in
|
||||||
if let self {
|
if let self {
|
||||||
self.performAction.invoke(.navigateTo(url))
|
self.performAction.invoke(.navigateTo(url, true))
|
||||||
}
|
}
|
||||||
}, addBookmark: { [weak self] in
|
}, addBookmark: { [weak self] in
|
||||||
self?.addBookmark(url, showArrow: false)
|
self?.addBookmark(url, showArrow: false)
|
||||||
|
|||||||
@ -681,7 +681,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||||||
// })
|
// })
|
||||||
// } else {
|
// } else {
|
||||||
if let url = navigationAction.request.url?.absoluteString {
|
if let url = navigationAction.request.url?.absoluteString {
|
||||||
if isTelegramMeLink(url) || isTelegraPhLink(url) {
|
if (navigationAction.targetFrame == nil || navigationAction.targetFrame?.isMainFrame == true) && (isTelegramMeLink(url) || isTelegraPhLink(url)) {
|
||||||
decisionHandler(.cancel, preferences)
|
decisionHandler(.cancel, preferences)
|
||||||
self.minimize()
|
self.minimize()
|
||||||
self.openAppUrl(url)
|
self.openAppUrl(url)
|
||||||
@ -712,7 +712,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||||||
|
|
||||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||||
if let url = navigationAction.request.url?.absoluteString {
|
if let url = navigationAction.request.url?.absoluteString {
|
||||||
if isTelegramMeLink(url) || isTelegraPhLink(url) {
|
if (navigationAction.targetFrame == nil || navigationAction.targetFrame?.isMainFrame == true) && (isTelegramMeLink(url) || isTelegraPhLink(url)) {
|
||||||
decisionHandler(.cancel)
|
decisionHandler(.cancel)
|
||||||
self.minimize()
|
self.minimize()
|
||||||
self.openAppUrl(url)
|
self.openAppUrl(url)
|
||||||
@ -752,7 +752,12 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
|
|||||||
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
|
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
|
||||||
if navigationAction.targetFrame == nil {
|
if navigationAction.targetFrame == nil {
|
||||||
if let url = navigationAction.request.url?.absoluteString {
|
if let url = navigationAction.request.url?.absoluteString {
|
||||||
self.open(url: url, new: true)
|
if isTelegramMeLink(url) || isTelegraPhLink(url) {
|
||||||
|
self.minimize()
|
||||||
|
self.openAppUrl(url)
|
||||||
|
} else {
|
||||||
|
self.open(url: url, new: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -90,6 +90,10 @@ public struct ContainerViewLayout: Equatable {
|
|||||||
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: self.inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
|
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: self.inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func withUpdatedAdditionalInsets(_ additionalInsets: UIEdgeInsets) -> ContainerViewLayout {
|
||||||
|
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: self.intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: self.inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
|
||||||
|
}
|
||||||
|
|
||||||
public func withUpdatedInputHeight(_ inputHeight: CGFloat?) -> ContainerViewLayout {
|
public func withUpdatedInputHeight(_ inputHeight: CGFloat?) -> ContainerViewLayout {
|
||||||
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: self.intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
|
return ContainerViewLayout(size: self.size, metrics: self.metrics, deviceMetrics: self.deviceMetrics, intrinsicInsets: self.intrinsicInsets, safeInsets: self.safeInsets, additionalInsets: self.additionalInsets, statusBarHeight: self.statusBarHeight, inputHeight: inputHeight, inputHeightIsInteractivellyChanging: self.inputHeightIsInteractivellyChanging, inVoiceOver: self.inVoiceOver)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -443,7 +443,20 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||||||
globalScrollToTopNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: layout.size.width, height: 1.0))
|
globalScrollToTopNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: layout.size.width, height: 1.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
let overlayContainerLayout = layout
|
var overlayContainerLayout = layout
|
||||||
|
|
||||||
|
var updatedSize = layout.size
|
||||||
|
var updatedIntrinsicInsets = layout.intrinsicInsets
|
||||||
|
var updatedAdditionalInsets = layout.additionalInsets
|
||||||
|
if let minimizedContainer = self.minimizedContainer {
|
||||||
|
if (layout.inputHeight ?? 0.0).isZero {
|
||||||
|
let minimizedContainerHeight = minimizedContainer.collapsedHeight(layout: layout)
|
||||||
|
updatedSize.height -= minimizedContainerHeight
|
||||||
|
updatedIntrinsicInsets.bottom = 0.0
|
||||||
|
updatedAdditionalInsets.bottom += minimizedContainerHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
overlayContainerLayout = overlayContainerLayout.withUpdatedAdditionalInsets(updatedAdditionalInsets)
|
||||||
|
|
||||||
if let inCallStatusBar = self.inCallStatusBar {
|
if let inCallStatusBar = self.inCallStatusBar {
|
||||||
let isLandscape = layout.size.width > layout.size.height
|
let isLandscape = layout.size.width > layout.size.height
|
||||||
@ -843,8 +856,6 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||||||
layout.additionalInsets.left = max(layout.intrinsicInsets.left, additionalSideInsets.left)
|
layout.additionalInsets.left = max(layout.intrinsicInsets.left, additionalSideInsets.left)
|
||||||
layout.additionalInsets.right = max(layout.intrinsicInsets.right, additionalSideInsets.right)
|
layout.additionalInsets.right = max(layout.intrinsicInsets.right, additionalSideInsets.right)
|
||||||
|
|
||||||
var updatedSize = layout.size
|
|
||||||
var updatedIntrinsicInsets = layout.intrinsicInsets
|
|
||||||
if case .flat = navigationLayout.root, let minimizedContainer = self.minimizedContainer {
|
if case .flat = navigationLayout.root, let minimizedContainer = self.minimizedContainer {
|
||||||
if minimizedContainer.supernode !== self.displayNode {
|
if minimizedContainer.supernode !== self.displayNode {
|
||||||
if let rootContainer = self.rootContainer, case let .flat(flatContainer) = rootContainer {
|
if let rootContainer = self.rootContainer, case let .flat(flatContainer) = rootContainer {
|
||||||
@ -857,10 +868,6 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||||||
self.displayNode.insertSubnode(minimizedContainer, at: 0)
|
self.displayNode.insertSubnode(minimizedContainer, at: 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (layout.inputHeight ?? 0.0).isZero {
|
|
||||||
updatedSize.height -= minimizedContainer.collapsedHeight(layout: layout)
|
|
||||||
updatedIntrinsicInsets.bottom = 0.0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch navigationLayout.root {
|
switch navigationLayout.root {
|
||||||
|
|||||||
@ -209,7 +209,7 @@ public final class DrawingLinkEntityView: DrawingEntityView, UITextViewDelegate
|
|||||||
if !self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
if !self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
string = self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
string = self.linkEntity.name.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||||
} else {
|
} else {
|
||||||
string = self.linkEntity.url.uppercased()
|
string = self.linkEntity.url.uppercased().replacingOccurrences(of: "http://", with: "").replacingOccurrences(of: "https://", with: "")
|
||||||
}
|
}
|
||||||
let text = NSMutableAttributedString(string: string)
|
let text = NSMutableAttributedString(string: string)
|
||||||
let range = NSMakeRange(0, text.length)
|
let range = NSMakeRange(0, text.length)
|
||||||
|
|||||||
@ -1799,9 +1799,13 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
|||||||
self.titleView.title = collection.localizedTitle ?? presentationData.strings.Attachment_Gallery
|
self.titleView.title = collection.localizedTitle ?? presentationData.strings.Attachment_Gallery
|
||||||
} else {
|
} else {
|
||||||
switch mode {
|
switch mode {
|
||||||
case .default, .createSticker:
|
case .default:
|
||||||
self.titleView.title = presentationData.strings.MediaPicker_Recents
|
self.titleView.title = presentationData.strings.MediaPicker_Recents
|
||||||
self.titleView.isEnabled = true
|
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:
|
case .story:
|
||||||
self.titleView.title = presentationData.strings.MediaPicker_Recents
|
self.titleView.title = presentationData.strings.MediaPicker_Recents
|
||||||
self.titleView.isEnabled = true
|
self.titleView.isEnabled = true
|
||||||
|
|||||||
@ -10,12 +10,14 @@ final class MediaPickerTitleView: UIView {
|
|||||||
let contextSourceNode: ContextReferenceContentNode
|
let contextSourceNode: ContextReferenceContentNode
|
||||||
private let buttonNode: HighlightTrackingButtonNode
|
private let buttonNode: HighlightTrackingButtonNode
|
||||||
private let titleNode: ImmediateTextNode
|
private let titleNode: ImmediateTextNode
|
||||||
|
private let subtitleNode: ImmediateTextNode
|
||||||
private let arrowNode: ASImageNode
|
private let arrowNode: ASImageNode
|
||||||
private let segmentedControlNode: SegmentedControlNode
|
private let segmentedControlNode: SegmentedControlNode
|
||||||
|
|
||||||
public var theme: PresentationTheme {
|
public var theme: PresentationTheme {
|
||||||
didSet {
|
didSet {
|
||||||
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: 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))
|
self.segmentedControlNode.updateTheme(SegmentedControlTheme(theme: self.theme))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,7 +25,16 @@ final class MediaPickerTitleView: UIView {
|
|||||||
public var title: String = "" {
|
public var title: String = "" {
|
||||||
didSet {
|
didSet {
|
||||||
if self.title != oldValue {
|
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()
|
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 animated {
|
||||||
if self.title != title {
|
if self.title != title {
|
||||||
if let snapshotView = self.titleNode.view.snapshotContentTree() {
|
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)
|
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 self.isEnabled != isEnabled {
|
||||||
if let snapshotView = self.arrowNode.view.snapshotContentTree() {
|
if let snapshotView = self.arrowNode.view.snapshotContentTree() {
|
||||||
snapshotView.frame = self.arrowNode.frame
|
snapshotView.frame = self.arrowNode.frame
|
||||||
@ -62,6 +84,7 @@ final class MediaPickerTitleView: UIView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.subtitle = subtitle
|
||||||
self.isEnabled = isEnabled
|
self.isEnabled = isEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +99,7 @@ final class MediaPickerTitleView: UIView {
|
|||||||
if self.segmentsHidden != oldValue {
|
if self.segmentsHidden != oldValue {
|
||||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut)
|
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.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.arrowNode, alpha: self.segmentsHidden ? 1.0 : 0.0)
|
||||||
transition.updateAlpha(node: self.segmentedControlNode, alpha: self.segmentsHidden ? 0.0 : 1.0)
|
transition.updateAlpha(node: self.segmentedControlNode, alpha: self.segmentsHidden ? 0.0 : 1.0)
|
||||||
self.segmentedControlNode.isUserInteractionEnabled = !self.segmentsHidden
|
self.segmentedControlNode.isUserInteractionEnabled = !self.segmentsHidden
|
||||||
@ -115,6 +139,9 @@ final class MediaPickerTitleView: UIView {
|
|||||||
self.titleNode = ImmediateTextNode()
|
self.titleNode = ImmediateTextNode()
|
||||||
self.titleNode.displaysAsynchronously = false
|
self.titleNode.displaysAsynchronously = false
|
||||||
|
|
||||||
|
self.subtitleNode = ImmediateTextNode()
|
||||||
|
self.subtitleNode.displaysAsynchronously = false
|
||||||
|
|
||||||
self.arrowNode = ASImageNode()
|
self.arrowNode = ASImageNode()
|
||||||
self.arrowNode.displaysAsynchronously = false
|
self.arrowNode.displaysAsynchronously = false
|
||||||
self.arrowNode.image = generateTintedImage(image: UIImage(bundleImageName: "Media Editor/DownArrow"), color: theme.rootController.navigationBar.secondaryTextColor)
|
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.contextSourceNode)
|
||||||
self.addSubnode(self.titleNode)
|
self.addSubnode(self.titleNode)
|
||||||
|
self.addSubnode(self.subtitleNode)
|
||||||
self.addSubnode(self.arrowNode)
|
self.addSubnode(self.arrowNode)
|
||||||
self.addSubnode(self.buttonNode)
|
self.addSubnode(self.buttonNode)
|
||||||
self.addSubnode(self.segmentedControlNode)
|
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)
|
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))
|
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 {
|
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)
|
self.buttonNode.frame = CGRect(origin: .zero, size: size)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1104,7 +1104,7 @@ private final class TwoFactorDataInputTextNode: ASDisplayNode, UITextFieldDelega
|
|||||||
self.hideButtonNode.isHidden = confirmation
|
self.hideButtonNode.isHidden = confirmation
|
||||||
case .email:
|
case .email:
|
||||||
self.inputNode.textField.keyboardType = .emailAddress
|
self.inputNode.textField.keyboardType = .emailAddress
|
||||||
self.inputNode.textField.returnKeyType = .done
|
self.inputNode.textField.returnKeyType = .next
|
||||||
self.hideButtonNode.isHidden = true
|
self.hideButtonNode.isHidden = true
|
||||||
|
|
||||||
if #available(iOS 12.0, *) {
|
if #available(iOS 12.0, *) {
|
||||||
@ -1134,7 +1134,7 @@ private final class TwoFactorDataInputTextNode: ASDisplayNode, UITextFieldDelega
|
|||||||
}
|
}
|
||||||
case .hint:
|
case .hint:
|
||||||
self.inputNode.textField.keyboardType = .asciiCapable
|
self.inputNode.textField.keyboardType = .asciiCapable
|
||||||
self.inputNode.textField.returnKeyType = .done
|
self.inputNode.textField.returnKeyType = .next
|
||||||
self.hideButtonNode.isHidden = true
|
self.hideButtonNode.isHidden = true
|
||||||
|
|
||||||
self.inputNode.textField.autocorrectionType = .no
|
self.inputNode.textField.autocorrectionType = .no
|
||||||
|
|||||||
@ -56,6 +56,10 @@ public func representationFetchRangeForDisplayAtSize(representation: TelegramMed
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceUserLocation, customUserContentType: MediaResourceUserContentType? = nil, photoReference: ImageMediaReference, fullRepresentationSize: CGSize = CGSize(width: 1280.0, height: 1280.0), autoFetchFullSize: Bool = false, tryAdditionalRepresentations: Bool = false, synchronousLoad: Bool = false, useMiniThumbnailIfAvailable: Bool = false, forceThumbnail: Bool = false, automaticFetch: Bool = true) -> Signal<Tuple4<Data?, Data?, ChatMessagePhotoQuality, Bool>, NoError> {
|
public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceUserLocation, customUserContentType: MediaResourceUserContentType? = nil, photoReference: ImageMediaReference, fullRepresentationSize: CGSize = CGSize(width: 1280.0, height: 1280.0), autoFetchFullSize: Bool = false, tryAdditionalRepresentations: Bool = false, synchronousLoad: Bool = false, useMiniThumbnailIfAvailable: Bool = false, forceThumbnail: Bool = false, automaticFetch: Bool = true) -> Signal<Tuple4<Data?, Data?, ChatMessagePhotoQuality, Bool>, NoError> {
|
||||||
|
return chatMessagePhotoDatas(mediaBox: postbox.mediaBox, userLocation: userLocation, customUserContentType: customUserContentType, photoReference: photoReference, fullRepresentationSize: fullRepresentationSize, autoFetchFullSize: autoFetchFullSize, tryAdditionalRepresentations: tryAdditionalRepresentations, synchronousLoad: synchronousLoad, useMiniThumbnailIfAvailable: useMiniThumbnailIfAvailable, forceThumbnail: forceThumbnail, automaticFetch: automaticFetch)
|
||||||
|
}
|
||||||
|
|
||||||
|
func chatMessagePhotoDatas(mediaBox: MediaBox, userLocation: MediaResourceUserLocation, customUserContentType: MediaResourceUserContentType? = nil, photoReference: ImageMediaReference, fullRepresentationSize: CGSize = CGSize(width: 1280.0, height: 1280.0), autoFetchFullSize: Bool = false, tryAdditionalRepresentations: Bool = false, synchronousLoad: Bool = false, useMiniThumbnailIfAvailable: Bool = false, forceThumbnail: Bool = false, automaticFetch: Bool = true) -> Signal<Tuple4<Data?, Data?, ChatMessagePhotoQuality, Bool>, NoError> {
|
||||||
if !forceThumbnail, let progressiveRepresentation = progressiveImageRepresentation(photoReference.media.representations), progressiveRepresentation.progressiveSizes.count > 1 {
|
if !forceThumbnail, let progressiveRepresentation = progressiveImageRepresentation(photoReference.media.representations), progressiveRepresentation.progressiveSizes.count > 1 {
|
||||||
enum SizeSource {
|
enum SizeSource {
|
||||||
case miniThumbnail(data: Data)
|
case miniThumbnail(data: Data)
|
||||||
@ -93,7 +97,7 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
case let .miniThumbnail(data):
|
case let .miniThumbnail(data):
|
||||||
return .single((source, data))
|
return .single((source, data))
|
||||||
case let .image(size):
|
case let .image(size):
|
||||||
return postbox.mediaBox.resourceData(progressiveRepresentation.resource, size: Int64(progressiveRepresentation.progressiveSizes.last!), in: 0 ..< size, mode: .incremental, notifyAboutIncomplete: true, attemptSynchronously: synchronousLoad)
|
return mediaBox.resourceData(progressiveRepresentation.resource, size: Int64(progressiveRepresentation.progressiveSizes.last!), in: 0 ..< size, mode: .incremental, notifyAboutIncomplete: true, attemptSynchronously: synchronousLoad)
|
||||||
|> map { (data, _) -> (SizeSource, Data?) in
|
|> map { (data, _) -> (SizeSource, Data?) in
|
||||||
return (source, data)
|
return (source, data)
|
||||||
}
|
}
|
||||||
@ -131,9 +135,9 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
var fetchDisposable: Disposable?
|
var fetchDisposable: Disposable?
|
||||||
if automaticFetch {
|
if automaticFetch {
|
||||||
if autoFetchFullSize {
|
if autoFetchFullSize {
|
||||||
fetchDisposable = fetchedMediaResource(mediaBox: postbox.mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(progressiveRepresentation.resource), range: (0 ..< Int64(largestByteSize), .default), statsCategory: .image).start()
|
fetchDisposable = fetchedMediaResource(mediaBox: mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(progressiveRepresentation.resource), range: (0 ..< Int64(largestByteSize), .default), statsCategory: .image).start()
|
||||||
} else if useMiniThumbnailIfAvailable {
|
} else if useMiniThumbnailIfAvailable {
|
||||||
fetchDisposable = fetchedMediaResource(mediaBox: postbox.mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(progressiveRepresentation.resource), range: (0 ..< Int64(thumbnailByteSize), .default), statsCategory: .image).start()
|
fetchDisposable = fetchedMediaResource(mediaBox: mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(progressiveRepresentation.resource), range: (0 ..< Int64(thumbnailByteSize), .default), statsCategory: .image).start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,8 +149,8 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !forceThumbnail || photoReference.media.immediateThumbnailData == nil, let smallestRepresentation = smallestImageRepresentation(photoReference.media.representations), let largestRepresentation = photoReference.media.representationForDisplayAtSize(PixelDimensions(width: Int32(fullRepresentationSize.width), height: Int32(fullRepresentationSize.height))), let fullRepresentation = largestImageRepresentation(photoReference.media.representations) {
|
if !forceThumbnail || photoReference.media.immediateThumbnailData == nil, let smallestRepresentation = smallestImageRepresentation(photoReference.media.representations), let largestRepresentation = photoReference.media.representationForDisplayAtSize(PixelDimensions(width: Int32(fullRepresentationSize.width), height: Int32(fullRepresentationSize.height))), let fullRepresentation = largestImageRepresentation(photoReference.media.representations) {
|
||||||
let maybeFullSize = postbox.mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
let maybeFullSize = mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
||||||
let maybeLargestSize = postbox.mediaBox.resourceData(fullRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
let maybeLargestSize = mediaBox.resourceData(fullRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
||||||
|
|
||||||
let signal = combineLatest(maybeFullSize, maybeLargestSize)
|
let signal = combineLatest(maybeFullSize, maybeLargestSize)
|
||||||
|> take(1)
|
|> take(1)
|
||||||
@ -163,16 +167,16 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
if let _ = decodedThumbnailData {
|
if let _ = decodedThumbnailData {
|
||||||
fetchedThumbnail = .complete()
|
fetchedThumbnail = .complete()
|
||||||
} else {
|
} else {
|
||||||
fetchedThumbnail = fetchedMediaResource(mediaBox: postbox.mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(smallestRepresentation.resource), statsCategory: .image)
|
fetchedThumbnail = fetchedMediaResource(mediaBox: mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(smallestRepresentation.resource), statsCategory: .image)
|
||||||
}
|
}
|
||||||
let fetchedFullSize = fetchedMediaResource(mediaBox: postbox.mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(largestRepresentation.resource), statsCategory: .image)
|
let fetchedFullSize = fetchedMediaResource(mediaBox: mediaBox, userLocation: userLocation, userContentType: customUserContentType ?? .image, reference: photoReference.resourceReference(largestRepresentation.resource), statsCategory: .image)
|
||||||
|
|
||||||
let anyThumbnail: [Signal<(MediaResourceData, ChatMessagePhotoQuality), NoError>]
|
let anyThumbnail: [Signal<(MediaResourceData, ChatMessagePhotoQuality), NoError>]
|
||||||
if tryAdditionalRepresentations {
|
if tryAdditionalRepresentations {
|
||||||
anyThumbnail = photoReference.media.representations.filter({ representation in
|
anyThumbnail = photoReference.media.representations.filter({ representation in
|
||||||
return representation != largestRepresentation
|
return representation != largestRepresentation
|
||||||
}).map({ representation -> Signal<(MediaResourceData, ChatMessagePhotoQuality), NoError> in
|
}).map({ representation -> Signal<(MediaResourceData, ChatMessagePhotoQuality), NoError> in
|
||||||
return postbox.mediaBox.resourceData(representation.resource)
|
return mediaBox.resourceData(representation.resource)
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> map { data -> (MediaResourceData, ChatMessagePhotoQuality) in
|
|> map { data -> (MediaResourceData, ChatMessagePhotoQuality) in
|
||||||
if representation.dimensions.width > 200 || representation.dimensions.height > 200 {
|
if representation.dimensions.width > 200 || representation.dimensions.height > 200 {
|
||||||
@ -193,7 +197,7 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
return EmptyDisposable
|
return EmptyDisposable
|
||||||
} else {
|
} else {
|
||||||
let fetchedDisposable = fetchedThumbnail.start()
|
let fetchedDisposable = fetchedThumbnail.start()
|
||||||
let thumbnailDisposable = postbox.mediaBox.resourceData(smallestRepresentation.resource, attemptSynchronously: synchronousLoad).start(next: { next in
|
let thumbnailDisposable = mediaBox.resourceData(smallestRepresentation.resource, attemptSynchronously: synchronousLoad).start(next: { next in
|
||||||
subscriber.putNext(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []))
|
subscriber.putNext(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []))
|
||||||
}, error: subscriber.putError, completed: subscriber.putCompletion)
|
}, error: subscriber.putError, completed: subscriber.putCompletion)
|
||||||
|
|
||||||
@ -222,7 +226,7 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
if autoFetchFullSize && !useMiniThumbnailIfAvailable {
|
if autoFetchFullSize && !useMiniThumbnailIfAvailable {
|
||||||
fullSizeData = Signal<Tuple2<Data?, Bool>, NoError> { subscriber in
|
fullSizeData = Signal<Tuple2<Data?, Bool>, NoError> { subscriber in
|
||||||
let fetchedFullSizeDisposable = fetchedFullSize.start()
|
let fetchedFullSizeDisposable = fetchedFullSize.start()
|
||||||
let fullSizeDisposable = postbox.mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad).start(next: { next in
|
let fullSizeDisposable = mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad).start(next: { next in
|
||||||
subscriber.putNext(Tuple(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []), next.complete))
|
subscriber.putNext(Tuple(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []), next.complete))
|
||||||
}, error: subscriber.putError, completed: subscriber.putCompletion)
|
}, error: subscriber.putError, completed: subscriber.putCompletion)
|
||||||
|
|
||||||
@ -232,7 +236,7 @@ public func chatMessagePhotoDatas(postbox: Postbox, userLocation: MediaResourceU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fullSizeData = postbox.mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
fullSizeData = mediaBox.resourceData(largestRepresentation.resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad)
|
||||||
|> map { next -> Tuple2<Data?, Bool> in
|
|> map { next -> Tuple2<Data?, Bool> in
|
||||||
return Tuple(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []), next.complete)
|
return Tuple(next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []), next.complete)
|
||||||
}
|
}
|
||||||
@ -600,6 +604,13 @@ public func chatMessagePhoto(postbox: Postbox, userLocation: MediaResourceUserLo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func chatMessagePhoto(mediaBox: MediaBox, userLocation: MediaResourceUserLocation, userContentType customUserContentType: MediaResourceUserContentType? = nil, photoReference: ImageMediaReference, synchronousLoad: Bool = false, highQuality: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||||
|
return chatMessagePhotoInternal(photoData: chatMessagePhotoDatas(mediaBox: mediaBox, userLocation: userLocation, customUserContentType: customUserContentType, photoReference: photoReference, tryAdditionalRepresentations: true, synchronousLoad: synchronousLoad), synchronousLoad: synchronousLoad)
|
||||||
|
|> map { _, _, generate in
|
||||||
|
return generate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum ChatMessagePhotoQuality {
|
public enum ChatMessagePhotoQuality {
|
||||||
case none
|
case none
|
||||||
case blurred
|
case blurred
|
||||||
|
|||||||
@ -208,7 +208,7 @@ final class WebBrowserDomainExceptionItemNode: ItemListRevealOptionsItemNode, It
|
|||||||
let iconSize = CGSize(width: 40.0, height: 40.0)
|
let iconSize = CGSize(width: 40.0, height: 40.0)
|
||||||
var imageSize = iconSize
|
var imageSize = iconSize
|
||||||
if currentItem?.icon?.id != item.icon?.id, let icon = item.icon {
|
if currentItem?.icon?.id != item.icon?.id, let icon = item.icon {
|
||||||
strongSelf.iconNode.setSignal(chatMessagePhoto(postbox: item.context.account.postbox, userLocation: .other, photoReference: .standalone(media: icon)))
|
strongSelf.iconNode.setSignal(chatMessagePhoto(mediaBox: item.context.sharedContext.accountManager.mediaBox, userLocation: .other, photoReference: .standalone(media: icon)))
|
||||||
}
|
}
|
||||||
if let icon = item.icon, let dimensions = largestImageRepresentation(icon.representations)?.dimensions.cgSize {
|
if let icon = item.icon, let dimensions = largestImageRepresentation(icon.representations)?.dimensions.cgSize {
|
||||||
imageSize = dimensions.aspectFilled(imageSize)
|
imageSize = dimensions.aspectFilled(imageSize)
|
||||||
|
|||||||
@ -21,6 +21,7 @@ private final class WebBrowserSettingsControllerArguments {
|
|||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
let updateDefaultBrowser: (String?) -> Void
|
let updateDefaultBrowser: (String?) -> Void
|
||||||
let clearCookies: () -> Void
|
let clearCookies: () -> Void
|
||||||
|
let clearCache: () -> Void
|
||||||
let addException: () -> Void
|
let addException: () -> Void
|
||||||
let removeException: (String) -> Void
|
let removeException: (String) -> Void
|
||||||
let clearExceptions: () -> Void
|
let clearExceptions: () -> Void
|
||||||
@ -29,6 +30,7 @@ private final class WebBrowserSettingsControllerArguments {
|
|||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
updateDefaultBrowser: @escaping (String?) -> Void,
|
updateDefaultBrowser: @escaping (String?) -> Void,
|
||||||
clearCookies: @escaping () -> Void,
|
clearCookies: @escaping () -> Void,
|
||||||
|
clearCache: @escaping () -> Void,
|
||||||
addException: @escaping () -> Void,
|
addException: @escaping () -> Void,
|
||||||
removeException: @escaping (String) -> Void,
|
removeException: @escaping (String) -> Void,
|
||||||
clearExceptions: @escaping () -> Void
|
clearExceptions: @escaping () -> Void
|
||||||
@ -36,6 +38,7 @@ private final class WebBrowserSettingsControllerArguments {
|
|||||||
self.context = context
|
self.context = context
|
||||||
self.updateDefaultBrowser = updateDefaultBrowser
|
self.updateDefaultBrowser = updateDefaultBrowser
|
||||||
self.clearCookies = clearCookies
|
self.clearCookies = clearCookies
|
||||||
|
self.clearCache = clearCache
|
||||||
self.addException = addException
|
self.addException = addException
|
||||||
self.removeException = removeException
|
self.removeException = removeException
|
||||||
self.clearExceptions = clearExceptions
|
self.clearExceptions = clearExceptions
|
||||||
@ -53,6 +56,7 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
case browser(PresentationTheme, String, OpenInApplication?, String?, Bool, Int32)
|
case browser(PresentationTheme, String, OpenInApplication?, String?, Bool, Int32)
|
||||||
|
|
||||||
case clearCookies(PresentationTheme, String)
|
case clearCookies(PresentationTheme, String)
|
||||||
|
case clearCache(PresentationTheme, String)
|
||||||
case clearCookiesInfo(PresentationTheme, String)
|
case clearCookiesInfo(PresentationTheme, String)
|
||||||
|
|
||||||
case exceptionsHeader(PresentationTheme, String)
|
case exceptionsHeader(PresentationTheme, String)
|
||||||
@ -65,7 +69,7 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
switch self {
|
switch self {
|
||||||
case .browserHeader, .browser:
|
case .browserHeader, .browser:
|
||||||
return WebBrowserSettingsSection.browsers.rawValue
|
return WebBrowserSettingsSection.browsers.rawValue
|
||||||
case .clearCookies, .clearCookiesInfo:
|
case .clearCookies, .clearCache, .clearCookiesInfo:
|
||||||
return WebBrowserSettingsSection.clearCookies.rawValue
|
return WebBrowserSettingsSection.clearCookies.rawValue
|
||||||
case .exceptionsHeader, .exceptionsAdd, .exception, .exceptionsClear, .exceptionsInfo:
|
case .exceptionsHeader, .exceptionsAdd, .exception, .exceptionsClear, .exceptionsInfo:
|
||||||
return WebBrowserSettingsSection.exceptions.rawValue
|
return WebBrowserSettingsSection.exceptions.rawValue
|
||||||
@ -80,12 +84,14 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
return UInt64(1 + index)
|
return UInt64(1 + index)
|
||||||
case .clearCookies:
|
case .clearCookies:
|
||||||
return 102
|
return 102
|
||||||
case .clearCookiesInfo:
|
case .clearCache:
|
||||||
return 103
|
return 103
|
||||||
case .exceptionsHeader:
|
case .clearCookiesInfo:
|
||||||
return 104
|
return 104
|
||||||
case .exceptionsAdd:
|
case .exceptionsHeader:
|
||||||
return 105
|
return 105
|
||||||
|
case .exceptionsAdd:
|
||||||
|
return 106
|
||||||
case let .exception(_, _, exception):
|
case let .exception(_, _, exception):
|
||||||
return 2000 + exception.domain.persistentHashValue
|
return 2000 + exception.domain.persistentHashValue
|
||||||
case .exceptionsClear:
|
case .exceptionsClear:
|
||||||
@ -103,14 +109,16 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
return 1 + index
|
return 1 + index
|
||||||
case .clearCookies:
|
case .clearCookies:
|
||||||
return 102
|
return 102
|
||||||
case .clearCookiesInfo:
|
case .clearCache:
|
||||||
return 103
|
return 103
|
||||||
case .exceptionsHeader:
|
case .clearCookiesInfo:
|
||||||
return 104
|
return 104
|
||||||
case .exceptionsAdd:
|
case .exceptionsHeader:
|
||||||
return 105
|
return 105
|
||||||
|
case .exceptionsAdd:
|
||||||
|
return 106
|
||||||
case let .exception(index, _, _):
|
case let .exception(index, _, _):
|
||||||
return 106 + index
|
return 107 + index
|
||||||
case .exceptionsClear:
|
case .exceptionsClear:
|
||||||
return 1000
|
return 1000
|
||||||
case .exceptionsInfo:
|
case .exceptionsInfo:
|
||||||
@ -138,6 +146,12 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case let .clearCache(lhsTheme, lhsText):
|
||||||
|
if case let .clearCache(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
case let .clearCookiesInfo(lhsTheme, lhsText):
|
case let .clearCookiesInfo(lhsTheme, lhsText):
|
||||||
if case let .clearCookiesInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
if case let .clearCookiesInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
return true
|
return true
|
||||||
@ -194,6 +208,10 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
|
|||||||
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.accentDeleteIconImage(presentationData.theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.accentDeleteIconImage(presentationData.theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
||||||
arguments.clearCookies()
|
arguments.clearCookies()
|
||||||
})
|
})
|
||||||
|
case let .clearCache(_, text):
|
||||||
|
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.accentDeleteIconImage(presentationData.theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
||||||
|
arguments.clearCache()
|
||||||
|
})
|
||||||
case let .clearCookiesInfo(_, text):
|
case let .clearCookiesInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
case let .exceptionsHeader(_, text):
|
case let .exceptionsHeader(_, text):
|
||||||
@ -232,6 +250,7 @@ private func webBrowserSettingsControllerEntries(context: AccountContext, presen
|
|||||||
|
|
||||||
if settings.defaultWebBrowser == nil {
|
if settings.defaultWebBrowser == nil {
|
||||||
entries.append(.clearCookies(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies))
|
entries.append(.clearCookies(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies))
|
||||||
|
// entries.append(.clearCache(presentationData.theme, presentationData.strings.WebBrowser_ClearCache))
|
||||||
entries.append(.clearCookiesInfo(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies_Info))
|
entries.append(.clearCookiesInfo(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies_Info))
|
||||||
|
|
||||||
entries.append(.exceptionsHeader(presentationData.theme, presentationData.strings.WebBrowser_Exceptions_Title))
|
entries.append(.exceptionsHeader(presentationData.theme, presentationData.strings.WebBrowser_Exceptions_Title))
|
||||||
@ -255,6 +274,7 @@ private func webBrowserSettingsControllerEntries(context: AccountContext, presen
|
|||||||
|
|
||||||
public func webBrowserSettingsController(context: AccountContext) -> ViewController {
|
public func webBrowserSettingsController(context: AccountContext) -> ViewController {
|
||||||
var clearCookiesImpl: (() -> Void)?
|
var clearCookiesImpl: (() -> Void)?
|
||||||
|
var clearCacheImpl: (() -> Void)?
|
||||||
var addExceptionImpl: (() -> Void)?
|
var addExceptionImpl: (() -> Void)?
|
||||||
var removeExceptionImpl: ((String) -> Void)?
|
var removeExceptionImpl: ((String) -> Void)?
|
||||||
var clearExceptionsImpl: (() -> Void)?
|
var clearExceptionsImpl: (() -> Void)?
|
||||||
@ -269,6 +289,9 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
|
|||||||
clearCookies: {
|
clearCookies: {
|
||||||
clearCookiesImpl?()
|
clearCookiesImpl?()
|
||||||
},
|
},
|
||||||
|
clearCache: {
|
||||||
|
clearCacheImpl?()
|
||||||
|
},
|
||||||
addException: {
|
addException: {
|
||||||
addExceptionImpl?()
|
addExceptionImpl?()
|
||||||
},
|
},
|
||||||
@ -320,7 +343,7 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
|
|||||||
actions: [
|
actions: [
|
||||||
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
|
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
|
||||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_ClearCookies_ClearConfirmation_Clear, action: {
|
TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_ClearCookies_ClearConfirmation_Clear, action: {
|
||||||
WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
|
WKWebsiteDataStore.default().removeData(ofTypes: [WKWebsiteDataTypeCookies, WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeSessionStorage], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
controller?.present(UndoOverlayController(
|
controller?.present(UndoOverlayController(
|
||||||
@ -341,6 +364,38 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
|
|||||||
controller?.present(alertController, in: .window(.root))
|
controller?.present(alertController, in: .window(.root))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearCacheImpl = { [weak controller] in
|
||||||
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
|
let alertController = textAlertController(
|
||||||
|
context: context,
|
||||||
|
updatedPresentationData: nil,
|
||||||
|
title: nil,
|
||||||
|
text: presentationData.strings.WebBrowser_ClearCache_ClearConfirmation_Text,
|
||||||
|
actions: [
|
||||||
|
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
|
||||||
|
TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_ClearCache_ClearConfirmation_Clear, action: {
|
||||||
|
WKWebsiteDataStore.default().removeData(ofTypes: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
|
||||||
|
|
||||||
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
controller?.present(UndoOverlayController(
|
||||||
|
presentationData: presentationData,
|
||||||
|
content: .info(
|
||||||
|
title: nil,
|
||||||
|
text: presentationData.strings.WebBrowser_ClearCache_Succeed,
|
||||||
|
timeout: nil,
|
||||||
|
customUndoText: nil
|
||||||
|
),
|
||||||
|
elevatedLayout: false,
|
||||||
|
position: .bottom,
|
||||||
|
action: { _ in return false }), in: .current
|
||||||
|
)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
)
|
||||||
|
controller?.present(alertController, in: .window(.root))
|
||||||
|
}
|
||||||
|
|
||||||
addExceptionImpl = { [weak controller] in
|
addExceptionImpl = { [weak controller] in
|
||||||
var dismissImpl: (() -> Void)?
|
var dismissImpl: (() -> Void)?
|
||||||
let linkController = webBrowserDomainController(context: context, apply: { url in
|
let linkController = webBrowserDomainController(context: context, apply: { url in
|
||||||
@ -424,7 +479,7 @@ private func fetchDomainExceptionInfo(context: AccountContext, url: String) -> S
|
|||||||
var image: TelegramMediaImage?
|
var image: TelegramMediaImage?
|
||||||
if let imageData, let parsedImage = UIImage(data: imageData) {
|
if let imageData, let parsedImage = UIImage(data: imageData) {
|
||||||
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
|
let resource = LocalFileMediaResource(fileId: Int64.random(in: Int64.min ... Int64.max))
|
||||||
context.account.postbox.mediaBox.storeResourceData(resource.id, data: imageData)
|
context.sharedContext.accountManager.mediaBox.storeResourceData(resource.id, data: imageData)
|
||||||
image = TelegramMediaImage(
|
image = TelegramMediaImage(
|
||||||
imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)),
|
imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: Int64.random(in: Int64.min ... Int64.max)),
|
||||||
representations: [
|
representations: [
|
||||||
|
|||||||
@ -178,10 +178,10 @@ final class MonetizationBalanceItemNode: ListViewItemNode, ItemListItemNode {
|
|||||||
if let stats = item.stats as? RevenueStats {
|
if let stats = item.stats as? RevenueStats {
|
||||||
let cryptoValue = formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator)
|
let cryptoValue = formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator)
|
||||||
amountString = tonAmountAttributedString(cryptoValue, integralFont: integralFont, fractionalFont: fractionalFont, color: item.presentationData.theme.list.itemPrimaryTextColor)
|
amountString = tonAmountAttributedString(cryptoValue, integralFont: integralFont, fractionalFont: fractionalFont, color: item.presentationData.theme.list.itemPrimaryTextColor)
|
||||||
value = stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate))"
|
value = stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))"
|
||||||
} else if let stats = item.stats as? StarsRevenueStats {
|
} else if let stats = item.stats as? StarsRevenueStats {
|
||||||
amountString = NSAttributedString(string: presentationStringsFormattedNumber(Int32(stats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator), font: integralFont, textColor: item.presentationData.theme.list.itemPrimaryTextColor)
|
amountString = NSAttributedString(string: presentationStringsFormattedNumber(Int32(stats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator), font: integralFont, textColor: item.presentationData.theme.list.itemPrimaryTextColor)
|
||||||
value = stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, divide: false, rate: stats.usdRate))"
|
value = stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, divide: false, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))"
|
||||||
isStars = true
|
isStars = true
|
||||||
} else {
|
} else {
|
||||||
fatalError()
|
fatalError()
|
||||||
|
|||||||
@ -774,7 +774,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Available,
|
item.presentationData.strings.Monetization_StarsProceeds_Available,
|
||||||
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.currentBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.currentBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Current,
|
item.presentationData.strings.Monetization_StarsProceeds_Current,
|
||||||
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -794,7 +794,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.overallRevenue, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.overallRevenue, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Total,
|
item.presentationData.strings.Monetization_StarsProceeds_Total,
|
||||||
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate))", .generic),
|
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(additionalStats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(additionalStats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
" ",
|
" ",
|
||||||
(additionalStats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.availableBalance, divide: false, rate: additionalStats.usdRate))", .generic),
|
(additionalStats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.availableBalance, divide: false, rate: additionalStats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -814,7 +814,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(additionalStats.balances.currentBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(additionalStats.balances.currentBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
" ",
|
" ",
|
||||||
(additionalStats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.currentBalance, divide: false, rate: additionalStats.usdRate))", .generic),
|
(additionalStats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.currentBalance, divide: false, rate: additionalStats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(additionalStats.balances.overallRevenue), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(additionalStats.balances.overallRevenue), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
" ",
|
" ",
|
||||||
(additionalStats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.overallRevenue, divide: false, rate: additionalStats.usdRate))", .generic),
|
(additionalStats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(additionalStats.balances.overallRevenue, divide: false, rate: additionalStats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.availableBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_Overview_Available,
|
item.presentationData.strings.Monetization_Overview_Available,
|
||||||
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.currentBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.currentBalance, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_Overview_Current,
|
item.presentationData.strings.Monetization_Overview_Current,
|
||||||
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -858,7 +858,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
formatTonAmountText(stats.balances.overallRevenue, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
formatTonAmountText(stats.balances.overallRevenue, decimalSeparator: item.presentationData.dateTimeFormat.decimalSeparator),
|
||||||
item.presentationData.strings.Monetization_Overview_Total,
|
item.presentationData.strings.Monetization_Overview_Total,
|
||||||
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate))", .generic),
|
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.ton
|
.ton
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -873,7 +873,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(stats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(stats.balances.availableBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Available,
|
item.presentationData.strings.Monetization_StarsProceeds_Available,
|
||||||
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.availableBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.availableBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -883,7 +883,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(stats.balances.currentBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(stats.balances.currentBalance), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Current,
|
item.presentationData.strings.Monetization_StarsProceeds_Current,
|
||||||
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate))", .generic),
|
(stats.balances.currentBalance == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.currentBalance, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -893,7 +893,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
|||||||
item.presentationData,
|
item.presentationData,
|
||||||
presentationStringsFormattedNumber(Int32(stats.balances.overallRevenue), item.presentationData.dateTimeFormat.groupingSeparator),
|
presentationStringsFormattedNumber(Int32(stats.balances.overallRevenue), item.presentationData.dateTimeFormat.groupingSeparator),
|
||||||
item.presentationData.strings.Monetization_StarsProceeds_Total,
|
item.presentationData.strings.Monetization_StarsProceeds_Total,
|
||||||
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate))", .generic),
|
(stats.balances.overallRevenue == 0 ? "" : "≈\(formatTonUsdValue(stats.balances.overallRevenue, rate: stats.usdRate, dateTimeFormat: item.presentationData.dateTimeFormat))", .generic),
|
||||||
.stars
|
.stars
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -355,6 +355,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1690108678] = { return Api.InputEncryptedFile.parse_inputEncryptedFileUploaded($0) }
|
dict[1690108678] = { return Api.InputEncryptedFile.parse_inputEncryptedFileUploaded($0) }
|
||||||
dict[-181407105] = { return Api.InputFile.parse_inputFile($0) }
|
dict[-181407105] = { return Api.InputFile.parse_inputFile($0) }
|
||||||
dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) }
|
dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) }
|
||||||
|
dict[1658620744] = { return Api.InputFile.parse_inputFileStoryDocument($0) }
|
||||||
dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
|
dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
|
||||||
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
|
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
|
||||||
dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
|
dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
|
||||||
@ -1401,7 +1402,7 @@ public extension Api {
|
|||||||
return parser(reader)
|
return parser(reader)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found")
|
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,115 @@
|
|||||||
|
public extension Api {
|
||||||
|
indirect enum InputInvoice: TypeConstructorDescription {
|
||||||
|
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
|
||||||
|
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
|
||||||
|
case inputInvoiceSlug(slug: String)
|
||||||
|
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputInvoiceMessage(let peer, let msgId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-977967015)
|
||||||
|
}
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputInvoicePremiumGiftCode(let purpose, let option):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1734841331)
|
||||||
|
}
|
||||||
|
purpose.serialize(buffer, true)
|
||||||
|
option.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
case .inputInvoiceSlug(let slug):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1020867857)
|
||||||
|
}
|
||||||
|
serializeString(slug, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputInvoiceStars(let purpose):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1710230755)
|
||||||
|
}
|
||||||
|
purpose.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputInvoiceMessage(let peer, let msgId):
|
||||||
|
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
|
||||||
|
case .inputInvoicePremiumGiftCode(let purpose, let option):
|
||||||
|
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
|
||||||
|
case .inputInvoiceSlug(let slug):
|
||||||
|
return ("inputInvoiceSlug", [("slug", slug as Any)])
|
||||||
|
case .inputInvoiceStars(let purpose):
|
||||||
|
return ("inputInvoiceStars", [("purpose", purpose as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
|
||||||
|
var _1: Api.InputPeer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
|
||||||
|
var _1: Api.InputStorePaymentPurpose?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
|
||||||
|
}
|
||||||
|
var _2: Api.PremiumGiftCodeOption?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_2 = Api.parse(reader, signature: signature) as? Api.PremiumGiftCodeOption
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
|
||||||
|
var _1: Api.InputStorePaymentPurpose?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
indirect enum InputMedia: TypeConstructorDescription {
|
indirect enum InputMedia: TypeConstructorDescription {
|
||||||
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
|
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
|
||||||
@ -918,171 +1030,3 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
|
||||||
indirect enum InputPeer: TypeConstructorDescription {
|
|
||||||
case inputPeerChannel(channelId: Int64, accessHash: Int64)
|
|
||||||
case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
|
|
||||||
case inputPeerChat(chatId: Int64)
|
|
||||||
case inputPeerEmpty
|
|
||||||
case inputPeerSelf
|
|
||||||
case inputPeerUser(userId: Int64, accessHash: Int64)
|
|
||||||
case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputPeerChannel(let channelId, let accessHash):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(666680316)
|
|
||||||
}
|
|
||||||
serializeInt64(channelId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1121318848)
|
|
||||||
}
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(channelId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputPeerChat(let chatId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(900291769)
|
|
||||||
}
|
|
||||||
serializeInt64(chatId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputPeerEmpty:
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(2134579434)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
case .inputPeerSelf:
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(2107670217)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
case .inputPeerUser(let userId, let accessHash):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-571955892)
|
|
||||||
}
|
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1468331492)
|
|
||||||
}
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputPeerChannel(let channelId, let accessHash):
|
|
||||||
return ("inputPeerChannel", [("channelId", channelId as Any), ("accessHash", accessHash as Any)])
|
|
||||||
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
|
|
||||||
return ("inputPeerChannelFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("channelId", channelId as Any)])
|
|
||||||
case .inputPeerChat(let chatId):
|
|
||||||
return ("inputPeerChat", [("chatId", chatId as Any)])
|
|
||||||
case .inputPeerEmpty:
|
|
||||||
return ("inputPeerEmpty", [])
|
|
||||||
case .inputPeerSelf:
|
|
||||||
return ("inputPeerSelf", [])
|
|
||||||
case .inputPeerUser(let userId, let accessHash):
|
|
||||||
return ("inputPeerUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
|
|
||||||
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
|
|
||||||
return ("inputPeerUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
var _1: Api.InputPeer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int64?
|
|
||||||
_3 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
if _c1 && _c2 && _c3 {
|
|
||||||
return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputPeer.inputPeerChat(chatId: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
return Api.InputPeer.inputPeerEmpty
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerSelf(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
return Api.InputPeer.inputPeerSelf
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
|
|
||||||
var _1: Api.InputPeer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int64?
|
|
||||||
_3 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
if _c1 && _c2 && _c3 {
|
|
||||||
return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,171 @@
|
|||||||
|
public extension Api {
|
||||||
|
indirect enum InputPeer: TypeConstructorDescription {
|
||||||
|
case inputPeerChannel(channelId: Int64, accessHash: Int64)
|
||||||
|
case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
|
||||||
|
case inputPeerChat(chatId: Int64)
|
||||||
|
case inputPeerEmpty
|
||||||
|
case inputPeerSelf
|
||||||
|
case inputPeerUser(userId: Int64, accessHash: Int64)
|
||||||
|
case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputPeerChannel(let channelId, let accessHash):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(666680316)
|
||||||
|
}
|
||||||
|
serializeInt64(channelId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1121318848)
|
||||||
|
}
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(channelId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputPeerChat(let chatId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(900291769)
|
||||||
|
}
|
||||||
|
serializeInt64(chatId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputPeerEmpty:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(2134579434)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputPeerSelf:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(2107670217)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputPeerUser(let userId, let accessHash):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-571955892)
|
||||||
|
}
|
||||||
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1468331492)
|
||||||
|
}
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputPeerChannel(let channelId, let accessHash):
|
||||||
|
return ("inputPeerChannel", [("channelId", channelId as Any), ("accessHash", accessHash as Any)])
|
||||||
|
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
|
||||||
|
return ("inputPeerChannelFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("channelId", channelId as Any)])
|
||||||
|
case .inputPeerChat(let chatId):
|
||||||
|
return ("inputPeerChat", [("chatId", chatId as Any)])
|
||||||
|
case .inputPeerEmpty:
|
||||||
|
return ("inputPeerEmpty", [])
|
||||||
|
case .inputPeerSelf:
|
||||||
|
return ("inputPeerSelf", [])
|
||||||
|
case .inputPeerUser(let userId, let accessHash):
|
||||||
|
return ("inputPeerUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
|
||||||
|
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
|
||||||
|
return ("inputPeerUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
var _1: Api.InputPeer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int64?
|
||||||
|
_3 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputPeer.inputPeerChat(chatId: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
return Api.InputPeer.inputPeerEmpty
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerSelf(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
return Api.InputPeer.inputPeerSelf
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
|
||||||
|
var _1: Api.InputPeer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int64?
|
||||||
|
_3 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum InputPeerNotifySettings: TypeConstructorDescription {
|
enum InputPeerNotifySettings: TypeConstructorDescription {
|
||||||
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?, storiesMuted: Api.Bool?, storiesHideSender: Api.Bool?, storiesSound: Api.NotificationSound?)
|
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?, storiesMuted: Api.Bool?, storiesHideSender: Api.Bool?, storiesSound: Api.NotificationSound?)
|
||||||
@ -510,321 +678,3 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
|
||||||
enum InputQuickReplyShortcut: TypeConstructorDescription {
|
|
||||||
case inputQuickReplyShortcut(shortcut: String)
|
|
||||||
case inputQuickReplyShortcutId(shortcutId: Int32)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputQuickReplyShortcut(let shortcut):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(609840449)
|
|
||||||
}
|
|
||||||
serializeString(shortcut, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputQuickReplyShortcutId(let shortcutId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(18418929)
|
|
||||||
}
|
|
||||||
serializeInt32(shortcutId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputQuickReplyShortcut(let shortcut):
|
|
||||||
return ("inputQuickReplyShortcut", [("shortcut", shortcut as Any)])
|
|
||||||
case .inputQuickReplyShortcutId(let shortcutId):
|
|
||||||
return ("inputQuickReplyShortcutId", [("shortcutId", shortcutId as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputQuickReplyShortcut(_ reader: BufferReader) -> InputQuickReplyShortcut? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputQuickReplyShortcutId(_ reader: BufferReader) -> InputQuickReplyShortcut? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
indirect enum InputReplyTo: TypeConstructorDescription {
|
|
||||||
case inputReplyToMessage(flags: Int32, replyToMsgId: Int32, topMsgId: Int32?, replyToPeerId: Api.InputPeer?, quoteText: String?, quoteEntities: [Api.MessageEntity]?, quoteOffset: Int32?)
|
|
||||||
case inputReplyToStory(peer: Api.InputPeer, storyId: Int32)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(583071445)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(replyToMsgId, buffer: buffer, boxed: false)
|
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
|
|
||||||
if Int(flags) & Int(1 << 1) != 0 {replyToPeerId!.serialize(buffer, true)}
|
|
||||||
if Int(flags) & Int(1 << 2) != 0 {serializeString(quoteText!, buffer: buffer, boxed: false)}
|
|
||||||
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(quoteEntities!.count))
|
|
||||||
for item in quoteEntities! {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}}
|
|
||||||
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(quoteOffset!, buffer: buffer, boxed: false)}
|
|
||||||
break
|
|
||||||
case .inputReplyToStory(let peer, let storyId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1484862010)
|
|
||||||
}
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeInt32(storyId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
|
|
||||||
return ("inputReplyToMessage", [("flags", flags as Any), ("replyToMsgId", replyToMsgId as Any), ("topMsgId", topMsgId as Any), ("replyToPeerId", replyToPeerId as Any), ("quoteText", quoteText as Any), ("quoteEntities", quoteEntities as Any), ("quoteOffset", quoteOffset as Any)])
|
|
||||||
case .inputReplyToStory(let peer, let storyId):
|
|
||||||
return ("inputReplyToStory", [("peer", peer as Any), ("storyId", storyId as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputReplyToMessage(_ reader: BufferReader) -> InputReplyTo? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int32?
|
|
||||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
|
||||||
var _4: Api.InputPeer?
|
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_4 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
} }
|
|
||||||
var _5: String?
|
|
||||||
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
|
|
||||||
var _6: [Api.MessageEntity]?
|
|
||||||
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
|
|
||||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
|
||||||
} }
|
|
||||||
var _7: Int32?
|
|
||||||
if Int(_1!) & Int(1 << 4) != 0 {_7 = reader.readInt32() }
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
|
||||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
|
||||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
|
||||||
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
|
||||||
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
|
||||||
return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputReplyToStory(_ reader: BufferReader) -> InputReplyTo? {
|
|
||||||
var _1: Api.InputPeer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
enum InputSecureFile: TypeConstructorDescription {
|
|
||||||
case inputSecureFile(id: Int64, accessHash: Int64)
|
|
||||||
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputSecureFile(let id, let accessHash):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1399317950)
|
|
||||||
}
|
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(859091184)
|
|
||||||
}
|
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
|
||||||
serializeString(md5Checksum, buffer: buffer, boxed: false)
|
|
||||||
serializeBytes(fileHash, buffer: buffer, boxed: false)
|
|
||||||
serializeBytes(secret, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputSecureFile(let id, let accessHash):
|
|
||||||
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
|
|
||||||
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
|
|
||||||
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: String?
|
|
||||||
_3 = parseString(reader)
|
|
||||||
var _4: Buffer?
|
|
||||||
_4 = parseBytes(reader)
|
|
||||||
var _5: Buffer?
|
|
||||||
_5 = parseBytes(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
let _c5 = _5 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
|
||||||
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
enum InputSecureValue: TypeConstructorDescription {
|
|
||||||
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-618540889)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
type.serialize(buffer, true)
|
|
||||||
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
|
|
||||||
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
|
|
||||||
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
|
|
||||||
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
|
|
||||||
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(translation!.count))
|
|
||||||
for item in translation! {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}}
|
|
||||||
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(files!.count))
|
|
||||||
for item in files! {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}}
|
|
||||||
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
|
|
||||||
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Api.SecureValueType?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
|
|
||||||
}
|
|
||||||
var _3: Api.SecureData?
|
|
||||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
|
|
||||||
} }
|
|
||||||
var _4: Api.InputSecureFile?
|
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
|
||||||
} }
|
|
||||||
var _5: Api.InputSecureFile?
|
|
||||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
|
||||||
} }
|
|
||||||
var _6: Api.InputSecureFile?
|
|
||||||
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
|
||||||
} }
|
|
||||||
var _7: [Api.InputSecureFile]?
|
|
||||||
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
|
|
||||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
|
|
||||||
} }
|
|
||||||
var _8: [Api.InputSecureFile]?
|
|
||||||
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
|
|
||||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
|
|
||||||
} }
|
|
||||||
var _9: Api.SecurePlainData?
|
|
||||||
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
|
|
||||||
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
|
|
||||||
} }
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
|
||||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
|
||||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
|
||||||
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
|
||||||
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
|
|
||||||
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
|
|
||||||
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
|
||||||
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,321 @@
|
|||||||
|
public extension Api {
|
||||||
|
enum InputQuickReplyShortcut: TypeConstructorDescription {
|
||||||
|
case inputQuickReplyShortcut(shortcut: String)
|
||||||
|
case inputQuickReplyShortcutId(shortcutId: Int32)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputQuickReplyShortcut(let shortcut):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(609840449)
|
||||||
|
}
|
||||||
|
serializeString(shortcut, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputQuickReplyShortcutId(let shortcutId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(18418929)
|
||||||
|
}
|
||||||
|
serializeInt32(shortcutId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputQuickReplyShortcut(let shortcut):
|
||||||
|
return ("inputQuickReplyShortcut", [("shortcut", shortcut as Any)])
|
||||||
|
case .inputQuickReplyShortcutId(let shortcutId):
|
||||||
|
return ("inputQuickReplyShortcutId", [("shortcutId", shortcutId as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputQuickReplyShortcut(_ reader: BufferReader) -> InputQuickReplyShortcut? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputQuickReplyShortcutId(_ reader: BufferReader) -> InputQuickReplyShortcut? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
indirect enum InputReplyTo: TypeConstructorDescription {
|
||||||
|
case inputReplyToMessage(flags: Int32, replyToMsgId: Int32, topMsgId: Int32?, replyToPeerId: Api.InputPeer?, quoteText: String?, quoteEntities: [Api.MessageEntity]?, quoteOffset: Int32?)
|
||||||
|
case inputReplyToStory(peer: Api.InputPeer, storyId: Int32)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(583071445)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(replyToMsgId, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 1) != 0 {replyToPeerId!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 2) != 0 {serializeString(quoteText!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(quoteEntities!.count))
|
||||||
|
for item in quoteEntities! {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}}
|
||||||
|
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(quoteOffset!, buffer: buffer, boxed: false)}
|
||||||
|
break
|
||||||
|
case .inputReplyToStory(let peer, let storyId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1484862010)
|
||||||
|
}
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(storyId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
|
||||||
|
return ("inputReplyToMessage", [("flags", flags as Any), ("replyToMsgId", replyToMsgId as Any), ("topMsgId", topMsgId as Any), ("replyToPeerId", replyToPeerId as Any), ("quoteText", quoteText as Any), ("quoteEntities", quoteEntities as Any), ("quoteOffset", quoteOffset as Any)])
|
||||||
|
case .inputReplyToStory(let peer, let storyId):
|
||||||
|
return ("inputReplyToStory", [("peer", peer as Any), ("storyId", storyId as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputReplyToMessage(_ reader: BufferReader) -> InputReplyTo? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||||
|
var _4: Api.InputPeer?
|
||||||
|
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_4 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
} }
|
||||||
|
var _5: String?
|
||||||
|
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
|
||||||
|
var _6: [Api.MessageEntity]?
|
||||||
|
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
|
||||||
|
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||||
|
} }
|
||||||
|
var _7: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 4) != 0 {_7 = reader.readInt32() }
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||||
|
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||||
|
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||||
|
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||||
|
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||||
|
return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputReplyToStory(_ reader: BufferReader) -> InputReplyTo? {
|
||||||
|
var _1: Api.InputPeer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
enum InputSecureFile: TypeConstructorDescription {
|
||||||
|
case inputSecureFile(id: Int64, accessHash: Int64)
|
||||||
|
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputSecureFile(let id, let accessHash):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1399317950)
|
||||||
|
}
|
||||||
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(859091184)
|
||||||
|
}
|
||||||
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||||
|
serializeString(md5Checksum, buffer: buffer, boxed: false)
|
||||||
|
serializeBytes(fileHash, buffer: buffer, boxed: false)
|
||||||
|
serializeBytes(secret, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputSecureFile(let id, let accessHash):
|
||||||
|
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
|
||||||
|
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
|
||||||
|
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: String?
|
||||||
|
_3 = parseString(reader)
|
||||||
|
var _4: Buffer?
|
||||||
|
_4 = parseBytes(reader)
|
||||||
|
var _5: Buffer?
|
||||||
|
_5 = parseBytes(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
let _c5 = _5 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
|
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
enum InputSecureValue: TypeConstructorDescription {
|
||||||
|
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-618540889)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
type.serialize(buffer, true)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(translation!.count))
|
||||||
|
for item in translation! {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}}
|
||||||
|
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(files!.count))
|
||||||
|
for item in files! {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}}
|
||||||
|
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
|
||||||
|
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Api.SecureValueType?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
|
||||||
|
}
|
||||||
|
var _3: Api.SecureData?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
|
||||||
|
} }
|
||||||
|
var _4: Api.InputSecureFile?
|
||||||
|
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
||||||
|
} }
|
||||||
|
var _5: Api.InputSecureFile?
|
||||||
|
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
||||||
|
} }
|
||||||
|
var _6: Api.InputSecureFile?
|
||||||
|
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
|
||||||
|
} }
|
||||||
|
var _7: [Api.InputSecureFile]?
|
||||||
|
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
|
||||||
|
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
|
||||||
|
} }
|
||||||
|
var _8: [Api.InputSecureFile]?
|
||||||
|
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
|
||||||
|
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
|
||||||
|
} }
|
||||||
|
var _9: Api.SecurePlainData?
|
||||||
|
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
|
||||||
|
} }
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||||
|
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||||
|
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||||
|
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
|
||||||
|
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
|
||||||
|
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
|
||||||
|
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||||
|
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
indirect enum InputSingleMedia: TypeConstructorDescription {
|
indirect enum InputSingleMedia: TypeConstructorDescription {
|
||||||
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
|
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
|
||||||
@ -760,177 +1078,3 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
|
||||||
indirect enum InputUser: TypeConstructorDescription {
|
|
||||||
case inputUser(userId: Int64, accessHash: Int64)
|
|
||||||
case inputUserEmpty
|
|
||||||
case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
|
|
||||||
case inputUserSelf
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputUser(let userId, let accessHash):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-233744186)
|
|
||||||
}
|
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputUserEmpty:
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1182234929)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
case .inputUserFromMessage(let peer, let msgId, let userId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(497305826)
|
|
||||||
}
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputUserSelf:
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-138301121)
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputUser(let userId, let accessHash):
|
|
||||||
return ("inputUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
|
|
||||||
case .inputUserEmpty:
|
|
||||||
return ("inputUserEmpty", [])
|
|
||||||
case .inputUserFromMessage(let peer, let msgId, let userId):
|
|
||||||
return ("inputUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
|
|
||||||
case .inputUserSelf:
|
|
||||||
return ("inputUserSelf", [])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
|
|
||||||
return Api.InputUser.inputUserEmpty
|
|
||||||
}
|
|
||||||
public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
|
|
||||||
var _1: Api.InputPeer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int64?
|
|
||||||
_3 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
if _c1 && _c2 && _c3 {
|
|
||||||
return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
|
|
||||||
return Api.InputUser.inputUserSelf
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
enum InputWallPaper: TypeConstructorDescription {
|
|
||||||
case inputWallPaper(id: Int64, accessHash: Int64)
|
|
||||||
case inputWallPaperNoFile(id: Int64)
|
|
||||||
case inputWallPaperSlug(slug: String)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputWallPaper(let id, let accessHash):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-433014407)
|
|
||||||
}
|
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputWallPaperNoFile(let id):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1770371538)
|
|
||||||
}
|
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputWallPaperSlug(let slug):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1913199744)
|
|
||||||
}
|
|
||||||
serializeString(slug, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputWallPaper(let id, let accessHash):
|
|
||||||
return ("inputWallPaper", [("id", id as Any), ("accessHash", accessHash as Any)])
|
|
||||||
case .inputWallPaperNoFile(let id):
|
|
||||||
return ("inputWallPaperNoFile", [("id", id as Any)])
|
|
||||||
case .inputWallPaperSlug(let slug):
|
|
||||||
return ("inputWallPaperSlug", [("slug", slug as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
|
|
||||||
var _1: Int64?
|
|
||||||
_1 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,177 @@
|
|||||||
|
public extension Api {
|
||||||
|
indirect enum InputUser: TypeConstructorDescription {
|
||||||
|
case inputUser(userId: Int64, accessHash: Int64)
|
||||||
|
case inputUserEmpty
|
||||||
|
case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
|
||||||
|
case inputUserSelf
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputUser(let userId, let accessHash):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-233744186)
|
||||||
|
}
|
||||||
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputUserEmpty:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1182234929)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputUserFromMessage(let peer, let msgId, let userId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(497305826)
|
||||||
|
}
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
serializeInt32(msgId, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputUserSelf:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-138301121)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputUser(let userId, let accessHash):
|
||||||
|
return ("inputUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
|
||||||
|
case .inputUserEmpty:
|
||||||
|
return ("inputUserEmpty", [])
|
||||||
|
case .inputUserFromMessage(let peer, let msgId, let userId):
|
||||||
|
return ("inputUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
|
||||||
|
case .inputUserSelf:
|
||||||
|
return ("inputUserSelf", [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputUser.inputUser(userId: _1!, accessHash: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
|
||||||
|
return Api.InputUser.inputUserEmpty
|
||||||
|
}
|
||||||
|
public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
|
||||||
|
var _1: Api.InputPeer?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
}
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int64?
|
||||||
|
_3 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
|
||||||
|
return Api.InputUser.inputUserSelf
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
enum InputWallPaper: TypeConstructorDescription {
|
||||||
|
case inputWallPaper(id: Int64, accessHash: Int64)
|
||||||
|
case inputWallPaperNoFile(id: Int64)
|
||||||
|
case inputWallPaperSlug(slug: String)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .inputWallPaper(let id, let accessHash):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-433014407)
|
||||||
|
}
|
||||||
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputWallPaperNoFile(let id):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1770371538)
|
||||||
|
}
|
||||||
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .inputWallPaperSlug(let slug):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1913199744)
|
||||||
|
}
|
||||||
|
serializeString(slug, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .inputWallPaper(let id, let accessHash):
|
||||||
|
return ("inputWallPaper", [("id", id as Any), ("accessHash", accessHash as Any)])
|
||||||
|
case .inputWallPaperNoFile(let id):
|
||||||
|
return ("inputWallPaperNoFile", [("id", id as Any)])
|
||||||
|
case .inputWallPaperSlug(let slug):
|
||||||
|
return ("inputWallPaperSlug", [("slug", slug as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
|
||||||
|
var _1: Int64?
|
||||||
|
_1 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum InputWebDocument: TypeConstructorDescription {
|
enum InputWebDocument: TypeConstructorDescription {
|
||||||
case inputWebDocument(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
|
case inputWebDocument(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
|
||||||
@ -900,139 +1074,3 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
|
||||||
enum KeyboardButtonRow: TypeConstructorDescription {
|
|
||||||
case keyboardButtonRow(buttons: [Api.KeyboardButton])
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .keyboardButtonRow(let buttons):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(2002815875)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(buttons.count))
|
|
||||||
for item in buttons {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .keyboardButtonRow(let buttons):
|
|
||||||
return ("keyboardButtonRow", [("buttons", buttons as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
|
|
||||||
var _1: [Api.KeyboardButton]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
enum LabeledPrice: TypeConstructorDescription {
|
|
||||||
case labeledPrice(label: String, amount: Int64)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .labeledPrice(let label, let amount):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-886477832)
|
|
||||||
}
|
|
||||||
serializeString(label, buffer: buffer, boxed: false)
|
|
||||||
serializeInt64(amount, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .labeledPrice(let label, let amount):
|
|
||||||
return ("labeledPrice", [("label", label as Any), ("amount", amount as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
var _2: Int64?
|
|
||||||
_2 = reader.readInt64()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api {
|
|
||||||
enum LangPackDifference: TypeConstructorDescription {
|
|
||||||
case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-209337866)
|
|
||||||
}
|
|
||||||
serializeString(langCode, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(fromVersion, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(version, buffer: buffer, boxed: false)
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(strings.count))
|
|
||||||
for item in strings {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
|
|
||||||
return ("langPackDifference", [("langCode", langCode as Any), ("fromVersion", fromVersion as Any), ("version", version as Any), ("strings", strings as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int32?
|
|
||||||
_3 = reader.readInt32()
|
|
||||||
var _4: [Api.LangPackString]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 {
|
|
||||||
return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,139 @@
|
|||||||
|
public extension Api {
|
||||||
|
enum KeyboardButtonRow: TypeConstructorDescription {
|
||||||
|
case keyboardButtonRow(buttons: [Api.KeyboardButton])
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .keyboardButtonRow(let buttons):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(2002815875)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(buttons.count))
|
||||||
|
for item in buttons {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .keyboardButtonRow(let buttons):
|
||||||
|
return ("keyboardButtonRow", [("buttons", buttons as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
|
||||||
|
var _1: [Api.KeyboardButton]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
enum LabeledPrice: TypeConstructorDescription {
|
||||||
|
case labeledPrice(label: String, amount: Int64)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .labeledPrice(let label, let amount):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-886477832)
|
||||||
|
}
|
||||||
|
serializeString(label, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(amount, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .labeledPrice(let label, let amount):
|
||||||
|
return ("labeledPrice", [("label", label as Any), ("amount", amount as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api {
|
||||||
|
enum LangPackDifference: TypeConstructorDescription {
|
||||||
|
case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-209337866)
|
||||||
|
}
|
||||||
|
serializeString(langCode, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(fromVersion, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(version, buffer: buffer, boxed: false)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(strings.count))
|
||||||
|
for item in strings {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
|
||||||
|
return ("langPackDifference", [("langCode", langCode as Any), ("fromVersion", fromVersion as Any), ("version", version as Any), ("strings", strings as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
var _4: [Api.LangPackString]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum LangPackLanguage: TypeConstructorDescription {
|
enum LangPackLanguage: TypeConstructorDescription {
|
||||||
case langPackLanguage(flags: Int32, name: String, nativeName: String, langCode: String, baseLangCode: String?, pluralCode: String, stringsCount: Int32, translatedCount: Int32, translationsUrl: String)
|
case langPackLanguage(flags: Int32, name: String, nativeName: String, langCode: String, baseLangCode: String?, pluralCode: String, stringsCount: Int32, translatedCount: Int32, translationsUrl: String)
|
||||||
|
|||||||
@ -412,6 +412,7 @@ public extension Api {
|
|||||||
enum InputFile: TypeConstructorDescription {
|
enum InputFile: TypeConstructorDescription {
|
||||||
case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String)
|
case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String)
|
||||||
case inputFileBig(id: Int64, parts: Int32, name: String)
|
case inputFileBig(id: Int64, parts: Int32, name: String)
|
||||||
|
case inputFileStoryDocument(id: Api.InputDocument)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -432,6 +433,12 @@ public extension Api {
|
|||||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||||
serializeString(name, buffer: buffer, boxed: false)
|
serializeString(name, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .inputFileStoryDocument(let id):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1658620744)
|
||||||
|
}
|
||||||
|
id.serialize(buffer, true)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,6 +448,8 @@ public extension Api {
|
|||||||
return ("inputFile", [("id", id as Any), ("parts", parts as Any), ("name", name as Any), ("md5Checksum", md5Checksum as Any)])
|
return ("inputFile", [("id", id as Any), ("parts", parts as Any), ("name", name as Any), ("md5Checksum", md5Checksum as Any)])
|
||||||
case .inputFileBig(let id, let parts, let name):
|
case .inputFileBig(let id, let parts, let name):
|
||||||
return ("inputFileBig", [("id", id as Any), ("parts", parts as Any), ("name", name as Any)])
|
return ("inputFileBig", [("id", id as Any), ("parts", parts as Any), ("name", name as Any)])
|
||||||
|
case .inputFileStoryDocument(let id):
|
||||||
|
return ("inputFileStoryDocument", [("id", id as Any)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,6 +490,19 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_inputFileStoryDocument(_ reader: BufferReader) -> InputFile? {
|
||||||
|
var _1: Api.InputDocument?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.InputFile.inputFileStoryDocument(id: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1002,115 +1024,3 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api {
|
|
||||||
indirect enum InputInvoice: TypeConstructorDescription {
|
|
||||||
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
|
|
||||||
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
|
|
||||||
case inputInvoiceSlug(slug: String)
|
|
||||||
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .inputInvoiceMessage(let peer, let msgId):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-977967015)
|
|
||||||
}
|
|
||||||
peer.serialize(buffer, true)
|
|
||||||
serializeInt32(msgId, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputInvoicePremiumGiftCode(let purpose, let option):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1734841331)
|
|
||||||
}
|
|
||||||
purpose.serialize(buffer, true)
|
|
||||||
option.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
case .inputInvoiceSlug(let slug):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1020867857)
|
|
||||||
}
|
|
||||||
serializeString(slug, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .inputInvoiceStars(let purpose):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1710230755)
|
|
||||||
}
|
|
||||||
purpose.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .inputInvoiceMessage(let peer, let msgId):
|
|
||||||
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
|
|
||||||
case .inputInvoicePremiumGiftCode(let purpose, let option):
|
|
||||||
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
|
|
||||||
case .inputInvoiceSlug(let slug):
|
|
||||||
return ("inputInvoiceSlug", [("slug", slug as Any)])
|
|
||||||
case .inputInvoiceStars(let purpose):
|
|
||||||
return ("inputInvoiceStars", [("purpose", purpose as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
|
|
||||||
var _1: Api.InputPeer?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
|
||||||
}
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
|
|
||||||
var _1: Api.InputStorePaymentPurpose?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
|
|
||||||
}
|
|
||||||
var _2: Api.PremiumGiftCodeOption?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_2 = Api.parse(reader, signature: signature) as? Api.PremiumGiftCodeOption
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
|
|
||||||
var _1: Api.InputStorePaymentPurpose?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ private func copyOrMoveResourceData(from fromResource: MediaResource, to toResou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: Bool) {
|
func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: Bool, skipPreviews: Bool = false) {
|
||||||
if let fromImage = from as? TelegramMediaImage, let toImage = to as? TelegramMediaImage {
|
if let fromImage = from as? TelegramMediaImage, let toImage = to as? TelegramMediaImage {
|
||||||
let fromSmallestRepresentation = smallestImageRepresentation(fromImage.representations)
|
let fromSmallestRepresentation = smallestImageRepresentation(fromImage.representations)
|
||||||
if let fromSmallestRepresentation = fromSmallestRepresentation, let toSmallestRepresentation = smallestImageRepresentation(toImage.representations) {
|
if let fromSmallestRepresentation = fromSmallestRepresentation, let toSmallestRepresentation = smallestImageRepresentation(toImage.representations) {
|
||||||
@ -32,11 +32,13 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile {
|
} else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile {
|
||||||
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
|
if !skipPreviews {
|
||||||
copyOrMoveResourceData(from: fromPreview.resource, to: toPreview.resource, mediaBox: postbox.mediaBox)
|
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
|
||||||
}
|
copyOrMoveResourceData(from: fromPreview.resource, to: toPreview.resource, mediaBox: postbox.mediaBox)
|
||||||
if let fromVideoThumbnail = fromFile.videoThumbnails.first, let toVideoThumbnail = toFile.videoThumbnails.first, fromVideoThumbnail.resource.id != toVideoThumbnail.resource.id {
|
}
|
||||||
copyOrMoveResourceData(from: fromVideoThumbnail.resource, to: toVideoThumbnail.resource, mediaBox: postbox.mediaBox)
|
if let fromVideoThumbnail = fromFile.videoThumbnails.first, let toVideoThumbnail = toFile.videoThumbnails.first, fromVideoThumbnail.resource.id != toVideoThumbnail.resource.id {
|
||||||
|
copyOrMoveResourceData(from: fromVideoThumbnail.resource, to: toVideoThumbnail.resource, mediaBox: postbox.mediaBox)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let videoFirstFrameFromPath = postbox.mediaBox.cachedRepresentationCompletePath(fromFile.resource.id, keepDuration: .general, representationId: "first-frame")
|
let videoFirstFrameFromPath = postbox.mediaBox.cachedRepresentationCompletePath(fromFile.resource.id, keepDuration: .general, representationId: "first-frame")
|
||||||
let videoFirstFrameToPath = postbox.mediaBox.cachedRepresentationCompletePath(toFile.resource.id, keepDuration: .general, representationId: "first-frame")
|
let videoFirstFrameToPath = postbox.mediaBox.cachedRepresentationCompletePath(toFile.resource.id, keepDuration: .general, representationId: "first-frame")
|
||||||
|
|||||||
@ -2076,32 +2076,60 @@ public extension TelegramEngine.EngineData.Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct BotMenu: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
public struct BotMenu: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
||||||
public typealias Result = Optional<BotMenuButton>
|
public typealias Result = Optional<BotMenuButton>
|
||||||
|
|
||||||
fileprivate var id: EnginePeer.Id
|
fileprivate var id: EnginePeer.Id
|
||||||
public var mapKey: EnginePeer.Id {
|
public var mapKey: EnginePeer.Id {
|
||||||
return self.id
|
return self.id
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(id: EnginePeer.Id) {
|
public init(id: EnginePeer.Id) {
|
||||||
self.id = id
|
self.id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
var key: PostboxViewKey {
|
var key: PostboxViewKey {
|
||||||
return .cachedPeerData(peerId: self.id)
|
return .cachedPeerData(peerId: self.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func extract(view: PostboxView) -> Result {
|
func extract(view: PostboxView) -> Result {
|
||||||
guard let view = view as? CachedPeerDataView else {
|
guard let view = view as? CachedPeerDataView else {
|
||||||
preconditionFailure()
|
preconditionFailure()
|
||||||
}
|
}
|
||||||
if let cachedData = view.cachedPeerData as? CachedUserData {
|
if let cachedData = view.cachedPeerData as? CachedUserData {
|
||||||
return cachedData.botInfo?.menuButton
|
return cachedData.botInfo?.menuButton
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct BotCommands: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
||||||
|
public typealias Result = Optional<[BotCommand]>
|
||||||
|
|
||||||
|
fileprivate var id: EnginePeer.Id
|
||||||
|
public var mapKey: EnginePeer.Id {
|
||||||
|
return self.id
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(id: EnginePeer.Id) {
|
||||||
|
self.id = id
|
||||||
|
}
|
||||||
|
|
||||||
|
var key: PostboxViewKey {
|
||||||
|
return .cachedPeerData(peerId: self.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func extract(view: PostboxView) -> Result {
|
||||||
|
guard let view = view as? CachedPeerDataView else {
|
||||||
|
preconditionFailure()
|
||||||
|
}
|
||||||
|
if let cachedData = view.cachedPeerData as? CachedUserData {
|
||||||
|
return cachedData.botInfo?.commands
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1498,9 +1498,13 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng
|
|||||||
return .single(.progress(progress.progress))
|
return .single(.progress(progress.progress))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updatingCoverTime = false
|
||||||
let inputMedia: Api.InputMedia?
|
let inputMedia: Api.InputMedia?
|
||||||
if let result = result, case let .content(uploadedContent) = result, case let .media(media, _) = uploadedContent.content {
|
if let result = result, case let .content(uploadedContent) = result, case let .media(media, _) = uploadedContent.content {
|
||||||
inputMedia = media
|
inputMedia = media
|
||||||
|
} else if case let .existing(media) = media, let file = media as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
|
||||||
|
inputMedia = .inputMediaUploadedDocument(flags: 0, file: .inputFileStoryDocument(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), thumb: nil, mimeType: file.mimeType, attributes: inputDocumentAttributesFromFileAttributes(file.attributes), stickers: nil, ttlSeconds: nil)
|
||||||
|
updatingCoverTime = true
|
||||||
} else {
|
} else {
|
||||||
inputMedia = nil
|
inputMedia = nil
|
||||||
}
|
}
|
||||||
@ -1566,7 +1570,7 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng
|
|||||||
case let .storyItem(_, _, _, _, _, _, _, _, media, _, _, _, _):
|
case let .storyItem(_, _, _, _, _, _, _, _, media, _, _, _, _):
|
||||||
let (parsedMedia, _, _, _, _) = textMediaAndExpirationTimerFromApiMedia(media, account.peerId)
|
let (parsedMedia, _, _, _, _) = textMediaAndExpirationTimerFromApiMedia(media, account.peerId)
|
||||||
if let parsedMedia = parsedMedia, let originalMedia = originalMedia {
|
if let parsedMedia = parsedMedia, let originalMedia = originalMedia {
|
||||||
applyMediaResourceChanges(from: originalMedia, to: parsedMedia, postbox: account.postbox, force: false)
|
applyMediaResourceChanges(from: originalMedia, to: parsedMedia, postbox: account.postbox, force: false, skipPreviews: updatingCoverTime)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import TelegramPresentationData
|
||||||
|
|
||||||
let walletAddressLength: Int = 48
|
let walletAddressLength: Int = 48
|
||||||
|
|
||||||
@ -9,9 +10,20 @@ public func formatTonAddress(_ address: String) -> String {
|
|||||||
return address
|
return address
|
||||||
}
|
}
|
||||||
|
|
||||||
public func formatTonUsdValue(_ value: Int64, divide: Bool = true, rate: Double) -> String {
|
public func formatTonUsdValue(_ value: Int64, divide: Bool = true, rate: Double, dateTimeFormat: PresentationDateTimeFormat) -> String {
|
||||||
|
let decimalSeparator = dateTimeFormat.decimalSeparator
|
||||||
let normalizedValue: Double = divide ? Double(value) / 1000000000 : Double(value)
|
let normalizedValue: Double = divide ? Double(value) / 1000000000 : Double(value)
|
||||||
let formattedValue = String(format: "%0.2f", normalizedValue * rate)
|
var formattedValue = String(format: "%0.2f", normalizedValue * rate)
|
||||||
|
formattedValue = formattedValue.replacingOccurrences(of: ".", with: decimalSeparator)
|
||||||
|
if let dotIndex = formattedValue.firstIndex(of: decimalSeparator.first!) {
|
||||||
|
let integerPartString = formattedValue[..<dotIndex]
|
||||||
|
if let integerPart = Int32(integerPartString) {
|
||||||
|
let modifiedIntegerPart = presentationStringsFormattedNumber(integerPart, dateTimeFormat.groupingSeparator)
|
||||||
|
|
||||||
|
let resultString = "$\(modifiedIntegerPart)\(formattedValue[dotIndex...])"
|
||||||
|
return resultString
|
||||||
|
}
|
||||||
|
}
|
||||||
return "$\(formattedValue)"
|
return "$\(formattedValue)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ swift_library(
|
|||||||
"//submodules/ReactionSelectionNode",
|
"//submodules/ReactionSelectionNode",
|
||||||
"//submodules/TelegramUI/Components/Chat/ChatMediaInputStickerGridItem",
|
"//submodules/TelegramUI/Components/Chat/ChatMediaInputStickerGridItem",
|
||||||
"//submodules/PremiumUI",
|
"//submodules/PremiumUI",
|
||||||
|
"//submodules/TelegramUI/Components/LottieComponent",
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import ReactionSelectionNode
|
|||||||
import ChatMediaInputStickerGridItem
|
import ChatMediaInputStickerGridItem
|
||||||
import UndoUI
|
import UndoUI
|
||||||
import PremiumUI
|
import PremiumUI
|
||||||
|
import LottieComponent
|
||||||
|
|
||||||
private protocol ChatEmptyNodeContent {
|
private protocol ChatEmptyNodeContent {
|
||||||
func updateLayout(interfaceState: ChatPresentationInterfaceState, subject: ChatEmptyNode.Subject, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
|
func updateLayout(interfaceState: ChatPresentationInterfaceState, subject: ChatEmptyNode.Subject, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
|
||||||
@ -1203,7 +1204,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
|||||||
private let interaction: ChatPanelInterfaceInteraction?
|
private let interaction: ChatPanelInterfaceInteraction?
|
||||||
|
|
||||||
private let iconBackground: SimpleLayer
|
private let iconBackground: SimpleLayer
|
||||||
private let icon: UIImageView
|
private let icon = ComponentView<Empty>()
|
||||||
private let text = ComponentView<Empty>()
|
private let text = ComponentView<Empty>()
|
||||||
private let buttonTitle = ComponentView<Empty>()
|
private let buttonTitle = ComponentView<Empty>()
|
||||||
private let button: HighlightTrackingButton
|
private let button: HighlightTrackingButton
|
||||||
@ -1219,8 +1220,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
|||||||
self.interaction = interaction
|
self.interaction = interaction
|
||||||
|
|
||||||
self.iconBackground = SimpleLayer()
|
self.iconBackground = SimpleLayer()
|
||||||
self.icon = UIImageView(image: UIImage(bundleImageName: "Chat/Empty Chat/PremiumRequiredIcon")?.withRenderingMode(.alwaysTemplate))
|
|
||||||
|
|
||||||
self.button = HighlightTrackingButton()
|
self.button = HighlightTrackingButton()
|
||||||
self.button.clipsToBounds = true
|
self.button.clipsToBounds = true
|
||||||
|
|
||||||
@ -1230,7 +1230,6 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
|||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
self.layer.addSublayer(self.iconBackground)
|
self.layer.addSublayer(self.iconBackground)
|
||||||
self.view.addSubview(self.icon)
|
|
||||||
|
|
||||||
if !self.isPremiumDisabled {
|
if !self.isPremiumDisabled {
|
||||||
self.view.addSubview(self.button)
|
self.view.addSubview(self.button)
|
||||||
@ -1330,11 +1329,28 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
|
|||||||
contentsHeight += iconBackgroundSize
|
contentsHeight += iconBackgroundSize
|
||||||
contentsHeight += iconTextSpacing
|
contentsHeight += iconTextSpacing
|
||||||
|
|
||||||
self.icon.tintColor = serviceColor.primaryText
|
let iconSize = self.icon.update(
|
||||||
if let image = self.icon.image {
|
transition: .immediate,
|
||||||
transition.updateFrame(view: self.icon, frame: CGRect(origin: CGPoint(x: iconBackgroundFrame.minX + floor((iconBackgroundFrame.width - image.size.width) * 0.5), y: iconBackgroundFrame.minY + floor((iconBackgroundFrame.height - image.size.height) * 0.5)), size: image.size))
|
component: AnyComponent(
|
||||||
|
LottieComponent(
|
||||||
|
content: LottieComponent.AppBundleContent(name: "PremiumRequired"),
|
||||||
|
color: serviceColor.primaryText,
|
||||||
|
size: CGSize(width: 120.0, height: 120.0),
|
||||||
|
loop: true
|
||||||
|
)
|
||||||
|
),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: maxWidth - sideInset * 2.0, height: 500.0)
|
||||||
|
)
|
||||||
|
let iconFrame = CGRect(origin: CGPoint(x: iconBackgroundFrame.minX + floor((iconBackgroundFrame.width - iconSize.width) * 0.5), y: iconBackgroundFrame.minY + floor((iconBackgroundFrame.height - iconSize.height) * 0.5)), size: iconSize)
|
||||||
|
if let iconView = self.icon.view {
|
||||||
|
if iconView.superview == nil {
|
||||||
|
iconView.isUserInteractionEnabled = false
|
||||||
|
self.view.addSubview(iconView)
|
||||||
|
}
|
||||||
|
iconView.frame = iconFrame
|
||||||
}
|
}
|
||||||
|
|
||||||
let textFrame = CGRect(origin: CGPoint(x: floor((contentsWidth - textSize.width) * 0.5), y: contentsHeight), size: textSize)
|
let textFrame = CGRect(origin: CGPoint(x: floor((contentsWidth - textSize.width) * 0.5), y: contentsHeight), size: textSize)
|
||||||
if let textView = self.text.view {
|
if let textView = self.text.view {
|
||||||
if textView.superview == nil {
|
if textView.superview == nil {
|
||||||
|
|||||||
@ -395,7 +395,11 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
|
|||||||
actionTitle = item.presentationData.strings.Conversation_ViewMessage
|
actionTitle = item.presentationData.strings.Conversation_ViewMessage
|
||||||
}
|
}
|
||||||
case "telegram_user":
|
case "telegram_user":
|
||||||
actionTitle = item.presentationData.strings.Conversation_UserSendMessage
|
if webpage.displayUrl.contains("?profile") {
|
||||||
|
actionTitle = item.presentationData.strings.Conversation_OpenProfile
|
||||||
|
} else {
|
||||||
|
actionTitle = item.presentationData.strings.Conversation_UserSendMessage
|
||||||
|
}
|
||||||
case "telegram_channel_request":
|
case "telegram_channel_request":
|
||||||
actionTitle = item.presentationData.strings.Conversation_RequestToJoinChannel
|
actionTitle = item.presentationData.strings.Conversation_RequestToJoinChannel
|
||||||
case "telegram_chat_request", "telegram_megagroup_request":
|
case "telegram_chat_request", "telegram_megagroup_request":
|
||||||
|
|||||||
@ -466,14 +466,21 @@ private final class CreateLinkSheetComponent: CombinedComponent {
|
|||||||
let text = !self.name.isEmpty ? self.name : self.link
|
let text = !self.name.isEmpty ? self.name : self.link
|
||||||
|
|
||||||
var effectiveMedia: TelegramMediaWebpage?
|
var effectiveMedia: TelegramMediaWebpage?
|
||||||
if let webpage = self.webpage, case .Loaded = webpage.content, !self.dismissed {
|
var webpageHasLargeMedia = false
|
||||||
|
if let webpage = self.webpage, case let .Loaded(content) = webpage.content, !self.dismissed {
|
||||||
effectiveMedia = webpage
|
effectiveMedia = webpage
|
||||||
|
|
||||||
|
if let isMediaLargeByDefault = content.isMediaLargeByDefault, isMediaLargeByDefault {
|
||||||
|
webpageHasLargeMedia = true
|
||||||
|
} else {
|
||||||
|
webpageHasLargeMedia = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributes: [MessageAttribute] = []
|
var attributes: [MessageAttribute] = []
|
||||||
attributes.append(TextEntitiesMessageAttribute(entities: [.init(range: 0 ..< (text as NSString).length, type: .Url)]))
|
attributes.append(TextEntitiesMessageAttribute(entities: [.init(range: 0 ..< (text as NSString).length, type: .Url)]))
|
||||||
if !self.dismissed {
|
if !self.dismissed {
|
||||||
attributes.append(WebpagePreviewMessageAttribute(leadingPreview: !self.positionBelowText, forceLargeMedia: self.largeMedia, isManuallyAdded: false, isSafe: true))
|
attributes.append(WebpagePreviewMessageAttribute(leadingPreview: !self.positionBelowText, forceLargeMedia: self.largeMedia ?? webpageHasLargeMedia, isManuallyAdded: false, isSafe: true))
|
||||||
}
|
}
|
||||||
|
|
||||||
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1))
|
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1))
|
||||||
|
|||||||
@ -83,6 +83,17 @@ public extension MediaEditorScreen {
|
|||||||
transitionOut: nil
|
transitionOut: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var videoPlaybackPosition = videoPlaybackPosition
|
||||||
|
if cover, case let .file(file) = storyItem.media {
|
||||||
|
videoPlaybackPosition = 0.0
|
||||||
|
for attribute in file.attributes {
|
||||||
|
if case let .Video(_, _, _, _, coverTime) = attribute {
|
||||||
|
videoPlaybackPosition = coverTime
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var updateProgressImpl: ((Float) -> Void)?
|
var updateProgressImpl: ((Float) -> Void)?
|
||||||
let controller = MediaEditorScreen(
|
let controller = MediaEditorScreen(
|
||||||
context: context,
|
context: context,
|
||||||
@ -248,7 +259,7 @@ public extension MediaEditorScreen {
|
|||||||
var updatedAttributes: [TelegramMediaFileAttribute] = []
|
var updatedAttributes: [TelegramMediaFileAttribute] = []
|
||||||
for attribute in file.attributes {
|
for attribute in file.attributes {
|
||||||
if case let .Video(duration, size, flags, preloadSize, _) = attribute {
|
if case let .Video(duration, size, flags, preloadSize, _) = attribute {
|
||||||
updatedAttributes.append(.Video(duration: duration, size: size, flags: flags, preloadSize: preloadSize, coverTime: updatedCoverTimestamp))
|
updatedAttributes.append(.Video(duration: duration, size: size, flags: flags, preloadSize: preloadSize, coverTime: min(duration, updatedCoverTimestamp)))
|
||||||
} else {
|
} else {
|
||||||
updatedAttributes.append(attribute)
|
updatedAttributes.append(attribute)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2945,7 +2945,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
|
|
||||||
let mediaEditor = MediaEditor(context: self.context, mode: isStickerEditor ? .sticker : .default, subject: effectiveSubject.editorSubject, values: initialValues, hasHistogram: true)
|
let mediaEditor = MediaEditor(context: self.context, mode: isStickerEditor ? .sticker : .default, subject: effectiveSubject.editorSubject, values: initialValues, hasHistogram: true)
|
||||||
if let initialVideoPosition = controller.initialVideoPosition {
|
if let initialVideoPosition = controller.initialVideoPosition {
|
||||||
mediaEditor.seek(initialVideoPosition, andPlay: true)
|
if controller.isEditingStoryCover {
|
||||||
|
mediaEditor.setCoverImageTimestamp(initialVideoPosition)
|
||||||
|
} else {
|
||||||
|
mediaEditor.seek(initialVideoPosition, andPlay: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if case .message = subject, self.context.sharedContext.currentPresentationData.with({$0}).autoNightModeTriggered {
|
if case .message = subject, self.context.sharedContext.currentPresentationData.with({$0}).autoNightModeTriggered {
|
||||||
mediaEditor.setNightTheme(true)
|
mediaEditor.setNightTheme(true)
|
||||||
|
|||||||
@ -168,7 +168,7 @@ final class StarsBalanceComponent: Component {
|
|||||||
|
|
||||||
let subtitleText: String
|
let subtitleText: String
|
||||||
if let rate = component.rate {
|
if let rate = component.rate {
|
||||||
subtitleText = "≈\(formatStarsUsdValue(component.count, rate: rate))"
|
subtitleText = "≈\(formatTonUsdValue(component.count, divide: false, rate: rate, dateTimeFormat: component.dateTimeFormat))"
|
||||||
} else {
|
} else {
|
||||||
subtitleText = component.strings.Stars_Intro_YourBalance
|
subtitleText = component.strings.Stars_Intro_YourBalance
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import AccountContext
|
|||||||
import MultilineTextComponent
|
import MultilineTextComponent
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
import PresentationDataUtils
|
import PresentationDataUtils
|
||||||
|
import TelegramStringFormatting
|
||||||
|
|
||||||
final class StarsOverviewItemComponent: Component {
|
final class StarsOverviewItemComponent: Component {
|
||||||
let theme: PresentationTheme
|
let theme: PresentationTheme
|
||||||
@ -80,7 +81,7 @@ final class StarsOverviewItemComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let valueString = presentationStringsFormattedNumber(Int32(component.value), component.dateTimeFormat.groupingSeparator)
|
let valueString = presentationStringsFormattedNumber(Int32(component.value), component.dateTimeFormat.groupingSeparator)
|
||||||
let usdValueString = formatStarsUsdValue(component.value, rate: component.rate)
|
let usdValueString = formatTonUsdValue(component.value, divide: false, rate: component.rate, dateTimeFormat: component.dateTimeFormat)
|
||||||
|
|
||||||
let valueSize = self.value.update(
|
let valueSize = self.value.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
|
|||||||
@ -538,7 +538,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
component.buy()
|
component.buy()
|
||||||
},
|
},
|
||||||
buyAds: nil,
|
buyAds: nil,
|
||||||
additionalAction: AnyComponent(
|
additionalAction: premiumConfiguration.starsGiftsPurchaseAvailable ? AnyComponent(
|
||||||
Button(
|
Button(
|
||||||
content: AnyComponent(
|
content: AnyComponent(
|
||||||
HStack([
|
HStack([
|
||||||
@ -548,7 +548,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
),
|
),
|
||||||
AnyComponentWithIdentity(
|
AnyComponentWithIdentity(
|
||||||
id: "label",
|
id: "label",
|
||||||
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: "Gift Stars to Friends", font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor))))
|
component: AnyComponent(MultilineTextComponent(text: .plain(NSAttributedString(string: environment.strings.Stars_Intro_GiftStars, font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor))))
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
spacing: 6.0)
|
spacing: 6.0)
|
||||||
@ -557,7 +557,7 @@ final class StarsTransactionsScreenComponent: Component {
|
|||||||
component.gift()
|
component.gift()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
) : nil
|
||||||
)
|
)
|
||||||
))]
|
))]
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
import Foundation
|
|
||||||
|
|
||||||
func formatStarsUsdValue(_ value: Int64, rate: Double) -> String {
|
|
||||||
let formattedValue = String(format: "%0.2f", (Double(value)) * rate)
|
|
||||||
return "$\(formattedValue)"
|
|
||||||
}
|
|
||||||
@ -1389,7 +1389,7 @@ public class VideoMessageCameraScreen: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var backgroundFrame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: controller.inputPanelFrame.0.minY))
|
var backgroundFrame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: controller.inputPanelFrame.0.minY))
|
||||||
if backgroundFrame.maxY < layout.size.height - 100.0 && (layout.inputHeight ?? 0.0).isZero && !controller.inputPanelFrame.1 {
|
if backgroundFrame.maxY < layout.size.height - 100.0 && (layout.inputHeight ?? 0.0).isZero && !controller.inputPanelFrame.1 && layout.additionalInsets.bottom.isZero {
|
||||||
backgroundFrame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: layout.size.height - layout.intrinsicInsets.bottom - controller.inputPanelFrame.0.height))
|
backgroundFrame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: layout.size.height - layout.intrinsicInsets.bottom - controller.inputPanelFrame.0.height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "privacy (2).pdf",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy (2).pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Privacy.imageset/privacy (2).pdf
vendored
Normal file
Binary file not shown.
BIN
submodules/TelegramUI/Resources/Animations/PremiumRequired.tgs
Normal file
BIN
submodules/TelegramUI/Resources/Animations/PremiumRequired.tgs
Normal file
Binary file not shown.
@ -135,11 +135,11 @@ func openWebAppImpl(context: AccountContext, parentController: ViewController, u
|
|||||||
}
|
}
|
||||||
}, didDismiss: { [weak parentController] in
|
}, didDismiss: { [weak parentController] in
|
||||||
if let parentController = parentController as? ChatControllerImpl {
|
if let parentController = parentController as? ChatControllerImpl {
|
||||||
let isFocused = parentController.chatDisplayNode.textInputPanelNode?.isFocused ?? false
|
// let isFocused = parentController.chatDisplayNode.textInputPanelNode?.isFocused ?? false
|
||||||
parentController.chatDisplayNode.insertSubnode(parentController.chatDisplayNode.inputPanelContainerNode, aboveSubnode: parentController.chatDisplayNode.inputContextPanelContainer)
|
// parentController.chatDisplayNode.insertSubnode(parentController.chatDisplayNode.inputPanelContainerNode, aboveSubnode: parentController.chatDisplayNode.inputContextPanelContainer)
|
||||||
if isFocused {
|
// if isFocused {
|
||||||
parentController.chatDisplayNode.textInputPanelNode?.ensureFocused()
|
// parentController.chatDisplayNode.textInputPanelNode?.ensureFocused()
|
||||||
}
|
// }
|
||||||
|
|
||||||
parentController.updateChatPresentationInterfaceState(interactive: false) { state in
|
parentController.updateChatPresentationInterfaceState(interactive: false) { state in
|
||||||
return state.updatedForceInputCommandsHidden(false)
|
return state.updatedForceInputCommandsHidden(false)
|
||||||
|
|||||||
@ -678,9 +678,9 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
|
|||||||
var coverTime: Double?
|
var coverTime: Double?
|
||||||
if let coverImageTimestamp = values.coverImageTimestamp {
|
if let coverImageTimestamp = values.coverImageTimestamp {
|
||||||
if let trimRange = values.videoTrimRange {
|
if let trimRange = values.videoTrimRange {
|
||||||
coverTime = coverImageTimestamp - trimRange.lowerBound
|
coverTime = min(duration, coverImageTimestamp - trimRange.lowerBound)
|
||||||
} else {
|
} else {
|
||||||
coverTime = coverImageTimestamp
|
coverTime = min(duration, coverImageTimestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1987,7 +1987,12 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
@objc private func morePressed(node: ContextReferenceContentNode, gesture: ContextGesture?) {
|
@objc private func morePressed(node: ContextReferenceContentNode, gesture: ContextGesture?) {
|
||||||
let context = self.context
|
let context = self.context
|
||||||
let presentationData = self.presentationData
|
var presentationData = self.presentationData
|
||||||
|
if !presentationData.theme.overallDarkAppearance, let headerColor = self.controllerNode.headerColor {
|
||||||
|
if headerColor.lightness < 0.5 {
|
||||||
|
presentationData = presentationData.withUpdated(theme: defaultDarkPresentationTheme)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let peerId = self.peerId
|
let peerId = self.peerId
|
||||||
let botId = self.botId
|
let botId = self.botId
|
||||||
@ -1998,10 +2003,11 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
let items = combineLatest(queue: Queue.mainQueue(),
|
let items = combineLatest(queue: Queue.mainQueue(),
|
||||||
context.engine.messages.attachMenuBots(),
|
context.engine.messages.attachMenuBots(),
|
||||||
context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.botId))
|
context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.botId)),
|
||||||
|
context.engine.data.get(TelegramEngine.EngineData.Item.Peer.BotCommands(id: self.botId))
|
||||||
)
|
)
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> map { [weak self] attachMenuBots, botPeer -> ContextController.Items in
|
|> map { [weak self] attachMenuBots, botPeer, botCommands -> ContextController.Items in
|
||||||
var items: [ContextMenuItem] = []
|
var items: [ContextMenuItem] = []
|
||||||
|
|
||||||
let attachMenuBot = attachMenuBots.first(where: { $0.peer.id == botId && !$0.flags.contains(.notActivated) })
|
let attachMenuBot = attachMenuBots.first(where: { $0.peer.id == botId && !$0.flags.contains(.notActivated) })
|
||||||
@ -2068,7 +2074,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
|
|
||||||
self?.controllerNode.webView?.reload()
|
self?.controllerNode.webView?.reload()
|
||||||
})))
|
})))
|
||||||
|
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_TermsOfUse, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_TermsOfUse, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.contextMenu.primaryColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] c, _ in
|
}, action: { [weak self] c, _ in
|
||||||
@ -2088,6 +2094,28 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
|
|
||||||
|
if let botCommands {
|
||||||
|
for command in botCommands {
|
||||||
|
if command.text == "privacy" {
|
||||||
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_PrivacyPolicy, icon: { theme in
|
||||||
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Privacy"), color: theme.contextMenu.primaryColor)
|
||||||
|
}, action: { [weak self] c, _ in
|
||||||
|
c?.dismiss(completion: nil)
|
||||||
|
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let _ = enqueueMessages(account: self.context.account, peerId: self.botId, messages: [.message(text: "/privacy", attributes: [], inlineStickers: [:], mediaReference: nil, threadId: nil, replyToMessageId: nil, replyToStoryId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])]).startStandalone()
|
||||||
|
|
||||||
|
if let botPeer, let navigationController = self.getNavigationController() {
|
||||||
|
(self.parentController() as? AttachmentController)?.minimizeIfNeeded()
|
||||||
|
self.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: self.context, chatLocation: .peer(botPeer)))
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let _ = attachMenuBot, [.attachMenu, .settings, .generic].contains(source) {
|
if let _ = attachMenuBot, [.attachMenu, .settings, .generic].contains(source) {
|
||||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_RemoveBot, textColor: .destructive, icon: { theme in
|
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_RemoveBot, textColor: .destructive, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
|
||||||
@ -2109,7 +2137,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
return ContextController.Items(content: .list(items))
|
return ContextController.Items(content: .list(items))
|
||||||
}
|
}
|
||||||
|
|
||||||
let contextController = ContextController(presentationData: self.presentationData, source: .reference(WebAppContextReferenceContentSource(controller: self, sourceNode: node)), items: items, gesture: gesture)
|
let contextController = ContextController(presentationData: presentationData, source: .reference(WebAppContextReferenceContentSource(controller: self, sourceNode: node)), items: items, gesture: gesture)
|
||||||
self.presentInGlobalOverlay(contextController)
|
self.presentInGlobalOverlay(contextController)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app": "10.14.3",
|
"app": "10.15",
|
||||||
"xcode": "15.2",
|
"xcode": "15.2",
|
||||||
"bazel": "7.1.1",
|
"bazel": "7.1.1",
|
||||||
"macos": "13.0"
|
"macos": "13.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user